/* Generated by Cython 3.1.2 */

/* BEGIN: Cython Metadata
{
    "distutils": {
        "depends": [
            "/home/runner/work/pysam/pysam/htslib/htslib/bgzf.h",
            "/home/runner/work/pysam/pysam/htslib/htslib/cram.h",
            "/home/runner/work/pysam/pysam/htslib/htslib/faidx.h",
            "/home/runner/work/pysam/pysam/htslib/htslib/hfile.h",
            "/home/runner/work/pysam/pysam/htslib/htslib/hts.h",
            "/home/runner/work/pysam/pysam/htslib/htslib/kstring.h",
            "/home/runner/work/pysam/pysam/htslib/htslib/sam.h",
            "/home/runner/work/pysam/pysam/htslib/htslib/tbx.h",
            "/home/runner/work/pysam/pysam/htslib/htslib/vcf.h",
            "/home/runner/work/pysam/pysam/htslib/htslib/vcfutils.h",
            "/home/runner/work/pysam/pysam/pysam/htslib_util.h"
        ],
        "extra_compile_args": [
            "-Wno-unused",
            "-Wno-strict-prototypes",
            "-Wno-sign-compare",
            "-Wno-error=declaration-after-statement"
        ],
        "include_dirs": [
            "pysam",
            "/home/runner/work/pysam/pysam/pysam",
            "/home/runner/work/pysam/pysam/htslib",
            "/home/runner/work/pysam/pysam/samtools",
            "/home/runner/work/pysam/pysam/samtools/lz4",
            "/home/runner/work/pysam/pysam/bcftools",
            "/home/runner/work/pysam/pysam"
        ],
        "language": "c",
        "libraries": [
            "z",
            "lzma",
            "bz2",
            "z",
            "m",
            "curl",
            "crypto",
            "chtslib.cpython-310-x86_64-linux-gnu",
            "cutils.cpython-310-x86_64-linux-gnu"
        ],
        "library_dirs": [
            "/home/runner/work/pysam/pysam/pysam",
            "/home/runner/work/pysam/pysam"
        ],
        "name": "pysam.libcbcf",
        "sources": [
            "pysam/libcbcf.pyx"
        ]
    },
    "module_name": "pysam.libcbcf"
}
END: Cython Metadata */

#ifndef PY_SSIZE_T_CLEAN
#define PY_SSIZE_T_CLEAN
#endif /* PY_SSIZE_T_CLEAN */
/* InitLimitedAPI */
#if defined(Py_LIMITED_API) && !defined(CYTHON_LIMITED_API)
  #define CYTHON_LIMITED_API 1
#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_1_2"
#define CYTHON_HEX_VERSION 0x030102F0
#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 HAVE_LONG_LONG
  #define HAVE_LONG_LONG
#endif
#ifndef PY_LONG_LONG
  #define PY_LONG_LONG LONG_LONG
#endif
#ifndef Py_HUGE_VAL
  #define Py_HUGE_VAL HUGE_VAL
#endif
#define __PYX_LIMITED_VERSION_HEX PY_VERSION_HEX
#if defined(GRAALVM_PYTHON)
  /* For very preliminary testing purposes. Most variables are set the same as PyPy.
     The existence of this section does not imply that anything works or is even tested */
  #define CYTHON_COMPILING_IN_PYPY 0
  #define CYTHON_COMPILING_IN_CPYTHON 0
  #define CYTHON_COMPILING_IN_LIMITED_API 0
  #define CYTHON_COMPILING_IN_GRAAL 1
  #define CYTHON_COMPILING_IN_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 1
  #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
#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
#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_CLINE_IN_TRACEBACK
  #define CYTHON_CLINE_IN_TRACEBACK 0
  #undef CYTHON_USE_TYPE_SLOTS
  #define CYTHON_USE_TYPE_SLOTS 0
  #undef CYTHON_USE_TYPE_SPECS
  #define CYTHON_USE_TYPE_SPECS 1
  #undef CYTHON_USE_PYTYPE_LOOKUP
  #define CYTHON_USE_PYTYPE_LOOKUP 0
  #undef CYTHON_USE_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
  #undef CYTHON_USE_FREELISTS
  #define CYTHON_USE_FREELISTS 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
#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 && PY_VERSION_HEX >= 0x030800B1)
#endif
#endif
#define CYTHON_BACKPORT_VECTORCALL (CYTHON_METH_FASTCALL && PY_VERSION_HEX < 0x030800B1)
#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)
#ifdef _MSC_VER
    #ifndef _MSC_STDINT_H_
        #if _MSC_VER < 1300
            typedef unsigned char     uint8_t;
            typedef unsigned short    uint16_t;
            typedef unsigned int      uint32_t;
        #else
            typedef unsigned __int8   uint8_t;
            typedef unsigned __int16  uint16_t;
            typedef unsigned __int32  uint32_t;
        #endif
    #endif
    #if _MSC_VER < 1300
        #ifdef _WIN64
            typedef unsigned long long  __pyx_uintptr_t;
        #else
            typedef unsigned int        __pyx_uintptr_t;
        #endif
    #else
        #ifdef _WIN64
            typedef unsigned __int64    __pyx_uintptr_t;
        #else
            typedef unsigned __int32    __pyx_uintptr_t;
        #endif
    #endif
#else
    #include <stdint.h>
    typedef uintptr_t  __pyx_uintptr_t;
#endif
#ifndef CYTHON_FALLTHROUGH
  #if defined(__cplusplus)
    /* for clang __has_cpp_attribute(fallthrough) is true even before C++17
     * but leads to warnings with -pedantic, since it is a C++17 feature */
    #if ((defined(_MSVC_LANG) && _MSVC_LANG >= 201703L) || __cplusplus >= 201703L)
      #if __has_cpp_attribute(fallthrough)
        #define CYTHON_FALLTHROUGH [[fallthrough]]
      #endif
    #endif
    #ifndef CYTHON_FALLTHROUGH
      #if __has_cpp_attribute(clang::fallthrough)
        #define CYTHON_FALLTHROUGH [[clang::fallthrough]]
      #elif __has_cpp_attribute(gnu::fallthrough)
        #define CYTHON_FALLTHROUGH [[gnu::fallthrough]]
      #endif
    #endif
  #endif
  #ifndef CYTHON_FALLTHROUGH
    #if __has_attribute(fallthrough)
      #define CYTHON_FALLTHROUGH __attribute__((fallthrough))
    #else
      #define CYTHON_FALLTHROUGH
    #endif
  #endif
  #if defined(__clang__) && defined(__apple_build_version__)
    #if __apple_build_version__ < 7000000
      #undef  CYTHON_FALLTHROUGH
      #define CYTHON_FALLTHROUGH
    #endif
  #endif
#endif
#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 >= 0x030800b4 && PY_VERSION_HEX < 0x030A0000)
#else
  #define __PYX_NEED_TP_PRINT_SLOT  (PY_VERSION_HEX >= 0x030800b4 && PY_VERSION_HEX < 0x03090000)
#endif
#define __PYX_REINTERPRET_FUNCION(func_pointer, other_pointer) ((func_pointer)(void(*)(void))(other_pointer))

/* 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 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))
#elif CYTHON_BACKPORT_VECTORCALL
  typedef PyObject *(*__pyx_vectorcallfunc)(PyObject *callable, PyObject *const *args,
                                            size_t nargsf, PyObject *kwnames);
  #define __Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET  ((size_t)1 << (8 * sizeof(size_t) - 1))
  #define __Pyx_PyVectorcall_NARGS(n)  ((Py_ssize_t)(((size_t)(n)) & ~__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET))
#else
  #define __Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET  0
  #define __Pyx_PyVectorcall_NARGS(n)  ((Py_ssize_t)(n))
#endif
#if PY_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 __PYX_LIMITED_VERSION_HEX < 0x03090000
  #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
  #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 && PY_VERSION_HEX >= 0x03080000
#define __Pyx_PyHeapTypeObject_GC_Del(obj)  {\
    PyTypeObject *type = Py_TYPE((PyObject*)obj);\
    assert(__Pyx_PyType_HasFeature(type, Py_TPFLAGS_HEAPTYPE));\
    PyObject_GC_Del(obj);\
    Py_DECREF(type);\
}
#else
#define __Pyx_PyHeapTypeObject_GC_Del(obj)  PyObject_GC_Del(obj)
#endif
#if CYTHON_COMPILING_IN_LIMITED_API
  #define __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
  #define __Pyx_PySequence_ListKeepNew(obj)\
    (likely(PyList_CheckExact(obj) && Py_REFCNT(obj) == 1) ? __Pyx_NewRef(obj) : PySequence_List(obj))
#else
  #define __Pyx_PySequence_ListKeepNew(obj)  PySequence_List(obj)
#endif
#ifndef PySet_CheckExact
  #define PySet_CheckExact(obj)        __Pyx_IS_TYPE(obj, &PySet_Type)
#endif
#if PY_VERSION_HEX >= 0x030900A4
  #define __Pyx_SET_REFCNT(obj, refcnt) Py_SET_REFCNT(obj, refcnt)
  #define __Pyx_SET_SIZE(obj, size) Py_SET_SIZE(obj, size)
#else
  #define __Pyx_SET_REFCNT(obj, refcnt) Py_REFCNT(obj) = (refcnt)
  #define __Pyx_SET_SIZE(obj, size) Py_SIZE(obj) = (size)
#endif
#if CYTHON_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 __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 __PYX_LIMITED_VERSION_HEX >= 0x030d0000
  #define __Pyx_PyImport_AddModuleRef(name) PyImport_AddModuleRef(name)
#else
  static CYTHON_INLINE PyObject *__Pyx_PyImport_AddModuleRef(const char *name) {
      PyObject *module = PyImport_AddModule(name);
      Py_XINCREF(module);
      return module;
  }
#endif
#if 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>
#ifdef NAN
#define __PYX_NAN() ((float) NAN)
#else
static CYTHON_INLINE float __PYX_NAN() {
  float value;
  memset(&value, 0xFF, sizeof(value));
  return value;
}
#endif
#if defined(__CYGWIN__) && defined(_LDBL_EQ_DBL)
#define __Pyx_truncl trunc
#else
#define __Pyx_truncl truncl
#endif

#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__pysam__libcbcf
#define __PYX_HAVE_API__pysam__libcbcf
/* Early includes */
#include <stdint.h>
#include <string.h>
#include <stdlib.h>
#include <stdio.h>
#include <sys/types.h>
#include "stdarg.h"
#include "htslib/kstring.h"
#include "htslib_util.h"
#include "htslib/hfile.h"
#include "htslib/bgzf.h"
#include "htslib/hts.h"
#include "htslib/sam.h"
#include "htslib/faidx.h"
#include "htslib/tbx.h"
#include "htslib/vcf.h"
#include "htslib/vcfutils.h"
#include "htslib/cram.h"
#include <errno.h>

    #if PY_MAJOR_VERSION <= 2
    #define PyDict_GetItemWithError _PyDict_GetItemWithError
    #endif
    
#include <stddef.h>

    #if PY_MAJOR_VERSION >= 3
      #define __Pyx_PyFloat_FromString(obj)  PyFloat_FromString(obj)
    #else
      #define __Pyx_PyFloat_FromString(obj)  PyFloat_FromString(obj, NULL)
    #endif
    

    #if PY_VERSION_HEX < 0x030d0000
    static CYTHON_INLINE int __Pyx_PyWeakref_GetRef(PyObject *ref, PyObject **pobj)
    {
        PyObject *obj = PyWeakref_GetObject(ref);
        if (obj == NULL) {
            // SystemError if ref is NULL
            *pobj = NULL;
            return -1;
        }
        if (obj == Py_None) {
            *pobj = NULL;
            return 0;
        }
        Py_INCREF(obj);
        *pobj = obj;
        return 1;
    }
    #else
    #define __Pyx_PyWeakref_GetRef PyWeakref_GetRef
    #endif
    
#include "pythread.h"

    #if (CYTHON_COMPILING_IN_PYPY && PYPY_VERSION_NUM < 0x07030600) && !defined(PyContextVar_Get)
    #define PyContextVar_Get(var, d, v)         ((d) ?             ((void)(var), Py_INCREF(d), (v)[0] = (d), 0) :             ((v)[0] = NULL, 0)         )
    #endif
    

    #if CYTHON_COMPILING_IN_PYPY || CYTHON_COMPILING_IN_LIMITED_API
    #ifdef _MSC_VER
    #pragma message ("This module uses CPython specific internals of 'array.array', which are not available in PyPy or the limited API.")
    #else
    #warning This module uses CPython specific internals of 'array.array', which are not available in PyPy or the limited API.
    #endif
    #endif
    
#ifdef _OPENMP
#include <omp.h>
#endif /* _OPENMP */

#if defined(PYREX_WITHOUT_ASSERTIONS) && !defined(CYTHON_WITHOUT_ASSERTIONS)
#define CYTHON_WITHOUT_ASSERTIONS
#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[] = {
  "pysam/libcbcf.pyx",
  "cpython/contextvars.pxd",
  "array.pxd",
  "pysam/libcbcf.pxd",
  "<stringsource>",
  "cpython/type.pxd",
  "cpython/bool.pxd",
  "cpython/complex.pxd",
};
/* #### Code section: utility_code_proto_before_types ### */
/* Profile_config.proto */
#ifndef CYTHON_PROFILE
#if CYTHON_COMPILING_IN_LIMITED_API || CYTHON_COMPILING_IN_PYPY
  #define CYTHON_PROFILE 0
#else
  #define CYTHON_PROFILE 1
#endif
#endif
#ifndef CYTHON_TRACE_NOGIL
  #define CYTHON_TRACE_NOGIL 0
#else
  #if CYTHON_TRACE_NOGIL && !defined(CYTHON_TRACE)
    #define CYTHON_TRACE 1
  #endif
#endif
#ifndef CYTHON_TRACE
  #define CYTHON_TRACE 0
#endif
#if CYTHON_PROFILE || CYTHON_TRACE
#if CYTHON_USE_SYS_MONITORING
    typedef enum {
        __Pyx_Monitoring_PY_START = 0,
        __Pyx_Monitoring_PY_RETURN,
        __Pyx_Monitoring_PY_UNWIND,
        __Pyx_Monitoring_LINE,
        __Pyx_Monitoring_RAISE,
        __Pyx_Monitoring_RERAISE,
        __Pyx_Monitoring_EXCEPTION_HANDLED,
        __Pyx_Monitoring_PY_RESUME,
        __Pyx_Monitoring_PY_YIELD,
        __Pyx_Monitoring_STOP_ITERATION,
    } __Pyx_Monitoring_Event_Index;
    static const unsigned char __Pyx_MonitoringEventTypes[] = {
        PY_MONITORING_EVENT_PY_START,
        PY_MONITORING_EVENT_PY_RETURN,
        PY_MONITORING_EVENT_PY_UNWIND,
        PY_MONITORING_EVENT_LINE,
        PY_MONITORING_EVENT_RAISE,
        PY_MONITORING_EVENT_RERAISE,
        PY_MONITORING_EVENT_EXCEPTION_HANDLED,
        PY_MONITORING_EVENT_PY_RESUME,
        PY_MONITORING_EVENT_PY_YIELD,
        PY_MONITORING_EVENT_STOP_ITERATION,
    };
    #define __Pyx_MonitoringEventTypes_CyFunc_count (sizeof(__Pyx_MonitoringEventTypes) - 3)
    #define __Pyx_MonitoringEventTypes_CyGen_count (sizeof(__Pyx_MonitoringEventTypes))
#endif
#endif

/* Atomics.proto */
#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)
    #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)
    #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_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)
    #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
    #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)
    #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
#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

/* 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 */
#include <structmember.h>

/* CriticalSections.proto */
#if !CYTHON_COMPILING_IN_CPYTHON_FREETHREADING
#define __Pyx_PyCriticalSection void*
#define __Pyx_PyCriticalSection2 void*
#define __Pyx_PyCriticalSection_Begin1(cs, arg) (void)cs
#define __Pyx_PyCriticalSection_Begin2(cs, arg1, arg2) (void)cs
#define __Pyx_PyCriticalSection_End1(cs)
#define __Pyx_PyCriticalSection_End2(cs)
#else
#define __Pyx_PyCriticalSection PyCriticalSection
#define __Pyx_PyCriticalSection2 PyCriticalSection2
#define __Pyx_PyCriticalSection_Begin1 PyCriticalSection_Begin
#define __Pyx_PyCriticalSection_Begin2 PyCriticalSection2_Begin
#define __Pyx_PyCriticalSection_End1 PyCriticalSection_End
#define __Pyx_PyCriticalSection_End2 PyCriticalSection2_End
#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

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

/*--- Type declarations ---*/
#ifndef _ARRAYARRAY_H
struct arrayobject;
typedef struct arrayobject arrayobject;
#endif
struct __pyx_obj_5pysam_10libchtslib_HTSFile;
struct __pyx_obj_5pysam_7libcbcf_VariantHeader;
struct __pyx_obj_5pysam_7libcbcf_VariantHeaderRecord;
struct __pyx_obj_5pysam_7libcbcf_VariantHeaderRecords;
struct __pyx_obj_5pysam_7libcbcf_VariantHeaderContigs;
struct __pyx_obj_5pysam_7libcbcf_VariantHeaderSamples;
struct __pyx_obj_5pysam_7libcbcf_VariantContig;
struct __pyx_obj_5pysam_7libcbcf_VariantMetadata;
struct __pyx_obj_5pysam_7libcbcf_VariantHeaderMetadata;
struct __pyx_obj_5pysam_7libcbcf_VariantRecord;
struct __pyx_obj_5pysam_7libcbcf_VariantRecordFilter;
struct __pyx_obj_5pysam_7libcbcf_VariantRecordFormat;
struct __pyx_obj_5pysam_7libcbcf_VariantRecordInfo;
struct __pyx_obj_5pysam_7libcbcf_VariantRecordSamples;
struct __pyx_obj_5pysam_7libcbcf_VariantRecordSample;
struct __pyx_obj_5pysam_7libcbcf_BaseIndex;
struct __pyx_obj_5pysam_7libcbcf_BCFIndex;
struct __pyx_obj_5pysam_7libcbcf_TabixIndex;
struct __pyx_obj_5pysam_7libcbcf_BaseIterator;
struct __pyx_obj_5pysam_7libcbcf_BCFIterator;
struct __pyx_obj_5pysam_7libcbcf_TabixIterator;
struct __pyx_obj_5pysam_7libcbcf_VariantFile;
struct __pyx_obj_5pysam_7libcbcf___pyx_scope_struct____pyx_f_5pysam_7libcbcf_char_array_to_tuple;
struct __pyx_obj_5pysam_7libcbcf___pyx_scope_struct_1_genexpr;
struct __pyx_obj_5pysam_7libcbcf___pyx_scope_struct_2_genexpr;
struct __pyx_obj_5pysam_7libcbcf___pyx_scope_struct_3_genexpr;
struct __pyx_obj_5pysam_7libcbcf___pyx_scope_struct_4_genexpr;
struct __pyx_obj_5pysam_7libcbcf___pyx_scope_struct_5___get__;
struct __pyx_obj_5pysam_7libcbcf___pyx_scope_struct_6_genexpr;
struct __pyx_obj_5pysam_7libcbcf___pyx_scope_struct_7___iter__;
struct __pyx_obj_5pysam_7libcbcf___pyx_scope_struct_8_itervalues;
struct __pyx_obj_5pysam_7libcbcf___pyx_scope_struct_9_iteritems;
struct __pyx_obj_5pysam_7libcbcf___pyx_scope_struct_10___iter__;
struct __pyx_obj_5pysam_7libcbcf___pyx_scope_struct_11___iter__;
struct __pyx_obj_5pysam_7libcbcf___pyx_scope_struct_12_itervalues;
struct __pyx_obj_5pysam_7libcbcf___pyx_scope_struct_13_iteritems;
struct __pyx_obj_5pysam_7libcbcf___pyx_scope_struct_14___iter__;
struct __pyx_obj_5pysam_7libcbcf___pyx_scope_struct_15_itervalues;
struct __pyx_obj_5pysam_7libcbcf___pyx_scope_struct_16_iteritems;
struct __pyx_obj_5pysam_7libcbcf___pyx_scope_struct_17___iter__;
struct __pyx_obj_5pysam_7libcbcf___pyx_scope_struct_18___iter__;
struct __pyx_obj_5pysam_7libcbcf___pyx_scope_struct_19_itervalues;
struct __pyx_obj_5pysam_7libcbcf___pyx_scope_struct_20_iteritems;
struct __pyx_obj_5pysam_7libcbcf___pyx_scope_struct_21___iter__;
struct __pyx_obj_5pysam_7libcbcf___pyx_scope_struct_22_itervalues;
struct __pyx_obj_5pysam_7libcbcf___pyx_scope_struct_23_iteritems;
struct __pyx_obj_5pysam_7libcbcf___pyx_scope_struct_24___iter__;
struct __pyx_obj_5pysam_7libcbcf___pyx_scope_struct_25_itervalues;
struct __pyx_obj_5pysam_7libcbcf___pyx_scope_struct_26_iteritems;
struct __pyx_obj_5pysam_7libcbcf___pyx_scope_struct_27___iter__;
struct __pyx_obj_5pysam_7libcbcf___pyx_scope_struct_28_itervalues;
struct __pyx_obj_5pysam_7libcbcf___pyx_scope_struct_29_iteritems;
struct __pyx_obj_5pysam_7libcbcf___pyx_scope_struct_30___set__;
struct __pyx_obj_5pysam_7libcbcf___pyx_scope_struct_31_genexpr;
struct __pyx_obj_5pysam_7libcbcf___pyx_scope_struct_32_genexpr;
struct __pyx_obj_5pysam_7libcbcf___pyx_scope_struct_33___iter__;
struct __pyx_obj_5pysam_7libcbcf___pyx_scope_struct_34_itervalues;
struct __pyx_obj_5pysam_7libcbcf___pyx_scope_struct_35_iteritems;
struct __pyx_obj_5pysam_7libcbcf___pyx_scope_struct_36_itervalues;
struct __pyx_obj_5pysam_7libcbcf___pyx_scope_struct_37_iteritems;
struct __pyx_opt_args_7cpython_11contextvars_get_value;
struct __pyx_opt_args_7cpython_11contextvars_get_value_no_default;

/* "cpython/contextvars.pxd":116
 * 
 * @_cython.c_compile_guard("!CYTHON_COMPILING_IN_LIMITED_API")
 * cdef inline object get_value(var, default_value=None):             # <<<<<<<<<<<<<<
 *     """Return a new reference to the value of the context variable,
 *     or the default value of the context variable,
*/
struct __pyx_opt_args_7cpython_11contextvars_get_value {
  int __pyx_n;
  PyObject *default_value;
};

/* "cpython/contextvars.pxd":134
 * 
 * @_cython.c_compile_guard("!CYTHON_COMPILING_IN_LIMITED_API")
 * cdef inline object get_value_no_default(var, default_value=None):             # <<<<<<<<<<<<<<
 *     """Return a new reference to the value of the context variable,
 *     or the provided default value if no such value was found.
*/
struct __pyx_opt_args_7cpython_11contextvars_get_value_no_default {
  int __pyx_n;
  PyObject *default_value;
};
struct __pyx_opt_args_5pysam_9libcutils_parse_region;
struct __pyx_opt_args_5pysam_9libcutils_OSError_from_errno;
struct __pyx_opt_args_5pysam_9libcutils_qualitystring_to_array;
struct __pyx_opt_args_5pysam_9libcutils_array_to_qualitystring;
struct __pyx_opt_args_5pysam_9libcutils_qualities_to_qualitystring;
struct __pyx_opt_args_5pysam_9libcutils_charptr_to_str;
struct __pyx_opt_args_5pysam_9libcutils_charptr_to_bytes;
struct __pyx_opt_args_5pysam_9libcutils_charptr_to_str_w_len;
struct __pyx_opt_args_5pysam_9libcutils_force_str;
struct __pyx_opt_args_5pysam_9libcutils_force_bytes;
struct __pyx_opt_args_5pysam_9libcutils_decode_bytes;

/* "pysam/libcutils.pxd":8
 * from cpython cimport array as c_array
 * 
 * cpdef parse_region(contig=*, start=*, stop=*, region=*, reference=*, end=*)             # <<<<<<<<<<<<<<
 * 
 * cdef int libc_whence_from_io(int whence)
*/
struct __pyx_opt_args_5pysam_9libcutils_parse_region {
  int __pyx_n;
  PyObject *contig;
  PyObject *start;
  PyObject *stop;
  PyObject *region;
  PyObject *reference;
  PyObject *end;
};

/* "pysam/libcutils.pxd":12
 * cdef int libc_whence_from_io(int whence)
 * 
 * cdef OSError_from_errno(message, filename=*)             # <<<<<<<<<<<<<<
 * 
 * #########################################################################
*/
struct __pyx_opt_args_5pysam_9libcutils_OSError_from_errno {
  int __pyx_n;
  PyObject *filename;
};

/* "pysam/libcutils.pxd":17
 * # Utility functions for quality string conversions
 * 
 * cpdef c_array.array qualitystring_to_array(input_str, int offset=*)             # <<<<<<<<<<<<<<
 * cpdef array_to_qualitystring(c_array.array arr, int offset=*)
 * cpdef qualities_to_qualitystring(qualities, int offset=*)
*/
struct __pyx_opt_args_5pysam_9libcutils_qualitystring_to_array {
  int __pyx_n;
  int offset;
};

/* "pysam/libcutils.pxd":18
 * 
 * cpdef c_array.array qualitystring_to_array(input_str, int offset=*)
 * cpdef array_to_qualitystring(c_array.array arr, int offset=*)             # <<<<<<<<<<<<<<
 * cpdef qualities_to_qualitystring(qualities, int offset=*)
 * 
*/
struct __pyx_opt_args_5pysam_9libcutils_array_to_qualitystring {
  int __pyx_n;
  int offset;
};

/* "pysam/libcutils.pxd":19
 * cpdef c_array.array qualitystring_to_array(input_str, int offset=*)
 * cpdef array_to_qualitystring(c_array.array arr, int offset=*)
 * cpdef qualities_to_qualitystring(qualities, int offset=*)             # <<<<<<<<<<<<<<
 * 
 * ########################################################################
*/
struct __pyx_opt_args_5pysam_9libcutils_qualities_to_qualitystring {
  int __pyx_n;
  int offset;
};

/* "pysam/libcutils.pxd":31
 * ## Python 3 compatibility functions
 * ########################################################################
 * cdef charptr_to_str(const char *s, encoding=*, errors=*)             # <<<<<<<<<<<<<<
 * cdef bytes charptr_to_bytes(const char *s, encoding=*, errors=*)
 * cdef charptr_to_str_w_len(const char* s, size_t n, encoding=*, errors=*)
*/
struct __pyx_opt_args_5pysam_9libcutils_charptr_to_str {
  int __pyx_n;
  PyObject *encoding;
  PyObject *errors;
};

/* "pysam/libcutils.pxd":32
 * ########################################################################
 * cdef charptr_to_str(const char *s, encoding=*, errors=*)
 * cdef bytes charptr_to_bytes(const char *s, encoding=*, errors=*)             # <<<<<<<<<<<<<<
 * cdef charptr_to_str_w_len(const char* s, size_t n, encoding=*, errors=*)
 * cdef force_str(object s, encoding=*, errors=*)
*/
struct __pyx_opt_args_5pysam_9libcutils_charptr_to_bytes {
  int __pyx_n;
  PyObject *encoding;
  PyObject *errors;
};

/* "pysam/libcutils.pxd":33
 * cdef charptr_to_str(const char *s, encoding=*, errors=*)
 * cdef bytes charptr_to_bytes(const char *s, encoding=*, errors=*)
 * cdef charptr_to_str_w_len(const char* s, size_t n, encoding=*, errors=*)             # <<<<<<<<<<<<<<
 * cdef force_str(object s, encoding=*, errors=*)
 * cdef bytes force_bytes(object s, encoding=*, errors=*)
*/
struct __pyx_opt_args_5pysam_9libcutils_charptr_to_str_w_len {
  int __pyx_n;
  PyObject *encoding;
  PyObject *errors;
};

/* "pysam/libcutils.pxd":34
 * cdef bytes charptr_to_bytes(const char *s, encoding=*, errors=*)
 * cdef charptr_to_str_w_len(const char* s, size_t n, encoding=*, errors=*)
 * cdef force_str(object s, encoding=*, errors=*)             # <<<<<<<<<<<<<<
 * cdef bytes force_bytes(object s, encoding=*, errors=*)
 * cdef decode_bytes(bytes s, encoding=*, errors=*)
*/
struct __pyx_opt_args_5pysam_9libcutils_force_str {
  int __pyx_n;
  PyObject *encoding;
  PyObject *errors;
};

/* "pysam/libcutils.pxd":35
 * cdef charptr_to_str_w_len(const char* s, size_t n, encoding=*, errors=*)
 * cdef force_str(object s, encoding=*, errors=*)
 * cdef bytes force_bytes(object s, encoding=*, errors=*)             # <<<<<<<<<<<<<<
 * cdef decode_bytes(bytes s, encoding=*, errors=*)
 * cdef bytes encode_filename(object filename)
*/
struct __pyx_opt_args_5pysam_9libcutils_force_bytes {
  int __pyx_n;
  PyObject *encoding;
  PyObject *errors;
};

/* "pysam/libcutils.pxd":36
 * cdef force_str(object s, encoding=*, errors=*)
 * cdef bytes force_bytes(object s, encoding=*, errors=*)
 * cdef decode_bytes(bytes s, encoding=*, errors=*)             # <<<<<<<<<<<<<<
 * cdef bytes encode_filename(object filename)
 * cdef from_string_and_size(const char *s, size_t length)
*/
struct __pyx_opt_args_5pysam_9libcutils_decode_bytes {
  int __pyx_n;
  PyObject *encoding;
  PyObject *errors;
};
struct __pyx_opt_args_5pysam_7libcbcf_char_array_to_tuple;

/* "pysam/libcbcf.pyx":267
 * 
 * 
 * cdef tuple char_array_to_tuple(const char **a, ssize_t n, int free_after=0):             # <<<<<<<<<<<<<<
 *     if not a:
 *         return None
*/
struct __pyx_opt_args_5pysam_7libcbcf_char_array_to_tuple {
  int __pyx_n;
  int free_after;
};

/* "pysam/libchtslib.pxd":2706
 * 
 * 
 * cdef class HTSFile(object):             # <<<<<<<<<<<<<<
 *     cdef          htsFile *htsfile       # pointer to htsFile structure
 *     cdef          int64_t start_offset   # BGZF offset of first record
*/
struct __pyx_obj_5pysam_10libchtslib_HTSFile {
  PyObject_HEAD
  struct __pyx_vtabstruct_5pysam_10libchtslib_HTSFile *__pyx_vtab;
  htsFile *htsfile;
  int64_t start_offset;
  PyObject *filename;
  PyObject *mode;
  PyObject *threads;
  PyObject *index_filename;
  int is_stream;
  int is_remote;
  int duplicate_filehandle;
};


/* "pysam/libcbcf.pxd":39
 * 
 * 
 * cdef class VariantHeader(object):             # <<<<<<<<<<<<<<
 *     cdef bcf_hdr_t *ptr
 * 
*/
struct __pyx_obj_5pysam_7libcbcf_VariantHeader {
  PyObject_HEAD
  struct __pyx_vtabstruct_5pysam_7libcbcf_VariantHeader *__pyx_vtab;
  bcf_hdr_t *ptr;
};


/* "pysam/libcbcf.pxd":47
 * 
 * 
 * cdef class VariantHeaderRecord(object):             # <<<<<<<<<<<<<<
 *     cdef readonly VariantHeader header
 *     cdef bcf_hrec_t *ptr
*/
struct __pyx_obj_5pysam_7libcbcf_VariantHeaderRecord {
  PyObject_HEAD
  struct __pyx_obj_5pysam_7libcbcf_VariantHeader *header;
  bcf_hrec_t *ptr;
};


/* "pysam/libcbcf.pxd":52
 * 
 * 
 * cdef class VariantHeaderRecords(object):             # <<<<<<<<<<<<<<
 *     cdef readonly VariantHeader header
 * 
*/
struct __pyx_obj_5pysam_7libcbcf_VariantHeaderRecords {
  PyObject_HEAD
  struct __pyx_obj_5pysam_7libcbcf_VariantHeader *header;
};


/* "pysam/libcbcf.pxd":56
 * 
 * 
 * cdef class VariantHeaderContigs(object):             # <<<<<<<<<<<<<<
 *     cdef readonly VariantHeader header
 * 
*/
struct __pyx_obj_5pysam_7libcbcf_VariantHeaderContigs {
  PyObject_HEAD
  struct __pyx_obj_5pysam_7libcbcf_VariantHeader *header;
};


/* "pysam/libcbcf.pxd":60
 * 
 * 
 * cdef class VariantHeaderSamples(object):             # <<<<<<<<<<<<<<
 *     cdef readonly VariantHeader header
 * 
*/
struct __pyx_obj_5pysam_7libcbcf_VariantHeaderSamples {
  PyObject_HEAD
  struct __pyx_obj_5pysam_7libcbcf_VariantHeader *header;
};


/* "pysam/libcbcf.pxd":64
 * 
 * 
 * cdef class VariantContig(object):             # <<<<<<<<<<<<<<
 *     cdef readonly VariantHeader header
 *     cdef int id
*/
struct __pyx_obj_5pysam_7libcbcf_VariantContig {
  PyObject_HEAD
  struct __pyx_obj_5pysam_7libcbcf_VariantHeader *header;
  int id;
};


/* "pysam/libcbcf.pxd":69
 * 
 * 
 * cdef class VariantMetadata(object):             # <<<<<<<<<<<<<<
 *     cdef readonly VariantHeader header
 *     cdef int type
*/
struct __pyx_obj_5pysam_7libcbcf_VariantMetadata {
  PyObject_HEAD
  struct __pyx_obj_5pysam_7libcbcf_VariantHeader *header;
  int type;
  int id;
};


/* "pysam/libcbcf.pxd":75
 * 
 * 
 * cdef class VariantHeaderMetadata(object):             # <<<<<<<<<<<<<<
 *     cdef readonly VariantHeader header
 *     cdef int32_t type
*/
struct __pyx_obj_5pysam_7libcbcf_VariantHeaderMetadata {
  PyObject_HEAD
  struct __pyx_obj_5pysam_7libcbcf_VariantHeader *header;
  int32_t type;
};


/* "pysam/libcbcf.pxd":80
 * 
 * 
 * cdef class VariantRecord(object):             # <<<<<<<<<<<<<<
 *     cdef readonly VariantHeader header
 *     cdef bcf1_t *ptr
*/
struct __pyx_obj_5pysam_7libcbcf_VariantRecord {
  PyObject_HEAD
  struct __pyx_obj_5pysam_7libcbcf_VariantHeader *header;
  bcf1_t *ptr;
};


/* "pysam/libcbcf.pxd":85
 * 
 * 
 * cdef class VariantRecordFilter(object):             # <<<<<<<<<<<<<<
 *     cdef VariantRecord record
 * 
*/
struct __pyx_obj_5pysam_7libcbcf_VariantRecordFilter {
  PyObject_HEAD
  struct __pyx_obj_5pysam_7libcbcf_VariantRecord *record;
};


/* "pysam/libcbcf.pxd":89
 * 
 * 
 * cdef class VariantRecordFormat(object):             # <<<<<<<<<<<<<<
 *     cdef VariantRecord record
 * 
*/
struct __pyx_obj_5pysam_7libcbcf_VariantRecordFormat {
  PyObject_HEAD
  struct __pyx_obj_5pysam_7libcbcf_VariantRecord *record;
};


/* "pysam/libcbcf.pxd":93
 * 
 * 
 * cdef class VariantRecordInfo(object):             # <<<<<<<<<<<<<<
 *     cdef VariantRecord record
 * 
*/
struct __pyx_obj_5pysam_7libcbcf_VariantRecordInfo {
  PyObject_HEAD
  struct __pyx_obj_5pysam_7libcbcf_VariantRecord *record;
};


/* "pysam/libcbcf.pxd":97
 * 
 * 
 * cdef class VariantRecordSamples(object):             # <<<<<<<<<<<<<<
 *     cdef VariantRecord record
 * 
*/
struct __pyx_obj_5pysam_7libcbcf_VariantRecordSamples {
  PyObject_HEAD
  struct __pyx_obj_5pysam_7libcbcf_VariantRecord *record;
};


/* "pysam/libcbcf.pxd":101
 * 
 * 
 * cdef class VariantRecordSample(object):             # <<<<<<<<<<<<<<
 *     cdef VariantRecord record
 *     cdef readonly int32_t index
*/
struct __pyx_obj_5pysam_7libcbcf_VariantRecordSample {
  PyObject_HEAD
  struct __pyx_obj_5pysam_7libcbcf_VariantRecord *record;
  int32_t index;
};


/* "pysam/libcbcf.pxd":106
 * 
 * 
 * cdef class BaseIndex(object):             # <<<<<<<<<<<<<<
 *     cdef tuple refs
 *     cdef dict refmap
*/
struct __pyx_obj_5pysam_7libcbcf_BaseIndex {
  PyObject_HEAD
  PyObject *refs;
  PyObject *refmap;
};


/* "pysam/libcbcf.pxd":111
 * 
 * 
 * cdef class BCFIndex(BaseIndex):             # <<<<<<<<<<<<<<
 *     cdef readonly VariantHeader header
 *     cdef hts_idx_t *ptr
*/
struct __pyx_obj_5pysam_7libcbcf_BCFIndex {
  struct __pyx_obj_5pysam_7libcbcf_BaseIndex __pyx_base;
  struct __pyx_obj_5pysam_7libcbcf_VariantHeader *header;
  hts_idx_t *ptr;
};


/* "pysam/libcbcf.pxd":116
 * 
 * 
 * cdef class TabixIndex(BaseIndex):             # <<<<<<<<<<<<<<
 *     cdef tbx_t *ptr
 * 
*/
struct __pyx_obj_5pysam_7libcbcf_TabixIndex {
  struct __pyx_obj_5pysam_7libcbcf_BaseIndex __pyx_base;
  tbx_t *ptr;
};


/* "pysam/libcbcf.pxd":120
 * 
 * 
 * cdef class BaseIterator(object):             # <<<<<<<<<<<<<<
 *     cdef VariantFile bcf
 *     cdef hts_itr_t  *iter
*/
struct __pyx_obj_5pysam_7libcbcf_BaseIterator {
  PyObject_HEAD
  struct __pyx_obj_5pysam_7libcbcf_VariantFile *bcf;
  hts_itr_t *iter;
};


/* "pysam/libcbcf.pxd":125
 * 
 * 
 * cdef class BCFIterator(BaseIterator):             # <<<<<<<<<<<<<<
 *     cdef BCFIndex index
 * 
*/
struct __pyx_obj_5pysam_7libcbcf_BCFIterator {
  struct __pyx_obj_5pysam_7libcbcf_BaseIterator __pyx_base;
  struct __pyx_obj_5pysam_7libcbcf_BCFIndex *index;
};


/* "pysam/libcbcf.pxd":129
 * 
 * 
 * cdef class TabixIterator(BaseIterator):             # <<<<<<<<<<<<<<
 *     cdef TabixIndex index
 *     cdef kstring_t line_buffer
*/
struct __pyx_obj_5pysam_7libcbcf_TabixIterator {
  struct __pyx_obj_5pysam_7libcbcf_BaseIterator __pyx_base;
  struct __pyx_obj_5pysam_7libcbcf_TabixIndex *index;
  kstring_t line_buffer;
};


/* "pysam/libcbcf.pxd":134
 * 
 * 
 * cdef class VariantFile(HTSFile):             # <<<<<<<<<<<<<<
 *     cdef readonly VariantHeader  header
 *     cdef readonly BaseIndex      index
*/
struct __pyx_obj_5pysam_7libcbcf_VariantFile {
  struct __pyx_obj_5pysam_10libchtslib_HTSFile __pyx_base;
  struct __pyx_obj_5pysam_7libcbcf_VariantHeader *header;
  struct __pyx_obj_5pysam_7libcbcf_BaseIndex *index;
  int drop_samples;
  int is_reading;
  int header_written;
};


/* "pysam/libcbcf.pyx":267
 * 
 * 
 * cdef tuple char_array_to_tuple(const char **a, ssize_t n, int free_after=0):             # <<<<<<<<<<<<<<
 *     if not a:
 *         return None
*/
struct __pyx_obj_5pysam_7libcbcf___pyx_scope_struct____pyx_f_5pysam_7libcbcf_char_array_to_tuple {
  PyObject_HEAD
  char const **__pyx_v_a;
};


/* "pysam/libcbcf.pyx":271
 *         return None
 *     try:
 *          return tuple(charptr_to_str(a[i]) for i in range(n))             # <<<<<<<<<<<<<<
 *     finally:
 *         if free_after and a:
*/
struct __pyx_obj_5pysam_7libcbcf___pyx_scope_struct_1_genexpr {
  PyObject_HEAD
  struct __pyx_obj_5pysam_7libcbcf___pyx_scope_struct____pyx_f_5pysam_7libcbcf_char_array_to_tuple *__pyx_outer_scope;
  Py_ssize_t __pyx_genexpr_arg_0;
  Py_ssize_t __pyx_v_i;
  Py_ssize_t __pyx_t_0;
  Py_ssize_t __pyx_t_1;
  Py_ssize_t __pyx_t_2;
};


/* "pysam/libcbcf.pyx":302
 *                 # Otherwise, copy the entire block
 *                 b = datac[:n]
 *             value = tuple(decode_bytes(v, 'utf-8') if v and v != bcf_str_missing else None for v in b.split(b','))             # <<<<<<<<<<<<<<
 *     else:
 *         value = []
*/
struct __pyx_obj_5pysam_7libcbcf___pyx_scope_struct_2_genexpr {
  PyObject_HEAD
  PyObject *__pyx_genexpr_arg_0;
  PyObject *__pyx_v_v;
  PyObject *__pyx_t_0;
  Py_ssize_t __pyx_t_1;
};


/* "pysam/libcbcf.pyx":360
 *     if bt_type == BCF_BT_CHAR:
 *         if not isinstance(values, (str, bytes)):
 *             values = b','.join(force_bytes(v) if v else bcf_str_missing for v in values)             # <<<<<<<<<<<<<<
 *             value_count = len(values)
 *         assert value_count <= n
*/
struct __pyx_obj_5pysam_7libcbcf___pyx_scope_struct_3_genexpr {
  PyObject_HEAD
  PyObject *__pyx_genexpr_arg_0;
  PyObject *__pyx_v_v;
  PyObject *__pyx_t_0;
  Py_ssize_t __pyx_t_1;
  PyObject *(*__pyx_t_2)(PyObject *);
};


/* "pysam/libcbcf.pyx":614
 *                 raise ValueError('Integer value too small/large to store in VCF/BCF')
 *     elif ht_type == BCF_HT_STR:
 *         values = b','.join(force_bytes(v) if v is not None else b'' for v in values)             # <<<<<<<<<<<<<<
 *     elif ht_type == BCF_HT_FLAG:
 *         if values[0] not in (True, False, None, 1, 0):
*/
struct __pyx_obj_5pysam_7libcbcf___pyx_scope_struct_4_genexpr {
  PyObject_HEAD
  PyObject *__pyx_genexpr_arg_0;
  PyObject *__pyx_v_v;
  PyObject *__pyx_t_0;
  Py_ssize_t __pyx_t_1;
  PyObject *(*__pyx_t_2)(PyObject *);
};


/* "pysam/libcbcf.pyx":1274
 *         return charptr_to_str(r.value) if r and r.value else None
 * 
 *     @property             # <<<<<<<<<<<<<<
 *     def attrs(self):
 *         """sequence of additional header attributes"""
*/
struct __pyx_obj_5pysam_7libcbcf___pyx_scope_struct_5___get__ {
  PyObject_HEAD
  bcf_hrec_t *__pyx_v_r;
};


/* "pysam/libcbcf.pyx":1281
 *             return ()
 *         cdef int i
 *         return tuple((bcf_str_cache_get_charptr(r.keys[i]) if r.keys[i] else None,             # <<<<<<<<<<<<<<
 *                       charptr_to_str(r.vals[i]) if r.vals[i] else None)
 *                      for i in range(r.nkeys))
*/
struct __pyx_obj_5pysam_7libcbcf___pyx_scope_struct_6_genexpr {
  PyObject_HEAD
  struct __pyx_obj_5pysam_7libcbcf___pyx_scope_struct_5___get__ *__pyx_outer_scope;
  int __pyx_genexpr_arg_0;
  int __pyx_v_i;
  int __pyx_t_0;
  int __pyx_t_1;
  int __pyx_t_2;
};


/* "pysam/libcbcf.pyx":1304
 *         raise KeyError('cannot find metadata key')
 * 
 *     def __iter__(self):             # <<<<<<<<<<<<<<
 *         cdef bcf_hrec_t *r = self.ptr
 *         if not r:
*/
struct __pyx_obj_5pysam_7libcbcf___pyx_scope_struct_7___iter__ {
  PyObject_HEAD
  int __pyx_v_i;
  bcf_hrec_t *__pyx_v_r;
  struct __pyx_obj_5pysam_7libcbcf_VariantHeaderRecord *__pyx_v_self;
  int __pyx_t_0;
  int __pyx_t_1;
  int __pyx_t_2;
};


/* "pysam/libcbcf.pyx":1332
 *         return iter(self)
 * 
 *     def itervalues(self):             # <<<<<<<<<<<<<<
 *         """D.itervalues() -> an iterator over the values of D"""
 *         cdef bcf_hrec_t *r = self.ptr
*/
struct __pyx_obj_5pysam_7libcbcf___pyx_scope_struct_8_itervalues {
  PyObject_HEAD
  int __pyx_v_i;
  bcf_hrec_t *__pyx_v_r;
  struct __pyx_obj_5pysam_7libcbcf_VariantHeaderRecord *__pyx_v_self;
  int __pyx_t_0;
  int __pyx_t_1;
  int __pyx_t_2;
};


/* "pysam/libcbcf.pyx":1342
 *                 yield charptr_to_str(r.vals[i]) if r.vals[i] else None
 * 
 *     def iteritems(self):             # <<<<<<<<<<<<<<
 *         """D.iteritems() -> an iterator over the (key, value) items of D"""
 *         cdef bcf_hrec_t *r = self.ptr
*/
struct __pyx_obj_5pysam_7libcbcf___pyx_scope_struct_9_iteritems {
  PyObject_HEAD
  int __pyx_v_i;
  bcf_hrec_t *__pyx_v_r;
  struct __pyx_obj_5pysam_7libcbcf_VariantHeaderRecord *__pyx_v_self;
  int __pyx_t_0;
  int __pyx_t_1;
  int __pyx_t_2;
};


/* "pysam/libcbcf.pyx":1453
 *         return makeVariantHeaderRecord(self.header, self.header.ptr.hrec[i])
 * 
 *     def __iter__(self):             # <<<<<<<<<<<<<<
 *         cdef int32_t i
 *         for i in range(self.header.ptr.nhrec):
*/
struct __pyx_obj_5pysam_7libcbcf___pyx_scope_struct_10___iter__ {
  PyObject_HEAD
  int32_t __pyx_v_i;
  struct __pyx_obj_5pysam_7libcbcf_VariantHeaderRecords *__pyx_v_self;
  int __pyx_t_0;
  int __pyx_t_1;
  int32_t __pyx_t_2;
};


/* "pysam/libcbcf.pyx":1643
 *         #bcf_hdr_sync(hdr)
 * 
 *     def __iter__(self):             # <<<<<<<<<<<<<<
 *         cdef bcf_hdr_t *hdr = self.header.ptr
 *         cdef bcf_idpair_t *idpair
*/
struct __pyx_obj_5pysam_7libcbcf___pyx_scope_struct_11___iter__ {
  PyObject_HEAD
  bcf_hdr_t *__pyx_v_hdr;
  int32_t __pyx_v_i;
  bcf_idpair_t *__pyx_v_idpair;
  struct __pyx_obj_5pysam_7libcbcf_VariantHeaderMetadata *__pyx_v_self;
  int32_t __pyx_t_0;
  int32_t __pyx_t_1;
  int32_t __pyx_t_2;
};


/* "pysam/libcbcf.pyx":1672
 *         return iter(self)
 * 
 *     def itervalues(self):             # <<<<<<<<<<<<<<
 *         """D.itervalues() -> an iterator over the values of D"""
 *         for key in self:
*/
struct __pyx_obj_5pysam_7libcbcf___pyx_scope_struct_12_itervalues {
  PyObject_HEAD
  PyObject *__pyx_v_key;
  struct __pyx_obj_5pysam_7libcbcf_VariantHeaderMetadata *__pyx_v_self;
  PyObject *__pyx_t_0;
  Py_ssize_t __pyx_t_1;
  PyObject *(*__pyx_t_2)(PyObject *);
};


/* "pysam/libcbcf.pyx":1677
 *             yield self[key]
 * 
 *     def iteritems(self):             # <<<<<<<<<<<<<<
 *         """D.iteritems() -> an iterator over the (key, value) items of D"""
 *         for key in self:
*/
struct __pyx_obj_5pysam_7libcbcf___pyx_scope_struct_13_iteritems {
  PyObject_HEAD
  PyObject *__pyx_v_key;
  struct __pyx_obj_5pysam_7libcbcf_VariantHeaderMetadata *__pyx_v_self;
  PyObject *__pyx_t_0;
  Py_ssize_t __pyx_t_1;
  PyObject *(*__pyx_t_2)(PyObject *);
};


/* "pysam/libcbcf.pyx":1823
 *         #bcf_hdr_sync(hdr)
 * 
 *     def __iter__(self):             # <<<<<<<<<<<<<<
 *         cdef bcf_hdr_t *hdr = self.header.ptr
 *         cdef vdict_t *d = <vdict_t *>hdr.dict[BCF_DT_CTG]
*/
struct __pyx_obj_5pysam_7libcbcf___pyx_scope_struct_14___iter__ {
  PyObject_HEAD
  vdict_t *__pyx_v_d;
  bcf_hdr_t *__pyx_v_hdr;
  uint32_t __pyx_v_i;
  uint32_t __pyx_v_n;
  struct __pyx_obj_5pysam_7libcbcf_VariantHeaderContigs *__pyx_v_self;
  uint32_t __pyx_t_0;
  uint32_t __pyx_t_1;
  uint32_t __pyx_t_2;
};


/* "pysam/libcbcf.pyx":1852
 *         return iter(self)
 * 
 *     def itervalues(self):             # <<<<<<<<<<<<<<
 *         """D.itervalues() -> an iterator over the values of D"""
 *         for key in self:
*/
struct __pyx_obj_5pysam_7libcbcf___pyx_scope_struct_15_itervalues {
  PyObject_HEAD
  PyObject *__pyx_v_key;
  struct __pyx_obj_5pysam_7libcbcf_VariantHeaderContigs *__pyx_v_self;
  PyObject *__pyx_t_0;
  Py_ssize_t __pyx_t_1;
  PyObject *(*__pyx_t_2)(PyObject *);
};


/* "pysam/libcbcf.pyx":1857
 *             yield self[key]
 * 
 *     def iteritems(self):             # <<<<<<<<<<<<<<
 *         """D.iteritems() -> an iterator over the (key, value) items of D"""
 *         for key in self:
*/
struct __pyx_obj_5pysam_7libcbcf___pyx_scope_struct_16_iteritems {
  PyObject_HEAD
  PyObject *__pyx_v_key;
  struct __pyx_obj_5pysam_7libcbcf_VariantHeaderContigs *__pyx_v_self;
  PyObject *__pyx_t_0;
  Py_ssize_t __pyx_t_1;
  PyObject *(*__pyx_t_2)(PyObject *);
};


/* "pysam/libcbcf.pyx":1922
 *         return charptr_to_str(hdr.samples[i])
 * 
 *     def __iter__(self):             # <<<<<<<<<<<<<<
 *         cdef bcf_hdr_t *hdr = self.header.ptr
 *         cdef int32_t i, n = bcf_hdr_nsamples(hdr)
*/
struct __pyx_obj_5pysam_7libcbcf___pyx_scope_struct_17___iter__ {
  PyObject_HEAD
  bcf_hdr_t *__pyx_v_hdr;
  int32_t __pyx_v_i;
  int32_t __pyx_v_n;
  struct __pyx_obj_5pysam_7libcbcf_VariantHeaderSamples *__pyx_v_self;
  int32_t __pyx_t_0;
  int32_t __pyx_t_1;
  int32_t __pyx_t_2;
};


/* "pysam/libcbcf.pyx":2323
 *         r.d.n_flt = 0
 * 
 *     def __iter__(self):             # <<<<<<<<<<<<<<
 *         cdef bcf_hdr_t *hdr = self.record.header.ptr
 *         cdef bcf1_t *r = self.record.ptr
*/
struct __pyx_obj_5pysam_7libcbcf___pyx_scope_struct_18___iter__ {
  PyObject_HEAD
  bcf_hdr_t *__pyx_v_hdr;
  int __pyx_v_i;
  bcf1_t *__pyx_v_r;
  struct __pyx_obj_5pysam_7libcbcf_VariantRecordFilter *__pyx_v_self;
  int __pyx_t_0;
  int __pyx_t_1;
  int __pyx_t_2;
};


/* "pysam/libcbcf.pyx":2348
 *         return iter(self)
 * 
 *     def itervalues(self):             # <<<<<<<<<<<<<<
 *         """D.itervalues() -> an iterator over the values of D"""
 *         for key in self:
*/
struct __pyx_obj_5pysam_7libcbcf___pyx_scope_struct_19_itervalues {
  PyObject_HEAD
  PyObject *__pyx_v_key;
  struct __pyx_obj_5pysam_7libcbcf_VariantRecordFilter *__pyx_v_self;
  PyObject *__pyx_t_0;
  Py_ssize_t __pyx_t_1;
  PyObject *(*__pyx_t_2)(PyObject *);
};


/* "pysam/libcbcf.pyx":2353
 *             yield self[key]
 * 
 *     def iteritems(self):             # <<<<<<<<<<<<<<
 *         """D.iteritems() -> an iterator over the (key, value) items of D"""
 *         for key in self:
*/
struct __pyx_obj_5pysam_7libcbcf___pyx_scope_struct_20_iteritems {
  PyObject_HEAD
  PyObject *__pyx_v_key;
  struct __pyx_obj_5pysam_7libcbcf_VariantRecordFilter *__pyx_v_self;
  PyObject *__pyx_t_0;
  Py_ssize_t __pyx_t_1;
  PyObject *(*__pyx_t_2)(PyObject *);
};


/* "pysam/libcbcf.pyx":2467
 *                     raise ValueError('Unable to delete FORMAT')
 * 
 *     def __iter__(self):             # <<<<<<<<<<<<<<
 *         cdef bcf_hdr_t *hdr = self.record.header.ptr
 *         cdef bcf1_t *r = self.record.ptr
*/
struct __pyx_obj_5pysam_7libcbcf___pyx_scope_struct_21___iter__ {
  PyObject_HEAD
  bcf_fmt_t *__pyx_v_fmt;
  bcf_hdr_t *__pyx_v_hdr;
  int __pyx_v_i;
  bcf1_t *__pyx_v_r;
  struct __pyx_obj_5pysam_7libcbcf_VariantRecordFormat *__pyx_v_self;
  uint32_t __pyx_t_0;
  uint32_t __pyx_t_1;
  int __pyx_t_2;
};


/* "pysam/libcbcf.pyx":2496
 *         return iter(self)
 * 
 *     def itervalues(self):             # <<<<<<<<<<<<<<
 *         """D.itervalues() -> an iterator over the values of D"""
 *         for key in self:
*/
struct __pyx_obj_5pysam_7libcbcf___pyx_scope_struct_22_itervalues {
  PyObject_HEAD
  PyObject *__pyx_v_key;
  struct __pyx_obj_5pysam_7libcbcf_VariantRecordFormat *__pyx_v_self;
  PyObject *__pyx_t_0;
  Py_ssize_t __pyx_t_1;
  PyObject *(*__pyx_t_2)(PyObject *);
};


/* "pysam/libcbcf.pyx":2501
 *             yield self[key]
 * 
 *     def iteritems(self):             # <<<<<<<<<<<<<<
 *         """D.iteritems() -> an iterator over the (key, value) items of D"""
 *         for key in self:
*/
struct __pyx_obj_5pysam_7libcbcf___pyx_scope_struct_23_iteritems {
  PyObject_HEAD
  PyObject *__pyx_v_key;
  struct __pyx_obj_5pysam_7libcbcf_VariantRecordFormat *__pyx_v_self;
  PyObject *__pyx_t_0;
  Py_ssize_t __pyx_t_1;
  PyObject *(*__pyx_t_2)(PyObject *);
};


/* "pysam/libcbcf.pyx":2673
 *                     raise ValueError('Unable to delete INFO')
 * 
 *     def __iter__(self):             # <<<<<<<<<<<<<<
 *         cdef bcf_hdr_t *hdr = self.record.header.ptr
 *         cdef bcf1_t *r = self.record.ptr
*/
struct __pyx_obj_5pysam_7libcbcf___pyx_scope_struct_24___iter__ {
  PyObject_HEAD
  bcf_hdr_t *__pyx_v_hdr;
  int __pyx_v_i;
  bcf_info_t *__pyx_v_info;
  char const *__pyx_v_key;
  bcf1_t *__pyx_v_r;
  struct __pyx_obj_5pysam_7libcbcf_VariantRecordInfo *__pyx_v_self;
  uint32_t __pyx_t_0;
  uint32_t __pyx_t_1;
  int __pyx_t_2;
};


/* "pysam/libcbcf.pyx":2740
 *         return iter(self)
 * 
 *     def itervalues(self):             # <<<<<<<<<<<<<<
 *         """D.itervalues() -> an iterator over the values of D"""
 *         cdef bcf_hdr_t *hdr = self.record.header.ptr
*/
struct __pyx_obj_5pysam_7libcbcf___pyx_scope_struct_25_itervalues {
  PyObject_HEAD
  bcf_hdr_t *__pyx_v_hdr;
  int __pyx_v_i;
  bcf_info_t *__pyx_v_info;
  char const *__pyx_v_key;
  bcf1_t *__pyx_v_r;
  struct __pyx_obj_5pysam_7libcbcf_VariantRecordInfo *__pyx_v_self;
  uint32_t __pyx_t_0;
  uint32_t __pyx_t_1;
  int __pyx_t_2;
};


/* "pysam/libcbcf.pyx":2758
 *                     yield bcf_info_get_value(self.record, info)
 * 
 *     def iteritems(self):             # <<<<<<<<<<<<<<
 *         """D.iteritems() -> an iterator over the (key, value) items of D"""
 *         cdef bcf_hdr_t *hdr = self.record.header.ptr
*/
struct __pyx_obj_5pysam_7libcbcf___pyx_scope_struct_26_iteritems {
  PyObject_HEAD
  bcf_hdr_t *__pyx_v_hdr;
  int __pyx_v_i;
  bcf_info_t *__pyx_v_info;
  char const *__pyx_v_key;
  bcf1_t *__pyx_v_r;
  struct __pyx_obj_5pysam_7libcbcf_VariantRecordInfo *__pyx_v_self;
  PyObject *__pyx_v_value;
  uint32_t __pyx_t_0;
  uint32_t __pyx_t_1;
  int __pyx_t_2;
};


/* "pysam/libcbcf.pyx":2901
 *         return makeVariantRecordSample(self.record, sample_index)
 * 
 *     def __iter__(self):             # <<<<<<<<<<<<<<
 *         cdef bcf_hdr_t *hdr = self.record.header.ptr
 *         cdef bcf1_t *r = self.record.ptr
*/
struct __pyx_obj_5pysam_7libcbcf___pyx_scope_struct_27___iter__ {
  PyObject_HEAD
  bcf_hdr_t *__pyx_v_hdr;
  int32_t __pyx_v_i;
  int32_t __pyx_v_n;
  bcf1_t *__pyx_v_r;
  struct __pyx_obj_5pysam_7libcbcf_VariantRecordSamples *__pyx_v_self;
  int32_t __pyx_t_0;
  int32_t __pyx_t_1;
  int32_t __pyx_t_2;
};


/* "pysam/libcbcf.pyx":2938
 *         return iter(self)
 * 
 *     def itervalues(self):             # <<<<<<<<<<<<<<
 *         """D.itervalues() -> an iterator over the values of D"""
 *         cdef bcf_hdr_t *hdr = self.record.header.ptr
*/
struct __pyx_obj_5pysam_7libcbcf___pyx_scope_struct_28_itervalues {
  PyObject_HEAD
  bcf_hdr_t *__pyx_v_hdr;
  int32_t __pyx_v_i;
  int32_t __pyx_v_n;
  bcf1_t *__pyx_v_r;
  struct __pyx_obj_5pysam_7libcbcf_VariantRecordSamples *__pyx_v_self;
  int32_t __pyx_t_0;
  int32_t __pyx_t_1;
  int32_t __pyx_t_2;
};


/* "pysam/libcbcf.pyx":2947
 *             yield makeVariantRecordSample(self.record, i)
 * 
 *     def iteritems(self):             # <<<<<<<<<<<<<<
 *         """D.iteritems() -> an iterator over the (key, value) items of D"""
 *         cdef bcf_hdr_t *hdr = self.record.header.ptr
*/
struct __pyx_obj_5pysam_7libcbcf___pyx_scope_struct_29_iteritems {
  PyObject_HEAD
  bcf_hdr_t *__pyx_v_hdr;
  int32_t __pyx_v_i;
  int32_t __pyx_v_n;
  bcf1_t *__pyx_v_r;
  struct __pyx_obj_5pysam_7libcbcf_VariantRecordSamples *__pyx_v_self;
  int32_t __pyx_t_0;
  int32_t __pyx_t_1;
  int32_t __pyx_t_2;
};


/* "pysam/libcbcf.pyx":3479
 *         return bcf_format_get_alleles(self)
 * 
 *     @alleles.setter             # <<<<<<<<<<<<<<
 *     def alleles(self, value):
 *         # Sets the genotype, supply a tuple of alleles to set.
*/
struct __pyx_obj_5pysam_7libcbcf___pyx_scope_struct_30___set__ {
  PyObject_HEAD
  struct __pyx_obj_5pysam_7libcbcf_VariantRecordSample *__pyx_v_self;
};


/* "pysam/libcbcf.pyx":3489
 *             return
 * 
 *         if any((type(x) == int for x in value)):             # <<<<<<<<<<<<<<
 *             raise ValueError('Use .allele_indices to set integer allele indices')
 * 
*/
struct __pyx_obj_5pysam_7libcbcf___pyx_scope_struct_31_genexpr {
  PyObject_HEAD
  PyObject *__pyx_genexpr_arg_0;
  PyObject *__pyx_v_x;
};


/* "pysam/libcbcf.pyx":3494
 *         # determine and set allele indices:
 *         try:
 *             self['GT'] = tuple( (self.record.alleles.index(allele) for allele in value) )             # <<<<<<<<<<<<<<
 *         except ValueError:
 *             raise ValueError("One or more of the supplied sample alleles are not defined as alleles of the corresponding pysam.libcbcf.VariantRecord."
*/
struct __pyx_obj_5pysam_7libcbcf___pyx_scope_struct_32_genexpr {
  PyObject_HEAD
  struct __pyx_obj_5pysam_7libcbcf___pyx_scope_struct_30___set__ *__pyx_outer_scope;
  PyObject *__pyx_genexpr_arg_0;
  PyObject *__pyx_v_allele;
  PyObject *__pyx_t_0;
  Py_ssize_t __pyx_t_1;
  PyObject *(*__pyx_t_2)(PyObject *);
};


/* "pysam/libcbcf.pyx":3559
 *                 bcf_format_del_value(self, bcf_hdr_int2id(hdr, BCF_DT_ID, fmt.id))
 * 
 *     def __iter__(self):             # <<<<<<<<<<<<<<
 *         cdef bcf_hdr_t *hdr = self.record.header.ptr
 *         cdef bcf1_t *r = self.record.ptr
*/
struct __pyx_obj_5pysam_7libcbcf___pyx_scope_struct_33___iter__ {
  PyObject_HEAD
  bcf_fmt_t *__pyx_v_fmt;
  bcf_hdr_t *__pyx_v_hdr;
  int __pyx_v_i;
  bcf1_t *__pyx_v_r;
  struct __pyx_obj_5pysam_7libcbcf_VariantRecordSample *__pyx_v_self;
  uint32_t __pyx_t_0;
  uint32_t __pyx_t_1;
  int __pyx_t_2;
};


/* "pysam/libcbcf.pyx":3588
 *         return iter(self)
 * 
 *     def itervalues(self):             # <<<<<<<<<<<<<<
 *         """D.itervalues() -> an iterator over the values of D"""
 *         for key in self:
*/
struct __pyx_obj_5pysam_7libcbcf___pyx_scope_struct_34_itervalues {
  PyObject_HEAD
  PyObject *__pyx_v_key;
  struct __pyx_obj_5pysam_7libcbcf_VariantRecordSample *__pyx_v_self;
  PyObject *__pyx_t_0;
  Py_ssize_t __pyx_t_1;
  PyObject *(*__pyx_t_2)(PyObject *);
};


/* "pysam/libcbcf.pyx":3593
 *             yield self[key]
 * 
 *     def iteritems(self):             # <<<<<<<<<<<<<<
 *         """D.iteritems() -> an iterator over the (key, value) items of D"""
 *         for key in self:
*/
struct __pyx_obj_5pysam_7libcbcf___pyx_scope_struct_35_iteritems {
  PyObject_HEAD
  PyObject *__pyx_v_key;
  struct __pyx_obj_5pysam_7libcbcf_VariantRecordSample *__pyx_v_self;
  PyObject *__pyx_t_0;
  Py_ssize_t __pyx_t_1;
  PyObject *(*__pyx_t_2)(PyObject *);
};


/* "pysam/libcbcf.pyx":3703
 *         return iter(self)
 * 
 *     def itervalues(self):             # <<<<<<<<<<<<<<
 *         """D.itervalues() -> an iterator over the values of D"""
 *         for key in self:
*/
struct __pyx_obj_5pysam_7libcbcf___pyx_scope_struct_36_itervalues {
  PyObject_HEAD
  PyObject *__pyx_v_key;
  struct __pyx_obj_5pysam_7libcbcf_BaseIndex *__pyx_v_self;
  PyObject *__pyx_t_0;
  Py_ssize_t __pyx_t_1;
  PyObject *(*__pyx_t_2)(PyObject *);
};


/* "pysam/libcbcf.pyx":3708
 *             yield self[key]
 * 
 *     def iteritems(self):             # <<<<<<<<<<<<<<
 *         """D.iteritems() -> an iterator over the (key, value) items of D"""
 *         for key in self:
*/
struct __pyx_obj_5pysam_7libcbcf___pyx_scope_struct_37_iteritems {
  PyObject_HEAD
  PyObject *__pyx_v_key;
  struct __pyx_obj_5pysam_7libcbcf_BaseIndex *__pyx_v_self;
  PyObject *__pyx_t_0;
  Py_ssize_t __pyx_t_1;
  PyObject *(*__pyx_t_2)(PyObject *);
};



/* "pysam/libchtslib.pxd":2706
 * 
 * 
 * cdef class HTSFile(object):             # <<<<<<<<<<<<<<
 *     cdef          htsFile *htsfile       # pointer to htsFile structure
 *     cdef          int64_t start_offset   # BGZF offset of first record
*/

struct __pyx_vtabstruct_5pysam_10libchtslib_HTSFile {
  htsFile *(*_open_htsfile)(struct __pyx_obj_5pysam_10libchtslib_HTSFile *);
};
static struct __pyx_vtabstruct_5pysam_10libchtslib_HTSFile *__pyx_vtabptr_5pysam_10libchtslib_HTSFile;


/* "pysam/libcbcf.pyx":1957
 * 
 * 
 * cdef class VariantHeader(object):             # <<<<<<<<<<<<<<
 *     """header information for a :class:`VariantFile` object"""
 *     #FIXME: Add structured proxy
*/

struct __pyx_vtabstruct_5pysam_7libcbcf_VariantHeader {
  PyObject *(*_add_sample)(struct __pyx_obj_5pysam_7libcbcf_VariantHeader *, PyObject *);
  PyObject *(*_hdr_sync)(struct __pyx_obj_5pysam_7libcbcf_VariantHeader *);
  PyObject *(*_subset_samples)(struct __pyx_obj_5pysam_7libcbcf_VariantHeader *, PyObject *);
};
static struct __pyx_vtabstruct_5pysam_7libcbcf_VariantHeader *__pyx_vtabptr_5pysam_7libcbcf_VariantHeader;


/* "pysam/libcbcf.pyx":4035
 * 
 * 
 * cdef class VariantFile(HTSFile):             # <<<<<<<<<<<<<<
 *     """*(filename, mode=None, index_filename=None, header=None, drop_samples=False,
 *     duplicate_filehandle=True, ignore_truncation=False, threads=1)*
*/

struct __pyx_vtabstruct_5pysam_7libcbcf_VariantFile {
  struct __pyx_vtabstruct_5pysam_10libchtslib_HTSFile __pyx_base;
  int (*write)(struct __pyx_obj_5pysam_7libcbcf_VariantFile *, struct __pyx_obj_5pysam_7libcbcf_VariantRecord *, int __pyx_skip_dispatch);
};
static struct __pyx_vtabstruct_5pysam_7libcbcf_VariantFile *__pyx_vtabptr_5pysam_7libcbcf_VariantFile;
/* #### 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 */
#if CYTHON_FAST_THREAD_STATE
#define __Pyx_PyErr_ExceptionMatches(err) __Pyx_PyErr_ExceptionMatchesInState(__pyx_tstate, err)
static CYTHON_INLINE int __Pyx_PyErr_ExceptionMatchesInState(PyThreadState* tstate, PyObject* err);
#else
#define __Pyx_PyErr_ExceptionMatches(err)  PyErr_ExceptionMatches(err)
#endif

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

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

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

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

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

/* TupleAndListFromArray.proto */
#if CYTHON_COMPILING_IN_CPYTHON
static CYTHON_INLINE PyObject* __Pyx_PyList_FromArray(PyObject *const *src, Py_ssize_t n);
#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 */
#include <string.h>

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

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

/* fastcall.proto */
#if CYTHON_AVOID_BORROWED_REFS
    #define __Pyx_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

/* Profile.proto */
#if CYTHON_TRACE
  #undef CYTHON_PROFILE_REUSE_FRAME
#endif
#if CYTHON_USE_MODULE_STATE
  #undef CYTHON_PROFILE_REUSE_CODEOBJ
  #define CYTHON_PROFILE_REUSE_CODEOBJ 0
  #undef CYTHON_PROFILE_REUSE_FRAME
#endif
#ifndef CYTHON_PROFILE_REUSE_CODEOBJ
  #define CYTHON_PROFILE_REUSE_CODEOBJ 1
#endif
#ifndef CYTHON_PROFILE_REUSE_FRAME
  #define CYTHON_PROFILE_REUSE_FRAME 0
#endif
#if CYTHON_USE_SYS_MONITORING && (CYTHON_PROFILE || CYTHON_TRACE)
  #define __PYX_MONITORING_ABI_SUFFIX  "_mon"
#else
  #define __PYX_MONITORING_ABI_SUFFIX
#endif
#if CYTHON_PROFILE || CYTHON_TRACE
#if CYTHON_USE_SYS_MONITORING
  typedef uint64_t __pyx_monitoring_version_type;
  #define __Pyx_TraceDeclarationsFunc\
      PyObject *__pyx_frame_code = NULL;\
      PyMonitoringState __pyx_pymonitoring_state[__Pyx_MonitoringEventTypes_CyFunc_count];\
      int __pyx_exception_already_reported = 0;\
      const int __pyx_sys_monitoring_disabled_in_parallel = 0; CYTHON_UNUSED_VAR(__pyx_sys_monitoring_disabled_in_parallel);
  #define __Pyx_TraceDeclarationsGen\
      PyObject *__pyx_frame_code = Py_NewRef(__pyx_generator->gi_code);\
      PyMonitoringState* __pyx_pymonitoring_state = __pyx_generator->__pyx_pymonitoring_state;\
      __pyx_monitoring_version_type __pyx_pymonitoring_version = __pyx_generator->__pyx_pymonitoring_version;\
      int __pyx_exception_already_reported = 0;\
      const int __pyx_sys_monitoring_disabled_in_parallel = 0; CYTHON_UNUSED_VAR(__pyx_sys_monitoring_disabled_in_parallel);
  #define __Pyx_IsTracing(event_id)  ((!__pyx_sys_monitoring_disabled_in_parallel) && (__pyx_pymonitoring_state[event_id]).active)
  #define __Pyx_TraceFrameInit(codeobj)\
      if (codeobj) __pyx_frame_code = codeobj;
  #define __Pyx_TurnOffSysMonitoringInParallel\
    const int __pyx_sys_monitoring_disabled_in_parallel = 1;\
    CYTHON_UNUSED_VAR(__pyx_sys_monitoring_disabled_in_parallel);
  CYTHON_UNUSED static PyCodeObject *__Pyx_createFrameCodeObject(const char *funcname, const char *srcfile, int firstlineno);
  CYTHON_UNUSED static int __Pyx__TraceStartFunc(PyMonitoringState *state_array, PyObject *code_obj, int offset, int skip_event);
  CYTHON_UNUSED static int __Pyx__TraceStartGen(PyMonitoringState *state_array, __pyx_monitoring_version_type *version, PyObject *code_obj, int offset);
  CYTHON_UNUSED static int __Pyx__TraceResumeGen(PyMonitoringState *state_array, __pyx_monitoring_version_type *version, PyObject *code_obj, int offset);
  CYTHON_UNUSED static void __Pyx__TraceException(PyMonitoringState *monitoring_state, PyObject *code_obj, int offset, int reraised);
  #define __Pyx_PyMonitoring_ExitScope(nogil)\
    if (nogil) {\
        (void) __pyx_exception_already_reported;\
        if (CYTHON_TRACE_NOGIL) {\
            PyGILState_STATE state = PyGILState_Ensure();\
            PyMonitoring_ExitScope();\
            Py_XDECREF(__pyx_frame_code);\
            PyGILState_Release(state);\
        }\
    } else {\
        PyMonitoring_ExitScope();\
        Py_XDECREF(__pyx_frame_code);\
    }
  #define __Pyx_TraceStartFunc(funcname, srcfile, firstlineno, offset, nogil, skip_event, goto_error)\
  if ((0) ); else {\
      int ret = 0;\
      memset(__pyx_pymonitoring_state, 0, sizeof(__pyx_pymonitoring_state));\
      if (nogil) {\
          if (CYTHON_TRACE_NOGIL) {\
              PyGILState_STATE state = PyGILState_Ensure();\
              if (!__Pyx_PyThreadState_Current->tracing) {\
                  if (likely(__pyx_frame_code)) Py_INCREF(__pyx_frame_code);\
                  else __pyx_frame_code = (PyObject*) __Pyx_createFrameCodeObject(funcname, srcfile, firstlineno);\
                  if (unlikely(!__pyx_frame_code)) goto_error;\
                  ret = __Pyx__TraceStartFunc(__pyx_pymonitoring_state, __pyx_frame_code, offset, skip_event);\
              }\
              PyGILState_Release(state);\
          }\
      } else {\
          if (!__Pyx_PyThreadState_Current->tracing) {\
              if (likely(__pyx_frame_code)) Py_INCREF(__pyx_frame_code);\
              else __pyx_frame_code = (PyObject*) __Pyx_createFrameCodeObject(funcname, srcfile, firstlineno);\
              if (unlikely(!__pyx_frame_code)) goto_error;\
              ret = __Pyx__TraceStartFunc(__pyx_pymonitoring_state, __pyx_frame_code, offset, skip_event);\
          }\
      }\
      if (unlikely(ret == -1)) goto_error;\
  }
  #define __Pyx_TraceStartGen(funcname, srcfile, firstlineno, offset, nogil, skip_event, goto_error)\
  if ((0) ); else {\
      int ret = __Pyx__TraceStartGen(__pyx_pymonitoring_state, &__pyx_pymonitoring_version, __pyx_frame_code, offset);\
      if (unlikely(ret == -1)) goto_error;\
  }
  #define __Pyx_TraceResumeGen(funcname, srcfile, firstlineno, offset, goto_error)\
  if ((0) ); else {\
      int ret = __Pyx__TraceResumeGen(__pyx_pymonitoring_state, &__pyx_pymonitoring_version, __pyx_frame_code, offset);\
      if (unlikely(ret == -1)) goto_error;\
  }
  #define __Pyx_TraceYield(result, offset, goto_error)\
  if (!__Pyx_IsTracing(__Pyx_Monitoring_PY_YIELD)); else {\
      int ret = PyMonitoring_FirePyYieldEvent(&__pyx_pymonitoring_state[__Pyx_Monitoring_PY_RETURN], __pyx_frame_code, offset, result);\
      PyMonitoring_ExitScope();\
      if (unlikely(ret == -1)) goto_error;\
  }
  #define __Pyx_TraceException(offset, reraised, fresh)\
  if (!__Pyx_IsTracing((reraised) ? __Pyx_Monitoring_RERAISE : __Pyx_Monitoring_RAISE)); else {\
      if (fresh || reraised || !__pyx_exception_already_reported) {\
          __Pyx__TraceException(&__pyx_pymonitoring_state[(reraised) ? __Pyx_Monitoring_RERAISE : __Pyx_Monitoring_RAISE], __pyx_frame_code, offset, reraised);\
      }\
      __pyx_exception_already_reported = 1;\
  }
  #define __Pyx_TraceExceptionDone()  __pyx_exception_already_reported = 0
  #define __Pyx_TraceExceptionHandled(offset)\
  if (!__Pyx_IsTracing(__Pyx_Monitoring_EXCEPTION_HANDLED)); else {\
      (void) PyMonitoring_FireExceptionHandledEvent(&__pyx_pymonitoring_state[__Pyx_Monitoring_EXCEPTION_HANDLED], __pyx_frame_code, offset);\
      __pyx_exception_already_reported = 0;\
  }
  #define __Pyx_TraceReturnValue(result, offset, nogil, goto_error)\
  if (!__Pyx_IsTracing(__Pyx_Monitoring_PY_RETURN)); else {\
      int ret = 0;\
      if (nogil) {\
          if (CYTHON_TRACE_NOGIL) {\
              PyGILState_STATE state = PyGILState_Ensure();\
              ret = PyMonitoring_FirePyReturnEvent(&__pyx_pymonitoring_state[__Pyx_Monitoring_PY_RETURN], __pyx_frame_code, offset, result);\
              PyGILState_Release(state);\
          }\
      } else {\
          ret = PyMonitoring_FirePyReturnEvent(&__pyx_pymonitoring_state[__Pyx_Monitoring_PY_RETURN], __pyx_frame_code, offset, result);\
      }\
      if (unlikely(ret == -1)) goto_error;\
  }
  #define __Pyx_TraceReturnCValue(cresult, convert_function, offset, nogil, goto_error)\
  if (!__Pyx_IsTracing(__Pyx_Monitoring_PY_RETURN)); else {\
      int ret = 0;\
      if (nogil) {\
          if (CYTHON_TRACE_NOGIL) {\
              PyGILState_STATE state = PyGILState_Ensure();\
              PyObject *pyvalue = convert_function(cresult);\
              if (unlikely(!pyvalue)) {\
                  PyErr_Clear();\
                  pyvalue = Py_None; Py_INCREF(Py_None);\
              }\
              ret = PyMonitoring_FirePyReturnEvent(&__pyx_pymonitoring_state[__Pyx_Monitoring_PY_RETURN], __pyx_frame_code, offset, pyvalue);\
              Py_DECREF(pyvalue);\
              PyGILState_Release(state);\
          }\
      } else {\
          PyObject *pyvalue = convert_function(cresult);\
          if (unlikely(!pyvalue)) {\
              PyErr_Clear();\
              pyvalue = Py_None; Py_INCREF(Py_None);\
          }\
          ret = PyMonitoring_FirePyReturnEvent(&__pyx_pymonitoring_state[__Pyx_Monitoring_PY_RETURN], __pyx_frame_code, offset, pyvalue);\
          Py_DECREF(pyvalue);\
      }\
      if (unlikely(ret == -1)) goto_error;\
  }
  #define __Pyx_TraceExceptionUnwind(offset, nogil)\
  if (!__Pyx_IsTracing(__Pyx_Monitoring_PY_UNWIND)); else {\
      if (nogil) {\
          if (CYTHON_TRACE_NOGIL) {\
              PyGILState_STATE state = PyGILState_Ensure();\
              (void) PyMonitoring_FirePyUnwindEvent(&__pyx_pymonitoring_state[__Pyx_Monitoring_PY_UNWIND], __pyx_frame_code, offset);\
              PyGILState_Release(state);\
          }\
      } else {\
          (void) PyMonitoring_FirePyUnwindEvent(&__pyx_pymonitoring_state[__Pyx_Monitoring_PY_UNWIND], __pyx_frame_code, offset);\
      }\
  }
  #if CYTHON_TRACE
  CYTHON_UNUSED static int __Pyx__TraceLine(PyMonitoringState *monitoring_state, PyObject *code_obj, int line, int offset);
  #define __Pyx_TraceLine(line, offset, nogil, goto_error)\
  if (!__Pyx_IsTracing(__Pyx_Monitoring_LINE)); else {\
      int ret = 0;\
      if (nogil) {\
          if (CYTHON_TRACE_NOGIL) {\
              PyGILState_STATE state = PyGILState_Ensure();\
              ret = __Pyx__TraceLine(&__pyx_pymonitoring_state[__Pyx_Monitoring_LINE], __pyx_frame_code, line, offset);\
              PyGILState_Release(state);\
          }\
      } else {\
          ret = __Pyx__TraceLine(&__pyx_pymonitoring_state[__Pyx_Monitoring_LINE], __pyx_frame_code, line, offset);\
      }\
      if (unlikely(ret == -1)) goto_error;\
  }
  #endif
#else
  #include "compile.h"
  #include "frameobject.h"
  #include "traceback.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
  #if CYTHON_PROFILE_REUSE_FRAME
    #define CYTHON_FRAME_MODIFIER static
    #define CYTHON_FRAME_DEL(frame)
  #else
    #define CYTHON_FRAME_MODIFIER
    #define CYTHON_FRAME_DEL(frame) Py_CLEAR(frame)
  #endif
  #if CYTHON_PROFILE_REUSE_CODEOBJ
    #define CYTHON_CODEOBJ_MODIFIER static
  #else
    #define CYTHON_CODEOBJ_MODIFIER
  #endif
  #define __Pyx_TraceDeclarationsFunc\
      CYTHON_CODEOBJ_MODIFIER PyCodeObject *__pyx_frame_code = NULL;\
      CYTHON_FRAME_MODIFIER PyFrameObject *__pyx_frame = NULL;\
      int __Pyx_use_tracing = 0;
  #define __Pyx_TraceDeclarationsGen\
      PyObject *__pyx_frame_code = __pyx_generator->gi_code;\
      CYTHON_FRAME_MODIFIER PyFrameObject *__pyx_frame = NULL;\
      int __Pyx_use_tracing = 0;
  #define __Pyx_TraceFrameInit(codeobj)\
      if (codeobj) __pyx_frame_code = (PyCodeObject*) codeobj;
  #define __Pyx_PyMonitoring_ExitScope(nogil)  {}
  #define __Pyx_TraceException(offset, reraised, fresh)  {}
  #define __Pyx_TraceExceptionHandled(offset)  {}
  #define __Pyx_TraceExceptionDone()  {}
  #define __Pyx_TurnOffSysMonitoringInParallel {} // Only needed for freethreading
#if PY_VERSION_HEX >= 0x030b00a2
  #if PY_VERSION_HEX >= 0x030C00b1
  #define __Pyx_IsTracing(tstate, check_tracing, check_funcs)\
     ((!(check_tracing) || !(tstate)->tracing) &&\
         (!(check_funcs) || (tstate)->c_profilefunc || (CYTHON_TRACE && (tstate)->c_tracefunc)))
  #else
  #define __Pyx_IsTracing(tstate, check_tracing, check_funcs)\
     (unlikely((tstate)->cframe->use_tracing) &&\
         (!(check_tracing) || !(tstate)->tracing) &&\
         (!(check_funcs) || (tstate)->c_profilefunc || (CYTHON_TRACE && (tstate)->c_tracefunc)))
  #endif
  #define __Pyx_EnterTracing(tstate)  PyThreadState_EnterTracing(tstate)
  #define __Pyx_LeaveTracing(tstate)  PyThreadState_LeaveTracing(tstate)
#elif PY_VERSION_HEX >= 0x030a00b1
  #define __Pyx_IsTracing(tstate, check_tracing, check_funcs)\
     (unlikely((tstate)->cframe->use_tracing) &&\
         (!(check_tracing) || !(tstate)->tracing) &&\
         (!(check_funcs) || (tstate)->c_profilefunc || (CYTHON_TRACE && (tstate)->c_tracefunc)))
  #define __Pyx_EnterTracing(tstate)\
      do { tstate->tracing++; tstate->cframe->use_tracing = 0; } while (0)
  #define __Pyx_LeaveTracing(tstate)\
      do {\
          tstate->tracing--;\
          tstate->cframe->use_tracing = ((CYTHON_TRACE && tstate->c_tracefunc != NULL)\
                                 || tstate->c_profilefunc != NULL);\
      } while (0)
#else
  #define __Pyx_IsTracing(tstate, check_tracing, check_funcs)\
     (unlikely((tstate)->use_tracing) &&\
         (!(check_tracing) || !(tstate)->tracing) &&\
         (!(check_funcs) || (tstate)->c_profilefunc || (CYTHON_TRACE && (tstate)->c_tracefunc)))
  #define __Pyx_EnterTracing(tstate)\
      do { tstate->tracing++; tstate->use_tracing = 0; } while (0)
  #define __Pyx_LeaveTracing(tstate)\
      do {\
          tstate->tracing--;\
          tstate->use_tracing = ((CYTHON_TRACE && tstate->c_tracefunc != NULL)\
                                         || tstate->c_profilefunc != NULL);\
      } while (0)
#endif
  #define __Pyx_TraceStartFunc(funcname, srcfile, firstlineno, offset, nogil, skip_event, goto_error)\
  if (nogil) {\
      if (CYTHON_TRACE_NOGIL) {\
          PyThreadState *tstate;\
          PyGILState_STATE state = PyGILState_Ensure();\
          tstate = __Pyx_PyThreadState_Current;\
          if (__Pyx_IsTracing(tstate, 1, 1)) {\
              __Pyx_use_tracing = __Pyx_TraceSetupAndCall((PyCodeObject**)&__pyx_frame_code, &__pyx_frame, tstate, funcname, srcfile, firstlineno, skip_event);\
          }\
          PyGILState_Release(state);\
          if (unlikely(__Pyx_use_tracing < 0)) goto_error;\
      }\
  } else {\
      PyThreadState* tstate = PyThreadState_GET();\
      if (__Pyx_IsTracing(tstate, 1, 1)) {\
          __Pyx_use_tracing = __Pyx_TraceSetupAndCall((PyCodeObject**)&__pyx_frame_code, &__pyx_frame, tstate, funcname, srcfile, firstlineno, skip_event);\
          if (unlikely(__Pyx_use_tracing < 0)) goto_error;\
      }\
  }
  #define __Pyx_TraceStartGen __Pyx_TraceStartFunc
  #define __Pyx_TraceYield(result, offset, goto_error)\
  if (likely(!__Pyx_use_tracing)); else {\
      PyThreadState* tstate = __Pyx_PyThreadState_Current;\
      if (__Pyx_IsTracing(tstate, 0, 0)) {\
          __Pyx_call_return_trace_func(tstate, __pyx_frame, (PyObject*)result, 0);\
      }\
      if ((1)); else goto_error;\
  }
  #define __Pyx_TraceResumeGen(funcname, srcfile, firstlineno, offset, goto_error)\
      __Pyx_TraceStartFunc(funcname, srcfile, firstlineno, offset, 0, 0, goto_error)
  CYTHON_UNUSED static void __Pyx_call_return_trace_func(PyThreadState *tstate, PyFrameObject *frame, PyObject *result, int delete_frame) {
      PyObject *type, *value, *traceback;
      __Pyx_ErrFetchInState(tstate, &type, &value, &traceback);
      __Pyx_EnterTracing(tstate);
      if (CYTHON_TRACE && tstate->c_tracefunc)
          tstate->c_tracefunc(tstate->c_traceobj, frame, PyTrace_RETURN, result);
      if (tstate->c_profilefunc)
          tstate->c_profilefunc(tstate->c_profileobj, frame, PyTrace_RETURN, result);
      if (delete_frame) {
          CYTHON_FRAME_DEL(frame);
      }
      __Pyx_LeaveTracing(tstate);
      __Pyx_ErrRestoreInState(tstate, type, value, traceback);
  }
  #define __Pyx_TraceReturnValue(result, offset, nogil, goto_error)\
  if (likely(!__Pyx_use_tracing)); else {\
      if (nogil) {\
          if (CYTHON_TRACE_NOGIL) {\
              PyThreadState *tstate;\
              PyGILState_STATE state = PyGILState_Ensure();\
              tstate = __Pyx_PyThreadState_Current;\
              if (__Pyx_IsTracing(tstate, 0, 0)) {\
                  __Pyx_call_return_trace_func(tstate, __pyx_frame, (PyObject*)result, 1);\
              }\
              PyGILState_Release(state);\
          }\
      } else {\
          PyThreadState* tstate = __Pyx_PyThreadState_Current;\
          if (__Pyx_IsTracing(tstate, 0, 0)) {\
              __Pyx_call_return_trace_func(tstate, __pyx_frame, (PyObject*)result, 1);\
          }\
      }\
      if ((1)); else goto_error;\
  }
  #define __Pyx_TraceReturnCValue(cresult, convert_function, offset, nogil, goto_error)\
  if (likely(!__Pyx_use_tracing)); else {\
      if (nogil) {\
          if (CYTHON_TRACE_NOGIL) {\
              PyThreadState *tstate;\
              PyGILState_STATE state = PyGILState_Ensure();\
              tstate = __Pyx_PyThreadState_Current;\
              if (__Pyx_IsTracing(tstate, 0, 0)) {\
                  PyObject *pyvalue = convert_function(cresult);\
                  if (unlikely(!pyvalue)) goto_error;\
                  __Pyx_call_return_trace_func(tstate, __pyx_frame, pyvalue, 1);\
                  Py_DECREF(pyvalue);\
              }\
              PyGILState_Release(state);\
          }\
      } else {\
          PyThreadState* tstate = __Pyx_PyThreadState_Current;\
          if (__Pyx_IsTracing(tstate, 0, 0)) {\
              PyObject *pyvalue = convert_function(cresult);\
              if (unlikely(!pyvalue)) goto_error;\
              __Pyx_call_return_trace_func(tstate, __pyx_frame, pyvalue, 1);\
              Py_DECREF(pyvalue);\
          }\
      }\
  }
  #define __Pyx_TraceExceptionUnwind(offset, nogil)\
  if (likely(!__Pyx_use_tracing)); else {\
      if (nogil) {\
          if (CYTHON_TRACE_NOGIL) {\
              PyThreadState *tstate;\
              PyGILState_STATE state = PyGILState_Ensure();\
              tstate = __Pyx_PyThreadState_Current;\
              if (__Pyx_IsTracing(tstate, 0, 0)) {\
                  __Pyx_call_return_trace_func(tstate, __pyx_frame, Py_None, 1);\
              }\
              PyGILState_Release(state);\
          }\
      } else {\
          PyThreadState* tstate = __Pyx_PyThreadState_Current;\
          if (__Pyx_IsTracing(tstate, 0, 0)) {\
              __Pyx_call_return_trace_func(tstate, __pyx_frame, Py_None, 1);\
          }\
      }\
  }
  static int __Pyx_TraceSetupAndCall(PyCodeObject** code, PyFrameObject** frame, PyThreadState* tstate, const char *funcname, const char *srcfile, int firstlineno, int skip_event);
#if CYTHON_TRACE
  CYTHON_UNUSED static int __Pyx_call_line_trace_func(PyThreadState *tstate, PyFrameObject *frame, int line);
  #define __Pyx_TraceLine(line, offset, nogil, goto_error)\
  if (likely(!__Pyx_use_tracing)); else {\
      int ret = 0;\
      if (nogil) {\
          if (CYTHON_TRACE_NOGIL) {\
              PyThreadState *tstate;\
              PyGILState_STATE state = __Pyx_PyGILState_Ensure();\
              tstate = __Pyx_PyThreadState_Current;\
              if (__Pyx_IsTracing(tstate, 0, 0) && tstate->c_tracefunc && __pyx_frame->f_trace) {\
                  ret = __Pyx_call_line_trace_func(tstate, __pyx_frame, line);\
              }\
              __Pyx_PyGILState_Release(state);\
          }\
      } else {\
          PyThreadState* tstate = __Pyx_PyThreadState_Current;\
          if (__Pyx_IsTracing(tstate, 0, 0) && tstate->c_tracefunc && __pyx_frame->f_trace) {\
              ret = __Pyx_call_line_trace_func(tstate, __pyx_frame, line);\
          }\
      }\
      if (unlikely(ret)) goto_error;\
  }
#endif
#endif
#else
  #define __Pyx_TraceDeclarationsFunc
  #define __Pyx_TraceDeclarationsGen
  #define __Pyx_TraceExceptionDone()  {}
  #define __Pyx_TraceFrameInit(codeobj)  {}
  #define __Pyx_TurnOffSysMonitoringInParallel {}
  #define __Pyx_PyMonitoring_ExitScope(nogil)  {}
  #define __Pyx_TraceException(offset, reraised, fresh)  {}
  #define __Pyx_TraceExceptionUnwind(offset, nogil)  {}
  #define __Pyx_TraceExceptionHandled(offset)  {}
  #define __Pyx_TraceStartFunc(funcname, srcfile, firstlineno, offset, nogil, skip_event, goto_error)   if ((1)); else goto_error;
  #define __Pyx_TraceStartGen __Pyx_TraceStartFunc
  #define __Pyx_TraceResumeGen(funcname, srcfile, firstlineno, offset, goto_error)   if ((1)); else goto_error;
  #define __Pyx_TraceYield(result, offset, goto_error)   if ((1)); else goto_error;
  #define __Pyx_TraceReturnValue(result, offset, nogil, goto_error)\
      if ((1)); else goto_error;
  #define __Pyx_TraceReturnCValue(cresult, convert_function, offset, nogil, goto_error)\
      if ((1)); else { (void) convert_function; goto_error }
#endif
#if !CYTHON_TRACE
  #define __Pyx_TraceLine(line, offset, nogil, goto_error)   if ((1)); else goto_error;
#endif

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

/* UnpackUnboundCMethod.proto */
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

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

/* RaiseUnexpectedTypeError.proto */
static int __Pyx_RaiseUnexpectedTypeError(const char *expected, 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

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

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

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

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

/* PySequenceMultiply.proto */
#define __Pyx_PySequence_Multiply_Left(mul, seq)  __Pyx_PySequence_Multiply(seq, mul)
static CYTHON_INLINE PyObject* __Pyx_PySequence_Multiply(PyObject *seq, Py_ssize_t mul);

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

/* StringJoin.proto */
static CYTHON_INLINE PyObject* __Pyx_PyBytes_Join(PyObject* sep, PyObject* values);

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

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

/* PyObjectDelAttr.proto */
#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

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

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

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

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

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

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

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

/* 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.proto */
static void __Pyx_RejectKeywords(const char* function_name, PyObject *kwds);

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

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

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

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

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

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

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

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

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

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

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

/* GetModuleGlobalName.proto */
#if CYTHON_USE_DICT_VERSIONS
#define __Pyx_GetModuleGlobalName(var, name)  do {\
    static PY_UINT64_T __pyx_dict_version = 0;\
    static PyObject *__pyx_dict_cached_value = NULL;\
    (var) = (likely(__pyx_dict_version == __PYX_GET_DICT_VERSION(__pyx_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

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

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

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

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

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

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

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

/* py_dict_pop_ignore.proto */
static CYTHON_INLINE int __Pyx_PyDict_Pop_ignore(PyObject *d, PyObject *key, PyObject *default_value);

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

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

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

/* RaiseClosureNameError.proto */
static void __Pyx_RaiseClosureNameError(const char *varname);

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

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

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

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

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

/* HasAttr.proto */
#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

/* CallTypeTraverse.proto */
#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

/* CallNextTpDealloc.proto */
static void __Pyx_call_next_tp_dealloc(PyObject* obj, destructor current_tp_dealloc);

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

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

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

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

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

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

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

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

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

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

/* TypeImport.proto */
#ifndef __PYX_HAVE_RT_ImportType_proto_3_1_2
#define __PYX_HAVE_RT_ImportType_proto_3_1_2
#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_1_2(s) alignof(s)
#else
#define __PYX_GET_STRUCT_ALIGNMENT_3_1_2(s) sizeof(void*)
#endif
enum __Pyx_ImportType_CheckSize_3_1_2 {
   __Pyx_ImportType_CheckSize_Error_3_1_2 = 0,
   __Pyx_ImportType_CheckSize_Warn_3_1_2 = 1,
   __Pyx_ImportType_CheckSize_Ignore_3_1_2 = 2
};
static PyTypeObject *__Pyx_ImportType_3_1_2(PyObject* module, const char *module_name, const char *class_name, size_t size, size_t alignment, enum __Pyx_ImportType_CheckSize_3_1_2 check_size);
#endif

/* ImportDottedModule.proto */
static PyObject *__Pyx_ImportDottedModule(PyObject *name, PyObject *parts_tuple);
static PyObject *__Pyx_ImportDottedModule_WalkParts(PyObject *module, PyObject *name, PyObject *parts_tuple);

/* ListPack.proto */
static PyObject *__Pyx_PyList_Pack(Py_ssize_t n, ...);

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

/* dict_setdefault.proto */
static CYTHON_INLINE PyObject *__Pyx_PyDict_SetDefault(PyObject *d, PyObject *key, PyObject *default_value, int is_safe_type);

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

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

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

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

/* CythonFunctionShared.proto */
#define __Pyx_CyFunction_USED
#define __Pyx_CYFUNCTION_STATICMETHOD  0x01
#define __Pyx_CYFUNCTION_CLASSMETHOD   0x02
#define __Pyx_CYFUNCTION_CCLASS        0x04
#define __Pyx_CYFUNCTION_COROUTINE     0x08
#define __Pyx_CyFunction_GetClosure(f)\
    (((__pyx_CyFunctionObject *) (f))->func_closure)
#if PY_VERSION_HEX < 0x030900B1 || CYTHON_COMPILING_IN_LIMITED_API
  #define __Pyx_CyFunction_GetClassObj(f)\
      (((__pyx_CyFunctionObject *) (f))->func_classobj)
#else
  #define __Pyx_CyFunction_GetClassObj(f)\
      ((PyObject*) ((PyCMethodObject *) (f))->mm_class)
#endif
#define __Pyx_CyFunction_SetClassObj(f, classobj)\
    __Pyx__CyFunction_SetClassObj((__pyx_CyFunctionObject *) (f), (classobj))
#define __Pyx_CyFunction_Defaults(type, f)\
    ((type *)(((__pyx_CyFunctionObject *) (f))->defaults))
#define __Pyx_CyFunction_SetDefaultsGetter(f, g)\
    ((__pyx_CyFunctionObject *) (f))->defaults_getter = (g)
typedef struct {
#if CYTHON_COMPILING_IN_LIMITED_API
    PyObject_HEAD
    PyObject *func;
#elif PY_VERSION_HEX < 0x030900B1
    PyCFunctionObject func;
#else
    PyCMethodObject func;
#endif
#if CYTHON_BACKPORT_VECTORCALL ||\
        (CYTHON_COMPILING_IN_LIMITED_API && CYTHON_METH_FASTCALL)
    __pyx_vectorcallfunc func_vectorcall;
#endif
#if CYTHON_COMPILING_IN_LIMITED_API
    PyObject *func_weakreflist;
#endif
    PyObject *func_dict;
    PyObject *func_name;
    PyObject *func_qualname;
    PyObject *func_doc;
    PyObject *func_globals;
    PyObject *func_code;
    PyObject *func_closure;
#if PY_VERSION_HEX < 0x030900B1 || CYTHON_COMPILING_IN_LIMITED_API
    PyObject *func_classobj;
#endif
    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_BACKPORT_VECTORCALL || 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);

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

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

/* ArrayAPI.proto */
#ifndef _ARRAYARRAY_H
#define _ARRAYARRAY_H
typedef struct arraydescr {
    int typecode;
    int itemsize;
    PyObject * (*getitem)(struct arrayobject *, Py_ssize_t);
    int (*setitem)(struct arrayobject *, Py_ssize_t, PyObject *);
    char *formats;
} arraydescr;
struct arrayobject {
    PyObject_HEAD
    Py_ssize_t ob_size;
    union {
        char *ob_item;
        float *as_floats;
        double *as_doubles;
        int *as_ints;
        unsigned int *as_uints;
        unsigned char *as_uchars;
        signed char *as_schars;
        char *as_chars;
        unsigned long *as_ulongs;
        long *as_longs;
        unsigned long long *as_ulonglongs;
        long long *as_longlongs;
        short *as_shorts;
        unsigned short *as_ushorts;
        #if PY_VERSION_HEX >= 0x030d0000
        Py_DEPRECATED(3.13)
        #endif
            wchar_t *as_pyunicodes;
        void *as_voidptr;
    } data;
    Py_ssize_t allocated;
    struct arraydescr *ob_descr;
    PyObject *weakreflist;
    int ob_exports;
};
#ifndef NO_NEWARRAY_INLINE
static CYTHON_INLINE PyObject * newarrayobject(PyTypeObject *type, Py_ssize_t size,
    struct arraydescr *descr) {
    arrayobject *op;
    size_t nbytes;
    if (size < 0) {
        PyErr_BadInternalCall();
        return NULL;
    }
    nbytes = size * descr->itemsize;
    if (nbytes / descr->itemsize != (size_t)size) {
        return PyErr_NoMemory();
    }
    op = (arrayobject *) type->tp_alloc(type, 0);
    if (op == NULL) {
        return NULL;
    }
    op->ob_descr = descr;
    op->allocated = size;
    op->weakreflist = NULL;
    __Pyx_SET_SIZE(op, size);
    if (size <= 0) {
        op->data.ob_item = NULL;
    }
    else {
        op->data.ob_item = PyMem_NEW(char, nbytes);
        if (op->data.ob_item == NULL) {
            Py_DECREF(op);
            return PyErr_NoMemory();
        }
    }
    return (PyObject *) op;
}
#else
PyObject* newarrayobject(PyTypeObject *type, Py_ssize_t size,
    struct arraydescr *descr);
#endif
static CYTHON_INLINE int resize(arrayobject *self, Py_ssize_t n) {
    void *items = (void*) self->data.ob_item;
    PyMem_Resize(items, char, (size_t)(n * self->ob_descr->itemsize));
    if (items == NULL) {
        PyErr_NoMemory();
        return -1;
    }
    self->data.ob_item = (char*) items;
    __Pyx_SET_SIZE(self, n);
    self->allocated = n;
    return 0;
}
static CYTHON_INLINE int resize_smart(arrayobject *self, Py_ssize_t n) {
    void *items = (void*) self->data.ob_item;
    Py_ssize_t newsize;
    if (n < self->allocated && n*4 > self->allocated) {
        __Pyx_SET_SIZE(self, n);
        return 0;
    }
    newsize = n + (n / 2) + 1;
    if (newsize <= n) {
        PyErr_NoMemory();
        return -1;
    }
    PyMem_Resize(items, char, (size_t)(newsize * self->ob_descr->itemsize));
    if (items == NULL) {
        PyErr_NoMemory();
        return -1;
    }
    self->data.ob_item = (char*) items;
    __Pyx_SET_SIZE(self, n);
    self->allocated = newsize;
    return 0;
}
#endif

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

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

/* CIntToPy.proto */
static CYTHON_INLINE PyObject* __Pyx_PyLong_From_int32_t(int32_t value);

/* CIntFromPy.proto */
static CYTHON_INLINE int32_t __Pyx_PyLong_As_int32_t(PyObject *);

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

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

/* CIntToPy.proto */
static CYTHON_INLINE PyObject* __Pyx_PyLong_From_int8_t(int8_t value);

/* CIntToPy.proto */
static CYTHON_INLINE PyObject* __Pyx_PyLong_From_int16_t(int16_t value);

/* CIntFromPy.proto */
static CYTHON_INLINE int8_t __Pyx_PyLong_As_int8_t(PyObject *);

/* CIntFromPy.proto */
static CYTHON_INLINE int16_t __Pyx_PyLong_As_int16_t(PyObject *);

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

/* CIntFromPy.proto */
static CYTHON_INLINE uint32_t __Pyx_PyLong_As_uint32_t(PyObject *);

/* CIntToPy.proto */
static CYTHON_INLINE PyObject* __Pyx_PyLong_From_uint8_t(uint8_t value);

/* CIntFromPy.proto */
static CYTHON_INLINE int64_t __Pyx_PyLong_As_int64_t(PyObject *);

/* CIntToPy.proto */
static CYTHON_INLINE PyObject* __Pyx_PyLong_From_int64_t(int64_t value);

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

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

/* IterNextPlain.proto */
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

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

/* CoroutineBase.proto */
struct __pyx_CoroutineObject;
typedef PyObject *(*__pyx_coroutine_body_t)(struct __pyx_CoroutineObject *, PyThreadState *, PyObject *);
#if CYTHON_USE_EXC_INFO_STACK
#define __Pyx_ExcInfoStruct  _PyErr_StackItem
#else
typedef struct {
    PyObject *exc_type;
    PyObject *exc_value;
    PyObject *exc_traceback;
} __Pyx_ExcInfoStruct;
#endif
typedef struct __pyx_CoroutineObject {
    PyObject_HEAD
    __pyx_coroutine_body_t body;
    PyObject *closure;
    __Pyx_ExcInfoStruct gi_exc_state;
    PyObject *gi_weakreflist;
    PyObject *classobj;
    PyObject *yieldfrom;
    __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 */
#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);

/* GetRuntimeVersion.proto */
static unsigned long __Pyx_get_runtime_version(void);

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

/* FunctionImport.proto */
static int __Pyx_ImportFunction_3_1_2(PyObject *module, const char *funcname, void (**f)(void), const char *sig);

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

#if !CYTHON_COMPILING_IN_LIMITED_API
static CYTHON_INLINE double __pyx_f_7cpython_7complex_7complex_4real_real(PyComplexObject *__pyx_v_self); /* proto*/
#endif
#if !CYTHON_COMPILING_IN_LIMITED_API
static CYTHON_INLINE double __pyx_f_7cpython_7complex_7complex_4imag_imag(PyComplexObject *__pyx_v_self); /* proto*/
#endif
static PyObject *__pyx_f_5pysam_7libcbcf_13VariantHeader__subset_samples(struct __pyx_obj_5pysam_7libcbcf_VariantHeader *__pyx_v_self, PyObject *__pyx_v_include_samples); /* proto*/
static PyObject *__pyx_f_5pysam_7libcbcf_13VariantHeader__add_sample(struct __pyx_obj_5pysam_7libcbcf_VariantHeader *__pyx_v_self, PyObject *__pyx_v_name); /* proto*/
static PyObject *__pyx_f_5pysam_7libcbcf_13VariantHeader__hdr_sync(struct __pyx_obj_5pysam_7libcbcf_VariantHeader *__pyx_v_self); /* proto*/
static int __pyx_f_5pysam_7libcbcf_11VariantFile_write(struct __pyx_obj_5pysam_7libcbcf_VariantFile *__pyx_v_self, struct __pyx_obj_5pysam_7libcbcf_VariantRecord *__pyx_v_record, int __pyx_skip_dispatch); /* proto*/

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

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

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

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

/* Module declarations from "posix.types" */

/* Module declarations from "pysam.libchtslib" */

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

/* Module declarations from "cython" */

/* Module declarations from "__builtin__" */

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

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

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

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

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

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

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

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

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

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

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

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

/* Module declarations from "__builtin__" */

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

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

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

/* Module declarations from "__builtin__" */

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

/* Module declarations from "cpython" */

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

/* Module declarations from "array" */

/* Module declarations from "cpython.array" */
static CYTHON_INLINE int __pyx_f_7cpython_5array_extend_buffer(arrayobject *, char *, Py_ssize_t); /*proto*/

/* Module declarations from "pysam.libcutils" */
static PyObject *(*__pyx_f_5pysam_9libcutils_OSError_from_errno)(PyObject *, struct __pyx_opt_args_5pysam_9libcutils_OSError_from_errno *__pyx_optional_args); /*proto*/
static PyObject *(*__pyx_f_5pysam_9libcutils_charptr_to_str)(char const *, struct __pyx_opt_args_5pysam_9libcutils_charptr_to_str *__pyx_optional_args); /*proto*/
static PyObject *(*__pyx_f_5pysam_9libcutils_charptr_to_str_w_len)(char const *, size_t, struct __pyx_opt_args_5pysam_9libcutils_charptr_to_str_w_len *__pyx_optional_args); /*proto*/
static PyObject *(*__pyx_f_5pysam_9libcutils_force_str)(PyObject *, struct __pyx_opt_args_5pysam_9libcutils_force_str *__pyx_optional_args); /*proto*/
static PyObject *(*__pyx_f_5pysam_9libcutils_force_bytes)(PyObject *, struct __pyx_opt_args_5pysam_9libcutils_force_bytes *__pyx_optional_args); /*proto*/
static PyObject *(*__pyx_f_5pysam_9libcutils_decode_bytes)(PyObject *, struct __pyx_opt_args_5pysam_9libcutils_decode_bytes *__pyx_optional_args); /*proto*/
static PyObject *(*__pyx_f_5pysam_9libcutils_encode_filename)(PyObject *); /*proto*/
static PyObject *(*__pyx_f_5pysam_9libcutils_from_string_and_size)(char const *, size_t); /*proto*/

/* Module declarations from "pysam.libcbcf" */
static int __pyx_v_5pysam_7libcbcf_MAX_POS;
static PyObject *__pyx_v_5pysam_7libcbcf_VALUE_TYPES = 0;
static PyObject *__pyx_v_5pysam_7libcbcf_METADATA_TYPES = 0;
static PyObject *__pyx_v_5pysam_7libcbcf_METADATA_LENGTHS = 0;
static PyObject *__pyx_v_5pysam_7libcbcf__nothing = 0;
static PyObject *__pyx_v_5pysam_7libcbcf_bcf_str_cache = 0;
static CYTHON_INLINE PyObject *__pyx_f_5pysam_7libcbcf_bcf_str_cache_get_charptr(char const *); /*proto*/
static int __pyx_f_5pysam_7libcbcf_comb(int, int); /*proto*/
static CYTHON_INLINE int __pyx_f_5pysam_7libcbcf_bcf_geno_combinations(int, int); /*proto*/
static CYTHON_INLINE int __pyx_f_5pysam_7libcbcf_check_header_id(bcf_hdr_t *, int, int); /*proto*/
static CYTHON_INLINE int __pyx_f_5pysam_7libcbcf_is_gt_fmt(bcf_hdr_t *, int); /*proto*/
static CYTHON_INLINE int __pyx_f_5pysam_7libcbcf_bcf_genotype_count(bcf_hdr_t *, bcf1_t *, int); /*proto*/
static PyObject *__pyx_f_5pysam_7libcbcf_char_array_to_tuple(char const **, Py_ssize_t, struct __pyx_opt_args_5pysam_7libcbcf_char_array_to_tuple *__pyx_optional_args); /*proto*/
static PyObject *__pyx_f_5pysam_7libcbcf_bcf_array_to_object(void *, int, Py_ssize_t, Py_ssize_t, int); /*proto*/
static PyObject *__pyx_f_5pysam_7libcbcf_bcf_object_to_array(PyObject *, void *, int, Py_ssize_t, int); /*proto*/
static PyObject *__pyx_f_5pysam_7libcbcf_bcf_empty_array(int, Py_ssize_t, int); /*proto*/
static PyObject *__pyx_f_5pysam_7libcbcf_bcf_copy_expand_array(void *, int, size_t, void *, int, size_t, int); /*proto*/
static PyObject *__pyx_f_5pysam_7libcbcf_bcf_get_value_count(struct __pyx_obj_5pysam_7libcbcf_VariantRecord *, int, int, Py_ssize_t *, int *, int); /*proto*/
static PyObject *__pyx_f_5pysam_7libcbcf_bcf_info_get_value(struct __pyx_obj_5pysam_7libcbcf_VariantRecord *, bcf_info_t const *); /*proto*/
static PyObject *__pyx_f_5pysam_7libcbcf_bcf_check_values(struct __pyx_obj_5pysam_7libcbcf_VariantRecord *, PyObject *, int, int, int, int, int, Py_ssize_t, Py_ssize_t *, int *, int *); /*proto*/
static PyObject *__pyx_f_5pysam_7libcbcf_bcf_encode_alleles(struct __pyx_obj_5pysam_7libcbcf_VariantRecord *, PyObject *); /*proto*/
static PyObject *__pyx_f_5pysam_7libcbcf_bcf_info_set_value(struct __pyx_obj_5pysam_7libcbcf_VariantRecord *, PyObject *, PyObject *); /*proto*/
static PyObject *__pyx_f_5pysam_7libcbcf_bcf_format_get_value(struct __pyx_obj_5pysam_7libcbcf_VariantRecordSample *, PyObject *); /*proto*/
static PyObject *__pyx_f_5pysam_7libcbcf_bcf_format_set_value(struct __pyx_obj_5pysam_7libcbcf_VariantRecordSample *, PyObject *, PyObject *); /*proto*/
static PyObject *__pyx_f_5pysam_7libcbcf_bcf_format_del_value(struct __pyx_obj_5pysam_7libcbcf_VariantRecordSample *, PyObject *); /*proto*/
static PyObject *__pyx_f_5pysam_7libcbcf_bcf_format_get_allele_indices(struct __pyx_obj_5pysam_7libcbcf_VariantRecordSample *); /*proto*/
static PyObject *__pyx_f_5pysam_7libcbcf_bcf_format_get_alleles(struct __pyx_obj_5pysam_7libcbcf_VariantRecordSample *); /*proto*/
static int __pyx_f_5pysam_7libcbcf_bcf_sample_get_phased(struct __pyx_obj_5pysam_7libcbcf_VariantRecordSample *); /*proto*/
static PyObject *__pyx_f_5pysam_7libcbcf_bcf_sample_set_phased(struct __pyx_obj_5pysam_7libcbcf_VariantRecordSample *, int); /*proto*/
static CYTHON_INLINE PyObject *__pyx_f_5pysam_7libcbcf_bcf_sync_end(struct __pyx_obj_5pysam_7libcbcf_VariantRecord *); /*proto*/
static CYTHON_INLINE int __pyx_f_5pysam_7libcbcf_has_symbolic_allele(struct __pyx_obj_5pysam_7libcbcf_VariantRecord *); /*proto*/
static struct __pyx_obj_5pysam_7libcbcf_VariantHeaderRecord *__pyx_f_5pysam_7libcbcf_makeVariantHeaderRecord(struct __pyx_obj_5pysam_7libcbcf_VariantHeader *, bcf_hrec_t *); /*proto*/
static struct __pyx_obj_5pysam_7libcbcf_VariantHeaderRecords *__pyx_f_5pysam_7libcbcf_makeVariantHeaderRecords(struct __pyx_obj_5pysam_7libcbcf_VariantHeader *); /*proto*/
static struct __pyx_obj_5pysam_7libcbcf_VariantMetadata *__pyx_f_5pysam_7libcbcf_makeVariantMetadata(struct __pyx_obj_5pysam_7libcbcf_VariantHeader *, int, int); /*proto*/
static struct __pyx_obj_5pysam_7libcbcf_VariantHeaderMetadata *__pyx_f_5pysam_7libcbcf_makeVariantHeaderMetadata(struct __pyx_obj_5pysam_7libcbcf_VariantHeader *, int32_t); /*proto*/
static struct __pyx_obj_5pysam_7libcbcf_VariantContig *__pyx_f_5pysam_7libcbcf_makeVariantContig(struct __pyx_obj_5pysam_7libcbcf_VariantHeader *, int); /*proto*/
static struct __pyx_obj_5pysam_7libcbcf_VariantHeaderContigs *__pyx_f_5pysam_7libcbcf_makeVariantHeaderContigs(struct __pyx_obj_5pysam_7libcbcf_VariantHeader *); /*proto*/
static struct __pyx_obj_5pysam_7libcbcf_VariantHeaderSamples *__pyx_f_5pysam_7libcbcf_makeVariantHeaderSamples(struct __pyx_obj_5pysam_7libcbcf_VariantHeader *); /*proto*/
static struct __pyx_obj_5pysam_7libcbcf_VariantHeader *__pyx_f_5pysam_7libcbcf_makeVariantHeader(bcf_hdr_t *); /*proto*/
static CYTHON_INLINE int __pyx_f_5pysam_7libcbcf_bcf_header_get_info_id(bcf_hdr_t *, PyObject *); /*proto*/
static struct __pyx_obj_5pysam_7libcbcf_VariantRecordFilter *__pyx_f_5pysam_7libcbcf_makeVariantRecordFilter(struct __pyx_obj_5pysam_7libcbcf_VariantRecord *); /*proto*/
static struct __pyx_obj_5pysam_7libcbcf_VariantRecordFormat *__pyx_f_5pysam_7libcbcf_makeVariantRecordFormat(struct __pyx_obj_5pysam_7libcbcf_VariantRecord *); /*proto*/
static struct __pyx_obj_5pysam_7libcbcf_VariantRecordInfo *__pyx_f_5pysam_7libcbcf_makeVariantRecordInfo(struct __pyx_obj_5pysam_7libcbcf_VariantRecord *); /*proto*/
static struct __pyx_obj_5pysam_7libcbcf_VariantRecordSamples *__pyx_f_5pysam_7libcbcf_makeVariantRecordSamples(struct __pyx_obj_5pysam_7libcbcf_VariantRecord *); /*proto*/
static struct __pyx_obj_5pysam_7libcbcf_VariantRecord *__pyx_f_5pysam_7libcbcf_makeVariantRecord(struct __pyx_obj_5pysam_7libcbcf_VariantHeader *, bcf1_t *); /*proto*/
static struct __pyx_obj_5pysam_7libcbcf_VariantRecordSample *__pyx_f_5pysam_7libcbcf_makeVariantRecordSample(struct __pyx_obj_5pysam_7libcbcf_VariantRecord *, int32_t); /*proto*/
static struct __pyx_obj_5pysam_7libcbcf_BCFIndex *__pyx_f_5pysam_7libcbcf_makeBCFIndex(struct __pyx_obj_5pysam_7libcbcf_VariantHeader *, hts_idx_t *); /*proto*/
static struct __pyx_obj_5pysam_7libcbcf_TabixIndex *__pyx_f_5pysam_7libcbcf_makeTabixIndex(tbx_t *); /*proto*/
static void __pyx_f_5pysam_7libcbcf__stop_BCFIterator(struct __pyx_obj_5pysam_7libcbcf_BCFIterator *, bcf1_t *); /*proto*/
static PyObject *__pyx_f_5pysam_7libcbcf___pyx_unpickle_VariantHeaderRecords__set_state(struct __pyx_obj_5pysam_7libcbcf_VariantHeaderRecords *, PyObject *); /*proto*/
static PyObject *__pyx_f_5pysam_7libcbcf___pyx_unpickle_VariantMetadata__set_state(struct __pyx_obj_5pysam_7libcbcf_VariantMetadata *, PyObject *); /*proto*/
static PyObject *__pyx_f_5pysam_7libcbcf___pyx_unpickle_VariantHeaderMetadata__set_state(struct __pyx_obj_5pysam_7libcbcf_VariantHeaderMetadata *, PyObject *); /*proto*/
static PyObject *__pyx_f_5pysam_7libcbcf___pyx_unpickle_VariantContig__set_state(struct __pyx_obj_5pysam_7libcbcf_VariantContig *, PyObject *); /*proto*/
static PyObject *__pyx_f_5pysam_7libcbcf___pyx_unpickle_VariantHeaderContigs__set_state(struct __pyx_obj_5pysam_7libcbcf_VariantHeaderContigs *, PyObject *); /*proto*/
static PyObject *__pyx_f_5pysam_7libcbcf___pyx_unpickle_VariantHeaderSamples__set_state(struct __pyx_obj_5pysam_7libcbcf_VariantHeaderSamples *, PyObject *); /*proto*/
static PyObject *__pyx_f_5pysam_7libcbcf___pyx_unpickle_VariantRecordFilter__set_state(struct __pyx_obj_5pysam_7libcbcf_VariantRecordFilter *, PyObject *); /*proto*/
static PyObject *__pyx_f_5pysam_7libcbcf___pyx_unpickle_VariantRecordFormat__set_state(struct __pyx_obj_5pysam_7libcbcf_VariantRecordFormat *, PyObject *); /*proto*/
static PyObject *__pyx_f_5pysam_7libcbcf___pyx_unpickle_VariantRecordInfo__set_state(struct __pyx_obj_5pysam_7libcbcf_VariantRecordInfo *, PyObject *); /*proto*/
static PyObject *__pyx_f_5pysam_7libcbcf___pyx_unpickle_VariantRecordSamples__set_state(struct __pyx_obj_5pysam_7libcbcf_VariantRecordSamples *, PyObject *); /*proto*/
static PyObject *__pyx_f_5pysam_7libcbcf___pyx_unpickle_VariantRecordSample__set_state(struct __pyx_obj_5pysam_7libcbcf_VariantRecordSample *, PyObject *); /*proto*/
static PyObject *__pyx_f_5pysam_7libcbcf___pyx_unpickle_BaseIndex__set_state(struct __pyx_obj_5pysam_7libcbcf_BaseIndex *, PyObject *); /*proto*/
/* #### Code section: typeinfo ### */
/* #### Code section: before_global_var ### */
#define __Pyx_MODULE_NAME "pysam.libcbcf"
extern int __pyx_module_is_main_pysam__libcbcf;
int __pyx_module_is_main_pysam__libcbcf = 0;

/* Implementation of "pysam.libcbcf" */
/* #### Code section: global_var ### */
static PyObject *__pyx_builtin_object;
static PyObject *__pyx_builtin_range;
static PyObject *__pyx_builtin_ValueError;
static PyObject *__pyx_builtin_AssertionError;
static PyObject *__pyx_builtin_TypeError;
static PyObject *__pyx_builtin_KeyError;
static PyObject *__pyx_builtin_IndexError;
static PyObject *__pyx_builtin_MemoryError;
static PyObject *__pyx_builtin_enumerate;
static PyObject *__pyx_builtin_NotImplemented;
static PyObject *__pyx_builtin_reversed;
static PyObject *__pyx_builtin_IOError;
static PyObject *__pyx_builtin_StopIteration;
/* #### Code section: string_decls ### */
static const char __pyx_k_[] = ",";
static const char __pyx_k_1[] = "\2301";
static const char __pyx_k_A[] = "A";
static const char __pyx_k_G[] = "G";
static const char __pyx_k_Q[] = "\200\001\330\004\n\210+\220Q";
static const char __pyx_k_R[] = "R";
static const char __pyx_k_a[] = "a";
static const char __pyx_k_c[] = "c";
static const char __pyx_k_d[] = "d";
static const char __pyx_k_f[] = "f";
static const char __pyx_k_i[] = "i";
static const char __pyx_k_k[] = "k";
static const char __pyx_k_l[] = "l";
static const char __pyx_k_m[] = "m";
static const char __pyx_k_n[] = "n";
static const char __pyx_k_o[] = "o";
static const char __pyx_k_p[] = "p";
static const char __pyx_k_q[] = "\230q";
static const char __pyx_k_r[] = "r";
static const char __pyx_k_s[] = "s";
static const char __pyx_k_v[] = "v";
static const char __pyx_k_w[] = "w";
static const char __pyx_k_x[] = "x";
static const char __pyx_k_z[] = "z";
static const char __pyx_k_1D[] = "\200\001\330\004\020\220\001\220\021\360\006\000\005\024\2201\220D\230\001\330\004\010\210\010\220\001";
static const char __pyx_k_1F[] = "\200\001\330\004+\2501\250F\260!";
static const char __pyx_k_GT[] = "GT";
static const char __pyx_k_ID[] = "ID";
static const char __pyx_k__2[] = "";
static const char __pyx_k__4[] = ".";
static const char __pyx_k__5[] = "\"";
static const char __pyx_k__8[] = ", ";
static const char __pyx_k_gc[] = "gc";
static const char __pyx_k_gz[] = ".gz";
static const char __pyx_k_id[] = "id";
static const char __pyx_k_op[] = "op";
static const char __pyx_k_os[] = "os";
static const char __pyx_k_tp[] = "tp";
static const char __pyx_k_wb[] = "wb";
static const char __pyx_k_wz[] = "wz";
static const char __pyx_k_1_2[] = "\200\001\330\0041\260\021\260&\270\001";
static const char __pyx_k_2_6[] = "\200\001\330\0042\260!\2606\270\021";
static const char __pyx_k_31F[] = "\200\001\330\0043\2601\260F\270!";
static const char __pyx_k_ALT[] = "ALT";
static const char __pyx_k_A_2[] = "\240A";
static const char __pyx_k_A_3[] = "\200A";
static const char __pyx_k_A_q[] = "\200A\360\006\000\t\020\320\017'\240q\250\001";
static const char __pyx_k_BND[] = "BND";
static const char __pyx_k_END[] = "END";
static const char __pyx_k_MNP[] = "MNP";
static const char __pyx_k_Q_2[] = "\230Q";
static const char __pyx_k_QfA[] = "\200\001\330\004-\250Q\250f\260A";
static const char __pyx_k_REF[] = "REF";
static const char __pyx_k_SNP[] = "SNP";
static const char __pyx_k__11[] = "-";
static const char __pyx_k__12[] = "?";
static const char __pyx_k__13[] = "\230!";
static const char __pyx_k__14[] = "\240\001";
static const char __pyx_k__15[] = "\230\001";
static const char __pyx_k__16[] = "\270!";
static const char __pyx_k__17[] = "_";
static const char __pyx_k__18[] = "\240\021";
static const char __pyx_k_a_2[] = "\220a";
static const char __pyx_k_add[] = "add";
static const char __pyx_k_all[] = "__all__";
static const char __pyx_k_arg[] = "arg";
static const char __pyx_k_bcf[] = "bcf";
static const char __pyx_k_bid[] = "bid";
static const char __pyx_k_cmp[] = "cmp";
static const char __pyx_k_del[] = "__del__";
static const char __pyx_k_end[] = "end";
static const char __pyx_k_fmt[] = "fmt";
static const char __pyx_k_get[] = "get";
static const char __pyx_k_hdr[] = "hdr";
static const char __pyx_k_idx[] = "idx";
static const char __pyx_k_key[] = "key";
static const char __pyx_k_len[] = "__len__";
static const char __pyx_k_msg[] = "msg";
static const char __pyx_k_new[] = "__new__";
static const char __pyx_k_pop[] = "pop";
static const char __pyx_k_ptr[] = "ptr";
static const char __pyx_k_q_a[] = "\200\001\330\004/\250q\260\006\260a";
static const char __pyx_k_rec[] = "rec";
static const char __pyx_k_ref[] = "ref";
static const char __pyx_k_res[] = "res";
static const char __pyx_k_ret[] = "ret";
static const char __pyx_k_rid[] = "rid";
static const char __pyx_k_rwa[] = "rwa";
static const char __pyx_k_set[] = "__set__";
static const char __pyx_k_str[] = "__str__";
static const char __pyx_k_sys[] = "sys";
static const char __pyx_k_tid[] = "tid";
static const char __pyx_k_wb0[] = "wb0";
static const char __pyx_k_wbu[] = "wbu";
static const char __pyx_k_A_1F[] = "\200A\330\010\017\320\017#\2401\240F\250!";
static const char __pyx_k_A_AQ[] = "\200A\360\006\000\t\020\320\017,\250A\250Q";
static const char __pyx_k_A_AT[] = "\200A\330\010\017\320\017 \240\001\240\033\250A\250T\260\021";
static const char __pyx_k_A_G1[] = "\200A\330\010\014\210G\2201";
static const char __pyx_k_A_Kq[] = "\200A\330\010\014\210K\220q";
static const char __pyx_k_A_Qa[] = "\200A\360\006\000\t\020\320\017%\240Q\240a";
static const char __pyx_k_A_iq[] = "\200A\330\010\016\210i\220q\230\001";
static const char __pyx_k_A_t1[] = "\200A\360\006\000\t\020\210t\2201";
static const char __pyx_k_Flag[] = "Flag";
static const char __pyx_k_INFO[] = "INFO";
static const char __pyx_k_PASS[] = "PASS";
static const char __pyx_k_Type[] = "Type";
static const char __pyx_k_args[] = "args";
static const char __pyx_k_bkey[] = "bkey";
static const char __pyx_k_bool[] = "__bool__";
static const char __pyx_k_ckey[] = "ckey";
static const char __pyx_k_comb[] = "comb";
static const char __pyx_k_copy[] = "copy";
static const char __pyx_k_data[] = "data";
static const char __pyx_k_dict[] = "__dict__";
static const char __pyx_k_func[] = "__func__";
static const char __pyx_k_hash[] = "__hash__";
static const char __pyx_k_hlen[] = "hlen";
static const char __pyx_k_hrec[] = "hrec";
static const char __pyx_k_info[] = "info";
static const char __pyx_k_init[] = "__init__";
static const char __pyx_k_iter[] = "__iter__";
static const char __pyx_k_join[] = "join";
static const char __pyx_k_keys[] = "keys";
static const char __pyx_k_line[] = "line";
static const char __pyx_k_main[] = "__main__";
static const char __pyx_k_mode[] = "mode";
static const char __pyx_k_name[] = "name";
static const char __pyx_k_next[] = "next";
static const char __pyx_k_open[] = "open";
static const char __pyx_k_qual[] = "qual";
static const char __pyx_k_refs[] = "refs";
static const char __pyx_k_rlen[] = "rlen";
static const char __pyx_k_seek[] = "seek";
static const char __pyx_k_self[] = "self";
static const char __pyx_k_send[] = "send";
static const char __pyx_k_spec[] = "__spec__";
static const char __pyx_k_stop[] = "stop";
static const char __pyx_k_tell[] = "tell";
static const char __pyx_k_test[] = "__test__";
static const char __pyx_k_tidx[] = "tidx";
static const char __pyx_k_type[] = "type";
static const char __pyx_k_vars[] = "vars";
static const char __pyx_k_vlen[] = "vlen";
static const char __pyx_k_6_k_1[] = "\320\000\031\230\021\330\004\013\2106\220\021\220.\240\001\240\025\240k\260\031\270&\300\003\3001";
static const char __pyx_k_A_1_1[] = "\200A\330\010\t\330\014\020\220\001\220\021\330\017\020\330\014\023\2201\340\014\023\2201";
static const char __pyx_k_A_AV1[] = "\200A\330\010\034\230A\230V\2401";
static const char __pyx_k_A_AV5[] = "\200A\330\010\034\230A\230V\2405\250\001";
static const char __pyx_k_A_AXQ[] = "\200A\340\010\014\210A\210X\220Q";
static const char __pyx_k_A_QfA[] = "\200A\340\010\035\230Q\230f\240A";
static const char __pyx_k_A_T_q[] = "\200A\330\010\035\230T\240\021\330\010\017\210q\220\n\230'\240\021";
static const char __pyx_k_A_q_2[] = "\200A\360\006\000\t\020\320\017(\250\001\250\026\250q";
static const char __pyx_k_A_q_3[] = "\200A\330\010\017\210q";
static const char __pyx_k_A_t1A[] = "\200A\340\010\017\210t\2201\220A";
static const char __pyx_k_A_t1D[] = "\200A\340\010\017\210t\2201\220D\230\n\240!";
static const char __pyx_k_A_t4q[] = "\200A\360\006\000\t\020\210t\2204\220q";
static const char __pyx_k_FIXED[] = "FIXED";
static const char __pyx_k_Float[] = "Float";
static const char __pyx_k_INDEL[] = "INDEL";
static const char __pyx_k_OTHER[] = "OTHER";
static const char __pyx_k_bcf_2[] = ".bcf";
static const char __pyx_k_bcguz[] = "bcguz";
static const char __pyx_k_bgzfp[] = "bgzfp";
static const char __pyx_k_bline[] = "bline";
static const char __pyx_k_cinit[] = "__cinit__";
static const char __pyx_k_clear[] = "clear";
static const char __pyx_k_close[] = "close";
static const char __pyx_k_cmode[] = "cmode";
static const char __pyx_k_count[] = "count";
static const char __pyx_k_cstop[] = "cstop";
static const char __pyx_k_descr[] = "descr";
static const char __pyx_k_fetch[] = "fetch";
static const char __pyx_k_get_2[] = "__get__";
static const char __pyx_k_idstr[] = "idstr";
static const char __pyx_k_index[] = "index";
static const char __pyx_k_items[] = "items";
static const char __pyx_k_merge[] = "merge";
static const char __pyx_k_other[] = "other";
static const char __pyx_k_q_a_2[] = "\200\001\330\004'\240q\250\006\250a";
static const char __pyx_k_range[] = "range";
static const char __pyx_k_remap[] = "remap";
static const char __pyx_k_reset[] = "reset";
static const char __pyx_k_split[] = "split";
static const char __pyx_k_start[] = "start";
static const char __pyx_k_state[] = "state";
static const char __pyx_k_strip[] = "strip";
static const char __pyx_k_throw[] = "throw";
static const char __pyx_k_upper[] = "upper";
static const char __pyx_k_utf_8[] = "utf-8";
static const char __pyx_k_value[] = "value";
static const char __pyx_k_write[] = "write";
static const char __pyx_k_A_5_vQ[] = "\200A\330\010\017\210{\230!\2305\240\010\250\007\250v\260Q";
static const char __pyx_k_A_AQ_2[] = "\200A\360\006\000\t\020\320\017$\240A\240Q";
static const char __pyx_k_A_AU_q[] = "\200A\330\010\017\210}\230A\230U\240(\250'\260\026\260q";
static const char __pyx_k_A_G_aq[] = "\200A\340\010\014\210G\220;\230a\230q";
static const char __pyx_k_A_L_Ja[] = "\200A\340\010\014\210L\230\001\230\021\330\010\014\210J\220a";
static const char __pyx_k_A_YgQd[] = "\200A\340\010\017\320\017 \240\001\240\024\240Y\250g\260Q\260d\270!";
static const char __pyx_k_A_q_G1[] = "\200A\330\010\017\320\017\037\230q\240\004\240G\2501";
static const char __pyx_k_A_s_4q[] = "\200A\330\010\017\210s\220!\2204\220q";
static const char __pyx_k_A_t5_1[] = "\200A\330\010\017\210t\2205\230\003\2301";
static const char __pyx_k_A_t5_Q[] = "\200A\340\010\017\210t\2205\230\001\230\024\230Q";
static const char __pyx_k_A_t7_a[] = "\200A\330\010\017\210t\2207\230$\230a";
static const char __pyx_k_A_t7_b[] = "\200A\330\010\017\210t\2207\230$\230b\240\001";
static const char __pyx_k_A_y_AT[] = "\200A\360\006\000\t\020\210y\230\001\320\031,\250A\250T\260\021";
static const char __pyx_k_CONTIG[] = "CONTIG";
static const char __pyx_k_FILTER[] = "FILTER";
static const char __pyx_k_FORMAT[] = "FORMAT";
static const char __pyx_k_Number[] = "Number";
static const char __pyx_k_String[] = "String";
static const char __pyx_k_allele[] = "allele";
static const char __pyx_k_append[] = "append";
static const char __pyx_k_bchrom[] = "bchrom";
static const char __pyx_k_bt_len[] = "bt_len";
static const char __pyx_k_contig[] = "contig";
static const char __pyx_k_cstart[] = "cstart";
static const char __pyx_k_dict_2[] = "_dict";
static const char __pyx_k_enable[] = "enable";
static const char __pyx_k_filter[] = "filter";
static const char __pyx_k_fmt_id[] = "fmt_id";
static const char __pyx_k_format[] = "format";
static const char __pyx_k_header[] = "header";
static const char __pyx_k_idpair[] = "idpair";
static const char __pyx_k_kwargs[] = "kwargs";
static const char __pyx_k_length[] = "length";
static const char __pyx_k_module[] = "__module__";
static const char __pyx_k_name_2[] = "__name__";
static const char __pyx_k_next_2[] = "__next__";
static const char __pyx_k_number[] = "number";
static const char __pyx_k_object[] = "object";
static const char __pyx_k_phased[] = "phased";
static const char __pyx_k_pickle[] = "pickle";
static const char __pyx_k_ploidy[] = "ploidy";
static const char __pyx_k_q_4q_1[] = "\320\004\037\230q\340\010\t\330\014\023\2204\220q\230\001\330\017\020\330\014\023\2201";
static const char __pyx_k_quoted[] = "quoted";
static const char __pyx_k_record[] = "record";
static const char __pyx_k_reduce[] = "__reduce__";
static const char __pyx_k_region[] = "region";
static const char __pyx_k_remove[] = "remove";
static const char __pyx_k_reopen[] = "reopen";
static const char __pyx_k_result[] = "result";
static const char __pyx_k_sample[] = "sample";
static const char __pyx_k_scalar[] = "scalar";
static const char __pyx_k_update[] = "update";
static const char __pyx_k_v_type[] = "v_type";
static const char __pyx_k_values[] = "values";
static const char __pyx_k_A_4q_1D[] = "\200A\330\010\013\2104\210q\330\014\033\2301\230D\240\001\330\014\020\220\010\230\001";
static const char __pyx_k_A_HA_IQ[] = "\200A\330\010\014\210H\220A\330\010\014\210I\220Q";
static const char __pyx_k_A_d_auL[] = "\200A\330\010\036\230d\240'\250\021\330\010\026\220a\220u\230L\250\001";
static const char __pyx_k_A_s_4wc[] = "\200A\330\010\017\210s\220!\2204\220w\230c\240\021";
static const char __pyx_k_A_t1D_1[] = "\200A\340\010\017\210t\2201\220D\230\013\2401";
static const char __pyx_k_A_t1D_2[] = "\200A\330\010\017\210t\2201\220D\230\001";
static const char __pyx_k_A_t4uBa[] = "\200A\360\006\000\t\020\210t\2204\220u\230B\230a";
static const char __pyx_k_A_t7_gS[] = "\200A\330\010\017\210t\2207\230$\230g\240S\250\001";
static const char __pyx_k_GENERIC[] = "GENERIC";
static const char __pyx_k_IOError[] = "IOError";
static const char __pyx_k_Integer[] = "Integer";
static const char __pyx_k_MAX_POS[] = "MAX_POS";
static const char __pyx_k_NON_REF[] = "<NON_REF>";
static const char __pyx_k_OVERLAP[] = "OVERLAP";
static const char __pyx_k_alleles[] = "alleles";
static const char __pyx_k_bt_type[] = "bt_type";
static const char __pyx_k_dealloc[] = "__dealloc__";
static const char __pyx_k_default[] = "default";
static const char __pyx_k_delitem[] = "__delitem__";
static const char __pyx_k_disable[] = "disable";
static const char __pyx_k_dst_hdr[] = "dst_hdr";
static const char __pyx_k_errcode[] = "errcode";
static const char __pyx_k_genexpr[] = "genexpr";
static const char __pyx_k_get_tid[] = "get_tid";
static const char __pyx_k_getitem[] = "__getitem__";
static const char __pyx_k_hl_type[] = "hl_type";
static const char __pyx_k_ht_type[] = "ht_type";
static const char __pyx_k_info_id[] = "info_id";
static const char __pyx_k_is_open[] = "is_open";
static const char __pyx_k_nothing[] = "_nothing";
static const char __pyx_k_realloc[] = "realloc";
static const char __pyx_k_records[] = "records";
static const char __pyx_k_richcmp[] = "__richcmp__";
static const char __pyx_k_samples[] = "samples";
static const char __pyx_k_setitem[] = "__setitem__";
static const char __pyx_k_src_hdr[] = "src_hdr";
static const char __pyx_k_threads[] = "threads";
static const char __pyx_k_A_4q_Q_q[] = "\200A\330\010\013\2104\210q\330\014\030\230\001\230\024\230Q\330\014\020\220\007\220q";
static const char __pyx_k_A_Q_D_AQ[] = "\200A\340\010\025\220Q\330\010\014\210D\220\010\230\001\330\010\024\220A\220Q";
static const char __pyx_k_A_T_2T_A[] = "\200A\360\006\000\t\036\230T\240\021\330\010\017\320\017(\250\001\250\021\250)\2602\260T\270\021\270*\300A";
static const char __pyx_k_A_q_G6_A[] = "\200A\330\010\017\320\017\037\230q\240\004\240G\2506\260\023\260A";
static const char __pyx_k_A_t7_Rxq[] = "\200A\360\n\000\t\020\210t\2207\230+\240R\240x\250q";
static const char __pyx_k_A_t7_b_s[] = "\200A\330\010\017\210t\2207\230$\230b\240\007\240s\250!";
static const char __pyx_k_A_t7_j_1[] = "\200A\330\010\017\210t\2207\230$\230j\250\003\2501";
static const char __pyx_k_BCFIndex[] = "BCFIndex";
static const char __pyx_k_Gq_4q_3a[] = "\320\000G\300q\360\030\000\005\014\2104\210q\220\010\230\002\230'\240\022\2403\240a";
static const char __pyx_k_KeyError[] = "KeyError";
static const char __pyx_k_VARIABLE[] = "VARIABLE";
static const char __pyx_k_add_line[] = "add_line";
static const char __pyx_k_add_meta[] = "add_meta";
static const char __pyx_k_add_note[] = "add_note";
static const char __pyx_k_contains[] = "__contains__";
static const char __pyx_k_dst_data[] = "dst_data";
static const char __pyx_k_dst_type[] = "dst_type";
static const char __pyx_k_endswith[] = "endswith";
static const char __pyx_k_filename[] = "filename";
static const char __pyx_k_getstate[] = "__getstate__";
static const char __pyx_k_hdr_sync[] = "_hdr_sync";
static const char __pyx_k_hrec_str[] = "hrec_str";
static const char __pyx_k_iterkeys[] = "iterkeys";
static const char __pyx_k_pyx_type[] = "__pyx_type";
static const char __pyx_k_qualname[] = "__qualname__";
static const char __pyx_k_reversed[] = "reversed";
static const char __pyx_k_set_name[] = "__set_name__";
static const char __pyx_k_setstate[] = "__setstate__";
static const char __pyx_k_src_data[] = "src_data";
static const char __pyx_k_src_type[] = "src_type";
static const char __pyx_k_A_4q_1D_q[] = "\200A\330\010\013\2104\210q\330\014\033\2301\230D\240\001\330\014\020\220\007\220q";
static const char __pyx_k_A_WA_A_9A[] = "\200A\340\010\031\230\024\230W\240A\330\010\t\210\022\320\013\034\230A\330\010\t\210\022\2109\220A";
static const char __pyx_k_A_d_auD_q[] = "\200A\330\010\036\230d\240'\250\021\330\010\026\220a\220u\230D\240\007\240q";
static const char __pyx_k_A_t4uBd_a[] = "\200A\360\006\000\t\020\210t\2204\220u\230B\230d\240$\240a";
static const char __pyx_k_BaseIndex[] = "BaseIndex";
static const char __pyx_k_TypeError[] = "TypeError";
static const char __pyx_k_cfilename[] = "cfilename";
static const char __pyx_k_enumerate[] = "enumerate";
static const char __pyx_k_is_gt_fmt[] = "is_gt_fmt";
static const char __pyx_k_isenabled[] = "isenabled";
static const char __pyx_k_iteritems[] = "iteritems";
static const char __pyx_k_pyx_state[] = "__pyx_state";
static const char __pyx_k_reduce_ex[] = "__reduce_ex__";
static const char __pyx_k_reference[] = "reference";
static const char __pyx_k_translate[] = "translate";
static const char __pyx_k_A_4q_q_A_q[] = "\200A\330\010\013\2104\210q\330\014\027\220q\230\004\230A\330\014\020\220\007\220q";
static const char __pyx_k_A_6_HA_4t7[] = "\200A\340\010\013\2106\220\027\230\001\330\014\020\220\004\220H\230A\340\014\031\230\021\230!\2304\230t\2407\250!";
static const char __pyx_k_A_T_Qa_D_Q[] = "\200A\360\006\000\t\036\230T\240\021\330\010\017\210~\230Q\230a\230{\250\"\250D\260\001\260\034\270Q";
static const char __pyx_k_A_d_Cq_4t1[] = "\200A\360\006\000\t\037\230d\240'\250\021\330\010\017\320\017(\250\001\250\023\250C\250q\260\n\270!\2704\270t\3001";
static const char __pyx_k_IndexError[] = "IndexError";
static const char __pyx_k_STRUCTURED[] = "STRUCTURED";
static const char __pyx_k_TabixIndex[] = "TabixIndex";
static const char __pyx_k_ValueError[] = "ValueError";
static const char __pyx_k_add_record[] = "add_record";
static const char __pyx_k_add_sample[] = "add_sample";
static const char __pyx_k_dst_header[] = "dst_header";
static const char __pyx_k_dst_values[] = "dst_values";
static const char __pyx_k_free_after[] = "free_after";
static const char __pyx_k_itervalues[] = "itervalues";
static const char __pyx_k_new_record[] = "new_record";
static const char __pyx_k_pyx_result[] = "__pyx_result";
static const char __pyx_k_pyx_vtable[] = "__pyx_vtable__";
static const char __pyx_k_src_values[] = "src_values";
static const char __pyx_k_startswith[] = "startswith";
static const char __pyx_k_t1_j_81A_1[] = "\200\001\330\004\007\200t\2101\330\010\016\210j\230\001\230\021\340\004&\320&;\2708\3001\300A\330\004\010\210\n\220!\330\004\010\210\010\220\001\340\004\013\2101";
static const char __pyx_k_t1_j_9_A_1[] = "\200\001\330\004\007\200t\2101\330\010\016\210j\230\001\230\021\340\004&\320&9\270\030\300\021\300!\330\004\n\210*\220A\340\004\013\2101";
static const char __pyx_k_t1_j_XQa_1[] = "\200\001\330\004\007\200t\2101\330\010\016\210j\230\001\230\021\340\004 \240\r\250X\260Q\260a\330\004\n\210'\220\021\340\004\013\2101";
static const char __pyx_k_A_T_r_E_QgS[] = "\200A\330\010\035\230T\240\021\330\010\017\210r\220\023\220E\230\024\230Q\230g\240S\250\001";
static const char __pyx_k_A_d_Cq_1D_A[] = "\200A\360\006\000\t\037\230d\240'\250\021\330\010\017\320\017(\250\001\250\023\250C\250q\260\013\2701\270D\300\004\300A";
static const char __pyx_k_A_t4y_8_T_Q[] = "\200A\360\006\000\t\020\210t\2204\220y\240\004\320$8\270\001\270\024\270T\300\034\310Q";
static const char __pyx_k_BCFIterator[] = "BCFIterator";
static const char __pyx_k_Description[] = "Description";
static const char __pyx_k_I_t1_q__A_d[] = "\320\000I\310\021\330\004\007\200t\2101\330\010\017\210q\330\004\005\330\t\020\220\005\220_\240A\340\010\013\210;\220d\230!\330\014\020\220\001\220\021";
static const char __pyx_k_Invalid_tid[] = "Invalid tid";
static const char __pyx_k_MemoryError[] = "MemoryError";
static const char __pyx_k_PickleError[] = "PickleError";
static const char __pyx_k_VALUE_TYPES[] = "VALUE_TYPES";
static const char __pyx_k_VariantFile[] = "VariantFile";
static const char __pyx_k_add_samples[] = "add_samples";
static const char __pyx_k_description[] = "description";
static const char __pyx_k_invalid_key[] = "invalid key: {}";
static const char __pyx_k_invalid_tag[] = "invalid tag";
static const char __pyx_k_pysam_utils[] = "pysam.utils";
static const char __pyx_k_t1_j_381A_1[] = "\200\001\330\004\007\200t\2101\330\010\016\210j\230\001\230\021\340\004\"\320\"3\2608\2701\270A\330\004\010\210\n\220!\340\004\013\2101";
static const char __pyx_k_t1_j_HA_Q_1[] = "\200\001\330\004\007\200t\2101\330\010\016\210j\230\001\230\021\340\004(\320(<\270H\300A\330\010\t\330\004\013\210:\220Q\340\004\013\2101";
static const char __pyx_k_t1_q_Jhaq_1[] = "\200\001\330\004\007\200t\2101\330\010\017\210q\340\004\034\230J\240h\250a\250q\330\004\t\210\027\220\001\330\004\t\210\031\220!\340\004\013\2101";
static const char __pyx_k_value_count[] = "value_count";
static const char __pyx_k_A_G_q_4t1_AQ[] = "\200A\330\010\014\210G\220<\230q\240\001\330\010\013\2104\210t\2201\330\014\022\220*\230A\230Q";
static const char __pyx_k_A_Qd_Ba_AQ_q[] = "\200A\360\006\000\t\014\210:\220Q\220d\230&\240\014\250B\250a\330\014\022\220*\230A\230Q\330\010\017\320\017'\240q\250\001";
static const char __pyx_k_A_T_4q_1_Qaq[] = "\200A\360\006\000\t\036\230T\240\021\330\010\013\2104\210q\330\014\023\2201\330\010\017\210~\230Q\230a\230q";
static const char __pyx_k_A_T_4q_1_uBa[] = "\200A\360\006\000\t\036\230T\240\021\330\010\013\2104\210q\330\014\023\2201\340\010\017\210u\220B\220a";
static const char __pyx_k_BaseIterator[] = "BaseIterator";
static const char __pyx_k_add_sample_2[] = "_add_sample";
static const char __pyx_k_bcf_sync_end[] = "bcf_sync_end";
static const char __pyx_k_clear_header[] = "clear_header";
static const char __pyx_k_drop_samples[] = "drop_samples";
static const char __pyx_k_format_modes[] = "format_modes";
static const char __pyx_k_initializing[] = "_initializing";
static const char __pyx_k_is_coroutine[] = "_is_coroutine";
static const char __pyx_k_is_valid_tid[] = "is_valid_tid";
static const char __pyx_k_makeBCFIndex[] = "makeBCFIndex";
static const char __pyx_k_parse_region[] = "parse_region";
static const char __pyx_k_pyx_checksum[] = "__pyx_checksum";
static const char __pyx_k_sample_index[] = "sample_index";
static const char __pyx_k_stringsource[] = "<stringsource>";
static const char __pyx_k_t1_j_HAQ_Q_1[] = "\200\001\330\004\007\200t\2101\330\010\016\210j\230\001\230\021\340\004(\320(<\270H\300A\300Q\330\004\013\210:\220Q\330\004\013\2101";
static const char __pyx_k_unknown_INFO[] = "unknown INFO: {}";
static const char __pyx_k_unknown_mode[] = "unknown mode {}";
static const char __pyx_k_unquoted_str[] = "unquoted_str";
static const char __pyx_k_use_setstate[] = "use_setstate";
static const char __pyx_k_A_1A_Qd_r_A_9[] = "\200A\330\010\020\220\013\2301\230A\330\010\013\320\013\035\230Q\230d\240&\250\007\250r\260\021\330\014\022\220*\230A\320\0359\270\027\300\001\300\021";
static const char __pyx_k_A_7_Q_AQ_Qd_a[] = "\200A\330\010\013\2107\220#\220Q\330\014\022\220*\230A\230Q\330\010\025\220Q\220d\230&\240\006\240a";
static const char __pyx_k_A_G4q_1_E_q_y[] = "\200A\360\006\000\t\021\220\004\220G\2304\230q\240\001\330\010\013\2101\330\014\024\220E\230\026\230q\240\001\330\010\017\210y\230\001\230\021";
static const char __pyx_k_A_L_Q_L_Q_L_Q[] = "\200A\330\010\014\210L\230\005\230Q\330\010\014\210L\230\005\230Q\330\010\014\210L\230\005\230Q";
static const char __pyx_k_A_Qd_Ba_AQ_aq[] = "\200A\360\006\000\t\014\210:\220Q\220d\230&\240\014\250B\250a\330\014\022\220*\230A\230Q\330\010\017\320\017&\240a\240q";
static const char __pyx_k_A_Qd_Rq_AQ_AQ[] = "\200A\360\006\000\t\014\210:\220Q\220d\230&\240\r\250R\250q\330\014\022\220*\230A\230Q\330\010\017\320\017$\240A\240Q";
static const char __pyx_k_A_d_3a_1E_1_k[] = "\200A\330\010\036\230d\240!\330\010\013\2103\210a\330\014\017\210|\2301\230E\240\022\2401\330\020\026\220k\240\021\240!";
static const char __pyx_k_BaseIndex_get[] = "BaseIndex.get";
static const char __pyx_k_BaseIndex_pop[] = "BaseIndex.pop";
static const char __pyx_k_StopIteration[] = "StopIteration";
static const char __pyx_k_TabixIterator[] = "TabixIterator";
static const char __pyx_k_VariantContig[] = "VariantContig";
static const char __pyx_k_VariantHeader[] = "VariantHeader";
static const char __pyx_k_VariantRecord[] = "VariantRecord";
static const char __pyx_k_bcf_str_cache[] = "bcf_str_cache";
static const char __pyx_k_class_getitem[] = "__class_getitem__";
static const char __pyx_k_invalid_modes[] = "invalid_modes";
static const char __pyx_k_pysam_libcbcf[] = "pysam.libcbcf";
static const char __pyx_k_reduce_cython[] = "__reduce_cython__";
static const char __pyx_k_remove_header[] = "remove_header";
static const char __pyx_k_A_d_s_Qk_d_auL[] = "\200A\330\010\036\230d\240'\250\021\330\010\037\230s\240#\240Q\240k\260\021\260$\260d\270!\330\010\026\220a\220u\230L\250\001";
static const char __pyx_k_AssertionError[] = "AssertionError";
static const char __pyx_k_BCFIndex_fetch[] = "BCFIndex.fetch";
static const char __pyx_k_BaseIndex_keys[] = "BaseIndex.keys";
static const char __pyx_k_Closing_failed[] = "Closing failed";
static const char __pyx_k_Invalid_filter[] = "Invalid filter: {}";
static const char __pyx_k_Invalid_header[] = "Invalid header";
static const char __pyx_k_METADATA_TYPES[] = "METADATA_TYPES";
static const char __pyx_k_NotImplemented[] = "NotImplemented";
static const char __pyx_k_Qa_s_D_q_a_IWA[] = "\200\001\330\004\020\220\n\230+\240Q\240a\330\004\007\200s\210!\210=\230\002\230\"\230D\240\007\240q\250\016\260a\330\010\024\220I\230W\240A\240[\260\001\260\021";
static const char __pyx_k_Unknown_allele[] = "Unknown allele";
static const char __pyx_k_index_filename[] = "index_filename";
static const char __pyx_k_invalid_FORMAT[] = "invalid FORMAT: {}";
static const char __pyx_k_invalid_contig[] = "invalid contig: {}";
static const char __pyx_k_makeTabixIndex[] = "makeTabixIndex";
static const char __pyx_k_q_D_AQ_1_xwa_q[] = "\320\004\037\230q\330\010\t\330\014\024\220D\230\001\230\021\330\014\020\220\004\220A\220Q\330\014\023\2201\330\017\020\330\014\017\210x\220w\230a\330\020\027\220q\330\014\r";
static const char __pyx_k_subset_samples[] = "subset_samples";
static const char __pyx_k_t1_j_HAQ_Q_1_2[] = "\200\001\330\004\007\200t\2101\330\010\016\210j\230\001\230\021\340\004(\320(<\270H\300A\300Q\330\004\013\210:\220Q\340\004\013\2101";
static const char __pyx_k_t7_A_j_9_A_1_1[] = "\200\001\330\004\007\200t\2107\220#\220]\240\"\240A\330\010\016\210j\230\001\230\021\340\004&\320&9\270\030\300\021\300!\330\004\n\210*\220A\330\004\n\210)\2201\340\004\013\2101";
static const char __pyx_k_truncated_file[] = "truncated file";
static const char __pyx_k_unknown_format[] = "unknown format: {}";
static const char __pyx_k_A_1A_fG2Q_AQ_Ja[] = "\200A\340\010\020\220\013\2301\230A\330\010\013\210>\230\021\230$\230f\240G\2502\250Q\330\014\022\220*\230A\230Q\340\010\014\210J\220a";
static const char __pyx_k_A_Qe1_4uAQ_4waq[] = "\200A\330\010\013\210:\220Q\220e\2301\330\014\023\2204\220u\230A\230Q\340\014\023\2204\220w\230a\230q";
static const char __pyx_k_BaseIndex_items[] = "BaseIndex.items";
static const char __pyx_k_VariantMetadata[] = "VariantMetadata";
static const char __pyx_k_bcf_empty_array[] = "bcf_empty_array";
static const char __pyx_k_check_header_id[] = "check_header_id";
static const char __pyx_k_cindex_filename[] = "cindex_filename";
static const char __pyx_k_include_samples[] = "include_samples";
static const char __pyx_k_limits_violated[] = "limits violated";
static const char __pyx_k_pyx_PickleError[] = "__pyx_PickleError";
static const char __pyx_k_setstate_cython[] = "__setstate_cython__";
static const char __pyx_k_t1_j_t1_q_9_A_1[] = "\200\001\330\004\007\200t\2101\330\010\016\210j\230\001\230\021\340\004\007\200t\2101\330\010\017\210q\340\004&\320&9\270\030\300\021\300!\330\004\n\210*\220A\330\004\n\210'\220\021\340\004\013\2101";
static const char __pyx_k_t1_q_t1_j_1_1_1[] = "\200\001\330\004\007\200t\2101\330\010\017\210q\340\004\007\200t\2101\330\010\016\210j\230\001\230\021\340\004\032\230(\240(\250!\2501\330\004\t\210\032\2201\330\004\t\210\027\220\001\330\004\t\210\031\220!\340\004\013\2101";
static const char __pyx_k_unable_to_fetch[] = "unable to fetch {}:{}-{}";
static const char __pyx_k_A_Q_Qc_Rq_AQ_Qar[] = "\200A\360\006\000\t\032\230\024\230Q\330\010\013\210:\220Q\220c\230\034\240R\240q\330\014\022\220*\230A\230Q\330\010\017\210~\230Q\230a\230r\240\027\250\001\250\027\260\001\260\022\260=\300\001";
static const char __pyx_k_A_d_2Rr_Bc_AQ_Qc[] = "\200A\330\010\036\230d\240'\250\021\330\010\031\320\031)\250\021\250!\330\010\031\230\021\340\010\013\2102\210R\210r\220\023\220B\220c\230\021\330\014\022\220*\230A\230Q\340\010\017\210~\230Q\230c\240\030\250\021\250!";
static const char __pyx_k_A_d_WA_Qa_Qe3fCq[] = "\200A\330\010\036\230d\240'\250\027\260\001\330\010\031\230\024\230W\240A\330\010\032\230+\240Q\240a\330\010\017\210~\230Q\230e\2403\240f\250C\250q";
static const char __pyx_k_A_d_s_Qj_T_auD_q[] = "\200A\330\010\036\230d\240'\250\021\330\010\037\230s\240#\240Q\240j\260\001\260\024\260T\270\021\330\010\026\220a\220u\230D\240\007\240q";
static const char __pyx_k_A_d_wa_U_3b_s_AQ[] = "\200A\330\010\036\230d\240'\250\021\330\010\017\210w\220a\220{\240#\240U\250!\250=\270\003\2703\270b\300\001\300\021\330\010\017\210s\220\"\220A\220Q";
static const char __pyx_k_A_q_avWD_a_6_V3c[] = "\200A\360\026\000\t\020\210q\220\006\220a\220v\230W\240D\250\n\260$\260a\330\020\023\2206\230\024\230V\2403\240c\250\021";
static const char __pyx_k_BaseIndex_update[] = "BaseIndex.update";
static const char __pyx_k_BaseIndex_values[] = "BaseIndex.values";
static const char __pyx_k_METADATA_LENGTHS[] = "METADATA_LENGTHS";
static const char __pyx_k_TabixIndex_fetch[] = "TabixIndex.fetch";
static const char __pyx_k_VariantFile_copy[] = "VariantFile.copy";
static const char __pyx_k_VariantFile_open[] = "VariantFile.open";
static const char __pyx_k_bcf_check_values[] = "bcf_check_values";
static const char __pyx_k_check_truncation[] = "check_truncation";
static const char __pyx_k_invalid_contig_2[] = "invalid contig";
static const char __pyx_k_stop_BCFIterator[] = "_stop_BCFIterator";
static const char __pyx_k_subset_samples_2[] = "_subset_samples";
static const char __pyx_k_unsupported_type[] = "unsupported type";
static const char __pyx_k_3c_4s_Cr_T1FauIUV[] = "\320\000 \240\001\330\004\013\2103\210c\220\022\2204\220s\230\"\230C\230r\240\021\240+\250T\3201F\300a\300u\310I\320UV";
static const char __pyx_k_A_Q_2Rq_AQ_D_q_AQ[] = "\200A\340\010\025\220Q\330\010\013\2102\210R\210q\330\014\022\220*\230A\230Q\330\010\014\210D\220\007\220q\330\010\024\220A\220Q";
static const char __pyx_k_A_d_wa_U_3b_s_A_A[] = "\200A\330\010\036\230d\240'\250\021\330\010\017\210w\220a\220{\240#\240U\250!\250=\270\003\2703\270b\300\001\300\021\330\010\017\210s\220\"\220A\220\\\240\023\240A";
static const char __pyx_k_Error_updating_id[] = "Error updating id";
static const char __pyx_k_Invalid_header_id[] = "Invalid header id";
static const char __pyx_k_Qd_hk_s_D_q_a_IWA[] = "\200\001\330\004\020\220\n\230+\240Q\240d\250,\260h\270k\310\021\310!\330\004\007\200s\210!\210=\230\002\230\"\230D\240\007\240q\250\016\260a\330\010\024\220I\230W\240A\240[\260\001\260\021";
static const char __pyx_k_VariantFile_close[] = "VariantFile.close";
static const char __pyx_k_VariantFile_fetch[] = "VariantFile.fetch";
static const char __pyx_k_VariantFile_reset[] = "VariantFile.reset";
static const char __pyx_k_VariantFile_write[] = "VariantFile.write";
static const char __pyx_k_VariantRecordInfo[] = "VariantRecordInfo";
static const char __pyx_k_bcguz0123456789ex[] = "bcguz0123456789ex";
static const char __pyx_k_ignore_truncation[] = "ignore_truncation";
static const char __pyx_k_invalid_contig_id[] = "invalid contig id";
static const char __pyx_k_makeVariantContig[] = "makeVariantContig";
static const char __pyx_k_makeVariantHeader[] = "makeVariantHeader";
static const char __pyx_k_makeVariantRecord[] = "makeVariantRecord";
static const char __pyx_k_pysam_libcbcf_pxd[] = "pysam/libcbcf.pxd";
static const char __pyx_k_pysam_libcbcf_pyx[] = "pysam/libcbcf.pyx";
static const char __pyx_k_unsupported_types[] = "unsupported types";
static const char __pyx_k_vcf_format_failed[] = "vcf_format failed";
static const char __pyx_k_AT_Z_1_s_D_q_a_IWA[] = "\200\001\330\004\020\220\t\230\033\240A\240T\250\034\260Z\270{\310!\3101\330\004\007\200s\210!\210=\230\002\230\"\230D\240\007\240q\250\016\260a\330\010\024\220I\230W\240A\240[\260\001\260\021";
static const char __pyx_k_A_7_Q_AQ_AV1_V1_Ja[] = "\200A\340\010\013\2107\220#\220Q\330\014\022\220*\230A\230Q\340\010 \240\014\250A\250V\2601\340\010\030\230\001\230\024\230V\2401\340\010\014\210J\220a";
static const char __pyx_k_A_d_3a_4t4uAQ_at9A[] = "\200A\360\006\000\t\037\230d\240'\250\021\330\010 \240\003\2403\240a\240{\260!\2604\260t\2704\270u\300A\300Q\330\010\017\320\017&\240a\240t\2509\260A";
static const char __pyx_k_A_d_s_Qk_d_e1A_z_Q[] = "\200A\360\006\000\t\037\230d\240'\250\021\330\010\037\230s\240#\240Q\240k\260\021\260$\260d\270$\270e\3001\300A\330\010\017\210z\230\034\240Q";
static const char __pyx_k_BaseIndex_iterkeys[] = "BaseIndex.iterkeys";
static const char __pyx_k_Can_t_write_record[] = "Can't write record";
static const char __pyx_k_Invalid_INFO_field[] = "Invalid INFO field: {}";
static const char __pyx_k_Qd_fKq_s_D_q_a_IWA[] = "\200\001\330\004\020\220\n\230+\240Q\240d\250,\260f\270K\300q\310\001\330\004\007\200s\210!\210=\230\002\230\"\230D\240\007\240q\250\016\260a\330\010\024\220I\230W\240A\240[\260\001\260\021";
static const char __pyx_k_Unknown_INFO_field[] = "Unknown INFO field: {}";
static const char __pyx_k_VariantHeader_copy[] = "VariantHeader.copy";
static const char __pyx_k_VariantRecord_copy[] = "VariantRecord.copy";
static const char __pyx_k_asyncio_coroutines[] = "asyncio.coroutines";
static const char __pyx_k_bcf_encode_alleles[] = "bcf_encode_alleles";
static const char __pyx_k_bcf_genotype_count[] = "bcf_genotype_count";
static const char __pyx_k_bcf_index_required[] = "bcf index required";
static const char __pyx_k_bcf_info_del_value[] = "bcf_info_del_value";
static const char __pyx_k_bcf_info_get_value[] = "bcf_info_get_value";
static const char __pyx_k_bcf_info_set_value[] = "bcf_info_set_value";
static const char __pyx_k_cline_in_traceback[] = "cline_in_traceback";
static const char __pyx_k_error_in_vcf_parse[] = "error in vcf_parse";
static const char __pyx_k_get_reference_name[] = "get_reference_name";
static const char __pyx_k_1_CuE_q_a_1_5_fA_AU[] = "\320\004\033\2301\360\n\000\t\r\210C\210u\220E\230\026\230q\330\014\020\220\001\220\025\220a\340\010\013\2101\330\014\020\220\003\2205\230\006\230f\240A\330\020\024\220A\220U\230!";
static const char __pyx_k_A_4t1_AQ_4xq_AQ_N_q[] = "\200A\330\010\013\2104\210t\2201\330\014\022\220*\230A\230Q\340\010\013\2104\210x\220q\330\014\022\220*\230A\230Q\340\010\014\210N\230!\330\010\017\210q";
static const char __pyx_k_A_4t1_AQ_d_q_r_F_Rq[] = "\200A\360\014\000\t\014\2104\210t\2201\330\014\022\220*\230A\230Q\340\010\036\230d\240'\250\021\330\010\027\220q\330\010\017\210r\220\023\220F\230#\230R\230q\240\001";
static const char __pyx_k_A_5_7_U_E_CvS_AQ_AQ[] = "\200A\360\014\000\t\014\2105\220\003\2207\230#\230U\240\"\240E\250\023\250C\250v\260S\270\001\330\014\020\220\001\220\030\230\021\330\014\r\340\010\030\230\001\330\014\022\220*\230A\230Q\360\006\000\t\n\330\014\020\220\001\220\030\230\025\320\036:\270!\330\017\020\330\014\022\220*\230A\230Q";
static const char __pyx_k_A_G1_z_q_L_HA_AQ_Ja[] = "\200A\360\014\000\t\r\210G\2201\330\014\017\210z\230\021\230%\230q\330\020\024\220L\240\001\240\021\340\020\024\220H\230A\330\024\030\230\014\240A\240Q\330\010\014\210J\220a";
static const char __pyx_k_A_Q_2Rq_AQ_D_D_A_AQ[] = "\200A\340\010\025\220Q\330\010\013\2102\210R\210q\330\014\022\220*\230A\230Q\330\010\014\210D\220\010\230\002\230\"\230D\240\004\240A\330\010\024\220A\220Q";
static const char __pyx_k_A_Q_2Rq_AQ_D_r_1_AQ[] = "\200A\340\010\025\220Q\330\010\013\2102\210R\210q\330\014\022\220*\230A\230Q\330\010\014\210D\220\007\220r\230\022\2301\330\010\024\220A\220Q";
static const char __pyx_k_BaseIndex_iteritems[] = "BaseIndex.iteritems";
static const char __pyx_k_Can_t_write_headers[] = "Can't write headers";
static const char __pyx_k_Error_extracting_ID[] = "Error extracting ID";
static const char __pyx_k_VariantFile_get_tid[] = "VariantFile.get_tid";
static const char __pyx_k_VariantHeaderRecord[] = "VariantHeaderRecord";
static const char __pyx_k_VariantHeader_merge[] = "VariantHeader.merge";
static const char __pyx_k_VariantRecordFilter[] = "VariantRecordFilter";
static const char __pyx_k_VariantRecordFormat[] = "VariantRecordFormat";
static const char __pyx_k_VariantRecordSample[] = "VariantRecordSample";
static const char __pyx_k_bcf_array_to_object[] = "bcf_array_to_object";
static const char __pyx_k_bcf_get_value_count[] = "bcf_get_value_count";
static const char __pyx_k_bcf_object_to_array[] = "bcf_object_to_array";
static const char __pyx_k_char_array_to_tuple[] = "char_array_to_tuple";
static const char __pyx_k_has_symbolic_allele[] = "has_symbolic_allele";
static const char __pyx_k_invalid_header_line[] = "invalid header line";
static const char __pyx_k_invalid_metadata_id[] = "invalid metadata id";
static const char __pyx_k_invalid_sample_name[] = "invalid sample name: {}";
static const char __pyx_k_makeVariantMetadata[] = "makeVariantMetadata";
static const char __pyx_k_A_d_S_Qa_Qa_as_r_F_1[] = "\200A\330\010\036\230d\240'\250\021\330\010\032\230+\240S\250\005\250Q\250a\330\010\032\230+\240Q\240a\330\010\032\230,\240a\240s\250!\340\010\017\210r\220\023\220F\230!\2301";
static const char __pyx_k_A_d_WA_E_aq_q_ar_Q_q[] = "\200A\330\010\036\230d\240'\250\027\260\001\330\010\031\230\024\230W\240A\330\010\030\230\001\340\010\014\210E\220\025\220a\220q\230\001\330\014\017\210q\220\002\220$\220a\220r\230\021\330\020\025\220Q\330\010\017\210q";
static const char __pyx_k_A_d_WA_E_aq_q_ar_q_q[] = "\200A\330\010\036\230d\240'\250\027\260\001\330\010\031\230\024\230W\240A\360\006\000\t\r\210E\220\025\220a\220q\230\001\330\014\017\210q\220\002\220$\220a\220r\230\021\330\020\027\220q\330\010\017\210q";
static const char __pyx_k_BaseIndex_itervalues[] = "BaseIndex.itervalues";
static const char __pyx_k_Invalid_allele_index[] = "Invalid allele index";
static const char __pyx_k_Invalid_index_object[] = "Invalid index object";
static const char __pyx_k_Unable_to_delete_END[] = "Unable to delete END";
static const char __pyx_k_VariantHeaderContigs[] = "VariantHeaderContigs";
static const char __pyx_k_VariantHeaderRecords[] = "VariantHeaderRecords";
static const char __pyx_k_VariantHeaderSamples[] = "VariantHeaderSamples";
static const char __pyx_k_VariantRecordSamples[] = "VariantRecordSamples";
static const char __pyx_k_bcf_format_del_value[] = "bcf_format_del_value";
static const char __pyx_k_bcf_format_get_value[] = "bcf_format_get_value";
static const char __pyx_k_bcf_format_set_value[] = "bcf_format_set_value";
static const char __pyx_k_bcf_must_not_be_None[] = "bcf must not be None";
static const char __pyx_k_duplicate_filehandle[] = "duplicate_filehandle";
static const char __pyx_k_hk_A_1_1_7_1_2DNRS_1[] = "\200\001\360\006\000\005\010\200\220h\230k\250\033\260A\330\010\r\210^\2301\330\010\016\320\016!\320!{\320{}\320}~\330\004\023\220?\240(\250!\2501\330\004\007\200|\2207\230!\330\0101\260\021\3202D\300N\320RS\330\004\013\2101";
static const char __pyx_k_invalid_contig_index[] = "invalid contig index";
static const char __pyx_k_invalid_filter_index[] = "invalid filter index";
static const char __pyx_k_invalid_mode_options[] = "invalid mode options: {}";
static const char __pyx_k_invalid_reference_id[] = "invalid reference id";
static const char __pyx_k_invalid_sample_index[] = "invalid sample index";
static const char __pyx_k_tabix_index_required[] = "tabix index required";
static const char __pyx_k_A_d_WA_Qa_k_s_t3e4s_S[] = "\200A\330\010\036\230d\240'\250\027\260\001\330\010\031\230\024\230W\240A\330\010\032\230+\240Q\240a\330\010\036\230k\250\021\250%\250s\260!\330\010\017\210t\2203\220e\2304\230s\240#\240S\250\001";
static const char __pyx_k_Unable_to_delete_INFO[] = "Unable to delete INFO";
static const char __pyx_k_Unknown_format_length[] = "Unknown format length";
static const char __pyx_k_Unsupported_INFO_type[] = "Unsupported INFO type";
static const char __pyx_k_VariantHeaderMetadata[] = "VariantHeaderMetadata";
static const char __pyx_k_VariantRecordInfo_get[] = "VariantRecordInfo.get";
static const char __pyx_k_VariantRecordInfo_pop[] = "VariantRecordInfo.pop";
static const char __pyx_k_bcf_copy_expand_array[] = "bcf_copy_expand_array";
static const char __pyx_k_bcf_geno_combinations[] = "bcf_geno_combinations";
static const char __pyx_k_bcf_hdr_format_failed[] = "bcf_hdr_format failed";
static const char __pyx_k_bcf_sample_get_phased[] = "bcf_sample_get_phased";
static const char __pyx_k_bcf_sample_set_phased[] = "bcf_sample_set_phased";
static const char __pyx_k_hk_A_1_uuwwx_7_q0_a_1[] = "\200\001\360\006\000\005\010\200\220h\230k\250\033\260A\330\010\r\210^\2301\330\010\016\320\016!\320!u\320uw\320wx\330\004\023\220=\240\010\250\001\250\021\330\004\007\200|\2207\230!\330\010/\250q\3200@\300\016\310a\330\004\013\2101";
static const char __pyx_k_invalid_VariantHeader[] = "invalid VariantHeader";
static const char __pyx_k_invalid_VariantRecord[] = "invalid VariantRecord";
static const char __pyx_k_invalid_metadata_type[] = "invalid metadata type";
static const char __pyx_k_makeVariantRecordInfo[] = "makeVariantRecordInfo";
static const char __pyx_k_A_2Rr_Bc_WD_AQ_at9D_t5[] = "\200A\330\010\031\230\021\330\010\013\2102\210R\210r\220\023\220B\220c\230\024\230W\240D\250\001\330\014\022\220*\230A\230Q\330\010\017\320\017&\240a\240t\2509\260D\270\007\270t\3005\310\001\310\021";
static const char __pyx_k_A_d_WA_4wb_T_1_AQ_Qc_a[] = "\200A\360\006\000\t\037\230d\240'\250\027\260\001\330\010\031\230\024\230W\240A\330\010\031\230\021\230!\340\010\013\2104\210w\220b\230\002\230#\230T\240\027\250\003\2501\330\014\022\220*\230A\230Q\340\010\017\210~\230Q\230c\240\030\250\021\250$\250a";
static const char __pyx_k_A_d_t4q_4r_3d_S_1_AQ_a[] = "\200A\360\006\000\t\037\230d\240'\250\021\330\010\027\220t\2304\230q\330\010\013\2104\210r\220\022\2203\220d\230#\230S\240\002\240!\2401\330\014\022\220*\230A\230Q\330\010\017\320\017(\250\001\250\037\270\001\270\025\270a";
static const char __pyx_k_Cannot_re_open_htsfile[] = "Cannot re-open htsfile";
static const char __pyx_k_Duplicated_sample_name[] = "Duplicated sample name: {}";
static const char __pyx_k_Error_s_reading_record[] = "Error(s) reading record: {}";
static const char __pyx_k_Error_updating_alleles[] = "Error updating alleles";
static const char __pyx_k_VariantFile_new_record[] = "VariantFile.new_record";
static const char __pyx_k_VariantHeader_add_line[] = "VariantHeader.add_line";
static const char __pyx_k_VariantHeader_add_meta[] = "VariantHeader.add_meta";
static const char __pyx_k_VariantRecordInfo_keys[] = "VariantRecordInfo.keys";
static const char __pyx_k_bcf_format_get_alleles[] = "bcf_format_get_alleles";
static const char __pyx_k_bcf_header_get_info_id[] = "bcf_header_get_info_id";
static const char __pyx_k_bcf_header_remove_hrec[] = "bcf_header_remove_hrec";
static const char __pyx_k_cannot_set_null_allele[] = "cannot set null allele";
static const char __pyx_k_pyx_unpickle_BaseIndex[] = "__pyx_unpickle_BaseIndex";
static const char __pyx_k_unknown_type_specified[] = "unknown type specified: {}";
static const char __pyx_k_A_4q_1D_4_1_L_Q_L_Q_L_Q[] = "\200A\330\010\013\2104\210q\330\014\033\2301\230D\240\001\330\014\020\220\010\230\001\340\010\013\2104\210|\2301\330\014\020\220\001\220\024\220\\\240\021\340\010\014\210L\230\005\230Q\330\010\014\210L\230\005\230Q\330\010\014\210L\230\005\230Q";
static const char __pyx_k_Unable_to_delete_FORMAT[] = "Unable to delete FORMAT";
static const char __pyx_k_Unsupported_FORMAT_type[] = "Unsupported FORMAT type";
static const char __pyx_k_VariantHeaderRecord_get[] = "VariantHeaderRecord.get";
static const char __pyx_k_VariantHeaderRecord_pop[] = "VariantHeaderRecord.pop";
static const char __pyx_k_VariantRecordFilter_add[] = "VariantRecordFilter.add";
static const char __pyx_k_VariantRecordFilter_get[] = "VariantRecordFilter.get";
static const char __pyx_k_VariantRecordFormat_get[] = "VariantRecordFormat.get";
static const char __pyx_k_VariantRecordInfo_clear[] = "VariantRecordInfo.clear";
static const char __pyx_k_VariantRecordInfo_items[] = "VariantRecordInfo.items";
static const char __pyx_k_VariantRecordSample_get[] = "VariantRecordSample.get";
static const char __pyx_k_VariantRecordSample_pop[] = "VariantRecordSample.pop";
static const char __pyx_k_VariantRecord_translate[] = "VariantRecord.translate";
static const char __pyx_k_fetch_requires_an_index[] = "fetch requires an index";
static const char __pyx_k_header_must_not_be_None[] = "header must not be None";
static const char __pyx_k_invalid_character_found[] = "invalid character found";
static const char __pyx_k_makeVariantHeaderRecord[] = "makeVariantHeaderRecord";
static const char __pyx_k_makeVariantRecordFilter[] = "makeVariantRecordFilter";
static const char __pyx_k_makeVariantRecordFormat[] = "makeVariantRecordFormat";
static const char __pyx_k_makeVariantRecordSample[] = "makeVariantRecordSample";
static const char __pyx_k_r_A_q_q_q_q_xq_as_Q_1_1[] = "\200\001\330\004\007\200r\210\023\210A\330\010\017\210q\340\004\033\320\033/\250q\260\017\270q\330\004\007\200q\330\010\017\210x\220q\340\004\n\320\n\036\230a\230s\240&\250\001\250\024\250Q\340\004\030\230\001\230\037\250\003\2501\340\004\013\2101";
static const char __pyx_k_record_must_not_be_None[] = "record must not be None";
static const char __pyx_k_sample_must_not_be_None[] = "sample must not be None";
static const char __pyx_k_A_Qa_6_1_1_Qd_Ba_AQ_4y_Q[] = "\200A\330\010\032\230+\240Q\240a\340\010\013\2106\220\021\220&\230\010\240\003\2401\330\014\022\220(\230!\2301\340\010\013\210:\220Q\220d\230'\240\026\240}\260B\260a\330\014\022\220*\230A\230Q\340\010\032\230!\2304\230y\250\005\250Q";
static const char __pyx_k_A_d_T_4q_q_6_AQ_auAWA_G1[] = "\200A\330\010\036\230d\240'\250\021\330\010\035\230T\240\021\330\010\013\2104\210q\330\014\r\330\010\017\210q\220\001\330\010\031\230\021\230(\240!\2406\250\023\320,<\270A\270Q\330\010\026\220a\220u\230A\230W\240A\330\010\014\210G\2201";
static const char __pyx_k_A_d_WA_E_aq_1Bd_1_s_AV_Q[] = "\200A\340\010\036\230d\240'\250\027\260\001\330\010\031\230\024\230W\240A\360\010\000\t\r\210E\220\025\220a\220q\230\001\330\014\022\220!\2201\220B\220d\230!\2301\330\014\017\210s\220!\330\020$\240A\240V\250>\270\021\270%\270{\310#\310Q";
static const char __pyx_k_BCFIndex___reduce_cython[] = "BCFIndex.__reduce_cython__";
static const char __pyx_k_VariantFile_is_valid_tid[] = "VariantFile.is_valid_tid";
static const char __pyx_k_VariantHeaderContigs_add[] = "VariantHeaderContigs.add";
static const char __pyx_k_VariantHeaderContigs_get[] = "VariantHeaderContigs.get";
static const char __pyx_k_VariantHeaderRecord_keys[] = "VariantHeaderRecord.keys";
static const char __pyx_k_VariantHeaderSamples_add[] = "VariantHeaderSamples.add";
static const char __pyx_k_VariantHeader_add_record[] = "VariantHeader.add_record";
static const char __pyx_k_VariantHeader_add_sample[] = "VariantHeader.add_sample";
static const char __pyx_k_VariantHeader_new_record[] = "VariantHeader.new_record";
static const char __pyx_k_VariantRecordFilter_keys[] = "VariantRecordFilter.keys";
static const char __pyx_k_VariantRecordFormat_keys[] = "VariantRecordFormat.keys";
static const char __pyx_k_VariantRecordInfo___iter[] = "VariantRecordInfo.__iter__";
static const char __pyx_k_VariantRecordInfo_update[] = "VariantRecordInfo.update";
static const char __pyx_k_VariantRecordInfo_values[] = "VariantRecordInfo.values";
static const char __pyx_k_VariantRecordSample_keys[] = "VariantRecordSample.keys";
static const char __pyx_k_VariantRecordSamples_get[] = "VariantRecordSamples.get";
static const char __pyx_k_VariantRecordSamples_pop[] = "VariantRecordSamples.pop";
static const char __pyx_k_cannot_find_metadata_key[] = "cannot find metadata key";
static const char __pyx_k_contig_must_be_specified[] = "contig must be specified";
static const char __pyx_k_could_not_open_file_mode[] = "could not open file `{}` (mode='{}')";
static const char __pyx_k_hk_A_1_wwyyz_7_7q8PP___1[] = "\200\001\360\006\000\005\010\200\220h\230k\250\033\260A\330\010\r\210^\2301\330\010\016\320\016!\320!w\320wy\320yz\330\004\023\320\023(\250\010\260\001\260\021\330\004\007\200|\2207\230!\330\0107\260q\3208P\320P^\320^_\330\004\013\2101";
static const char __pyx_k_makeVariantHeaderContigs[] = "makeVariantHeaderContigs";
static const char __pyx_k_makeVariantHeaderRecords[] = "makeVariantHeaderRecords";
static const char __pyx_k_makeVariantHeaderSamples[] = "makeVariantHeaderSamples";
static const char __pyx_k_makeVariantRecordSamples[] = "makeVariantRecordSamples";
static const char __pyx_k_A_3c_4s_Q_1_AV3d_1_3c_a_q[] = "\200A\330\010\013\2103\210c\220\022\2204\220s\230#\230Q\330\014\023\2201\340\010\030\230\004\230A\230V\2403\240d\250!\2501\340\010\013\2103\210c\220\021\330\014\022\220$\220a\340\010\017\210q";
static const char __pyx_k_BaseIndex___reduce_cython[] = "BaseIndex.__reduce_cython__";
static const char __pyx_k_Cannot_create_empty_array[] = "Cannot create empty array";
static const char __pyx_k_Invalid_chromosome_contig[] = "Invalid chromosome/contig";
static const char __pyx_k_Position_must_be_positive[] = "Position must be positive";
static const char __pyx_k_Q_3c_A_B_AQ_7_L_vQ_G9AZvQ[] = "\320\004\035\230Q\340\010\013\2103\210c\220\021\330\014\022\220*\230A\320\035B\300'\310\021\310!\340\010\020\220\002\220&\230\014\240A\240Q\330\010\013\2107\220'\230\021\330\014\021\220\027\230\002\230*\240L\260\001\260\021\330\010\021\220\026\220v\230Q\330\010\014\210G\2209\230A\230Z\240v\250Q";
static const char __pyx_k_VariantHeaderContigs_keys[] = "VariantHeaderContigs.keys";
static const char __pyx_k_VariantHeaderMetadata_add[] = "VariantHeaderMetadata.add";
static const char __pyx_k_VariantHeaderMetadata_get[] = "VariantHeaderMetadata.get";
static const char __pyx_k_VariantHeaderRecord_items[] = "VariantHeaderRecord.items";
static const char __pyx_k_VariantHeader_add_samples[] = "VariantHeader.add_samples";
static const char __pyx_k_VariantRecordFilter_clear[] = "VariantRecordFilter.clear";
static const char __pyx_k_VariantRecordFilter_items[] = "VariantRecordFilter.items";
static const char __pyx_k_VariantRecordFormat_clear[] = "VariantRecordFormat.clear";
static const char __pyx_k_VariantRecordFormat_items[] = "VariantRecordFormat.items";
static const char __pyx_k_VariantRecordSample_clear[] = "VariantRecordSample.clear";
static const char __pyx_k_VariantRecordSample_items[] = "VariantRecordSample.items";
static const char __pyx_k_VariantRecordSamples_keys[] = "VariantRecordSamples.keys";
static const char __pyx_k_bcf_str_cache_get_charptr[] = "bcf_str_cache_get_charptr";
static const char __pyx_k_hk_A_1_qqsst_xq_7_6a7Nn_1[] = "\200\001\360\006\000\005\010\200\220h\230k\250\033\260A\330\010\r\210^\2301\330\010\016\320\016!\320!q\320qs\320st\330\004\023\320\023'\240x\250q\260\001\330\004\007\200|\2207\230!\330\0106\260a\3207N\310n\320\\]\330\004\013\2101";
static const char __pyx_k_invalid_number_of_columns[] = "invalid number of columns";
static const char __pyx_k_makeVariantHeaderMetadata[] = "makeVariantHeaderMetadata";
static const char __pyx_k_BCFIndex___setstate_cython[] = "BCFIndex.__setstate_cython__";
static const char __pyx_k_TabixIndex___reduce_cython[] = "TabixIndex.__reduce_cython__";
static const char __pyx_k_VariantFile_subset_samples[] = "VariantFile.subset_samples";
static const char __pyx_k_VariantHeaderContigs_items[] = "VariantHeaderContigs.items";
static const char __pyx_k_VariantHeaderMetadata_keys[] = "VariantHeaderMetadata.keys";
static const char __pyx_k_VariantHeaderRecord___iter[] = "VariantHeaderRecord.__iter__";
static const char __pyx_k_VariantHeaderRecord_remove[] = "VariantHeaderRecord.remove";
static const char __pyx_k_VariantHeaderRecord_update[] = "VariantHeaderRecord.update";
static const char __pyx_k_VariantHeaderRecord_values[] = "VariantHeaderRecord.values";
static const char __pyx_k_VariantRecordFilter___iter[] = "VariantRecordFilter.__iter__";
static const char __pyx_k_VariantRecordFilter_values[] = "VariantRecordFilter.values";
static const char __pyx_k_VariantRecordFormat___iter[] = "VariantRecordFormat.__iter__";
static const char __pyx_k_VariantRecordFormat_values[] = "VariantRecordFormat.values";
static const char __pyx_k_VariantRecordInfo_iterkeys[] = "VariantRecordInfo.iterkeys";
static const char __pyx_k_VariantRecordSample___iter[] = "VariantRecordSample.__iter__";
static const char __pyx_k_VariantRecordSample_update[] = "VariantRecordSample.update";
static const char __pyx_k_VariantRecordSample_values[] = "VariantRecordSample.values";
static const char __pyx_k_VariantRecordSamples_items[] = "VariantRecordSamples.items";
static const char __pyx_k_cannot_set_null_alt_allele[] = "cannot set null alt allele";
static const char __pyx_k_error_in_bcf_subset_format[] = "error in bcf_subset_format";
static const char __pyx_k_hk_A_1_wwyyz_9HAQ_7_1L_a_1[] = "\200\001\360\006\000\005\010\200\220h\230k\250\033\260A\330\010\r\210^\2301\330\010\016\320\016!\320!w\320wy\320yz\330\004\023\2209\230H\240A\240Q\330\004\007\200|\2207\230!\330\010+\2501\250L\270\016\300a\330\004\013\2101";
static const char __pyx_k_hk_A_1_xxzz_haq_7_5Q6LNZ_1[] = "\200\001\360\006\000\005\010\200\220h\230k\250\033\260A\330\010\r\210^\2301\330\010\016\320\016!\320!x\320xz\320z{\330\004\023\320\023&\240h\250a\250q\330\004\007\200|\2207\230!\330\0105\260Q\3206L\310N\320Z[\330\004\013\2101";
static const char __pyx_k_pyx_unpickle_VariantContig[] = "__pyx_unpickle_VariantContig";
static const char __pyx_k_t1_j_s_Bc_CvT_1A_j_XQa_A_1[] = "\200\001\330\004\007\200t\2101\330\010\016\210j\230\001\230\021\340\004\007\200s\210\"\210B\210c\220\023\220C\220v\230T\240\022\2401\240A\330\010\016\210j\230\001\230\021\340\004 \240\r\250X\260Q\260a\330\004\n\210*\220A\330\004\n\210&\220\001\340\004\013\2101";
static const char __pyx_k_unsupported_info_type_code[] = "unsupported info type code";
static const char __pyx_k_A_4t1_AQ_d_q_4r_3d_S_1_AQ_a[] = "\200A\360\010\000\t\014\2104\210t\2201\330\014\022\220*\230A\230Q\340\010\036\230d\240'\250\021\330\010\027\220q\330\010\013\2104\210r\220\022\2203\220d\230#\230S\240\002\240!\2401\330\014\022\220*\230A\230Q\330\010\017\320\017(\250\001\250\037\270\001\270\025\270a";
static const char __pyx_k_A_D_t5_AQ_Qc_2S_aq_AQ_D_1Cr[] = "\200A\340\010\032\230*\240D\250\007\250t\2605\270\001\270\021\330\010\021\220\033\230A\230Q\330\010\031\230\034\240Q\240c\250\021\330\010\013\2102\210S\220\006\220a\220q\330\014\022\220*\230A\230Q\330\010\014\210D\220\007\220|\2401\240C\240r\250\021";
static const char __pyx_k_A_d_4_auD_t1_AQ_4vS_1_5_G4q[] = "\200A\360\006\000\t\037\230d\240'\250\021\330\010\013\2104\210\230a\230u\240D\250\007\250t\2601\330\014\022\220*\230A\230Q\340\010\013\2104\210v\220S\230\001\330\014\023\2201\330\010\017\210{\230!\230?\250!\2505\260\004\260G\2704\270q";
static const char __pyx_k_BCFIterator___reduce_cython[] = "BCFIterator.__reduce_cython__";
static const char __pyx_k_BaseIndex___setstate_cython[] = "BaseIndex.__setstate_cython__";
static const char __pyx_k_Could_not_open_variant_file[] = "Could not open variant file";
static const char __pyx_k_Invalid_header_record_index[] = "Invalid header record index";
static const char __pyx_k_Qd_fKq_LX_kkllm_s_D_q_a_IWA[] = "\200\001\330\004\020\220\n\230+\240Q\240d\250,\260f\270K\300q\310\004\310L\320X`\320`k\320kl\320lm\330\004\007\200s\210!\210=\230\002\230\"\230D\240\007\240q\250\016\260a\330\010\024\220I\230W\240A\240[\260\001\260\021";
static const char __pyx_k_Unable_to_fetch_next_record[] = "Unable to fetch next record";
static const char __pyx_k_VariantContig_remove_header[] = "VariantContig.remove_header";
static const char __pyx_k_VariantFile___reduce_cython[] = "VariantFile.__reduce_cython__";
static const char __pyx_k_VariantHeaderContigs___iter[] = "VariantHeaderContigs.__iter__";
static const char __pyx_k_VariantHeaderContigs_values[] = "VariantHeaderContigs.values";
static const char __pyx_k_VariantHeaderMetadata_items[] = "VariantHeaderMetadata.items";
static const char __pyx_k_VariantHeaderRecords___iter[] = "VariantHeaderRecords.__iter__";
static const char __pyx_k_VariantHeaderSamples___iter[] = "VariantHeaderSamples.__iter__";
static const char __pyx_k_VariantRecordInfo_iteritems[] = "VariantRecordInfo.iteritems";
static const char __pyx_k_VariantRecordSamples___iter[] = "VariantRecordSamples.__iter__";
static const char __pyx_k_VariantRecordSamples_update[] = "VariantRecordSamples.update";
static const char __pyx_k_VariantRecordSamples_values[] = "VariantRecordSamples.values";
static const char __pyx_k_cannot_create_VariantHeader[] = "cannot create VariantHeader";
static const char __pyx_k_cannot_create_VariantRecord[] = "cannot create VariantRecord";
static const char __pyx_k_could_not_open_variant_file[] = "could not open variant file `{}`";
static const char __pyx_k_dst_header_must_not_be_None[] = "dst_header must not be None";
static const char __pyx_k_hk_A_1_qqsst_haq_7_5Q6LNZ_1[] = "\200\001\360\006\000\005\010\200\220h\230k\250\033\260A\330\010\r\210^\2301\330\010\016\320\016!\320!q\320qs\320st\330\004\023\320\023&\240h\250a\250q\330\004\007\200|\2207\230!\330\0105\260Q\3206L\310N\320Z[\330\004\013\2101";
static const char __pyx_k_invalid_header_record_index[] = "invalid header record index";
static const char __pyx_k_missing_d_requested_samples[] = "missing {:d} requested samples";
static const char __pyx_k_must_set_at_least_2_alleles[] = "must set at least 2 alleles";
static const char __pyx_k_ref_allele_must_not_be_null[] = "ref allele must not be null";
static const char __pyx_k_unable_to_fetch_next_record[] = "unable to fetch next record";
static const char __pyx_k_unable_to_parse_next_record[] = "unable to parse next record";
static const char __pyx_k_1_CuE_q_r_A_AU_1_awa_5_fA_AU[] = "\320\004\033\2301\360\n\000\t\r\210C\210u\220E\230\026\230q\330\014\017\210r\220\023\220A\330\020\024\220A\220U\230!\340\010\013\2101\330\014\022\220$\220a\220w\230a\330\014\020\220\003\2205\230\006\230f\240A\330\020\024\220A\220U\230!";
static const char __pyx_k_A_4t1_AQ_D_t5_Kq_Qc_1Cr_V1IQ[] = "\200A\360\016\000\t\014\2104\210t\2201\330\014\022\220*\230A\230Q\340\010\032\230*\240D\250\007\250t\2605\270\001\270\021\330\010\024\220K\230q\240\001\330\010\031\230\034\240Q\240c\250\021\330\010\017\210|\2301\230C\230r\240\027\250\002\250#\250V\2601\260I\270Q";
static const char __pyx_k_A_Q_Qc_Rq_AQ_ARvS_AQ_Qar_D_Q[] = "\200A\360\006\000\t\032\230\024\230Q\330\010\013\210:\220Q\220c\230\034\240R\240q\330\014\022\220*\230A\230Q\360\006\000\t\r\210A\210R\210v\220S\230\001\330\014\022\220*\230A\230Q\330\010\017\210~\230Q\230a\230r\240\030\250\021\250\"\250D\260\003\260:\270Q";
static const char __pyx_k_BaseIterator___reduce_cython[] = "BaseIterator.__reduce_cython__";
static const char __pyx_k_Header_already_exists_for_id[] = "Header already exists for id={}";
static const char __pyx_k_I_O_operation_on_closed_file[] = "I/O operation on closed file";
static const char __pyx_k_TabixIndex___setstate_cython[] = "TabixIndex.__setstate_cython__";
static const char __pyx_k_Unable_to_update_INFO_values[] = "Unable to update INFO values";
static const char __pyx_k_VariantHeaderMetadata___iter[] = "VariantHeaderMetadata.__iter__";
static const char __pyx_k_VariantHeaderMetadata_values[] = "VariantHeaderMetadata.values";
static const char __pyx_k_VariantHeaderRecord_iterkeys[] = "VariantHeaderRecord.iterkeys";
static const char __pyx_k_VariantRecordFilter_iterkeys[] = "VariantRecordFilter.iterkeys";
static const char __pyx_k_VariantRecordFormat_iterkeys[] = "VariantRecordFormat.iterkeys";
static const char __pyx_k_VariantRecordInfo_itervalues[] = "VariantRecordInfo.itervalues";
static const char __pyx_k_VariantRecordSample_iterkeys[] = "VariantRecordSample.iterkeys";
static const char __pyx_k_hk_A_1_qqsst_HAQ_7_314H_VW_1[] = "\200\001\360\006\000\005\010\200\220h\230k\250\033\260A\330\010\r\210^\2301\330\010\016\320\016!\320!q\320qs\320st\330\004\023\320\023$\240H\250A\250Q\330\004\007\200|\2207\230!\330\0103\2601\3204H\310\016\320VW\330\004\013\2101";
static const char __pyx_k_pyx_unpickle_VariantMetadata[] = "__pyx_unpickle_VariantMetadata";
static const char __pyx_k_unsupported_header_type_code[] = "unsupported header type code";
static const char __pyx_k_1_U_3fD_fD_3as_U_c_Qe2S_1_1_1[] = "\320\000#\2401\360\006\000\005\t\210\005\210U\220!\2203\220f\230D\240\001\330\010\016\210f\220D\230\002\230'\240\021\240!\330\010\013\2103\210a\210s\220#\220U\230$\230c\240\021\240#\240Q\240e\2502\250S\260\003\2601\330\014\023\2201\340\004\013\2101";
static const char __pyx_k_A_4t1_AQ_4xq_AQ_4q_AQ_G_1A_4q[] = "\200A\360\n\000\t\014\2104\210t\2201\330\014\022\220*\230A\230Q\340\010\013\2104\210x\220q\330\014\022\220*\230A\230Q\340\010\013\2104\210q\330\014\022\220*\230A\230Q\340\010\014\210G\320\023#\2401\240A\360\006\000\t\014\2104\210q\330\014\020\320\020 \240\001";
static const char __pyx_k_A_T_4q_AQ_XU_Q_q_1A_84xq_81_q[] = "\200A\330\010\035\230T\240\021\340\010\013\2104\210q\330\014\022\220*\230A\230Q\360\006\000\t\021\220\005\220X\230U\240!\330\010\020\220\005\220Q\340\010\027\220q\230\003\2301\230A\340\010\016\320\016\"\240!\2408\2504\250x\260q\340\010\013\2108\2201\330\014\020\220\001\220\030\230\021\340\010\017\210q";
static const char __pyx_k_A_d_WA_Qc_Rq_AQ_E_aq_q_ar_Q_q[] = "\200A\330\010\036\230d\240'\250\027\260\001\330\010\031\230\024\230W\240A\330\010\030\230\001\340\010\013\210:\220Q\220c\230\034\240R\240q\330\014\022\220*\230A\230Q\340\010\014\210E\220\025\220a\220q\230\001\330\014\017\210q\220\002\220$\220a\220r\230\021\330\020\025\220Q\330\010\017\210q";
static const char __pyx_k_A_d_WA_Qc_Rq_AQ_E_aq_q_ar_q_q[] = "\200A\330\010\036\230d\240'\250\027\260\001\330\010\031\230\024\230W\240A\360\006\000\t\014\210:\220Q\220c\230\034\240R\240q\330\014\022\220*\230A\230Q\340\010\014\210E\220\025\220a\220q\230\001\330\014\017\210q\220\002\220$\220a\220r\230\021\330\020\027\220q\330\010\017\210q";
static const char __pyx_k_BCFIterator___setstate_cython[] = "BCFIterator.__setstate_cython__";
static const char __pyx_k_Error_unpacking_VariantRecord[] = "Error unpacking VariantRecord";
static const char __pyx_k_Stop_position_of_the_interval[] = "Stop position of the interval";
static const char __pyx_k_TabixIterator___reduce_cython[] = "TabixIterator.__reduce_cython__";
static const char __pyx_k_VariantContig___reduce_cython[] = "VariantContig.__reduce_cython__";
static const char __pyx_k_VariantFile___setstate_cython[] = "VariantFile.__setstate_cython__";
static const char __pyx_k_VariantHeaderContigs_iterkeys[] = "VariantHeaderContigs.iterkeys";
static const char __pyx_k_VariantHeaderRecord_iteritems[] = "VariantHeaderRecord.iteritems";
static const char __pyx_k_VariantHeader___reduce_cython[] = "VariantHeader.__reduce_cython__";
static const char __pyx_k_VariantMetadata_remove_header[] = "VariantMetadata.remove_header";
static const char __pyx_k_VariantRecordFilter_iteritems[] = "VariantRecordFilter.iteritems";
static const char __pyx_k_VariantRecordFormat_iteritems[] = "VariantRecordFormat.iteritems";
static const char __pyx_k_VariantRecordSample_iteritems[] = "VariantRecordSample.iteritems";
static const char __pyx_k_VariantRecordSamples_iterkeys[] = "VariantRecordSamples.iterkeys";
static const char __pyx_k_VariantRecord___reduce_cython[] = "VariantRecord.__reduce_cython__";
static const char __pyx_k_bcf_format_get_allele_indices[] = "bcf_format_get_allele_indices";
static const char __pyx_k_mode_must_begin_with_r_w_or_a[] = "mode must begin with r, w or a";
static const char __pyx_k_unable_to_allocate_BCF_record[] = "unable to allocate BCF record";
static const char __pyx_k_3aq_s_xs_4z_5_T_aq_Qa_3a_awhha[] = "\200\001\360\014\000\005$\2403\240a\240q\340\004\013\210<\220s\230!\340\004\007\200x\210s\220!\330\010\013\2104\210z\230\021\230)\2405\250\001\330\014\025\220T\230\025\230a\230q\330\014\032\230#\230Q\230a\330\010\017\210|\2303\230a\330\010\020\220\010\230\001\330\010\016\210a\210w\220h\230h\240a\330\010\014\210E\220\025\220a\220}\240A\330\014\021\220\021\220%\220q\330\t\021\220\023\220A\330\010\021\220\032\2301\330\010\014\210E\220\025\220a\220q\330\014\022\220&\230\001\230\021\330\014\022\220!\2205\230\007\230t\2407\250*\260A\330\010\014\210E\220\025\220a\220}\240A\330\014\022\220!\2205\230\001\330\t\021\220\023\220A\330\010\022\220+\230Q\330\010\014\210E\220\025\220a\220q\330\014\022\220&\230\001\230\021\330\014\023\2201\220E\230\027\240\004\240G\250:\260Q\330\010\014\210E\220\025\220a\220}\240A\330\014\023\2201\220E\230\021\330\t\021\220\023\220A\330\010\022\220+\230Q\330\010\014\210E\220\025\220a\220q\330\014\022\220&\230\001\230\021\330\014\023\2201\220E\230\027\240\004\240G\250:\260Q\330\010\014\210E\220\025\220a\220}\240A\330\014\023\2201\220E\230\021\330\t\021\220\023\220A\330\010\020\220\t\230\021\330\010\014\210E\220\025\220a\220q\330\014\022\220&\230\001\230\021\330\014\017\210t\2203\220a\330\020\035\230Q\230f\240B\240c\250\021\340\020\025\220Q\220e\2301\330\010\014\210E\220\025\220a\220}\240A\330\014\031\230\021\230&\240\002\240#\240Q\340\010\016\210i\220q\230\001";
static const char __pyx_k_A_a_a_a_a_a_a_a_a_a_a_a_q_E_81[] = "\200A\330\010\014\320\014\036\230a\330\010\014\320\014\036\230a\330\010\014\320\014\036\230a\330\010\014\320\014\036\230a\330\010\014\320\014\036\230a\330\010\014\320\014\036\230a\330\010\014\320\014\036\230a\330\010\014\320\014\036\230a\330\010\014\320\014\036\230a\330\010\014\320\014\036\230a\330\010\014\320\014\036\230a\330\010\014\320\014\037\230q\340\010\014\210E\220\022\2208\2301";
static const char __pyx_k_A_r_1_q_3a_q_2Rs_Bb_2Rr_U_3b_Q[] = "\320\000$\240A\360\030\000\005\010\200r\210\022\2101\330\010\017\210q\330\t\013\2103\210a\330\010\017\210q\330\t\013\2102\210R\210s\220!\330\010\014\210B\210b\220\001\360\010\000\005\t\210\t\220\022\2202\220R\220r\230\021\330\004\010\210\005\210U\220!\2203\220b\230\002\230!\330\010\r\210Q\330\010\023\2201\330\010\023\2201\330\004\013\2101";
static const char __pyx_k_BaseIterator___setstate_cython[] = "BaseIterator.__setstate_cython__";
static const char __pyx_k_EQ_z_q_k_3e1A_AS_r_F_3c_Qc_5_b[] = "\320\000E\300Q\360\n\000\005\010\200z\220\021\220%\220q\330\010\016\210k\230\021\230!\340\004\010\210\013\2203\220e\2301\230A\330\004\010\210\014\220A\220S\230\001\340\004\007\200r\210\023\210F\220!\2203\220c\230\034\240Q\240c\250\022\2505\260\001\260\035\270b\300\004\300C\300q\330\010\020\220\001\340\004\013\210<\220q\230\003\2302\230Q";
static const char __pyx_k_Q_82Rt1_AQ_Kq_4q_a_4uCt1Cwa_AQ[] = "\320\004\"\240!\330\034\035\330\"#\330\032\033\330\"#\330\037 \330\025\026\360\026\000\t&\240Q\360\006\000\t\014\2108\2202\220R\220t\2301\360\014\000\r\023\220*\230A\230Q\330\010\014\210K\220q\360\006\000\t\014\2104\210q\330\014\020\220\006\220a\340\010\013\2104\210u\220C\220t\2301\230C\230w\240a\330\014\022\220*\230A\230Q\340\010\014\320\014$\240A\340\010\027\220q\230\002\230$\230e\2404\240q\250\004\250C\250r\260\023\260A\330\010\013\2103\210a\210~\230R\230q\330\014\022\220*\230A\320\035N\310g\320UV\320VX\320X]\320]^\320^_\340\010\030\230\001\230\022\2304\230u\240D\250\001\250\024\250S\260\002\260'\270\021\330\010\013\2101\330\014\022\220*\230A\320\0357\260w\270a\270r\300\025\300a\300q\360\006\000\t\014\2105\220\003\2204\220t\230:\240Q\240j\260\001\330\014\017\210x\220y\240\001\240\021\330\020\027\220q\330\021\031\230\031\240!\2401\330\020\027\220q\360\006\000\t\014\2105\220\003\2201\330\014\023\2201\340\010\014\210H\220G\230;\240a\240q\330\010\t\330\014\027\220\240a\240q\330\014\020\220\r\230Y\240a\240q\330\014\020\220\r\230Y\240c\250\021\330\017\020\330\014\027\220q\330\014\020\220\r\230Q\330\014\020\220\r\230Q\340\010\014\210L\230\001\340\010\013\210?\230'\240\021\330\014\020\320\020\"\320\"3\260?\300!\3001\340\014\020\320\020\"\240!\340\010\014\320\014\034\230D\240\001\240\021\330\010\014\210J\220a\340\010\014\320\014\036\230a\340\010\013\2104\210{\230!\2301\340\014\017\210\230g\240Q\330\020\026\220j\240\001\240\021\360\006\000\r\020\210q\330\020\024\220J\230f\240E\250\021\340\020\024\220J\230m\2501\360\010\000\r\021\220\013\2304\230~\250Q\340\014\017\210t\2204\220q\330\020\026\220j\240\001\320!G\300w\310a\310z\320YZ\340\r\021\220\033\230A\230Q\340\014\020\220\013\2304\230~\250Q\340\014\017\210t\2204\220q\330\020\023\2201\330\024\032\320\032,\250A\320-L\310A\340\024\032\230*\240A\320%G\300w\310a\310q\340\014\017\210t\2208\2307\240(\250(\260%\260q\330\020\026\220j\240\001\320!X\320X_\320_`\320`j\320jk\340\014\020\320\020!\240\021\240!\340\021\022\330\020\026""\220l\240!\2404\240q\340\014\r\330\020\024\220J\320\036/\250q\260\001\330\023\024\330\020\026\220j\240\001\320!k\320kr\320rs\320s}\320}~\340\014\017\210z\230\021\230$\230k\250\021\330\020\034\230D\240\001\340\020\034\230A\360\006\000\r\020\210t\2208\2307\240(\250#\250T\260\024\260Q\330\020\023\220?\240'\250\021\330\024&\240a\330\025\026\330\024\032\230/\250\021\250+\260Q\330\020\024\220I\230\\\250\021\250$\250i\260q\340\021\025\220X\230W\240M\260\023\260E\270\024\270Q\330\020\023\220?\240'\250\021\330\024&\240a\330\025\026\330\024\033\230?\250!\250;\260a\330\020\024\220I\230^\2501\250A\340\014\017\210t\2204\220q\330\020\024\320\024$\240D\250\005\250Q\340\014\022\220*\230A\320\035.\250g\260Q\260a";
static const char __pyx_k_T_G1F_a_vWA_q_t87_q_2_awk_PQ_2[] = "\200\001\360\010\000\005\016\210T\220\021\330\004\014\210G\2201\220F\230,\240a\330\004\007\200v\210W\220A\330\010\022\220!\330\010\027\220q\340\010\027\220t\2308\2407\250!\330\004\007\200q\330\010\017\320\0172\260$\260a\260w\270k\310\027\320PQ\340\010\017\320\0172\260$\260a\260w\270k\310\021";
static const char __pyx_k_T_a_G1F_a_vWA_q_t87_q_6d_7_WTU[] = "\200\001\360\010\000\005\016\210T\220\031\230$\230a\330\004\014\210G\2201\220F\230,\240a\330\004\007\200v\210W\220A\330\010\022\220!\330\010\027\220q\340\010\027\220t\2308\2407\250!\330\004\007\200q\330\010\017\320\0176\260d\270!\2707\300+\310W\320TU\340\010\017\320\0176\260d\270!\2707\300+\310Q";
static const char __pyx_k_T_a_G1F_a_vWA_q_t87_q_d_7_WA_d[] = "\200\001\360\010\000\005\016\210T\220\031\230$\230a\330\004\014\210G\2201\220F\230,\240a\330\004\007\200v\210W\220A\330\010\022\220!\330\010\027\220q\340\010\027\220t\2308\2407\250!\330\004\007\200q\330\010\017\320\017.\250d\260!\2607\270+\300W\310A\340\010\017\320\017.\250d\260!\2607\270+\300Q";
static const char __pyx_k_Unable_to_update_format_values[] = "Unable to update format values";
static const char __pyx_k_VariantFile_get_reference_name[] = "VariantFile.get_reference_name";
static const char __pyx_k_VariantHeaderContigs_iteritems[] = "VariantHeaderContigs.iteritems";
static const char __pyx_k_VariantHeaderMetadata_iterkeys[] = "VariantHeaderMetadata.iterkeys";
static const char __pyx_k_VariantHeaderRecord_itervalues[] = "VariantHeaderRecord.itervalues";
static const char __pyx_k_VariantRecordFilter_itervalues[] = "VariantRecordFilter.itervalues";
static const char __pyx_k_VariantRecordFormat_itervalues[] = "VariantRecordFormat.itervalues";
static const char __pyx_k_VariantRecordSample_itervalues[] = "VariantRecordSample.itervalues";
static const char __pyx_k_VariantRecordSamples_iteritems[] = "VariantRecordSamples.iteritems";
static const char __pyx_k_bcf_hdr_set_samples_failed_ret[] = "bcf_hdr_set_samples failed: ret = {}";
static const char __pyx_k_invalid_value_for_Float_format[] = "invalid value for Float format";
static const char __pyx_k_mST_4s_AQ_4z_XQ_AQ_1_G1_IQ_waq[] = "\320\004/\250|\270;\300m\320ST\330\010\013\2104\210s\220!\330\014\022\220*\230A\230Q\340\010\013\2104\210z\230\021\230#\230X\240Q\330\014\022\220*\230A\230Q\340\010 \240\003\2401\340\010\014\210G\2201\330\010\014\210I\220Q\360\010\000\t\n\330\014\022\220%\220w\230a\230q\330\017\020\340\014\020\220\010\230\001\330\014\r\340\010\013\2101\330\014\020\220\007\220t\2304\230u\240A\340\010\021\220\031\230&\240\007\240z\260\021\330\010\021\220\031\230&\240\007\240z\260\021\340\010\014\210H\220N\240!\2405\250\006\250e\2607\270!\340\010\013\2104\210t\2201\330\014\017\210q\330\020\026\220g\230Q\230g\240X\250Q\250a\340\020\026\220g\230Q\320\0368\270\007\270q\300\010\310\005\310Q\310c\320QR";
static const char __pyx_k_mST_4s_AQ_7_Q_AQ_4z_XQ_AQ_c_G1[] = "\320\004/\250|\270;\300m\320ST\330\010\013\2104\210s\220!\330\014\022\220*\230A\230Q\340\010\013\2107\220#\220Q\330\014\022\220*\230A\230Q\340\010\013\2104\210z\230\021\230#\230X\240Q\330\014\022\220*\230A\230Q\340\010\036\230c\240\021\340\010\014\210G\2201\330\010\014\210I\220Q\360\010\000\t\n\330\014\022\220%\220w\230a\230q\330\017\020\340\014\020\220\010\230\001\330\014\r\340\010\013\2101\330\014\020\220\007\220t\2304\230u\240A\340\010\021\220\031\230&\240\007\240z\260\021\330\010\021\220\031\230&\240\007\240z\260\021\340\r\016\330\014\020\220\010\230\016\240a\240u\250F\260%\260x\270q\340\010\013\2104\210t\2201\330\014\017\210q\330\020\026\220g\230Q\230g\240X\250Q\250a\340\020\026\220g\230Q\320\0368\270\007\270q\300\010\310\005\310Q\310c\320QR";
static const char __pyx_k_pyx_unpickle_BaseIndex__set_st[] = "__pyx_unpickle_BaseIndex__set_state";
static const char __pyx_k_pyx_unpickle_VariantContig__se[] = "__pyx_unpickle_VariantContig__set_state";
static const char __pyx_k_pyx_unpickle_VariantHeaderCont[] = "__pyx_unpickle_VariantHeaderContigs";
static const char __pyx_k_pyx_unpickle_VariantHeaderMeta[] = "__pyx_unpickle_VariantHeaderMetadata";
static const char __pyx_k_pyx_unpickle_VariantHeaderReco[] = "__pyx_unpickle_VariantHeaderRecords";
static const char __pyx_k_pyx_unpickle_VariantHeaderSamp[] = "__pyx_unpickle_VariantHeaderSamples";
static const char __pyx_k_pyx_unpickle_VariantMetadata_2[] = "__pyx_unpickle_VariantMetadata__set_state";
static const char __pyx_k_pyx_unpickle_VariantRecordFilt[] = "__pyx_unpickle_VariantRecordFilter";
static const char __pyx_k_pyx_unpickle_VariantRecordForm[] = "__pyx_unpickle_VariantRecordFormat";
static const char __pyx_k_pyx_unpickle_VariantRecordInfo[] = "__pyx_unpickle_VariantRecordInfo";
static const char __pyx_k_pyx_unpickle_VariantRecordSamp[] = "__pyx_unpickle_VariantRecordSamples";
static const char __pyx_k_q_AV7_vU_QfA_t_axuD_d_CvTQWWZZ[] = "\200\001\330\004\032\230&\240\007\240q\340\004\026\320\026,\250A\250V\2607\270&\300\001\360\010\000\005\010\200v\210U\220'\230\021\330\010\022\220#\220Q\220f\230A\340\010\022\220!\360\010\000\005\010\200t\320\013\036\230a\230x\240u\250D\260\006\260d\270*\300C\300v\310T\320QW\320WZ\320Z[\340\010\013\2107\220#\220Q\330\014\023\220<\230q\240\005\240V\2506\260\021\330\014\017\210u\220D\230\004\230A\330\020\023\220?\240!\2405\250\006\250f\260H\270F\300#\300T\310\027\320PR\320RS\330\024\032\230*\240A\240Q\360\006\000\t\014\2107\220\"\220A\330\014\022\220'\230\025\230d\240!\2407\250'\260\023\260E\270\033\300L\320PQ\360\006\000\t\033\230!\2308\2408\2506\260\024\260U\270\"\270F\300$\300a";
static const char __pyx_k_q_d_WA_Qc_b_AQ_Qa_6_1_1_AU_Q_1[] = "\320\004\037\230q\340\010\036\230d\240'\250\027\260\001\330\010\031\230\024\230W\240A\340\010\013\210:\220Q\220c\230\035\240b\250\001\330\014\022\220*\230A\230Q\340\010\032\230+\240Q\240a\340\010\013\2106\220\021\220&\230\010\240\003\2401\330\014\023\2201\340\010 \240\014\250A\250U\260#\260Q\360\006\000\t\034\320\0331\260\021\260%\260y\300\004\300J\310d\320RS\340\010\013\2104\210\230a\230u\240M\260\021\330\014\022\220*\230A\230Q\360\006\000\t\014\210?\230!\2305\240\r\250Y\260c\270\021\330\014\023\2205\230\003\2305\240\004\240D\250\006\250c\260\021\340\010\013\2104\210u\220C\220t\2304\230q\330\014\023\2201\340\010\017\320\017!\240\021\240$\240i\250q";
static const char __pyx_k_t5_2S_q_uCq_4q_A_uAQas_Q_A_E_1[] = "\200\001\360\022\000\005\010\200t\2105\220\003\2202\220S\230\001\330\010\017\210q\340\004\007\200u\210C\210q\330\010\020\220\010\230\001\340\010\013\2104\210q\330\014\024\220A\360\006\000\r\020\210u\220A\220Q\220a\220s\230#\230Q\340\020\024\220A\360\006\000\021\025\220E\230\022\2301\330\014\024\220E\230\021\230!\340\010\020\220\001\330\010\013\2105\220\003\2201\330\014\024\220J\230a\330\014\020\220\005\220U\230!\2301\330\020\023\2205\230\001\230\023\230C\230q\330\024\025\330\020\025\220W\230A\230U\240!\2406\250\025\250a\250s\260#\3205K\3101\330\r\022\220#\220Q\330\014\025\220[\240\001\330\014\020\220\005\220U\230!\2301\330\020\023\2206\230\021\230#\230S\240\001\330\024\025\330\020\025\220W\230A\230V\2401\240F\250&\260\001\260\023\260C\3207N\310a\330\r\022\220#\220Q\330\014\025\220[\240\001\330\014\020\220\005\220U\230!\2301\330\020\023\2206\230\021\230#\230S\240\001\330\024\025\330\020\025\220W\230A\230V\2401\240F\250&\260\001\260\023\260C\3207N\310a\330\r\022\220#\220Q\330\014\024\220I\230Q\330\014\020\220\005\220U\230!\2301\330\020\023\320\023*\250!\2505\260\001\260\021\330\024\025\330\020\025\220W\230A\230U\240!\2406\250\024\320-A\300\021\300%\300q\310\t\320QR\340\014\022\220)\2301\230A\360\006\000\005\010\200t\2101\330\010\013\2101\330\014\024\220A\330\r\023\2203\220a\330\014\024\220A\340\014\025\220V\2301\230A\330\t\020\220\004\220C\220q\230\007\230s\240!\330\010\020\220\005\220Q\220a\340\010\020\220\005\220Q\220a\340\004\013\2101";
static const char __pyx_k_wc_j_V1_AQ_wc_q_t_QivQ_6_A_WAQ[] = "\200\001\330\004\007\200w\210c\220\021\330\010\016\210j\230\001\230\021\340\004\025\220V\2301\330\004\034\230A\230Q\330\004\032\230!\360\010\000\005\010\200w\210c\220\021\330\010\017\210q\340\004\007\200t\210:\220Q\220i\230v\240Q\330\010\022\220!\340\004\010\210\t\220\021\330\010\013\2106\220\023\220A\330\014\025\220W\230A\230Q\330\r\027\220q\230\010\240\005\240Q\330\014\025\220[\240\001\240\021\330\014\020\220\001\330\014\020\220\005\220U\230!\2301\230A\330\020\023\2206\230\021\230!\2302\230W\240A\240T\250\023\250C\250q\330\024\035\230W\240A\240_\260A\260Q\330\024\025\340\020\026\220j\240\001\240\021\340\014\020\220\001\330\014\017\210u\220B\220c\230\024\230Q\330\020\026\220j\240\001\240\021\330\014\025\220W\230A\230_\250A\250Q\340\004\013\2101";
static const char __pyx_k_wc_j_q_V1_C1_z_A_j_k_L_c_q_a_a[] = "\200\001\330\004\007\200w\210c\220\021\330\010\016\210j\230\001\230\021\340\004\032\230&\240\007\240q\330\004\025\220V\2301\330\004C\3001\360\006\000\005\010\200z\220\021\220#\220]\240\"\240A\330\010\016\210j\230\001\230\021\340\004\026\220k\240\021\240!\330\004\034\230L\250\001\250\025\250c\260\021\340\004\007\200q\330\010\022\220$\220a\340\010\022\320\022(\250\001\250\025\250a\340\004\007\200x\210r\220\021\330\010\016\210h\220a\320\027)\250\027\260\001\260\021\340\004\007\200t\210?\230!\2305\240\r\250Q\330\010\016\210j\230\001\230\021\340\004\020\220\017\230q\240\005\240]\260!\330\004\r\320\r\035\230Q\230h\240h\250a\330\036+\250;\260a\330\036\"\240)\250;\260a\330\036\"\240)\250;\260a\330\036\037\230}\250A\250X\260Q\260a\340\004\007\200z\220\023\220A\330\010\013\210?\230!\2305\240\003\2406\250\026\250t\2601\260F\270!\2705\300\013\3102\310Q\330\014\022\220*\230A\230Q\330\010\t\340\004\013\210<\220r\230\021\330\004\022\220#\220Q\220a\360:\000\005\024\2201\220C\220q\330\004\007\200u\210D\220\004\220E\230\022\2301\330\010\024\220D\230\001\340\004\021\220\037\240\001\240\033\250K\260q\330\004\026\220h\230a\340\004\007\200z\220\023\220A\330\010\023\2201\330\t\023\2203\220a\330\010\023\2201\330\t\023\2203\220a\330\010\023\2201\340\010\016\210j\230\001\230\021\340\004\027\220q\230\010\240\006\240j\260\013\2701\340\004\007\200\220a\220u\230C\230v\240V\2505\260\013\270;\300b\310\001\330\010\016\210j\230\001\230\021";
static const char __pyx_k_wc_j_q_V1_t_5_j_q_Ya_q_Ya_5_xs[] = "\200\001\330\004\007\200w\210c\220\021\330\010\016\210j\230\001\230\021\340\004\032\230&\240\007\240q\330\004\025\220V\2301\340\004\007\200t\210?\230!\2305\240\t\250\021\330\010\016\210j\230\001\230\021\340\004\026\320\026'\240q\250\005\250Y\260a\330\004\026\320\026'\240q\250\005\250Y\260a\340\004\n\210!\2105\220\001\340\004\007\200x\210s\220+\230T\240\031\250!\2505\260\001\330\010\r\210Q\210e\2201\330\t\020\220\003\2201\330\010\013\2107\220#\220Q\330\014\022\220!\2205\230\001\330\010\r\210Q\210e\2201\330\t\020\220\003\2201\330\010\r\210Q\210e\2201\220A\330\t\020\220\003\2201\330\010\r\210Q\210e\2201\220J\230b\240\001\330\t\020\220\003\2201\330\010\r\210Q\210e\320\023%\240Q\240e\2503\250a\330\t\020\220\003\2201\330\010\r\210Q\210f\220A\340\010\016\210j\230\001\230\021";
static const char __pyx_k_wc_j_q_V1_z_A_j_k_L_c_t1_haq_q[] = "\200\001\330\004\007\200w\210c\220\021\330\010\016\210j\230\001\230\021\340\004\032\230&\240\007\240q\330\004\025\220V\2301\360\010\000\005\010\200z\220\021\220#\220]\240\"\240A\330\010\016\210j\230\001\230\021\340\004\026\220k\240\021\240!\330\004\034\230L\250\001\250\025\250c\260\021\340\004\007\200t\2101\330\010\016\210h\220a\220q\340\004\027\220q\230\010\240\r\250T\260\026\260q\270\r\300Q\300i\310q\340\004\007\200|\2203\220a\330\010\025\220Q\330\t\n\330\010\025\220Q\340\010\026\220f\230A\230Q\340\004\026\220a\220x\230v\240Q";
static const char __pyx_k_wc_j_q_q_QfAWAYa_q_S_O1E_avS_A[] = "\200\001\330\004\007\200w\210c\220\021\330\010\016\210j\230\001\230\021\340\004\032\230&\240\007\240q\360\014\000\005\030\220q\230\010\240\r\250Q\250f\260A\260W\270A\270Y\300a\340\004\007\200q\210\005\210S\220\001\330\010\014\210O\2301\230E\240\035\250a\250v\260S\270\001\330\014\024\220A\330\r\016\330\014\024\220A\340\014\024\220A\330\t\n\210%\210s\220!\330\010\013\2101\210F\220#\220Q\330\014\024\220A\220S\230\006\230a\230s\240#\240S\320(>\270a\330\r\016\210f\220C\220q\330\014\024\220A\220S\230\006\230a\230s\240#\240S\320(?\270q\330\r\016\210f\220C\220q\330\014\024\220A\220S\230\006\230a\230s\240#\240S\320(?\270q\330\r\016\210f\220C\220q\330\014\024\220A\220S\230\006\230d\320\"6\260a\260q\270\003\2709\300A\330\r\016\210f\220C\220q\330\014\024\220I\230Q\230c\240\021\240!\2403\240a\340\014\022\220)\2301\230A\340\010\013\2104\210w\220d\230&\240\003\2401\330\014\025\220Q\340\010\020\320\020#\2401\240A\240W\250A\250W\260A\260V\2707\300!\340\004\013\2101";
static const char __pyx_k_8_7_Q_AQ_4t1_AQ_4t81_AQ_4t1_m1D[] = "\320\0048\270\001\360\014\000\t\014\2107\220#\220Q\330\014\022\220*\230A\230Q\340\010\013\2104\210t\2201\330\014\022\220*\230A\230Q\340\010\013\2104\210t\2208\2301\330\014\022\220*\230A\230Q\360\010\000\t\014\2104\210t\2201\330\014\020\320\020\"\240!\330\021\022\330\020\026\220m\2401\240D\250\n\260$\260g\270Q\330\014\017\210t\2202\220Q\330\020\026\320\026(\250\001\320)@\300\004\300A\360\014\000\t\014\2106\220\024\220Z\230s\320\"2\260!\2604\260w\270a\330\014\022\220!\330\014\022\220*\230A\230S\240\007\240q\250\006\250d\260+\320=M\310Q\310d\320RY\320YZ\360\006\000\t\025\220A\220Q\340\r\016\330\014\022\220*\230A\230T\240\032\2504\250w\260f\270F\300!\340\010\013\2104\210r\220\021\330\014\022\320\022$\240A\320%;\2704\270q\340\010\017\210q";
static const char __pyx_k_A_3c_4s_Q_1_WA_gQ_AV3d_1_3c_a_q[] = "\200A\330\010\013\2103\210c\220\022\2204\220s\230#\230Q\330\014\023\2201\340\010\031\230\024\230W\240A\330\010\031\230\025\230g\240Q\360\006\000\t\031\230\004\230A\230V\2403\240d\250!\2501\340\010\013\2103\210c\220\021\330\014\022\220$\220a\340\010\017\210q";
static const char __pyx_k_A_3c_4s_Q_1_WA_gQ_Cq_d_CuGST_3c[] = "\200A\330\010\013\2103\210c\220\022\2204\220s\230#\230Q\330\014\023\2201\340\010\031\230\024\230W\240A\330\010\031\230\025\230g\240Q\340\010\031\230\021\230*\240C\240q\250\n\260$\260d\270'\300\023\300C\300u\310G\320ST\340\010\013\2103\210c\220\021\330\014\022\220$\220a\340\010\017\210q";
static const char __pyx_k_A_4t1_81A_Kt_4t1_AQ_d_d_d_d_d_d[] = "\200A\330\010\013\2104\210t\2201\330\014\022\220!\340\010 \240\013\2508\2601\260A\360\010\000\t\r\210K\220t\230>\250\021\340\010\013\2104\210t\2201\330\014\022\220*\230A\230Q\360\010\000\t\r\320\014\036\230d\240!\330\010\014\320\014\036\230d\240!\340\010\014\320\014\036\230d\240!\330\010\014\320\014\036\230d\240!\330\010\014\320\014\036\230d\240!\330\010\014\320\014\036\230d\240!\330\010\014\320\014\036\230d\240!\330\010\014\320\014\036\230d\240!\330\010\014\320\014\036\230d\240!\330\010\014\320\014\036\230d\240!\330\010\014\320\014\036\230d\240!\330\010\014\320\014\036\230d\240!\340\010\013\2104\210x\220q\330\014\020\220\005\220Q\220d\230%\230q\340\021\022\330\020\026\220l\240!\2404\240q\330\014\035\230Q\230a\340\010\017\210q";
static const char __pyx_k_A_4t1_at4z_V6_WATQR_4r_1D_t4q_T[] = "\200A\330\010\013\2104\210t\2201\330\014\r\360\010\000\016\017\330\014\022\220,\230a\230t\2404\240z\260\024\260V\2706\300\024\300W\310A\310T\320QR\340\010\013\2104\210r\220\021\330\014\033\2301\230D\240\001\330\014\020\220\010\230\001\330\014\017\210t\2204\220q\330\020\021\330\021\025\220T\230\021\330\020\026\220g\230Q\230a\330\021\022\330\020\026\220g\230Q\230g\240X\250Q\250a\340\020\026\220g\230Q\230a\340\010\036\230i\240q\340\010\013\2104\210q\330\014\022\220+\230Q\230a\340\010\016\210h\220a\330\010\013\2104\210t\2201\330\014\022\220.\240\001\340\010\016\210j\230\001\230\021\230$\230n\250D\260\004\260G\2706\300\021\360\006\000\t\014\2104\210r\220\021\330\014\030\230\001\230\021\330\014\022\220*\230A\230Q\340\010\017\320\017 \240\001\240\024\240T\250\031\260!";
static const char __pyx_k_A_HA_Ja_4t1_AQ_31D_d_qPQ_H_q_nF[] = "\200A\330\010\014\210H\220A\330\010\014\210J\220a\340\010\013\2104\210t\2201\330\014\022\220*\230A\230Q\360\006\000\t\"\320!3\2601\260D\270\006\270d\300'\310\026\310q\320PQ\340\010\014\210H\320\024'\240q\250\006\250n\270F\300*\310A\330\010\014\210J\220b\230\002\230\"\230D\240\002\240%\240y\260\001\260\024\260Q";
static const char __pyx_k_A_HA_Ja_4t1_AQ_Qd_H_q_nF_A_Jb_D[] = "\200A\330\010\014\210H\220A\330\010\014\210J\220a\340\010\013\2104\210t\2201\330\014\022\220*\230A\230Q\360\006\000\t\"\240\034\250Q\250d\260&\270\001\270\021\340\010\014\210H\320\024'\240q\250\006\250n\270F\300*\310A\330\010\014\210J\220b\230\002\230\"\230D\240\002\240%\240y\260\001\260\024\260Q";
static const char __pyx_k_A_Q_Qc_Rq_AQ_1Jb_T_A_1_AQj_E_as[] = "\200A\360\006\000\t\032\230\024\230Q\330\010\013\210:\220Q\220c\230\034\240R\240q\330\014\022\220*\230A\230Q\330\010\013\2101\210J\220b\230\002\230#\230T\240\021\240\"\240A\330\014\023\2201\330\010\031\230\033\240A\240Q\240j\260\002\260!\330\010\014\210E\220\025\220a\220s\230!\2301\330\014\020\220\016\230a\230q\240\002\240'\250\021\250!\330\014\034\230A\230U\240\"\240B\240c\250\021\330\014\025\220Q\220a\330\010\017\210q";
static const char __pyx_k_A_Q_Qc_Rq_AQ_4q_AQ_1A_1Bhd_1_aq[] = "\200A\340\010\031\230\024\230Q\330\010\013\210:\220Q\220c\230\034\240R\240q\330\014\022\220*\230A\230Q\340\010\013\2104\210q\330\014\022\220*\230A\230Q\330\010\020\220\013\2301\230A\330\010\013\2101\210B\210h\220d\230!\2301\330\014\026\220a\220q\230\002\230'\240\021\240#\240T\250\025\250e\2601\260A\260Q\330\014\023\2201\220E\230\021\340\014\026\220a\220w\230a\330\010\014\210K\220q\330\010\024\220A\220Q";
static const char __pyx_k_A_Q_Qc_Rq_AQ_Qc_U_3axr_AQ_4s_AQ[] = "\200A\340\010\031\230\024\230Q\360\006\000\t\031\230\001\230\021\340\010\013\210:\220Q\220c\230\034\240R\240q\330\014\022\220*\230A\230Q\340\010\021\220\021\220+\230Q\230c\240\024\240U\250!\340\010\013\2103\210a\210x\220r\230\021\330\014\022\220*\230A\230Q\340\010\013\2104\210s\220!\330\014\022\220*\230A\230Q\340\010\020\220\004\220E\230\021\230!\340\010\013\320\013!\240\021\240$\240g\250V\2603\260g\270R\270q\330\014\022\220*\230A\230Q\360\006\000\t\014\320\013\036\230a\230q\330\014\020\220\004\220H\230A\340\014\020\220\004\220H\230C\230q\240\006\240a\240q\330\010\t\210\022\210=\230\001\330\010\024\220A\220Q";
static const char __pyx_k_A_c_AQ_gQ_A_83a_t4z_4AQ_a_j_G1D[] = "\200A\330\010\013\210;\220c\230\021\330\014\022\220*\230A\230Q\340\010\"\240$\240g\250Q\330\010\"\240*\250A\340\010\013\2108\2203\220a\330\014\017\210t\2204\220z\240\023\320$4\260A\260Q\330\020\026\220a\330\020\026\220j\240\001\240\023\240G\2501\250D\260\004\260K\320?O\310q\320PQ\340\014\031\230\021\230)\2409\250D\260\001\330\014\020\220\n\230!";
static const char __pyx_k_A_d_4_auD_t1_AQ_4vS_1_auD_t1_2S[] = "\200A\360\006\000\t\037\230d\240'\250\021\340\010\013\2104\210\230a\230u\240D\250\007\250t\2601\330\014\022\220*\230A\230Q\340\010\013\2104\210v\220S\230\001\330\014\023\2201\340\010\025\320\025&\240a\240u\250D\260\007\260t\2701\330\010\013\2102\210S\220\001\330\014\023\320\023$\240A\240U\250$\250g\260T\270\021\330\r\017\210s\220!\330\014\023\2201\340\014\023\320\023#\2401\240A";
static const char __pyx_k_A_d_A_E_as_AQ_S_1Kr_vU_fE_V4uAT[] = "\200A\330\010\036\230d\240'\250\021\340\010\034\230A\340\010\014\210E\220\025\220a\220s\230\"\230A\230Q\330\014\025\220S\230\003\2301\230K\240r\250\021\330\014\017\210v\220U\230$\230f\240E\250\024\250V\2604\260u\270A\270T\300\027\310\002\310$\310c\320QR\330\020\025\220Q\330\010\017\210q";
static const char __pyx_k_A_d_Q_2Rr_Bc_Ba_3d_S_ARq_AQ_D_q[] = "\200A\340\010\036\230d\240'\250\021\330\010\025\220Q\330\010\013\2102\210R\210r\220\023\220B\220c\230\023\230B\230a\230|\2503\250d\260#\260S\270\001\270\033\300A\300R\300q\330\014\022\220*\230A\230Q\330\010\014\210D\220\007\220q";
static const char __pyx_k_A_d_S_Qa_Qa_as_2S_as_RuAT_c_G1A[] = "\200A\330\010\036\230d\240'\250\021\330\010\032\230+\240S\250\005\250Q\250a\340\010\032\230+\240Q\240a\330\010\032\230,\240a\240s\250!\340\010\013\2102\210S\220\006\220a\220s\230#\230\\\250\021\250#\250R\250u\260A\260T\270\027\300\002\300$\300c\310\021\330\014\022\220(\230!\320\033,\250G\2601\260A\340\010\017\320\017\"\240!\2404\240y\260\004\260G\270<\300q\310\003\3102\310Q";
static const char __pyx_k_A_d_WA_E_q_1Bd_1_s_nAU_S_AU_U_T[] = "\200A\360\006\000\t\037\230d\240'\250\027\260\001\330\010\031\230\024\230W\240A\360\n\000\t\r\210E\220\030\230\021\230%\230q\240\001\240\021\330\014\022\220!\2201\220B\220d\230!\2301\330\014\017\210s\220!\330\020\026\220n\240A\240U\250+\260S\270\001\330\020\023\320\023$\240A\240U\250#\250U\260#\260T\270\023\270C\270w\300b\310\001\330\024\032\230*\240A\240Q";
static const char __pyx_k_A_d_WA_Qa_k_s_4t3d_Q_waq_4wi_3a[] = "\200A\330\010\036\230d\240'\250\027\260\001\330\010\031\230\024\230W\240A\340\010\032\230+\240Q\240a\330\010\036\230k\250\021\250%\250s\260!\340\010\013\2104\210t\2203\220d\230#\230Q\330\014\022\220(\230!\320\033/\250w\260a\260q\340\010\017\320\017\"\240!\2404\240w\250i\260|\3003\300a";
static const char __pyx_k_A_d_WA_Qa_k_s_4t3d_Q_waq_AU_V3d[] = "\200A\330\010\036\230d\240'\250\027\260\001\330\010\031\230\024\230W\240A\340\010\032\230+\240Q\240a\330\010\036\230k\250\021\250%\250s\260!\340\010\013\2104\210t\2203\220d\230#\230Q\330\014\022\220(\230!\320\033/\250w\260a\260q\340\010\013\320\013\034\230A\230U\240#\240V\2503\250d\260#\260S\270\007\270r\300\021\330\014\022\220*\230A\230Q";
static const char __pyx_k_A_d_WA_Qb_Qe1_A_vRr_F_Q_j_D_t3a[] = "\200A\330\010\036\230d\240'\250\027\260\001\330\010\031\230\024\230W\240A\340\010\025\220Q\220b\230\001\340\010\013\210:\220Q\220e\2301\330\014\024\220A\340\014\017\210v\220R\220r\230\023\230F\240#\240Q\330\020\026\220j\240\001\240\021\340\014\021\220\021\220\"\220D\230\001\230\021\340\014\017\210t\2203\220a\330\020\026\220a\340\014\023\220;\230a\230q\330\014\021\220\036\230q\240\005\240[\260\001\340\014\017\210t\220?\240!\2405\250\014\260D\270\003\2704\270~\310Q\310e\320SV\320VW\330\020\026\220h\230a\320\0373\2607\270!\2701\340\010\017\320\017\"\240!\2404\240w\250i\260|\3001";
static const char __pyx_k_A_d_WA_Qc_b_AQ_E_aq_1ARuAQ_uD_A[] = "\200A\340\010\036\230d\240'\250\027\260\001\330\010\031\230\024\230W\240A\360\n\000\t\014\210:\220Q\220c\230\035\240b\250\001\330\014\022\220*\230A\230Q\340\010\014\210E\220\025\220a\220q\230\001\330\014\023\2201\220A\220R\220u\230A\230Q\330\014\017\210u\220D\230\004\230A\330\020\026\220n\240A\240U\250+\260T\270\021\330\020\023\2206\230\021\230%\230x\240s\250!\330\024\025\330\020\023\220?\240!\2405\250\003\2505\260\006\260c\270\024\270W\300B\300a\330\024\032\230*\240A\240Q";
static const char __pyx_k_A_d_WA_T_A_Qe1_1_aq_a_Ba_ha_8_q[] = "\200A\330\010\036\230d\240'\250\027\260\001\330\010\031\230\024\230W\240A\330\010\025\220T\230\027\240\004\240A\360\n\000\t\014\210:\220Q\220e\2301\330\014\033\2301\340\014\023\220;\230a\230q\330\014\033\230>\250\021\250%\250\270a\330\014\017\210}\230B\230a\330\020\026\220h\230a\320\0378\270\007\270q\300\001\340\010\013\210=\230\002\230\"\230C\230}\250C\250q\330\014\022\220*\230A\230Q\340\010\017\320\017&\240a\240t\2509\260A";
static const char __pyx_k_A_iq_4q_Qa_ha_4q_1D_gV1_4r_fA_q[] = "\200A\360\006\000\t\037\230i\240q\340\010\013\2104\210q\330\014\022\220+\230Q\230a\340\010\016\210h\220a\330\010\013\2104\210q\330\014\022\220.\240\001\340\r\016\330\014\022\220)\2301\230D\240\n\250$\250g\260V\2701\340\010\013\2104\210r\220\021\330\014\026\220f\230A\330\014\030\230\001\230\021\330\014\017\210q\330\020\026\220g\230Q\230a\330\014\017\210t\2204\220q\330\020\021\330\021\025\220T\230\021\330\020\026\220g\230Q\230a\330\021\022\330\020\026\320\026(\250\001\320)H\310\004\310A\340\020\026\220g\230Q\230a\340\010\017\320\017 \240\001\240\024\240Y\250a";
static const char __pyx_k_A_j_PPWWXXdde_y_q_HA_HA_a_Q_E_a[] = "\200\001\360$\000\005\010\200{\220\"\220A\330\010\016\210j\230\001\320\031P\320PW\320WX\320Xd\320de\340\004\007\200y\220\003\220<\230q\330\010\024\220H\230A\330\010\024\220H\230A\330\010\016\210a\210{\230+\240Q\330\010\014\210E\220\025\220a\220|\2401\330\014\025\220Q\220e\2301\330\t\022\220#\220\\\240\024\240Y\250c\260\021\330\010\025\220Z\230q\330\010\025\220[\240\001\330\010\014\210E\220\025\220a\220q\330\014\022\220*\230A\230Q\330\014\017\210t\2203\220a\330\020\026\220a\330\021\025\220S\230\001\330\020\026\220a\330\014\025\220Q\220e\2301\330\010\014\210E\220\025\220a\220|\2401\330\014\025\220Q\220e\320\0330\260\004\260J\270a\330\t\022\220#\220]\240$\240i\250s\260!\330\010\026\220k\240\021\330\010\026\220k\240\021\330\010\014\210E\220\025\220a\220q\330\014\022\220+\230Q\230a\330\014\017\210t\2203\220a\330\020\026\220a\330\021\025\220S\230\001\330\020\026\220a\330\014\025\220Q\220e\2301\330\010\014\210E\220\025\220a\220|\2401\330\014\025\220Q\220e\320\0330\260\004\260J\270a\330\t\022\220#\220]\240$\240i\250s\260!\330\010\026\220k\240\021\330\010\026\220k\240\021\330\010\014\210E\220\025\220a\220q\330\014\025\220Q\220e\230;\240a\240q\330\010\014\210E\220\025\220a\220|\2401\330\014\025\220Q\220e\320\0330\260\004\260J\270a\330\t\022\220#\220]\240$\240i\250s\260!\330\010\024\220I\230Q\330\010\024\220I\230Q\330\010\014\210E\220\025\220a\220q\330\014\025\220Q\220e\2309\240A\240Q\330\010\014\210E\220\025\220a\220|\2401\330\014\031\230\021\230*\240B\240c\320)>\270d\300*\310A\340\010\016\210i\220q\230\001";
static const char __pyx_k_HKq_K_Q_q_ha_4q_Qa_4_1D_7_9A_9A[] = "\320\004 \240\014\250H\260K\270q\330\034'\240}\260K\270~\310Q\360\020\000\t\017\320\016\037\230q\240\006\240h\250a\340\010\013\2104\210q\330\014\022\220+\230Q\230a\340\010\013\2104\210|\320\033+\2501\250D\260\001\340\010\013\2107\220'\230\021\330\014\017\210{\230!\340\010\013\2109\220A\330\010\013\2109\220A\330\010\013\2109\220A\330\010\013\2109\220A\340\010\013\2108\2207\230!\330\014\017\210{\230!\340\010\013\2107\220'\230\021\330\014\017\210z\230\021\230)\2406\250\027\260\001\330\020\024\220E\230\021\330\024\027\220w\230d\240!\2401\340\020\023\2207\230$\230a\230q\340\010\013\2101\330\014\017\210u\220G\2301\230A\340\010\013\2101\330\014\017\210x\220q\230\002\230'\240\021\240!\340\010\013\2101\330\014\020\220\003\220:\230Y\240a\240q\330\020\023\2208\2301\230B\230g\240Q\240a\340\010\017\210q";
static const char __pyx_k_Invalid_VariantRecord_Number_of[] = "Invalid VariantRecord.  Number of samples does not match header ({} vs {})";
static const char __pyx_k_KWggh_4t1_AQ_4xq_AQ_7_U_gS_a_e6[] = "\320\004\033\230<\240{\260-\270}\310K\320Wg\320gh\360,\000\t\014\2104\210t\2201\330\014\022\220*\230A\230Q\340\010\013\2104\210x\220q\330\014\022\220*\230A\230Q\340\010\013\2107\220#\220U\230$\230g\240S\250\001\330\014\020\220\016\230a\330\014\022\220$\220e\2306\240\034\250Q\330\014\017\210u\220A\220T\230\021\330\014\023\2204\220q\230\001\340\010\013\2104\210w\220c\230\021\330\014\022\220*\230A\230Q\340\010\013\2105\220\007\220w\230d\240-\250q\260\010\270\007\270v\300Q\33006\260d\270%\270z\310\021\340\010\013\2107\220#\220Q\330\014\025\220T\320\031,\250A\250Q\340\010\014\210N\230!\330\010\017\210t\2206\230\026\230q\240\006\240h\250g\260V\2701";
static const char __pyx_k_Number_must_be_None_when_adding[] = "Number must be None when adding a filter";
static const char __pyx_k_TTU_wb_j_1_1_1E_axq_t3b_4q_q_4r[] = "\320\000T\320TU\340\004\007\200w\210b\220\001\330\010\016\210j\230\001\230\021\340\004\033\2301\330\004\023\2201\330\004\n\320\n\033\2301\230E\240\025\240a\240x\250q\260\001\340\004\007\200t\2103\210b\220\003\2204\220q\330\010\017\210q\340\004\013\2104\210r\220\023\220J\230c\240\021\330\004\032\230$\230c\240\023\240A\330\004\027\220w\230b\240\007\240r\250\021\330\004\026\220a\340\004\n\210'\220\022\220;\230d\240\"\240A\240S\250\003\2501\330\010\016\210a\330\010\022\220!\340\004\010\210\001\210\027\220\001\340\004\013\320\013 \240\001\240\030\250\023\250A";
static const char __pyx_k_T_1AQ_U_1A_Q_3c_Q_1_Q_1_Q_1_Q_1[] = "\210\001\330\014\035\230T\240\021\330\014 \240\013\2501\250A\250Q\340\014\020\220\005\220U\230!\2301\230A\330\020\025\320\025)\250\021\250#\250Q\340\020\023\2203\220c\230\021\330\024\035\230Q\330\025\030\230\003\2301\330\024\035\230Q\330\025\030\230\003\2301\330\024\035\230Q\330\025\030\230\003\2301\330\024\035\230Q\330\025\030\230\003\2301\330\024\035\230Q\330\025\030\230\003\2301\330\024\035\230Q\340\024\035\230Q\340\020 \240\001\240\030\250\023\250A\330\020\031\230\021\230!\340\014\023\2201";
static const char __pyx_k_T_G1F_a_vWA_q_t87_q_4D_7RS_4D_1[] = "\200\001\360\010\000\005\016\210T\220\021\330\004\014\210G\2201\220F\230,\240a\330\004\007\200v\210W\220A\330\010\022\220!\330\010\027\220q\340\010\027\220t\2308\2407\250!\330\004\007\200q\330\010\017\320\0174\260D\270\001\270\027\300\013\3107\320RS\340\010\017\320\0174\260D\270\001\270\027\300\013\3101";
static const char __pyx_k_T_G1F_a_vWA_q_t87_q_5T_GST_5T_A[] = "\200\001\360\010\000\005\016\210T\220\021\330\004\014\210G\2201\220F\230,\240a\330\004\007\200v\210W\220A\330\010\022\220!\330\010\027\220q\340\010\027\220t\2308\2407\250!\330\004\007\200q\330\010\017\320\0175\260T\270\021\270'\300\033\310G\320ST\340\010\017\320\0175\260T\270\021\270'\300\033\310A";
static const char __pyx_k_T_Q_G1F_a_vWA_q_t87_q_4D_7RS_4D[] = "\200\001\360\010\000\005\016\210T\220\030\230\024\230Q\330\004\014\210G\2201\220F\230,\240a\330\004\007\200v\210W\220A\330\010\022\220!\330\010\027\220q\340\010\027\220t\2308\2407\250!\330\004\007\200q\330\010\017\320\0174\260D\270\001\270\027\300\013\3107\320RS\340\010\017\320\0174\260D\270\001\270\027\300\013\3101";
static const char __pyx_k_T_a_G1F_a_vWA_q_t87_s_fG1_q_awk[] = "\200\001\360\010\000\005\016\210T\220\031\230$\230a\330\004\014\210G\2201\220F\230,\240a\330\004\007\200v\210W\220A\330\010\022\220!\330\010\027\220q\340\010\027\220t\2308\2407\250%\250s\260$\260f\270G\3001\330\004\007\200q\330\010\017\320\017*\250$\250a\250w\260k\300\027\310\001\340\010\017\320\017*\250$\250a\250w\260k\300\021";
static const char __pyx_k_T_e4q_G1F_a_vWA_q_t87_q_0_AWKwa[] = "\200\001\360\010\000\005\016\210T\220\031\230$\230e\2404\240q\330\004\014\210G\2201\220F\230,\240a\330\004\007\200v\210W\220A\330\010\022\220!\330\010\027\220q\340\010\027\220t\2308\2407\250!\330\004\007\200q\330\010\017\320\0170\260\004\260A\260W\270K\300w\310a\340\010\017\320\0170\260\004\260A\260W\270K\300q";
static const char __pyx_k_TabixIterator___setstate_cython[] = "TabixIterator.__setstate_cython__";
static const char __pyx_k_Type_must_be_None_when_adding_a[] = "Type must be None when adding a filter";
static const char __pyx_k_VariantContig___setstate_cython[] = "VariantContig.__setstate_cython__";
static const char __pyx_k_VariantHeaderContigs___setstate[] = "VariantHeaderContigs.__setstate_cython__";
static const char __pyx_k_VariantHeaderContigs_itervalues[] = "VariantHeaderContigs.itervalues";
static const char __pyx_k_VariantHeaderMetadata_iteritems[] = "VariantHeaderMetadata.iteritems";
static const char __pyx_k_VariantHeaderRecords___setstate[] = "VariantHeaderRecords.__setstate_cython__";
static const char __pyx_k_VariantHeaderSamples___setstate[] = "VariantHeaderSamples.__setstate_cython__";
static const char __pyx_k_VariantHeader___setstate_cython[] = "VariantHeader.__setstate_cython__";
static const char __pyx_k_VariantMetadata___reduce_cython[] = "VariantMetadata.__reduce_cython__";
static const char __pyx_k_VariantRecordSamples___setstate[] = "VariantRecordSamples.__setstate_cython__";
static const char __pyx_k_VariantRecordSamples_itervalues[] = "VariantRecordSamples.itervalues";
static const char __pyx_k_VariantRecord___setstate_cython[] = "VariantRecord.__setstate_cython__";
static const char __pyx_k_a_6_wfCvWA_AQ_V1Cq_Qa_vQa_vWA_I[] = "\320\004\"\240,\250a\340\010\013\2106\220\026\220w\230f\240C\240v\250W\260A\330\014\022\220*\230A\230Q\340\010 \240\r\250V\2601\260C\260q\360\006\000\t\n\330\014\022\220+\230Q\230a\330\014\020\220\007\220v\230Q\230a\340\014\017\210v\220W\230A\330\020\024\220I\230V\2401\240K\250q\260\001\340\020\024\220E\230\031\240!\330\024\035\230T\240\032\2501\250G\260>\300\024\300T\310\030\320QW\320Wa\320ab\340\024\032\230+\240Q\240a\330\024\027\320\027'\240q\250\006\250e\2605\270\003\2701\270F\300\"\300A\330\030\036\230k\250\021\250!\340\024\034\230K\240q\250\003\2501\250A\330\024\027\320\027'\240q\250\006\250d\260&\270\001\270\023\270G\3005\310\003\3101\310H\320T\\\320\\^\320^_\330\030\036\230k\250\021\250!\340\014\034\230A\230Q\330\014\r\340\010\030\230\001\230\024\230V\2401\340\010\014\210J\220a";
static const char __pyx_k_bcf_check_values_locals_genexpr[] = "bcf_check_values.<locals>.genexpr";
static const char __pyx_k_cannot_iterate_over_Variantfile[] = "cannot iterate over Variantfile opened for writing";
static const char __pyx_k_file_does_not_have_valid_header[] = "file `{}` does not have valid header (mode=`{}`) - is it VCF/BCF format?";
static const char __pyx_k_invalid_file_mode_is_it_VCF_BCF[] = "invalid file `{}` (mode=`{}`) - is it VCF/BCF format?";
static const char __pyx_k_q_d_WA_Qc_b_AQ_Qa_AU_Q_1_y_JdRS[] = "\320\004\037\230q\330\010\036\230d\240'\250\027\260\001\330\010\031\230\024\230W\240A\340\010\013\210:\220Q\220c\230\035\240b\250\001\330\014\022\220*\230A\230Q\340\010\032\230+\240Q\240a\330\010 \240\014\250A\250U\260#\260Q\360\006\000\t\034\320\0331\260\021\260%\260y\300\004\300J\310d\320RS\340\010\013\2108\2202\220Q\330\014\017\210x\220s\230!\330\020\026\220h\230a\320\0377\260w\270a\270q\330\014\023\2201\340\010\013\2104\210\230a\230u\240M\260\021\330\014\022\220*\230A\230Q\360\006\000\t\014\210?\230!\2305\240\r\250Y\260c\270\034\300U\310$\310e\320SV\320VZ\320Z^\320^_\330\014\r\340\010\013\2104\210u\220C\220t\2304\230q\330\014\017\210x\220s\230!\330\020\026\220h\230a\320\0377\260w\270a\270q\330\014\023\2201\340\010\020\320\020\"\240!\2404\240y\260\001\340\010\013\210?\230!\2305\240\003\2406\250\026\250s\260$\260g\270R\270q\330\014\022\220*\230A\230Q\340\010\017\210q";
static const char __pyx_k_q_wc_j_wa_V7_Qa_z_1_j_vWBb_6_2S[] = "\320\000\037\230q\330\004\007\200w\210c\220\021\330\010\016\210j\230\001\230\021\340\004\032\230&\240\007\240w\250a\330\004\025\220V\2307\240!\330\004\025\220Q\220a\340\004\007\200z\220\021\220#\220\\\240\022\2401\330\010\016\210j\230\001\230\021\340\004\007\200v\210W\220B\220b\230\003\2306\240\027\250\003\2502\250S\260\004\260A\260Q\330\010\017\210q\340\004\033\2301\230B\230a\330\004\023\2209\230A\230U\240$\240a\340\004\007\200t\2104\210s\220$\220d\230!\330\010\017\210q\360\014\000\005\030\220q\340\004\007\200t\2106\220\023\220A\330\010\020\220\013\2304\230s\240\"\240F\250'\260\022\2604\260q\330\010\014\210E\220\025\220a\220t\2301\330\014\017\210u\220A\220S\230\003\2301\330\020\021\330\021\026\220a\220s\230#\230Q\330\020\021\330\021\023\2204\220t\320\033+\2501\250E\260\021\260!\330\020\027\220q\340\020\031\230\021\330\t\r\210V\2203\220a\330\010\021\220\034\230T\240\023\240B\240f\250G\2602\260T\270\021\330\010\014\210E\220\025\220a\220t\2301\330\014\017\210v\220Q\220c\230\023\230A\330\020\021\330\021\027\220q\230\003\2303\230a\330\020\021\330\021\023\2204\220t\320\033+\2501\250F\260!\2601\330\020\027\220q\340\020\031\230\021\330\t\r\210V\2203\220a\330\010\021\220\034\230T\240\023\240B\240f\250G\2602\260T\270\021\330\010\014\210E\220\025\220a\220t\2301\330\014\017\210v\220Q\220c\230\023\230A\330\020\021\330\021\027\220q\230\003\2303\230a\330\020\021\330\021\023\2204\220t\320\033+\2501\250F\260!\2601\330\020\027\220q\340\020\031\230\021\340\004\013\2101";
static const char __pyx_k_r_A_j_uCq_AQ_E_aq_j_c_q_HA_E_aq[] = "\200\001\360\014\000\005\010\200r\210\023\210A\330\010\016\210j\230\001\230\021\340\004\007\200u\210C\210q\330\010\020\320\020)\250\021\250&\260\014\270A\270Q\330\010\020\220\010\230\001\330\010\014\210E\220\025\220a\220q\330\014\021\220\021\220%\320\027*\250$\250j\270\001\330\t\016\210c\220\021\330\010\020\320\020)\250\021\250&\260\017\270q\300\001\330\010\021\220\033\230H\240A\330\010\014\210E\220\025\220a\220q\330\014\022\220!\2205\320\030-\250T\260\032\2701\330\t\016\210c\220\021\330\010\020\320\020)\250\021\250&\260\r\270Q\270a\330\010\020\220\t\230\030\240\021\330\010\014\210E\220\025\220a\220q\330\014\031\230\021\230&\240\002\240#\320%:\270$\270j\310\001\340\010\016\210i\220q\230\001\340\004\013\2101";
static const char __pyx_k_self_ptr_cannot_be_converted_to[] = "self.ptr cannot be converted to a Python object for pickling";
static const char __pyx_k_t1_j_t1_j_q_a_1IRq_waq_1IRq_waq[] = "\200\001\330\004\007\200t\2101\330\010\016\210j\230\001\230\021\340\004\007\200t\2101\330\010\016\210j\230\001\230\021\340\004\007\200q\210\001\330\010\016\210a\360\n\000\t\014\2101\210I\220R\220q\330\014\017\210w\220a\220q\330\010\013\2101\210I\220R\220q\330\014\017\210w\220a\220q\330\010\013\2101\210I\220R\220q\330\014\017\210w\220a\220q\330\010\013\2101\210I\220R\220q\330\014\017\210w\220a\220q\330\010\013\2101\210I\220R\220q\330\014\017\210w\220a\220q\340\010\013\2101\330\014\022\220$\220e\2301\230A\330\014\022\220*\230A\320\035:\270'\300\021\300!\340\004 \240\r\250X\260Q\260a\330\004\n\210*\220A\330\004\n\210'\220\021\340\004\013\2101";
static const char __pyx_k_t1_j_uC_e3l_e3a_j_s_Bc_CvT_1A_j[] = "\200\001\330\004\007\200t\2101\330\010\016\210j\230\001\230\021\340\004\007\200u\210C\210{\230$\230e\2403\240l\260$\260e\2703\270a\330\010\016\210j\230\001\230\021\340\004\007\200s\210\"\210B\210c\220\023\220C\220v\230T\240\022\2401\240A\330\010\016\210j\230\001\230\021\340\004 \240\017\250x\260q\270\001\330\004\010\210\n\220!\330\004\010\210\010\220\001\330\004\010\210\006\210a\340\004\013\2101";
static const char __pyx_k_wc_j_q_Qk_Zq_m1_xs_1E_Kt9AV7_1F[] = "\200\001\360\n\000\005\010\200w\210c\220\021\330\010\016\210j\230\001\230\021\340\004\027\220q\230\010\240\t\250\024\250]\270(\300!\360\006\000\005\016\210Q\210k\230\024\230Z\240q\250\010\260\006\260m\3001\360\006\000\005\010\200x\210s\220!\330\010\023\2201\220E\230\021\330\t\021\220\023\220K\230t\2409\250A\250V\2607\270&\300\001\340\010\023\2201\220F\230!\340\004\025\220S\230\001\230\021\330\004\007\200{\220!\2203\220d\230\"\230D\240\013\2501\250C\250s\260!\330\010\013\2106\220\021\220!\330\014\022\220)\2301\320\034G\300w\310a\310q\340\014\022\220)\2301\320\034J\310'\320QR\320R]\320]^\320^b\320bc\340\004\007\200x\210s\220!\330\010\014\210E\220\021\330\014\017\210t\2202\220S\230\005\230S\240\n\250!\2504\250w\260a\330\020\026\220i\230q\240\001\330\t\021\220\023\220A\330\010\014\210E\220\021\330\014\017\210t\2202\220S\230\005\230T\240\032\2501\250D\260\007\260v\270T\300\023\300A\300S\310\003\3101\330\020\026\220i\230q\240\001\330\010\014\210E\220\021\330\014\017\210t\2202\220S\230\005\230S\320 2\260\"\260E\270\021\330\020\026\220j\240\001\240\021\330\t\021\220\023\220A\330\010\021\220\024\220U\230!\2301\330\t\021\220\023\220A\330\010\013\2106\220\021\220#\220X\230V\2407\250&\260\003\2601\330\014\022\220*\230A\230Q\340\010\016\210i\220q\230\001\340\004\013\2101\210E\220\021\330\004\007\200s\210!\2108\2203\220b\230\004\230H\240C\240q\330\010\017\210q\220\005\220Q\330\t\014\210A\210X\220R\220q\330\010\017\210q\220\005\220Q\330\t\021\220\023\220A\330\010\014\210E\220\021\330\014\017\210r\220\027\230\005\230T\240\024\320%6\260b\270\005\270Q\330\020\027\220q\230\005\230Q\330\020\021\330\t\021\220\023\220A\330\010\014\210E\220\021\330\014\017\210r\220\027\230\005\230T\240\024\320%7\260r\270\025\270a\330\020\027\220q\230\005\230Q\330\020\021\340\004\013\2101";
static const char __pyx_k_wc_j_r_2S_S_j_CuAQ_z_r_3a_q_E_a[] = "\200\001\330\004\007\200w\210c\220\021\330\010\016\210j\230\001\230\021\340\004\032\230&\240\001\340\004\007\200r\210\022\2102\210S\220\002\220#\220S\230\001\330\010\016\210j\230\001\230\021\340\004\034\230C\230u\240A\240Q\330\004\007\200z\220\021\340\004\007\200r\210\022\2103\210a\330\010\017\210q\220\001\220\023\220E\230\021\230$\230a\230s\240%\240q\250\001\250\021\250%\250s\260&\270\001\270\022\2701\270A\340\004\024\220A\220Q\330\004\007\200u\210A\210S\220\n\230!\330\004\007\200y\220\001";
static const char __pyx_k_wc_j_t3a_j_AQ_wa_V7_z_1_j_k_Qe3[] = "\200\001\330\004\007\200w\210c\220\021\330\010\016\210j\230\001\230\021\340\004\007\200t\2103\210a\330\010\016\210j\230\004\230A\230Q\330\010\t\340\004\032\230&\240\007\240w\250a\330\004\025\220V\2307\240!\360\010\000\005:\270\021\360\006\000\005\010\200z\220\021\220#\220\\\240\022\2401\330\010\016\210j\230\001\230\021\340\004\026\220k\240\021\240!\330\004\032\230+\240Q\240e\2503\250a\340\004\007\200q\330\010\021\220\023\220A\340\010\014\210K\220s\230%\230q\240\001\330\010\014\210L\230\001\230\023\230A\340\010\013\2102\210S\220\006\220a\220s\230#\230\\\250\021\250#\250R\250u\260A\260\\\300\022\3004\300s\310!\330\014\022\220(\230!\320\033/\250w\260a\260q\340\010\021\220\034\230Q\230c\240\022\2401\340\004\007\200t\210?\230!\2305\240\014\250A\330\010\016\210j\230\001\230\021\340\004\017\210\230a\230u\240L\260\001\340\004\007\200y\220\003\2201\330\010\016\210j\230\001\230\021\340\004\007\200y\220\001\220\025\220a\330\010\020\320\020\"\240!\2406\250\031\260!\340\010\023\2201\340\004\r\320\r\035\230Q\230f\240I\250W\260F\270!\330\036*\250*\260A\330\036!\240\031\250*\260A\330\036!\240\031\250*\260A\330\036\037\230}\250A\250X\260Q\260a\330\004\013\210<\220r\230\021\330\004\022\220#\220Q\220a\360\006\000\005\010\200t\2104\210t\2201\330\010\t\210\022\210?\230!\330\010\033\2301\230H\240C\240s\250\"\250F\260'\270\022\2703\270g\300S\310\007\310s\320RV\320VW\330\010\t\340\004\023\2201\220C\220q\330\004\007\200t\2104\210s\220#\220R\220q\330\010\024\220C\220q\340\004\017\210q\220\001\330\004\021\220\037\240\001\240\032\2509\260B\260k\300\021\330\004\036\230h\240a\340\004\007\200y\220\003\2201\330\010\023\2201\330\010\023\320\023#\2402\240Q\330\t\022\220#\220Q\330\010\023\2201\330\010\023\220>\240\022\2401\330\t\022\220#\220Q\330\010\023\2201\330\010\023\220=\240\002\240!\340\010\016\210j\230\001\230\021\340\004\007\200t\2104\210y\230\002\230!\330\010\014\210E\220\025\220a\220q\330\014!\240\021\240#\240S\250\002\250\"\250B\250c\260\027\270\003\2707\300#\300Q\330\"0\260\002\260\"""\260B\260j\300\n\310!\330\"#\340\004\027\220q\230\010\240\r\250R\250v\260W\270B\270j\310\n\320R]\320]^\340\004\007\320\007\030\230\001\230\025\230c\240\026\240~\260V\2709\300B\300l\320R\\\320\\^\320^_\330\010\016\210j\230\001\230\021";
static const char __pyx_k_wc_j_wa_V7_AQ_z_1_j_AQ_vWBb_6_9[] = "\200\001\330\004\007\200w\210c\220\021\330\010\016\210j\230\001\230\021\340\004\032\230&\240\007\240w\250a\330\004\025\220V\2307\240!\330\004\034\230A\230Q\340\004\007\200z\220\021\220#\220\\\240\022\2401\330\010\016\210j\230\001\230\021\340\004\034\230A\230Q\340\004\007\200v\210W\220B\220b\230\003\2306\240\027\250\003\2509\260C\260t\2701\270A\330\010\017\210q\340\004\033\2301\230B\230a\330\004\023\2209\230A\230U\240$\240a\340\004\007\200t\2104\210s\220$\220d\230!\330\010\017\210q\360\014\000\005\017\210a\330\004\007\200t\2106\220\023\220A\330\010\020\220\013\2304\230s\240\"\240F\250'\260\022\2604\260q\330\010\014\210E\220\025\220a\220t\2301\330\014\017\210u\220A\220S\230\003\2301\330\020\021\330\014\020\220\r\230Q\230e\2401\240A\330\014\023\2207\230!\230>\250\021\250!\2502\250W\260A\260W\270B\270c\300\024\300^\320ST\330\t\r\210V\2203\220a\330\010\021\220\034\230T\240\023\240B\240f\250G\2602\260T\270\021\330\010\014\210E\220\025\220a\220t\2301\330\014\017\210v\220Q\220c\230\023\230A\330\020\021\330\014\020\220\r\230Q\230f\240A\240Q\330\014\023\2207\230!\230>\250\021\250!\2502\250W\260A\260W\270B\270c\300\024\300^\320ST\330\t\r\210V\2203\220a\330\010\021\220\034\230T\240\023\240B\240f\250G\2602\260T\270\021\330\010\014\210E\220\025\220a\220t\2301\330\014\017\210v\220Q\220c\230\023\230A\330\020\021\330\014\020\220\r\230Q\230f\240A\240Q\330\014\023\2207\230!\230>\250\021\250!\2502\250W\260A\260W\270B\270c\300\024\300^\320ST\330\004\013\2105\220\001\220\021";
static const char __pyx_k_wc_j_wa_V7_Qa_z_1_j_vWBb_6_2S_A[] = "\200\001\330\004\007\200w\210c\220\021\330\010\016\210j\230\001\230\021\340\004\032\230&\240\007\240w\250a\330\004\025\220V\2307\240!\330\004\025\220Q\220a\340\004\007\200z\220\021\220#\220\\\240\022\2401\330\010\016\210j\230\001\230\021\340\004\007\200v\210W\220B\220b\230\003\2306\240\027\250\003\2502\250S\260\004\260A\260Q\330\010\017\210q\340\004\033\2301\230B\230a\330\004\023\2209\230A\230U\240$\240a\340\004\007\200t\2104\210s\220$\220d\230!\330\010\017\210q\360\n\000\005 \230q\240\001\330\004\030\230\001\340\004\007\200t\2106\220\023\220A\330\010\020\220\013\2304\230s\240\"\240F\250'\260\022\2604\260q\330\010\014\210E\220\025\220a\220t\2301\330\014\017\210u\220A\220S\230\003\2301\330\020\021\330\021\026\220a\220s\230#\230Q\330\020\025\220Q\340\020\024\220M\240\021\240%\240q\250\001\330\014\023\2207\230!\2305\240\002\240#\240T\250\036\260q\330\t\r\210V\2203\220a\330\010\021\220\034\230T\240\023\240B\240f\250G\2602\260T\270\021\330\010\014\210E\220\025\220a\220t\2301\330\014\017\210v\220Q\220c\230\023\230A\330\020\021\330\021\027\220q\230\003\2303\230a\330\020\025\220Q\340\020\024\220M\240\021\240&\250\001\250\021\330\014\023\2207\230!\2305\240\002\240#\240T\250\036\260q\330\t\r\210V\2203\220a\330\010\021\220\034\230T\240\023\240B\240f\250G\2602\260T\270\021\330\010\014\210E\220\025\220a\220t\2301\330\014\017\210v\220Q\220c\230\023\230A\330\020\021\330\021\027\220q\230\003\2303\230a\330\020\025\220Q\340\020\024\220M\240\021\240&\250\001\250\021\330\014\023\2207\230!\2305\240\002\240#\240T\250\036\260q\340\004\013\2105\220\001\220\021";
static const char __pyx_k_wc_j_wa_V7_z_1_j_k_Qe3a_t4s_c_h[] = "\200\001\330\004\007\200w\210c\220\021\330\010\016\210j\230\001\230\021\340\004\032\230&\240\007\240w\250a\330\004\025\220V\2307\240!\360\010\000\005\010\200z\220\021\220#\220\\\240\022\2401\330\010\016\210j\230\001\230\021\340\004\026\220k\240\021\240!\330\004\032\230+\240Q\240e\2503\250a\340\004\007\200t\2104\210s\220$\220c\230\021\330\010\016\210h\220a\320\027+\2507\260!\2601\340\004\007\200y\220\001\220\025\220c\230\021\330\010\017\320\017,\250A\250Q\340\004\027\220q\230\006\230i\240|\2603\260e\2701\270G\3001\300H\310F\320RS\340\004\007\200s\210#\210T\220\023\220C\220t\2303\230a\330\010\017\320\017\"\240!\2403\240c\250\022\2506\260\027\270\002\270#\270W\300C\300w\310c\320QU\320U\\\320\\]\330\t\n\330\010\017\210q\330\t\017\210s\220!\330\010\017\210q\340\010\020\220\007\220q";
static const char __pyx_k_A_3c_4s_Q_1_Q_a_S_a_l_Qa_Ql_Qa_2[] = "\200A\330\010\013\2103\210c\220\022\2204\220s\230#\230Q\330\014\023\2201\340\010\031\230\024\230Q\330\010\031\230\025\230a\340\010\030\230\005\230S\240\006\240a\330\035\036\230l\250#\250Q\250a\330\030\035\230Q\230l\250#\250Q\250a\330\030\036\320\0362\260!\2601\260G\2704\320?S\320ST\320TU\320UV\330\032\035\230Q\230l\250#\250Q\250a\330\030\035\230Q\230l\250#\250Q\250a\330\030\035\230Q\230l\250#\250Q\250a\330\030\035\230T\240\031\250#\250U\260!\330\030\035\230T\240\031\250#\250U\260!\330\030\035\230T\240\031\250#\250U\260!\330\030\035\230T\240\031\250#\250U\260!\330\030\035\230T\240\031\250#\250U\260!\330\030\035\230T\240\031\250#\250U\260!\340\010\013\2103\210c\220\021\330\014\022\220$\220a\340\010\017\210q";
static const char __pyx_k_A_3c_4s_Q_1_WA_gQ_G3ar_D_s_aq_3c[] = "\200A\330\010\013\2103\210c\220\022\2204\220s\230#\230Q\330\014\023\2201\340\010\031\230\024\230W\240A\330\010\031\230\025\230g\240Q\340\010\031\230\021\230\"\230G\2403\240a\240r\250\027\260\004\260D\270\001\270\026\270s\300$\300a\300q\340\010\013\2103\210c\220\021\330\014\022\220$\220a\340\010\017\210q";
static const char __pyx_k_A_3c_A_gQa_4vS_wgQ_j_uG1_j_BfL_q[] = "\200A\340\010\013\2103\210c\220\021\330\014\022\220*\230A\320\035>\270g\300Q\300a\340\010\013\2104\210v\220S\230\001\330\014\017\210w\220g\230Q\330\020\026\220j\240\001\240\021\330\014\017\210u\220G\2301\330\020\026\220j\240\001\240\021\340\014\024\220B\220f\230L\250\001\250\027\260\017\270q\340\014\017\210u\220G\2301\330\020\026\220j\240\001\320!=\270W\300A\300Q\330\014\017\210w\220c\230\021\330\020\031\230\021\340\014\024\220B\220f\230L\250\001\250\021\330\026 \240\014\250A\250Q\330\026\036\230l\250!\2501\330\026%\240Q\340\010\021\220\026\220v\230Q\330\010\014\210G\2209\230A\230^\2501\250D\260\010\270\006\270a";
static const char __pyx_k_A_4t1_4xz_T_Q_m1D_gQ_t2Rt6_A_A_i[] = "\200A\340\010\013\2104\210t\2201\330\014\r\360\n\000\t\014\2104\210x\220z\240\024\240T\250\024\250Q\330\021\022\330\020\026\220m\2401\240D\250\n\260$\260g\270Q\330\014\017\210t\2202\220R\220t\2306\240\023\240A\330\020\026\320\026(\250\001\320)@\300\004\300A\340\010\016\210i\220q\230\004\230A\330\010\014\210K\220q\330\010\014\210J\220d\230)\2401\340\010\013\2104\210r\220\022\2204\220v\230S\240\001\330\014\022\320\022$\240A\320%7\260t\2701";
static const char __pyx_k_A_4t1_iq_4q_Qa_ha_4t1_at4z_WA_4r[] = "\200A\330\010\013\2104\210t\2201\330\014\r\340\010\036\230i\240q\340\010\013\2104\210q\330\014\022\220+\230Q\230a\340\010\016\210h\220a\330\010\013\2104\210t\2201\330\014\022\220.\240\001\360\010\000\016\017\330\014\022\220,\230a\230t\2404\240z\260\024\260W\270A\340\010\013\2104\210r\220\021\330\014\035\230Q\230f\240A\330\014\017\210t\2204\220q\330\020\021\330\021\025\220T\230\021\330\020\026\220g\230Q\230a\330\021\022\330\020\026\220g\230Q\230g\240X\250Q\250a\340\020\026\220g\230Q\230a\340\010\016\320\016\037\230q\240\004\240D\250\007\250v\260Q\340\010\013\2104\210r\220\021\330\014\035\230Q\230f\240A\330\014\022\220*\230A\230Q\340\010\017\320\017 \240\001\240\024\240T\250\031\260!";
static const char __pyx_k_A_4t9Ct4q_4xz_T_Q_m1D_gQ_t2Rt6_A[] = "\200A\330\010\013\2104\210t\2209\230C\230t\2404\240q\330\014\r\360\n\000\t\014\2104\210x\220z\240\024\240T\250\024\250Q\330\021\022\330\020\026\220m\2401\240D\250\n\260$\260g\270Q\330\014\017\210t\2202\220R\220t\2306\240\023\240A\330\020\026\320\026(\250\001\320)@\300\004\300A\340\010\016\210i\220q\230\004\230A\330\010\014\210K\220q\330\010\014\210J\220d\230)\2401\340\010\013\2104\210r\220\022\2204\220v\230S\240\001\330\014\022\320\022$\240A\320%7\260t\2701";
static const char __pyx_k_A_E_U_E_Qd_t6_t1_AT_AQ_4t4q_4q_Q[] = "\200A\360\010\000\t\r\210E\220\024\220U\230!\330\010\014\210E\220\021\340\010\013\210:\220Q\220d\230'\240\026\240t\2506\260\021\260&\270\002\270!\330\014\017\210t\2201\330\020\024\220A\220T\230\021\330\014\022\220*\230A\230Q\360\022\000\t\017\320\016\"\240!\2404\240t\2504\250q\340\010\013\2104\210q\330\014\020\220\001\220\024\220Q\340\010\017\210q";
static const char __pyx_k_A_E_U_E_fCq_b_t1_AT_AQ_4t4q_4q_Q[] = "\200A\360\006\000\t\r\210E\220\024\220U\230!\330\010\014\210E\220\021\340\010\013\210>\230\021\230$\230f\240C\240q\250\006\250b\260\001\330\014\017\210t\2201\330\020\024\220A\220T\230\021\330\014\022\220*\230A\230Q\340\010\016\320\016\"\240!\2404\240t\2504\250q\340\010\013\2104\210q\330\014\020\220\001\220\024\220Q\330\010\017\210q";
static const char __pyx_k_A_Q_Qc_Rq_AQ_1_6_Qa_A_WF_fG2Q_AQ[] = "\200A\340\010\031\230\024\230Q\330\010\013\210:\220Q\220c\230\034\240R\240q\330\014\022\220*\230A\230Q\330\010\033\2301\330\010\013\2106\220\027\230\001\330\014\022\220+\230Q\230a\330\014\024\220A\330\010\013\210=\230\001\230\024\230W\240F\250$\250f\260G\2702\270Q\330\014\022\220*\230A\230Q";
static const char __pyx_k_A_Q_Qc_Rq_AQ_4q_1_AQa_E_aq_aq_AU[] = "\200A\360\006\000\t\032\230\024\230Q\330\010\013\210:\220Q\220c\230\034\240R\240q\330\014\022\220*\230A\230Q\330\010\013\2104\210q\220\002\220!\330\014\023\2201\330\010\031\230\033\240A\240Q\240a\330\010\014\210E\220\025\220a\220q\230\001\330\014\020\220\016\230a\230q\240\002\240'\250\021\250!\330\014\034\230A\230U\240#\240Q\330\014\025\220Q\220a\330\010\017\210q";
static const char __pyx_k_A_Q_Qc_Rq_AQ_AS_E_4s_AQ_q_7_6_HD[] = "\200A\360\006\000\t\032\230\024\230Q\330\010\013\210:\220Q\220c\230\034\240R\240q\330\014\022\220*\230A\230Q\330\010\020\220\001\220\033\230A\230S\240\004\240E\250\021\330\010\013\2104\210s\220!\330\014\022\220*\230A\230Q\330\010\017\210q\220\001\220\022\2207\230!\2306\240\021\240\"\240H\250D\260\001\260\037\300\001\330\010\014\210K\220t\2302\230Q\330\010\t\210\022\210=\230\001";
static const char __pyx_k_A_Qd_Qa_A_1_A_0_q_q_3e1A_22DA_at[] = "\200A\330\010\032\230#\230Q\230d\240!\330\010\032\230#\230Q\230a\330\010\032\320\032*\250\"\250A\330\010\032\230!\340\010\013\2101\340\014\022\220*\230A\330\0200\260\007\260q\330\024\027\220q\230\001\340\010\027\220{\240!\2403\240e\2501\250A\330\010\032\230(\320\"2\3202D\300A\330\010\023\320\023&\240a\240t\2506\260\026\260q\340\010\013\2104\210s\220!\330\014\022\220*\230A\330\0206\260g\270Q\270a";
static const char __pyx_k_A_T_1_aq_U_1A_1E_T_q_3a_5_axq_ha[] = "\200A\340\010\035\230T\240\021\340\010\013\2101\330\014\023\220;\230a\230q\330\014\020\220\005\220U\230!\2301\230A\330\020\023\2201\220E\230\021\230#\230T\240\021\240%\240q\250\003\2503\250a\330\024\033\230>\250\021\250!\2505\260\001\260\027\270\001\270\025\270a\270x\300q\330\010\016\210h\220a\220q";
static const char __pyx_k_A_d_4_auD_t1_AQ_3az_d_e1D_4q_1_a[] = "\200A\360\006\000\t\037\230d\240'\250\021\330\010\013\2104\210\230a\230u\240D\250\007\250t\2601\330\014\022\220*\230A\230Q\330\010 \240\003\2403\240a\240z\260\021\260$\260d\270$\270e\3001\300D\310\001\330\010\013\2104\210q\330\014\023\2201\330\010\017\320\017&\240a\240t\2509\260A";
static const char __pyx_k_A_d_E_as_AQ_S_1Kr_vU_fE_V4uAT_cQ[] = "\200A\330\010\036\230d\240'\250\021\360\010\000\t\r\210E\220\025\220a\220s\230\"\230A\230Q\330\014\025\220S\230\003\2301\230K\240r\250\021\330\014\017\210v\220U\230$\230f\240E\250\024\250V\2604\260u\270A\270T\300\027\310\002\310$\310c\320QR\330\020\027\220q\330\010\017\210q";
static const char __pyx_k_A_d_Qe1_A_vRr_F_S_1_j_3c_Qd_a_3e[] = "\200A\330\010\036\230d\240'\250\021\360\014\000\t\014\210:\220Q\220e\2301\330\014\024\220A\330\014\017\210v\220R\220r\230\023\230F\240#\240S\250\002\250!\2501\330\020\026\220j\240\001\240\021\330\014\023\2203\220c\230\021\230+\240Q\240d\250$\250a\340\014\020\220\013\2303\230e\2401\240A\330\014\022\220+\230Q\230a\330\014\017\210|\2301\230C\230u\240C\240v\250Q\250a\330\020\026\220h\230a\320\0373\2607\270!\2701\330\014\023\2201\340\010\026\220a\220u\230L\250\001";
static const char __pyx_k_A_d_Qe1_A_vRr_F_S_1_j_AT_S_Qa_Qa[] = "\200A\330\010\036\230d\240'\250\021\360\006\000\t\014\210:\220Q\220e\2301\330\014\024\220A\330\014\017\210v\220R\220r\230\023\230F\240#\240S\250\002\250!\2501\330\020\026\220j\240\001\240\021\330\014\023\320\023$\240A\240T\250\031\260!\340\010\032\230+\240S\250\005\250Q\250a\330\010\032\230+\240Q\240a\330\010\032\230,\240a\240s\250!\340\010\013\2102\210S\220\006\220a\220q\330\014\022\220(\230!\320\033/\250w\260a\260q\340\010\026\220l\240!\2403\240b\250\001\340\010\017\320\017 \240\001\240\024\240Y\250a";
static const char __pyx_k_A_d_WA_4s_Qa_1E_A_4_auL_waq_auCq[] = "\200A\340\010\036\230d\240'\250\027\260\001\330\010\031\230\024\230W\240A\360\006\000\t\014\2104\210s\220!\330\014\022\220!\340\010\032\230+\240Q\240a\330\010\r\210^\2301\230E\240\033\250A\340\010\013\2104\210\230a\230u\240L\260\001\330\014\022\220(\230!\320\033/\250w\260a\260q\340\010\026\220a\220u\230C\230q";
static const char __pyx_k_A_d_WA_A_Qc_b_AQ_E_aq_1ARuAQ_k_Q[] = "\200A\330\010\036\230d\240'\250\027\260\001\330\010\031\230\024\230W\240A\360\006\000\t\035\230A\340\010\013\210:\220Q\220c\230\035\240b\250\001\330\014\022\220*\230A\230Q\340\010\014\210E\220\025\220a\220q\230\001\330\014\023\2201\220A\220R\220u\230A\230Q\330\014\022\220.\240\001\240\025\240k\260\024\260Q\330\014\017\210u\220C\220u\230D\240\004\240F\250#\250U\260$\260f\270A\270U\300(\310#\310Q\330\020\031\230\021\340\010\017\210q";
static const char __pyx_k_A_d_WA_Qa_6_1_1_Qc_b_AQ_AU_Q_1_y[] = "\200A\330\010\036\230d\240'\250\027\260\001\330\010\031\230\024\230W\240A\340\010\032\230+\240Q\240a\330\010\013\2106\220\021\220&\230\010\240\003\2401\330\014\022\220(\230!\2301\340\010\013\210:\220Q\220c\230\035\240b\250\001\330\014\022\220*\230A\230Q\340\010 \240\014\250A\250U\260#\260Q\360\006\000\t\034\320\0331\260\021\260%\260y\300\004\300J\310d\320RS\340\010\013\2108\2202\220Q\330\014\022\220(\230!\320\0333\2607\270!\2701\340\010\013\2104\210\230a\230u\240M\260\021\330\014\022\220*\230A\230Q\360\006\000\t\014\210?\230!\2305\240\r\250Y\260c\270\034\300U\310$\310e\320SV\320VZ\320Z^\320^_\330\014\r\340\010\013\2104\210u\220C\220t\2304\230q\330\014\022\220(\230!\320\0333\2607\270!\2701\340\010\013\210?\230!\2305\240\003\2406\250\026\250s\260$\260g\270R\270q\330\014\022\220*\230A\230Q";
static const char __pyx_k_A_d_WA_Qc_b_AQ_E_aq_1ARuAQ_k_Q_u[] = "\200A\330\010\036\230d\240'\250\027\260\001\330\010\031\230\024\230W\240A\360\n\000\t\014\210:\220Q\220c\230\035\240b\250\001\330\014\022\220*\230A\230Q\340\010\014\210E\220\025\220a\220q\230\001\330\014\023\2201\220A\220R\220u\230A\230Q\330\014\022\220.\240\001\240\025\240k\260\024\260Q\330\014\017\210u\220C\220u\230D\240\004\240F\250#\250U\260$\260f\270A\270U\300(\310#\310Q\330\020\027\220q\340\010\017\210q";
static const char __pyx_k_A_d_WA_Qc_b_AQ_Qa_6_1_1_AU_Q_1_y[] = "\200A\330\010\036\230d\240'\250\027\260\001\330\010\031\230\024\230W\240A\340\010\013\210:\220Q\220c\230\035\240b\250\001\330\014\022\220*\230A\230Q\340\010\032\230+\240Q\240a\340\010\013\2106\220\021\220&\230\010\240\003\2401\330\014\022\220(\230!\2301\340\010 \240\014\250A\250U\260#\260Q\360\006\000\t\034\320\0331\260\021\260%\260y\300\004\300J\310d\320RS\340\010\013\2108\2202\220Q\330\014\022\220(\230!\320\0333\2607\270!\2701\340\010\013\2104\210\230a\230u\240M\260\021\330\014\022\220*\230A\230Q\360\006\000\t\014\210?\230!\2305\240\r\250Y\260c\270\021\330\014\023\2205\230\003\2305\240\004\240D\250\006\250c\260\021\340\010\013\2104\210u\220C\220t\2304\230q\330\014\022\220(\230!\320\0333\2607\270!\2701\340\010\017\320\017!\240\021\240$\240i\250q";
static const char __pyx_k_A_d_WA_Qc_b_AQ_Qa_6_1_1_AU_Q_uCu[] = "\200A\330\010\036\230d\240'\250\027\260\001\330\010\031\230\024\230W\240A\340\010\013\210:\220Q\220c\230\035\240b\250\001\330\014\022\220*\230A\230Q\340\010\032\230+\240Q\240a\340\010\013\2106\220\021\220&\230\010\240\003\2401\330\014\023\2201\340\010 \240\014\250A\250U\260#\260Q\340\010\017\210u\220C\220u\230D\240\004\240F\250#\250Q";
static const char __pyx_k_Cannot_add_extra_threads_when_ig[] = "Cannot add extra threads when \"ignore_truncation\" is True";
static const char __pyx_k_Cannot_copy_arrays_with_src_valu[] = "Cannot copy arrays with src_values={} > dst_values={}";
static const char __pyx_k_Cannot_set_phased_before_genotyp[] = "Cannot set phased before genotype is set";
static const char __pyx_k_Cannot_specify_an_index_filename[] = "Cannot specify an index filename when writing a VCF/BCF file";
static const char __pyx_k_Cannot_translate_record_Number_o[] = "Cannot translate record.  Number of samples does not match header ({} vs {})";
static const char __pyx_k_Could_not_allocate_VCF_header_re[] = "Could not allocate VCF header record";
static const char __pyx_k_END_is_a_reserved_attribute_acce[] = "END is a reserved attribute; access is via record.stop";
static const char __pyx_k_Flag_types_are_not_allowed_on_FO[] = "Flag types are not allowed on FORMATs";
static const char __pyx_k_Flag_values_must_be_True_False_N[] = "Flag values must be: True, False, None, 1, 0";
static const char __pyx_k_Header_already_exists_for_contig[] = "Header already exists for contig {}";
static const char __pyx_k_Incompatible_checksums_0x_x_vs_0[] = "Incompatible checksums (0x%x vs (0x1e0584a, 0x594fd16, 0x099fb99) = (header))";
static const char __pyx_k_Integer_value_too_small_large_to[] = "Integer value too small/large to store in VCF/BCF";
static const char __pyx_k_Note_that_Cython_is_deliberately[] = "Note 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.";
static const char __pyx_k_One_or_more_of_the_supplied_samp[] = "One or more of the supplied sample alleles are not defined as alleles of the corresponding pysam.libcbcf.VariantRecord.First set the .alleles of this record to define the alleles";
static const char __pyx_k_Start_coordinate_must_be_non_neg[] = "Start coordinate must be non-negative";
static const char __pyx_k_Stop_coordinate_must_be_non_nega[] = "Stop coordinate must be non-negative";
static const char __pyx_k_Use_allele_indices_to_set_intege[] = "Use .allele_indices to set integer allele indices";
static const char __pyx_k_VariantHeaderContigs___reduce_cy[] = "VariantHeaderContigs.__reduce_cython__";
static const char __pyx_k_VariantHeaderContigs_clear_heade[] = "VariantHeaderContigs.clear_header";
static const char __pyx_k_VariantHeaderContigs_remove_head[] = "VariantHeaderContigs.remove_header";
static const char __pyx_k_VariantHeaderMetadata___reduce_c[] = "VariantHeaderMetadata.__reduce_cython__";
static const char __pyx_k_VariantHeaderMetadata___setstate[] = "VariantHeaderMetadata.__setstate_cython__";
static const char __pyx_k_VariantHeaderMetadata_clear_head[] = "VariantHeaderMetadata.clear_header";
static const char __pyx_k_VariantHeaderMetadata_itervalues[] = "VariantHeaderMetadata.itervalues";
static const char __pyx_k_VariantHeaderMetadata_remove_hea[] = "VariantHeaderMetadata.remove_header";
static const char __pyx_k_VariantHeaderRecord___get___loca[] = "VariantHeaderRecord.__get__.<locals>.genexpr";
static const char __pyx_k_VariantHeaderRecord___reduce_cyt[] = "VariantHeaderRecord.__reduce_cython__";
static const char __pyx_k_VariantHeaderRecord___setstate_c[] = "VariantHeaderRecord.__setstate_cython__";
static const char __pyx_k_VariantHeaderRecords___reduce_cy[] = "VariantHeaderRecords.__reduce_cython__";
static const char __pyx_k_VariantHeaderSamples___reduce_cy[] = "VariantHeaderSamples.__reduce_cython__";
static const char __pyx_k_VariantMetadata___setstate_cytho[] = "VariantMetadata.__setstate_cython__";
static const char __pyx_k_VariantRecordFilter___reduce_cyt[] = "VariantRecordFilter.__reduce_cython__";
static const char __pyx_k_VariantRecordFilter___setstate_c[] = "VariantRecordFilter.__setstate_cython__";
static const char __pyx_k_VariantRecordFormat___reduce_cyt[] = "VariantRecordFormat.__reduce_cython__";
static const char __pyx_k_VariantRecordFormat___setstate_c[] = "VariantRecordFormat.__setstate_cython__";
static const char __pyx_k_VariantRecordInfo___reduce_cytho[] = "VariantRecordInfo.__reduce_cython__";
static const char __pyx_k_VariantRecordInfo___setstate_cyt[] = "VariantRecordInfo.__setstate_cython__";
static const char __pyx_k_VariantRecordSample___reduce_cyt[] = "VariantRecordSample.__reduce_cython__";
static const char __pyx_k_VariantRecordSample___set___loca[] = "VariantRecordSample.__set__.<locals>.genexpr";
static const char __pyx_k_VariantRecordSample___setstate_c[] = "VariantRecordSample.__setstate_cython__";
static const char __pyx_k_VariantRecordSamples___reduce_cy[] = "VariantRecordSamples.__reduce_cython__";
static const char __pyx_k_bcf_array_to_object_locals_genex[] = "bcf_array_to_object.<locals>.genexpr";
static const char __pyx_k_bcf_object_to_array_locals_genex[] = "bcf_object_to_array.<locals>.genexpr";
static const char __pyx_k_cannot_convert_deleted_record_to[] = "cannot convert deleted record to str";
static const char __pyx_k_cannot_create_VariantRecordSampl[] = "cannot create VariantRecordSample";
static const char __pyx_k_cannot_fetch_from_Variantfile_op[] = "cannot fetch from Variantfile opened for writing";
static const char __pyx_k_cannot_subset_samples_after_fetc[] = "cannot subset samples after fetching records";
static const char __pyx_k_cannot_subset_samples_from_Varia[] = "cannot subset samples from Variantfile opened for writing";
static const char __pyx_k_cannot_write_to_a_Variantfile_op[] = "cannot write to a Variantfile opened for reading";
static const char __pyx_k_char_array_to_tuple_locals_genex[] = "char_array_to_tuple.<locals>.genexpr";
static const char __pyx_k_either_value_or_items_must_be_sp[] = "either value or items must be specified";
static const char __pyx_k_genotype_is_only_valid_as_a_form[] = "genotype is only valid as a format field";
static const char __pyx_k_invalid_value_for_Integer_format[] = "invalid value for Integer format";
static const char __pyx_k_mode_contains_conflicting_format[] = "mode contains conflicting format specifiers: {}";
static const char __pyx_k_no_default___reduce___due_to_non[] = "no default __reduce__ due to non-trivial __cinit__";
static const char __pyx_k_pyx_unpickle_VariantHeaderCont_2[] = "__pyx_unpickle_VariantHeaderContigs__set_state";
static const char __pyx_k_pyx_unpickle_VariantHeaderMeta_2[] = "__pyx_unpickle_VariantHeaderMetadata__set_state";
static const char __pyx_k_pyx_unpickle_VariantHeaderReco_2[] = "__pyx_unpickle_VariantHeaderRecords__set_state";
static const char __pyx_k_pyx_unpickle_VariantHeaderSamp_2[] = "__pyx_unpickle_VariantHeaderSamples__set_state";
static const char __pyx_k_pyx_unpickle_VariantRecordFilt_2[] = "__pyx_unpickle_VariantRecordFilter__set_state";
static const char __pyx_k_pyx_unpickle_VariantRecordForm_2[] = "__pyx_unpickle_VariantRecordFormat__set_state";
static const char __pyx_k_pyx_unpickle_VariantRecordInfo_2[] = "__pyx_unpickle_VariantRecordInfo__set_state";
static const char __pyx_k_pyx_unpickle_VariantRecordSamp_2[] = "__pyx_unpickle_VariantRecordSample";
static const char __pyx_k_pyx_unpickle_VariantRecordSamp_3[] = "__pyx_unpickle_VariantRecordSamples__set_state";
static const char __pyx_k_pyx_unpickle_VariantRecordSamp_4[] = "__pyx_unpickle_VariantRecordSample__set_state";
static const char __pyx_k_self_iter_cannot_be_converted_to[] = "self.iter cannot be converted to a Python object for pickling";
static const char __pyx_k_this_class_cannot_be_instantiate[] = "this class cannot be instantiated from Python";
static const char __pyx_k_unable_to_reallocate_VariantHead[] = "unable to reallocate VariantHeader";
static const char __pyx_k_value_expected_to_be_scalar_give[] = "value expected to be scalar, given len={}";
static const char __pyx_k_values_expected_to_be_tuple_give[] = "values expected to be {}-tuple, given len={}";
static const char __pyx_k_A_d_S_Qa_Qa_as_2S_as_RuAT_c_G1A_2[] = "\200A\330\010\036\230d\240'\250\021\330\010\032\230+\240S\250\005\250Q\250a\340\010\032\230+\240Q\240a\330\010\032\230,\240a\240s\250!\340\010\013\2102\210S\220\006\220a\220s\230#\230\\\250\021\250#\250R\250u\260A\260T\270\027\300\002\300$\300c\310\021\330\014\022\220(\230!\320\033,\250G\2601\260A\340\010\026\220a\220u\230D\240\007\240q";
static const char __pyx_k_A_d_WA_Qb_Qe1_A_vRr_F_Q_j_D_t3a_2[] = "\200A\330\010\036\230d\240'\250\027\260\001\330\010\031\230\024\230W\240A\340\010\025\220Q\220b\230\001\340\010\013\210:\220Q\220e\2301\330\014\024\220A\340\014\017\210v\220R\220r\230\023\230F\240#\240Q\330\020\026\220j\240\001\240\021\340\014\021\220\021\220\"\220D\230\001\230\021\340\014\017\210t\2203\220a\330\020\026\220a\340\014\023\220;\230a\230q\330\014\021\220\036\230q\240\005\240[\260\001\340\014\017\210t\220?\240!\2405\250\014\260D\270\003\2704\270~\310Q\310e\320SV\320VW\330\020\026\220h\230a\320\0373\2607\270!\2701\340\010\031\230\021\230%\230s\240$\240a";
static const char __pyx_k_A_d_WA_T_A_Qe1_1_aq_a_Ba_ha_8_q_2[] = "\200A\330\010\036\230d\240'\250\027\260\001\330\010\031\230\024\230W\240A\330\010\025\220T\230\027\240\004\240A\360\n\000\t\014\210:\220Q\220e\2301\330\014\033\2301\340\014\023\220;\230a\230q\330\014\033\230>\250\021\250%\250\270a\330\014\017\210}\230B\230a\330\020\026\220h\230a\320\0378\270\007\270q\300\001\340\010\017\210r\220\023\220O\2401";
static const char __pyx_k_wc_j_wa_V7_Qa_z_1_j_vWBb_6_2S_A_2[] = "\200\001\330\004\007\200w\210c\220\021\330\010\016\210j\230\001\230\021\340\004\032\230&\240\007\240w\250a\330\004\025\220V\2307\240!\330\004\025\220Q\220a\340\004\007\200z\220\021\220#\220\\\240\022\2401\330\010\016\210j\230\001\230\021\340\004\007\200v\210W\220B\220b\230\003\2306\240\027\250\003\2502\250S\260\004\260A\260Q\330\010\t\340\004\033\2301\230B\230a\330\004\023\2209\230A\230U\240$\240a\340\004\007\200t\2104\210s\220$\220d\230!\330\010\016\210j\230\001\230\021\360\014\000\005\010\200t\2106\220\023\220A\330\010\020\220\013\2304\230s\240\"\240F\250'\260\022\2604\260q\330\010\014\210E\220\025\220a\220t\2301\330\014\017\210u\220A\220S\230\003\2301\330\020\021\330\021\026\220a\220s\230#\230Q\330\020\021\330\021\022\330\020\025\220Q\220f\230E\240\021\240#\240R\240v\250R\250q\330\t\r\210V\2203\220a\330\010\021\220\034\230T\240\023\240B\240f\250G\2602\260T\270\021\330\010\014\210E\220\025\220a\220t\2301\330\014\017\210v\220Q\220c\230\023\230A\330\020\021\330\021\027\220q\230\003\2303\230a\330\020\021\330\021\022\330\020\026\220a\220v\230V\2401\240C\240r\250\030\260\022\2601\330\t\r\210V\2203\220a\330\010\021\220\034\230T\240\023\240B\240f\250G\2602\260T\270\021\330\010\014\210E\220\025\220a\220t\2301\330\014\017\210v\220Q\220c\230\023\230A\330\020\021\330\021\027\220q\230\003\2303\230a\330\020\021\330\021\022\330\020\026\220a\220v\230V\2401\240C\240r\250\034\260R\260q";
static const char __pyx_k_wc_j_wa_V7_z_1_j_k_Qe3a_t4s_c_h_2[] = "\200\001\330\004\007\200w\210c\220\021\330\010\016\210j\230\001\230\021\340\004\032\230&\240\007\240w\250a\330\004\025\220V\2307\240!\360\010\000\005\010\200z\220\021\220#\220\\\240\022\2401\330\010\016\210j\230\001\230\021\340\004\026\220k\240\021\240!\330\004\032\230+\240Q\240e\2503\250a\340\004\007\200t\2104\210s\220$\220c\230\021\330\010\016\210h\220a\220q\340\004\027\220q\230\006\230i\240|\2603\260e\2701\270M\310\021\310(\320RX\320XY\340\004\007\200|\2203\220a\330\010\025\220Q\330\t\n\330\010\025\220Q\340\010\026\220f\230A\230Q\340\004\030\230\001\230\030\240\026\240q";
static const char __pyx_k_Incompatible_checksums_0x_x_vs_0_2[] = "Incompatible checksums (0x%x vs (0xcd1335f, 0xa03cdd6, 0x9d0a56c) = (header, id, type))";
static const char __pyx_k_Incompatible_checksums_0x_x_vs_0_3[] = "Incompatible checksums (0x%x vs (0x816ca43, 0x0a33d30, 0xed5e66b) = (header, type))";
static const char __pyx_k_Incompatible_checksums_0x_x_vs_0_4[] = "Incompatible checksums (0x%x vs (0x2572060, 0x8ae1160, 0xbe66ecb) = (header, id))";
static const char __pyx_k_Incompatible_checksums_0x_x_vs_0_5[] = "Incompatible checksums (0x%x vs (0x70ce871, 0x275a700, 0xde17f0f) = (record))";
static const char __pyx_k_Incompatible_checksums_0x_x_vs_0_6[] = "Incompatible checksums (0x%x vs (0xeeb89f3, 0x59cf0f7, 0x5d6ff7b) = (index, record))";
static const char __pyx_k_Incompatible_checksums_0x_x_vs_0_7[] = "Incompatible checksums (0x%x vs (0x7898a51, 0x1fe4488, 0xd936de3) = (refmap, refs))";
/* #### Code section: decls ### */
static int __pyx_pf_7cpython_5array_5array___getbuffer__(arrayobject *__pyx_v_self, Py_buffer *__pyx_v_info, CYTHON_UNUSED int __pyx_v_flags); /* proto */
static void __pyx_pf_7cpython_5array_5array_2__releasebuffer__(CYTHON_UNUSED arrayobject *__pyx_v_self, Py_buffer *__pyx_v_info); /* proto */
static PyObject *__pyx_pf_5pysam_7libcbcf_19char_array_to_tuple_genexpr(PyObject *__pyx_self, Py_ssize_t __pyx_genexpr_arg_0); /* proto */
static PyObject *__pyx_pf_5pysam_7libcbcf_19bcf_array_to_object_genexpr(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_genexpr_arg_0); /* proto */
static PyObject *__pyx_pf_5pysam_7libcbcf_19bcf_object_to_array_genexpr(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_genexpr_arg_0); /* proto */
static PyObject *__pyx_pf_5pysam_7libcbcf_16bcf_check_values_genexpr(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_genexpr_arg_0); /* proto */
static int __pyx_pf_5pysam_7libcbcf_19VariantHeaderRecord___init__(CYTHON_UNUSED struct __pyx_obj_5pysam_7libcbcf_VariantHeaderRecord *__pyx_v_self, CYTHON_UNUSED PyObject *__pyx_v_args, CYTHON_UNUSED PyObject *__pyx_v_kwargs); /* proto */
static PyObject *__pyx_pf_5pysam_7libcbcf_19VariantHeaderRecord_4type___get__(struct __pyx_obj_5pysam_7libcbcf_VariantHeaderRecord *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_5pysam_7libcbcf_19VariantHeaderRecord_3key___get__(struct __pyx_obj_5pysam_7libcbcf_VariantHeaderRecord *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_5pysam_7libcbcf_19VariantHeaderRecord_5value___get__(struct __pyx_obj_5pysam_7libcbcf_VariantHeaderRecord *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_5pysam_7libcbcf_19VariantHeaderRecord_5attrs_7__get___genexpr(PyObject *__pyx_self, int __pyx_genexpr_arg_0); /* proto */
static PyObject *__pyx_pf_5pysam_7libcbcf_19VariantHeaderRecord_5attrs___get__(struct __pyx_obj_5pysam_7libcbcf_VariantHeaderRecord *__pyx_v_self); /* proto */
static Py_ssize_t __pyx_pf_5pysam_7libcbcf_19VariantHeaderRecord_2__len__(struct __pyx_obj_5pysam_7libcbcf_VariantHeaderRecord *__pyx_v_self); /* proto */
static int __pyx_pf_5pysam_7libcbcf_19VariantHeaderRecord_4__bool__(struct __pyx_obj_5pysam_7libcbcf_VariantHeaderRecord *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_5pysam_7libcbcf_19VariantHeaderRecord_6__getitem__(struct __pyx_obj_5pysam_7libcbcf_VariantHeaderRecord *__pyx_v_self, PyObject *__pyx_v_key); /* proto */
static PyObject *__pyx_pf_5pysam_7libcbcf_19VariantHeaderRecord_8__iter__(struct __pyx_obj_5pysam_7libcbcf_VariantHeaderRecord *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_5pysam_7libcbcf_19VariantHeaderRecord_11get(struct __pyx_obj_5pysam_7libcbcf_VariantHeaderRecord *__pyx_v_self, PyObject *__pyx_v_key, PyObject *__pyx_v_default); /* proto */
static int __pyx_pf_5pysam_7libcbcf_19VariantHeaderRecord_13__contains__(struct __pyx_obj_5pysam_7libcbcf_VariantHeaderRecord *__pyx_v_self, PyObject *__pyx_v_key); /* proto */
static PyObject *__pyx_pf_5pysam_7libcbcf_19VariantHeaderRecord_15iterkeys(struct __pyx_obj_5pysam_7libcbcf_VariantHeaderRecord *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_5pysam_7libcbcf_19VariantHeaderRecord_17itervalues(struct __pyx_obj_5pysam_7libcbcf_VariantHeaderRecord *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_5pysam_7libcbcf_19VariantHeaderRecord_20iteritems(struct __pyx_obj_5pysam_7libcbcf_VariantHeaderRecord *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_5pysam_7libcbcf_19VariantHeaderRecord_23keys(struct __pyx_obj_5pysam_7libcbcf_VariantHeaderRecord *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_5pysam_7libcbcf_19VariantHeaderRecord_25items(struct __pyx_obj_5pysam_7libcbcf_VariantHeaderRecord *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_5pysam_7libcbcf_19VariantHeaderRecord_27values(struct __pyx_obj_5pysam_7libcbcf_VariantHeaderRecord *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_5pysam_7libcbcf_19VariantHeaderRecord_29update(struct __pyx_obj_5pysam_7libcbcf_VariantHeaderRecord *__pyx_v_self, PyObject *__pyx_v_items, PyObject *__pyx_v_kwargs); /* proto */
static PyObject *__pyx_pf_5pysam_7libcbcf_19VariantHeaderRecord_31pop(struct __pyx_obj_5pysam_7libcbcf_VariantHeaderRecord *__pyx_v_self, PyObject *__pyx_v_key, PyObject *__pyx_v_default); /* proto */
static PyObject *__pyx_pf_5pysam_7libcbcf_19VariantHeaderRecord_33__str__(struct __pyx_obj_5pysam_7libcbcf_VariantHeaderRecord *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_5pysam_7libcbcf_19VariantHeaderRecord_35remove(struct __pyx_obj_5pysam_7libcbcf_VariantHeaderRecord *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_5pysam_7libcbcf_19VariantHeaderRecord_6header___get__(struct __pyx_obj_5pysam_7libcbcf_VariantHeaderRecord *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_5pysam_7libcbcf_19VariantHeaderRecord_37__reduce_cython__(CYTHON_UNUSED struct __pyx_obj_5pysam_7libcbcf_VariantHeaderRecord *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_5pysam_7libcbcf_19VariantHeaderRecord_39__setstate_cython__(CYTHON_UNUSED struct __pyx_obj_5pysam_7libcbcf_VariantHeaderRecord *__pyx_v_self, CYTHON_UNUSED PyObject *__pyx_v___pyx_state); /* proto */
static int __pyx_pf_5pysam_7libcbcf_20VariantHeaderRecords___init__(CYTHON_UNUSED struct __pyx_obj_5pysam_7libcbcf_VariantHeaderRecords *__pyx_v_self, CYTHON_UNUSED PyObject *__pyx_v_args, CYTHON_UNUSED PyObject *__pyx_v_kwargs); /* proto */
static Py_ssize_t __pyx_pf_5pysam_7libcbcf_20VariantHeaderRecords_2__len__(struct __pyx_obj_5pysam_7libcbcf_VariantHeaderRecords *__pyx_v_self); /* proto */
static int __pyx_pf_5pysam_7libcbcf_20VariantHeaderRecords_4__bool__(struct __pyx_obj_5pysam_7libcbcf_VariantHeaderRecords *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_5pysam_7libcbcf_20VariantHeaderRecords_6__getitem__(struct __pyx_obj_5pysam_7libcbcf_VariantHeaderRecords *__pyx_v_self, PyObject *__pyx_v_index); /* proto */
static PyObject *__pyx_pf_5pysam_7libcbcf_20VariantHeaderRecords_8__iter__(struct __pyx_obj_5pysam_7libcbcf_VariantHeaderRecords *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_5pysam_7libcbcf_20VariantHeaderRecords_6header___get__(struct __pyx_obj_5pysam_7libcbcf_VariantHeaderRecords *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_5pysam_7libcbcf_20VariantHeaderRecords_11__reduce_cython__(struct __pyx_obj_5pysam_7libcbcf_VariantHeaderRecords *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_5pysam_7libcbcf_20VariantHeaderRecords_13__setstate_cython__(struct __pyx_obj_5pysam_7libcbcf_VariantHeaderRecords *__pyx_v_self, PyObject *__pyx_v___pyx_state); /* proto */
static int __pyx_pf_5pysam_7libcbcf_15VariantMetadata___init__(CYTHON_UNUSED struct __pyx_obj_5pysam_7libcbcf_VariantMetadata *__pyx_v_self, CYTHON_UNUSED PyObject *__pyx_v_args, CYTHON_UNUSED PyObject *__pyx_v_kwargs); /* proto */
static PyObject *__pyx_pf_5pysam_7libcbcf_15VariantMetadata_4name___get__(struct __pyx_obj_5pysam_7libcbcf_VariantMetadata *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_5pysam_7libcbcf_15VariantMetadata_2id___get__(struct __pyx_obj_5pysam_7libcbcf_VariantMetadata *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_5pysam_7libcbcf_15VariantMetadata_6number___get__(struct __pyx_obj_5pysam_7libcbcf_VariantMetadata *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_5pysam_7libcbcf_15VariantMetadata_4type___get__(struct __pyx_obj_5pysam_7libcbcf_VariantMetadata *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_5pysam_7libcbcf_15VariantMetadata_11description___get__(struct __pyx_obj_5pysam_7libcbcf_VariantMetadata *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_5pysam_7libcbcf_15VariantMetadata_6record___get__(struct __pyx_obj_5pysam_7libcbcf_VariantMetadata *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_5pysam_7libcbcf_15VariantMetadata_2remove_header(struct __pyx_obj_5pysam_7libcbcf_VariantMetadata *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_5pysam_7libcbcf_15VariantMetadata_6header___get__(struct __pyx_obj_5pysam_7libcbcf_VariantMetadata *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_5pysam_7libcbcf_15VariantMetadata_4__reduce_cython__(struct __pyx_obj_5pysam_7libcbcf_VariantMetadata *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_5pysam_7libcbcf_15VariantMetadata_6__setstate_cython__(struct __pyx_obj_5pysam_7libcbcf_VariantMetadata *__pyx_v_self, PyObject *__pyx_v___pyx_state); /* proto */
static int __pyx_pf_5pysam_7libcbcf_21VariantHeaderMetadata___init__(CYTHON_UNUSED struct __pyx_obj_5pysam_7libcbcf_VariantHeaderMetadata *__pyx_v_self, CYTHON_UNUSED PyObject *__pyx_v_args, CYTHON_UNUSED PyObject *__pyx_v_kwargs); /* proto */
static PyObject *__pyx_pf_5pysam_7libcbcf_21VariantHeaderMetadata_2add(struct __pyx_obj_5pysam_7libcbcf_VariantHeaderMetadata *__pyx_v_self, PyObject *__pyx_v_id, PyObject *__pyx_v_number, PyObject *__pyx_v_type, PyObject *__pyx_v_description, PyObject *__pyx_v_kwargs); /* proto */
static Py_ssize_t __pyx_pf_5pysam_7libcbcf_21VariantHeaderMetadata_4__len__(struct __pyx_obj_5pysam_7libcbcf_VariantHeaderMetadata *__pyx_v_self); /* proto */
static int __pyx_pf_5pysam_7libcbcf_21VariantHeaderMetadata_6__bool__(struct __pyx_obj_5pysam_7libcbcf_VariantHeaderMetadata *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_5pysam_7libcbcf_21VariantHeaderMetadata_8__getitem__(struct __pyx_obj_5pysam_7libcbcf_VariantHeaderMetadata *__pyx_v_self, PyObject *__pyx_v_key); /* proto */
static PyObject *__pyx_pf_5pysam_7libcbcf_21VariantHeaderMetadata_10remove_header(struct __pyx_obj_5pysam_7libcbcf_VariantHeaderMetadata *__pyx_v_self, PyObject *__pyx_v_key); /* proto */
static PyObject *__pyx_pf_5pysam_7libcbcf_21VariantHeaderMetadata_12clear_header(struct __pyx_obj_5pysam_7libcbcf_VariantHeaderMetadata *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_5pysam_7libcbcf_21VariantHeaderMetadata_14__iter__(struct __pyx_obj_5pysam_7libcbcf_VariantHeaderMetadata *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_5pysam_7libcbcf_21VariantHeaderMetadata_17get(struct __pyx_obj_5pysam_7libcbcf_VariantHeaderMetadata *__pyx_v_self, PyObject *__pyx_v_key, PyObject *__pyx_v_default); /* proto */
static int __pyx_pf_5pysam_7libcbcf_21VariantHeaderMetadata_19__contains__(struct __pyx_obj_5pysam_7libcbcf_VariantHeaderMetadata *__pyx_v_self, PyObject *__pyx_v_key); /* proto */
static PyObject *__pyx_pf_5pysam_7libcbcf_21VariantHeaderMetadata_21iterkeys(struct __pyx_obj_5pysam_7libcbcf_VariantHeaderMetadata *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_5pysam_7libcbcf_21VariantHeaderMetadata_23itervalues(struct __pyx_obj_5pysam_7libcbcf_VariantHeaderMetadata *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_5pysam_7libcbcf_21VariantHeaderMetadata_26iteritems(struct __pyx_obj_5pysam_7libcbcf_VariantHeaderMetadata *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_5pysam_7libcbcf_21VariantHeaderMetadata_29keys(struct __pyx_obj_5pysam_7libcbcf_VariantHeaderMetadata *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_5pysam_7libcbcf_21VariantHeaderMetadata_31items(struct __pyx_obj_5pysam_7libcbcf_VariantHeaderMetadata *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_5pysam_7libcbcf_21VariantHeaderMetadata_33values(struct __pyx_obj_5pysam_7libcbcf_VariantHeaderMetadata *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_5pysam_7libcbcf_21VariantHeaderMetadata_6header___get__(struct __pyx_obj_5pysam_7libcbcf_VariantHeaderMetadata *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_5pysam_7libcbcf_21VariantHeaderMetadata_35__reduce_cython__(struct __pyx_obj_5pysam_7libcbcf_VariantHeaderMetadata *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_5pysam_7libcbcf_21VariantHeaderMetadata_37__setstate_cython__(struct __pyx_obj_5pysam_7libcbcf_VariantHeaderMetadata *__pyx_v_self, PyObject *__pyx_v___pyx_state); /* proto */
static int __pyx_pf_5pysam_7libcbcf_13VariantContig___init__(CYTHON_UNUSED struct __pyx_obj_5pysam_7libcbcf_VariantContig *__pyx_v_self, CYTHON_UNUSED PyObject *__pyx_v_args, CYTHON_UNUSED PyObject *__pyx_v_kwargs); /* proto */
static PyObject *__pyx_pf_5pysam_7libcbcf_13VariantContig_4name___get__(struct __pyx_obj_5pysam_7libcbcf_VariantContig *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_5pysam_7libcbcf_13VariantContig_2id___get__(struct __pyx_obj_5pysam_7libcbcf_VariantContig *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_5pysam_7libcbcf_13VariantContig_6length___get__(struct __pyx_obj_5pysam_7libcbcf_VariantContig *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_5pysam_7libcbcf_13VariantContig_13header_record___get__(struct __pyx_obj_5pysam_7libcbcf_VariantContig *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_5pysam_7libcbcf_13VariantContig_2remove_header(struct __pyx_obj_5pysam_7libcbcf_VariantContig *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_5pysam_7libcbcf_13VariantContig_6header___get__(struct __pyx_obj_5pysam_7libcbcf_VariantContig *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_5pysam_7libcbcf_13VariantContig_4__reduce_cython__(struct __pyx_obj_5pysam_7libcbcf_VariantContig *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_5pysam_7libcbcf_13VariantContig_6__setstate_cython__(struct __pyx_obj_5pysam_7libcbcf_VariantContig *__pyx_v_self, PyObject *__pyx_v___pyx_state); /* proto */
static int __pyx_pf_5pysam_7libcbcf_20VariantHeaderContigs___init__(CYTHON_UNUSED struct __pyx_obj_5pysam_7libcbcf_VariantHeaderContigs *__pyx_v_self, CYTHON_UNUSED PyObject *__pyx_v_args, CYTHON_UNUSED PyObject *__pyx_v_kwargs); /* proto */
static Py_ssize_t __pyx_pf_5pysam_7libcbcf_20VariantHeaderContigs_2__len__(struct __pyx_obj_5pysam_7libcbcf_VariantHeaderContigs *__pyx_v_self); /* proto */
static int __pyx_pf_5pysam_7libcbcf_20VariantHeaderContigs_4__bool__(struct __pyx_obj_5pysam_7libcbcf_VariantHeaderContigs *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_5pysam_7libcbcf_20VariantHeaderContigs_6__getitem__(struct __pyx_obj_5pysam_7libcbcf_VariantHeaderContigs *__pyx_v_self, PyObject *__pyx_v_key); /* proto */
static PyObject *__pyx_pf_5pysam_7libcbcf_20VariantHeaderContigs_8remove_header(struct __pyx_obj_5pysam_7libcbcf_VariantHeaderContigs *__pyx_v_self, PyObject *__pyx_v_key); /* proto */
static PyObject *__pyx_pf_5pysam_7libcbcf_20VariantHeaderContigs_10clear_header(struct __pyx_obj_5pysam_7libcbcf_VariantHeaderContigs *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_5pysam_7libcbcf_20VariantHeaderContigs_12__iter__(struct __pyx_obj_5pysam_7libcbcf_VariantHeaderContigs *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_5pysam_7libcbcf_20VariantHeaderContigs_15get(struct __pyx_obj_5pysam_7libcbcf_VariantHeaderContigs *__pyx_v_self, PyObject *__pyx_v_key, PyObject *__pyx_v_default); /* proto */
static int __pyx_pf_5pysam_7libcbcf_20VariantHeaderContigs_17__contains__(struct __pyx_obj_5pysam_7libcbcf_VariantHeaderContigs *__pyx_v_self, PyObject *__pyx_v_key); /* proto */
static PyObject *__pyx_pf_5pysam_7libcbcf_20VariantHeaderContigs_19iterkeys(struct __pyx_obj_5pysam_7libcbcf_VariantHeaderContigs *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_5pysam_7libcbcf_20VariantHeaderContigs_21itervalues(struct __pyx_obj_5pysam_7libcbcf_VariantHeaderContigs *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_5pysam_7libcbcf_20VariantHeaderContigs_24iteritems(struct __pyx_obj_5pysam_7libcbcf_VariantHeaderContigs *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_5pysam_7libcbcf_20VariantHeaderContigs_27keys(struct __pyx_obj_5pysam_7libcbcf_VariantHeaderContigs *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_5pysam_7libcbcf_20VariantHeaderContigs_29items(struct __pyx_obj_5pysam_7libcbcf_VariantHeaderContigs *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_5pysam_7libcbcf_20VariantHeaderContigs_31values(struct __pyx_obj_5pysam_7libcbcf_VariantHeaderContigs *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_5pysam_7libcbcf_20VariantHeaderContigs_33add(struct __pyx_obj_5pysam_7libcbcf_VariantHeaderContigs *__pyx_v_self, PyObject *__pyx_v_id, PyObject *__pyx_v_length, PyObject *__pyx_v_kwargs); /* proto */
static PyObject *__pyx_pf_5pysam_7libcbcf_20VariantHeaderContigs_6header___get__(struct __pyx_obj_5pysam_7libcbcf_VariantHeaderContigs *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_5pysam_7libcbcf_20VariantHeaderContigs_35__reduce_cython__(struct __pyx_obj_5pysam_7libcbcf_VariantHeaderContigs *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_5pysam_7libcbcf_20VariantHeaderContigs_37__setstate_cython__(struct __pyx_obj_5pysam_7libcbcf_VariantHeaderContigs *__pyx_v_self, PyObject *__pyx_v___pyx_state); /* proto */
static int __pyx_pf_5pysam_7libcbcf_20VariantHeaderSamples___init__(CYTHON_UNUSED struct __pyx_obj_5pysam_7libcbcf_VariantHeaderSamples *__pyx_v_self, CYTHON_UNUSED PyObject *__pyx_v_args, CYTHON_UNUSED PyObject *__pyx_v_kwargs); /* proto */
static Py_ssize_t __pyx_pf_5pysam_7libcbcf_20VariantHeaderSamples_2__len__(struct __pyx_obj_5pysam_7libcbcf_VariantHeaderSamples *__pyx_v_self); /* proto */
static int __pyx_pf_5pysam_7libcbcf_20VariantHeaderSamples_4__bool__(struct __pyx_obj_5pysam_7libcbcf_VariantHeaderSamples *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_5pysam_7libcbcf_20VariantHeaderSamples_6__getitem__(struct __pyx_obj_5pysam_7libcbcf_VariantHeaderSamples *__pyx_v_self, PyObject *__pyx_v_index); /* proto */
static PyObject *__pyx_pf_5pysam_7libcbcf_20VariantHeaderSamples_8__iter__(struct __pyx_obj_5pysam_7libcbcf_VariantHeaderSamples *__pyx_v_self); /* proto */
static int __pyx_pf_5pysam_7libcbcf_20VariantHeaderSamples_11__contains__(struct __pyx_obj_5pysam_7libcbcf_VariantHeaderSamples *__pyx_v_self, PyObject *__pyx_v_key); /* proto */
static PyObject *__pyx_pf_5pysam_7libcbcf_20VariantHeaderSamples_13add(struct __pyx_obj_5pysam_7libcbcf_VariantHeaderSamples *__pyx_v_self, PyObject *__pyx_v_name); /* proto */
static PyObject *__pyx_pf_5pysam_7libcbcf_20VariantHeaderSamples_6header___get__(struct __pyx_obj_5pysam_7libcbcf_VariantHeaderSamples *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_5pysam_7libcbcf_20VariantHeaderSamples_15__reduce_cython__(struct __pyx_obj_5pysam_7libcbcf_VariantHeaderSamples *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_5pysam_7libcbcf_20VariantHeaderSamples_17__setstate_cython__(struct __pyx_obj_5pysam_7libcbcf_VariantHeaderSamples *__pyx_v_self, PyObject *__pyx_v___pyx_state); /* proto */
static int __pyx_pf_5pysam_7libcbcf_13VariantHeader___cinit__(struct __pyx_obj_5pysam_7libcbcf_VariantHeader *__pyx_v_self); /* proto */
static int __pyx_pf_5pysam_7libcbcf_13VariantHeader_2__init__(struct __pyx_obj_5pysam_7libcbcf_VariantHeader *__pyx_v_self); /* proto */
static void __pyx_pf_5pysam_7libcbcf_13VariantHeader_4__dealloc__(struct __pyx_obj_5pysam_7libcbcf_VariantHeader *__pyx_v_self); /* proto */
static int __pyx_pf_5pysam_7libcbcf_13VariantHeader_6__bool__(struct __pyx_obj_5pysam_7libcbcf_VariantHeader *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_5pysam_7libcbcf_13VariantHeader_8copy(struct __pyx_obj_5pysam_7libcbcf_VariantHeader *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_5pysam_7libcbcf_13VariantHeader_10merge(struct __pyx_obj_5pysam_7libcbcf_VariantHeader *__pyx_v_self, struct __pyx_obj_5pysam_7libcbcf_VariantHeader *__pyx_v_header); /* proto */
static PyObject *__pyx_pf_5pysam_7libcbcf_13VariantHeader_7version___get__(struct __pyx_obj_5pysam_7libcbcf_VariantHeader *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_5pysam_7libcbcf_13VariantHeader_7samples___get__(struct __pyx_obj_5pysam_7libcbcf_VariantHeader *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_5pysam_7libcbcf_13VariantHeader_7records___get__(struct __pyx_obj_5pysam_7libcbcf_VariantHeader *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_5pysam_7libcbcf_13VariantHeader_7contigs___get__(struct __pyx_obj_5pysam_7libcbcf_VariantHeader *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_5pysam_7libcbcf_13VariantHeader_7filters___get__(struct __pyx_obj_5pysam_7libcbcf_VariantHeader *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_5pysam_7libcbcf_13VariantHeader_4info___get__(struct __pyx_obj_5pysam_7libcbcf_VariantHeader *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_5pysam_7libcbcf_13VariantHeader_7formats___get__(struct __pyx_obj_5pysam_7libcbcf_VariantHeader *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_5pysam_7libcbcf_13VariantHeader_4alts___get__(struct __pyx_obj_5pysam_7libcbcf_VariantHeader *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_5pysam_7libcbcf_13VariantHeader_12__str__(struct __pyx_obj_5pysam_7libcbcf_VariantHeader *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_5pysam_7libcbcf_13VariantHeader_14new_record(struct __pyx_obj_5pysam_7libcbcf_VariantHeader *__pyx_v_self, PyObject *__pyx_v_contig, PyObject *__pyx_v_start, PyObject *__pyx_v_stop, PyObject *__pyx_v_alleles, PyObject *__pyx_v_id, PyObject *__pyx_v_qual, PyObject *__pyx_v_filter, PyObject *__pyx_v_info, PyObject *__pyx_v_samples, PyObject *__pyx_v_kwargs); /* proto */
static PyObject *__pyx_pf_5pysam_7libcbcf_13VariantHeader_16add_record(struct __pyx_obj_5pysam_7libcbcf_VariantHeader *__pyx_v_self, struct __pyx_obj_5pysam_7libcbcf_VariantHeaderRecord *__pyx_v_record); /* proto */
static PyObject *__pyx_pf_5pysam_7libcbcf_13VariantHeader_18add_line(struct __pyx_obj_5pysam_7libcbcf_VariantHeader *__pyx_v_self, PyObject *__pyx_v_line); /* proto */
static PyObject *__pyx_pf_5pysam_7libcbcf_13VariantHeader_20add_meta(struct __pyx_obj_5pysam_7libcbcf_VariantHeader *__pyx_v_self, PyObject *__pyx_v_key, PyObject *__pyx_v_value, PyObject *__pyx_v_items); /* proto */
static PyObject *__pyx_pf_5pysam_7libcbcf_13VariantHeader_22add_sample(struct __pyx_obj_5pysam_7libcbcf_VariantHeader *__pyx_v_self, PyObject *__pyx_v_name); /* proto */
static PyObject *__pyx_pf_5pysam_7libcbcf_13VariantHeader_24add_samples(struct __pyx_obj_5pysam_7libcbcf_VariantHeader *__pyx_v_self, PyObject *__pyx_v_args); /* proto */
static PyObject *__pyx_pf_5pysam_7libcbcf_13VariantHeader_26__reduce_cython__(CYTHON_UNUSED struct __pyx_obj_5pysam_7libcbcf_VariantHeader *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_5pysam_7libcbcf_13VariantHeader_28__setstate_cython__(CYTHON_UNUSED struct __pyx_obj_5pysam_7libcbcf_VariantHeader *__pyx_v_self, CYTHON_UNUSED PyObject *__pyx_v___pyx_state); /* proto */
static int __pyx_pf_5pysam_7libcbcf_19VariantRecordFilter___init__(CYTHON_UNUSED struct __pyx_obj_5pysam_7libcbcf_VariantRecordFilter *__pyx_v_self, CYTHON_UNUSED PyObject *__pyx_v_args, CYTHON_UNUSED PyObject *__pyx_v_kwargs); /* proto */
static Py_ssize_t __pyx_pf_5pysam_7libcbcf_19VariantRecordFilter_2__len__(struct __pyx_obj_5pysam_7libcbcf_VariantRecordFilter *__pyx_v_self); /* proto */
static int __pyx_pf_5pysam_7libcbcf_19VariantRecordFilter_4__bool__(struct __pyx_obj_5pysam_7libcbcf_VariantRecordFilter *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_5pysam_7libcbcf_19VariantRecordFilter_6__getitem__(struct __pyx_obj_5pysam_7libcbcf_VariantRecordFilter *__pyx_v_self, PyObject *__pyx_v_key); /* proto */
static PyObject *__pyx_pf_5pysam_7libcbcf_19VariantRecordFilter_8add(struct __pyx_obj_5pysam_7libcbcf_VariantRecordFilter *__pyx_v_self, PyObject *__pyx_v_key); /* proto */
static int __pyx_pf_5pysam_7libcbcf_19VariantRecordFilter_10__delitem__(struct __pyx_obj_5pysam_7libcbcf_VariantRecordFilter *__pyx_v_self, PyObject *__pyx_v_key); /* proto */
static PyObject *__pyx_pf_5pysam_7libcbcf_19VariantRecordFilter_12clear(struct __pyx_obj_5pysam_7libcbcf_VariantRecordFilter *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_5pysam_7libcbcf_19VariantRecordFilter_14__iter__(struct __pyx_obj_5pysam_7libcbcf_VariantRecordFilter *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_5pysam_7libcbcf_19VariantRecordFilter_17get(struct __pyx_obj_5pysam_7libcbcf_VariantRecordFilter *__pyx_v_self, PyObject *__pyx_v_key, PyObject *__pyx_v_default); /* proto */
static int __pyx_pf_5pysam_7libcbcf_19VariantRecordFilter_19__contains__(struct __pyx_obj_5pysam_7libcbcf_VariantRecordFilter *__pyx_v_self, PyObject *__pyx_v_key); /* proto */
static PyObject *__pyx_pf_5pysam_7libcbcf_19VariantRecordFilter_21iterkeys(struct __pyx_obj_5pysam_7libcbcf_VariantRecordFilter *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_5pysam_7libcbcf_19VariantRecordFilter_23itervalues(struct __pyx_obj_5pysam_7libcbcf_VariantRecordFilter *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_5pysam_7libcbcf_19VariantRecordFilter_26iteritems(struct __pyx_obj_5pysam_7libcbcf_VariantRecordFilter *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_5pysam_7libcbcf_19VariantRecordFilter_29keys(struct __pyx_obj_5pysam_7libcbcf_VariantRecordFilter *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_5pysam_7libcbcf_19VariantRecordFilter_31items(struct __pyx_obj_5pysam_7libcbcf_VariantRecordFilter *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_5pysam_7libcbcf_19VariantRecordFilter_33values(struct __pyx_obj_5pysam_7libcbcf_VariantRecordFilter *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_5pysam_7libcbcf_19VariantRecordFilter_35__richcmp__(struct __pyx_obj_5pysam_7libcbcf_VariantRecordFilter *__pyx_v_self, struct __pyx_obj_5pysam_7libcbcf_VariantRecordFilter *__pyx_v_other, int __pyx_v_op); /* proto */
static PyObject *__pyx_pf_5pysam_7libcbcf_19VariantRecordFilter_37__reduce_cython__(struct __pyx_obj_5pysam_7libcbcf_VariantRecordFilter *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_5pysam_7libcbcf_19VariantRecordFilter_39__setstate_cython__(struct __pyx_obj_5pysam_7libcbcf_VariantRecordFilter *__pyx_v_self, PyObject *__pyx_v___pyx_state); /* proto */
static int __pyx_pf_5pysam_7libcbcf_19VariantRecordFormat___init__(CYTHON_UNUSED struct __pyx_obj_5pysam_7libcbcf_VariantRecordFormat *__pyx_v_self, CYTHON_UNUSED PyObject *__pyx_v_args, CYTHON_UNUSED PyObject *__pyx_v_kwargs); /* proto */
static Py_ssize_t __pyx_pf_5pysam_7libcbcf_19VariantRecordFormat_2__len__(struct __pyx_obj_5pysam_7libcbcf_VariantRecordFormat *__pyx_v_self); /* proto */
static int __pyx_pf_5pysam_7libcbcf_19VariantRecordFormat_4__bool__(struct __pyx_obj_5pysam_7libcbcf_VariantRecordFormat *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_5pysam_7libcbcf_19VariantRecordFormat_6__getitem__(struct __pyx_obj_5pysam_7libcbcf_VariantRecordFormat *__pyx_v_self, PyObject *__pyx_v_key); /* proto */
static int __pyx_pf_5pysam_7libcbcf_19VariantRecordFormat_8__delitem__(struct __pyx_obj_5pysam_7libcbcf_VariantRecordFormat *__pyx_v_self, PyObject *__pyx_v_key); /* proto */
static PyObject *__pyx_pf_5pysam_7libcbcf_19VariantRecordFormat_10clear(struct __pyx_obj_5pysam_7libcbcf_VariantRecordFormat *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_5pysam_7libcbcf_19VariantRecordFormat_12__iter__(struct __pyx_obj_5pysam_7libcbcf_VariantRecordFormat *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_5pysam_7libcbcf_19VariantRecordFormat_15get(struct __pyx_obj_5pysam_7libcbcf_VariantRecordFormat *__pyx_v_self, PyObject *__pyx_v_key, PyObject *__pyx_v_default); /* proto */
static int __pyx_pf_5pysam_7libcbcf_19VariantRecordFormat_17__contains__(struct __pyx_obj_5pysam_7libcbcf_VariantRecordFormat *__pyx_v_self, PyObject *__pyx_v_key); /* proto */
static PyObject *__pyx_pf_5pysam_7libcbcf_19VariantRecordFormat_19iterkeys(struct __pyx_obj_5pysam_7libcbcf_VariantRecordFormat *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_5pysam_7libcbcf_19VariantRecordFormat_21itervalues(struct __pyx_obj_5pysam_7libcbcf_VariantRecordFormat *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_5pysam_7libcbcf_19VariantRecordFormat_24iteritems(struct __pyx_obj_5pysam_7libcbcf_VariantRecordFormat *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_5pysam_7libcbcf_19VariantRecordFormat_27keys(struct __pyx_obj_5pysam_7libcbcf_VariantRecordFormat *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_5pysam_7libcbcf_19VariantRecordFormat_29items(struct __pyx_obj_5pysam_7libcbcf_VariantRecordFormat *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_5pysam_7libcbcf_19VariantRecordFormat_31values(struct __pyx_obj_5pysam_7libcbcf_VariantRecordFormat *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_5pysam_7libcbcf_19VariantRecordFormat_33__reduce_cython__(struct __pyx_obj_5pysam_7libcbcf_VariantRecordFormat *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_5pysam_7libcbcf_19VariantRecordFormat_35__setstate_cython__(struct __pyx_obj_5pysam_7libcbcf_VariantRecordFormat *__pyx_v_self, PyObject *__pyx_v___pyx_state); /* proto */
static int __pyx_pf_5pysam_7libcbcf_17VariantRecordInfo___init__(CYTHON_UNUSED struct __pyx_obj_5pysam_7libcbcf_VariantRecordInfo *__pyx_v_self, CYTHON_UNUSED PyObject *__pyx_v_args, CYTHON_UNUSED PyObject *__pyx_v_kwargs); /* proto */
static Py_ssize_t __pyx_pf_5pysam_7libcbcf_17VariantRecordInfo_2__len__(struct __pyx_obj_5pysam_7libcbcf_VariantRecordInfo *__pyx_v_self); /* proto */
static int __pyx_pf_5pysam_7libcbcf_17VariantRecordInfo_4__bool__(struct __pyx_obj_5pysam_7libcbcf_VariantRecordInfo *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_5pysam_7libcbcf_17VariantRecordInfo_6__getitem__(struct __pyx_obj_5pysam_7libcbcf_VariantRecordInfo *__pyx_v_self, PyObject *__pyx_v_key); /* proto */
static int __pyx_pf_5pysam_7libcbcf_17VariantRecordInfo_8__setitem__(struct __pyx_obj_5pysam_7libcbcf_VariantRecordInfo *__pyx_v_self, PyObject *__pyx_v_key, PyObject *__pyx_v_value); /* proto */
static int __pyx_pf_5pysam_7libcbcf_17VariantRecordInfo_10__delitem__(struct __pyx_obj_5pysam_7libcbcf_VariantRecordInfo *__pyx_v_self, PyObject *__pyx_v_key); /* proto */
static PyObject *__pyx_pf_5pysam_7libcbcf_17VariantRecordInfo_12clear(struct __pyx_obj_5pysam_7libcbcf_VariantRecordInfo *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_5pysam_7libcbcf_17VariantRecordInfo_14__iter__(struct __pyx_obj_5pysam_7libcbcf_VariantRecordInfo *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_5pysam_7libcbcf_17VariantRecordInfo_17get(struct __pyx_obj_5pysam_7libcbcf_VariantRecordInfo *__pyx_v_self, PyObject *__pyx_v_key, PyObject *__pyx_v_default); /* proto */
static int __pyx_pf_5pysam_7libcbcf_17VariantRecordInfo_19__contains__(struct __pyx_obj_5pysam_7libcbcf_VariantRecordInfo *__pyx_v_self, PyObject *__pyx_v_key); /* proto */
static PyObject *__pyx_pf_5pysam_7libcbcf_17VariantRecordInfo_21iterkeys(struct __pyx_obj_5pysam_7libcbcf_VariantRecordInfo *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_5pysam_7libcbcf_17VariantRecordInfo_23itervalues(struct __pyx_obj_5pysam_7libcbcf_VariantRecordInfo *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_5pysam_7libcbcf_17VariantRecordInfo_26iteritems(struct __pyx_obj_5pysam_7libcbcf_VariantRecordInfo *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_5pysam_7libcbcf_17VariantRecordInfo_29keys(struct __pyx_obj_5pysam_7libcbcf_VariantRecordInfo *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_5pysam_7libcbcf_17VariantRecordInfo_31items(struct __pyx_obj_5pysam_7libcbcf_VariantRecordInfo *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_5pysam_7libcbcf_17VariantRecordInfo_33values(struct __pyx_obj_5pysam_7libcbcf_VariantRecordInfo *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_5pysam_7libcbcf_17VariantRecordInfo_35update(struct __pyx_obj_5pysam_7libcbcf_VariantRecordInfo *__pyx_v_self, PyObject *__pyx_v_items, PyObject *__pyx_v_kwargs); /* proto */
static PyObject *__pyx_pf_5pysam_7libcbcf_17VariantRecordInfo_37pop(struct __pyx_obj_5pysam_7libcbcf_VariantRecordInfo *__pyx_v_self, PyObject *__pyx_v_key, PyObject *__pyx_v_default); /* proto */
static PyObject *__pyx_pf_5pysam_7libcbcf_17VariantRecordInfo_39__richcmp__(struct __pyx_obj_5pysam_7libcbcf_VariantRecordInfo *__pyx_v_self, struct __pyx_obj_5pysam_7libcbcf_VariantRecordInfo *__pyx_v_other, int __pyx_v_op); /* proto */
static PyObject *__pyx_pf_5pysam_7libcbcf_17VariantRecordInfo_41__reduce_cython__(struct __pyx_obj_5pysam_7libcbcf_VariantRecordInfo *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_5pysam_7libcbcf_17VariantRecordInfo_43__setstate_cython__(struct __pyx_obj_5pysam_7libcbcf_VariantRecordInfo *__pyx_v_self, PyObject *__pyx_v___pyx_state); /* proto */
static int __pyx_pf_5pysam_7libcbcf_20VariantRecordSamples___init__(CYTHON_UNUSED struct __pyx_obj_5pysam_7libcbcf_VariantRecordSamples *__pyx_v_self, CYTHON_UNUSED PyObject *__pyx_v_args, CYTHON_UNUSED PyObject *__pyx_v_kwargs); /* proto */
static Py_ssize_t __pyx_pf_5pysam_7libcbcf_20VariantRecordSamples_2__len__(struct __pyx_obj_5pysam_7libcbcf_VariantRecordSamples *__pyx_v_self); /* proto */
static int __pyx_pf_5pysam_7libcbcf_20VariantRecordSamples_4__bool__(struct __pyx_obj_5pysam_7libcbcf_VariantRecordSamples *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_5pysam_7libcbcf_20VariantRecordSamples_6__getitem__(struct __pyx_obj_5pysam_7libcbcf_VariantRecordSamples *__pyx_v_self, PyObject *__pyx_v_key); /* proto */
static PyObject *__pyx_pf_5pysam_7libcbcf_20VariantRecordSamples_8__iter__(struct __pyx_obj_5pysam_7libcbcf_VariantRecordSamples *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_5pysam_7libcbcf_20VariantRecordSamples_11get(struct __pyx_obj_5pysam_7libcbcf_VariantRecordSamples *__pyx_v_self, PyObject *__pyx_v_key, PyObject *__pyx_v_default); /* proto */
static int __pyx_pf_5pysam_7libcbcf_20VariantRecordSamples_13__contains__(struct __pyx_obj_5pysam_7libcbcf_VariantRecordSamples *__pyx_v_self, PyObject *__pyx_v_key); /* proto */
static PyObject *__pyx_pf_5pysam_7libcbcf_20VariantRecordSamples_15iterkeys(struct __pyx_obj_5pysam_7libcbcf_VariantRecordSamples *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_5pysam_7libcbcf_20VariantRecordSamples_17itervalues(struct __pyx_obj_5pysam_7libcbcf_VariantRecordSamples *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_5pysam_7libcbcf_20VariantRecordSamples_20iteritems(struct __pyx_obj_5pysam_7libcbcf_VariantRecordSamples *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_5pysam_7libcbcf_20VariantRecordSamples_23keys(struct __pyx_obj_5pysam_7libcbcf_VariantRecordSamples *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_5pysam_7libcbcf_20VariantRecordSamples_25items(struct __pyx_obj_5pysam_7libcbcf_VariantRecordSamples *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_5pysam_7libcbcf_20VariantRecordSamples_27values(struct __pyx_obj_5pysam_7libcbcf_VariantRecordSamples *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_5pysam_7libcbcf_20VariantRecordSamples_29update(struct __pyx_obj_5pysam_7libcbcf_VariantRecordSamples *__pyx_v_self, PyObject *__pyx_v_items, PyObject *__pyx_v_kwargs); /* proto */
static PyObject *__pyx_pf_5pysam_7libcbcf_20VariantRecordSamples_31pop(struct __pyx_obj_5pysam_7libcbcf_VariantRecordSamples *__pyx_v_self, PyObject *__pyx_v_key, PyObject *__pyx_v_default); /* proto */
static PyObject *__pyx_pf_5pysam_7libcbcf_20VariantRecordSamples_33__richcmp__(struct __pyx_obj_5pysam_7libcbcf_VariantRecordSamples *__pyx_v_self, struct __pyx_obj_5pysam_7libcbcf_VariantRecordSamples *__pyx_v_other, int __pyx_v_op); /* proto */
static PyObject *__pyx_pf_5pysam_7libcbcf_20VariantRecordSamples_35__reduce_cython__(struct __pyx_obj_5pysam_7libcbcf_VariantRecordSamples *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_5pysam_7libcbcf_20VariantRecordSamples_37__setstate_cython__(struct __pyx_obj_5pysam_7libcbcf_VariantRecordSamples *__pyx_v_self, PyObject *__pyx_v___pyx_state); /* proto */
static int __pyx_pf_5pysam_7libcbcf_13VariantRecord___init__(CYTHON_UNUSED struct __pyx_obj_5pysam_7libcbcf_VariantRecord *__pyx_v_self, CYTHON_UNUSED PyObject *__pyx_v_args, CYTHON_UNUSED PyObject *__pyx_v_kwargs); /* proto */
static void __pyx_pf_5pysam_7libcbcf_13VariantRecord_2__dealloc__(struct __pyx_obj_5pysam_7libcbcf_VariantRecord *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_5pysam_7libcbcf_13VariantRecord_4copy(struct __pyx_obj_5pysam_7libcbcf_VariantRecord *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_5pysam_7libcbcf_13VariantRecord_6translate(struct __pyx_obj_5pysam_7libcbcf_VariantRecord *__pyx_v_self, struct __pyx_obj_5pysam_7libcbcf_VariantHeader *__pyx_v_dst_header); /* proto */
static PyObject *__pyx_pf_5pysam_7libcbcf_13VariantRecord_3rid___get__(struct __pyx_obj_5pysam_7libcbcf_VariantRecord *__pyx_v_self); /* proto */
static int __pyx_pf_5pysam_7libcbcf_13VariantRecord_3rid_2__set__(struct __pyx_obj_5pysam_7libcbcf_VariantRecord *__pyx_v_self, PyObject *__pyx_v_value); /* proto */
static PyObject *__pyx_pf_5pysam_7libcbcf_13VariantRecord_5chrom___get__(struct __pyx_obj_5pysam_7libcbcf_VariantRecord *__pyx_v_self); /* proto */
static int __pyx_pf_5pysam_7libcbcf_13VariantRecord_5chrom_2__set__(struct __pyx_obj_5pysam_7libcbcf_VariantRecord *__pyx_v_self, PyObject *__pyx_v_value); /* proto */
static PyObject *__pyx_pf_5pysam_7libcbcf_13VariantRecord_6contig___get__(struct __pyx_obj_5pysam_7libcbcf_VariantRecord *__pyx_v_self); /* proto */
static int __pyx_pf_5pysam_7libcbcf_13VariantRecord_6contig_2__set__(struct __pyx_obj_5pysam_7libcbcf_VariantRecord *__pyx_v_self, PyObject *__pyx_v_value); /* proto */
static PyObject *__pyx_pf_5pysam_7libcbcf_13VariantRecord_3pos___get__(struct __pyx_obj_5pysam_7libcbcf_VariantRecord *__pyx_v_self); /* proto */
static int __pyx_pf_5pysam_7libcbcf_13VariantRecord_3pos_2__set__(struct __pyx_obj_5pysam_7libcbcf_VariantRecord *__pyx_v_self, PyObject *__pyx_v_value); /* proto */
static PyObject *__pyx_pf_5pysam_7libcbcf_13VariantRecord_5start___get__(struct __pyx_obj_5pysam_7libcbcf_VariantRecord *__pyx_v_self); /* proto */
static int __pyx_pf_5pysam_7libcbcf_13VariantRecord_5start_2__set__(struct __pyx_obj_5pysam_7libcbcf_VariantRecord *__pyx_v_self, PyObject *__pyx_v_value); /* proto */
static PyObject *__pyx_pf_5pysam_7libcbcf_13VariantRecord_4stop___get__(struct __pyx_obj_5pysam_7libcbcf_VariantRecord *__pyx_v_self); /* proto */
static int __pyx_pf_5pysam_7libcbcf_13VariantRecord_4stop_2__set__(struct __pyx_obj_5pysam_7libcbcf_VariantRecord *__pyx_v_self, PyObject *__pyx_v_value); /* proto */
static PyObject *__pyx_pf_5pysam_7libcbcf_13VariantRecord_4rlen___get__(struct __pyx_obj_5pysam_7libcbcf_VariantRecord *__pyx_v_self); /* proto */
static int __pyx_pf_5pysam_7libcbcf_13VariantRecord_4rlen_2__set__(struct __pyx_obj_5pysam_7libcbcf_VariantRecord *__pyx_v_self, PyObject *__pyx_v_value); /* proto */
static PyObject *__pyx_pf_5pysam_7libcbcf_13VariantRecord_4qual___get__(struct __pyx_obj_5pysam_7libcbcf_VariantRecord *__pyx_v_self); /* proto */
static int __pyx_pf_5pysam_7libcbcf_13VariantRecord_4qual_2__set__(struct __pyx_obj_5pysam_7libcbcf_VariantRecord *__pyx_v_self, PyObject *__pyx_v_value); /* proto */
static PyObject *__pyx_pf_5pysam_7libcbcf_13VariantRecord_2id___get__(struct __pyx_obj_5pysam_7libcbcf_VariantRecord *__pyx_v_self); /* proto */
static int __pyx_pf_5pysam_7libcbcf_13VariantRecord_2id_2__set__(struct __pyx_obj_5pysam_7libcbcf_VariantRecord *__pyx_v_self, PyObject *__pyx_v_value); /* proto */
static PyObject *__pyx_pf_5pysam_7libcbcf_13VariantRecord_3ref___get__(struct __pyx_obj_5pysam_7libcbcf_VariantRecord *__pyx_v_self); /* proto */
static int __pyx_pf_5pysam_7libcbcf_13VariantRecord_3ref_2__set__(struct __pyx_obj_5pysam_7libcbcf_VariantRecord *__pyx_v_self, PyObject *__pyx_v_value); /* proto */
static PyObject *__pyx_pf_5pysam_7libcbcf_13VariantRecord_7alleles___get__(struct __pyx_obj_5pysam_7libcbcf_VariantRecord *__pyx_v_self); /* proto */
static int __pyx_pf_5pysam_7libcbcf_13VariantRecord_7alleles_2__set__(struct __pyx_obj_5pysam_7libcbcf_VariantRecord *__pyx_v_self, PyObject *__pyx_v_values); /* proto */
static PyObject *__pyx_pf_5pysam_7libcbcf_13VariantRecord_4alts___get__(struct __pyx_obj_5pysam_7libcbcf_VariantRecord *__pyx_v_self); /* proto */
static int __pyx_pf_5pysam_7libcbcf_13VariantRecord_4alts_2__set__(struct __pyx_obj_5pysam_7libcbcf_VariantRecord *__pyx_v_self, PyObject *__pyx_v_value); /* proto */
static PyObject *__pyx_pf_5pysam_7libcbcf_13VariantRecord_6filter___get__(struct __pyx_obj_5pysam_7libcbcf_VariantRecord *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_5pysam_7libcbcf_13VariantRecord_4info___get__(struct __pyx_obj_5pysam_7libcbcf_VariantRecord *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_5pysam_7libcbcf_13VariantRecord_6format___get__(struct __pyx_obj_5pysam_7libcbcf_VariantRecord *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_5pysam_7libcbcf_13VariantRecord_7samples___get__(struct __pyx_obj_5pysam_7libcbcf_VariantRecord *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_5pysam_7libcbcf_13VariantRecord_21alleles_variant_types___get__(struct __pyx_obj_5pysam_7libcbcf_VariantRecord *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_5pysam_7libcbcf_13VariantRecord_8__richcmp__(struct __pyx_obj_5pysam_7libcbcf_VariantRecord *__pyx_v_self, struct __pyx_obj_5pysam_7libcbcf_VariantRecord *__pyx_v_other, int __pyx_v_op); /* proto */
static PyObject *__pyx_pf_5pysam_7libcbcf_13VariantRecord_10__str__(struct __pyx_obj_5pysam_7libcbcf_VariantRecord *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_5pysam_7libcbcf_13VariantRecord_6header___get__(struct __pyx_obj_5pysam_7libcbcf_VariantRecord *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_5pysam_7libcbcf_13VariantRecord_12__reduce_cython__(CYTHON_UNUSED struct __pyx_obj_5pysam_7libcbcf_VariantRecord *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_5pysam_7libcbcf_13VariantRecord_14__setstate_cython__(CYTHON_UNUSED struct __pyx_obj_5pysam_7libcbcf_VariantRecord *__pyx_v_self, CYTHON_UNUSED PyObject *__pyx_v___pyx_state); /* proto */
static int __pyx_pf_5pysam_7libcbcf_19VariantRecordSample___init__(CYTHON_UNUSED struct __pyx_obj_5pysam_7libcbcf_VariantRecordSample *__pyx_v_self, CYTHON_UNUSED PyObject *__pyx_v_args, CYTHON_UNUSED PyObject *__pyx_v_kwargs); /* proto */
static PyObject *__pyx_pf_5pysam_7libcbcf_19VariantRecordSample_4name___get__(struct __pyx_obj_5pysam_7libcbcf_VariantRecordSample *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_5pysam_7libcbcf_19VariantRecordSample_14allele_indices___get__(struct __pyx_obj_5pysam_7libcbcf_VariantRecordSample *__pyx_v_self); /* proto */
static int __pyx_pf_5pysam_7libcbcf_19VariantRecordSample_14allele_indices_2__set__(struct __pyx_obj_5pysam_7libcbcf_VariantRecordSample *__pyx_v_self, PyObject *__pyx_v_value); /* proto */
static int __pyx_pf_5pysam_7libcbcf_19VariantRecordSample_14allele_indices_4__del__(struct __pyx_obj_5pysam_7libcbcf_VariantRecordSample *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_5pysam_7libcbcf_19VariantRecordSample_7alleles___get__(struct __pyx_obj_5pysam_7libcbcf_VariantRecordSample *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_5pysam_7libcbcf_19VariantRecordSample_7alleles_7__set___genexpr(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_genexpr_arg_0); /* proto */
static PyObject *__pyx_pf_5pysam_7libcbcf_19VariantRecordSample_7alleles_7__set___3genexpr(PyObject *__pyx_self, PyObject *__pyx_genexpr_arg_0); /* proto */
static int __pyx_pf_5pysam_7libcbcf_19VariantRecordSample_7alleles_2__set__(struct __pyx_obj_5pysam_7libcbcf_VariantRecordSample *__pyx_v_self, PyObject *__pyx_v_value); /* proto */
static int __pyx_pf_5pysam_7libcbcf_19VariantRecordSample_7alleles_4__del__(struct __pyx_obj_5pysam_7libcbcf_VariantRecordSample *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_5pysam_7libcbcf_19VariantRecordSample_6phased___get__(struct __pyx_obj_5pysam_7libcbcf_VariantRecordSample *__pyx_v_self); /* proto */
static int __pyx_pf_5pysam_7libcbcf_19VariantRecordSample_6phased_2__set__(struct __pyx_obj_5pysam_7libcbcf_VariantRecordSample *__pyx_v_self, PyObject *__pyx_v_value); /* proto */
static Py_ssize_t __pyx_pf_5pysam_7libcbcf_19VariantRecordSample_2__len__(struct __pyx_obj_5pysam_7libcbcf_VariantRecordSample *__pyx_v_self); /* proto */
static int __pyx_pf_5pysam_7libcbcf_19VariantRecordSample_4__bool__(struct __pyx_obj_5pysam_7libcbcf_VariantRecordSample *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_5pysam_7libcbcf_19VariantRecordSample_6__getitem__(struct __pyx_obj_5pysam_7libcbcf_VariantRecordSample *__pyx_v_self, PyObject *__pyx_v_key); /* proto */
static int __pyx_pf_5pysam_7libcbcf_19VariantRecordSample_8__setitem__(struct __pyx_obj_5pysam_7libcbcf_VariantRecordSample *__pyx_v_self, PyObject *__pyx_v_key, PyObject *__pyx_v_value); /* proto */
static int __pyx_pf_5pysam_7libcbcf_19VariantRecordSample_10__delitem__(struct __pyx_obj_5pysam_7libcbcf_VariantRecordSample *__pyx_v_self, PyObject *__pyx_v_key); /* proto */
static PyObject *__pyx_pf_5pysam_7libcbcf_19VariantRecordSample_12clear(struct __pyx_obj_5pysam_7libcbcf_VariantRecordSample *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_5pysam_7libcbcf_19VariantRecordSample_14__iter__(struct __pyx_obj_5pysam_7libcbcf_VariantRecordSample *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_5pysam_7libcbcf_19VariantRecordSample_17get(struct __pyx_obj_5pysam_7libcbcf_VariantRecordSample *__pyx_v_self, PyObject *__pyx_v_key, PyObject *__pyx_v_default); /* proto */
static int __pyx_pf_5pysam_7libcbcf_19VariantRecordSample_19__contains__(struct __pyx_obj_5pysam_7libcbcf_VariantRecordSample *__pyx_v_self, PyObject *__pyx_v_key); /* proto */
static PyObject *__pyx_pf_5pysam_7libcbcf_19VariantRecordSample_21iterkeys(struct __pyx_obj_5pysam_7libcbcf_VariantRecordSample *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_5pysam_7libcbcf_19VariantRecordSample_23itervalues(struct __pyx_obj_5pysam_7libcbcf_VariantRecordSample *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_5pysam_7libcbcf_19VariantRecordSample_26iteritems(struct __pyx_obj_5pysam_7libcbcf_VariantRecordSample *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_5pysam_7libcbcf_19VariantRecordSample_29keys(struct __pyx_obj_5pysam_7libcbcf_VariantRecordSample *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_5pysam_7libcbcf_19VariantRecordSample_31items(struct __pyx_obj_5pysam_7libcbcf_VariantRecordSample *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_5pysam_7libcbcf_19VariantRecordSample_33values(struct __pyx_obj_5pysam_7libcbcf_VariantRecordSample *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_5pysam_7libcbcf_19VariantRecordSample_35update(struct __pyx_obj_5pysam_7libcbcf_VariantRecordSample *__pyx_v_self, PyObject *__pyx_v_items, PyObject *__pyx_v_kwargs); /* proto */
static PyObject *__pyx_pf_5pysam_7libcbcf_19VariantRecordSample_37pop(struct __pyx_obj_5pysam_7libcbcf_VariantRecordSample *__pyx_v_self, PyObject *__pyx_v_key, PyObject *__pyx_v_default); /* proto */
static PyObject *__pyx_pf_5pysam_7libcbcf_19VariantRecordSample_39__richcmp__(struct __pyx_obj_5pysam_7libcbcf_VariantRecordSample *__pyx_v_self, struct __pyx_obj_5pysam_7libcbcf_VariantRecordSample *__pyx_v_other, int __pyx_v_op); /* proto */
static PyObject *__pyx_pf_5pysam_7libcbcf_19VariantRecordSample_5index___get__(struct __pyx_obj_5pysam_7libcbcf_VariantRecordSample *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_5pysam_7libcbcf_19VariantRecordSample_41__reduce_cython__(struct __pyx_obj_5pysam_7libcbcf_VariantRecordSample *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_5pysam_7libcbcf_19VariantRecordSample_43__setstate_cython__(struct __pyx_obj_5pysam_7libcbcf_VariantRecordSample *__pyx_v_self, PyObject *__pyx_v___pyx_state); /* proto */
static int __pyx_pf_5pysam_7libcbcf_9BaseIndex___init__(struct __pyx_obj_5pysam_7libcbcf_BaseIndex *__pyx_v_self); /* proto */
static Py_ssize_t __pyx_pf_5pysam_7libcbcf_9BaseIndex_2__len__(struct __pyx_obj_5pysam_7libcbcf_BaseIndex *__pyx_v_self); /* proto */
static int __pyx_pf_5pysam_7libcbcf_9BaseIndex_4__bool__(struct __pyx_obj_5pysam_7libcbcf_BaseIndex *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_5pysam_7libcbcf_9BaseIndex_6__getitem__(struct __pyx_obj_5pysam_7libcbcf_BaseIndex *__pyx_v_self, PyObject *__pyx_v_key); /* proto */
static PyObject *__pyx_pf_5pysam_7libcbcf_9BaseIndex_8__iter__(struct __pyx_obj_5pysam_7libcbcf_BaseIndex *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_5pysam_7libcbcf_9BaseIndex_10get(struct __pyx_obj_5pysam_7libcbcf_BaseIndex *__pyx_v_self, PyObject *__pyx_v_key, PyObject *__pyx_v_default); /* proto */
static int __pyx_pf_5pysam_7libcbcf_9BaseIndex_12__contains__(struct __pyx_obj_5pysam_7libcbcf_BaseIndex *__pyx_v_self, PyObject *__pyx_v_key); /* proto */
static PyObject *__pyx_pf_5pysam_7libcbcf_9BaseIndex_14iterkeys(struct __pyx_obj_5pysam_7libcbcf_BaseIndex *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_5pysam_7libcbcf_9BaseIndex_16itervalues(struct __pyx_obj_5pysam_7libcbcf_BaseIndex *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_5pysam_7libcbcf_9BaseIndex_19iteritems(struct __pyx_obj_5pysam_7libcbcf_BaseIndex *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_5pysam_7libcbcf_9BaseIndex_22keys(struct __pyx_obj_5pysam_7libcbcf_BaseIndex *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_5pysam_7libcbcf_9BaseIndex_24items(struct __pyx_obj_5pysam_7libcbcf_BaseIndex *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_5pysam_7libcbcf_9BaseIndex_26values(struct __pyx_obj_5pysam_7libcbcf_BaseIndex *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_5pysam_7libcbcf_9BaseIndex_28update(struct __pyx_obj_5pysam_7libcbcf_BaseIndex *__pyx_v_self, PyObject *__pyx_v_items, PyObject *__pyx_v_kwargs); /* proto */
static PyObject *__pyx_pf_5pysam_7libcbcf_9BaseIndex_30pop(struct __pyx_obj_5pysam_7libcbcf_BaseIndex *__pyx_v_self, PyObject *__pyx_v_key, PyObject *__pyx_v_default); /* proto */
static PyObject *__pyx_pf_5pysam_7libcbcf_9BaseIndex_32__reduce_cython__(struct __pyx_obj_5pysam_7libcbcf_BaseIndex *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_5pysam_7libcbcf_9BaseIndex_34__setstate_cython__(struct __pyx_obj_5pysam_7libcbcf_BaseIndex *__pyx_v_self, PyObject *__pyx_v___pyx_state); /* proto */
static int __pyx_pf_5pysam_7libcbcf_8BCFIndex___init__(struct __pyx_obj_5pysam_7libcbcf_BCFIndex *__pyx_v_self); /* proto */
static void __pyx_pf_5pysam_7libcbcf_8BCFIndex_2__dealloc__(struct __pyx_obj_5pysam_7libcbcf_BCFIndex *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_5pysam_7libcbcf_8BCFIndex_4fetch(CYTHON_UNUSED struct __pyx_obj_5pysam_7libcbcf_BCFIndex *__pyx_v_self, PyObject *__pyx_v_bcf, PyObject *__pyx_v_contig, PyObject *__pyx_v_start, PyObject *__pyx_v_stop, PyObject *__pyx_v_reopen); /* proto */
static PyObject *__pyx_pf_5pysam_7libcbcf_8BCFIndex_6header___get__(struct __pyx_obj_5pysam_7libcbcf_BCFIndex *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_5pysam_7libcbcf_8BCFIndex_6__reduce_cython__(CYTHON_UNUSED struct __pyx_obj_5pysam_7libcbcf_BCFIndex *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_5pysam_7libcbcf_8BCFIndex_8__setstate_cython__(CYTHON_UNUSED struct __pyx_obj_5pysam_7libcbcf_BCFIndex *__pyx_v_self, CYTHON_UNUSED PyObject *__pyx_v___pyx_state); /* proto */
static int __pyx_pf_5pysam_7libcbcf_10TabixIndex___init__(struct __pyx_obj_5pysam_7libcbcf_TabixIndex *__pyx_v_self); /* proto */
static void __pyx_pf_5pysam_7libcbcf_10TabixIndex_2__dealloc__(struct __pyx_obj_5pysam_7libcbcf_TabixIndex *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_5pysam_7libcbcf_10TabixIndex_4fetch(CYTHON_UNUSED struct __pyx_obj_5pysam_7libcbcf_TabixIndex *__pyx_v_self, PyObject *__pyx_v_bcf, PyObject *__pyx_v_contig, PyObject *__pyx_v_start, PyObject *__pyx_v_stop, PyObject *__pyx_v_reopen); /* proto */
static PyObject *__pyx_pf_5pysam_7libcbcf_10TabixIndex_6__reduce_cython__(CYTHON_UNUSED struct __pyx_obj_5pysam_7libcbcf_TabixIndex *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_5pysam_7libcbcf_10TabixIndex_8__setstate_cython__(CYTHON_UNUSED struct __pyx_obj_5pysam_7libcbcf_TabixIndex *__pyx_v_self, CYTHON_UNUSED PyObject *__pyx_v___pyx_state); /* proto */
static PyObject *__pyx_pf_5pysam_7libcbcf_12BaseIterator___reduce_cython__(CYTHON_UNUSED struct __pyx_obj_5pysam_7libcbcf_BaseIterator *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_5pysam_7libcbcf_12BaseIterator_2__setstate_cython__(CYTHON_UNUSED struct __pyx_obj_5pysam_7libcbcf_BaseIterator *__pyx_v_self, CYTHON_UNUSED PyObject *__pyx_v___pyx_state); /* proto */
static int __pyx_pf_5pysam_7libcbcf_11BCFIterator___init__(struct __pyx_obj_5pysam_7libcbcf_BCFIterator *__pyx_v_self, struct __pyx_obj_5pysam_7libcbcf_VariantFile *__pyx_v_bcf, PyObject *__pyx_v_contig, PyObject *__pyx_v_start, PyObject *__pyx_v_stop, PyObject *__pyx_v_reopen); /* proto */
static void __pyx_pf_5pysam_7libcbcf_11BCFIterator_2__dealloc__(struct __pyx_obj_5pysam_7libcbcf_BCFIterator *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_5pysam_7libcbcf_11BCFIterator_4__iter__(struct __pyx_obj_5pysam_7libcbcf_BCFIterator *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_5pysam_7libcbcf_11BCFIterator_6__next__(struct __pyx_obj_5pysam_7libcbcf_BCFIterator *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_5pysam_7libcbcf_11BCFIterator_8__reduce_cython__(CYTHON_UNUSED struct __pyx_obj_5pysam_7libcbcf_BCFIterator *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_5pysam_7libcbcf_11BCFIterator_10__setstate_cython__(CYTHON_UNUSED struct __pyx_obj_5pysam_7libcbcf_BCFIterator *__pyx_v_self, CYTHON_UNUSED PyObject *__pyx_v___pyx_state); /* proto */
static int __pyx_pf_5pysam_7libcbcf_13TabixIterator___cinit__(struct __pyx_obj_5pysam_7libcbcf_TabixIterator *__pyx_v_self, CYTHON_UNUSED PyObject *__pyx_v_args, CYTHON_UNUSED PyObject *__pyx_v_kwargs); /* proto */
static int __pyx_pf_5pysam_7libcbcf_13TabixIterator_2__init__(struct __pyx_obj_5pysam_7libcbcf_TabixIterator *__pyx_v_self, struct __pyx_obj_5pysam_7libcbcf_VariantFile *__pyx_v_bcf, PyObject *__pyx_v_contig, PyObject *__pyx_v_start, PyObject *__pyx_v_stop, PyObject *__pyx_v_reopen); /* proto */
static void __pyx_pf_5pysam_7libcbcf_13TabixIterator_4__dealloc__(struct __pyx_obj_5pysam_7libcbcf_TabixIterator *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_5pysam_7libcbcf_13TabixIterator_6__iter__(struct __pyx_obj_5pysam_7libcbcf_TabixIterator *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_5pysam_7libcbcf_13TabixIterator_8__next__(struct __pyx_obj_5pysam_7libcbcf_TabixIterator *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_5pysam_7libcbcf_13TabixIterator_10__reduce_cython__(CYTHON_UNUSED struct __pyx_obj_5pysam_7libcbcf_TabixIterator *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_5pysam_7libcbcf_13TabixIterator_12__setstate_cython__(CYTHON_UNUSED struct __pyx_obj_5pysam_7libcbcf_TabixIterator *__pyx_v_self, CYTHON_UNUSED PyObject *__pyx_v___pyx_state); /* proto */
static int __pyx_pf_5pysam_7libcbcf_11VariantFile___cinit__(struct __pyx_obj_5pysam_7libcbcf_VariantFile *__pyx_v_self, CYTHON_UNUSED PyObject *__pyx_v_args, CYTHON_UNUSED PyObject *__pyx_v_kwargs); /* proto */
static int __pyx_pf_5pysam_7libcbcf_11VariantFile_2__init__(struct __pyx_obj_5pysam_7libcbcf_VariantFile *__pyx_v_self, PyObject *__pyx_v_args, PyObject *__pyx_v_kwargs); /* proto */
static void __pyx_pf_5pysam_7libcbcf_11VariantFile_4__dealloc__(struct __pyx_obj_5pysam_7libcbcf_VariantFile *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_5pysam_7libcbcf_11VariantFile_6close(struct __pyx_obj_5pysam_7libcbcf_VariantFile *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_5pysam_7libcbcf_11VariantFile_8__iter__(struct __pyx_obj_5pysam_7libcbcf_VariantFile *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_5pysam_7libcbcf_11VariantFile_10__next__(struct __pyx_obj_5pysam_7libcbcf_VariantFile *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_5pysam_7libcbcf_11VariantFile_12copy(struct __pyx_obj_5pysam_7libcbcf_VariantFile *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_5pysam_7libcbcf_11VariantFile_14open(struct __pyx_obj_5pysam_7libcbcf_VariantFile *__pyx_v_self, PyObject *__pyx_v_filename, PyObject *__pyx_v_mode, PyObject *__pyx_v_index_filename, struct __pyx_obj_5pysam_7libcbcf_VariantHeader *__pyx_v_header, PyObject *__pyx_v_drop_samples, PyObject *__pyx_v_duplicate_filehandle, PyObject *__pyx_v_ignore_truncation, PyObject *__pyx_v_threads); /* proto */
static PyObject *__pyx_pf_5pysam_7libcbcf_11VariantFile_16reset(struct __pyx_obj_5pysam_7libcbcf_VariantFile *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_5pysam_7libcbcf_11VariantFile_18is_valid_tid(struct __pyx_obj_5pysam_7libcbcf_VariantFile *__pyx_v_self, PyObject *__pyx_v_tid); /* proto */
static PyObject *__pyx_pf_5pysam_7libcbcf_11VariantFile_20get_tid(struct __pyx_obj_5pysam_7libcbcf_VariantFile *__pyx_v_self, PyObject *__pyx_v_reference); /* proto */
static PyObject *__pyx_pf_5pysam_7libcbcf_11VariantFile_22get_reference_name(struct __pyx_obj_5pysam_7libcbcf_VariantFile *__pyx_v_self, PyObject *__pyx_v_tid); /* proto */
static PyObject *__pyx_pf_5pysam_7libcbcf_11VariantFile_24fetch(struct __pyx_obj_5pysam_7libcbcf_VariantFile *__pyx_v_self, PyObject *__pyx_v_contig, PyObject *__pyx_v_start, PyObject *__pyx_v_stop, PyObject *__pyx_v_region, PyObject *__pyx_v_reopen, PyObject *__pyx_v_end, PyObject *__pyx_v_reference); /* proto */
static PyObject *__pyx_pf_5pysam_7libcbcf_11VariantFile_26new_record(struct __pyx_obj_5pysam_7libcbcf_VariantFile *__pyx_v_self, PyObject *__pyx_v_args, PyObject *__pyx_v_kwargs); /* proto */
static PyObject *__pyx_pf_5pysam_7libcbcf_11VariantFile_28write(struct __pyx_obj_5pysam_7libcbcf_VariantFile *__pyx_v_self, struct __pyx_obj_5pysam_7libcbcf_VariantRecord *__pyx_v_record); /* proto */
static PyObject *__pyx_pf_5pysam_7libcbcf_11VariantFile_30subset_samples(struct __pyx_obj_5pysam_7libcbcf_VariantFile *__pyx_v_self, PyObject *__pyx_v_include_samples); /* proto */
static PyObject *__pyx_pf_5pysam_7libcbcf_11VariantFile_6header___get__(struct __pyx_obj_5pysam_7libcbcf_VariantFile *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_5pysam_7libcbcf_11VariantFile_5index___get__(struct __pyx_obj_5pysam_7libcbcf_VariantFile *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_5pysam_7libcbcf_11VariantFile_12drop_samples___get__(struct __pyx_obj_5pysam_7libcbcf_VariantFile *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_5pysam_7libcbcf_11VariantFile_10is_reading___get__(struct __pyx_obj_5pysam_7libcbcf_VariantFile *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_5pysam_7libcbcf_11VariantFile_14header_written___get__(struct __pyx_obj_5pysam_7libcbcf_VariantFile *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_5pysam_7libcbcf_11VariantFile_32__reduce_cython__(CYTHON_UNUSED struct __pyx_obj_5pysam_7libcbcf_VariantFile *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_5pysam_7libcbcf_11VariantFile_34__setstate_cython__(CYTHON_UNUSED struct __pyx_obj_5pysam_7libcbcf_VariantFile *__pyx_v_self, CYTHON_UNUSED PyObject *__pyx_v___pyx_state); /* proto */
static PyObject *__pyx_pf_5pysam_7libcbcf___pyx_unpickle_VariantHeaderRecords(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v___pyx_type, long __pyx_v___pyx_checksum, PyObject *__pyx_v___pyx_state); /* proto */
static PyObject *__pyx_pf_5pysam_7libcbcf_2__pyx_unpickle_VariantMetadata(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v___pyx_type, long __pyx_v___pyx_checksum, PyObject *__pyx_v___pyx_state); /* proto */
static PyObject *__pyx_pf_5pysam_7libcbcf_4__pyx_unpickle_VariantHeaderMetadata(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v___pyx_type, long __pyx_v___pyx_checksum, PyObject *__pyx_v___pyx_state); /* proto */
static PyObject *__pyx_pf_5pysam_7libcbcf_6__pyx_unpickle_VariantContig(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v___pyx_type, long __pyx_v___pyx_checksum, PyObject *__pyx_v___pyx_state); /* proto */
static PyObject *__pyx_pf_5pysam_7libcbcf_8__pyx_unpickle_VariantHeaderContigs(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v___pyx_type, long __pyx_v___pyx_checksum, PyObject *__pyx_v___pyx_state); /* proto */
static PyObject *__pyx_pf_5pysam_7libcbcf_10__pyx_unpickle_VariantHeaderSamples(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v___pyx_type, long __pyx_v___pyx_checksum, PyObject *__pyx_v___pyx_state); /* proto */
static PyObject *__pyx_pf_5pysam_7libcbcf_12__pyx_unpickle_VariantRecordFilter(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v___pyx_type, long __pyx_v___pyx_checksum, PyObject *__pyx_v___pyx_state); /* proto */
static PyObject *__pyx_pf_5pysam_7libcbcf_14__pyx_unpickle_VariantRecordFormat(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v___pyx_type, long __pyx_v___pyx_checksum, PyObject *__pyx_v___pyx_state); /* proto */
static PyObject *__pyx_pf_5pysam_7libcbcf_16__pyx_unpickle_VariantRecordInfo(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v___pyx_type, long __pyx_v___pyx_checksum, PyObject *__pyx_v___pyx_state); /* proto */
static PyObject *__pyx_pf_5pysam_7libcbcf_18__pyx_unpickle_VariantRecordSamples(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v___pyx_type, long __pyx_v___pyx_checksum, PyObject *__pyx_v___pyx_state); /* proto */
static PyObject *__pyx_pf_5pysam_7libcbcf_20__pyx_unpickle_VariantRecordSample(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v___pyx_type, long __pyx_v___pyx_checksum, PyObject *__pyx_v___pyx_state); /* proto */
static PyObject *__pyx_pf_5pysam_7libcbcf_22__pyx_unpickle_BaseIndex(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v___pyx_type, long __pyx_v___pyx_checksum, PyObject *__pyx_v___pyx_state); /* proto */
static PyObject *__pyx_tp_new_5pysam_7libcbcf_VariantHeader(PyTypeObject *t, PyObject *a, PyObject *k); /*proto*/
static PyObject *__pyx_tp_new_5pysam_7libcbcf_VariantHeaderRecord(PyTypeObject *t, PyObject *a, PyObject *k); /*proto*/
static PyObject *__pyx_tp_new_5pysam_7libcbcf_VariantHeaderRecords(PyTypeObject *t, PyObject *a, PyObject *k); /*proto*/
static PyObject *__pyx_tp_new_5pysam_7libcbcf_VariantHeaderContigs(PyTypeObject *t, PyObject *a, PyObject *k); /*proto*/
static PyObject *__pyx_tp_new_5pysam_7libcbcf_VariantHeaderSamples(PyTypeObject *t, PyObject *a, PyObject *k); /*proto*/
static PyObject *__pyx_tp_new_5pysam_7libcbcf_VariantContig(PyTypeObject *t, PyObject *a, PyObject *k); /*proto*/
static PyObject *__pyx_tp_new_5pysam_7libcbcf_VariantMetadata(PyTypeObject *t, PyObject *a, PyObject *k); /*proto*/
static PyObject *__pyx_tp_new_5pysam_7libcbcf_VariantHeaderMetadata(PyTypeObject *t, PyObject *a, PyObject *k); /*proto*/
static PyObject *__pyx_tp_new_5pysam_7libcbcf_VariantRecord(PyTypeObject *t, PyObject *a, PyObject *k); /*proto*/
static PyObject *__pyx_tp_new_5pysam_7libcbcf_VariantRecordFilter(PyTypeObject *t, PyObject *a, PyObject *k); /*proto*/
static PyObject *__pyx_tp_new_5pysam_7libcbcf_VariantRecordFormat(PyTypeObject *t, PyObject *a, PyObject *k); /*proto*/
static PyObject *__pyx_tp_new_5pysam_7libcbcf_VariantRecordInfo(PyTypeObject *t, PyObject *a, PyObject *k); /*proto*/
static PyObject *__pyx_tp_new_5pysam_7libcbcf_VariantRecordSamples(PyTypeObject *t, PyObject *a, PyObject *k); /*proto*/
static PyObject *__pyx_tp_new_5pysam_7libcbcf_VariantRecordSample(PyTypeObject *t, PyObject *a, PyObject *k); /*proto*/
static PyObject *__pyx_tp_new_5pysam_7libcbcf_BaseIndex(PyTypeObject *t, PyObject *a, PyObject *k); /*proto*/
static PyObject *__pyx_tp_new_5pysam_7libcbcf_BCFIndex(PyTypeObject *t, PyObject *a, PyObject *k); /*proto*/
static PyObject *__pyx_tp_new_5pysam_7libcbcf_BaseIterator(PyTypeObject *t, PyObject *a, PyObject *k); /*proto*/
static PyObject *__pyx_tp_new_5pysam_7libcbcf_BCFIterator(PyTypeObject *t, PyObject *a, PyObject *k); /*proto*/
static PyObject *__pyx_tp_new_5pysam_7libcbcf_TabixIterator(PyTypeObject *t, PyObject *a, PyObject *k); /*proto*/
static PyObject *__pyx_tp_new_5pysam_7libcbcf_VariantFile(PyTypeObject *t, PyObject *a, PyObject *k); /*proto*/
static PyObject *__pyx_tp_new_5pysam_7libcbcf___pyx_scope_struct____pyx_f_5pysam_7libcbcf_char_array_to_tuple(PyTypeObject *t, PyObject *a, PyObject *k); /*proto*/
static PyObject *__pyx_tp_new_5pysam_7libcbcf___pyx_scope_struct_1_genexpr(PyTypeObject *t, PyObject *a, PyObject *k); /*proto*/
static PyObject *__pyx_tp_new_5pysam_7libcbcf___pyx_scope_struct_2_genexpr(PyTypeObject *t, PyObject *a, PyObject *k); /*proto*/
static PyObject *__pyx_tp_new_5pysam_7libcbcf___pyx_scope_struct_3_genexpr(PyTypeObject *t, PyObject *a, PyObject *k); /*proto*/
static PyObject *__pyx_tp_new_5pysam_7libcbcf___pyx_scope_struct_4_genexpr(PyTypeObject *t, PyObject *a, PyObject *k); /*proto*/
static PyObject *__pyx_tp_new_5pysam_7libcbcf___pyx_scope_struct_5___get__(PyTypeObject *t, PyObject *a, PyObject *k); /*proto*/
static PyObject *__pyx_tp_new_5pysam_7libcbcf___pyx_scope_struct_6_genexpr(PyTypeObject *t, PyObject *a, PyObject *k); /*proto*/
static PyObject *__pyx_tp_new_5pysam_7libcbcf___pyx_scope_struct_7___iter__(PyTypeObject *t, PyObject *a, PyObject *k); /*proto*/
static PyObject *__pyx_tp_new_5pysam_7libcbcf___pyx_scope_struct_8_itervalues(PyTypeObject *t, PyObject *a, PyObject *k); /*proto*/
static PyObject *__pyx_tp_new_5pysam_7libcbcf___pyx_scope_struct_9_iteritems(PyTypeObject *t, PyObject *a, PyObject *k); /*proto*/
static PyObject *__pyx_tp_new_5pysam_7libcbcf___pyx_scope_struct_10___iter__(PyTypeObject *t, PyObject *a, PyObject *k); /*proto*/
static PyObject *__pyx_tp_new_5pysam_7libcbcf___pyx_scope_struct_11___iter__(PyTypeObject *t, PyObject *a, PyObject *k); /*proto*/
static PyObject *__pyx_tp_new_5pysam_7libcbcf___pyx_scope_struct_12_itervalues(PyTypeObject *t, PyObject *a, PyObject *k); /*proto*/
static PyObject *__pyx_tp_new_5pysam_7libcbcf___pyx_scope_struct_13_iteritems(PyTypeObject *t, PyObject *a, PyObject *k); /*proto*/
static PyObject *__pyx_tp_new_5pysam_7libcbcf___pyx_scope_struct_14___iter__(PyTypeObject *t, PyObject *a, PyObject *k); /*proto*/
static PyObject *__pyx_tp_new_5pysam_7libcbcf___pyx_scope_struct_15_itervalues(PyTypeObject *t, PyObject *a, PyObject *k); /*proto*/
static PyObject *__pyx_tp_new_5pysam_7libcbcf___pyx_scope_struct_16_iteritems(PyTypeObject *t, PyObject *a, PyObject *k); /*proto*/
static PyObject *__pyx_tp_new_5pysam_7libcbcf___pyx_scope_struct_17___iter__(PyTypeObject *t, PyObject *a, PyObject *k); /*proto*/
static PyObject *__pyx_tp_new_5pysam_7libcbcf___pyx_scope_struct_18___iter__(PyTypeObject *t, PyObject *a, PyObject *k); /*proto*/
static PyObject *__pyx_tp_new_5pysam_7libcbcf___pyx_scope_struct_19_itervalues(PyTypeObject *t, PyObject *a, PyObject *k); /*proto*/
static PyObject *__pyx_tp_new_5pysam_7libcbcf___pyx_scope_struct_20_iteritems(PyTypeObject *t, PyObject *a, PyObject *k); /*proto*/
static PyObject *__pyx_tp_new_5pysam_7libcbcf___pyx_scope_struct_21___iter__(PyTypeObject *t, PyObject *a, PyObject *k); /*proto*/
static PyObject *__pyx_tp_new_5pysam_7libcbcf___pyx_scope_struct_22_itervalues(PyTypeObject *t, PyObject *a, PyObject *k); /*proto*/
static PyObject *__pyx_tp_new_5pysam_7libcbcf___pyx_scope_struct_23_iteritems(PyTypeObject *t, PyObject *a, PyObject *k); /*proto*/
static PyObject *__pyx_tp_new_5pysam_7libcbcf___pyx_scope_struct_24___iter__(PyTypeObject *t, PyObject *a, PyObject *k); /*proto*/
static PyObject *__pyx_tp_new_5pysam_7libcbcf___pyx_scope_struct_25_itervalues(PyTypeObject *t, PyObject *a, PyObject *k); /*proto*/
static PyObject *__pyx_tp_new_5pysam_7libcbcf___pyx_scope_struct_26_iteritems(PyTypeObject *t, PyObject *a, PyObject *k); /*proto*/
static PyObject *__pyx_tp_new_5pysam_7libcbcf___pyx_scope_struct_27___iter__(PyTypeObject *t, PyObject *a, PyObject *k); /*proto*/
static PyObject *__pyx_tp_new_5pysam_7libcbcf___pyx_scope_struct_28_itervalues(PyTypeObject *t, PyObject *a, PyObject *k); /*proto*/
static PyObject *__pyx_tp_new_5pysam_7libcbcf___pyx_scope_struct_29_iteritems(PyTypeObject *t, PyObject *a, PyObject *k); /*proto*/
static PyObject *__pyx_tp_new_5pysam_7libcbcf___pyx_scope_struct_30___set__(PyTypeObject *t, PyObject *a, PyObject *k); /*proto*/
static PyObject *__pyx_tp_new_5pysam_7libcbcf___pyx_scope_struct_31_genexpr(PyTypeObject *t, PyObject *a, PyObject *k); /*proto*/
static PyObject *__pyx_tp_new_5pysam_7libcbcf___pyx_scope_struct_32_genexpr(PyTypeObject *t, PyObject *a, PyObject *k); /*proto*/
static PyObject *__pyx_tp_new_5pysam_7libcbcf___pyx_scope_struct_33___iter__(PyTypeObject *t, PyObject *a, PyObject *k); /*proto*/
static PyObject *__pyx_tp_new_5pysam_7libcbcf___pyx_scope_struct_34_itervalues(PyTypeObject *t, PyObject *a, PyObject *k); /*proto*/
static PyObject *__pyx_tp_new_5pysam_7libcbcf___pyx_scope_struct_35_iteritems(PyTypeObject *t, PyObject *a, PyObject *k); /*proto*/
static PyObject *__pyx_tp_new_5pysam_7libcbcf___pyx_scope_struct_36_itervalues(PyTypeObject *t, PyObject *a, PyObject *k); /*proto*/
static PyObject *__pyx_tp_new_5pysam_7libcbcf___pyx_scope_struct_37_iteritems(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;
  #ifdef __Pyx_CyFunction_USED
  PyTypeObject *__pyx_CyFunctionType;
  #endif
  #ifdef __Pyx_FusedFunction_USED
  PyTypeObject *__pyx_FusedFunctionType;
  #endif
  #ifdef __Pyx_Generator_USED
  PyTypeObject *__pyx_GeneratorType;
  #endif
  #ifdef __Pyx_IterableCoroutine_USED
  PyTypeObject *__pyx_IterableCoroutineType;
  #endif
  #ifdef __Pyx_Coroutine_USED
  PyTypeObject *__pyx_CoroutineAwaitType;
  #endif
  #ifdef __Pyx_Coroutine_USED
  PyTypeObject *__pyx_CoroutineType;
  #endif
  PyTypeObject *__pyx_ptype_5pysam_10libchtslib_HTSFile;
  PyTypeObject *__pyx_ptype_7cpython_4type_type;
  PyTypeObject *__pyx_ptype_7cpython_4bool_bool;
  PyTypeObject *__pyx_ptype_7cpython_7complex_complex;
  PyTypeObject *__pyx_ptype_7cpython_5array_array;
  PyObject *__pyx_type_5pysam_7libcbcf_VariantHeader;
  PyObject *__pyx_type_5pysam_7libcbcf_VariantHeaderRecord;
  PyObject *__pyx_type_5pysam_7libcbcf_VariantHeaderRecords;
  PyObject *__pyx_type_5pysam_7libcbcf_VariantHeaderContigs;
  PyObject *__pyx_type_5pysam_7libcbcf_VariantHeaderSamples;
  PyObject *__pyx_type_5pysam_7libcbcf_VariantContig;
  PyObject *__pyx_type_5pysam_7libcbcf_VariantMetadata;
  PyObject *__pyx_type_5pysam_7libcbcf_VariantHeaderMetadata;
  PyObject *__pyx_type_5pysam_7libcbcf_VariantRecord;
  PyObject *__pyx_type_5pysam_7libcbcf_VariantRecordFilter;
  PyObject *__pyx_type_5pysam_7libcbcf_VariantRecordFormat;
  PyObject *__pyx_type_5pysam_7libcbcf_VariantRecordInfo;
  PyObject *__pyx_type_5pysam_7libcbcf_VariantRecordSamples;
  PyObject *__pyx_type_5pysam_7libcbcf_VariantRecordSample;
  PyObject *__pyx_type_5pysam_7libcbcf_BaseIndex;
  PyObject *__pyx_type_5pysam_7libcbcf_BCFIndex;
  PyObject *__pyx_type_5pysam_7libcbcf_TabixIndex;
  PyObject *__pyx_type_5pysam_7libcbcf_BaseIterator;
  PyObject *__pyx_type_5pysam_7libcbcf_BCFIterator;
  PyObject *__pyx_type_5pysam_7libcbcf_TabixIterator;
  PyObject *__pyx_type_5pysam_7libcbcf_VariantFile;
  PyObject *__pyx_type_5pysam_7libcbcf___pyx_scope_struct____pyx_f_5pysam_7libcbcf_char_array_to_tuple;
  PyObject *__pyx_type_5pysam_7libcbcf___pyx_scope_struct_1_genexpr;
  PyObject *__pyx_type_5pysam_7libcbcf___pyx_scope_struct_2_genexpr;
  PyObject *__pyx_type_5pysam_7libcbcf___pyx_scope_struct_3_genexpr;
  PyObject *__pyx_type_5pysam_7libcbcf___pyx_scope_struct_4_genexpr;
  PyObject *__pyx_type_5pysam_7libcbcf___pyx_scope_struct_5___get__;
  PyObject *__pyx_type_5pysam_7libcbcf___pyx_scope_struct_6_genexpr;
  PyObject *__pyx_type_5pysam_7libcbcf___pyx_scope_struct_7___iter__;
  PyObject *__pyx_type_5pysam_7libcbcf___pyx_scope_struct_8_itervalues;
  PyObject *__pyx_type_5pysam_7libcbcf___pyx_scope_struct_9_iteritems;
  PyObject *__pyx_type_5pysam_7libcbcf___pyx_scope_struct_10___iter__;
  PyObject *__pyx_type_5pysam_7libcbcf___pyx_scope_struct_11___iter__;
  PyObject *__pyx_type_5pysam_7libcbcf___pyx_scope_struct_12_itervalues;
  PyObject *__pyx_type_5pysam_7libcbcf___pyx_scope_struct_13_iteritems;
  PyObject *__pyx_type_5pysam_7libcbcf___pyx_scope_struct_14___iter__;
  PyObject *__pyx_type_5pysam_7libcbcf___pyx_scope_struct_15_itervalues;
  PyObject *__pyx_type_5pysam_7libcbcf___pyx_scope_struct_16_iteritems;
  PyObject *__pyx_type_5pysam_7libcbcf___pyx_scope_struct_17___iter__;
  PyObject *__pyx_type_5pysam_7libcbcf___pyx_scope_struct_18___iter__;
  PyObject *__pyx_type_5pysam_7libcbcf___pyx_scope_struct_19_itervalues;
  PyObject *__pyx_type_5pysam_7libcbcf___pyx_scope_struct_20_iteritems;
  PyObject *__pyx_type_5pysam_7libcbcf___pyx_scope_struct_21___iter__;
  PyObject *__pyx_type_5pysam_7libcbcf___pyx_scope_struct_22_itervalues;
  PyObject *__pyx_type_5pysam_7libcbcf___pyx_scope_struct_23_iteritems;
  PyObject *__pyx_type_5pysam_7libcbcf___pyx_scope_struct_24___iter__;
  PyObject *__pyx_type_5pysam_7libcbcf___pyx_scope_struct_25_itervalues;
  PyObject *__pyx_type_5pysam_7libcbcf___pyx_scope_struct_26_iteritems;
  PyObject *__pyx_type_5pysam_7libcbcf___pyx_scope_struct_27___iter__;
  PyObject *__pyx_type_5pysam_7libcbcf___pyx_scope_struct_28_itervalues;
  PyObject *__pyx_type_5pysam_7libcbcf___pyx_scope_struct_29_iteritems;
  PyObject *__pyx_type_5pysam_7libcbcf___pyx_scope_struct_30___set__;
  PyObject *__pyx_type_5pysam_7libcbcf___pyx_scope_struct_31_genexpr;
  PyObject *__pyx_type_5pysam_7libcbcf___pyx_scope_struct_32_genexpr;
  PyObject *__pyx_type_5pysam_7libcbcf___pyx_scope_struct_33___iter__;
  PyObject *__pyx_type_5pysam_7libcbcf___pyx_scope_struct_34_itervalues;
  PyObject *__pyx_type_5pysam_7libcbcf___pyx_scope_struct_35_iteritems;
  PyObject *__pyx_type_5pysam_7libcbcf___pyx_scope_struct_36_itervalues;
  PyObject *__pyx_type_5pysam_7libcbcf___pyx_scope_struct_37_iteritems;
  PyTypeObject *__pyx_ptype_5pysam_7libcbcf_VariantHeader;
  PyTypeObject *__pyx_ptype_5pysam_7libcbcf_VariantHeaderRecord;
  PyTypeObject *__pyx_ptype_5pysam_7libcbcf_VariantHeaderRecords;
  PyTypeObject *__pyx_ptype_5pysam_7libcbcf_VariantHeaderContigs;
  PyTypeObject *__pyx_ptype_5pysam_7libcbcf_VariantHeaderSamples;
  PyTypeObject *__pyx_ptype_5pysam_7libcbcf_VariantContig;
  PyTypeObject *__pyx_ptype_5pysam_7libcbcf_VariantMetadata;
  PyTypeObject *__pyx_ptype_5pysam_7libcbcf_VariantHeaderMetadata;
  PyTypeObject *__pyx_ptype_5pysam_7libcbcf_VariantRecord;
  PyTypeObject *__pyx_ptype_5pysam_7libcbcf_VariantRecordFilter;
  PyTypeObject *__pyx_ptype_5pysam_7libcbcf_VariantRecordFormat;
  PyTypeObject *__pyx_ptype_5pysam_7libcbcf_VariantRecordInfo;
  PyTypeObject *__pyx_ptype_5pysam_7libcbcf_VariantRecordSamples;
  PyTypeObject *__pyx_ptype_5pysam_7libcbcf_VariantRecordSample;
  PyTypeObject *__pyx_ptype_5pysam_7libcbcf_BaseIndex;
  PyTypeObject *__pyx_ptype_5pysam_7libcbcf_BCFIndex;
  PyTypeObject *__pyx_ptype_5pysam_7libcbcf_TabixIndex;
  PyTypeObject *__pyx_ptype_5pysam_7libcbcf_BaseIterator;
  PyTypeObject *__pyx_ptype_5pysam_7libcbcf_BCFIterator;
  PyTypeObject *__pyx_ptype_5pysam_7libcbcf_TabixIterator;
  PyTypeObject *__pyx_ptype_5pysam_7libcbcf_VariantFile;
  PyTypeObject *__pyx_ptype_5pysam_7libcbcf___pyx_scope_struct____pyx_f_5pysam_7libcbcf_char_array_to_tuple;
  PyTypeObject *__pyx_ptype_5pysam_7libcbcf___pyx_scope_struct_1_genexpr;
  PyTypeObject *__pyx_ptype_5pysam_7libcbcf___pyx_scope_struct_2_genexpr;
  PyTypeObject *__pyx_ptype_5pysam_7libcbcf___pyx_scope_struct_3_genexpr;
  PyTypeObject *__pyx_ptype_5pysam_7libcbcf___pyx_scope_struct_4_genexpr;
  PyTypeObject *__pyx_ptype_5pysam_7libcbcf___pyx_scope_struct_5___get__;
  PyTypeObject *__pyx_ptype_5pysam_7libcbcf___pyx_scope_struct_6_genexpr;
  PyTypeObject *__pyx_ptype_5pysam_7libcbcf___pyx_scope_struct_7___iter__;
  PyTypeObject *__pyx_ptype_5pysam_7libcbcf___pyx_scope_struct_8_itervalues;
  PyTypeObject *__pyx_ptype_5pysam_7libcbcf___pyx_scope_struct_9_iteritems;
  PyTypeObject *__pyx_ptype_5pysam_7libcbcf___pyx_scope_struct_10___iter__;
  PyTypeObject *__pyx_ptype_5pysam_7libcbcf___pyx_scope_struct_11___iter__;
  PyTypeObject *__pyx_ptype_5pysam_7libcbcf___pyx_scope_struct_12_itervalues;
  PyTypeObject *__pyx_ptype_5pysam_7libcbcf___pyx_scope_struct_13_iteritems;
  PyTypeObject *__pyx_ptype_5pysam_7libcbcf___pyx_scope_struct_14___iter__;
  PyTypeObject *__pyx_ptype_5pysam_7libcbcf___pyx_scope_struct_15_itervalues;
  PyTypeObject *__pyx_ptype_5pysam_7libcbcf___pyx_scope_struct_16_iteritems;
  PyTypeObject *__pyx_ptype_5pysam_7libcbcf___pyx_scope_struct_17___iter__;
  PyTypeObject *__pyx_ptype_5pysam_7libcbcf___pyx_scope_struct_18___iter__;
  PyTypeObject *__pyx_ptype_5pysam_7libcbcf___pyx_scope_struct_19_itervalues;
  PyTypeObject *__pyx_ptype_5pysam_7libcbcf___pyx_scope_struct_20_iteritems;
  PyTypeObject *__pyx_ptype_5pysam_7libcbcf___pyx_scope_struct_21___iter__;
  PyTypeObject *__pyx_ptype_5pysam_7libcbcf___pyx_scope_struct_22_itervalues;
  PyTypeObject *__pyx_ptype_5pysam_7libcbcf___pyx_scope_struct_23_iteritems;
  PyTypeObject *__pyx_ptype_5pysam_7libcbcf___pyx_scope_struct_24___iter__;
  PyTypeObject *__pyx_ptype_5pysam_7libcbcf___pyx_scope_struct_25_itervalues;
  PyTypeObject *__pyx_ptype_5pysam_7libcbcf___pyx_scope_struct_26_iteritems;
  PyTypeObject *__pyx_ptype_5pysam_7libcbcf___pyx_scope_struct_27___iter__;
  PyTypeObject *__pyx_ptype_5pysam_7libcbcf___pyx_scope_struct_28_itervalues;
  PyTypeObject *__pyx_ptype_5pysam_7libcbcf___pyx_scope_struct_29_iteritems;
  PyTypeObject *__pyx_ptype_5pysam_7libcbcf___pyx_scope_struct_30___set__;
  PyTypeObject *__pyx_ptype_5pysam_7libcbcf___pyx_scope_struct_31_genexpr;
  PyTypeObject *__pyx_ptype_5pysam_7libcbcf___pyx_scope_struct_32_genexpr;
  PyTypeObject *__pyx_ptype_5pysam_7libcbcf___pyx_scope_struct_33___iter__;
  PyTypeObject *__pyx_ptype_5pysam_7libcbcf___pyx_scope_struct_34_itervalues;
  PyTypeObject *__pyx_ptype_5pysam_7libcbcf___pyx_scope_struct_35_iteritems;
  PyTypeObject *__pyx_ptype_5pysam_7libcbcf___pyx_scope_struct_36_itervalues;
  PyTypeObject *__pyx_ptype_5pysam_7libcbcf___pyx_scope_struct_37_iteritems;
  __Pyx_CachedCFunction __pyx_umethod_PyDict_Type_items;
  __Pyx_CachedCFunction __pyx_umethod_PyDict_Type_pop;
  __Pyx_CachedCFunction __pyx_umethod_PyBytes_Type__split;
  __Pyx_CachedCFunction __pyx_umethod_PyUnicode_Type__format;
  PyObject *__pyx_k__3;
  PyObject *__pyx_k__6;
  PyObject *__pyx_k__7;
  PyObject *__pyx_k__9;
  PyObject *__pyx_k__10;
  PyObject *__pyx_slice[1];
  PyObject *__pyx_tuple[15];
  PyObject *__pyx_codeobj_tab[412];
  PyObject *__pyx_string_tab[716];
  PyObject *__pyx_int_0;
  PyObject *__pyx_int_1;
  PyObject *__pyx_int_2;
  PyObject *__pyx_int_10091417;
  PyObject *__pyx_int_10698032;
  PyObject *__pyx_int_31479882;
  PyObject *__pyx_int_33440904;
  PyObject *__pyx_int_39264352;
  PyObject *__pyx_int_41264896;
  PyObject *__pyx_int_93650198;
  PyObject *__pyx_int_94171383;
  PyObject *__pyx_int_97976187;
  PyObject *__pyx_int_118286449;
  PyObject *__pyx_int_126454353;
  PyObject *__pyx_int_135711299;
  PyObject *__pyx_int_145625440;
  PyObject *__pyx_int_164668780;
  PyObject *__pyx_int_168021462;
  PyObject *__pyx_int_199651019;
  PyObject *__pyx_int_215036767;
  PyObject *__pyx_int_227765731;
  PyObject *__pyx_int_232881935;
  PyObject *__pyx_int_248899179;
  PyObject *__pyx_int_250317299;
  PyObject *__pyx_int_4294967294;
  PyObject *__pyx_int_neg_1;
/* #### Code section: module_state_contents ### */

#if CYTHON_USE_FREELISTS
struct __pyx_obj_5pysam_7libcbcf___pyx_scope_struct____pyx_f_5pysam_7libcbcf_char_array_to_tuple *__pyx_freelist_5pysam_7libcbcf___pyx_scope_struct____pyx_f_5pysam_7libcbcf_char_array_to_tuple[8];
int __pyx_freecount_5pysam_7libcbcf___pyx_scope_struct____pyx_f_5pysam_7libcbcf_char_array_to_tuple;
#endif

#if CYTHON_USE_FREELISTS
struct __pyx_obj_5pysam_7libcbcf___pyx_scope_struct_1_genexpr *__pyx_freelist_5pysam_7libcbcf___pyx_scope_struct_1_genexpr[8];
int __pyx_freecount_5pysam_7libcbcf___pyx_scope_struct_1_genexpr;
#endif

#if CYTHON_USE_FREELISTS
struct __pyx_obj_5pysam_7libcbcf___pyx_scope_struct_2_genexpr *__pyx_freelist_5pysam_7libcbcf___pyx_scope_struct_2_genexpr[8];
int __pyx_freecount_5pysam_7libcbcf___pyx_scope_struct_2_genexpr;
#endif

#if CYTHON_USE_FREELISTS
struct __pyx_obj_5pysam_7libcbcf___pyx_scope_struct_3_genexpr *__pyx_freelist_5pysam_7libcbcf___pyx_scope_struct_3_genexpr[8];
int __pyx_freecount_5pysam_7libcbcf___pyx_scope_struct_3_genexpr;
#endif

#if CYTHON_USE_FREELISTS
struct __pyx_obj_5pysam_7libcbcf___pyx_scope_struct_4_genexpr *__pyx_freelist_5pysam_7libcbcf___pyx_scope_struct_4_genexpr[8];
int __pyx_freecount_5pysam_7libcbcf___pyx_scope_struct_4_genexpr;
#endif

#if CYTHON_USE_FREELISTS
struct __pyx_obj_5pysam_7libcbcf___pyx_scope_struct_5___get__ *__pyx_freelist_5pysam_7libcbcf___pyx_scope_struct_5___get__[8];
int __pyx_freecount_5pysam_7libcbcf___pyx_scope_struct_5___get__;
#endif

#if CYTHON_USE_FREELISTS
struct __pyx_obj_5pysam_7libcbcf___pyx_scope_struct_6_genexpr *__pyx_freelist_5pysam_7libcbcf___pyx_scope_struct_6_genexpr[8];
int __pyx_freecount_5pysam_7libcbcf___pyx_scope_struct_6_genexpr;
#endif

#if CYTHON_USE_FREELISTS
struct __pyx_obj_5pysam_7libcbcf___pyx_scope_struct_7___iter__ *__pyx_freelist_5pysam_7libcbcf___pyx_scope_struct_7___iter__[8];
int __pyx_freecount_5pysam_7libcbcf___pyx_scope_struct_7___iter__;
#endif

#if CYTHON_USE_FREELISTS
struct __pyx_obj_5pysam_7libcbcf___pyx_scope_struct_8_itervalues *__pyx_freelist_5pysam_7libcbcf___pyx_scope_struct_8_itervalues[8];
int __pyx_freecount_5pysam_7libcbcf___pyx_scope_struct_8_itervalues;
#endif

#if CYTHON_USE_FREELISTS
struct __pyx_obj_5pysam_7libcbcf___pyx_scope_struct_9_iteritems *__pyx_freelist_5pysam_7libcbcf___pyx_scope_struct_9_iteritems[8];
int __pyx_freecount_5pysam_7libcbcf___pyx_scope_struct_9_iteritems;
#endif

#if CYTHON_USE_FREELISTS
struct __pyx_obj_5pysam_7libcbcf___pyx_scope_struct_10___iter__ *__pyx_freelist_5pysam_7libcbcf___pyx_scope_struct_10___iter__[8];
int __pyx_freecount_5pysam_7libcbcf___pyx_scope_struct_10___iter__;
#endif

#if CYTHON_USE_FREELISTS
struct __pyx_obj_5pysam_7libcbcf___pyx_scope_struct_11___iter__ *__pyx_freelist_5pysam_7libcbcf___pyx_scope_struct_11___iter__[8];
int __pyx_freecount_5pysam_7libcbcf___pyx_scope_struct_11___iter__;
#endif

#if CYTHON_USE_FREELISTS
struct __pyx_obj_5pysam_7libcbcf___pyx_scope_struct_12_itervalues *__pyx_freelist_5pysam_7libcbcf___pyx_scope_struct_12_itervalues[8];
int __pyx_freecount_5pysam_7libcbcf___pyx_scope_struct_12_itervalues;
#endif

#if CYTHON_USE_FREELISTS
struct __pyx_obj_5pysam_7libcbcf___pyx_scope_struct_13_iteritems *__pyx_freelist_5pysam_7libcbcf___pyx_scope_struct_13_iteritems[8];
int __pyx_freecount_5pysam_7libcbcf___pyx_scope_struct_13_iteritems;
#endif

#if CYTHON_USE_FREELISTS
struct __pyx_obj_5pysam_7libcbcf___pyx_scope_struct_14___iter__ *__pyx_freelist_5pysam_7libcbcf___pyx_scope_struct_14___iter__[8];
int __pyx_freecount_5pysam_7libcbcf___pyx_scope_struct_14___iter__;
#endif

#if CYTHON_USE_FREELISTS
struct __pyx_obj_5pysam_7libcbcf___pyx_scope_struct_15_itervalues *__pyx_freelist_5pysam_7libcbcf___pyx_scope_struct_15_itervalues[8];
int __pyx_freecount_5pysam_7libcbcf___pyx_scope_struct_15_itervalues;
#endif

#if CYTHON_USE_FREELISTS
struct __pyx_obj_5pysam_7libcbcf___pyx_scope_struct_16_iteritems *__pyx_freelist_5pysam_7libcbcf___pyx_scope_struct_16_iteritems[8];
int __pyx_freecount_5pysam_7libcbcf___pyx_scope_struct_16_iteritems;
#endif

#if CYTHON_USE_FREELISTS
struct __pyx_obj_5pysam_7libcbcf___pyx_scope_struct_17___iter__ *__pyx_freelist_5pysam_7libcbcf___pyx_scope_struct_17___iter__[8];
int __pyx_freecount_5pysam_7libcbcf___pyx_scope_struct_17___iter__;
#endif

#if CYTHON_USE_FREELISTS
struct __pyx_obj_5pysam_7libcbcf___pyx_scope_struct_18___iter__ *__pyx_freelist_5pysam_7libcbcf___pyx_scope_struct_18___iter__[8];
int __pyx_freecount_5pysam_7libcbcf___pyx_scope_struct_18___iter__;
#endif

#if CYTHON_USE_FREELISTS
struct __pyx_obj_5pysam_7libcbcf___pyx_scope_struct_19_itervalues *__pyx_freelist_5pysam_7libcbcf___pyx_scope_struct_19_itervalues[8];
int __pyx_freecount_5pysam_7libcbcf___pyx_scope_struct_19_itervalues;
#endif

#if CYTHON_USE_FREELISTS
struct __pyx_obj_5pysam_7libcbcf___pyx_scope_struct_20_iteritems *__pyx_freelist_5pysam_7libcbcf___pyx_scope_struct_20_iteritems[8];
int __pyx_freecount_5pysam_7libcbcf___pyx_scope_struct_20_iteritems;
#endif

#if CYTHON_USE_FREELISTS
struct __pyx_obj_5pysam_7libcbcf___pyx_scope_struct_21___iter__ *__pyx_freelist_5pysam_7libcbcf___pyx_scope_struct_21___iter__[8];
int __pyx_freecount_5pysam_7libcbcf___pyx_scope_struct_21___iter__;
#endif

#if CYTHON_USE_FREELISTS
struct __pyx_obj_5pysam_7libcbcf___pyx_scope_struct_22_itervalues *__pyx_freelist_5pysam_7libcbcf___pyx_scope_struct_22_itervalues[8];
int __pyx_freecount_5pysam_7libcbcf___pyx_scope_struct_22_itervalues;
#endif

#if CYTHON_USE_FREELISTS
struct __pyx_obj_5pysam_7libcbcf___pyx_scope_struct_23_iteritems *__pyx_freelist_5pysam_7libcbcf___pyx_scope_struct_23_iteritems[8];
int __pyx_freecount_5pysam_7libcbcf___pyx_scope_struct_23_iteritems;
#endif

#if CYTHON_USE_FREELISTS
struct __pyx_obj_5pysam_7libcbcf___pyx_scope_struct_24___iter__ *__pyx_freelist_5pysam_7libcbcf___pyx_scope_struct_24___iter__[8];
int __pyx_freecount_5pysam_7libcbcf___pyx_scope_struct_24___iter__;
#endif

#if CYTHON_USE_FREELISTS
struct __pyx_obj_5pysam_7libcbcf___pyx_scope_struct_25_itervalues *__pyx_freelist_5pysam_7libcbcf___pyx_scope_struct_25_itervalues[8];
int __pyx_freecount_5pysam_7libcbcf___pyx_scope_struct_25_itervalues;
#endif

#if CYTHON_USE_FREELISTS
struct __pyx_obj_5pysam_7libcbcf___pyx_scope_struct_26_iteritems *__pyx_freelist_5pysam_7libcbcf___pyx_scope_struct_26_iteritems[8];
int __pyx_freecount_5pysam_7libcbcf___pyx_scope_struct_26_iteritems;
#endif

#if CYTHON_USE_FREELISTS
struct __pyx_obj_5pysam_7libcbcf___pyx_scope_struct_27___iter__ *__pyx_freelist_5pysam_7libcbcf___pyx_scope_struct_27___iter__[8];
int __pyx_freecount_5pysam_7libcbcf___pyx_scope_struct_27___iter__;
#endif

#if CYTHON_USE_FREELISTS
struct __pyx_obj_5pysam_7libcbcf___pyx_scope_struct_28_itervalues *__pyx_freelist_5pysam_7libcbcf___pyx_scope_struct_28_itervalues[8];
int __pyx_freecount_5pysam_7libcbcf___pyx_scope_struct_28_itervalues;
#endif

#if CYTHON_USE_FREELISTS
struct __pyx_obj_5pysam_7libcbcf___pyx_scope_struct_29_iteritems *__pyx_freelist_5pysam_7libcbcf___pyx_scope_struct_29_iteritems[8];
int __pyx_freecount_5pysam_7libcbcf___pyx_scope_struct_29_iteritems;
#endif

#if CYTHON_USE_FREELISTS
struct __pyx_obj_5pysam_7libcbcf___pyx_scope_struct_30___set__ *__pyx_freelist_5pysam_7libcbcf___pyx_scope_struct_30___set__[8];
int __pyx_freecount_5pysam_7libcbcf___pyx_scope_struct_30___set__;
#endif

#if CYTHON_USE_FREELISTS
struct __pyx_obj_5pysam_7libcbcf___pyx_scope_struct_31_genexpr *__pyx_freelist_5pysam_7libcbcf___pyx_scope_struct_31_genexpr[8];
int __pyx_freecount_5pysam_7libcbcf___pyx_scope_struct_31_genexpr;
#endif

#if CYTHON_USE_FREELISTS
struct __pyx_obj_5pysam_7libcbcf___pyx_scope_struct_32_genexpr *__pyx_freelist_5pysam_7libcbcf___pyx_scope_struct_32_genexpr[8];
int __pyx_freecount_5pysam_7libcbcf___pyx_scope_struct_32_genexpr;
#endif

#if CYTHON_USE_FREELISTS
struct __pyx_obj_5pysam_7libcbcf___pyx_scope_struct_33___iter__ *__pyx_freelist_5pysam_7libcbcf___pyx_scope_struct_33___iter__[8];
int __pyx_freecount_5pysam_7libcbcf___pyx_scope_struct_33___iter__;
#endif

#if CYTHON_USE_FREELISTS
struct __pyx_obj_5pysam_7libcbcf___pyx_scope_struct_34_itervalues *__pyx_freelist_5pysam_7libcbcf___pyx_scope_struct_34_itervalues[8];
int __pyx_freecount_5pysam_7libcbcf___pyx_scope_struct_34_itervalues;
#endif

#if CYTHON_USE_FREELISTS
struct __pyx_obj_5pysam_7libcbcf___pyx_scope_struct_35_iteritems *__pyx_freelist_5pysam_7libcbcf___pyx_scope_struct_35_iteritems[8];
int __pyx_freecount_5pysam_7libcbcf___pyx_scope_struct_35_iteritems;
#endif

#if CYTHON_USE_FREELISTS
struct __pyx_obj_5pysam_7libcbcf___pyx_scope_struct_36_itervalues *__pyx_freelist_5pysam_7libcbcf___pyx_scope_struct_36_itervalues[8];
int __pyx_freecount_5pysam_7libcbcf___pyx_scope_struct_36_itervalues;
#endif

#if CYTHON_USE_FREELISTS
struct __pyx_obj_5pysam_7libcbcf___pyx_scope_struct_37_iteritems *__pyx_freelist_5pysam_7libcbcf___pyx_scope_struct_37_iteritems[8];
int __pyx_freecount_5pysam_7libcbcf___pyx_scope_struct_37_iteritems;
#endif
/* CommonTypesMetaclass.module_state_decls */
PyTypeObject *__pyx_CommonTypesMetaclassType;

/* CachedMethodType.module_state_decls */
#if CYTHON_COMPILING_IN_LIMITED_API
PyObject *__Pyx_CachedMethodType;
#endif

/* CodeObjectCache.module_state_decls */
struct __Pyx_CodeObjectCache __pyx_code_cache;

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

/* #### 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_b_ __pyx_string_tab[0]
#define __pyx_kp_u_ __pyx_string_tab[1]
#define __pyx_n_u_A __pyx_string_tab[2]
#define __pyx_n_u_ALT __pyx_string_tab[3]
#define __pyx_n_u_AssertionError __pyx_string_tab[4]
#define __pyx_n_u_BCFIndex __pyx_string_tab[5]
#define __pyx_n_u_BCFIndex___reduce_cython __pyx_string_tab[6]
#define __pyx_n_u_BCFIndex___setstate_cython __pyx_string_tab[7]
#define __pyx_n_u_BCFIndex_fetch __pyx_string_tab[8]
#define __pyx_n_u_BCFIterator __pyx_string_tab[9]
#define __pyx_n_u_BCFIterator___reduce_cython __pyx_string_tab[10]
#define __pyx_n_u_BCFIterator___setstate_cython __pyx_string_tab[11]
#define __pyx_n_u_BND __pyx_string_tab[12]
#define __pyx_n_u_BaseIndex __pyx_string_tab[13]
#define __pyx_n_u_BaseIndex___reduce_cython __pyx_string_tab[14]
#define __pyx_n_u_BaseIndex___setstate_cython __pyx_string_tab[15]
#define __pyx_n_u_BaseIndex_get __pyx_string_tab[16]
#define __pyx_n_u_BaseIndex_items __pyx_string_tab[17]
#define __pyx_n_u_BaseIndex_iteritems __pyx_string_tab[18]
#define __pyx_n_u_BaseIndex_iterkeys __pyx_string_tab[19]
#define __pyx_n_u_BaseIndex_itervalues __pyx_string_tab[20]
#define __pyx_n_u_BaseIndex_keys __pyx_string_tab[21]
#define __pyx_n_u_BaseIndex_pop __pyx_string_tab[22]
#define __pyx_n_u_BaseIndex_update __pyx_string_tab[23]
#define __pyx_n_u_BaseIndex_values __pyx_string_tab[24]
#define __pyx_n_u_BaseIterator __pyx_string_tab[25]
#define __pyx_n_u_BaseIterator___reduce_cython __pyx_string_tab[26]
#define __pyx_n_u_BaseIterator___setstate_cython __pyx_string_tab[27]
#define __pyx_n_u_CONTIG __pyx_string_tab[28]
#define __pyx_kp_u_Can_t_write_headers __pyx_string_tab[29]
#define __pyx_kp_u_Can_t_write_record __pyx_string_tab[30]
#define __pyx_kp_u_Cannot_add_extra_threads_when_ig __pyx_string_tab[31]
#define __pyx_kp_u_Cannot_copy_arrays_with_src_valu __pyx_string_tab[32]
#define __pyx_kp_u_Cannot_create_empty_array __pyx_string_tab[33]
#define __pyx_kp_u_Cannot_re_open_htsfile __pyx_string_tab[34]
#define __pyx_kp_u_Cannot_set_phased_before_genotyp __pyx_string_tab[35]
#define __pyx_kp_u_Cannot_specify_an_index_filename __pyx_string_tab[36]
#define __pyx_kp_u_Cannot_translate_record_Number_o __pyx_string_tab[37]
#define __pyx_kp_u_Closing_failed __pyx_string_tab[38]
#define __pyx_kp_u_Could_not_allocate_VCF_header_re __pyx_string_tab[39]
#define __pyx_kp_u_Could_not_open_variant_file __pyx_string_tab[40]
#define __pyx_n_u_Description __pyx_string_tab[41]
#define __pyx_kp_u_Duplicated_sample_name __pyx_string_tab[42]
#define __pyx_n_b_END __pyx_string_tab[43]
#define __pyx_n_u_END __pyx_string_tab[44]
#define __pyx_kp_u_END_is_a_reserved_attribute_acce __pyx_string_tab[45]
#define __pyx_kp_u_Error_extracting_ID __pyx_string_tab[46]
#define __pyx_kp_u_Error_s_reading_record __pyx_string_tab[47]
#define __pyx_kp_u_Error_unpacking_VariantRecord __pyx_string_tab[48]
#define __pyx_kp_u_Error_updating_alleles __pyx_string_tab[49]
#define __pyx_kp_u_Error_updating_id __pyx_string_tab[50]
#define __pyx_n_u_FILTER __pyx_string_tab[51]
#define __pyx_n_u_FIXED __pyx_string_tab[52]
#define __pyx_n_u_FORMAT __pyx_string_tab[53]
#define __pyx_n_u_Flag __pyx_string_tab[54]
#define __pyx_kp_u_Flag_types_are_not_allowed_on_FO __pyx_string_tab[55]
#define __pyx_kp_u_Flag_values_must_be_True_False_N __pyx_string_tab[56]
#define __pyx_n_u_Float __pyx_string_tab[57]
#define __pyx_n_u_G __pyx_string_tab[58]
#define __pyx_n_u_GENERIC __pyx_string_tab[59]
#define __pyx_n_u_GT __pyx_string_tab[60]
#define __pyx_kp_u_Header_already_exists_for_contig __pyx_string_tab[61]
#define __pyx_kp_u_Header_already_exists_for_id __pyx_string_tab[62]
#define __pyx_n_u_ID __pyx_string_tab[63]
#define __pyx_n_u_INDEL __pyx_string_tab[64]
#define __pyx_n_u_INFO __pyx_string_tab[65]
#define __pyx_n_u_IOError __pyx_string_tab[66]
#define __pyx_kp_u_I_O_operation_on_closed_file __pyx_string_tab[67]
#define __pyx_kp_u_Incompatible_checksums_0x_x_vs_0 __pyx_string_tab[68]
#define __pyx_kp_u_Incompatible_checksums_0x_x_vs_0_2 __pyx_string_tab[69]
#define __pyx_kp_u_Incompatible_checksums_0x_x_vs_0_3 __pyx_string_tab[70]
#define __pyx_kp_u_Incompatible_checksums_0x_x_vs_0_4 __pyx_string_tab[71]
#define __pyx_kp_u_Incompatible_checksums_0x_x_vs_0_5 __pyx_string_tab[72]
#define __pyx_kp_u_Incompatible_checksums_0x_x_vs_0_6 __pyx_string_tab[73]
#define __pyx_kp_u_Incompatible_checksums_0x_x_vs_0_7 __pyx_string_tab[74]
#define __pyx_n_u_IndexError __pyx_string_tab[75]
#define __pyx_n_u_Integer __pyx_string_tab[76]
#define __pyx_kp_u_Integer_value_too_small_large_to __pyx_string_tab[77]
#define __pyx_kp_u_Invalid_INFO_field __pyx_string_tab[78]
#define __pyx_kp_u_Invalid_VariantRecord_Number_of __pyx_string_tab[79]
#define __pyx_kp_u_Invalid_allele_index __pyx_string_tab[80]
#define __pyx_kp_u_Invalid_chromosome_contig __pyx_string_tab[81]
#define __pyx_kp_u_Invalid_filter __pyx_string_tab[82]
#define __pyx_kp_u_Invalid_header __pyx_string_tab[83]
#define __pyx_kp_u_Invalid_header_id __pyx_string_tab[84]
#define __pyx_kp_u_Invalid_header_record_index __pyx_string_tab[85]
#define __pyx_kp_u_Invalid_index_object __pyx_string_tab[86]
#define __pyx_kp_u_Invalid_tid __pyx_string_tab[87]
#define __pyx_n_u_KeyError __pyx_string_tab[88]
#define __pyx_n_u_MAX_POS __pyx_string_tab[89]
#define __pyx_n_u_METADATA_LENGTHS __pyx_string_tab[90]
#define __pyx_n_u_METADATA_TYPES __pyx_string_tab[91]
#define __pyx_n_u_MNP __pyx_string_tab[92]
#define __pyx_n_u_MemoryError __pyx_string_tab[93]
#define __pyx_kp_u_NON_REF __pyx_string_tab[94]
#define __pyx_n_u_NotImplemented __pyx_string_tab[95]
#define __pyx_kp_u_Note_that_Cython_is_deliberately __pyx_string_tab[96]
#define __pyx_n_u_Number __pyx_string_tab[97]
#define __pyx_kp_u_Number_must_be_None_when_adding __pyx_string_tab[98]
#define __pyx_n_u_OTHER __pyx_string_tab[99]
#define __pyx_n_u_OVERLAP __pyx_string_tab[100]
#define __pyx_kp_u_One_or_more_of_the_supplied_samp __pyx_string_tab[101]
#define __pyx_n_u_PASS __pyx_string_tab[102]
#define __pyx_n_u_PickleError __pyx_string_tab[103]
#define __pyx_kp_u_Position_must_be_positive __pyx_string_tab[104]
#define __pyx_n_u_R __pyx_string_tab[105]
#define __pyx_n_u_REF __pyx_string_tab[106]
#define __pyx_n_u_SNP __pyx_string_tab[107]
#define __pyx_n_u_STRUCTURED __pyx_string_tab[108]
#define __pyx_kp_u_Start_coordinate_must_be_non_neg __pyx_string_tab[109]
#define __pyx_n_u_StopIteration __pyx_string_tab[110]
#define __pyx_kp_u_Stop_coordinate_must_be_non_nega __pyx_string_tab[111]
#define __pyx_kp_u_Stop_position_of_the_interval __pyx_string_tab[112]
#define __pyx_n_u_String __pyx_string_tab[113]
#define __pyx_n_u_TabixIndex __pyx_string_tab[114]
#define __pyx_n_u_TabixIndex___reduce_cython __pyx_string_tab[115]
#define __pyx_n_u_TabixIndex___setstate_cython __pyx_string_tab[116]
#define __pyx_n_u_TabixIndex_fetch __pyx_string_tab[117]
#define __pyx_n_u_TabixIterator __pyx_string_tab[118]
#define __pyx_n_u_TabixIterator___reduce_cython __pyx_string_tab[119]
#define __pyx_n_u_TabixIterator___setstate_cython __pyx_string_tab[120]
#define __pyx_n_u_Type __pyx_string_tab[121]
#define __pyx_n_u_TypeError __pyx_string_tab[122]
#define __pyx_kp_u_Type_must_be_None_when_adding_a __pyx_string_tab[123]
#define __pyx_kp_u_Unable_to_delete_END __pyx_string_tab[124]
#define __pyx_kp_u_Unable_to_delete_FORMAT __pyx_string_tab[125]
#define __pyx_kp_u_Unable_to_delete_INFO __pyx_string_tab[126]
#define __pyx_kp_u_Unable_to_fetch_next_record __pyx_string_tab[127]
#define __pyx_kp_u_Unable_to_update_INFO_values __pyx_string_tab[128]
#define __pyx_kp_u_Unable_to_update_format_values __pyx_string_tab[129]
#define __pyx_kp_u_Unknown_INFO_field __pyx_string_tab[130]
#define __pyx_kp_u_Unknown_allele __pyx_string_tab[131]
#define __pyx_kp_u_Unknown_format_length __pyx_string_tab[132]
#define __pyx_kp_u_Unsupported_FORMAT_type __pyx_string_tab[133]
#define __pyx_kp_u_Unsupported_INFO_type __pyx_string_tab[134]
#define __pyx_kp_u_Use_allele_indices_to_set_intege __pyx_string_tab[135]
#define __pyx_n_u_VALUE_TYPES __pyx_string_tab[136]
#define __pyx_n_u_VARIABLE __pyx_string_tab[137]
#define __pyx_n_u_ValueError __pyx_string_tab[138]
#define __pyx_n_u_VariantContig __pyx_string_tab[139]
#define __pyx_n_u_VariantContig___reduce_cython __pyx_string_tab[140]
#define __pyx_n_u_VariantContig___setstate_cython __pyx_string_tab[141]
#define __pyx_n_u_VariantContig_remove_header __pyx_string_tab[142]
#define __pyx_n_u_VariantFile __pyx_string_tab[143]
#define __pyx_n_u_VariantFile___reduce_cython __pyx_string_tab[144]
#define __pyx_n_u_VariantFile___setstate_cython __pyx_string_tab[145]
#define __pyx_n_u_VariantFile_close __pyx_string_tab[146]
#define __pyx_n_u_VariantFile_copy __pyx_string_tab[147]
#define __pyx_n_u_VariantFile_fetch __pyx_string_tab[148]
#define __pyx_n_u_VariantFile_get_reference_name __pyx_string_tab[149]
#define __pyx_n_u_VariantFile_get_tid __pyx_string_tab[150]
#define __pyx_n_u_VariantFile_is_valid_tid __pyx_string_tab[151]
#define __pyx_n_u_VariantFile_new_record __pyx_string_tab[152]
#define __pyx_n_u_VariantFile_open __pyx_string_tab[153]
#define __pyx_n_u_VariantFile_reset __pyx_string_tab[154]
#define __pyx_n_u_VariantFile_subset_samples __pyx_string_tab[155]
#define __pyx_n_u_VariantFile_write __pyx_string_tab[156]
#define __pyx_n_u_VariantHeader __pyx_string_tab[157]
#define __pyx_n_u_VariantHeaderContigs __pyx_string_tab[158]
#define __pyx_n_u_VariantHeaderContigs___iter __pyx_string_tab[159]
#define __pyx_n_u_VariantHeaderContigs___reduce_cy __pyx_string_tab[160]
#define __pyx_n_u_VariantHeaderContigs___setstate __pyx_string_tab[161]
#define __pyx_n_u_VariantHeaderContigs_add __pyx_string_tab[162]
#define __pyx_n_u_VariantHeaderContigs_clear_heade __pyx_string_tab[163]
#define __pyx_n_u_VariantHeaderContigs_get __pyx_string_tab[164]
#define __pyx_n_u_VariantHeaderContigs_items __pyx_string_tab[165]
#define __pyx_n_u_VariantHeaderContigs_iteritems __pyx_string_tab[166]
#define __pyx_n_u_VariantHeaderContigs_iterkeys __pyx_string_tab[167]
#define __pyx_n_u_VariantHeaderContigs_itervalues __pyx_string_tab[168]
#define __pyx_n_u_VariantHeaderContigs_keys __pyx_string_tab[169]
#define __pyx_n_u_VariantHeaderContigs_remove_head __pyx_string_tab[170]
#define __pyx_n_u_VariantHeaderContigs_values __pyx_string_tab[171]
#define __pyx_n_u_VariantHeaderMetadata __pyx_string_tab[172]
#define __pyx_n_u_VariantHeaderMetadata___iter __pyx_string_tab[173]
#define __pyx_n_u_VariantHeaderMetadata___reduce_c __pyx_string_tab[174]
#define __pyx_n_u_VariantHeaderMetadata___setstate __pyx_string_tab[175]
#define __pyx_n_u_VariantHeaderMetadata_add __pyx_string_tab[176]
#define __pyx_n_u_VariantHeaderMetadata_clear_head __pyx_string_tab[177]
#define __pyx_n_u_VariantHeaderMetadata_get __pyx_string_tab[178]
#define __pyx_n_u_VariantHeaderMetadata_items __pyx_string_tab[179]
#define __pyx_n_u_VariantHeaderMetadata_iteritems __pyx_string_tab[180]
#define __pyx_n_u_VariantHeaderMetadata_iterkeys __pyx_string_tab[181]
#define __pyx_n_u_VariantHeaderMetadata_itervalues __pyx_string_tab[182]
#define __pyx_n_u_VariantHeaderMetadata_keys __pyx_string_tab[183]
#define __pyx_n_u_VariantHeaderMetadata_remove_hea __pyx_string_tab[184]
#define __pyx_n_u_VariantHeaderMetadata_values __pyx_string_tab[185]
#define __pyx_n_u_VariantHeaderRecord __pyx_string_tab[186]
#define __pyx_n_u_VariantHeaderRecord___get___loca __pyx_string_tab[187]
#define __pyx_n_u_VariantHeaderRecord___iter __pyx_string_tab[188]
#define __pyx_n_u_VariantHeaderRecord___reduce_cyt __pyx_string_tab[189]
#define __pyx_n_u_VariantHeaderRecord___setstate_c __pyx_string_tab[190]
#define __pyx_n_u_VariantHeaderRecord_get __pyx_string_tab[191]
#define __pyx_n_u_VariantHeaderRecord_items __pyx_string_tab[192]
#define __pyx_n_u_VariantHeaderRecord_iteritems __pyx_string_tab[193]
#define __pyx_n_u_VariantHeaderRecord_iterkeys __pyx_string_tab[194]
#define __pyx_n_u_VariantHeaderRecord_itervalues __pyx_string_tab[195]
#define __pyx_n_u_VariantHeaderRecord_keys __pyx_string_tab[196]
#define __pyx_n_u_VariantHeaderRecord_pop __pyx_string_tab[197]
#define __pyx_n_u_VariantHeaderRecord_remove __pyx_string_tab[198]
#define __pyx_n_u_VariantHeaderRecord_update __pyx_string_tab[199]
#define __pyx_n_u_VariantHeaderRecord_values __pyx_string_tab[200]
#define __pyx_n_u_VariantHeaderRecords __pyx_string_tab[201]
#define __pyx_n_u_VariantHeaderRecords___iter __pyx_string_tab[202]
#define __pyx_n_u_VariantHeaderRecords___reduce_cy __pyx_string_tab[203]
#define __pyx_n_u_VariantHeaderRecords___setstate __pyx_string_tab[204]
#define __pyx_n_u_VariantHeaderSamples __pyx_string_tab[205]
#define __pyx_n_u_VariantHeaderSamples___iter __pyx_string_tab[206]
#define __pyx_n_u_VariantHeaderSamples___reduce_cy __pyx_string_tab[207]
#define __pyx_n_u_VariantHeaderSamples___setstate __pyx_string_tab[208]
#define __pyx_n_u_VariantHeaderSamples_add __pyx_string_tab[209]
#define __pyx_n_u_VariantHeader___reduce_cython __pyx_string_tab[210]
#define __pyx_n_u_VariantHeader___setstate_cython __pyx_string_tab[211]
#define __pyx_n_u_VariantHeader_add_line __pyx_string_tab[212]
#define __pyx_n_u_VariantHeader_add_meta __pyx_string_tab[213]
#define __pyx_n_u_VariantHeader_add_record __pyx_string_tab[214]
#define __pyx_n_u_VariantHeader_add_sample __pyx_string_tab[215]
#define __pyx_n_u_VariantHeader_add_samples __pyx_string_tab[216]
#define __pyx_n_u_VariantHeader_copy __pyx_string_tab[217]
#define __pyx_n_u_VariantHeader_merge __pyx_string_tab[218]
#define __pyx_n_u_VariantHeader_new_record __pyx_string_tab[219]
#define __pyx_n_u_VariantMetadata __pyx_string_tab[220]
#define __pyx_n_u_VariantMetadata___reduce_cython __pyx_string_tab[221]
#define __pyx_n_u_VariantMetadata___setstate_cytho __pyx_string_tab[222]
#define __pyx_n_u_VariantMetadata_remove_header __pyx_string_tab[223]
#define __pyx_n_u_VariantRecord __pyx_string_tab[224]
#define __pyx_n_u_VariantRecordFilter __pyx_string_tab[225]
#define __pyx_n_u_VariantRecordFilter___iter __pyx_string_tab[226]
#define __pyx_n_u_VariantRecordFilter___reduce_cyt __pyx_string_tab[227]
#define __pyx_n_u_VariantRecordFilter___setstate_c __pyx_string_tab[228]
#define __pyx_n_u_VariantRecordFilter_add __pyx_string_tab[229]
#define __pyx_n_u_VariantRecordFilter_clear __pyx_string_tab[230]
#define __pyx_n_u_VariantRecordFilter_get __pyx_string_tab[231]
#define __pyx_n_u_VariantRecordFilter_items __pyx_string_tab[232]
#define __pyx_n_u_VariantRecordFilter_iteritems __pyx_string_tab[233]
#define __pyx_n_u_VariantRecordFilter_iterkeys __pyx_string_tab[234]
#define __pyx_n_u_VariantRecordFilter_itervalues __pyx_string_tab[235]
#define __pyx_n_u_VariantRecordFilter_keys __pyx_string_tab[236]
#define __pyx_n_u_VariantRecordFilter_values __pyx_string_tab[237]
#define __pyx_n_u_VariantRecordFormat __pyx_string_tab[238]
#define __pyx_n_u_VariantRecordFormat___iter __pyx_string_tab[239]
#define __pyx_n_u_VariantRecordFormat___reduce_cyt __pyx_string_tab[240]
#define __pyx_n_u_VariantRecordFormat___setstate_c __pyx_string_tab[241]
#define __pyx_n_u_VariantRecordFormat_clear __pyx_string_tab[242]
#define __pyx_n_u_VariantRecordFormat_get __pyx_string_tab[243]
#define __pyx_n_u_VariantRecordFormat_items __pyx_string_tab[244]
#define __pyx_n_u_VariantRecordFormat_iteritems __pyx_string_tab[245]
#define __pyx_n_u_VariantRecordFormat_iterkeys __pyx_string_tab[246]
#define __pyx_n_u_VariantRecordFormat_itervalues __pyx_string_tab[247]
#define __pyx_n_u_VariantRecordFormat_keys __pyx_string_tab[248]
#define __pyx_n_u_VariantRecordFormat_values __pyx_string_tab[249]
#define __pyx_n_u_VariantRecordInfo __pyx_string_tab[250]
#define __pyx_n_u_VariantRecordInfo___iter __pyx_string_tab[251]
#define __pyx_n_u_VariantRecordInfo___reduce_cytho __pyx_string_tab[252]
#define __pyx_n_u_VariantRecordInfo___setstate_cyt __pyx_string_tab[253]
#define __pyx_n_u_VariantRecordInfo_clear __pyx_string_tab[254]
#define __pyx_n_u_VariantRecordInfo_get __pyx_string_tab[255]
#define __pyx_n_u_VariantRecordInfo_items __pyx_string_tab[256]
#define __pyx_n_u_VariantRecordInfo_iteritems __pyx_string_tab[257]
#define __pyx_n_u_VariantRecordInfo_iterkeys __pyx_string_tab[258]
#define __pyx_n_u_VariantRecordInfo_itervalues __pyx_string_tab[259]
#define __pyx_n_u_VariantRecordInfo_keys __pyx_string_tab[260]
#define __pyx_n_u_VariantRecordInfo_pop __pyx_string_tab[261]
#define __pyx_n_u_VariantRecordInfo_update __pyx_string_tab[262]
#define __pyx_n_u_VariantRecordInfo_values __pyx_string_tab[263]
#define __pyx_n_u_VariantRecordSample __pyx_string_tab[264]
#define __pyx_n_u_VariantRecordSample___iter __pyx_string_tab[265]
#define __pyx_n_u_VariantRecordSample___reduce_cyt __pyx_string_tab[266]
#define __pyx_n_u_VariantRecordSample___set___loca __pyx_string_tab[267]
#define __pyx_n_u_VariantRecordSample___setstate_c __pyx_string_tab[268]
#define __pyx_n_u_VariantRecordSample_clear __pyx_string_tab[269]
#define __pyx_n_u_VariantRecordSample_get __pyx_string_tab[270]
#define __pyx_n_u_VariantRecordSample_items __pyx_string_tab[271]
#define __pyx_n_u_VariantRecordSample_iteritems __pyx_string_tab[272]
#define __pyx_n_u_VariantRecordSample_iterkeys __pyx_string_tab[273]
#define __pyx_n_u_VariantRecordSample_itervalues __pyx_string_tab[274]
#define __pyx_n_u_VariantRecordSample_keys __pyx_string_tab[275]
#define __pyx_n_u_VariantRecordSample_pop __pyx_string_tab[276]
#define __pyx_n_u_VariantRecordSample_update __pyx_string_tab[277]
#define __pyx_n_u_VariantRecordSample_values __pyx_string_tab[278]
#define __pyx_n_u_VariantRecordSamples __pyx_string_tab[279]
#define __pyx_n_u_VariantRecordSamples___iter __pyx_string_tab[280]
#define __pyx_n_u_VariantRecordSamples___reduce_cy __pyx_string_tab[281]
#define __pyx_n_u_VariantRecordSamples___setstate __pyx_string_tab[282]
#define __pyx_n_u_VariantRecordSamples_get __pyx_string_tab[283]
#define __pyx_n_u_VariantRecordSamples_items __pyx_string_tab[284]
#define __pyx_n_u_VariantRecordSamples_iteritems __pyx_string_tab[285]
#define __pyx_n_u_VariantRecordSamples_iterkeys __pyx_string_tab[286]
#define __pyx_n_u_VariantRecordSamples_itervalues __pyx_string_tab[287]
#define __pyx_n_u_VariantRecordSamples_keys __pyx_string_tab[288]
#define __pyx_n_u_VariantRecordSamples_pop __pyx_string_tab[289]
#define __pyx_n_u_VariantRecordSamples_update __pyx_string_tab[290]
#define __pyx_n_u_VariantRecordSamples_values __pyx_string_tab[291]
#define __pyx_n_u_VariantRecord___reduce_cython __pyx_string_tab[292]
#define __pyx_n_u_VariantRecord___setstate_cython __pyx_string_tab[293]
#define __pyx_n_u_VariantRecord_copy __pyx_string_tab[294]
#define __pyx_n_u_VariantRecord_translate __pyx_string_tab[295]
#define __pyx_kp_b__11 __pyx_string_tab[296]
#define __pyx_kp_u__12 __pyx_string_tab[297]
#define __pyx_n_u__17 __pyx_string_tab[298]
#define __pyx_kp_b__2 __pyx_string_tab[299]
#define __pyx_kp_u__2 __pyx_string_tab[300]
#define __pyx_kp_b__4 __pyx_string_tab[301]
#define __pyx_kp_u__4 __pyx_string_tab[302]
#define __pyx_kp_u__5 __pyx_string_tab[303]
#define __pyx_kp_u__8 __pyx_string_tab[304]
#define __pyx_n_u_a __pyx_string_tab[305]
#define __pyx_n_u_add __pyx_string_tab[306]
#define __pyx_n_u_add_line __pyx_string_tab[307]
#define __pyx_n_u_add_meta __pyx_string_tab[308]
#define __pyx_kp_u_add_note __pyx_string_tab[309]
#define __pyx_n_u_add_record __pyx_string_tab[310]
#define __pyx_n_u_add_sample __pyx_string_tab[311]
#define __pyx_n_u_add_sample_2 __pyx_string_tab[312]
#define __pyx_n_u_add_samples __pyx_string_tab[313]
#define __pyx_n_u_all __pyx_string_tab[314]
#define __pyx_n_u_allele __pyx_string_tab[315]
#define __pyx_n_u_alleles __pyx_string_tab[316]
#define __pyx_n_u_append __pyx_string_tab[317]
#define __pyx_n_u_arg __pyx_string_tab[318]
#define __pyx_n_u_args __pyx_string_tab[319]
#define __pyx_n_u_asyncio_coroutines __pyx_string_tab[320]
#define __pyx_n_u_bcf __pyx_string_tab[321]
#define __pyx_kp_u_bcf_2 __pyx_string_tab[322]
#define __pyx_n_u_bcf_array_to_object __pyx_string_tab[323]
#define __pyx_n_u_bcf_array_to_object_locals_genex __pyx_string_tab[324]
#define __pyx_n_u_bcf_check_values __pyx_string_tab[325]
#define __pyx_n_u_bcf_check_values_locals_genexpr __pyx_string_tab[326]
#define __pyx_n_u_bcf_copy_expand_array __pyx_string_tab[327]
#define __pyx_n_u_bcf_empty_array __pyx_string_tab[328]
#define __pyx_n_u_bcf_encode_alleles __pyx_string_tab[329]
#define __pyx_n_u_bcf_format_del_value __pyx_string_tab[330]
#define __pyx_n_u_bcf_format_get_allele_indices __pyx_string_tab[331]
#define __pyx_n_u_bcf_format_get_alleles __pyx_string_tab[332]
#define __pyx_n_u_bcf_format_get_value __pyx_string_tab[333]
#define __pyx_n_u_bcf_format_set_value __pyx_string_tab[334]
#define __pyx_n_u_bcf_geno_combinations __pyx_string_tab[335]
#define __pyx_n_u_bcf_genotype_count __pyx_string_tab[336]
#define __pyx_n_u_bcf_get_value_count __pyx_string_tab[337]
#define __pyx_kp_u_bcf_hdr_format_failed __pyx_string_tab[338]
#define __pyx_kp_u_bcf_hdr_set_samples_failed_ret __pyx_string_tab[339]
#define __pyx_n_u_bcf_header_get_info_id __pyx_string_tab[340]
#define __pyx_n_u_bcf_header_remove_hrec __pyx_string_tab[341]
#define __pyx_kp_u_bcf_index_required __pyx_string_tab[342]
#define __pyx_n_u_bcf_info_del_value __pyx_string_tab[343]
#define __pyx_n_u_bcf_info_get_value __pyx_string_tab[344]
#define __pyx_n_u_bcf_info_set_value __pyx_string_tab[345]
#define __pyx_kp_u_bcf_must_not_be_None __pyx_string_tab[346]
#define __pyx_n_u_bcf_object_to_array __pyx_string_tab[347]
#define __pyx_n_u_bcf_object_to_array_locals_genex __pyx_string_tab[348]
#define __pyx_n_u_bcf_sample_get_phased __pyx_string_tab[349]
#define __pyx_n_u_bcf_sample_set_phased __pyx_string_tab[350]
#define __pyx_n_u_bcf_str_cache __pyx_string_tab[351]
#define __pyx_n_u_bcf_str_cache_get_charptr __pyx_string_tab[352]
#define __pyx_n_u_bcf_sync_end __pyx_string_tab[353]
#define __pyx_n_u_bcguz __pyx_string_tab[354]
#define __pyx_n_u_bcguz0123456789ex __pyx_string_tab[355]
#define __pyx_n_u_bchrom __pyx_string_tab[356]
#define __pyx_n_u_bgzfp __pyx_string_tab[357]
#define __pyx_n_u_bid __pyx_string_tab[358]
#define __pyx_n_u_bkey __pyx_string_tab[359]
#define __pyx_n_u_bline __pyx_string_tab[360]
#define __pyx_n_u_bool __pyx_string_tab[361]
#define __pyx_n_u_bt_len __pyx_string_tab[362]
#define __pyx_n_u_bt_type __pyx_string_tab[363]
#define __pyx_n_u_c __pyx_string_tab[364]
#define __pyx_kp_u_cannot_convert_deleted_record_to __pyx_string_tab[365]
#define __pyx_kp_u_cannot_create_VariantHeader __pyx_string_tab[366]
#define __pyx_kp_u_cannot_create_VariantRecord __pyx_string_tab[367]
#define __pyx_kp_u_cannot_create_VariantRecordSampl __pyx_string_tab[368]
#define __pyx_kp_u_cannot_fetch_from_Variantfile_op __pyx_string_tab[369]
#define __pyx_kp_u_cannot_find_metadata_key __pyx_string_tab[370]
#define __pyx_kp_u_cannot_iterate_over_Variantfile __pyx_string_tab[371]
#define __pyx_kp_u_cannot_set_null_allele __pyx_string_tab[372]
#define __pyx_kp_u_cannot_set_null_alt_allele __pyx_string_tab[373]
#define __pyx_kp_u_cannot_subset_samples_after_fetc __pyx_string_tab[374]
#define __pyx_kp_u_cannot_subset_samples_from_Varia __pyx_string_tab[375]
#define __pyx_kp_u_cannot_write_to_a_Variantfile_op __pyx_string_tab[376]
#define __pyx_n_u_cfilename __pyx_string_tab[377]
#define __pyx_n_u_char_array_to_tuple __pyx_string_tab[378]
#define __pyx_n_u_char_array_to_tuple_locals_genex __pyx_string_tab[379]
#define __pyx_n_u_check_header_id __pyx_string_tab[380]
#define __pyx_n_u_check_truncation __pyx_string_tab[381]
#define __pyx_n_u_cindex_filename __pyx_string_tab[382]
#define __pyx_n_u_cinit __pyx_string_tab[383]
#define __pyx_n_u_ckey __pyx_string_tab[384]
#define __pyx_n_u_class_getitem __pyx_string_tab[385]
#define __pyx_n_u_clear __pyx_string_tab[386]
#define __pyx_n_u_clear_header __pyx_string_tab[387]
#define __pyx_n_u_cline_in_traceback __pyx_string_tab[388]
#define __pyx_n_u_close __pyx_string_tab[389]
#define __pyx_n_u_cmode __pyx_string_tab[390]
#define __pyx_n_u_cmp __pyx_string_tab[391]
#define __pyx_n_u_comb __pyx_string_tab[392]
#define __pyx_n_u_contains __pyx_string_tab[393]
#define __pyx_n_u_contig __pyx_string_tab[394]
#define __pyx_kp_u_contig_must_be_specified __pyx_string_tab[395]
#define __pyx_n_u_copy __pyx_string_tab[396]
#define __pyx_kp_u_could_not_open_file_mode __pyx_string_tab[397]
#define __pyx_kp_u_could_not_open_variant_file __pyx_string_tab[398]
#define __pyx_n_u_count __pyx_string_tab[399]
#define __pyx_n_u_cstart __pyx_string_tab[400]
#define __pyx_n_u_cstop __pyx_string_tab[401]
#define __pyx_n_u_d __pyx_string_tab[402]
#define __pyx_n_u_data __pyx_string_tab[403]
#define __pyx_n_u_dealloc __pyx_string_tab[404]
#define __pyx_n_u_default __pyx_string_tab[405]
#define __pyx_n_u_del __pyx_string_tab[406]
#define __pyx_n_u_delitem __pyx_string_tab[407]
#define __pyx_n_u_descr __pyx_string_tab[408]
#define __pyx_n_u_description __pyx_string_tab[409]
#define __pyx_n_u_dict __pyx_string_tab[410]
#define __pyx_n_u_dict_2 __pyx_string_tab[411]
#define __pyx_kp_u_disable __pyx_string_tab[412]
#define __pyx_n_u_drop_samples __pyx_string_tab[413]
#define __pyx_n_u_dst_data __pyx_string_tab[414]
#define __pyx_n_u_dst_hdr __pyx_string_tab[415]
#define __pyx_n_u_dst_header __pyx_string_tab[416]
#define __pyx_kp_u_dst_header_must_not_be_None __pyx_string_tab[417]
#define __pyx_n_u_dst_type __pyx_string_tab[418]
#define __pyx_n_u_dst_values __pyx_string_tab[419]
#define __pyx_n_u_duplicate_filehandle __pyx_string_tab[420]
#define __pyx_kp_u_either_value_or_items_must_be_sp __pyx_string_tab[421]
#define __pyx_kp_u_enable __pyx_string_tab[422]
#define __pyx_n_u_end __pyx_string_tab[423]
#define __pyx_n_u_endswith __pyx_string_tab[424]
#define __pyx_n_u_enumerate __pyx_string_tab[425]
#define __pyx_n_u_errcode __pyx_string_tab[426]
#define __pyx_kp_u_error_in_bcf_subset_format __pyx_string_tab[427]
#define __pyx_kp_u_error_in_vcf_parse __pyx_string_tab[428]
#define __pyx_n_u_f __pyx_string_tab[429]
#define __pyx_n_u_fetch __pyx_string_tab[430]
#define __pyx_kp_u_fetch_requires_an_index __pyx_string_tab[431]
#define __pyx_kp_u_file_does_not_have_valid_header __pyx_string_tab[432]
#define __pyx_n_u_filename __pyx_string_tab[433]
#define __pyx_n_u_filter __pyx_string_tab[434]
#define __pyx_n_u_fmt __pyx_string_tab[435]
#define __pyx_n_u_fmt_id __pyx_string_tab[436]
#define __pyx_n_u_format __pyx_string_tab[437]
#define __pyx_n_u_format_modes __pyx_string_tab[438]
#define __pyx_n_u_free_after __pyx_string_tab[439]
#define __pyx_n_u_func __pyx_string_tab[440]
#define __pyx_kp_u_gc __pyx_string_tab[441]
#define __pyx_n_u_genexpr __pyx_string_tab[442]
#define __pyx_kp_u_genotype_is_only_valid_as_a_form __pyx_string_tab[443]
#define __pyx_n_u_get __pyx_string_tab[444]
#define __pyx_n_u_get_2 __pyx_string_tab[445]
#define __pyx_n_u_get_reference_name __pyx_string_tab[446]
#define __pyx_n_u_get_tid __pyx_string_tab[447]
#define __pyx_n_u_getitem __pyx_string_tab[448]
#define __pyx_n_u_getstate __pyx_string_tab[449]
#define __pyx_kp_u_gz __pyx_string_tab[450]
#define __pyx_n_u_has_symbolic_allele __pyx_string_tab[451]
#define __pyx_n_u_hash __pyx_string_tab[452]
#define __pyx_n_u_hdr __pyx_string_tab[453]
#define __pyx_n_u_hdr_sync __pyx_string_tab[454]
#define __pyx_n_u_header __pyx_string_tab[455]
#define __pyx_kp_u_header_must_not_be_None __pyx_string_tab[456]
#define __pyx_n_u_hl_type __pyx_string_tab[457]
#define __pyx_n_u_hlen __pyx_string_tab[458]
#define __pyx_n_u_hrec __pyx_string_tab[459]
#define __pyx_n_u_hrec_str __pyx_string_tab[460]
#define __pyx_n_u_ht_type __pyx_string_tab[461]
#define __pyx_n_u_i __pyx_string_tab[462]
#define __pyx_n_u_id __pyx_string_tab[463]
#define __pyx_n_u_idpair __pyx_string_tab[464]
#define __pyx_n_u_idstr __pyx_string_tab[465]
#define __pyx_n_u_idx __pyx_string_tab[466]
#define __pyx_n_u_ignore_truncation __pyx_string_tab[467]
#define __pyx_n_u_include_samples __pyx_string_tab[468]
#define __pyx_n_u_index __pyx_string_tab[469]
#define __pyx_n_u_index_filename __pyx_string_tab[470]
#define __pyx_n_u_info __pyx_string_tab[471]
#define __pyx_n_u_info_id __pyx_string_tab[472]
#define __pyx_n_u_init __pyx_string_tab[473]
#define __pyx_n_u_initializing __pyx_string_tab[474]
#define __pyx_kp_u_invalid_FORMAT __pyx_string_tab[475]
#define __pyx_kp_u_invalid_VariantHeader __pyx_string_tab[476]
#define __pyx_kp_u_invalid_VariantRecord __pyx_string_tab[477]
#define __pyx_kp_u_invalid_character_found __pyx_string_tab[478]
#define __pyx_kp_u_invalid_contig __pyx_string_tab[479]
#define __pyx_kp_u_invalid_contig_2 __pyx_string_tab[480]
#define __pyx_kp_u_invalid_contig_id __pyx_string_tab[481]
#define __pyx_kp_u_invalid_contig_index __pyx_string_tab[482]
#define __pyx_kp_u_invalid_file_mode_is_it_VCF_BCF __pyx_string_tab[483]
#define __pyx_kp_u_invalid_filter_index __pyx_string_tab[484]
#define __pyx_kp_u_invalid_header_line __pyx_string_tab[485]
#define __pyx_kp_u_invalid_header_record_index __pyx_string_tab[486]
#define __pyx_kp_u_invalid_key __pyx_string_tab[487]
#define __pyx_kp_u_invalid_metadata_id __pyx_string_tab[488]
#define __pyx_kp_u_invalid_metadata_type __pyx_string_tab[489]
#define __pyx_kp_u_invalid_mode_options __pyx_string_tab[490]
#define __pyx_n_u_invalid_modes __pyx_string_tab[491]
#define __pyx_kp_u_invalid_number_of_columns __pyx_string_tab[492]
#define __pyx_kp_u_invalid_reference_id __pyx_string_tab[493]
#define __pyx_kp_u_invalid_sample_index __pyx_string_tab[494]
#define __pyx_kp_u_invalid_sample_name __pyx_string_tab[495]
#define __pyx_kp_u_invalid_tag __pyx_string_tab[496]
#define __pyx_kp_u_invalid_value_for_Float_format __pyx_string_tab[497]
#define __pyx_kp_u_invalid_value_for_Integer_format __pyx_string_tab[498]
#define __pyx_n_u_is_coroutine __pyx_string_tab[499]
#define __pyx_n_u_is_gt_fmt __pyx_string_tab[500]
#define __pyx_n_u_is_open __pyx_string_tab[501]
#define __pyx_n_u_is_valid_tid __pyx_string_tab[502]
#define __pyx_kp_u_isenabled __pyx_string_tab[503]
#define __pyx_n_u_items __pyx_string_tab[504]
#define __pyx_n_u_iter __pyx_string_tab[505]
#define __pyx_n_u_iteritems __pyx_string_tab[506]
#define __pyx_n_u_iterkeys __pyx_string_tab[507]
#define __pyx_n_u_itervalues __pyx_string_tab[508]
#define __pyx_n_u_join __pyx_string_tab[509]
#define __pyx_n_u_k __pyx_string_tab[510]
#define __pyx_n_u_key __pyx_string_tab[511]
#define __pyx_n_u_keys __pyx_string_tab[512]
#define __pyx_n_u_kwargs __pyx_string_tab[513]
#define __pyx_n_u_l __pyx_string_tab[514]
#define __pyx_n_u_len __pyx_string_tab[515]
#define __pyx_n_u_length __pyx_string_tab[516]
#define __pyx_kp_u_limits_violated __pyx_string_tab[517]
#define __pyx_n_u_line __pyx_string_tab[518]
#define __pyx_n_u_m __pyx_string_tab[519]
#define __pyx_n_u_main __pyx_string_tab[520]
#define __pyx_n_u_makeBCFIndex __pyx_string_tab[521]
#define __pyx_n_u_makeTabixIndex __pyx_string_tab[522]
#define __pyx_n_u_makeVariantContig __pyx_string_tab[523]
#define __pyx_n_u_makeVariantHeader __pyx_string_tab[524]
#define __pyx_n_u_makeVariantHeaderContigs __pyx_string_tab[525]
#define __pyx_n_u_makeVariantHeaderMetadata __pyx_string_tab[526]
#define __pyx_n_u_makeVariantHeaderRecord __pyx_string_tab[527]
#define __pyx_n_u_makeVariantHeaderRecords __pyx_string_tab[528]
#define __pyx_n_u_makeVariantHeaderSamples __pyx_string_tab[529]
#define __pyx_n_u_makeVariantMetadata __pyx_string_tab[530]
#define __pyx_n_u_makeVariantRecord __pyx_string_tab[531]
#define __pyx_n_u_makeVariantRecordFilter __pyx_string_tab[532]
#define __pyx_n_u_makeVariantRecordFormat __pyx_string_tab[533]
#define __pyx_n_u_makeVariantRecordInfo __pyx_string_tab[534]
#define __pyx_n_u_makeVariantRecordSample __pyx_string_tab[535]
#define __pyx_n_u_makeVariantRecordSamples __pyx_string_tab[536]
#define __pyx_n_u_merge __pyx_string_tab[537]
#define __pyx_kp_u_missing_d_requested_samples __pyx_string_tab[538]
#define __pyx_n_u_mode __pyx_string_tab[539]
#define __pyx_kp_u_mode_contains_conflicting_format __pyx_string_tab[540]
#define __pyx_kp_u_mode_must_begin_with_r_w_or_a __pyx_string_tab[541]
#define __pyx_n_u_module __pyx_string_tab[542]
#define __pyx_n_u_msg __pyx_string_tab[543]
#define __pyx_kp_u_must_set_at_least_2_alleles __pyx_string_tab[544]
#define __pyx_n_u_n __pyx_string_tab[545]
#define __pyx_n_u_name __pyx_string_tab[546]
#define __pyx_n_u_name_2 __pyx_string_tab[547]
#define __pyx_n_u_new __pyx_string_tab[548]
#define __pyx_n_u_new_record __pyx_string_tab[549]
#define __pyx_n_u_next __pyx_string_tab[550]
#define __pyx_n_u_next_2 __pyx_string_tab[551]
#define __pyx_kp_u_no_default___reduce___due_to_non __pyx_string_tab[552]
#define __pyx_n_u_nothing __pyx_string_tab[553]
#define __pyx_n_u_number __pyx_string_tab[554]
#define __pyx_n_u_o __pyx_string_tab[555]
#define __pyx_n_u_object __pyx_string_tab[556]
#define __pyx_n_u_op __pyx_string_tab[557]
#define __pyx_n_u_open __pyx_string_tab[558]
#define __pyx_n_u_os __pyx_string_tab[559]
#define __pyx_n_u_other __pyx_string_tab[560]
#define __pyx_n_u_p __pyx_string_tab[561]
#define __pyx_n_u_parse_region __pyx_string_tab[562]
#define __pyx_n_u_phased __pyx_string_tab[563]
#define __pyx_n_u_pickle __pyx_string_tab[564]
#define __pyx_n_u_ploidy __pyx_string_tab[565]
#define __pyx_n_u_pop __pyx_string_tab[566]
#define __pyx_n_u_ptr __pyx_string_tab[567]
#define __pyx_n_u_pysam_libcbcf __pyx_string_tab[568]
#define __pyx_kp_u_pysam_libcbcf_pxd __pyx_string_tab[569]
#define __pyx_kp_u_pysam_libcbcf_pyx __pyx_string_tab[570]
#define __pyx_n_u_pysam_utils __pyx_string_tab[571]
#define __pyx_n_u_pyx_PickleError __pyx_string_tab[572]
#define __pyx_n_u_pyx_checksum __pyx_string_tab[573]
#define __pyx_n_u_pyx_result __pyx_string_tab[574]
#define __pyx_n_u_pyx_state __pyx_string_tab[575]
#define __pyx_n_u_pyx_type __pyx_string_tab[576]
#define __pyx_n_u_pyx_unpickle_BaseIndex __pyx_string_tab[577]
#define __pyx_n_u_pyx_unpickle_BaseIndex__set_st __pyx_string_tab[578]
#define __pyx_n_u_pyx_unpickle_VariantContig __pyx_string_tab[579]
#define __pyx_n_u_pyx_unpickle_VariantContig__se __pyx_string_tab[580]
#define __pyx_n_u_pyx_unpickle_VariantHeaderCont __pyx_string_tab[581]
#define __pyx_n_u_pyx_unpickle_VariantHeaderCont_2 __pyx_string_tab[582]
#define __pyx_n_u_pyx_unpickle_VariantHeaderMeta __pyx_string_tab[583]
#define __pyx_n_u_pyx_unpickle_VariantHeaderMeta_2 __pyx_string_tab[584]
#define __pyx_n_u_pyx_unpickle_VariantHeaderReco __pyx_string_tab[585]
#define __pyx_n_u_pyx_unpickle_VariantHeaderReco_2 __pyx_string_tab[586]
#define __pyx_n_u_pyx_unpickle_VariantHeaderSamp __pyx_string_tab[587]
#define __pyx_n_u_pyx_unpickle_VariantHeaderSamp_2 __pyx_string_tab[588]
#define __pyx_n_u_pyx_unpickle_VariantMetadata __pyx_string_tab[589]
#define __pyx_n_u_pyx_unpickle_VariantMetadata_2 __pyx_string_tab[590]
#define __pyx_n_u_pyx_unpickle_VariantRecordFilt __pyx_string_tab[591]
#define __pyx_n_u_pyx_unpickle_VariantRecordFilt_2 __pyx_string_tab[592]
#define __pyx_n_u_pyx_unpickle_VariantRecordForm __pyx_string_tab[593]
#define __pyx_n_u_pyx_unpickle_VariantRecordForm_2 __pyx_string_tab[594]
#define __pyx_n_u_pyx_unpickle_VariantRecordInfo __pyx_string_tab[595]
#define __pyx_n_u_pyx_unpickle_VariantRecordInfo_2 __pyx_string_tab[596]
#define __pyx_n_u_pyx_unpickle_VariantRecordSamp __pyx_string_tab[597]
#define __pyx_n_u_pyx_unpickle_VariantRecordSamp_2 __pyx_string_tab[598]
#define __pyx_n_u_pyx_unpickle_VariantRecordSamp_3 __pyx_string_tab[599]
#define __pyx_n_u_pyx_unpickle_VariantRecordSamp_4 __pyx_string_tab[600]
#define __pyx_n_u_pyx_vtable __pyx_string_tab[601]
#define __pyx_n_u_qual __pyx_string_tab[602]
#define __pyx_n_u_qualname __pyx_string_tab[603]
#define __pyx_n_u_quoted __pyx_string_tab[604]
#define __pyx_n_b_r __pyx_string_tab[605]
#define __pyx_n_u_r __pyx_string_tab[606]
#define __pyx_n_u_range __pyx_string_tab[607]
#define __pyx_n_u_realloc __pyx_string_tab[608]
#define __pyx_n_u_rec __pyx_string_tab[609]
#define __pyx_n_u_record __pyx_string_tab[610]
#define __pyx_kp_u_record_must_not_be_None __pyx_string_tab[611]
#define __pyx_n_u_records __pyx_string_tab[612]
#define __pyx_n_u_reduce __pyx_string_tab[613]
#define __pyx_n_u_reduce_cython __pyx_string_tab[614]
#define __pyx_n_u_reduce_ex __pyx_string_tab[615]
#define __pyx_n_u_ref __pyx_string_tab[616]
#define __pyx_kp_u_ref_allele_must_not_be_null __pyx_string_tab[617]
#define __pyx_n_u_reference __pyx_string_tab[618]
#define __pyx_n_u_refs __pyx_string_tab[619]
#define __pyx_n_u_region __pyx_string_tab[620]
#define __pyx_n_u_remap __pyx_string_tab[621]
#define __pyx_n_u_remove __pyx_string_tab[622]
#define __pyx_n_u_remove_header __pyx_string_tab[623]
#define __pyx_n_u_reopen __pyx_string_tab[624]
#define __pyx_n_u_res __pyx_string_tab[625]
#define __pyx_n_u_reset __pyx_string_tab[626]
#define __pyx_n_u_result __pyx_string_tab[627]
#define __pyx_n_u_ret __pyx_string_tab[628]
#define __pyx_n_u_reversed __pyx_string_tab[629]
#define __pyx_n_u_richcmp __pyx_string_tab[630]
#define __pyx_n_u_rid __pyx_string_tab[631]
#define __pyx_n_u_rlen __pyx_string_tab[632]
#define __pyx_n_u_rwa __pyx_string_tab[633]
#define __pyx_n_u_s __pyx_string_tab[634]
#define __pyx_n_u_sample __pyx_string_tab[635]
#define __pyx_n_u_sample_index __pyx_string_tab[636]
#define __pyx_kp_u_sample_must_not_be_None __pyx_string_tab[637]
#define __pyx_n_u_samples __pyx_string_tab[638]
#define __pyx_n_u_scalar __pyx_string_tab[639]
#define __pyx_n_u_seek __pyx_string_tab[640]
#define __pyx_n_u_self __pyx_string_tab[641]
#define __pyx_kp_u_self_iter_cannot_be_converted_to __pyx_string_tab[642]
#define __pyx_kp_u_self_ptr_cannot_be_converted_to __pyx_string_tab[643]
#define __pyx_n_u_send __pyx_string_tab[644]
#define __pyx_n_u_set __pyx_string_tab[645]
#define __pyx_n_u_set_name __pyx_string_tab[646]
#define __pyx_n_u_setitem __pyx_string_tab[647]
#define __pyx_n_u_setstate __pyx_string_tab[648]
#define __pyx_n_u_setstate_cython __pyx_string_tab[649]
#define __pyx_n_u_spec __pyx_string_tab[650]
#define __pyx_n_u_split __pyx_string_tab[651]
#define __pyx_n_u_src_data __pyx_string_tab[652]
#define __pyx_n_u_src_hdr __pyx_string_tab[653]
#define __pyx_n_u_src_type __pyx_string_tab[654]
#define __pyx_n_u_src_values __pyx_string_tab[655]
#define __pyx_n_u_start __pyx_string_tab[656]
#define __pyx_n_u_startswith __pyx_string_tab[657]
#define __pyx_n_u_state __pyx_string_tab[658]
#define __pyx_n_u_stop __pyx_string_tab[659]
#define __pyx_n_u_stop_BCFIterator __pyx_string_tab[660]
#define __pyx_n_u_str __pyx_string_tab[661]
#define __pyx_kp_u_stringsource __pyx_string_tab[662]
#define __pyx_n_u_strip __pyx_string_tab[663]
#define __pyx_n_u_subset_samples __pyx_string_tab[664]
#define __pyx_n_u_subset_samples_2 __pyx_string_tab[665]
#define __pyx_n_u_sys __pyx_string_tab[666]
#define __pyx_kp_u_tabix_index_required __pyx_string_tab[667]
#define __pyx_n_u_tell __pyx_string_tab[668]
#define __pyx_n_u_test __pyx_string_tab[669]
#define __pyx_kp_u_this_class_cannot_be_instantiate __pyx_string_tab[670]
#define __pyx_n_u_threads __pyx_string_tab[671]
#define __pyx_n_u_throw __pyx_string_tab[672]
#define __pyx_n_u_tid __pyx_string_tab[673]
#define __pyx_n_u_tidx __pyx_string_tab[674]
#define __pyx_n_u_tp __pyx_string_tab[675]
#define __pyx_n_u_translate __pyx_string_tab[676]
#define __pyx_kp_u_truncated_file __pyx_string_tab[677]
#define __pyx_n_u_type __pyx_string_tab[678]
#define __pyx_kp_u_unable_to_allocate_BCF_record __pyx_string_tab[679]
#define __pyx_kp_u_unable_to_fetch __pyx_string_tab[680]
#define __pyx_kp_u_unable_to_fetch_next_record __pyx_string_tab[681]
#define __pyx_kp_u_unable_to_parse_next_record __pyx_string_tab[682]
#define __pyx_kp_u_unable_to_reallocate_VariantHead __pyx_string_tab[683]
#define __pyx_kp_u_unknown_INFO __pyx_string_tab[684]
#define __pyx_kp_u_unknown_format __pyx_string_tab[685]
#define __pyx_kp_u_unknown_mode __pyx_string_tab[686]
#define __pyx_kp_u_unknown_type_specified __pyx_string_tab[687]
#define __pyx_n_u_unquoted_str __pyx_string_tab[688]
#define __pyx_kp_u_unsupported_header_type_code __pyx_string_tab[689]
#define __pyx_kp_u_unsupported_info_type_code __pyx_string_tab[690]
#define __pyx_kp_u_unsupported_type __pyx_string_tab[691]
#define __pyx_kp_u_unsupported_types __pyx_string_tab[692]
#define __pyx_n_u_update __pyx_string_tab[693]
#define __pyx_n_u_upper __pyx_string_tab[694]
#define __pyx_n_u_use_setstate __pyx_string_tab[695]
#define __pyx_kp_u_utf_8 __pyx_string_tab[696]
#define __pyx_n_u_v __pyx_string_tab[697]
#define __pyx_n_u_v_type __pyx_string_tab[698]
#define __pyx_n_u_value __pyx_string_tab[699]
#define __pyx_n_u_value_count __pyx_string_tab[700]
#define __pyx_kp_u_value_expected_to_be_scalar_give __pyx_string_tab[701]
#define __pyx_n_u_values __pyx_string_tab[702]
#define __pyx_kp_u_values_expected_to_be_tuple_give __pyx_string_tab[703]
#define __pyx_n_u_vars __pyx_string_tab[704]
#define __pyx_kp_u_vcf_format_failed __pyx_string_tab[705]
#define __pyx_n_u_vlen __pyx_string_tab[706]
#define __pyx_n_b_w __pyx_string_tab[707]
#define __pyx_n_u_w __pyx_string_tab[708]
#define __pyx_n_u_wb __pyx_string_tab[709]
#define __pyx_n_u_wb0 __pyx_string_tab[710]
#define __pyx_n_u_wbu __pyx_string_tab[711]
#define __pyx_n_u_write __pyx_string_tab[712]
#define __pyx_n_u_wz __pyx_string_tab[713]
#define __pyx_n_u_x __pyx_string_tab[714]
#define __pyx_n_u_z __pyx_string_tab[715]
/* #### 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);
  #ifdef __Pyx_CyFunction_USED
  Py_CLEAR(clear_module_state->__pyx_CyFunctionType);
  #endif
  #ifdef __Pyx_FusedFunction_USED
  Py_CLEAR(clear_module_state->__pyx_FusedFunctionType);
  #endif
  #if CYTHON_PEP489_MULTI_PHASE_INIT
  __Pyx_State_RemoveModule(NULL);
  #endif
  Py_CLEAR(clear_module_state->__pyx_ptype_5pysam_10libchtslib_HTSFile);
  Py_CLEAR(clear_module_state->__pyx_ptype_7cpython_4type_type);
  Py_CLEAR(clear_module_state->__pyx_ptype_7cpython_4bool_bool);
  Py_CLEAR(clear_module_state->__pyx_ptype_7cpython_7complex_complex);
  Py_CLEAR(clear_module_state->__pyx_ptype_7cpython_5array_array);
  Py_CLEAR(clear_module_state->__pyx_ptype_5pysam_7libcbcf_VariantHeader);
  Py_CLEAR(clear_module_state->__pyx_type_5pysam_7libcbcf_VariantHeader);
  Py_CLEAR(clear_module_state->__pyx_ptype_5pysam_7libcbcf_VariantHeaderRecord);
  Py_CLEAR(clear_module_state->__pyx_type_5pysam_7libcbcf_VariantHeaderRecord);
  Py_CLEAR(clear_module_state->__pyx_ptype_5pysam_7libcbcf_VariantHeaderRecords);
  Py_CLEAR(clear_module_state->__pyx_type_5pysam_7libcbcf_VariantHeaderRecords);
  Py_CLEAR(clear_module_state->__pyx_ptype_5pysam_7libcbcf_VariantHeaderContigs);
  Py_CLEAR(clear_module_state->__pyx_type_5pysam_7libcbcf_VariantHeaderContigs);
  Py_CLEAR(clear_module_state->__pyx_ptype_5pysam_7libcbcf_VariantHeaderSamples);
  Py_CLEAR(clear_module_state->__pyx_type_5pysam_7libcbcf_VariantHeaderSamples);
  Py_CLEAR(clear_module_state->__pyx_ptype_5pysam_7libcbcf_VariantContig);
  Py_CLEAR(clear_module_state->__pyx_type_5pysam_7libcbcf_VariantContig);
  Py_CLEAR(clear_module_state->__pyx_ptype_5pysam_7libcbcf_VariantMetadata);
  Py_CLEAR(clear_module_state->__pyx_type_5pysam_7libcbcf_VariantMetadata);
  Py_CLEAR(clear_module_state->__pyx_ptype_5pysam_7libcbcf_VariantHeaderMetadata);
  Py_CLEAR(clear_module_state->__pyx_type_5pysam_7libcbcf_VariantHeaderMetadata);
  Py_CLEAR(clear_module_state->__pyx_ptype_5pysam_7libcbcf_VariantRecord);
  Py_CLEAR(clear_module_state->__pyx_type_5pysam_7libcbcf_VariantRecord);
  Py_CLEAR(clear_module_state->__pyx_ptype_5pysam_7libcbcf_VariantRecordFilter);
  Py_CLEAR(clear_module_state->__pyx_type_5pysam_7libcbcf_VariantRecordFilter);
  Py_CLEAR(clear_module_state->__pyx_ptype_5pysam_7libcbcf_VariantRecordFormat);
  Py_CLEAR(clear_module_state->__pyx_type_5pysam_7libcbcf_VariantRecordFormat);
  Py_CLEAR(clear_module_state->__pyx_ptype_5pysam_7libcbcf_VariantRecordInfo);
  Py_CLEAR(clear_module_state->__pyx_type_5pysam_7libcbcf_VariantRecordInfo);
  Py_CLEAR(clear_module_state->__pyx_ptype_5pysam_7libcbcf_VariantRecordSamples);
  Py_CLEAR(clear_module_state->__pyx_type_5pysam_7libcbcf_VariantRecordSamples);
  Py_CLEAR(clear_module_state->__pyx_ptype_5pysam_7libcbcf_VariantRecordSample);
  Py_CLEAR(clear_module_state->__pyx_type_5pysam_7libcbcf_VariantRecordSample);
  Py_CLEAR(clear_module_state->__pyx_ptype_5pysam_7libcbcf_BaseIndex);
  Py_CLEAR(clear_module_state->__pyx_type_5pysam_7libcbcf_BaseIndex);
  Py_CLEAR(clear_module_state->__pyx_ptype_5pysam_7libcbcf_BCFIndex);
  Py_CLEAR(clear_module_state->__pyx_type_5pysam_7libcbcf_BCFIndex);
  Py_CLEAR(clear_module_state->__pyx_ptype_5pysam_7libcbcf_TabixIndex);
  Py_CLEAR(clear_module_state->__pyx_type_5pysam_7libcbcf_TabixIndex);
  Py_CLEAR(clear_module_state->__pyx_ptype_5pysam_7libcbcf_BaseIterator);
  Py_CLEAR(clear_module_state->__pyx_type_5pysam_7libcbcf_BaseIterator);
  Py_CLEAR(clear_module_state->__pyx_ptype_5pysam_7libcbcf_BCFIterator);
  Py_CLEAR(clear_module_state->__pyx_type_5pysam_7libcbcf_BCFIterator);
  Py_CLEAR(clear_module_state->__pyx_ptype_5pysam_7libcbcf_TabixIterator);
  Py_CLEAR(clear_module_state->__pyx_type_5pysam_7libcbcf_TabixIterator);
  Py_CLEAR(clear_module_state->__pyx_ptype_5pysam_7libcbcf_VariantFile);
  Py_CLEAR(clear_module_state->__pyx_type_5pysam_7libcbcf_VariantFile);
  Py_CLEAR(clear_module_state->__pyx_ptype_5pysam_7libcbcf___pyx_scope_struct____pyx_f_5pysam_7libcbcf_char_array_to_tuple);
  Py_CLEAR(clear_module_state->__pyx_type_5pysam_7libcbcf___pyx_scope_struct____pyx_f_5pysam_7libcbcf_char_array_to_tuple);
  Py_CLEAR(clear_module_state->__pyx_ptype_5pysam_7libcbcf___pyx_scope_struct_1_genexpr);
  Py_CLEAR(clear_module_state->__pyx_type_5pysam_7libcbcf___pyx_scope_struct_1_genexpr);
  Py_CLEAR(clear_module_state->__pyx_ptype_5pysam_7libcbcf___pyx_scope_struct_2_genexpr);
  Py_CLEAR(clear_module_state->__pyx_type_5pysam_7libcbcf___pyx_scope_struct_2_genexpr);
  Py_CLEAR(clear_module_state->__pyx_ptype_5pysam_7libcbcf___pyx_scope_struct_3_genexpr);
  Py_CLEAR(clear_module_state->__pyx_type_5pysam_7libcbcf___pyx_scope_struct_3_genexpr);
  Py_CLEAR(clear_module_state->__pyx_ptype_5pysam_7libcbcf___pyx_scope_struct_4_genexpr);
  Py_CLEAR(clear_module_state->__pyx_type_5pysam_7libcbcf___pyx_scope_struct_4_genexpr);
  Py_CLEAR(clear_module_state->__pyx_ptype_5pysam_7libcbcf___pyx_scope_struct_5___get__);
  Py_CLEAR(clear_module_state->__pyx_type_5pysam_7libcbcf___pyx_scope_struct_5___get__);
  Py_CLEAR(clear_module_state->__pyx_ptype_5pysam_7libcbcf___pyx_scope_struct_6_genexpr);
  Py_CLEAR(clear_module_state->__pyx_type_5pysam_7libcbcf___pyx_scope_struct_6_genexpr);
  Py_CLEAR(clear_module_state->__pyx_ptype_5pysam_7libcbcf___pyx_scope_struct_7___iter__);
  Py_CLEAR(clear_module_state->__pyx_type_5pysam_7libcbcf___pyx_scope_struct_7___iter__);
  Py_CLEAR(clear_module_state->__pyx_ptype_5pysam_7libcbcf___pyx_scope_struct_8_itervalues);
  Py_CLEAR(clear_module_state->__pyx_type_5pysam_7libcbcf___pyx_scope_struct_8_itervalues);
  Py_CLEAR(clear_module_state->__pyx_ptype_5pysam_7libcbcf___pyx_scope_struct_9_iteritems);
  Py_CLEAR(clear_module_state->__pyx_type_5pysam_7libcbcf___pyx_scope_struct_9_iteritems);
  Py_CLEAR(clear_module_state->__pyx_ptype_5pysam_7libcbcf___pyx_scope_struct_10___iter__);
  Py_CLEAR(clear_module_state->__pyx_type_5pysam_7libcbcf___pyx_scope_struct_10___iter__);
  Py_CLEAR(clear_module_state->__pyx_ptype_5pysam_7libcbcf___pyx_scope_struct_11___iter__);
  Py_CLEAR(clear_module_state->__pyx_type_5pysam_7libcbcf___pyx_scope_struct_11___iter__);
  Py_CLEAR(clear_module_state->__pyx_ptype_5pysam_7libcbcf___pyx_scope_struct_12_itervalues);
  Py_CLEAR(clear_module_state->__pyx_type_5pysam_7libcbcf___pyx_scope_struct_12_itervalues);
  Py_CLEAR(clear_module_state->__pyx_ptype_5pysam_7libcbcf___pyx_scope_struct_13_iteritems);
  Py_CLEAR(clear_module_state->__pyx_type_5pysam_7libcbcf___pyx_scope_struct_13_iteritems);
  Py_CLEAR(clear_module_state->__pyx_ptype_5pysam_7libcbcf___pyx_scope_struct_14___iter__);
  Py_CLEAR(clear_module_state->__pyx_type_5pysam_7libcbcf___pyx_scope_struct_14___iter__);
  Py_CLEAR(clear_module_state->__pyx_ptype_5pysam_7libcbcf___pyx_scope_struct_15_itervalues);
  Py_CLEAR(clear_module_state->__pyx_type_5pysam_7libcbcf___pyx_scope_struct_15_itervalues);
  Py_CLEAR(clear_module_state->__pyx_ptype_5pysam_7libcbcf___pyx_scope_struct_16_iteritems);
  Py_CLEAR(clear_module_state->__pyx_type_5pysam_7libcbcf___pyx_scope_struct_16_iteritems);
  Py_CLEAR(clear_module_state->__pyx_ptype_5pysam_7libcbcf___pyx_scope_struct_17___iter__);
  Py_CLEAR(clear_module_state->__pyx_type_5pysam_7libcbcf___pyx_scope_struct_17___iter__);
  Py_CLEAR(clear_module_state->__pyx_ptype_5pysam_7libcbcf___pyx_scope_struct_18___iter__);
  Py_CLEAR(clear_module_state->__pyx_type_5pysam_7libcbcf___pyx_scope_struct_18___iter__);
  Py_CLEAR(clear_module_state->__pyx_ptype_5pysam_7libcbcf___pyx_scope_struct_19_itervalues);
  Py_CLEAR(clear_module_state->__pyx_type_5pysam_7libcbcf___pyx_scope_struct_19_itervalues);
  Py_CLEAR(clear_module_state->__pyx_ptype_5pysam_7libcbcf___pyx_scope_struct_20_iteritems);
  Py_CLEAR(clear_module_state->__pyx_type_5pysam_7libcbcf___pyx_scope_struct_20_iteritems);
  Py_CLEAR(clear_module_state->__pyx_ptype_5pysam_7libcbcf___pyx_scope_struct_21___iter__);
  Py_CLEAR(clear_module_state->__pyx_type_5pysam_7libcbcf___pyx_scope_struct_21___iter__);
  Py_CLEAR(clear_module_state->__pyx_ptype_5pysam_7libcbcf___pyx_scope_struct_22_itervalues);
  Py_CLEAR(clear_module_state->__pyx_type_5pysam_7libcbcf___pyx_scope_struct_22_itervalues);
  Py_CLEAR(clear_module_state->__pyx_ptype_5pysam_7libcbcf___pyx_scope_struct_23_iteritems);
  Py_CLEAR(clear_module_state->__pyx_type_5pysam_7libcbcf___pyx_scope_struct_23_iteritems);
  Py_CLEAR(clear_module_state->__pyx_ptype_5pysam_7libcbcf___pyx_scope_struct_24___iter__);
  Py_CLEAR(clear_module_state->__pyx_type_5pysam_7libcbcf___pyx_scope_struct_24___iter__);
  Py_CLEAR(clear_module_state->__pyx_ptype_5pysam_7libcbcf___pyx_scope_struct_25_itervalues);
  Py_CLEAR(clear_module_state->__pyx_type_5pysam_7libcbcf___pyx_scope_struct_25_itervalues);
  Py_CLEAR(clear_module_state->__pyx_ptype_5pysam_7libcbcf___pyx_scope_struct_26_iteritems);
  Py_CLEAR(clear_module_state->__pyx_type_5pysam_7libcbcf___pyx_scope_struct_26_iteritems);
  Py_CLEAR(clear_module_state->__pyx_ptype_5pysam_7libcbcf___pyx_scope_struct_27___iter__);
  Py_CLEAR(clear_module_state->__pyx_type_5pysam_7libcbcf___pyx_scope_struct_27___iter__);
  Py_CLEAR(clear_module_state->__pyx_ptype_5pysam_7libcbcf___pyx_scope_struct_28_itervalues);
  Py_CLEAR(clear_module_state->__pyx_type_5pysam_7libcbcf___pyx_scope_struct_28_itervalues);
  Py_CLEAR(clear_module_state->__pyx_ptype_5pysam_7libcbcf___pyx_scope_struct_29_iteritems);
  Py_CLEAR(clear_module_state->__pyx_type_5pysam_7libcbcf___pyx_scope_struct_29_iteritems);
  Py_CLEAR(clear_module_state->__pyx_ptype_5pysam_7libcbcf___pyx_scope_struct_30___set__);
  Py_CLEAR(clear_module_state->__pyx_type_5pysam_7libcbcf___pyx_scope_struct_30___set__);
  Py_CLEAR(clear_module_state->__pyx_ptype_5pysam_7libcbcf___pyx_scope_struct_31_genexpr);
  Py_CLEAR(clear_module_state->__pyx_type_5pysam_7libcbcf___pyx_scope_struct_31_genexpr);
  Py_CLEAR(clear_module_state->__pyx_ptype_5pysam_7libcbcf___pyx_scope_struct_32_genexpr);
  Py_CLEAR(clear_module_state->__pyx_type_5pysam_7libcbcf___pyx_scope_struct_32_genexpr);
  Py_CLEAR(clear_module_state->__pyx_ptype_5pysam_7libcbcf___pyx_scope_struct_33___iter__);
  Py_CLEAR(clear_module_state->__pyx_type_5pysam_7libcbcf___pyx_scope_struct_33___iter__);
  Py_CLEAR(clear_module_state->__pyx_ptype_5pysam_7libcbcf___pyx_scope_struct_34_itervalues);
  Py_CLEAR(clear_module_state->__pyx_type_5pysam_7libcbcf___pyx_scope_struct_34_itervalues);
  Py_CLEAR(clear_module_state->__pyx_ptype_5pysam_7libcbcf___pyx_scope_struct_35_iteritems);
  Py_CLEAR(clear_module_state->__pyx_type_5pysam_7libcbcf___pyx_scope_struct_35_iteritems);
  Py_CLEAR(clear_module_state->__pyx_ptype_5pysam_7libcbcf___pyx_scope_struct_36_itervalues);
  Py_CLEAR(clear_module_state->__pyx_type_5pysam_7libcbcf___pyx_scope_struct_36_itervalues);
  Py_CLEAR(clear_module_state->__pyx_ptype_5pysam_7libcbcf___pyx_scope_struct_37_iteritems);
  Py_CLEAR(clear_module_state->__pyx_type_5pysam_7libcbcf___pyx_scope_struct_37_iteritems);
  Py_CLEAR(clear_module_state->__pyx_k__3);
  Py_CLEAR(clear_module_state->__pyx_k__6);
  Py_CLEAR(clear_module_state->__pyx_k__7);
  Py_CLEAR(clear_module_state->__pyx_k__9);
  Py_CLEAR(clear_module_state->__pyx_k__10);
  for (int i=0; i<1; ++i) { Py_CLEAR(clear_module_state->__pyx_slice[i]); }
  for (int i=0; i<15; ++i) { Py_CLEAR(clear_module_state->__pyx_tuple[i]); }
  for (int i=0; i<412; ++i) { Py_CLEAR(clear_module_state->__pyx_codeobj_tab[i]); }
  for (int i=0; i<716; ++i) { Py_CLEAR(clear_module_state->__pyx_string_tab[i]); }
  Py_CLEAR(clear_module_state->__pyx_int_0);
  Py_CLEAR(clear_module_state->__pyx_int_1);
  Py_CLEAR(clear_module_state->__pyx_int_2);
  Py_CLEAR(clear_module_state->__pyx_int_10091417);
  Py_CLEAR(clear_module_state->__pyx_int_10698032);
  Py_CLEAR(clear_module_state->__pyx_int_31479882);
  Py_CLEAR(clear_module_state->__pyx_int_33440904);
  Py_CLEAR(clear_module_state->__pyx_int_39264352);
  Py_CLEAR(clear_module_state->__pyx_int_41264896);
  Py_CLEAR(clear_module_state->__pyx_int_93650198);
  Py_CLEAR(clear_module_state->__pyx_int_94171383);
  Py_CLEAR(clear_module_state->__pyx_int_97976187);
  Py_CLEAR(clear_module_state->__pyx_int_118286449);
  Py_CLEAR(clear_module_state->__pyx_int_126454353);
  Py_CLEAR(clear_module_state->__pyx_int_135711299);
  Py_CLEAR(clear_module_state->__pyx_int_145625440);
  Py_CLEAR(clear_module_state->__pyx_int_164668780);
  Py_CLEAR(clear_module_state->__pyx_int_168021462);
  Py_CLEAR(clear_module_state->__pyx_int_199651019);
  Py_CLEAR(clear_module_state->__pyx_int_215036767);
  Py_CLEAR(clear_module_state->__pyx_int_227765731);
  Py_CLEAR(clear_module_state->__pyx_int_232881935);
  Py_CLEAR(clear_module_state->__pyx_int_248899179);
  Py_CLEAR(clear_module_state->__pyx_int_250317299);
  Py_CLEAR(clear_module_state->__pyx_int_4294967294);
  Py_CLEAR(clear_module_state->__pyx_int_neg_1);
  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);
  #ifdef __Pyx_CyFunction_USED
  Py_VISIT(traverse_module_state->__pyx_CyFunctionType);
  #endif
  #ifdef __Pyx_FusedFunction_USED
  Py_VISIT(traverse_module_state->__pyx_FusedFunctionType);
  #endif
  Py_VISIT(traverse_module_state->__pyx_ptype_5pysam_10libchtslib_HTSFile);
  Py_VISIT(traverse_module_state->__pyx_ptype_7cpython_4type_type);
  Py_VISIT(traverse_module_state->__pyx_ptype_7cpython_4bool_bool);
  Py_VISIT(traverse_module_state->__pyx_ptype_7cpython_7complex_complex);
  Py_VISIT(traverse_module_state->__pyx_ptype_7cpython_5array_array);
  Py_VISIT(traverse_module_state->__pyx_ptype_5pysam_7libcbcf_VariantHeader);
  Py_VISIT(traverse_module_state->__pyx_type_5pysam_7libcbcf_VariantHeader);
  Py_VISIT(traverse_module_state->__pyx_ptype_5pysam_7libcbcf_VariantHeaderRecord);
  Py_VISIT(traverse_module_state->__pyx_type_5pysam_7libcbcf_VariantHeaderRecord);
  Py_VISIT(traverse_module_state->__pyx_ptype_5pysam_7libcbcf_VariantHeaderRecords);
  Py_VISIT(traverse_module_state->__pyx_type_5pysam_7libcbcf_VariantHeaderRecords);
  Py_VISIT(traverse_module_state->__pyx_ptype_5pysam_7libcbcf_VariantHeaderContigs);
  Py_VISIT(traverse_module_state->__pyx_type_5pysam_7libcbcf_VariantHeaderContigs);
  Py_VISIT(traverse_module_state->__pyx_ptype_5pysam_7libcbcf_VariantHeaderSamples);
  Py_VISIT(traverse_module_state->__pyx_type_5pysam_7libcbcf_VariantHeaderSamples);
  Py_VISIT(traverse_module_state->__pyx_ptype_5pysam_7libcbcf_VariantContig);
  Py_VISIT(traverse_module_state->__pyx_type_5pysam_7libcbcf_VariantContig);
  Py_VISIT(traverse_module_state->__pyx_ptype_5pysam_7libcbcf_VariantMetadata);
  Py_VISIT(traverse_module_state->__pyx_type_5pysam_7libcbcf_VariantMetadata);
  Py_VISIT(traverse_module_state->__pyx_ptype_5pysam_7libcbcf_VariantHeaderMetadata);
  Py_VISIT(traverse_module_state->__pyx_type_5pysam_7libcbcf_VariantHeaderMetadata);
  Py_VISIT(traverse_module_state->__pyx_ptype_5pysam_7libcbcf_VariantRecord);
  Py_VISIT(traverse_module_state->__pyx_type_5pysam_7libcbcf_VariantRecord);
  Py_VISIT(traverse_module_state->__pyx_ptype_5pysam_7libcbcf_VariantRecordFilter);
  Py_VISIT(traverse_module_state->__pyx_type_5pysam_7libcbcf_VariantRecordFilter);
  Py_VISIT(traverse_module_state->__pyx_ptype_5pysam_7libcbcf_VariantRecordFormat);
  Py_VISIT(traverse_module_state->__pyx_type_5pysam_7libcbcf_VariantRecordFormat);
  Py_VISIT(traverse_module_state->__pyx_ptype_5pysam_7libcbcf_VariantRecordInfo);
  Py_VISIT(traverse_module_state->__pyx_type_5pysam_7libcbcf_VariantRecordInfo);
  Py_VISIT(traverse_module_state->__pyx_ptype_5pysam_7libcbcf_VariantRecordSamples);
  Py_VISIT(traverse_module_state->__pyx_type_5pysam_7libcbcf_VariantRecordSamples);
  Py_VISIT(traverse_module_state->__pyx_ptype_5pysam_7libcbcf_VariantRecordSample);
  Py_VISIT(traverse_module_state->__pyx_type_5pysam_7libcbcf_VariantRecordSample);
  Py_VISIT(traverse_module_state->__pyx_ptype_5pysam_7libcbcf_BaseIndex);
  Py_VISIT(traverse_module_state->__pyx_type_5pysam_7libcbcf_BaseIndex);
  Py_VISIT(traverse_module_state->__pyx_ptype_5pysam_7libcbcf_BCFIndex);
  Py_VISIT(traverse_module_state->__pyx_type_5pysam_7libcbcf_BCFIndex);
  Py_VISIT(traverse_module_state->__pyx_ptype_5pysam_7libcbcf_TabixIndex);
  Py_VISIT(traverse_module_state->__pyx_type_5pysam_7libcbcf_TabixIndex);
  Py_VISIT(traverse_module_state->__pyx_ptype_5pysam_7libcbcf_BaseIterator);
  Py_VISIT(traverse_module_state->__pyx_type_5pysam_7libcbcf_BaseIterator);
  Py_VISIT(traverse_module_state->__pyx_ptype_5pysam_7libcbcf_BCFIterator);
  Py_VISIT(traverse_module_state->__pyx_type_5pysam_7libcbcf_BCFIterator);
  Py_VISIT(traverse_module_state->__pyx_ptype_5pysam_7libcbcf_TabixIterator);
  Py_VISIT(traverse_module_state->__pyx_type_5pysam_7libcbcf_TabixIterator);
  Py_VISIT(traverse_module_state->__pyx_ptype_5pysam_7libcbcf_VariantFile);
  Py_VISIT(traverse_module_state->__pyx_type_5pysam_7libcbcf_VariantFile);
  Py_VISIT(traverse_module_state->__pyx_ptype_5pysam_7libcbcf___pyx_scope_struct____pyx_f_5pysam_7libcbcf_char_array_to_tuple);
  Py_VISIT(traverse_module_state->__pyx_type_5pysam_7libcbcf___pyx_scope_struct____pyx_f_5pysam_7libcbcf_char_array_to_tuple);
  Py_VISIT(traverse_module_state->__pyx_ptype_5pysam_7libcbcf___pyx_scope_struct_1_genexpr);
  Py_VISIT(traverse_module_state->__pyx_type_5pysam_7libcbcf___pyx_scope_struct_1_genexpr);
  Py_VISIT(traverse_module_state->__pyx_ptype_5pysam_7libcbcf___pyx_scope_struct_2_genexpr);
  Py_VISIT(traverse_module_state->__pyx_type_5pysam_7libcbcf___pyx_scope_struct_2_genexpr);
  Py_VISIT(traverse_module_state->__pyx_ptype_5pysam_7libcbcf___pyx_scope_struct_3_genexpr);
  Py_VISIT(traverse_module_state->__pyx_type_5pysam_7libcbcf___pyx_scope_struct_3_genexpr);
  Py_VISIT(traverse_module_state->__pyx_ptype_5pysam_7libcbcf___pyx_scope_struct_4_genexpr);
  Py_VISIT(traverse_module_state->__pyx_type_5pysam_7libcbcf___pyx_scope_struct_4_genexpr);
  Py_VISIT(traverse_module_state->__pyx_ptype_5pysam_7libcbcf___pyx_scope_struct_5___get__);
  Py_VISIT(traverse_module_state->__pyx_type_5pysam_7libcbcf___pyx_scope_struct_5___get__);
  Py_VISIT(traverse_module_state->__pyx_ptype_5pysam_7libcbcf___pyx_scope_struct_6_genexpr);
  Py_VISIT(traverse_module_state->__pyx_type_5pysam_7libcbcf___pyx_scope_struct_6_genexpr);
  Py_VISIT(traverse_module_state->__pyx_ptype_5pysam_7libcbcf___pyx_scope_struct_7___iter__);
  Py_VISIT(traverse_module_state->__pyx_type_5pysam_7libcbcf___pyx_scope_struct_7___iter__);
  Py_VISIT(traverse_module_state->__pyx_ptype_5pysam_7libcbcf___pyx_scope_struct_8_itervalues);
  Py_VISIT(traverse_module_state->__pyx_type_5pysam_7libcbcf___pyx_scope_struct_8_itervalues);
  Py_VISIT(traverse_module_state->__pyx_ptype_5pysam_7libcbcf___pyx_scope_struct_9_iteritems);
  Py_VISIT(traverse_module_state->__pyx_type_5pysam_7libcbcf___pyx_scope_struct_9_iteritems);
  Py_VISIT(traverse_module_state->__pyx_ptype_5pysam_7libcbcf___pyx_scope_struct_10___iter__);
  Py_VISIT(traverse_module_state->__pyx_type_5pysam_7libcbcf___pyx_scope_struct_10___iter__);
  Py_VISIT(traverse_module_state->__pyx_ptype_5pysam_7libcbcf___pyx_scope_struct_11___iter__);
  Py_VISIT(traverse_module_state->__pyx_type_5pysam_7libcbcf___pyx_scope_struct_11___iter__);
  Py_VISIT(traverse_module_state->__pyx_ptype_5pysam_7libcbcf___pyx_scope_struct_12_itervalues);
  Py_VISIT(traverse_module_state->__pyx_type_5pysam_7libcbcf___pyx_scope_struct_12_itervalues);
  Py_VISIT(traverse_module_state->__pyx_ptype_5pysam_7libcbcf___pyx_scope_struct_13_iteritems);
  Py_VISIT(traverse_module_state->__pyx_type_5pysam_7libcbcf___pyx_scope_struct_13_iteritems);
  Py_VISIT(traverse_module_state->__pyx_ptype_5pysam_7libcbcf___pyx_scope_struct_14___iter__);
  Py_VISIT(traverse_module_state->__pyx_type_5pysam_7libcbcf___pyx_scope_struct_14___iter__);
  Py_VISIT(traverse_module_state->__pyx_ptype_5pysam_7libcbcf___pyx_scope_struct_15_itervalues);
  Py_VISIT(traverse_module_state->__pyx_type_5pysam_7libcbcf___pyx_scope_struct_15_itervalues);
  Py_VISIT(traverse_module_state->__pyx_ptype_5pysam_7libcbcf___pyx_scope_struct_16_iteritems);
  Py_VISIT(traverse_module_state->__pyx_type_5pysam_7libcbcf___pyx_scope_struct_16_iteritems);
  Py_VISIT(traverse_module_state->__pyx_ptype_5pysam_7libcbcf___pyx_scope_struct_17___iter__);
  Py_VISIT(traverse_module_state->__pyx_type_5pysam_7libcbcf___pyx_scope_struct_17___iter__);
  Py_VISIT(traverse_module_state->__pyx_ptype_5pysam_7libcbcf___pyx_scope_struct_18___iter__);
  Py_VISIT(traverse_module_state->__pyx_type_5pysam_7libcbcf___pyx_scope_struct_18___iter__);
  Py_VISIT(traverse_module_state->__pyx_ptype_5pysam_7libcbcf___pyx_scope_struct_19_itervalues);
  Py_VISIT(traverse_module_state->__pyx_type_5pysam_7libcbcf___pyx_scope_struct_19_itervalues);
  Py_VISIT(traverse_module_state->__pyx_ptype_5pysam_7libcbcf___pyx_scope_struct_20_iteritems);
  Py_VISIT(traverse_module_state->__pyx_type_5pysam_7libcbcf___pyx_scope_struct_20_iteritems);
  Py_VISIT(traverse_module_state->__pyx_ptype_5pysam_7libcbcf___pyx_scope_struct_21___iter__);
  Py_VISIT(traverse_module_state->__pyx_type_5pysam_7libcbcf___pyx_scope_struct_21___iter__);
  Py_VISIT(traverse_module_state->__pyx_ptype_5pysam_7libcbcf___pyx_scope_struct_22_itervalues);
  Py_VISIT(traverse_module_state->__pyx_type_5pysam_7libcbcf___pyx_scope_struct_22_itervalues);
  Py_VISIT(traverse_module_state->__pyx_ptype_5pysam_7libcbcf___pyx_scope_struct_23_iteritems);
  Py_VISIT(traverse_module_state->__pyx_type_5pysam_7libcbcf___pyx_scope_struct_23_iteritems);
  Py_VISIT(traverse_module_state->__pyx_ptype_5pysam_7libcbcf___pyx_scope_struct_24___iter__);
  Py_VISIT(traverse_module_state->__pyx_type_5pysam_7libcbcf___pyx_scope_struct_24___iter__);
  Py_VISIT(traverse_module_state->__pyx_ptype_5pysam_7libcbcf___pyx_scope_struct_25_itervalues);
  Py_VISIT(traverse_module_state->__pyx_type_5pysam_7libcbcf___pyx_scope_struct_25_itervalues);
  Py_VISIT(traverse_module_state->__pyx_ptype_5pysam_7libcbcf___pyx_scope_struct_26_iteritems);
  Py_VISIT(traverse_module_state->__pyx_type_5pysam_7libcbcf___pyx_scope_struct_26_iteritems);
  Py_VISIT(traverse_module_state->__pyx_ptype_5pysam_7libcbcf___pyx_scope_struct_27___iter__);
  Py_VISIT(traverse_module_state->__pyx_type_5pysam_7libcbcf___pyx_scope_struct_27___iter__);
  Py_VISIT(traverse_module_state->__pyx_ptype_5pysam_7libcbcf___pyx_scope_struct_28_itervalues);
  Py_VISIT(traverse_module_state->__pyx_type_5pysam_7libcbcf___pyx_scope_struct_28_itervalues);
  Py_VISIT(traverse_module_state->__pyx_ptype_5pysam_7libcbcf___pyx_scope_struct_29_iteritems);
  Py_VISIT(traverse_module_state->__pyx_type_5pysam_7libcbcf___pyx_scope_struct_29_iteritems);
  Py_VISIT(traverse_module_state->__pyx_ptype_5pysam_7libcbcf___pyx_scope_struct_30___set__);
  Py_VISIT(traverse_module_state->__pyx_type_5pysam_7libcbcf___pyx_scope_struct_30___set__);
  Py_VISIT(traverse_module_state->__pyx_ptype_5pysam_7libcbcf___pyx_scope_struct_31_genexpr);
  Py_VISIT(traverse_module_state->__pyx_type_5pysam_7libcbcf___pyx_scope_struct_31_genexpr);
  Py_VISIT(traverse_module_state->__pyx_ptype_5pysam_7libcbcf___pyx_scope_struct_32_genexpr);
  Py_VISIT(traverse_module_state->__pyx_type_5pysam_7libcbcf___pyx_scope_struct_32_genexpr);
  Py_VISIT(traverse_module_state->__pyx_ptype_5pysam_7libcbcf___pyx_scope_struct_33___iter__);
  Py_VISIT(traverse_module_state->__pyx_type_5pysam_7libcbcf___pyx_scope_struct_33___iter__);
  Py_VISIT(traverse_module_state->__pyx_ptype_5pysam_7libcbcf___pyx_scope_struct_34_itervalues);
  Py_VISIT(traverse_module_state->__pyx_type_5pysam_7libcbcf___pyx_scope_struct_34_itervalues);
  Py_VISIT(traverse_module_state->__pyx_ptype_5pysam_7libcbcf___pyx_scope_struct_35_iteritems);
  Py_VISIT(traverse_module_state->__pyx_type_5pysam_7libcbcf___pyx_scope_struct_35_iteritems);
  Py_VISIT(traverse_module_state->__pyx_ptype_5pysam_7libcbcf___pyx_scope_struct_36_itervalues);
  Py_VISIT(traverse_module_state->__pyx_type_5pysam_7libcbcf___pyx_scope_struct_36_itervalues);
  Py_VISIT(traverse_module_state->__pyx_ptype_5pysam_7libcbcf___pyx_scope_struct_37_iteritems);
  Py_VISIT(traverse_module_state->__pyx_type_5pysam_7libcbcf___pyx_scope_struct_37_iteritems);
  Py_VISIT(traverse_module_state->__pyx_k__3);
  Py_VISIT(traverse_module_state->__pyx_k__6);
  Py_VISIT(traverse_module_state->__pyx_k__7);
  Py_VISIT(traverse_module_state->__pyx_k__9);
  Py_VISIT(traverse_module_state->__pyx_k__10);
  for (int i=0; i<1; ++i) { __Pyx_VISIT_CONST(traverse_module_state->__pyx_slice[i]); }
  for (int i=0; i<15; ++i) { __Pyx_VISIT_CONST(traverse_module_state->__pyx_tuple[i]); }
  for (int i=0; i<412; ++i) { __Pyx_VISIT_CONST(traverse_module_state->__pyx_codeobj_tab[i]); }
  for (int i=0; i<716; ++i) { __Pyx_VISIT_CONST(traverse_module_state->__pyx_string_tab[i]); }
  __Pyx_VISIT_CONST(traverse_module_state->__pyx_int_0);
  __Pyx_VISIT_CONST(traverse_module_state->__pyx_int_1);
  __Pyx_VISIT_CONST(traverse_module_state->__pyx_int_2);
  __Pyx_VISIT_CONST(traverse_module_state->__pyx_int_10091417);
  __Pyx_VISIT_CONST(traverse_module_state->__pyx_int_10698032);
  __Pyx_VISIT_CONST(traverse_module_state->__pyx_int_31479882);
  __Pyx_VISIT_CONST(traverse_module_state->__pyx_int_33440904);
  __Pyx_VISIT_CONST(traverse_module_state->__pyx_int_39264352);
  __Pyx_VISIT_CONST(traverse_module_state->__pyx_int_41264896);
  __Pyx_VISIT_CONST(traverse_module_state->__pyx_int_93650198);
  __Pyx_VISIT_CONST(traverse_module_state->__pyx_int_94171383);
  __Pyx_VISIT_CONST(traverse_module_state->__pyx_int_97976187);
  __Pyx_VISIT_CONST(traverse_module_state->__pyx_int_118286449);
  __Pyx_VISIT_CONST(traverse_module_state->__pyx_int_126454353);
  __Pyx_VISIT_CONST(traverse_module_state->__pyx_int_135711299);
  __Pyx_VISIT_CONST(traverse_module_state->__pyx_int_145625440);
  __Pyx_VISIT_CONST(traverse_module_state->__pyx_int_164668780);
  __Pyx_VISIT_CONST(traverse_module_state->__pyx_int_168021462);
  __Pyx_VISIT_CONST(traverse_module_state->__pyx_int_199651019);
  __Pyx_VISIT_CONST(traverse_module_state->__pyx_int_215036767);
  __Pyx_VISIT_CONST(traverse_module_state->__pyx_int_227765731);
  __Pyx_VISIT_CONST(traverse_module_state->__pyx_int_232881935);
  __Pyx_VISIT_CONST(traverse_module_state->__pyx_int_248899179);
  __Pyx_VISIT_CONST(traverse_module_state->__pyx_int_250317299);
  __Pyx_VISIT_CONST(traverse_module_state->__pyx_int_4294967294);
  __Pyx_VISIT_CONST(traverse_module_state->__pyx_int_neg_1);
  return 0;
}
#endif
/* #### Code section: module_code ### */

/* "cpython/complex.pxd":20
 * 
 *         # unavailable in limited API
 *         @property             # <<<<<<<<<<<<<<
 *         @_cython.c_compile_guard("!CYTHON_COMPILING_IN_LIMITED_API")
 *         cdef inline double real(self) noexcept:
*/

#if !CYTHON_COMPILING_IN_LIMITED_API
static CYTHON_INLINE double __pyx_f_7cpython_7complex_7complex_4real_real(PyComplexObject *__pyx_v_self) {
  double __pyx_r;

  /* "cpython/complex.pxd":23
 *         @_cython.c_compile_guard("!CYTHON_COMPILING_IN_LIMITED_API")
 *         cdef inline double real(self) noexcept:
 *             return self.cval.real             # <<<<<<<<<<<<<<
 * 
 *         # unavailable in limited API
*/
  __pyx_r = __pyx_v_self->cval.real;
  goto __pyx_L0;

  /* "cpython/complex.pxd":20
 * 
 *         # unavailable in limited API
 *         @property             # <<<<<<<<<<<<<<
 *         @_cython.c_compile_guard("!CYTHON_COMPILING_IN_LIMITED_API")
 *         cdef inline double real(self) noexcept:
*/

  /* function exit code */
  __pyx_L0:;
  return __pyx_r;
}
#endif /*!(#if !CYTHON_COMPILING_IN_LIMITED_API)*/

/* "cpython/complex.pxd":26
 * 
 *         # unavailable in limited API
 *         @property             # <<<<<<<<<<<<<<
 *         @_cython.c_compile_guard("!CYTHON_COMPILING_IN_LIMITED_API")
 *         cdef inline double imag(self) noexcept:
*/

#if !CYTHON_COMPILING_IN_LIMITED_API
static CYTHON_INLINE double __pyx_f_7cpython_7complex_7complex_4imag_imag(PyComplexObject *__pyx_v_self) {
  double __pyx_r;

  /* "cpython/complex.pxd":29
 *         @_cython.c_compile_guard("!CYTHON_COMPILING_IN_LIMITED_API")
 *         cdef inline double imag(self) noexcept:
 *             return self.cval.imag             # <<<<<<<<<<<<<<
 * 
 *     # PyTypeObject PyComplex_Type
*/
  __pyx_r = __pyx_v_self->cval.imag;
  goto __pyx_L0;

  /* "cpython/complex.pxd":26
 * 
 *         # unavailable in limited API
 *         @property             # <<<<<<<<<<<<<<
 *         @_cython.c_compile_guard("!CYTHON_COMPILING_IN_LIMITED_API")
 *         cdef inline double imag(self) noexcept:
*/

  /* function exit code */
  __pyx_L0:;
  return __pyx_r;
}
#endif /*!(#if !CYTHON_COMPILING_IN_LIMITED_API)*/

/* "cpython/contextvars.pxd":115
 * 
 * 
 * @_cython.c_compile_guard("!CYTHON_COMPILING_IN_LIMITED_API")             # <<<<<<<<<<<<<<
 * cdef inline object get_value(var, default_value=None):
 *     """Return a new reference to the value of the context variable,
*/

#if !CYTHON_COMPILING_IN_LIMITED_API
static CYTHON_INLINE PyObject *__pyx_f_7cpython_11contextvars_get_value(PyObject *__pyx_v_var, struct __pyx_opt_args_7cpython_11contextvars_get_value *__pyx_optional_args) {

  /* "cpython/contextvars.pxd":116
 * 
 * @_cython.c_compile_guard("!CYTHON_COMPILING_IN_LIMITED_API")
 * cdef inline object get_value(var, default_value=None):             # <<<<<<<<<<<<<<
 *     """Return a new reference to the value of the context variable,
 *     or the default value of the context variable,
*/
  PyObject *__pyx_v_default_value = ((PyObject *)Py_None);
  PyObject *__pyx_v_value;
  PyObject *__pyx_v_pyvalue = NULL;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  int __pyx_t_2;
  PyObject *__pyx_t_3 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("get_value", 0);
  if (__pyx_optional_args) {
    if (__pyx_optional_args->__pyx_n > 0) {
      __pyx_v_default_value = __pyx_optional_args->default_value;
    }
  }

  /* "cpython/contextvars.pxd":121
 *     or None if no such value or default was found.
 *     """
 *     cdef PyObject *value = NULL             # <<<<<<<<<<<<<<
 *     PyContextVar_Get(var, NULL, &value)
 *     if value is NULL:
*/
  __pyx_v_value = NULL;

  /* "cpython/contextvars.pxd":122
 *     """
 *     cdef PyObject *value = NULL
 *     PyContextVar_Get(var, NULL, &value)             # <<<<<<<<<<<<<<
 *     if value is NULL:
 *         # context variable does not have a default
*/
  __pyx_t_1 = PyContextVar_Get(__pyx_v_var, NULL, (&__pyx_v_value)); if (unlikely(__pyx_t_1 == ((int)-1))) __PYX_ERR(1, 122, __pyx_L1_error)

  /* "cpython/contextvars.pxd":123
 *     cdef PyObject *value = NULL
 *     PyContextVar_Get(var, NULL, &value)
 *     if value is NULL:             # <<<<<<<<<<<<<<
 *         # context variable does not have a default
 *         pyvalue = default_value
*/
  __pyx_t_2 = (__pyx_v_value == NULL);
  if (__pyx_t_2) {

    /* "cpython/contextvars.pxd":125
 *     if value is NULL:
 *         # context variable does not have a default
 *         pyvalue = default_value             # <<<<<<<<<<<<<<
 *     else:
 *         # value or default value of context variable
*/
    __Pyx_INCREF(__pyx_v_default_value);
    __pyx_v_pyvalue = __pyx_v_default_value;

    /* "cpython/contextvars.pxd":123
 *     cdef PyObject *value = NULL
 *     PyContextVar_Get(var, NULL, &value)
 *     if value is NULL:             # <<<<<<<<<<<<<<
 *         # context variable does not have a default
 *         pyvalue = default_value
*/
    goto __pyx_L3;
  }

  /* "cpython/contextvars.pxd":128
 *     else:
 *         # value or default value of context variable
 *         pyvalue = <object>value             # <<<<<<<<<<<<<<
 *         Py_XDECREF(value)  # PyContextVar_Get() returned an owned reference as 'PyObject*'
 *     return pyvalue
*/
  /*else*/ {
    __pyx_t_3 = ((PyObject *)__pyx_v_value);
    __Pyx_INCREF(__pyx_t_3);
    __pyx_v_pyvalue = __pyx_t_3;
    __pyx_t_3 = 0;

    /* "cpython/contextvars.pxd":129
 *         # value or default value of context variable
 *         pyvalue = <object>value
 *         Py_XDECREF(value)  # PyContextVar_Get() returned an owned reference as 'PyObject*'             # <<<<<<<<<<<<<<
 *     return pyvalue
 * 
*/
    Py_XDECREF(__pyx_v_value);
  }
  __pyx_L3:;

  /* "cpython/contextvars.pxd":130
 *         pyvalue = <object>value
 *         Py_XDECREF(value)  # PyContextVar_Get() returned an owned reference as 'PyObject*'
 *     return pyvalue             # <<<<<<<<<<<<<<
 * 
 * 
*/
  __Pyx_XDECREF(__pyx_r);
  __Pyx_INCREF(__pyx_v_pyvalue);
  __pyx_r = __pyx_v_pyvalue;
  goto __pyx_L0;

  /* "cpython/contextvars.pxd":115
 * 
 * 
 * @_cython.c_compile_guard("!CYTHON_COMPILING_IN_LIMITED_API")             # <<<<<<<<<<<<<<
 * cdef inline object get_value(var, default_value=None):
 *     """Return a new reference to the value of the context variable,
*/

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_AddTraceback("cpython.contextvars.get_value", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_pyvalue);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}
#endif /*!(#if !CYTHON_COMPILING_IN_LIMITED_API)*/

/* "cpython/contextvars.pxd":133
 * 
 * 
 * @_cython.c_compile_guard("!CYTHON_COMPILING_IN_LIMITED_API")             # <<<<<<<<<<<<<<
 * cdef inline object get_value_no_default(var, default_value=None):
 *     """Return a new reference to the value of the context variable,
*/

#if !CYTHON_COMPILING_IN_LIMITED_API
static CYTHON_INLINE PyObject *__pyx_f_7cpython_11contextvars_get_value_no_default(PyObject *__pyx_v_var, struct __pyx_opt_args_7cpython_11contextvars_get_value_no_default *__pyx_optional_args) {

  /* "cpython/contextvars.pxd":134
 * 
 * @_cython.c_compile_guard("!CYTHON_COMPILING_IN_LIMITED_API")
 * cdef inline object get_value_no_default(var, default_value=None):             # <<<<<<<<<<<<<<
 *     """Return a new reference to the value of the context variable,
 *     or the provided default value if no such value was found.
*/
  PyObject *__pyx_v_default_value = ((PyObject *)Py_None);
  PyObject *__pyx_v_value;
  PyObject *__pyx_v_pyvalue = NULL;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  PyObject *__pyx_t_2 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("get_value_no_default", 0);
  if (__pyx_optional_args) {
    if (__pyx_optional_args->__pyx_n > 0) {
      __pyx_v_default_value = __pyx_optional_args->default_value;
    }
  }

  /* "cpython/contextvars.pxd":140
 *     Ignores the default value of the context variable, if any.
 *     """
 *     cdef PyObject *value = NULL             # <<<<<<<<<<<<<<
 *     PyContextVar_Get(var, <PyObject*>default_value, &value)
 *     # value of context variable or 'default_value'
*/
  __pyx_v_value = NULL;

  /* "cpython/contextvars.pxd":141
 *     """
 *     cdef PyObject *value = NULL
 *     PyContextVar_Get(var, <PyObject*>default_value, &value)             # <<<<<<<<<<<<<<
 *     # value of context variable or 'default_value'
 *     pyvalue = <object>value
*/
  __pyx_t_1 = PyContextVar_Get(__pyx_v_var, ((PyObject *)__pyx_v_default_value), (&__pyx_v_value)); if (unlikely(__pyx_t_1 == ((int)-1))) __PYX_ERR(1, 141, __pyx_L1_error)

  /* "cpython/contextvars.pxd":143
 *     PyContextVar_Get(var, <PyObject*>default_value, &value)
 *     # value of context variable or 'default_value'
 *     pyvalue = <object>value             # <<<<<<<<<<<<<<
 *     Py_XDECREF(value)  # PyContextVar_Get() returned an owned reference as 'PyObject*'
 *     return pyvalue
*/
  __pyx_t_2 = ((PyObject *)__pyx_v_value);
  __Pyx_INCREF(__pyx_t_2);
  __pyx_v_pyvalue = __pyx_t_2;
  __pyx_t_2 = 0;

  /* "cpython/contextvars.pxd":144
 *     # value of context variable or 'default_value'
 *     pyvalue = <object>value
 *     Py_XDECREF(value)  # PyContextVar_Get() returned an owned reference as 'PyObject*'             # <<<<<<<<<<<<<<
 *     return pyvalue
*/
  Py_XDECREF(__pyx_v_value);

  /* "cpython/contextvars.pxd":145
 *     pyvalue = <object>value
 *     Py_XDECREF(value)  # PyContextVar_Get() returned an owned reference as 'PyObject*'
 *     return pyvalue             # <<<<<<<<<<<<<<
*/
  __Pyx_XDECREF(__pyx_r);
  __Pyx_INCREF(__pyx_v_pyvalue);
  __pyx_r = __pyx_v_pyvalue;
  goto __pyx_L0;

  /* "cpython/contextvars.pxd":133
 * 
 * 
 * @_cython.c_compile_guard("!CYTHON_COMPILING_IN_LIMITED_API")             # <<<<<<<<<<<<<<
 * cdef inline object get_value_no_default(var, default_value=None):
 *     """Return a new reference to the value of the context variable,
*/

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_AddTraceback("cpython.contextvars.get_value_no_default", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_pyvalue);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}
#endif /*!(#if !CYTHON_COMPILING_IN_LIMITED_API)*/

/* "array.pxd":104
 *             __data_union data
 * 
 *         def __getbuffer__(self, Py_buffer* info, int flags):             # <<<<<<<<<<<<<<
 *             # This implementation of getbuffer is geared towards Cython
 *             # requirements, and does not yet fulfill the PEP.
*/

/* Python wrapper */
CYTHON_UNUSED static int __pyx_pw_7cpython_5array_5array_1__getbuffer__(PyObject *__pyx_v_self, Py_buffer *__pyx_v_info, int __pyx_v_flags); /*proto*/
CYTHON_UNUSED static int __pyx_pw_7cpython_5array_5array_1__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_pf_7cpython_5array_5array___getbuffer__(((arrayobject *)__pyx_v_self), ((Py_buffer *)__pyx_v_info), ((int)__pyx_v_flags));

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

static int __pyx_pf_7cpython_5array_5array___getbuffer__(arrayobject *__pyx_v_self, Py_buffer *__pyx_v_info, CYTHON_UNUSED int __pyx_v_flags) {
  PyObject *__pyx_v_item_count = NULL;
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  char *__pyx_t_2;
  int __pyx_t_3;
  PyObject *__pyx_t_4 = NULL;
  Py_ssize_t __pyx_t_5;
  int __pyx_t_6;
  char __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);

  /* "array.pxd":109
 *             # In particular strided access is always provided regardless
 *             # of flags
 *             item_count = Py_SIZE(self)             # <<<<<<<<<<<<<<
 * 
 *             info.suboffsets = NULL
*/
  __pyx_t_1 = PyLong_FromSsize_t(Py_SIZE(((PyObject *)__pyx_v_self))); if (unlikely(!__pyx_t_1)) __PYX_ERR(2, 109, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_v_item_count = __pyx_t_1;
  __pyx_t_1 = 0;

  /* "array.pxd":111
 *             item_count = Py_SIZE(self)
 * 
 *             info.suboffsets = NULL             # <<<<<<<<<<<<<<
 *             info.buf = self.data.as_chars
 *             info.readonly = 0
*/
  __pyx_v_info->suboffsets = NULL;

  /* "array.pxd":112
 * 
 *             info.suboffsets = NULL
 *             info.buf = self.data.as_chars             # <<<<<<<<<<<<<<
 *             info.readonly = 0
 *             info.ndim = 1
*/
  __pyx_t_2 = __pyx_v_self->data.as_chars;
  __pyx_v_info->buf = __pyx_t_2;

  /* "array.pxd":113
 *             info.suboffsets = NULL
 *             info.buf = self.data.as_chars
 *             info.readonly = 0             # <<<<<<<<<<<<<<
 *             info.ndim = 1
 *             info.itemsize = self.ob_descr.itemsize   # e.g. sizeof(float)
*/
  __pyx_v_info->readonly = 0;

  /* "array.pxd":114
 *             info.buf = self.data.as_chars
 *             info.readonly = 0
 *             info.ndim = 1             # <<<<<<<<<<<<<<
 *             info.itemsize = self.ob_descr.itemsize   # e.g. sizeof(float)
 *             info.len = info.itemsize * item_count
*/
  __pyx_v_info->ndim = 1;

  /* "array.pxd":115
 *             info.readonly = 0
 *             info.ndim = 1
 *             info.itemsize = self.ob_descr.itemsize   # e.g. sizeof(float)             # <<<<<<<<<<<<<<
 *             info.len = info.itemsize * item_count
 * 
*/
  __pyx_t_3 = __pyx_v_self->ob_descr->itemsize;
  __pyx_v_info->itemsize = __pyx_t_3;

  /* "array.pxd":116
 *             info.ndim = 1
 *             info.itemsize = self.ob_descr.itemsize   # e.g. sizeof(float)
 *             info.len = info.itemsize * item_count             # <<<<<<<<<<<<<<
 * 
 *             info.shape = <Py_ssize_t*> PyObject_Malloc(sizeof(Py_ssize_t) + 2)
*/
  __pyx_t_1 = PyLong_FromSsize_t(__pyx_v_info->itemsize); if (unlikely(!__pyx_t_1)) __PYX_ERR(2, 116, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_4 = PyNumber_Multiply(__pyx_t_1, __pyx_v_item_count); if (unlikely(!__pyx_t_4)) __PYX_ERR(2, 116, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_t_5 = __Pyx_PyIndex_AsSsize_t(__pyx_t_4); if (unlikely((__pyx_t_5 == (Py_ssize_t)-1) && PyErr_Occurred())) __PYX_ERR(2, 116, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  __pyx_v_info->len = __pyx_t_5;

  /* "array.pxd":118
 *             info.len = info.itemsize * item_count
 * 
 *             info.shape = <Py_ssize_t*> PyObject_Malloc(sizeof(Py_ssize_t) + 2)             # <<<<<<<<<<<<<<
 *             if not info.shape:
 *                 raise MemoryError()
*/
  __pyx_v_info->shape = ((Py_ssize_t *)PyObject_Malloc(((sizeof(Py_ssize_t)) + 2)));

  /* "array.pxd":119
 * 
 *             info.shape = <Py_ssize_t*> PyObject_Malloc(sizeof(Py_ssize_t) + 2)
 *             if not info.shape:             # <<<<<<<<<<<<<<
 *                 raise MemoryError()
 *             info.shape[0] = item_count      # constant regardless of resizing
*/
  __pyx_t_6 = (!(__pyx_v_info->shape != 0));
  if (unlikely(__pyx_t_6)) {

    /* "array.pxd":120
 *             info.shape = <Py_ssize_t*> PyObject_Malloc(sizeof(Py_ssize_t) + 2)
 *             if not info.shape:
 *                 raise MemoryError()             # <<<<<<<<<<<<<<
 *             info.shape[0] = item_count      # constant regardless of resizing
 *             info.strides = &info.itemsize
*/
    PyErr_NoMemory(); __PYX_ERR(2, 120, __pyx_L1_error)

    /* "array.pxd":119
 * 
 *             info.shape = <Py_ssize_t*> PyObject_Malloc(sizeof(Py_ssize_t) + 2)
 *             if not info.shape:             # <<<<<<<<<<<<<<
 *                 raise MemoryError()
 *             info.shape[0] = item_count      # constant regardless of resizing
*/
  }

  /* "array.pxd":121
 *             if not info.shape:
 *                 raise MemoryError()
 *             info.shape[0] = item_count      # constant regardless of resizing             # <<<<<<<<<<<<<<
 *             info.strides = &info.itemsize
 * 
*/
  __pyx_t_5 = __Pyx_PyIndex_AsSsize_t(__pyx_v_item_count); if (unlikely((__pyx_t_5 == (Py_ssize_t)-1) && PyErr_Occurred())) __PYX_ERR(2, 121, __pyx_L1_error)
  (__pyx_v_info->shape[0]) = __pyx_t_5;

  /* "array.pxd":122
 *                 raise MemoryError()
 *             info.shape[0] = item_count      # constant regardless of resizing
 *             info.strides = &info.itemsize             # <<<<<<<<<<<<<<
 * 
 *             info.format = <char*> (info.shape + 1)
*/
  __pyx_v_info->strides = (&__pyx_v_info->itemsize);

  /* "array.pxd":124
 *             info.strides = &info.itemsize
 * 
 *             info.format = <char*> (info.shape + 1)             # <<<<<<<<<<<<<<
 *             info.format[0] = self.ob_descr.typecode
 *             info.format[1] = 0
*/
  __pyx_v_info->format = ((char *)(__pyx_v_info->shape + 1));

  /* "array.pxd":125
 * 
 *             info.format = <char*> (info.shape + 1)
 *             info.format[0] = self.ob_descr.typecode             # <<<<<<<<<<<<<<
 *             info.format[1] = 0
 *             info.obj = self
*/
  __pyx_t_7 = __pyx_v_self->ob_descr->typecode;
  (__pyx_v_info->format[0]) = __pyx_t_7;

  /* "array.pxd":126
 *             info.format = <char*> (info.shape + 1)
 *             info.format[0] = self.ob_descr.typecode
 *             info.format[1] = 0             # <<<<<<<<<<<<<<
 *             info.obj = self
 * 
*/
  (__pyx_v_info->format[1]) = 0;

  /* "array.pxd":127
 *             info.format[0] = self.ob_descr.typecode
 *             info.format[1] = 0
 *             info.obj = self             # <<<<<<<<<<<<<<
 * 
 *         def __releasebuffer__(self, Py_buffer* info):
*/
  __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);

  /* "array.pxd":104
 *             __data_union data
 * 
 *         def __getbuffer__(self, Py_buffer* info, int flags):             # <<<<<<<<<<<<<<
 *             # This implementation of getbuffer is geared towards Cython
 *             # requirements, and does not yet fulfill the PEP.
*/

  /* function exit code */
  __pyx_r = 0;
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_AddTraceback("cpython.array.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_XDECREF(__pyx_v_item_count);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "array.pxd":129
 *             info.obj = self
 * 
 *         def __releasebuffer__(self, Py_buffer* info):             # <<<<<<<<<<<<<<
 *             PyObject_Free(info.shape)
 * 
*/

/* Python wrapper */
CYTHON_UNUSED static void __pyx_pw_7cpython_5array_5array_3__releasebuffer__(PyObject *__pyx_v_self, Py_buffer *__pyx_v_info); /*proto*/
CYTHON_UNUSED static void __pyx_pw_7cpython_5array_5array_3__releasebuffer__(PyObject *__pyx_v_self, Py_buffer *__pyx_v_info) {
  CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__releasebuffer__ (wrapper)", 0);
  __pyx_kwvalues = __Pyx_KwValues_VARARGS(__pyx_args, __pyx_nargs);
  __pyx_pf_7cpython_5array_5array_2__releasebuffer__(((arrayobject *)__pyx_v_self), ((Py_buffer *)__pyx_v_info));

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

static void __pyx_pf_7cpython_5array_5array_2__releasebuffer__(CYTHON_UNUSED arrayobject *__pyx_v_self, Py_buffer *__pyx_v_info) {

  /* "array.pxd":130
 * 
 *         def __releasebuffer__(self, Py_buffer* info):
 *             PyObject_Free(info.shape)             # <<<<<<<<<<<<<<
 * 
 *     array newarrayobject(PyTypeObject* type, Py_ssize_t size, arraydescr *descr)
*/
  PyObject_Free(__pyx_v_info->shape);

  /* "array.pxd":129
 *             info.obj = self
 * 
 *         def __releasebuffer__(self, Py_buffer* info):             # <<<<<<<<<<<<<<
 *             PyObject_Free(info.shape)
 * 
*/

  /* function exit code */
}

/* "array.pxd":141
 * 
 * 
 * cdef inline array clone(array template, Py_ssize_t length, bint zero):             # <<<<<<<<<<<<<<
 *     """ fast creation of a new array, given a template array.
 *     type will be same as template.
*/

static CYTHON_INLINE arrayobject *__pyx_f_7cpython_5array_clone(arrayobject *__pyx_v_template, Py_ssize_t __pyx_v_length, int __pyx_v_zero) {
  arrayobject *__pyx_v_op = 0;
  arrayobject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_t_2;
  int __pyx_t_3;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("clone", 0);

  /* "array.pxd":145
 *     type will be same as template.
 *     if zero is true, new array will be initialized with zeroes."""
 *     cdef array op = newarrayobject(Py_TYPE(template), length, template.ob_descr)             # <<<<<<<<<<<<<<
 *     if zero and op is not None:
 *         memset(op.data.as_chars, 0, length * op.ob_descr.itemsize)
*/
  __pyx_t_1 = ((PyObject *)newarrayobject(Py_TYPE(((PyObject *)__pyx_v_template)), __pyx_v_length, __pyx_v_template->ob_descr)); if (unlikely(!__pyx_t_1)) __PYX_ERR(2, 145, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_v_op = ((arrayobject *)__pyx_t_1);
  __pyx_t_1 = 0;

  /* "array.pxd":146
 *     if zero is true, new array will be initialized with zeroes."""
 *     cdef array op = newarrayobject(Py_TYPE(template), length, template.ob_descr)
 *     if zero and op is not None:             # <<<<<<<<<<<<<<
 *         memset(op.data.as_chars, 0, length * op.ob_descr.itemsize)
 *     return op
*/
  if (__pyx_v_zero) {
  } else {
    __pyx_t_2 = __pyx_v_zero;
    goto __pyx_L4_bool_binop_done;
  }
  __pyx_t_3 = (((PyObject *)__pyx_v_op) != Py_None);
  __pyx_t_2 = __pyx_t_3;
  __pyx_L4_bool_binop_done:;
  if (__pyx_t_2) {

    /* "array.pxd":147
 *     cdef array op = newarrayobject(Py_TYPE(template), length, template.ob_descr)
 *     if zero and op is not None:
 *         memset(op.data.as_chars, 0, length * op.ob_descr.itemsize)             # <<<<<<<<<<<<<<
 *     return op
 * 
*/
    (void)(memset(__pyx_v_op->data.as_chars, 0, (__pyx_v_length * __pyx_v_op->ob_descr->itemsize)));

    /* "array.pxd":146
 *     if zero is true, new array will be initialized with zeroes."""
 *     cdef array op = newarrayobject(Py_TYPE(template), length, template.ob_descr)
 *     if zero and op is not None:             # <<<<<<<<<<<<<<
 *         memset(op.data.as_chars, 0, length * op.ob_descr.itemsize)
 *     return op
*/
  }

  /* "array.pxd":148
 *     if zero and op is not None:
 *         memset(op.data.as_chars, 0, length * op.ob_descr.itemsize)
 *     return op             # <<<<<<<<<<<<<<
 * 
 * cdef inline array copy(array self):
*/
  __Pyx_XDECREF((PyObject *)__pyx_r);
  __Pyx_INCREF((PyObject *)__pyx_v_op);
  __pyx_r = __pyx_v_op;
  goto __pyx_L0;

  /* "array.pxd":141
 * 
 * 
 * cdef inline array clone(array template, Py_ssize_t length, bint zero):             # <<<<<<<<<<<<<<
 *     """ fast creation of a new array, given a template array.
 *     type will be same as template.
*/

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("cpython.array.clone", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_XDECREF((PyObject *)__pyx_v_op);
  __Pyx_XGIVEREF((PyObject *)__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "array.pxd":150
 *     return op
 * 
 * cdef inline array copy(array self):             # <<<<<<<<<<<<<<
 *     """ make a copy of an array. """
 *     cdef array op = newarrayobject(Py_TYPE(self), Py_SIZE(self), self.ob_descr)
*/

static CYTHON_INLINE arrayobject *__pyx_f_7cpython_5array_copy(arrayobject *__pyx_v_self) {
  arrayobject *__pyx_v_op = 0;
  arrayobject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("copy", 0);

  /* "array.pxd":152
 * cdef inline array copy(array self):
 *     """ make a copy of an array. """
 *     cdef array op = newarrayobject(Py_TYPE(self), Py_SIZE(self), self.ob_descr)             # <<<<<<<<<<<<<<
 *     memcpy(op.data.as_chars, self.data.as_chars, Py_SIZE(op) * op.ob_descr.itemsize)
 *     return op
*/
  __pyx_t_1 = ((PyObject *)newarrayobject(Py_TYPE(((PyObject *)__pyx_v_self)), Py_SIZE(((PyObject *)__pyx_v_self)), __pyx_v_self->ob_descr)); if (unlikely(!__pyx_t_1)) __PYX_ERR(2, 152, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_v_op = ((arrayobject *)__pyx_t_1);
  __pyx_t_1 = 0;

  /* "array.pxd":153
 *     """ make a copy of an array. """
 *     cdef array op = newarrayobject(Py_TYPE(self), Py_SIZE(self), self.ob_descr)
 *     memcpy(op.data.as_chars, self.data.as_chars, Py_SIZE(op) * op.ob_descr.itemsize)             # <<<<<<<<<<<<<<
 *     return op
 * 
*/
  (void)(memcpy(__pyx_v_op->data.as_chars, __pyx_v_self->data.as_chars, (Py_SIZE(((PyObject *)__pyx_v_op)) * __pyx_v_op->ob_descr->itemsize)));

  /* "array.pxd":154
 *     cdef array op = newarrayobject(Py_TYPE(self), Py_SIZE(self), self.ob_descr)
 *     memcpy(op.data.as_chars, self.data.as_chars, Py_SIZE(op) * op.ob_descr.itemsize)
 *     return op             # <<<<<<<<<<<<<<
 * 
 * cdef inline int extend_buffer(array self, char* stuff, Py_ssize_t n) except -1:
*/
  __Pyx_XDECREF((PyObject *)__pyx_r);
  __Pyx_INCREF((PyObject *)__pyx_v_op);
  __pyx_r = __pyx_v_op;
  goto __pyx_L0;

  /* "array.pxd":150
 *     return op
 * 
 * cdef inline array copy(array self):             # <<<<<<<<<<<<<<
 *     """ make a copy of an array. """
 *     cdef array op = newarrayobject(Py_TYPE(self), Py_SIZE(self), self.ob_descr)
*/

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("cpython.array.copy", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_XDECREF((PyObject *)__pyx_v_op);
  __Pyx_XGIVEREF((PyObject *)__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "array.pxd":156
 *     return op
 * 
 * cdef inline int extend_buffer(array self, char* stuff, Py_ssize_t n) except -1:             # <<<<<<<<<<<<<<
 *     """ efficient appending of new stuff of same type
 *     (e.g. of same array type)
*/

static CYTHON_INLINE int __pyx_f_7cpython_5array_extend_buffer(arrayobject *__pyx_v_self, char *__pyx_v_stuff, Py_ssize_t __pyx_v_n) {
  Py_ssize_t __pyx_v_itemsize;
  Py_ssize_t __pyx_v_origsize;
  int __pyx_r;
  int __pyx_t_1;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;

  /* "array.pxd":160
 *     (e.g. of same array type)
 *     n: number of elements (not number of bytes!) """
 *     cdef Py_ssize_t itemsize = self.ob_descr.itemsize             # <<<<<<<<<<<<<<
 *     cdef Py_ssize_t origsize = Py_SIZE(self)
 *     resize_smart(self, origsize + n)
*/
  __pyx_t_1 = __pyx_v_self->ob_descr->itemsize;
  __pyx_v_itemsize = __pyx_t_1;

  /* "array.pxd":161
 *     n: number of elements (not number of bytes!) """
 *     cdef Py_ssize_t itemsize = self.ob_descr.itemsize
 *     cdef Py_ssize_t origsize = Py_SIZE(self)             # <<<<<<<<<<<<<<
 *     resize_smart(self, origsize + n)
 *     memcpy(self.data.as_chars + origsize * itemsize, stuff, n * itemsize)
*/
  __pyx_v_origsize = Py_SIZE(((PyObject *)__pyx_v_self));

  /* "array.pxd":162
 *     cdef Py_ssize_t itemsize = self.ob_descr.itemsize
 *     cdef Py_ssize_t origsize = Py_SIZE(self)
 *     resize_smart(self, origsize + n)             # <<<<<<<<<<<<<<
 *     memcpy(self.data.as_chars + origsize * itemsize, stuff, n * itemsize)
 *     return 0
*/
  __pyx_t_1 = resize_smart(__pyx_v_self, (__pyx_v_origsize + __pyx_v_n)); if (unlikely(__pyx_t_1 == ((int)-1))) __PYX_ERR(2, 162, __pyx_L1_error)

  /* "array.pxd":163
 *     cdef Py_ssize_t origsize = Py_SIZE(self)
 *     resize_smart(self, origsize + n)
 *     memcpy(self.data.as_chars + origsize * itemsize, stuff, n * itemsize)             # <<<<<<<<<<<<<<
 *     return 0
 * 
*/
  (void)(memcpy((__pyx_v_self->data.as_chars + (__pyx_v_origsize * __pyx_v_itemsize)), __pyx_v_stuff, (__pyx_v_n * __pyx_v_itemsize)));

  /* "array.pxd":164
 *     resize_smart(self, origsize + n)
 *     memcpy(self.data.as_chars + origsize * itemsize, stuff, n * itemsize)
 *     return 0             # <<<<<<<<<<<<<<
 * 
 * cdef inline int extend(array self, array other) except -1:
*/
  __pyx_r = 0;
  goto __pyx_L0;

  /* "array.pxd":156
 *     return op
 * 
 * cdef inline int extend_buffer(array self, char* stuff, Py_ssize_t n) except -1:             # <<<<<<<<<<<<<<
 *     """ efficient appending of new stuff of same type
 *     (e.g. of same array type)
*/

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

/* "array.pxd":166
 *     return 0
 * 
 * cdef inline int extend(array self, array other) except -1:             # <<<<<<<<<<<<<<
 *     """ extend array with data from another array; types must match. """
 *     if self.ob_descr.typecode != other.ob_descr.typecode:
*/

static CYTHON_INLINE int __pyx_f_7cpython_5array_extend(arrayobject *__pyx_v_self, arrayobject *__pyx_v_other) {
  int __pyx_r;
  int __pyx_t_1;
  int __pyx_t_2;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;

  /* "array.pxd":168
 * cdef inline int extend(array self, array other) except -1:
 *     """ extend array with data from another array; types must match. """
 *     if self.ob_descr.typecode != other.ob_descr.typecode:             # <<<<<<<<<<<<<<
 *         PyErr_BadArgument()
 *     return extend_buffer(self, other.data.as_chars, Py_SIZE(other))
*/
  __pyx_t_1 = (__pyx_v_self->ob_descr->typecode != __pyx_v_other->ob_descr->typecode);
  if (__pyx_t_1) {

    /* "array.pxd":169
 *     """ extend array with data from another array; types must match. """
 *     if self.ob_descr.typecode != other.ob_descr.typecode:
 *         PyErr_BadArgument()             # <<<<<<<<<<<<<<
 *     return extend_buffer(self, other.data.as_chars, Py_SIZE(other))
 * 
*/
    __pyx_t_2 = PyErr_BadArgument(); if (unlikely(__pyx_t_2 == ((int)0))) __PYX_ERR(2, 169, __pyx_L1_error)

    /* "array.pxd":168
 * cdef inline int extend(array self, array other) except -1:
 *     """ extend array with data from another array; types must match. """
 *     if self.ob_descr.typecode != other.ob_descr.typecode:             # <<<<<<<<<<<<<<
 *         PyErr_BadArgument()
 *     return extend_buffer(self, other.data.as_chars, Py_SIZE(other))
*/
  }

  /* "array.pxd":170
 *     if self.ob_descr.typecode != other.ob_descr.typecode:
 *         PyErr_BadArgument()
 *     return extend_buffer(self, other.data.as_chars, Py_SIZE(other))             # <<<<<<<<<<<<<<
 * 
 * cdef inline void zero(array self) noexcept:
*/
  __pyx_t_2 = __pyx_f_7cpython_5array_extend_buffer(__pyx_v_self, __pyx_v_other->data.as_chars, Py_SIZE(((PyObject *)__pyx_v_other))); if (unlikely(__pyx_t_2 == ((int)-1))) __PYX_ERR(2, 170, __pyx_L1_error)
  __pyx_r = __pyx_t_2;
  goto __pyx_L0;

  /* "array.pxd":166
 *     return 0
 * 
 * cdef inline int extend(array self, array other) except -1:             # <<<<<<<<<<<<<<
 *     """ extend array with data from another array; types must match. """
 *     if self.ob_descr.typecode != other.ob_descr.typecode:
*/

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

/* "array.pxd":172
 *     return extend_buffer(self, other.data.as_chars, Py_SIZE(other))
 * 
 * cdef inline void zero(array self) noexcept:             # <<<<<<<<<<<<<<
 *     """ set all elements of array to zero. """
 *     memset(self.data.as_chars, 0, Py_SIZE(self) * self.ob_descr.itemsize)
*/

static CYTHON_INLINE void __pyx_f_7cpython_5array_zero(arrayobject *__pyx_v_self) {

  /* "array.pxd":174
 * cdef inline void zero(array self) noexcept:
 *     """ set all elements of array to zero. """
 *     memset(self.data.as_chars, 0, Py_SIZE(self) * self.ob_descr.itemsize)             # <<<<<<<<<<<<<<
*/
  (void)(memset(__pyx_v_self->data.as_chars, 0, (Py_SIZE(((PyObject *)__pyx_v_self)) * __pyx_v_self->ob_descr->itemsize)));

  /* "array.pxd":172
 *     return extend_buffer(self, other.data.as_chars, Py_SIZE(other))
 * 
 * cdef inline void zero(array self) noexcept:             # <<<<<<<<<<<<<<
 *     """ set all elements of array to zero. """
 *     memset(self.data.as_chars, 0, Py_SIZE(self) * self.ob_descr.itemsize)
*/

  /* function exit code */
}

/* "pysam/libcbcf.pyx":163
 * cdef dict bcf_str_cache = {}
 * 
 * cdef inline bcf_str_cache_get_charptr(const char* s):             # <<<<<<<<<<<<<<
 *     if s == NULL:
 *         return None
*/

static CYTHON_INLINE PyObject *__pyx_f_5pysam_7libcbcf_bcf_str_cache_get_charptr(char const *__pyx_v_s) {
  PyObject *__pyx_v_pystr;
  PyObject *__pyx_v_val = NULL;
  PyObject *__pyx_r = NULL;
  __Pyx_TraceDeclarationsFunc
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  PyObject *__pyx_t_2 = NULL;
  int __pyx_t_3;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_TraceFrameInit(((PyObject *)__pyx_mstate_global->__pyx_codeobj_tab[0]))
  __Pyx_RefNannySetupContext("bcf_str_cache_get_charptr", 0);
  __Pyx_TraceStartFunc("bcf_str_cache_get_charptr", __pyx_f[0], 163, 0, 0, 0, __PYX_ERR(0, 163, __pyx_L1_error));

  /* "pysam/libcbcf.pyx":164
 * 
 * cdef inline bcf_str_cache_get_charptr(const char* s):
 *     if s == NULL:             # <<<<<<<<<<<<<<
 *         return None
 * 
*/
  __pyx_t_1 = (__pyx_v_s == NULL);
  if (__pyx_t_1) {

    /* "pysam/libcbcf.pyx":165
 * cdef inline bcf_str_cache_get_charptr(const char* s):
 *     if s == NULL:
 *         return None             # <<<<<<<<<<<<<<
 * 
 *     cdef PyObject *pystr = PyDict_GetItemString(bcf_str_cache, s)
*/
    __Pyx_XDECREF(__pyx_r);
    __pyx_r = Py_None; __Pyx_INCREF(Py_None);
    goto __pyx_L0;

    /* "pysam/libcbcf.pyx":164
 * 
 * cdef inline bcf_str_cache_get_charptr(const char* s):
 *     if s == NULL:             # <<<<<<<<<<<<<<
 *         return None
 * 
*/
  }

  /* "pysam/libcbcf.pyx":167
 *         return None
 * 
 *     cdef PyObject *pystr = PyDict_GetItemString(bcf_str_cache, s)             # <<<<<<<<<<<<<<
 *     if pystr:
 *         return <object>pystr
*/
  __pyx_t_2 = __pyx_v_5pysam_7libcbcf_bcf_str_cache;
  __Pyx_INCREF(__pyx_t_2);
  __pyx_v_pystr = PyDict_GetItemString(__pyx_t_2, __pyx_v_s);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

  /* "pysam/libcbcf.pyx":168
 * 
 *     cdef PyObject *pystr = PyDict_GetItemString(bcf_str_cache, s)
 *     if pystr:             # <<<<<<<<<<<<<<
 *         return <object>pystr
 * 
*/
  __pyx_t_1 = (__pyx_v_pystr != 0);
  if (__pyx_t_1) {

    /* "pysam/libcbcf.pyx":169
 *     cdef PyObject *pystr = PyDict_GetItemString(bcf_str_cache, s)
 *     if pystr:
 *         return <object>pystr             # <<<<<<<<<<<<<<
 * 
 *     val = PyUnicode_DecodeUTF8(s, strlen(s), NULL)
*/
    __Pyx_XDECREF(__pyx_r);
    __Pyx_INCREF(((PyObject *)__pyx_v_pystr));
    __pyx_r = ((PyObject *)__pyx_v_pystr);
    __Pyx_TraceReturnValue(__pyx_r, 14, 0, __PYX_ERR(0, 169, __pyx_L1_error));
    goto __pyx_L0;

    /* "pysam/libcbcf.pyx":168
 * 
 *     cdef PyObject *pystr = PyDict_GetItemString(bcf_str_cache, s)
 *     if pystr:             # <<<<<<<<<<<<<<
 *         return <object>pystr
 * 
*/
  }

  /* "pysam/libcbcf.pyx":171
 *         return <object>pystr
 * 
 *     val = PyUnicode_DecodeUTF8(s, strlen(s), NULL)             # <<<<<<<<<<<<<<
 * 
 *     PyDict_SetItemString(bcf_str_cache, s, val)
*/
  __pyx_t_2 = PyUnicode_DecodeUTF8(__pyx_v_s, strlen(__pyx_v_s), NULL); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 171, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_v_val = ((PyObject*)__pyx_t_2);
  __pyx_t_2 = 0;

  /* "pysam/libcbcf.pyx":173
 *     val = PyUnicode_DecodeUTF8(s, strlen(s), NULL)
 * 
 *     PyDict_SetItemString(bcf_str_cache, s, val)             # <<<<<<<<<<<<<<
 * 
 *     return val
*/
  __pyx_t_2 = __pyx_v_5pysam_7libcbcf_bcf_str_cache;
  __Pyx_INCREF(__pyx_t_2);
  __pyx_t_3 = PyDict_SetItemString(__pyx_t_2, __pyx_v_s, __pyx_v_val); if (unlikely(__pyx_t_3 == ((int)-1))) __PYX_ERR(0, 173, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

  /* "pysam/libcbcf.pyx":175
 *     PyDict_SetItemString(bcf_str_cache, s, val)
 * 
 *     return val             # <<<<<<<<<<<<<<
 * 
 * 
*/
  __Pyx_XDECREF(__pyx_r);
  __Pyx_INCREF(__pyx_v_val);
  __pyx_r = __pyx_v_val;
  __Pyx_TraceReturnValue(__pyx_r, 30, 0, __PYX_ERR(0, 175, __pyx_L1_error));
  goto __pyx_L0;

  /* "pysam/libcbcf.pyx":163
 * cdef dict bcf_str_cache = {}
 * 
 * cdef inline bcf_str_cache_get_charptr(const char* s):             # <<<<<<<<<<<<<<
 *     if s == NULL:
 *         return None
*/

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_TraceException(__pyx_lineno, 0, 0);
  #if CYTHON_USE_SYS_MONITORING
  __Pyx_TraceExceptionUnwind(0, 0);
  #else
  __Pyx_TraceReturnValue(NULL, 0, 0, __PYX_ERR(0, 163, __pyx_L1_error));
  #endif
  __Pyx_AddTraceback("pysam.libcbcf.bcf_str_cache_get_charptr", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_val);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_PyMonitoring_ExitScope(0);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "pysam/libcbcf.pyx":183
 * ########################################################################
 * 
 * cdef int comb(int n, int k) except -1:             # <<<<<<<<<<<<<<
 *     """Return binomial coefficient: n choose k
 * 
*/

static int __pyx_f_5pysam_7libcbcf_comb(int __pyx_v_n, int __pyx_v_k) {
  PyObject *__pyx_v_d = 0;
  PyObject *__pyx_v_result = 0;
  PyObject *__pyx_v_i = NULL;
  int __pyx_r;
  __Pyx_TraceDeclarationsFunc
  __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;
  Py_ssize_t __pyx_t_7;
  PyObject *(*__pyx_t_8)(PyObject *);
  int __pyx_t_9;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_TraceFrameInit(((PyObject *)__pyx_mstate_global->__pyx_codeobj_tab[1]))
  __Pyx_RefNannySetupContext("comb", 0);
  __Pyx_TraceStartFunc("comb", __pyx_f[0], 183, 0, 0, 0, __PYX_ERR(0, 183, __pyx_L1_error));

  /* "pysam/libcbcf.pyx":195
 *     4950
 *     """
 *     if k > n:             # <<<<<<<<<<<<<<
 *         return 0
 *     elif k == n:
*/
  __pyx_t_1 = (__pyx_v_k > __pyx_v_n);
  if (__pyx_t_1) {

    /* "pysam/libcbcf.pyx":196
 *     """
 *     if k > n:
 *         return 0             # <<<<<<<<<<<<<<
 *     elif k == n:
 *         return 1
*/
    __pyx_r = 0;
    __Pyx_TraceReturnCValue(__pyx_r, __Pyx_PyLong_From_int, 6, 0, __PYX_ERR(0, 196, __pyx_L1_error));
    goto __pyx_L0;

    /* "pysam/libcbcf.pyx":195
 *     4950
 *     """
 *     if k > n:             # <<<<<<<<<<<<<<
 *         return 0
 *     elif k == n:
*/
  }

  /* "pysam/libcbcf.pyx":197
 *     if k > n:
 *         return 0
 *     elif k == n:             # <<<<<<<<<<<<<<
 *         return 1
 *     elif k > n // 2:
*/
  __pyx_t_1 = (__pyx_v_k == __pyx_v_n);
  if (__pyx_t_1) {

    /* "pysam/libcbcf.pyx":198
 *         return 0
 *     elif k == n:
 *         return 1             # <<<<<<<<<<<<<<
 *     elif k > n // 2:
 *         k = n - k
*/
    __pyx_r = 1;
    __Pyx_TraceReturnCValue(__pyx_r, __Pyx_PyLong_From_int, 11, 0, __PYX_ERR(0, 198, __pyx_L1_error));
    goto __pyx_L0;

    /* "pysam/libcbcf.pyx":197
 *     if k > n:
 *         return 0
 *     elif k == n:             # <<<<<<<<<<<<<<
 *         return 1
 *     elif k > n // 2:
*/
  }

  /* "pysam/libcbcf.pyx":199
 *     elif k == n:
 *         return 1
 *     elif k > n // 2:             # <<<<<<<<<<<<<<
 *         k = n - k
 * 
*/
  __pyx_t_1 = (__pyx_v_k > __Pyx_div_long(__pyx_v_n, 2, 1));
  if (__pyx_t_1) {

    /* "pysam/libcbcf.pyx":200
 *         return 1
 *     elif k > n // 2:
 *         k = n - k             # <<<<<<<<<<<<<<
 * 
 *     cdef d, result
*/
    __pyx_v_k = (__pyx_v_n - __pyx_v_k);

    /* "pysam/libcbcf.pyx":199
 *     elif k == n:
 *         return 1
 *     elif k > n // 2:             # <<<<<<<<<<<<<<
 *         k = n - k
 * 
*/
  }

  /* "pysam/libcbcf.pyx":204
 *     cdef d, result
 * 
 *     d = result = n - k + 1             # <<<<<<<<<<<<<<
 *     for i in range(2, k + 1):
 *         d += 1
*/
  __pyx_t_2 = __Pyx_PyLong_From_long(((__pyx_v_n - __pyx_v_k) + 1)); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 204, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_INCREF(__pyx_t_2);
  __pyx_v_d = __pyx_t_2;
  __Pyx_INCREF(__pyx_t_2);
  __pyx_v_result = __pyx_t_2;
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

  /* "pysam/libcbcf.pyx":205
 * 
 *     d = result = n - k + 1
 *     for i in range(2, k + 1):             # <<<<<<<<<<<<<<
 *         d += 1
 *         result  *= d
*/
  __pyx_t_3 = NULL;
  __Pyx_INCREF(__pyx_builtin_range);
  __pyx_t_4 = __pyx_builtin_range; 
  __pyx_t_5 = __Pyx_PyLong_From_long((__pyx_v_k + 1)); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 205, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_5);
  __pyx_t_6 = 1;
  {
    PyObject *__pyx_callargs[3] = {__pyx_t_3, __pyx_mstate_global->__pyx_int_2, __pyx_t_5};
    __pyx_t_2 = __Pyx_PyObject_FastCall(__pyx_t_4, __pyx_callargs+__pyx_t_6, (3-__pyx_t_6) | (__pyx_t_6*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
    __Pyx_XDECREF(__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_2)) __PYX_ERR(0, 205, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
  }
  if (likely(PyList_CheckExact(__pyx_t_2)) || PyTuple_CheckExact(__pyx_t_2)) {
    __pyx_t_4 = __pyx_t_2; __Pyx_INCREF(__pyx_t_4);
    __pyx_t_7 = 0;
    __pyx_t_8 = NULL;
  } else {
    __pyx_t_7 = -1; __pyx_t_4 = PyObject_GetIter(__pyx_t_2); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 205, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
    __pyx_t_8 = (CYTHON_COMPILING_IN_LIMITED_API) ? PyIter_Next : __Pyx_PyObject_GetIterNextFunc(__pyx_t_4); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 205, __pyx_L1_error)
  }
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  for (;;) {
    if (likely(!__pyx_t_8)) {
      if (likely(PyList_CheckExact(__pyx_t_4))) {
        {
          Py_ssize_t __pyx_temp = __Pyx_PyList_GET_SIZE(__pyx_t_4);
          #if !CYTHON_ASSUME_SAFE_SIZE
          if (unlikely((__pyx_temp < 0))) __PYX_ERR(0, 205, __pyx_L1_error)
          #endif
          if (__pyx_t_7 >= __pyx_temp) break;
        }
        __pyx_t_2 = __Pyx_PyList_GetItemRef(__pyx_t_4, __pyx_t_7);
        ++__pyx_t_7;
      } else {
        {
          Py_ssize_t __pyx_temp = __Pyx_PyTuple_GET_SIZE(__pyx_t_4);
          #if !CYTHON_ASSUME_SAFE_SIZE
          if (unlikely((__pyx_temp < 0))) __PYX_ERR(0, 205, __pyx_L1_error)
          #endif
          if (__pyx_t_7 >= __pyx_temp) break;
        }
        #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
        __pyx_t_2 = __Pyx_NewRef(PyTuple_GET_ITEM(__pyx_t_4, __pyx_t_7));
        #else
        __pyx_t_2 = __Pyx_PySequence_ITEM(__pyx_t_4, __pyx_t_7);
        #endif
        ++__pyx_t_7;
      }
      if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 205, __pyx_L1_error)
    } else {
      __pyx_t_2 = __pyx_t_8(__pyx_t_4);
      if (unlikely(!__pyx_t_2)) {
        PyObject* exc_type = PyErr_Occurred();
        if (exc_type) {
          if (unlikely(!__Pyx_PyErr_GivenExceptionMatches(exc_type, PyExc_StopIteration))) __PYX_ERR(0, 205, __pyx_L1_error)
          PyErr_Clear();
        }
        break;
      }
    }
    __Pyx_GOTREF(__pyx_t_2);
    __Pyx_XDECREF_SET(__pyx_v_i, __pyx_t_2);
    __pyx_t_2 = 0;

    /* "pysam/libcbcf.pyx":206
 *     d = result = n - k + 1
 *     for i in range(2, k + 1):
 *         d += 1             # <<<<<<<<<<<<<<
 *         result  *= d
 *         result //= i
*/
    __pyx_t_2 = __Pyx_PyLong_AddObjC(__pyx_v_d, __pyx_mstate_global->__pyx_int_1, 1, 1, 0); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 206, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __Pyx_DECREF_SET(__pyx_v_d, __pyx_t_2);
    __pyx_t_2 = 0;

    /* "pysam/libcbcf.pyx":207
 *     for i in range(2, k + 1):
 *         d += 1
 *         result  *= d             # <<<<<<<<<<<<<<
 *         result //= i
 *     return result
*/
    __pyx_t_2 = PyNumber_InPlaceMultiply(__pyx_v_result, __pyx_v_d); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 207, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __Pyx_DECREF_SET(__pyx_v_result, __pyx_t_2);
    __pyx_t_2 = 0;

    /* "pysam/libcbcf.pyx":208
 *         d += 1
 *         result  *= d
 *         result //= i             # <<<<<<<<<<<<<<
 *     return result
 * 
*/
    __pyx_t_2 = PyNumber_InPlaceFloorDivide(__pyx_v_result, __pyx_v_i); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 208, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __Pyx_DECREF_SET(__pyx_v_result, __pyx_t_2);
    __pyx_t_2 = 0;

    /* "pysam/libcbcf.pyx":205
 * 
 *     d = result = n - k + 1
 *     for i in range(2, k + 1):             # <<<<<<<<<<<<<<
 *         d += 1
 *         result  *= d
*/
  }
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;

  /* "pysam/libcbcf.pyx":209
 *         result  *= d
 *         result //= i
 *     return result             # <<<<<<<<<<<<<<
 * 
 * 
*/
  __pyx_t_9 = __Pyx_PyLong_As_int(__pyx_v_result); if (unlikely((__pyx_t_9 == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 209, __pyx_L1_error)
  __pyx_r = __pyx_t_9;
  __Pyx_TraceReturnCValue(__pyx_r, __Pyx_PyLong_From_int, 43, 0, __PYX_ERR(0, 209, __pyx_L1_error));
  goto __pyx_L0;

  /* "pysam/libcbcf.pyx":183
 * ########################################################################
 * 
 * cdef int comb(int n, int k) except -1:             # <<<<<<<<<<<<<<
 *     """Return binomial coefficient: n choose k
 * 
*/

  /* 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_TraceException(__pyx_lineno, 0, 0);
  #if CYTHON_USE_SYS_MONITORING
  __Pyx_TraceExceptionUnwind(0, 0);
  #else
  __Pyx_TraceReturnValue(NULL, 0, 0, __PYX_ERR(0, 183, __pyx_L1_error));
  #endif
  __Pyx_AddTraceback("pysam.libcbcf.comb", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = -1;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_d);
  __Pyx_XDECREF(__pyx_v_result);
  __Pyx_XDECREF(__pyx_v_i);
  __Pyx_PyMonitoring_ExitScope(0);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "pysam/libcbcf.pyx":212
 * 
 * 
 * cdef inline int bcf_geno_combinations(int ploidy, int alleles) except -1:             # <<<<<<<<<<<<<<
 *     """Return the count of genotypes expected for the given ploidy and number of alleles.
 * 
*/

static CYTHON_INLINE int __pyx_f_5pysam_7libcbcf_bcf_geno_combinations(int __pyx_v_ploidy, int __pyx_v_alleles) {
  int __pyx_r;
  __Pyx_TraceDeclarationsFunc
  int __pyx_t_1;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_TraceFrameInit(((PyObject *)__pyx_mstate_global->__pyx_codeobj_tab[2]))
  __Pyx_TraceStartFunc("bcf_geno_combinations", __pyx_f[0], 212, 0, 0, 0, __PYX_ERR(0, 212, __pyx_L1_error));

  /* "pysam/libcbcf.pyx":224
 *     4
 *     """
 *     return comb(alleles + ploidy - 1, ploidy)             # <<<<<<<<<<<<<<
 * 
 * 
*/
  __pyx_t_1 = __pyx_f_5pysam_7libcbcf_comb(((__pyx_v_alleles + __pyx_v_ploidy) - 1), __pyx_v_ploidy); if (unlikely(__pyx_t_1 == ((int)-1))) __PYX_ERR(0, 224, __pyx_L1_error)
  __pyx_r = __pyx_t_1;
  __Pyx_TraceReturnCValue(__pyx_r, __Pyx_PyLong_From_int, 2, 0, __PYX_ERR(0, 224, __pyx_L1_error));
  goto __pyx_L0;

  /* "pysam/libcbcf.pyx":212
 * 
 * 
 * cdef inline int bcf_geno_combinations(int ploidy, int alleles) except -1:             # <<<<<<<<<<<<<<
 *     """Return the count of genotypes expected for the given ploidy and number of alleles.
 * 
*/

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_TraceException(__pyx_lineno, 0, 0);
  #if CYTHON_USE_SYS_MONITORING
  __Pyx_TraceExceptionUnwind(0, 0);
  #else
  __Pyx_TraceReturnValue(NULL, 0, 0, __PYX_ERR(0, 212, __pyx_L1_error));
  #endif
  __Pyx_AddTraceback("pysam.libcbcf.bcf_geno_combinations", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = -1;
  __pyx_L0:;
  __Pyx_PyMonitoring_ExitScope(0);
  return __pyx_r;
}

/* "pysam/libcbcf.pyx":233
 * 
 * 
 * cdef inline bint check_header_id(bcf_hdr_t *hdr, int hl_type, int id):             # <<<<<<<<<<<<<<
 *     return id >= 0 and id < hdr.n[BCF_DT_ID] and bcf_hdr_idinfo_exists(hdr, hl_type, id)
 * 
*/

static CYTHON_INLINE int __pyx_f_5pysam_7libcbcf_check_header_id(bcf_hdr_t *__pyx_v_hdr, int __pyx_v_hl_type, int __pyx_v_id) {
  int __pyx_r;
  __Pyx_TraceDeclarationsFunc
  int __pyx_t_1;
  int __pyx_t_2;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_TraceFrameInit(((PyObject *)__pyx_mstate_global->__pyx_codeobj_tab[3]))
  __Pyx_TraceStartFunc("check_header_id", __pyx_f[0], 233, 0, 0, 0, __PYX_ERR(0, 233, __pyx_L1_error));

  /* "pysam/libcbcf.pyx":234
 * 
 * cdef inline bint check_header_id(bcf_hdr_t *hdr, int hl_type, int id):
 *     return id >= 0 and id < hdr.n[BCF_DT_ID] and bcf_hdr_idinfo_exists(hdr, hl_type, id)             # <<<<<<<<<<<<<<
 * 
 * 
*/
  __pyx_t_2 = (__pyx_v_id >= 0);
  if (__pyx_t_2) {
  } else {
    __pyx_t_1 = __pyx_t_2;
    goto __pyx_L3_bool_binop_done;
  }
  __pyx_t_2 = (__pyx_v_id < (__pyx_v_hdr->n[BCF_DT_ID]));
  if (__pyx_t_2) {
  } else {
    __pyx_t_1 = __pyx_t_2;
    goto __pyx_L3_bool_binop_done;
  }
  __pyx_t_2 = (bcf_hdr_idinfo_exists(__pyx_v_hdr, __pyx_v_hl_type, __pyx_v_id) != 0);
  __pyx_t_1 = __pyx_t_2;
  __pyx_L3_bool_binop_done:;
  __pyx_r = __pyx_t_1;
  __Pyx_TraceReturnCValue(__pyx_r, __Pyx_PyBool_FromLong, 2, 0, __PYX_ERR(0, 234, __pyx_L1_error));
  goto __pyx_L0;

  /* "pysam/libcbcf.pyx":233
 * 
 * 
 * cdef inline bint check_header_id(bcf_hdr_t *hdr, int hl_type, int id):             # <<<<<<<<<<<<<<
 *     return id >= 0 and id < hdr.n[BCF_DT_ID] and bcf_hdr_idinfo_exists(hdr, hl_type, id)
 * 
*/

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_TraceException(__pyx_lineno, 0, 0);
  #if CYTHON_USE_SYS_MONITORING
  __Pyx_TraceExceptionUnwind(0, 0);
  #else
  __Pyx_TraceReturnValue(NULL, 0, 0, __PYX_ERR(0, 233, __pyx_L1_error));
  #endif
  __Pyx_AddTraceback("pysam.libcbcf.check_header_id", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = -1;
  __pyx_L0:;
  __Pyx_PyMonitoring_ExitScope(0);
  return __pyx_r;
}

/* "pysam/libcbcf.pyx":237
 * 
 * 
 * cdef inline int is_gt_fmt(bcf_hdr_t *hdr, int fmt_id):             # <<<<<<<<<<<<<<
 *     return strcmp(bcf_hdr_int2id(hdr, BCF_DT_ID, fmt_id), 'GT') == 0
 * 
*/

static CYTHON_INLINE int __pyx_f_5pysam_7libcbcf_is_gt_fmt(bcf_hdr_t *__pyx_v_hdr, int __pyx_v_fmt_id) {
  int __pyx_r;
  __Pyx_TraceDeclarationsFunc
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_TraceFrameInit(((PyObject *)__pyx_mstate_global->__pyx_codeobj_tab[4]))
  __Pyx_TraceStartFunc("is_gt_fmt", __pyx_f[0], 237, 0, 0, 0, __PYX_ERR(0, 237, __pyx_L1_error));

  /* "pysam/libcbcf.pyx":238
 * 
 * cdef inline int is_gt_fmt(bcf_hdr_t *hdr, int fmt_id):
 *     return strcmp(bcf_hdr_int2id(hdr, BCF_DT_ID, fmt_id), 'GT') == 0             # <<<<<<<<<<<<<<
 * 
 * 
*/
  __pyx_r = (strcmp(bcf_hdr_int2id(__pyx_v_hdr, BCF_DT_ID, __pyx_v_fmt_id), ((char const *)"GT")) == 0);
  __Pyx_TraceReturnCValue(__pyx_r, __Pyx_PyLong_From_int, 2, 0, __PYX_ERR(0, 238, __pyx_L1_error));
  goto __pyx_L0;

  /* "pysam/libcbcf.pyx":237
 * 
 * 
 * cdef inline int is_gt_fmt(bcf_hdr_t *hdr, int fmt_id):             # <<<<<<<<<<<<<<
 *     return strcmp(bcf_hdr_int2id(hdr, BCF_DT_ID, fmt_id), 'GT') == 0
 * 
*/

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_TraceException(__pyx_lineno, 0, 0);
  #if CYTHON_USE_SYS_MONITORING
  __Pyx_TraceExceptionUnwind(0, 0);
  #else
  __Pyx_TraceReturnValue(NULL, 0, 0, __PYX_ERR(0, 237, __pyx_L1_error));
  #endif
  __Pyx_AddTraceback("pysam.libcbcf.is_gt_fmt", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = -1;
  __pyx_L0:;
  __Pyx_PyMonitoring_ExitScope(0);
  return __pyx_r;
}

/* "pysam/libcbcf.pyx":241
 * 
 * 
 * cdef inline int bcf_genotype_count(bcf_hdr_t *hdr, bcf1_t *rec, int sample) except -1:             # <<<<<<<<<<<<<<
 * 
 *     if sample < 0:
*/

static CYTHON_INLINE int __pyx_f_5pysam_7libcbcf_bcf_genotype_count(bcf_hdr_t *__pyx_v_hdr, bcf1_t *__pyx_v_rec, int __pyx_v_sample) {
  int32_t *__pyx_v_gt_arr;
  int __pyx_v_ngt;
  int __pyx_v_max_ploidy;
  int32_t *__pyx_v_gt;
  int __pyx_v_ploidy;
  int __pyx_r;
  __Pyx_TraceDeclarationsFunc
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  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_TraceFrameInit(((PyObject *)__pyx_mstate_global->__pyx_codeobj_tab[5]))
  __Pyx_RefNannySetupContext("bcf_genotype_count", 0);
  __Pyx_TraceStartFunc("bcf_genotype_count", __pyx_f[0], 241, 0, 0, 0, __PYX_ERR(0, 241, __pyx_L1_error));

  /* "pysam/libcbcf.pyx":243
 * cdef inline int bcf_genotype_count(bcf_hdr_t *hdr, bcf1_t *rec, int sample) except -1:
 * 
 *     if sample < 0:             # <<<<<<<<<<<<<<
 *         raise ValueError('genotype is only valid as a format field')
 * 
*/
  __pyx_t_1 = (__pyx_v_sample < 0);
  if (unlikely(__pyx_t_1)) {

    /* "pysam/libcbcf.pyx":244
 * 
 *     if sample < 0:
 *         raise ValueError('genotype is only valid as a format field')             # <<<<<<<<<<<<<<
 * 
 *     cdef int32_t *gt_arr = NULL
*/
    __pyx_t_3 = NULL;
    __Pyx_INCREF(__pyx_builtin_ValueError);
    __pyx_t_4 = __pyx_builtin_ValueError; 
    __pyx_t_5 = 1;
    {
      PyObject *__pyx_callargs[2] = {__pyx_t_3, __pyx_mstate_global->__pyx_kp_u_genotype_is_only_valid_as_a_form};
      __pyx_t_2 = __Pyx_PyObject_FastCall(__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_2)) __PYX_ERR(0, 244, __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, 244, __pyx_L1_error)

    /* "pysam/libcbcf.pyx":243
 * cdef inline int bcf_genotype_count(bcf_hdr_t *hdr, bcf1_t *rec, int sample) except -1:
 * 
 *     if sample < 0:             # <<<<<<<<<<<<<<
 *         raise ValueError('genotype is only valid as a format field')
 * 
*/
  }

  /* "pysam/libcbcf.pyx":246
 *         raise ValueError('genotype is only valid as a format field')
 * 
 *     cdef int32_t *gt_arr = NULL             # <<<<<<<<<<<<<<
 *     cdef int ngt = 0
 *     ngt = bcf_get_genotypes(hdr, rec, &gt_arr, &ngt)
*/
  __pyx_v_gt_arr = NULL;

  /* "pysam/libcbcf.pyx":247
 * 
 *     cdef int32_t *gt_arr = NULL
 *     cdef int ngt = 0             # <<<<<<<<<<<<<<
 *     ngt = bcf_get_genotypes(hdr, rec, &gt_arr, &ngt)
 * 
*/
  __pyx_v_ngt = 0;

  /* "pysam/libcbcf.pyx":248
 *     cdef int32_t *gt_arr = NULL
 *     cdef int ngt = 0
 *     ngt = bcf_get_genotypes(hdr, rec, &gt_arr, &ngt)             # <<<<<<<<<<<<<<
 * 
 *     if ngt <= 0 or not gt_arr:
*/
  __pyx_v_ngt = bcf_get_genotypes(__pyx_v_hdr, __pyx_v_rec, (&__pyx_v_gt_arr), (&__pyx_v_ngt));

  /* "pysam/libcbcf.pyx":250
 *     ngt = bcf_get_genotypes(hdr, rec, &gt_arr, &ngt)
 * 
 *     if ngt <= 0 or not gt_arr:             # <<<<<<<<<<<<<<
 *         return 0
 * 
*/
  __pyx_t_6 = (__pyx_v_ngt <= 0);
  if (!__pyx_t_6) {
  } else {
    __pyx_t_1 = __pyx_t_6;
    goto __pyx_L5_bool_binop_done;
  }
  __pyx_t_6 = (!(__pyx_v_gt_arr != 0));
  __pyx_t_1 = __pyx_t_6;
  __pyx_L5_bool_binop_done:;
  if (__pyx_t_1) {

    /* "pysam/libcbcf.pyx":251
 * 
 *     if ngt <= 0 or not gt_arr:
 *         return 0             # <<<<<<<<<<<<<<
 * 
 *     assert ngt % rec.n_sample == 0
*/
    __pyx_r = 0;
    __Pyx_TraceReturnCValue(__pyx_r, __Pyx_PyLong_From_int, 30, 0, __PYX_ERR(0, 251, __pyx_L1_error));
    goto __pyx_L0;

    /* "pysam/libcbcf.pyx":250
 *     ngt = bcf_get_genotypes(hdr, rec, &gt_arr, &ngt)
 * 
 *     if ngt <= 0 or not gt_arr:             # <<<<<<<<<<<<<<
 *         return 0
 * 
*/
  }

  /* "pysam/libcbcf.pyx":253
 *         return 0
 * 
 *     assert ngt % rec.n_sample == 0             # <<<<<<<<<<<<<<
 *     cdef int max_ploidy = ngt // rec.n_sample
 *     cdef int32_t *gt = gt_arr + sample * max_ploidy
*/
  #ifndef CYTHON_WITHOUT_ASSERTIONS
  if (unlikely(__pyx_assertions_enabled())) {
    if (unlikely(__pyx_v_rec->n_sample == 0)) {
      PyErr_SetString(PyExc_ZeroDivisionError, "integer division or modulo by zero");
      __PYX_ERR(0, 253, __pyx_L1_error)
    }
    __pyx_t_1 = ((__pyx_v_ngt % __pyx_v_rec->n_sample) == 0);
    if (unlikely(!__pyx_t_1)) {
      __Pyx_Raise(__pyx_builtin_AssertionError, 0, 0, 0);
      __PYX_ERR(0, 253, __pyx_L1_error)
    }
  }
  #else
  if ((1)); else __PYX_ERR(0, 253, __pyx_L1_error)
  #endif

  /* "pysam/libcbcf.pyx":254
 * 
 *     assert ngt % rec.n_sample == 0
 *     cdef int max_ploidy = ngt // rec.n_sample             # <<<<<<<<<<<<<<
 *     cdef int32_t *gt = gt_arr + sample * max_ploidy
 *     cdef int ploidy = 0
*/
  if (unlikely(__pyx_v_rec->n_sample == 0)) {
    PyErr_SetString(PyExc_ZeroDivisionError, "integer division or modulo by zero");
    __PYX_ERR(0, 254, __pyx_L1_error)
  }
  __pyx_v_max_ploidy = (__pyx_v_ngt / __pyx_v_rec->n_sample);

  /* "pysam/libcbcf.pyx":255
 *     assert ngt % rec.n_sample == 0
 *     cdef int max_ploidy = ngt // rec.n_sample
 *     cdef int32_t *gt = gt_arr + sample * max_ploidy             # <<<<<<<<<<<<<<
 *     cdef int ploidy = 0
 * 
*/
  __pyx_v_gt = (__pyx_v_gt_arr + (__pyx_v_sample * __pyx_v_max_ploidy));

  /* "pysam/libcbcf.pyx":256
 *     cdef int max_ploidy = ngt // rec.n_sample
 *     cdef int32_t *gt = gt_arr + sample * max_ploidy
 *     cdef int ploidy = 0             # <<<<<<<<<<<<<<
 * 
 *     while ploidy < max_ploidy and gt[0] != bcf_int32_vector_end:
*/
  __pyx_v_ploidy = 0;

  /* "pysam/libcbcf.pyx":258
 *     cdef int ploidy = 0
 * 
 *     while ploidy < max_ploidy and gt[0] != bcf_int32_vector_end:             # <<<<<<<<<<<<<<
 *         gt += 1
 *         ploidy += 1
*/
  while (1) {
    __pyx_t_6 = (__pyx_v_ploidy < __pyx_v_max_ploidy);
    if (__pyx_t_6) {
    } else {
      __pyx_t_1 = __pyx_t_6;
      goto __pyx_L9_bool_binop_done;
    }
    __pyx_t_6 = ((__pyx_v_gt[0]) != bcf_int32_vector_end);
    __pyx_t_1 = __pyx_t_6;
    __pyx_L9_bool_binop_done:;
    if (!__pyx_t_1) break;

    /* "pysam/libcbcf.pyx":259
 * 
 *     while ploidy < max_ploidy and gt[0] != bcf_int32_vector_end:
 *         gt += 1             # <<<<<<<<<<<<<<
 *         ploidy += 1
 * 
*/
    __pyx_v_gt = (__pyx_v_gt + 1);

    /* "pysam/libcbcf.pyx":260
 *     while ploidy < max_ploidy and gt[0] != bcf_int32_vector_end:
 *         gt += 1
 *         ploidy += 1             # <<<<<<<<<<<<<<
 * 
 *     free(<void*>gt_arr)
*/
    __pyx_v_ploidy = (__pyx_v_ploidy + 1);
  }

  /* "pysam/libcbcf.pyx":262
 *         ploidy += 1
 * 
 *     free(<void*>gt_arr)             # <<<<<<<<<<<<<<
 * 
 *     return bcf_geno_combinations(ploidy, rec.n_allele)
*/
  free(((void *)__pyx_v_gt_arr));

  /* "pysam/libcbcf.pyx":264
 *     free(<void*>gt_arr)
 * 
 *     return bcf_geno_combinations(ploidy, rec.n_allele)             # <<<<<<<<<<<<<<
 * 
 * 
*/
  __pyx_t_7 = __pyx_f_5pysam_7libcbcf_bcf_geno_combinations(__pyx_v_ploidy, __pyx_v_rec->n_allele); if (unlikely(__pyx_t_7 == ((int)-1))) __PYX_ERR(0, 264, __pyx_L1_error)
  __pyx_r = __pyx_t_7;
  __Pyx_TraceReturnCValue(__pyx_r, __Pyx_PyLong_From_int, 70, 0, __PYX_ERR(0, 264, __pyx_L1_error));
  goto __pyx_L0;

  /* "pysam/libcbcf.pyx":241
 * 
 * 
 * cdef inline int bcf_genotype_count(bcf_hdr_t *hdr, bcf1_t *rec, int sample) except -1:             # <<<<<<<<<<<<<<
 * 
 *     if sample < 0:
*/

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_TraceException(__pyx_lineno, 0, 0);
  #if CYTHON_USE_SYS_MONITORING
  __Pyx_TraceExceptionUnwind(0, 0);
  #else
  __Pyx_TraceReturnValue(NULL, 0, 0, __PYX_ERR(0, 241, __pyx_L1_error));
  #endif
  __Pyx_AddTraceback("pysam.libcbcf.bcf_genotype_count", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = -1;
  __pyx_L0:;
  __Pyx_PyMonitoring_ExitScope(0);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}
static PyObject *__pyx_gb_5pysam_7libcbcf_19char_array_to_tuple_2generator28(__pyx_CoroutineObject *__pyx_generator, CYTHON_UNUSED PyThreadState *__pyx_tstate, PyObject *__pyx_sent_value); /* proto */

/* "pysam/libcbcf.pyx":271
 *         return None
 *     try:
 *          return tuple(charptr_to_str(a[i]) for i in range(n))             # <<<<<<<<<<<<<<
 *     finally:
 *         if free_after and a:
*/

static PyObject *__pyx_pf_5pysam_7libcbcf_19char_array_to_tuple_genexpr(PyObject *__pyx_self, Py_ssize_t __pyx_genexpr_arg_0) {
  struct __pyx_obj_5pysam_7libcbcf___pyx_scope_struct_1_genexpr *__pyx_cur_scope;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("genexpr", 0);
  __pyx_cur_scope = (struct __pyx_obj_5pysam_7libcbcf___pyx_scope_struct_1_genexpr *)__pyx_tp_new_5pysam_7libcbcf___pyx_scope_struct_1_genexpr(__pyx_mstate_global->__pyx_ptype_5pysam_7libcbcf___pyx_scope_struct_1_genexpr, __pyx_mstate_global->__pyx_empty_tuple, NULL);
  if (unlikely(!__pyx_cur_scope)) {
    __pyx_cur_scope = ((struct __pyx_obj_5pysam_7libcbcf___pyx_scope_struct_1_genexpr *)Py_None);
    __Pyx_INCREF(Py_None);
    __PYX_ERR(0, 271, __pyx_L1_error)
  } else {
    __Pyx_GOTREF((PyObject *)__pyx_cur_scope);
  }
  __pyx_cur_scope->__pyx_outer_scope = (struct __pyx_obj_5pysam_7libcbcf___pyx_scope_struct____pyx_f_5pysam_7libcbcf_char_array_to_tuple *) __pyx_self;
  __Pyx_INCREF((PyObject *)__pyx_cur_scope->__pyx_outer_scope);
  __Pyx_GIVEREF((PyObject *)__pyx_cur_scope->__pyx_outer_scope);
  __pyx_cur_scope->__pyx_genexpr_arg_0 = __pyx_genexpr_arg_0;
  {
    __pyx_CoroutineObject *gen = __Pyx_Generator_New((__pyx_coroutine_body_t) __pyx_gb_5pysam_7libcbcf_19char_array_to_tuple_2generator28, ((PyObject *)__pyx_mstate_global->__pyx_codeobj_tab[6]), (PyObject *) __pyx_cur_scope, __pyx_mstate_global->__pyx_n_u_genexpr, __pyx_mstate_global->__pyx_n_u_char_array_to_tuple_locals_genex, __pyx_mstate_global->__pyx_n_u_pysam_libcbcf); if (unlikely(!gen)) __PYX_ERR(0, 271, __pyx_L1_error)
    __Pyx_DECREF(__pyx_cur_scope);
    __Pyx_RefNannyFinishContext();
    return (PyObject *) gen;
  }

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_AddTraceback("pysam.libcbcf.char_array_to_tuple.genexpr", __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_5pysam_7libcbcf_19char_array_to_tuple_2generator28(__pyx_CoroutineObject *__pyx_generator, CYTHON_UNUSED PyThreadState *__pyx_tstate, PyObject *__pyx_sent_value) /* generator body */
{
  struct __pyx_obj_5pysam_7libcbcf___pyx_scope_struct_1_genexpr *__pyx_cur_scope = ((struct __pyx_obj_5pysam_7libcbcf___pyx_scope_struct_1_genexpr *)__pyx_generator->closure);
  PyObject *__pyx_r = NULL;
  __Pyx_TraceDeclarationsGen
  Py_ssize_t __pyx_t_1;
  Py_ssize_t __pyx_t_2;
  Py_ssize_t __pyx_t_3;
  PyObject *__pyx_t_4 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("genexpr", 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_TraceStartGen("genexpr", __pyx_f[0], 271, 0, 0, 0, __PYX_ERR(0, 271, __pyx_L1_error));
    __Pyx_TraceReturnValue(Py_None, 0, 0, __PYX_ERR(0, 271, __pyx_L1_error));
    __Pyx_RefNannyFinishContext();
    return NULL;
  }
  __pyx_L3_first_run:;
  __Pyx_TraceStartGen("genexpr", __pyx_f[0], 271, 0, 0, 0, __PYX_ERR(0, 271, __pyx_L1_error));
  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, 271, __pyx_L1_error)
  }
  __pyx_t_1 = __pyx_cur_scope->__pyx_genexpr_arg_0;
  __pyx_t_2 = __pyx_t_1;
  for (__pyx_t_3 = 0; __pyx_t_3 < __pyx_t_2; __pyx_t_3+=1) {
    __pyx_cur_scope->__pyx_v_i = __pyx_t_3;
    __pyx_t_4 = __pyx_f_5pysam_9libcutils_charptr_to_str((__pyx_cur_scope->__pyx_outer_scope->__pyx_v_a[__pyx_cur_scope->__pyx_v_i]), NULL); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 271, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
    __pyx_r = __pyx_t_4;
    __pyx_t_4 = 0;
    __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_TraceYield(__pyx_r, 0, __PYX_ERR(0, 271, __pyx_L1_error));
    __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_TraceResumeGen("genexpr", __pyx_f[0], 271, 0, __PYX_ERR(0, 271, __pyx_L1_error));
    __pyx_t_1 = __pyx_cur_scope->__pyx_t_0;
    __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, 271, __pyx_L1_error)
  }
  CYTHON_MAYBE_UNUSED_VAR(__pyx_cur_scope);
  __Pyx_TraceReturnValue(Py_None, 0, 0, __PYX_ERR(0, 271, __pyx_L1_error));

  /* function exit code */
  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_4);
  if (__Pyx_PyErr_Occurred()) {
    __Pyx_TraceException(__pyx_lineno, 0, 0);
    __Pyx_Generator_Replace_StopIteration(0);
    __Pyx_AddTraceback("genexpr", __pyx_clineno, __pyx_lineno, __pyx_filename);
    __Pyx_TraceExceptionUnwind(0, 0);
  }
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_PyMonitoring_ExitScope(0);
  #if !CYTHON_USE_EXC_INFO_STACK
  __Pyx_Coroutine_ResetAndClearException(__pyx_generator);
  #endif
  __pyx_generator->resume_label = -1;
  __Pyx_Coroutine_clear((PyObject*)__pyx_generator);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "pysam/libcbcf.pyx":267
 * 
 * 
 * cdef tuple char_array_to_tuple(const char **a, ssize_t n, int free_after=0):             # <<<<<<<<<<<<<<
 *     if not a:
 *         return None
*/

static PyObject *__pyx_f_5pysam_7libcbcf_char_array_to_tuple(char const **__pyx_v_a, Py_ssize_t __pyx_v_n, struct __pyx_opt_args_5pysam_7libcbcf_char_array_to_tuple *__pyx_optional_args) {
  struct __pyx_obj_5pysam_7libcbcf___pyx_scope_struct____pyx_f_5pysam_7libcbcf_char_array_to_tuple *__pyx_cur_scope;
  int __pyx_v_free_after = ((int)0);
  PyObject *__pyx_gb_5pysam_7libcbcf_19char_array_to_tuple_2generator28 = 0;
  PyObject *__pyx_r = NULL;
  __Pyx_TraceDeclarationsFunc
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  PyObject *__pyx_t_2 = NULL;
  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_t_13;
  PyObject *__pyx_t_14 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_TraceFrameInit(((PyObject *)__pyx_mstate_global->__pyx_codeobj_tab[7]))
  __Pyx_RefNannySetupContext("char_array_to_tuple", 0);
  __pyx_cur_scope = (struct __pyx_obj_5pysam_7libcbcf___pyx_scope_struct____pyx_f_5pysam_7libcbcf_char_array_to_tuple *)__pyx_tp_new_5pysam_7libcbcf___pyx_scope_struct____pyx_f_5pysam_7libcbcf_char_array_to_tuple(__pyx_mstate_global->__pyx_ptype_5pysam_7libcbcf___pyx_scope_struct____pyx_f_5pysam_7libcbcf_char_array_to_tuple, __pyx_mstate_global->__pyx_empty_tuple, NULL);
  if (unlikely(!__pyx_cur_scope)) {
    __pyx_cur_scope = ((struct __pyx_obj_5pysam_7libcbcf___pyx_scope_struct____pyx_f_5pysam_7libcbcf_char_array_to_tuple *)Py_None);
    __Pyx_INCREF(Py_None);
    __PYX_ERR(0, 267, __pyx_L1_error)
  } else {
    __Pyx_GOTREF((PyObject *)__pyx_cur_scope);
  }
  __Pyx_TraceStartFunc("char_array_to_tuple", __pyx_f[0], 267, 0, 0, 0, __PYX_ERR(0, 267, __pyx_L1_error));
  if (__pyx_optional_args) {
    if (__pyx_optional_args->__pyx_n > 0) {
      __pyx_v_free_after = __pyx_optional_args->free_after;
    }
  }
  __pyx_cur_scope->__pyx_v_a = __pyx_v_a;

  /* "pysam/libcbcf.pyx":268
 * 
 * cdef tuple char_array_to_tuple(const char **a, ssize_t n, int free_after=0):
 *     if not a:             # <<<<<<<<<<<<<<
 *         return None
 *     try:
*/
  __pyx_t_1 = (!(__pyx_cur_scope->__pyx_v_a != 0));
  if (__pyx_t_1) {

    /* "pysam/libcbcf.pyx":269
 * cdef tuple char_array_to_tuple(const char **a, ssize_t n, int free_after=0):
 *     if not a:
 *         return None             # <<<<<<<<<<<<<<
 *     try:
 *          return tuple(charptr_to_str(a[i]) for i in range(n))
*/
    __Pyx_XDECREF(__pyx_r);
    __pyx_r = ((PyObject*)Py_None); __Pyx_INCREF(Py_None);
    goto __pyx_L0;

    /* "pysam/libcbcf.pyx":268
 * 
 * cdef tuple char_array_to_tuple(const char **a, ssize_t n, int free_after=0):
 *     if not a:             # <<<<<<<<<<<<<<
 *         return None
 *     try:
*/
  }

  /* "pysam/libcbcf.pyx":270
 *     if not a:
 *         return None
 *     try:             # <<<<<<<<<<<<<<
 *          return tuple(charptr_to_str(a[i]) for i in range(n))
 *     finally:
*/
  /*try:*/ {

    /* "pysam/libcbcf.pyx":271
 *         return None
 *     try:
 *          return tuple(charptr_to_str(a[i]) for i in range(n))             # <<<<<<<<<<<<<<
 *     finally:
 *         if free_after and a:
*/
    __Pyx_XDECREF(__pyx_r);
    __pyx_t_2 = __pyx_pf_5pysam_7libcbcf_19char_array_to_tuple_genexpr(((PyObject*)__pyx_cur_scope), __pyx_v_n); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 271, __pyx_L5_error)
    __Pyx_GOTREF(__pyx_t_2);
    __pyx_t_3 = __Pyx_PySequence_Tuple(__pyx_t_2); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 271, __pyx_L5_error)
    __Pyx_GOTREF(__pyx_t_3);
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    __pyx_r = ((PyObject*)__pyx_t_3);
    __pyx_t_3 = 0;
    __Pyx_TraceReturnValue(__pyx_r, 8, 0, __PYX_ERR(0, 271, __pyx_L5_error));
    goto __pyx_L4_return;
  }

  /* "pysam/libcbcf.pyx":273
 *          return tuple(charptr_to_str(a[i]) for i in range(n))
 *     finally:
 *         if free_after and a:             # <<<<<<<<<<<<<<
 *             free(a)
 * 
*/
  /*finally:*/ {
    __pyx_L5_error:;
    /*exception exit:*/{
      __Pyx_PyThreadState_declare
      __Pyx_TraceException(__pyx_lineno, 0, 0);
      __Pyx_TraceExceptionHandled(7);
      __Pyx_PyThreadState_assign
      __pyx_t_7 = 0; __pyx_t_8 = 0; __pyx_t_9 = 0; __pyx_t_10 = 0; __pyx_t_11 = 0; __pyx_t_12 = 0;
      __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
      __Pyx_XDECREF(__pyx_t_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;
      {
        __pyx_t_13 = (__pyx_v_free_after != 0);
        if (__pyx_t_13) {
        } else {
          __pyx_t_1 = __pyx_t_13;
          goto __pyx_L10_bool_binop_done;
        }
        __pyx_t_13 = (__pyx_cur_scope->__pyx_v_a != 0);
        __pyx_t_1 = __pyx_t_13;
        __pyx_L10_bool_binop_done:;
        if (__pyx_t_1) {

          /* "pysam/libcbcf.pyx":274
 *     finally:
 *         if free_after and a:
 *             free(a)             # <<<<<<<<<<<<<<
 * 
 * 
*/
          free(__pyx_cur_scope->__pyx_v_a);

          /* "pysam/libcbcf.pyx":273
 *          return tuple(charptr_to_str(a[i]) for i in range(n))
 *     finally:
 *         if free_after and a:             # <<<<<<<<<<<<<<
 *             free(a)
 * 
*/
        }
      }
      __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;
      __Pyx_TraceException(7, 1, 0);
      goto __pyx_L1_error;
    }
    __pyx_L4_return: {
      __pyx_t_14 = __pyx_r;
      __pyx_r = 0;
      __pyx_t_13 = (__pyx_v_free_after != 0);
      if (__pyx_t_13) {
      } else {
        __pyx_t_1 = __pyx_t_13;
        goto __pyx_L13_bool_binop_done;
      }
      __pyx_t_13 = (__pyx_cur_scope->__pyx_v_a != 0);
      __pyx_t_1 = __pyx_t_13;
      __pyx_L13_bool_binop_done:;
      if (__pyx_t_1) {

        /* "pysam/libcbcf.pyx":274
 *     finally:
 *         if free_after and a:
 *             free(a)             # <<<<<<<<<<<<<<
 * 
 * 
*/
        free(__pyx_cur_scope->__pyx_v_a);

        /* "pysam/libcbcf.pyx":273
 *          return tuple(charptr_to_str(a[i]) for i in range(n))
 *     finally:
 *         if free_after and a:             # <<<<<<<<<<<<<<
 *             free(a)
 * 
*/
      }
      __pyx_r = __pyx_t_14;
      __pyx_t_14 = 0;
      goto __pyx_L0;
    }
  }

  /* "pysam/libcbcf.pyx":267
 * 
 * 
 * cdef tuple char_array_to_tuple(const char **a, ssize_t n, int free_after=0):             # <<<<<<<<<<<<<<
 *     if not a:
 *         return None
*/

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_TraceException(__pyx_lineno, 0, 0);
  #if CYTHON_USE_SYS_MONITORING
  __Pyx_TraceExceptionUnwind(0, 0);
  #else
  __Pyx_TraceReturnValue(NULL, 0, 0, __PYX_ERR(0, 267, __pyx_L1_error));
  #endif
  __Pyx_AddTraceback("pysam.libcbcf.char_array_to_tuple", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_gb_5pysam_7libcbcf_19char_array_to_tuple_2generator28);
  __Pyx_DECREF((PyObject *)__pyx_cur_scope);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_PyMonitoring_ExitScope(0);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}
static PyObject *__pyx_gb_5pysam_7libcbcf_19bcf_array_to_object_2generator29(__pyx_CoroutineObject *__pyx_generator, CYTHON_UNUSED PyThreadState *__pyx_tstate, PyObject *__pyx_sent_value); /* proto */

/* "pysam/libcbcf.pyx":302
 *                 # Otherwise, copy the entire block
 *                 b = datac[:n]
 *             value = tuple(decode_bytes(v, 'utf-8') if v and v != bcf_str_missing else None for v in b.split(b','))             # <<<<<<<<<<<<<<
 *     else:
 *         value = []
*/

static PyObject *__pyx_pf_5pysam_7libcbcf_19bcf_array_to_object_genexpr(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_genexpr_arg_0) {
  struct __pyx_obj_5pysam_7libcbcf___pyx_scope_struct_2_genexpr *__pyx_cur_scope;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("genexpr", 0);
  __pyx_cur_scope = (struct __pyx_obj_5pysam_7libcbcf___pyx_scope_struct_2_genexpr *)__pyx_tp_new_5pysam_7libcbcf___pyx_scope_struct_2_genexpr(__pyx_mstate_global->__pyx_ptype_5pysam_7libcbcf___pyx_scope_struct_2_genexpr, __pyx_mstate_global->__pyx_empty_tuple, NULL);
  if (unlikely(!__pyx_cur_scope)) {
    __pyx_cur_scope = ((struct __pyx_obj_5pysam_7libcbcf___pyx_scope_struct_2_genexpr *)Py_None);
    __Pyx_INCREF(Py_None);
    __PYX_ERR(0, 302, __pyx_L1_error)
  } else {
    __Pyx_GOTREF((PyObject *)__pyx_cur_scope);
  }
  __pyx_cur_scope->__pyx_genexpr_arg_0 = __pyx_genexpr_arg_0;
  __Pyx_INCREF(__pyx_cur_scope->__pyx_genexpr_arg_0);
  __Pyx_GIVEREF(__pyx_cur_scope->__pyx_genexpr_arg_0);
  {
    __pyx_CoroutineObject *gen = __Pyx_Generator_New((__pyx_coroutine_body_t) __pyx_gb_5pysam_7libcbcf_19bcf_array_to_object_2generator29, ((PyObject *)__pyx_mstate_global->__pyx_codeobj_tab[8]), (PyObject *) __pyx_cur_scope, __pyx_mstate_global->__pyx_n_u_genexpr, __pyx_mstate_global->__pyx_n_u_bcf_array_to_object_locals_genex, __pyx_mstate_global->__pyx_n_u_pysam_libcbcf); if (unlikely(!gen)) __PYX_ERR(0, 302, __pyx_L1_error)
    __Pyx_DECREF(__pyx_cur_scope);
    __Pyx_RefNannyFinishContext();
    return (PyObject *) gen;
  }

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_AddTraceback("pysam.libcbcf.bcf_array_to_object.genexpr", __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_5pysam_7libcbcf_19bcf_array_to_object_2generator29(__pyx_CoroutineObject *__pyx_generator, CYTHON_UNUSED PyThreadState *__pyx_tstate, PyObject *__pyx_sent_value) /* generator body */
{
  struct __pyx_obj_5pysam_7libcbcf___pyx_scope_struct_2_genexpr *__pyx_cur_scope = ((struct __pyx_obj_5pysam_7libcbcf___pyx_scope_struct_2_genexpr *)__pyx_generator->closure);
  PyObject *__pyx_r = NULL;
  __Pyx_TraceDeclarationsGen
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  Py_ssize_t __pyx_t_3;
  int __pyx_t_4;
  int __pyx_t_5;
  PyObject *__pyx_t_6 = NULL;
  PyObject *__pyx_t_7 = NULL;
  struct __pyx_opt_args_5pysam_9libcutils_decode_bytes __pyx_t_8;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("genexpr", 0);
  switch (__pyx_generator->resume_label) {
    case 0: goto __pyx_L3_first_run;
    case 1: goto __pyx_L8_resume_from_yield;
    default: /* CPython raises the right error here */
    __Pyx_TraceStartGen("genexpr", __pyx_f[0], 302, 0, 0, 0, __PYX_ERR(0, 302, __pyx_L1_error));
    __Pyx_TraceReturnValue(Py_None, 0, 0, __PYX_ERR(0, 302, __pyx_L1_error));
    __Pyx_RefNannyFinishContext();
    return NULL;
  }
  __pyx_L3_first_run:;
  __Pyx_TraceStartGen("genexpr", __pyx_f[0], 302, 0, 0, 0, __PYX_ERR(0, 302, __pyx_L1_error));
  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, 302, __pyx_L1_error)
  }
  if (unlikely(!__pyx_cur_scope->__pyx_genexpr_arg_0)) { __Pyx_RaiseUnboundLocalError(".0"); __PYX_ERR(0, 302, __pyx_L1_error) }
  __pyx_t_1 = __Pyx_CallUnboundCMethod1(&__pyx_mstate_global->__pyx_umethod_PyBytes_Type__split, __pyx_cur_scope->__pyx_genexpr_arg_0, __pyx_mstate_global->__pyx_kp_b_); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 302, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_2 = __pyx_t_1; __Pyx_INCREF(__pyx_t_2);
  __pyx_t_3 = 0;
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  for (;;) {
    {
      Py_ssize_t __pyx_temp = __Pyx_PyList_GET_SIZE(__pyx_t_2);
      #if !CYTHON_ASSUME_SAFE_SIZE
      if (unlikely((__pyx_temp < 0))) __PYX_ERR(0, 302, __pyx_L1_error)
      #endif
      if (__pyx_t_3 >= __pyx_temp) break;
    }
    __pyx_t_1 = __Pyx_PyList_GetItemRef(__pyx_t_2, __pyx_t_3);
    ++__pyx_t_3;
    if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 302, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_XGOTREF(__pyx_cur_scope->__pyx_v_v);
    __Pyx_XDECREF_SET(__pyx_cur_scope->__pyx_v_v, __pyx_t_1);
    __Pyx_GIVEREF(__pyx_t_1);
    __pyx_t_1 = 0;
    __pyx_t_5 = __Pyx_PyObject_IsTrue(__pyx_cur_scope->__pyx_v_v); if (unlikely((__pyx_t_5 < 0))) __PYX_ERR(0, 302, __pyx_L1_error)
    if (__pyx_t_5) {
    } else {
      __pyx_t_4 = __pyx_t_5;
      goto __pyx_L6_bool_binop_done;
    }
    __pyx_t_6 = __Pyx_PyLong_From_int32_t(bcf_str_missing); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 302, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_6);
    __pyx_t_7 = PyObject_RichCompare(__pyx_cur_scope->__pyx_v_v, __pyx_t_6, Py_NE); __Pyx_XGOTREF(__pyx_t_7); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 302, __pyx_L1_error)
    __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
    __pyx_t_5 = __Pyx_PyObject_IsTrue(__pyx_t_7); if (unlikely((__pyx_t_5 < 0))) __PYX_ERR(0, 302, __pyx_L1_error)
    __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
    __pyx_t_4 = __pyx_t_5;
    __pyx_L6_bool_binop_done:;
    if (__pyx_t_4) {
      if (!(likely(PyBytes_CheckExact(__pyx_cur_scope->__pyx_v_v))||((__pyx_cur_scope->__pyx_v_v) == Py_None) || __Pyx_RaiseUnexpectedTypeError("bytes", __pyx_cur_scope->__pyx_v_v))) __PYX_ERR(0, 302, __pyx_L1_error)
      __pyx_t_8.__pyx_n = 1;
      __pyx_t_8.encoding = __pyx_mstate_global->__pyx_kp_u_utf_8;
      __pyx_t_7 = __pyx_f_5pysam_9libcutils_decode_bytes(((PyObject*)__pyx_cur_scope->__pyx_v_v), &__pyx_t_8); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 302, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_7);
      __pyx_t_1 = __pyx_t_7;
      __pyx_t_7 = 0;
    } else {
      __Pyx_INCREF(Py_None);
      __pyx_t_1 = Py_None;
    }
    __pyx_r = __pyx_t_1;
    __pyx_t_1 = 0;
    __Pyx_XGIVEREF(__pyx_t_2);
    __pyx_cur_scope->__pyx_t_0 = __pyx_t_2;
    __pyx_cur_scope->__pyx_t_1 = __pyx_t_3;
    __Pyx_TraceYield(__pyx_r, 0, __PYX_ERR(0, 302, __pyx_L1_error));
    __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_L8_resume_from_yield:;
    __Pyx_TraceResumeGen("genexpr", __pyx_f[0], 302, 0, __PYX_ERR(0, 302, __pyx_L1_error));
    __pyx_t_2 = __pyx_cur_scope->__pyx_t_0;
    __pyx_cur_scope->__pyx_t_0 = 0;
    __Pyx_XGOTREF(__pyx_t_2);
    __pyx_t_3 = __pyx_cur_scope->__pyx_t_1;
    if (unlikely(!__pyx_sent_value)) __PYX_ERR(0, 302, __pyx_L1_error)
  }
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  CYTHON_MAYBE_UNUSED_VAR(__pyx_cur_scope);
  __Pyx_TraceReturnValue(Py_None, 0, 0, __PYX_ERR(0, 302, __pyx_L1_error));

  /* function exit code */
  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_6);
  __Pyx_XDECREF(__pyx_t_7);
  if (__Pyx_PyErr_Occurred()) {
    __Pyx_TraceException(__pyx_lineno, 0, 0);
    __Pyx_Generator_Replace_StopIteration(0);
    __Pyx_AddTraceback("genexpr", __pyx_clineno, __pyx_lineno, __pyx_filename);
    __Pyx_TraceExceptionUnwind(0, 0);
  }
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_PyMonitoring_ExitScope(0);
  #if !CYTHON_USE_EXC_INFO_STACK
  __Pyx_Coroutine_ResetAndClearException(__pyx_generator);
  #endif
  __pyx_generator->resume_label = -1;
  __Pyx_Coroutine_clear((PyObject*)__pyx_generator);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "pysam/libcbcf.pyx":277
 * 
 * 
 * cdef bcf_array_to_object(void *data, int type, ssize_t n, ssize_t count, int scalar):             # <<<<<<<<<<<<<<
 *     cdef char    *datac
 *     cdef int8_t  *data8
*/

static PyObject *__pyx_f_5pysam_7libcbcf_bcf_array_to_object(void *__pyx_v_data, int __pyx_v_type, Py_ssize_t __pyx_v_n, Py_ssize_t __pyx_v_count, int __pyx_v_scalar) {
  char *__pyx_v_datac;
  int8_t *__pyx_v_data8;
  int16_t *__pyx_v_data16;
  int32_t *__pyx_v_data32;
  float *__pyx_v_dataf;
  int __pyx_v_i;
  PyObject *__pyx_v_b = 0;
  PyObject *__pyx_v_value = NULL;
  PyObject *__pyx_gb_5pysam_7libcbcf_19bcf_array_to_object_2generator29 = 0;
  PyObject *__pyx_r = NULL;
  __Pyx_TraceDeclarationsFunc
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  int __pyx_t_2;
  PyObject *__pyx_t_3 = NULL;
  PyObject *__pyx_t_4 = NULL;
  Py_ssize_t __pyx_t_5;
  Py_ssize_t __pyx_t_6;
  int __pyx_t_7;
  int __pyx_t_8;
  PyObject *__pyx_t_9 = NULL;
  size_t __pyx_t_10;
  Py_ssize_t __pyx_t_11;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_TraceFrameInit(((PyObject *)__pyx_mstate_global->__pyx_codeobj_tab[9]))
  __Pyx_RefNannySetupContext("bcf_array_to_object", 0);
  __Pyx_TraceStartFunc("bcf_array_to_object", __pyx_f[0], 277, 0, 0, 0, __PYX_ERR(0, 277, __pyx_L1_error));

  /* "pysam/libcbcf.pyx":286
 *     cdef bytes    b
 * 
 *     if not data or n <= 0:             # <<<<<<<<<<<<<<
 *         return None
 * 
*/
  __pyx_t_2 = (!(__pyx_v_data != 0));
  if (!__pyx_t_2) {
  } else {
    __pyx_t_1 = __pyx_t_2;
    goto __pyx_L4_bool_binop_done;
  }
  __pyx_t_2 = (__pyx_v_n <= 0);
  __pyx_t_1 = __pyx_t_2;
  __pyx_L4_bool_binop_done:;
  if (__pyx_t_1) {

    /* "pysam/libcbcf.pyx":287
 * 
 *     if not data or n <= 0:
 *         return None             # <<<<<<<<<<<<<<
 * 
 *     if type == BCF_BT_CHAR:
*/
    __Pyx_XDECREF(__pyx_r);
    __pyx_r = Py_None; __Pyx_INCREF(Py_None);
    goto __pyx_L0;

    /* "pysam/libcbcf.pyx":286
 *     cdef bytes    b
 * 
 *     if not data or n <= 0:             # <<<<<<<<<<<<<<
 *         return None
 * 
*/
  }

  /* "pysam/libcbcf.pyx":289
 *         return None
 * 
 *     if type == BCF_BT_CHAR:             # <<<<<<<<<<<<<<
 *         datac = <char *>data
 * 
*/
  __pyx_t_1 = (__pyx_v_type == BCF_BT_CHAR);
  if (__pyx_t_1) {

    /* "pysam/libcbcf.pyx":290
 * 
 *     if type == BCF_BT_CHAR:
 *         datac = <char *>data             # <<<<<<<<<<<<<<
 * 
 *         if not n:
*/
    __pyx_v_datac = ((char *)__pyx_v_data);

    /* "pysam/libcbcf.pyx":292
 *         datac = <char *>data
 * 
 *         if not n:             # <<<<<<<<<<<<<<
 *             value = ()
 *         else:
*/
    __pyx_t_1 = (!(__pyx_v_n != 0));
    if (__pyx_t_1) {

      /* "pysam/libcbcf.pyx":293
 * 
 *         if not n:
 *             value = ()             # <<<<<<<<<<<<<<
 *         else:
 *             # Check if at least one null terminator is present
*/
      __Pyx_INCREF(__pyx_mstate_global->__pyx_empty_tuple);
      __pyx_v_value = __pyx_mstate_global->__pyx_empty_tuple;

      /* "pysam/libcbcf.pyx":292
 *         datac = <char *>data
 * 
 *         if not n:             # <<<<<<<<<<<<<<
 *             value = ()
 *         else:
*/
      goto __pyx_L7;
    }

    /* "pysam/libcbcf.pyx":296
 *         else:
 *             # Check if at least one null terminator is present
 *             if datac[n-1] == bcf_str_vector_end:             # <<<<<<<<<<<<<<
 *                 # If so, create a string up to the first null terminator
 *                 b = datac
*/
    /*else*/ {
      __pyx_t_1 = ((__pyx_v_datac[(__pyx_v_n - 1)]) == bcf_str_vector_end);
      if (__pyx_t_1) {

        /* "pysam/libcbcf.pyx":298
 *             if datac[n-1] == bcf_str_vector_end:
 *                 # If so, create a string up to the first null terminator
 *                 b = datac             # <<<<<<<<<<<<<<
 *             else:
 *                 # Otherwise, copy the entire block
*/
        __pyx_t_3 = __Pyx_PyBytes_FromString(__pyx_v_datac); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 298, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_3);
        __pyx_v_b = ((PyObject*)__pyx_t_3);
        __pyx_t_3 = 0;

        /* "pysam/libcbcf.pyx":296
 *         else:
 *             # Check if at least one null terminator is present
 *             if datac[n-1] == bcf_str_vector_end:             # <<<<<<<<<<<<<<
 *                 # If so, create a string up to the first null terminator
 *                 b = datac
*/
        goto __pyx_L8;
      }

      /* "pysam/libcbcf.pyx":301
 *             else:
 *                 # Otherwise, copy the entire block
 *                 b = datac[:n]             # <<<<<<<<<<<<<<
 *             value = tuple(decode_bytes(v, 'utf-8') if v and v != bcf_str_missing else None for v in b.split(b','))
 *     else:
*/
      /*else*/ {
        __pyx_t_3 = __Pyx_PyBytes_FromStringAndSize(__pyx_v_datac + 0, __pyx_v_n - 0); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 301, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_3);
        __pyx_v_b = ((PyObject*)__pyx_t_3);
        __pyx_t_3 = 0;
      }
      __pyx_L8:;

      /* "pysam/libcbcf.pyx":302
 *                 # Otherwise, copy the entire block
 *                 b = datac[:n]
 *             value = tuple(decode_bytes(v, 'utf-8') if v and v != bcf_str_missing else None for v in b.split(b','))             # <<<<<<<<<<<<<<
 *     else:
 *         value = []
*/
      __pyx_t_3 = __pyx_pf_5pysam_7libcbcf_19bcf_array_to_object_genexpr(NULL, __pyx_v_b); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 302, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_3);
      __pyx_t_4 = __Pyx_PySequence_Tuple(__pyx_t_3); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 302, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_4);
      __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
      __pyx_v_value = __pyx_t_4;
      __pyx_t_4 = 0;
    }
    __pyx_L7:;

    /* "pysam/libcbcf.pyx":289
 *         return None
 * 
 *     if type == BCF_BT_CHAR:             # <<<<<<<<<<<<<<
 *         datac = <char *>data
 * 
*/
    goto __pyx_L6;
  }

  /* "pysam/libcbcf.pyx":304
 *             value = tuple(decode_bytes(v, 'utf-8') if v and v != bcf_str_missing else None for v in b.split(b','))
 *     else:
 *         value = []             # <<<<<<<<<<<<<<
 *         if type == BCF_BT_INT8:
 *             data8 = <int8_t *>data
*/
  /*else*/ {
    __pyx_t_4 = PyList_New(0); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 304, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
    __pyx_v_value = __pyx_t_4;
    __pyx_t_4 = 0;

    /* "pysam/libcbcf.pyx":305
 *     else:
 *         value = []
 *         if type == BCF_BT_INT8:             # <<<<<<<<<<<<<<
 *             data8 = <int8_t *>data
 *             for i in range(n):
*/
    __pyx_t_1 = (__pyx_v_type == BCF_BT_INT8);
    if (__pyx_t_1) {

      /* "pysam/libcbcf.pyx":306
 *         value = []
 *         if type == BCF_BT_INT8:
 *             data8 = <int8_t *>data             # <<<<<<<<<<<<<<
 *             for i in range(n):
 *                 if data8[i] == bcf_int8_vector_end:
*/
      __pyx_v_data8 = ((int8_t *)__pyx_v_data);

      /* "pysam/libcbcf.pyx":307
 *         if type == BCF_BT_INT8:
 *             data8 = <int8_t *>data
 *             for i in range(n):             # <<<<<<<<<<<<<<
 *                 if data8[i] == bcf_int8_vector_end:
 *                     break
*/
      __pyx_t_5 = __pyx_v_n;
      __pyx_t_6 = __pyx_t_5;
      for (__pyx_t_7 = 0; __pyx_t_7 < __pyx_t_6; __pyx_t_7+=1) {
        __pyx_v_i = __pyx_t_7;

        /* "pysam/libcbcf.pyx":308
 *             data8 = <int8_t *>data
 *             for i in range(n):
 *                 if data8[i] == bcf_int8_vector_end:             # <<<<<<<<<<<<<<
 *                     break
 *                 value.append(data8[i] if data8[i] != bcf_int8_missing else None)
*/
        __pyx_t_1 = ((__pyx_v_data8[__pyx_v_i]) == bcf_int8_vector_end);
        if (__pyx_t_1) {

          /* "pysam/libcbcf.pyx":309
 *             for i in range(n):
 *                 if data8[i] == bcf_int8_vector_end:
 *                     break             # <<<<<<<<<<<<<<
 *                 value.append(data8[i] if data8[i] != bcf_int8_missing else None)
 *         elif type == BCF_BT_INT16:
*/
          goto __pyx_L11_break;

          /* "pysam/libcbcf.pyx":308
 *             data8 = <int8_t *>data
 *             for i in range(n):
 *                 if data8[i] == bcf_int8_vector_end:             # <<<<<<<<<<<<<<
 *                     break
 *                 value.append(data8[i] if data8[i] != bcf_int8_missing else None)
*/
        }

        /* "pysam/libcbcf.pyx":310
 *                 if data8[i] == bcf_int8_vector_end:
 *                     break
 *                 value.append(data8[i] if data8[i] != bcf_int8_missing else None)             # <<<<<<<<<<<<<<
 *         elif type == BCF_BT_INT16:
 *             data16 = <int16_t *>data
*/
        __pyx_t_1 = ((__pyx_v_data8[__pyx_v_i]) != bcf_int8_missing);
        if (__pyx_t_1) {
          __pyx_t_3 = __Pyx_PyLong_From_int8_t((__pyx_v_data8[__pyx_v_i])); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 310, __pyx_L1_error)
          __Pyx_GOTREF(__pyx_t_3);
          __pyx_t_4 = __pyx_t_3;
          __pyx_t_3 = 0;
        } else {
          __Pyx_INCREF(Py_None);
          __pyx_t_4 = Py_None;
        }
        __pyx_t_8 = __Pyx_PyObject_Append(__pyx_v_value, __pyx_t_4); if (unlikely(__pyx_t_8 == ((int)-1))) __PYX_ERR(0, 310, __pyx_L1_error)
        __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
      }
      __pyx_L11_break:;

      /* "pysam/libcbcf.pyx":305
 *     else:
 *         value = []
 *         if type == BCF_BT_INT8:             # <<<<<<<<<<<<<<
 *             data8 = <int8_t *>data
 *             for i in range(n):
*/
      goto __pyx_L9;
    }

    /* "pysam/libcbcf.pyx":311
 *                     break
 *                 value.append(data8[i] if data8[i] != bcf_int8_missing else None)
 *         elif type == BCF_BT_INT16:             # <<<<<<<<<<<<<<
 *             data16 = <int16_t *>data
 *             for i in range(n):
*/
    __pyx_t_1 = (__pyx_v_type == BCF_BT_INT16);
    if (__pyx_t_1) {

      /* "pysam/libcbcf.pyx":312
 *                 value.append(data8[i] if data8[i] != bcf_int8_missing else None)
 *         elif type == BCF_BT_INT16:
 *             data16 = <int16_t *>data             # <<<<<<<<<<<<<<
 *             for i in range(n):
 *                 if data16[i] == bcf_int16_vector_end:
*/
      __pyx_v_data16 = ((int16_t *)__pyx_v_data);

      /* "pysam/libcbcf.pyx":313
 *         elif type == BCF_BT_INT16:
 *             data16 = <int16_t *>data
 *             for i in range(n):             # <<<<<<<<<<<<<<
 *                 if data16[i] == bcf_int16_vector_end:
 *                     break
*/
      __pyx_t_5 = __pyx_v_n;
      __pyx_t_6 = __pyx_t_5;
      for (__pyx_t_7 = 0; __pyx_t_7 < __pyx_t_6; __pyx_t_7+=1) {
        __pyx_v_i = __pyx_t_7;

        /* "pysam/libcbcf.pyx":314
 *             data16 = <int16_t *>data
 *             for i in range(n):
 *                 if data16[i] == bcf_int16_vector_end:             # <<<<<<<<<<<<<<
 *                     break
 *                 value.append(data16[i] if data16[i] != bcf_int16_missing else None)
*/
        __pyx_t_1 = ((__pyx_v_data16[__pyx_v_i]) == bcf_int16_vector_end);
        if (__pyx_t_1) {

          /* "pysam/libcbcf.pyx":315
 *             for i in range(n):
 *                 if data16[i] == bcf_int16_vector_end:
 *                     break             # <<<<<<<<<<<<<<
 *                 value.append(data16[i] if data16[i] != bcf_int16_missing else None)
 *         elif type == BCF_BT_INT32:
*/
          goto __pyx_L14_break;

          /* "pysam/libcbcf.pyx":314
 *             data16 = <int16_t *>data
 *             for i in range(n):
 *                 if data16[i] == bcf_int16_vector_end:             # <<<<<<<<<<<<<<
 *                     break
 *                 value.append(data16[i] if data16[i] != bcf_int16_missing else None)
*/
        }

        /* "pysam/libcbcf.pyx":316
 *                 if data16[i] == bcf_int16_vector_end:
 *                     break
 *                 value.append(data16[i] if data16[i] != bcf_int16_missing else None)             # <<<<<<<<<<<<<<
 *         elif type == BCF_BT_INT32:
 *             data32 = <int32_t *>data
*/
        __pyx_t_1 = ((__pyx_v_data16[__pyx_v_i]) != bcf_int16_missing);
        if (__pyx_t_1) {
          __pyx_t_3 = __Pyx_PyLong_From_int16_t((__pyx_v_data16[__pyx_v_i])); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 316, __pyx_L1_error)
          __Pyx_GOTREF(__pyx_t_3);
          __pyx_t_4 = __pyx_t_3;
          __pyx_t_3 = 0;
        } else {
          __Pyx_INCREF(Py_None);
          __pyx_t_4 = Py_None;
        }
        __pyx_t_8 = __Pyx_PyObject_Append(__pyx_v_value, __pyx_t_4); if (unlikely(__pyx_t_8 == ((int)-1))) __PYX_ERR(0, 316, __pyx_L1_error)
        __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
      }
      __pyx_L14_break:;

      /* "pysam/libcbcf.pyx":311
 *                     break
 *                 value.append(data8[i] if data8[i] != bcf_int8_missing else None)
 *         elif type == BCF_BT_INT16:             # <<<<<<<<<<<<<<
 *             data16 = <int16_t *>data
 *             for i in range(n):
*/
      goto __pyx_L9;
    }

    /* "pysam/libcbcf.pyx":317
 *                     break
 *                 value.append(data16[i] if data16[i] != bcf_int16_missing else None)
 *         elif type == BCF_BT_INT32:             # <<<<<<<<<<<<<<
 *             data32 = <int32_t *>data
 *             for i in range(n):
*/
    __pyx_t_1 = (__pyx_v_type == BCF_BT_INT32);
    if (__pyx_t_1) {

      /* "pysam/libcbcf.pyx":318
 *                 value.append(data16[i] if data16[i] != bcf_int16_missing else None)
 *         elif type == BCF_BT_INT32:
 *             data32 = <int32_t *>data             # <<<<<<<<<<<<<<
 *             for i in range(n):
 *                 if data32[i] == bcf_int32_vector_end:
*/
      __pyx_v_data32 = ((int32_t *)__pyx_v_data);

      /* "pysam/libcbcf.pyx":319
 *         elif type == BCF_BT_INT32:
 *             data32 = <int32_t *>data
 *             for i in range(n):             # <<<<<<<<<<<<<<
 *                 if data32[i] == bcf_int32_vector_end:
 *                     break
*/
      __pyx_t_5 = __pyx_v_n;
      __pyx_t_6 = __pyx_t_5;
      for (__pyx_t_7 = 0; __pyx_t_7 < __pyx_t_6; __pyx_t_7+=1) {
        __pyx_v_i = __pyx_t_7;

        /* "pysam/libcbcf.pyx":320
 *             data32 = <int32_t *>data
 *             for i in range(n):
 *                 if data32[i] == bcf_int32_vector_end:             # <<<<<<<<<<<<<<
 *                     break
 *                 value.append(data32[i] if data32[i] != bcf_int32_missing else None)
*/
        __pyx_t_1 = ((__pyx_v_data32[__pyx_v_i]) == bcf_int32_vector_end);
        if (__pyx_t_1) {

          /* "pysam/libcbcf.pyx":321
 *             for i in range(n):
 *                 if data32[i] == bcf_int32_vector_end:
 *                     break             # <<<<<<<<<<<<<<
 *                 value.append(data32[i] if data32[i] != bcf_int32_missing else None)
 *         elif type == BCF_BT_FLOAT:
*/
          goto __pyx_L17_break;

          /* "pysam/libcbcf.pyx":320
 *             data32 = <int32_t *>data
 *             for i in range(n):
 *                 if data32[i] == bcf_int32_vector_end:             # <<<<<<<<<<<<<<
 *                     break
 *                 value.append(data32[i] if data32[i] != bcf_int32_missing else None)
*/
        }

        /* "pysam/libcbcf.pyx":322
 *                 if data32[i] == bcf_int32_vector_end:
 *                     break
 *                 value.append(data32[i] if data32[i] != bcf_int32_missing else None)             # <<<<<<<<<<<<<<
 *         elif type == BCF_BT_FLOAT:
 *             dataf = <float *>data
*/
        __pyx_t_1 = ((__pyx_v_data32[__pyx_v_i]) != bcf_int32_missing);
        if (__pyx_t_1) {
          __pyx_t_3 = __Pyx_PyLong_From_int32_t((__pyx_v_data32[__pyx_v_i])); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 322, __pyx_L1_error)
          __Pyx_GOTREF(__pyx_t_3);
          __pyx_t_4 = __pyx_t_3;
          __pyx_t_3 = 0;
        } else {
          __Pyx_INCREF(Py_None);
          __pyx_t_4 = Py_None;
        }
        __pyx_t_8 = __Pyx_PyObject_Append(__pyx_v_value, __pyx_t_4); if (unlikely(__pyx_t_8 == ((int)-1))) __PYX_ERR(0, 322, __pyx_L1_error)
        __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
      }
      __pyx_L17_break:;

      /* "pysam/libcbcf.pyx":317
 *                     break
 *                 value.append(data16[i] if data16[i] != bcf_int16_missing else None)
 *         elif type == BCF_BT_INT32:             # <<<<<<<<<<<<<<
 *             data32 = <int32_t *>data
 *             for i in range(n):
*/
      goto __pyx_L9;
    }

    /* "pysam/libcbcf.pyx":323
 *                     break
 *                 value.append(data32[i] if data32[i] != bcf_int32_missing else None)
 *         elif type == BCF_BT_FLOAT:             # <<<<<<<<<<<<<<
 *             dataf = <float *>data
 *             for i in range(n):
*/
    __pyx_t_1 = (__pyx_v_type == BCF_BT_FLOAT);
    if (likely(__pyx_t_1)) {

      /* "pysam/libcbcf.pyx":324
 *                 value.append(data32[i] if data32[i] != bcf_int32_missing else None)
 *         elif type == BCF_BT_FLOAT:
 *             dataf = <float *>data             # <<<<<<<<<<<<<<
 *             for i in range(n):
 *                 if bcf_float_is_vector_end(dataf[i]):
*/
      __pyx_v_dataf = ((float *)__pyx_v_data);

      /* "pysam/libcbcf.pyx":325
 *         elif type == BCF_BT_FLOAT:
 *             dataf = <float *>data
 *             for i in range(n):             # <<<<<<<<<<<<<<
 *                 if bcf_float_is_vector_end(dataf[i]):
 *                     break
*/
      __pyx_t_5 = __pyx_v_n;
      __pyx_t_6 = __pyx_t_5;
      for (__pyx_t_7 = 0; __pyx_t_7 < __pyx_t_6; __pyx_t_7+=1) {
        __pyx_v_i = __pyx_t_7;

        /* "pysam/libcbcf.pyx":326
 *             dataf = <float *>data
 *             for i in range(n):
 *                 if bcf_float_is_vector_end(dataf[i]):             # <<<<<<<<<<<<<<
 *                     break
 *                 value.append(dataf[i] if not bcf_float_is_missing(dataf[i]) else None)
*/
        __pyx_t_1 = (bcf_float_is_vector_end((__pyx_v_dataf[__pyx_v_i])) != 0);
        if (__pyx_t_1) {

          /* "pysam/libcbcf.pyx":327
 *             for i in range(n):
 *                 if bcf_float_is_vector_end(dataf[i]):
 *                     break             # <<<<<<<<<<<<<<
 *                 value.append(dataf[i] if not bcf_float_is_missing(dataf[i]) else None)
 *         else:
*/
          goto __pyx_L20_break;

          /* "pysam/libcbcf.pyx":326
 *             dataf = <float *>data
 *             for i in range(n):
 *                 if bcf_float_is_vector_end(dataf[i]):             # <<<<<<<<<<<<<<
 *                     break
 *                 value.append(dataf[i] if not bcf_float_is_missing(dataf[i]) else None)
*/
        }

        /* "pysam/libcbcf.pyx":328
 *                 if bcf_float_is_vector_end(dataf[i]):
 *                     break
 *                 value.append(dataf[i] if not bcf_float_is_missing(dataf[i]) else None)             # <<<<<<<<<<<<<<
 *         else:
 *             raise TypeError('unsupported info type code')
*/
        __pyx_t_1 = (!(bcf_float_is_missing((__pyx_v_dataf[__pyx_v_i])) != 0));
        if (__pyx_t_1) {
          __pyx_t_3 = PyFloat_FromDouble((__pyx_v_dataf[__pyx_v_i])); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 328, __pyx_L1_error)
          __Pyx_GOTREF(__pyx_t_3);
          __pyx_t_4 = __pyx_t_3;
          __pyx_t_3 = 0;
        } else {
          __Pyx_INCREF(Py_None);
          __pyx_t_4 = Py_None;
        }
        __pyx_t_8 = __Pyx_PyObject_Append(__pyx_v_value, __pyx_t_4); if (unlikely(__pyx_t_8 == ((int)-1))) __PYX_ERR(0, 328, __pyx_L1_error)
        __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
      }
      __pyx_L20_break:;

      /* "pysam/libcbcf.pyx":323
 *                     break
 *                 value.append(data32[i] if data32[i] != bcf_int32_missing else None)
 *         elif type == BCF_BT_FLOAT:             # <<<<<<<<<<<<<<
 *             dataf = <float *>data
 *             for i in range(n):
*/
      goto __pyx_L9;
    }

    /* "pysam/libcbcf.pyx":330
 *                 value.append(dataf[i] if not bcf_float_is_missing(dataf[i]) else None)
 *         else:
 *             raise TypeError('unsupported info type code')             # <<<<<<<<<<<<<<
 * 
 *     # FIXME: Need to know length?  Report errors?  Pad with missing values?  Not clear what to do.
*/
    /*else*/ {
      __pyx_t_3 = NULL;
      __Pyx_INCREF(__pyx_builtin_TypeError);
      __pyx_t_9 = __pyx_builtin_TypeError; 
      __pyx_t_10 = 1;
      {
        PyObject *__pyx_callargs[2] = {__pyx_t_3, __pyx_mstate_global->__pyx_kp_u_unsupported_info_type_code};
        __pyx_t_4 = __Pyx_PyObject_FastCall(__pyx_t_9, __pyx_callargs+__pyx_t_10, (2-__pyx_t_10) | (__pyx_t_10*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
        __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
        __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
        if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 330, __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, 330, __pyx_L1_error)
    }
    __pyx_L9:;
  }
  __pyx_L6:;

  /* "pysam/libcbcf.pyx":333
 * 
 *     # FIXME: Need to know length?  Report errors?  Pad with missing values?  Not clear what to do.
 *     if not value:             # <<<<<<<<<<<<<<
 *         if scalar:
 *             value = None
*/
  __pyx_t_1 = __Pyx_PyObject_IsTrue(__pyx_v_value); if (unlikely((__pyx_t_1 < 0))) __PYX_ERR(0, 333, __pyx_L1_error)
  __pyx_t_2 = (!__pyx_t_1);
  if (__pyx_t_2) {

    /* "pysam/libcbcf.pyx":334
 *     # FIXME: Need to know length?  Report errors?  Pad with missing values?  Not clear what to do.
 *     if not value:
 *         if scalar:             # <<<<<<<<<<<<<<
 *             value = None
 *         elif count <= 0:
*/
    __pyx_t_2 = (__pyx_v_scalar != 0);
    if (__pyx_t_2) {

      /* "pysam/libcbcf.pyx":335
 *     if not value:
 *         if scalar:
 *             value = None             # <<<<<<<<<<<<<<
 *         elif count <= 0:
 *             value = ()
*/
      __Pyx_INCREF(Py_None);
      __Pyx_DECREF_SET(__pyx_v_value, Py_None);

      /* "pysam/libcbcf.pyx":334
 *     # FIXME: Need to know length?  Report errors?  Pad with missing values?  Not clear what to do.
 *     if not value:
 *         if scalar:             # <<<<<<<<<<<<<<
 *             value = None
 *         elif count <= 0:
*/
      goto __pyx_L23;
    }

    /* "pysam/libcbcf.pyx":336
 *         if scalar:
 *             value = None
 *         elif count <= 0:             # <<<<<<<<<<<<<<
 *             value = ()
 *         else:
*/
    __pyx_t_2 = (__pyx_v_count <= 0);
    if (__pyx_t_2) {

      /* "pysam/libcbcf.pyx":337
 *             value = None
 *         elif count <= 0:
 *             value = ()             # <<<<<<<<<<<<<<
 *         else:
 *             value = (None,)*count
*/
      __Pyx_INCREF(__pyx_mstate_global->__pyx_empty_tuple);
      __Pyx_DECREF_SET(__pyx_v_value, __pyx_mstate_global->__pyx_empty_tuple);

      /* "pysam/libcbcf.pyx":336
 *         if scalar:
 *             value = None
 *         elif count <= 0:             # <<<<<<<<<<<<<<
 *             value = ()
 *         else:
*/
      goto __pyx_L23;
    }

    /* "pysam/libcbcf.pyx":339
 *             value = ()
 *         else:
 *             value = (None,)*count             # <<<<<<<<<<<<<<
 *     elif scalar and len(value) == 1:
 *         value = value[0]
*/
    /*else*/ {
      __pyx_t_4 = __Pyx_PySequence_Multiply(__pyx_mstate_global->__pyx_tuple[0], __pyx_v_count); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 339, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_4);
      __Pyx_DECREF_SET(__pyx_v_value, __pyx_t_4);
      __pyx_t_4 = 0;
    }
    __pyx_L23:;

    /* "pysam/libcbcf.pyx":333
 * 
 *     # FIXME: Need to know length?  Report errors?  Pad with missing values?  Not clear what to do.
 *     if not value:             # <<<<<<<<<<<<<<
 *         if scalar:
 *             value = None
*/
    goto __pyx_L22;
  }

  /* "pysam/libcbcf.pyx":340
 *         else:
 *             value = (None,)*count
 *     elif scalar and len(value) == 1:             # <<<<<<<<<<<<<<
 *         value = value[0]
 *     else:
*/
  __pyx_t_1 = (__pyx_v_scalar != 0);
  if (__pyx_t_1) {
  } else {
    __pyx_t_2 = __pyx_t_1;
    goto __pyx_L24_bool_binop_done;
  }
  __pyx_t_11 = PyObject_Length(__pyx_v_value); if (unlikely(__pyx_t_11 == ((Py_ssize_t)-1))) __PYX_ERR(0, 340, __pyx_L1_error)
  __pyx_t_1 = (__pyx_t_11 == 1);
  __pyx_t_2 = __pyx_t_1;
  __pyx_L24_bool_binop_done:;
  if (__pyx_t_2) {

    /* "pysam/libcbcf.pyx":341
 *             value = (None,)*count
 *     elif scalar and len(value) == 1:
 *         value = value[0]             # <<<<<<<<<<<<<<
 *     else:
 *         value = tuple(value)
*/
    __pyx_t_4 = __Pyx_GetItemInt(__pyx_v_value, 0, long, 1, __Pyx_PyLong_From_long, 0, 0, 1, 1); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 341, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
    __Pyx_DECREF_SET(__pyx_v_value, __pyx_t_4);
    __pyx_t_4 = 0;

    /* "pysam/libcbcf.pyx":340
 *         else:
 *             value = (None,)*count
 *     elif scalar and len(value) == 1:             # <<<<<<<<<<<<<<
 *         value = value[0]
 *     else:
*/
    goto __pyx_L22;
  }

  /* "pysam/libcbcf.pyx":343
 *         value = value[0]
 *     else:
 *         value = tuple(value)             # <<<<<<<<<<<<<<
 * 
 *     return value
*/
  /*else*/ {
    __pyx_t_4 = __Pyx_PySequence_Tuple(__pyx_v_value); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 343, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
    __Pyx_DECREF_SET(__pyx_v_value, __pyx_t_4);
    __pyx_t_4 = 0;
  }
  __pyx_L22:;

  /* "pysam/libcbcf.pyx":345
 *         value = tuple(value)
 * 
 *     return value             # <<<<<<<<<<<<<<
 * 
 * 
*/
  __Pyx_XDECREF(__pyx_r);
  __Pyx_INCREF(__pyx_v_value);
  __pyx_r = __pyx_v_value;
  __Pyx_TraceReturnValue(__pyx_r, 199, 0, __PYX_ERR(0, 345, __pyx_L1_error));
  goto __pyx_L0;

  /* "pysam/libcbcf.pyx":277
 * 
 * 
 * cdef bcf_array_to_object(void *data, int type, ssize_t n, ssize_t count, int scalar):             # <<<<<<<<<<<<<<
 *     cdef char    *datac
 *     cdef int8_t  *data8
*/

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_XDECREF(__pyx_t_9);
  __Pyx_TraceException(__pyx_lineno, 0, 0);
  #if CYTHON_USE_SYS_MONITORING
  __Pyx_TraceExceptionUnwind(0, 0);
  #else
  __Pyx_TraceReturnValue(NULL, 0, 0, __PYX_ERR(0, 277, __pyx_L1_error));
  #endif
  __Pyx_AddTraceback("pysam.libcbcf.bcf_array_to_object", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_b);
  __Pyx_XDECREF(__pyx_v_value);
  __Pyx_XDECREF(__pyx_gb_5pysam_7libcbcf_19bcf_array_to_object_2generator29);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_PyMonitoring_ExitScope(0);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}
static PyObject *__pyx_gb_5pysam_7libcbcf_19bcf_object_to_array_2generator30(__pyx_CoroutineObject *__pyx_generator, CYTHON_UNUSED PyThreadState *__pyx_tstate, PyObject *__pyx_sent_value); /* proto */

/* "pysam/libcbcf.pyx":360
 *     if bt_type == BCF_BT_CHAR:
 *         if not isinstance(values, (str, bytes)):
 *             values = b','.join(force_bytes(v) if v else bcf_str_missing for v in values)             # <<<<<<<<<<<<<<
 *             value_count = len(values)
 *         assert value_count <= n
*/

static PyObject *__pyx_pf_5pysam_7libcbcf_19bcf_object_to_array_genexpr(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_genexpr_arg_0) {
  struct __pyx_obj_5pysam_7libcbcf___pyx_scope_struct_3_genexpr *__pyx_cur_scope;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("genexpr", 0);
  __pyx_cur_scope = (struct __pyx_obj_5pysam_7libcbcf___pyx_scope_struct_3_genexpr *)__pyx_tp_new_5pysam_7libcbcf___pyx_scope_struct_3_genexpr(__pyx_mstate_global->__pyx_ptype_5pysam_7libcbcf___pyx_scope_struct_3_genexpr, __pyx_mstate_global->__pyx_empty_tuple, NULL);
  if (unlikely(!__pyx_cur_scope)) {
    __pyx_cur_scope = ((struct __pyx_obj_5pysam_7libcbcf___pyx_scope_struct_3_genexpr *)Py_None);
    __Pyx_INCREF(Py_None);
    __PYX_ERR(0, 360, __pyx_L1_error)
  } else {
    __Pyx_GOTREF((PyObject *)__pyx_cur_scope);
  }
  __pyx_cur_scope->__pyx_genexpr_arg_0 = __pyx_genexpr_arg_0;
  __Pyx_INCREF(__pyx_cur_scope->__pyx_genexpr_arg_0);
  __Pyx_GIVEREF(__pyx_cur_scope->__pyx_genexpr_arg_0);
  {
    __pyx_CoroutineObject *gen = __Pyx_Generator_New((__pyx_coroutine_body_t) __pyx_gb_5pysam_7libcbcf_19bcf_object_to_array_2generator30, ((PyObject *)__pyx_mstate_global->__pyx_codeobj_tab[10]), (PyObject *) __pyx_cur_scope, __pyx_mstate_global->__pyx_n_u_genexpr, __pyx_mstate_global->__pyx_n_u_bcf_object_to_array_locals_genex, __pyx_mstate_global->__pyx_n_u_pysam_libcbcf); if (unlikely(!gen)) __PYX_ERR(0, 360, __pyx_L1_error)
    __Pyx_DECREF(__pyx_cur_scope);
    __Pyx_RefNannyFinishContext();
    return (PyObject *) gen;
  }

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_AddTraceback("pysam.libcbcf.bcf_object_to_array.genexpr", __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_5pysam_7libcbcf_19bcf_object_to_array_2generator30(__pyx_CoroutineObject *__pyx_generator, CYTHON_UNUSED PyThreadState *__pyx_tstate, PyObject *__pyx_sent_value) /* generator body */
{
  struct __pyx_obj_5pysam_7libcbcf___pyx_scope_struct_3_genexpr *__pyx_cur_scope = ((struct __pyx_obj_5pysam_7libcbcf___pyx_scope_struct_3_genexpr *)__pyx_generator->closure);
  PyObject *__pyx_r = NULL;
  __Pyx_TraceDeclarationsGen
  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;
  PyObject *__pyx_t_6 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("genexpr", 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_TraceStartGen("genexpr", __pyx_f[0], 360, 0, 0, 0, __PYX_ERR(0, 360, __pyx_L1_error));
    __Pyx_TraceReturnValue(Py_None, 0, 0, __PYX_ERR(0, 360, __pyx_L1_error));
    __Pyx_RefNannyFinishContext();
    return NULL;
  }
  __pyx_L3_first_run:;
  __Pyx_TraceStartGen("genexpr", __pyx_f[0], 360, 0, 0, 0, __PYX_ERR(0, 360, __pyx_L1_error));
  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, 360, __pyx_L1_error)
  }
  if (unlikely(!__pyx_cur_scope->__pyx_genexpr_arg_0)) { __Pyx_RaiseUnboundLocalError(".0"); __PYX_ERR(0, 360, __pyx_L1_error) }
  if (likely(PyList_CheckExact(__pyx_cur_scope->__pyx_genexpr_arg_0)) || PyTuple_CheckExact(__pyx_cur_scope->__pyx_genexpr_arg_0)) {
    __pyx_t_1 = __pyx_cur_scope->__pyx_genexpr_arg_0; __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_genexpr_arg_0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 360, __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, 360, __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, 360, __pyx_L1_error)
          #endif
          if (__pyx_t_2 >= __pyx_temp) break;
        }
        __pyx_t_4 = __Pyx_PyList_GetItemRef(__pyx_t_1, __pyx_t_2);
        ++__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, 360, __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, 360, __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, 360, __pyx_L1_error)
          PyErr_Clear();
        }
        break;
      }
    }
    __Pyx_GOTREF(__pyx_t_4);
    __Pyx_XGOTREF(__pyx_cur_scope->__pyx_v_v);
    __Pyx_XDECREF_SET(__pyx_cur_scope->__pyx_v_v, __pyx_t_4);
    __Pyx_GIVEREF(__pyx_t_4);
    __pyx_t_4 = 0;
    __pyx_t_5 = __Pyx_PyObject_IsTrue(__pyx_cur_scope->__pyx_v_v); if (unlikely((__pyx_t_5 < 0))) __PYX_ERR(0, 360, __pyx_L1_error)
    if (__pyx_t_5) {
      __pyx_t_6 = __pyx_f_5pysam_9libcutils_force_bytes(__pyx_cur_scope->__pyx_v_v, NULL); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 360, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_6);
      __pyx_t_4 = __pyx_t_6;
      __pyx_t_6 = 0;
    } else {
      __pyx_t_6 = __Pyx_PyLong_From_int32_t(bcf_str_missing); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 360, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_6);
      __pyx_t_4 = __pyx_t_6;
      __pyx_t_6 = 0;
    }
    __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_TraceYield(__pyx_r, 0, __PYX_ERR(0, 360, __pyx_L1_error));
    __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_TraceResumeGen("genexpr", __pyx_f[0], 360, 0, __PYX_ERR(0, 360, __pyx_L1_error));
    __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, 360, __pyx_L1_error)
  }
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  CYTHON_MAYBE_UNUSED_VAR(__pyx_cur_scope);
  __Pyx_TraceReturnValue(Py_None, 0, 0, __PYX_ERR(0, 360, __pyx_L1_error));

  /* 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_6);
  if (__Pyx_PyErr_Occurred()) {
    __Pyx_TraceException(__pyx_lineno, 0, 0);
    __Pyx_Generator_Replace_StopIteration(0);
    __Pyx_AddTraceback("genexpr", __pyx_clineno, __pyx_lineno, __pyx_filename);
    __Pyx_TraceExceptionUnwind(0, 0);
  }
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_PyMonitoring_ExitScope(0);
  #if !CYTHON_USE_EXC_INFO_STACK
  __Pyx_Coroutine_ResetAndClearException(__pyx_generator);
  #endif
  __pyx_generator->resume_label = -1;
  __Pyx_Coroutine_clear((PyObject*)__pyx_generator);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "pysam/libcbcf.pyx":348
 * 
 * 
 * cdef bcf_object_to_array(values, void *data, int bt_type, ssize_t n, int vlen):             # <<<<<<<<<<<<<<
 *     cdef char    *datac
 *     cdef int8_t  *data8
*/

static PyObject *__pyx_f_5pysam_7libcbcf_bcf_object_to_array(PyObject *__pyx_v_values, void *__pyx_v_data, int __pyx_v_bt_type, Py_ssize_t __pyx_v_n, CYTHON_UNUSED int __pyx_v_vlen) {
  char *__pyx_v_datac;
  float *__pyx_v_dataf;
  Py_ssize_t __pyx_v_i;
  Py_ssize_t __pyx_v_value_count;
  int8_t *__pyx_v_datai8;
  PyObject *__pyx_v_val = NULL;
  int16_t *__pyx_v_datai16;
  int32_t *__pyx_v_datai32;
  PyObject *__pyx_gb_5pysam_7libcbcf_19bcf_object_to_array_2generator30 = 0;
  PyObject *__pyx_r = NULL;
  __Pyx_TraceDeclarationsFunc
  __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;
  char *__pyx_t_6;
  Py_ssize_t __pyx_t_7;
  Py_ssize_t __pyx_t_8;
  Py_ssize_t __pyx_t_9;
  int8_t __pyx_t_10;
  int8_t __pyx_t_11;
  int16_t __pyx_t_12;
  int16_t __pyx_t_13;
  int32_t __pyx_t_14;
  int32_t __pyx_t_15;
  float __pyx_t_16;
  PyObject *__pyx_t_17 = NULL;
  size_t __pyx_t_18;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_TraceFrameInit(((PyObject *)__pyx_mstate_global->__pyx_codeobj_tab[11]))
  __Pyx_RefNannySetupContext("bcf_object_to_array", 0);
  __Pyx_TraceStartFunc("bcf_object_to_array", __pyx_f[0], 348, 0, 0, 0, __PYX_ERR(0, 348, __pyx_L1_error));
  __Pyx_INCREF(__pyx_v_values);

  /* "pysam/libcbcf.pyx":354
 *     cdef int32_t *data32
 *     cdef float   *dataf
 *     cdef ssize_t  i, value_count = len(values)             # <<<<<<<<<<<<<<
 * 
 *     assert value_count <= n
*/
  __pyx_t_1 = PyObject_Length(__pyx_v_values); if (unlikely(__pyx_t_1 == ((Py_ssize_t)-1))) __PYX_ERR(0, 354, __pyx_L1_error)
  __pyx_v_value_count = __pyx_t_1;

  /* "pysam/libcbcf.pyx":356
 *     cdef ssize_t  i, value_count = len(values)
 * 
 *     assert value_count <= n             # <<<<<<<<<<<<<<
 * 
 *     if bt_type == BCF_BT_CHAR:
*/
  #ifndef CYTHON_WITHOUT_ASSERTIONS
  if (unlikely(__pyx_assertions_enabled())) {
    __pyx_t_2 = (__pyx_v_value_count <= __pyx_v_n);
    if (unlikely(!__pyx_t_2)) {
      __Pyx_Raise(__pyx_builtin_AssertionError, 0, 0, 0);
      __PYX_ERR(0, 356, __pyx_L1_error)
    }
  }
  #else
  if ((1)); else __PYX_ERR(0, 356, __pyx_L1_error)
  #endif

  /* "pysam/libcbcf.pyx":358
 *     assert value_count <= n
 * 
 *     if bt_type == BCF_BT_CHAR:             # <<<<<<<<<<<<<<
 *         if not isinstance(values, (str, bytes)):
 *             values = b','.join(force_bytes(v) if v else bcf_str_missing for v in values)
*/
  __pyx_t_2 = (__pyx_v_bt_type == BCF_BT_CHAR);
  if (__pyx_t_2) {

    /* "pysam/libcbcf.pyx":359
 * 
 *     if bt_type == BCF_BT_CHAR:
 *         if not isinstance(values, (str, bytes)):             # <<<<<<<<<<<<<<
 *             values = b','.join(force_bytes(v) if v else bcf_str_missing for v in values)
 *             value_count = len(values)
*/
    __pyx_t_3 = PyUnicode_Check(__pyx_v_values); 
    if (!__pyx_t_3) {
    } else {
      __pyx_t_2 = __pyx_t_3;
      goto __pyx_L5_bool_binop_done;
    }
    __pyx_t_3 = PyBytes_Check(__pyx_v_values); 
    __pyx_t_2 = __pyx_t_3;
    __pyx_L5_bool_binop_done:;
    __pyx_t_3 = (!__pyx_t_2);
    if (__pyx_t_3) {

      /* "pysam/libcbcf.pyx":360
 *     if bt_type == BCF_BT_CHAR:
 *         if not isinstance(values, (str, bytes)):
 *             values = b','.join(force_bytes(v) if v else bcf_str_missing for v in values)             # <<<<<<<<<<<<<<
 *             value_count = len(values)
 *         assert value_count <= n
*/
      __pyx_t_4 = __pyx_pf_5pysam_7libcbcf_19bcf_object_to_array_genexpr(NULL, __pyx_v_values); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 360, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_4);
      __pyx_t_5 = __Pyx_PyBytes_Join(__pyx_mstate_global->__pyx_kp_b_, __pyx_t_4); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 360, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_5);
      __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
      __Pyx_DECREF_SET(__pyx_v_values, __pyx_t_5);
      __pyx_t_5 = 0;

      /* "pysam/libcbcf.pyx":361
 *         if not isinstance(values, (str, bytes)):
 *             values = b','.join(force_bytes(v) if v else bcf_str_missing for v in values)
 *             value_count = len(values)             # <<<<<<<<<<<<<<
 *         assert value_count <= n
 *         datac = <char *>data
*/
      __pyx_t_1 = PyObject_Length(__pyx_v_values); if (unlikely(__pyx_t_1 == ((Py_ssize_t)-1))) __PYX_ERR(0, 361, __pyx_L1_error)
      __pyx_v_value_count = __pyx_t_1;

      /* "pysam/libcbcf.pyx":359
 * 
 *     if bt_type == BCF_BT_CHAR:
 *         if not isinstance(values, (str, bytes)):             # <<<<<<<<<<<<<<
 *             values = b','.join(force_bytes(v) if v else bcf_str_missing for v in values)
 *             value_count = len(values)
*/
    }

    /* "pysam/libcbcf.pyx":362
 *             values = b','.join(force_bytes(v) if v else bcf_str_missing for v in values)
 *             value_count = len(values)
 *         assert value_count <= n             # <<<<<<<<<<<<<<
 *         datac = <char *>data
 *         memcpy(datac, <char *>values, value_count)
*/
    #ifndef CYTHON_WITHOUT_ASSERTIONS
    if (unlikely(__pyx_assertions_enabled())) {
      __pyx_t_3 = (__pyx_v_value_count <= __pyx_v_n);
      if (unlikely(!__pyx_t_3)) {
        __Pyx_Raise(__pyx_builtin_AssertionError, 0, 0, 0);
        __PYX_ERR(0, 362, __pyx_L1_error)
      }
    }
    #else
    if ((1)); else __PYX_ERR(0, 362, __pyx_L1_error)
    #endif

    /* "pysam/libcbcf.pyx":363
 *             value_count = len(values)
 *         assert value_count <= n
 *         datac = <char *>data             # <<<<<<<<<<<<<<
 *         memcpy(datac, <char *>values, value_count)
 *         for i in range(value_count, n):
*/
    __pyx_v_datac = ((char *)__pyx_v_data);

    /* "pysam/libcbcf.pyx":364
 *         assert value_count <= n
 *         datac = <char *>data
 *         memcpy(datac, <char *>values, value_count)             # <<<<<<<<<<<<<<
 *         for i in range(value_count, n):
 *             datac[i] = 0
*/
    __pyx_t_6 = __Pyx_PyObject_AsWritableString(__pyx_v_values); if (unlikely((!__pyx_t_6) && PyErr_Occurred())) __PYX_ERR(0, 364, __pyx_L1_error)
    (void)(memcpy(__pyx_v_datac, ((char *)__pyx_t_6), __pyx_v_value_count));

    /* "pysam/libcbcf.pyx":365
 *         datac = <char *>data
 *         memcpy(datac, <char *>values, value_count)
 *         for i in range(value_count, n):             # <<<<<<<<<<<<<<
 *             datac[i] = 0
 *     elif bt_type == BCF_BT_INT8:
*/
    __pyx_t_7 = __pyx_v_n;
    __pyx_t_8 = __pyx_t_7;
    for (__pyx_t_9 = __pyx_v_value_count; __pyx_t_9 < __pyx_t_8; __pyx_t_9+=1) {
      __pyx_v_i = __pyx_t_9;

      /* "pysam/libcbcf.pyx":366
 *         memcpy(datac, <char *>values, value_count)
 *         for i in range(value_count, n):
 *             datac[i] = 0             # <<<<<<<<<<<<<<
 *     elif bt_type == BCF_BT_INT8:
 *         datai8 = <int8_t *>data
*/
      (__pyx_v_datac[__pyx_v_i]) = 0;
    }

    /* "pysam/libcbcf.pyx":358
 *     assert value_count <= n
 * 
 *     if bt_type == BCF_BT_CHAR:             # <<<<<<<<<<<<<<
 *         if not isinstance(values, (str, bytes)):
 *             values = b','.join(force_bytes(v) if v else bcf_str_missing for v in values)
*/
    goto __pyx_L3;
  }

  /* "pysam/libcbcf.pyx":367
 *         for i in range(value_count, n):
 *             datac[i] = 0
 *     elif bt_type == BCF_BT_INT8:             # <<<<<<<<<<<<<<
 *         datai8 = <int8_t *>data
 *         for i in range(value_count):
*/
  __pyx_t_3 = (__pyx_v_bt_type == BCF_BT_INT8);
  if (__pyx_t_3) {

    /* "pysam/libcbcf.pyx":368
 *             datac[i] = 0
 *     elif bt_type == BCF_BT_INT8:
 *         datai8 = <int8_t *>data             # <<<<<<<<<<<<<<
 *         for i in range(value_count):
 *             val = values[i]
*/
    __pyx_v_datai8 = ((int8_t *)__pyx_v_data);

    /* "pysam/libcbcf.pyx":369
 *     elif bt_type == BCF_BT_INT8:
 *         datai8 = <int8_t *>data
 *         for i in range(value_count):             # <<<<<<<<<<<<<<
 *             val = values[i]
 *             datai8[i] = val if val is not None else bcf_int8_missing
*/
    __pyx_t_7 = __pyx_v_value_count;
    __pyx_t_8 = __pyx_t_7;
    for (__pyx_t_9 = 0; __pyx_t_9 < __pyx_t_8; __pyx_t_9+=1) {
      __pyx_v_i = __pyx_t_9;

      /* "pysam/libcbcf.pyx":370
 *         datai8 = <int8_t *>data
 *         for i in range(value_count):
 *             val = values[i]             # <<<<<<<<<<<<<<
 *             datai8[i] = val if val is not None else bcf_int8_missing
 *         for i in range(value_count, n):
*/
      __pyx_t_5 = __Pyx_GetItemInt(__pyx_v_values, __pyx_v_i, Py_ssize_t, 1, PyLong_FromSsize_t, 0, 1, 1, 1); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 370, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_5);
      __Pyx_XDECREF_SET(__pyx_v_val, __pyx_t_5);
      __pyx_t_5 = 0;

      /* "pysam/libcbcf.pyx":371
 *         for i in range(value_count):
 *             val = values[i]
 *             datai8[i] = val if val is not None else bcf_int8_missing             # <<<<<<<<<<<<<<
 *         for i in range(value_count, n):
 *             datai8[i] = bcf_int8_vector_end
*/
      __pyx_t_3 = (__pyx_v_val != Py_None);
      if (__pyx_t_3) {
        __pyx_t_11 = __Pyx_PyLong_As_int8_t(__pyx_v_val); if (unlikely((__pyx_t_11 == ((int8_t)-1)) && PyErr_Occurred())) __PYX_ERR(0, 371, __pyx_L1_error)
        __pyx_t_10 = __pyx_t_11;
      } else {
        __pyx_t_10 = bcf_int8_missing;
      }
      (__pyx_v_datai8[__pyx_v_i]) = __pyx_t_10;
    }

    /* "pysam/libcbcf.pyx":372
 *             val = values[i]
 *             datai8[i] = val if val is not None else bcf_int8_missing
 *         for i in range(value_count, n):             # <<<<<<<<<<<<<<
 *             datai8[i] = bcf_int8_vector_end
 *     elif bt_type == BCF_BT_INT16:
*/
    __pyx_t_7 = __pyx_v_n;
    __pyx_t_8 = __pyx_t_7;
    for (__pyx_t_9 = __pyx_v_value_count; __pyx_t_9 < __pyx_t_8; __pyx_t_9+=1) {
      __pyx_v_i = __pyx_t_9;

      /* "pysam/libcbcf.pyx":373
 *             datai8[i] = val if val is not None else bcf_int8_missing
 *         for i in range(value_count, n):
 *             datai8[i] = bcf_int8_vector_end             # <<<<<<<<<<<<<<
 *     elif bt_type == BCF_BT_INT16:
 *         datai16 = <int16_t *>data
*/
      (__pyx_v_datai8[__pyx_v_i]) = bcf_int8_vector_end;
    }

    /* "pysam/libcbcf.pyx":367
 *         for i in range(value_count, n):
 *             datac[i] = 0
 *     elif bt_type == BCF_BT_INT8:             # <<<<<<<<<<<<<<
 *         datai8 = <int8_t *>data
 *         for i in range(value_count):
*/
    goto __pyx_L3;
  }

  /* "pysam/libcbcf.pyx":374
 *         for i in range(value_count, n):
 *             datai8[i] = bcf_int8_vector_end
 *     elif bt_type == BCF_BT_INT16:             # <<<<<<<<<<<<<<
 *         datai16 = <int16_t *>data
 *         for i in range(value_count):
*/
  __pyx_t_3 = (__pyx_v_bt_type == BCF_BT_INT16);
  if (__pyx_t_3) {

    /* "pysam/libcbcf.pyx":375
 *             datai8[i] = bcf_int8_vector_end
 *     elif bt_type == BCF_BT_INT16:
 *         datai16 = <int16_t *>data             # <<<<<<<<<<<<<<
 *         for i in range(value_count):
 *             val = values[i]
*/
    __pyx_v_datai16 = ((int16_t *)__pyx_v_data);

    /* "pysam/libcbcf.pyx":376
 *     elif bt_type == BCF_BT_INT16:
 *         datai16 = <int16_t *>data
 *         for i in range(value_count):             # <<<<<<<<<<<<<<
 *             val = values[i]
 *             datai16[i] = val if val is not None else bcf_int16_missing
*/
    __pyx_t_7 = __pyx_v_value_count;
    __pyx_t_8 = __pyx_t_7;
    for (__pyx_t_9 = 0; __pyx_t_9 < __pyx_t_8; __pyx_t_9+=1) {
      __pyx_v_i = __pyx_t_9;

      /* "pysam/libcbcf.pyx":377
 *         datai16 = <int16_t *>data
 *         for i in range(value_count):
 *             val = values[i]             # <<<<<<<<<<<<<<
 *             datai16[i] = val if val is not None else bcf_int16_missing
 *         for i in range(value_count, n):
*/
      __pyx_t_5 = __Pyx_GetItemInt(__pyx_v_values, __pyx_v_i, Py_ssize_t, 1, PyLong_FromSsize_t, 0, 1, 1, 1); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 377, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_5);
      __Pyx_XDECREF_SET(__pyx_v_val, __pyx_t_5);
      __pyx_t_5 = 0;

      /* "pysam/libcbcf.pyx":378
 *         for i in range(value_count):
 *             val = values[i]
 *             datai16[i] = val if val is not None else bcf_int16_missing             # <<<<<<<<<<<<<<
 *         for i in range(value_count, n):
 *             datai16[i] = bcf_int16_vector_end
*/
      __pyx_t_3 = (__pyx_v_val != Py_None);
      if (__pyx_t_3) {
        __pyx_t_13 = __Pyx_PyLong_As_int16_t(__pyx_v_val); if (unlikely((__pyx_t_13 == ((int16_t)-1)) && PyErr_Occurred())) __PYX_ERR(0, 378, __pyx_L1_error)
        __pyx_t_12 = __pyx_t_13;
      } else {
        __pyx_t_12 = bcf_int16_missing;
      }
      (__pyx_v_datai16[__pyx_v_i]) = __pyx_t_12;
    }

    /* "pysam/libcbcf.pyx":379
 *             val = values[i]
 *             datai16[i] = val if val is not None else bcf_int16_missing
 *         for i in range(value_count, n):             # <<<<<<<<<<<<<<
 *             datai16[i] = bcf_int16_vector_end
 *     elif bt_type == BCF_BT_INT32:
*/
    __pyx_t_7 = __pyx_v_n;
    __pyx_t_8 = __pyx_t_7;
    for (__pyx_t_9 = __pyx_v_value_count; __pyx_t_9 < __pyx_t_8; __pyx_t_9+=1) {
      __pyx_v_i = __pyx_t_9;

      /* "pysam/libcbcf.pyx":380
 *             datai16[i] = val if val is not None else bcf_int16_missing
 *         for i in range(value_count, n):
 *             datai16[i] = bcf_int16_vector_end             # <<<<<<<<<<<<<<
 *     elif bt_type == BCF_BT_INT32:
 *         datai32 = <int32_t *>data
*/
      (__pyx_v_datai16[__pyx_v_i]) = bcf_int16_vector_end;
    }

    /* "pysam/libcbcf.pyx":374
 *         for i in range(value_count, n):
 *             datai8[i] = bcf_int8_vector_end
 *     elif bt_type == BCF_BT_INT16:             # <<<<<<<<<<<<<<
 *         datai16 = <int16_t *>data
 *         for i in range(value_count):
*/
    goto __pyx_L3;
  }

  /* "pysam/libcbcf.pyx":381
 *         for i in range(value_count, n):
 *             datai16[i] = bcf_int16_vector_end
 *     elif bt_type == BCF_BT_INT32:             # <<<<<<<<<<<<<<
 *         datai32 = <int32_t *>data
 *         for i in range(value_count):
*/
  __pyx_t_3 = (__pyx_v_bt_type == BCF_BT_INT32);
  if (__pyx_t_3) {

    /* "pysam/libcbcf.pyx":382
 *             datai16[i] = bcf_int16_vector_end
 *     elif bt_type == BCF_BT_INT32:
 *         datai32 = <int32_t *>data             # <<<<<<<<<<<<<<
 *         for i in range(value_count):
 *             val = values[i]
*/
    __pyx_v_datai32 = ((int32_t *)__pyx_v_data);

    /* "pysam/libcbcf.pyx":383
 *     elif bt_type == BCF_BT_INT32:
 *         datai32 = <int32_t *>data
 *         for i in range(value_count):             # <<<<<<<<<<<<<<
 *             val = values[i]
 *             datai32[i] = val if val is not None else bcf_int32_missing
*/
    __pyx_t_7 = __pyx_v_value_count;
    __pyx_t_8 = __pyx_t_7;
    for (__pyx_t_9 = 0; __pyx_t_9 < __pyx_t_8; __pyx_t_9+=1) {
      __pyx_v_i = __pyx_t_9;

      /* "pysam/libcbcf.pyx":384
 *         datai32 = <int32_t *>data
 *         for i in range(value_count):
 *             val = values[i]             # <<<<<<<<<<<<<<
 *             datai32[i] = val if val is not None else bcf_int32_missing
 *         for i in range(value_count, n):
*/
      __pyx_t_5 = __Pyx_GetItemInt(__pyx_v_values, __pyx_v_i, Py_ssize_t, 1, PyLong_FromSsize_t, 0, 1, 1, 1); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 384, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_5);
      __Pyx_XDECREF_SET(__pyx_v_val, __pyx_t_5);
      __pyx_t_5 = 0;

      /* "pysam/libcbcf.pyx":385
 *         for i in range(value_count):
 *             val = values[i]
 *             datai32[i] = val if val is not None else bcf_int32_missing             # <<<<<<<<<<<<<<
 *         for i in range(value_count, n):
 *             datai32[i] = bcf_int32_vector_end
*/
      __pyx_t_3 = (__pyx_v_val != Py_None);
      if (__pyx_t_3) {
        __pyx_t_15 = __Pyx_PyLong_As_int32_t(__pyx_v_val); if (unlikely((__pyx_t_15 == ((int32_t)-1)) && PyErr_Occurred())) __PYX_ERR(0, 385, __pyx_L1_error)
        __pyx_t_14 = __pyx_t_15;
      } else {
        __pyx_t_14 = bcf_int32_missing;
      }
      (__pyx_v_datai32[__pyx_v_i]) = __pyx_t_14;
    }

    /* "pysam/libcbcf.pyx":386
 *             val = values[i]
 *             datai32[i] = val if val is not None else bcf_int32_missing
 *         for i in range(value_count, n):             # <<<<<<<<<<<<<<
 *             datai32[i] = bcf_int32_vector_end
 *     elif bt_type == BCF_BT_FLOAT:
*/
    __pyx_t_7 = __pyx_v_n;
    __pyx_t_8 = __pyx_t_7;
    for (__pyx_t_9 = __pyx_v_value_count; __pyx_t_9 < __pyx_t_8; __pyx_t_9+=1) {
      __pyx_v_i = __pyx_t_9;

      /* "pysam/libcbcf.pyx":387
 *             datai32[i] = val if val is not None else bcf_int32_missing
 *         for i in range(value_count, n):
 *             datai32[i] = bcf_int32_vector_end             # <<<<<<<<<<<<<<
 *     elif bt_type == BCF_BT_FLOAT:
 *         dataf = <float *>data
*/
      (__pyx_v_datai32[__pyx_v_i]) = bcf_int32_vector_end;
    }

    /* "pysam/libcbcf.pyx":381
 *         for i in range(value_count, n):
 *             datai16[i] = bcf_int16_vector_end
 *     elif bt_type == BCF_BT_INT32:             # <<<<<<<<<<<<<<
 *         datai32 = <int32_t *>data
 *         for i in range(value_count):
*/
    goto __pyx_L3;
  }

  /* "pysam/libcbcf.pyx":388
 *         for i in range(value_count, n):
 *             datai32[i] = bcf_int32_vector_end
 *     elif bt_type == BCF_BT_FLOAT:             # <<<<<<<<<<<<<<
 *         dataf = <float *>data
 *         for i in range(value_count):
*/
  __pyx_t_3 = (__pyx_v_bt_type == BCF_BT_FLOAT);
  if (likely(__pyx_t_3)) {

    /* "pysam/libcbcf.pyx":389
 *             datai32[i] = bcf_int32_vector_end
 *     elif bt_type == BCF_BT_FLOAT:
 *         dataf = <float *>data             # <<<<<<<<<<<<<<
 *         for i in range(value_count):
 *             val = values[i]
*/
    __pyx_v_dataf = ((float *)__pyx_v_data);

    /* "pysam/libcbcf.pyx":390
 *     elif bt_type == BCF_BT_FLOAT:
 *         dataf = <float *>data
 *         for i in range(value_count):             # <<<<<<<<<<<<<<
 *             val = values[i]
 *             if val is None:
*/
    __pyx_t_7 = __pyx_v_value_count;
    __pyx_t_8 = __pyx_t_7;
    for (__pyx_t_9 = 0; __pyx_t_9 < __pyx_t_8; __pyx_t_9+=1) {
      __pyx_v_i = __pyx_t_9;

      /* "pysam/libcbcf.pyx":391
 *         dataf = <float *>data
 *         for i in range(value_count):
 *             val = values[i]             # <<<<<<<<<<<<<<
 *             if val is None:
 *                 bcf_float_set(dataf + i, bcf_float_missing)
*/
      __pyx_t_5 = __Pyx_GetItemInt(__pyx_v_values, __pyx_v_i, Py_ssize_t, 1, PyLong_FromSsize_t, 0, 1, 1, 1); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 391, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_5);
      __Pyx_XDECREF_SET(__pyx_v_val, __pyx_t_5);
      __pyx_t_5 = 0;

      /* "pysam/libcbcf.pyx":392
 *         for i in range(value_count):
 *             val = values[i]
 *             if val is None:             # <<<<<<<<<<<<<<
 *                 bcf_float_set(dataf + i, bcf_float_missing)
 *             else:
*/
      __pyx_t_3 = (__pyx_v_val == Py_None);
      if (__pyx_t_3) {

        /* "pysam/libcbcf.pyx":393
 *             val = values[i]
 *             if val is None:
 *                 bcf_float_set(dataf + i, bcf_float_missing)             # <<<<<<<<<<<<<<
 *             else:
 *                 dataf[i] = val
*/
        bcf_float_set((__pyx_v_dataf + __pyx_v_i), bcf_float_missing);

        /* "pysam/libcbcf.pyx":392
 *         for i in range(value_count):
 *             val = values[i]
 *             if val is None:             # <<<<<<<<<<<<<<
 *                 bcf_float_set(dataf + i, bcf_float_missing)
 *             else:
*/
        goto __pyx_L23;
      }

      /* "pysam/libcbcf.pyx":395
 *                 bcf_float_set(dataf + i, bcf_float_missing)
 *             else:
 *                 dataf[i] = val             # <<<<<<<<<<<<<<
 *         for i in range(value_count, n):
 *             bcf_float_set(dataf + i, bcf_float_vector_end)
*/
      /*else*/ {
        __pyx_t_16 = __Pyx_PyFloat_AsFloat(__pyx_v_val); if (unlikely((__pyx_t_16 == (float)-1) && PyErr_Occurred())) __PYX_ERR(0, 395, __pyx_L1_error)
        (__pyx_v_dataf[__pyx_v_i]) = __pyx_t_16;
      }
      __pyx_L23:;
    }

    /* "pysam/libcbcf.pyx":396
 *             else:
 *                 dataf[i] = val
 *         for i in range(value_count, n):             # <<<<<<<<<<<<<<
 *             bcf_float_set(dataf + i, bcf_float_vector_end)
 *     else:
*/
    __pyx_t_7 = __pyx_v_n;
    __pyx_t_8 = __pyx_t_7;
    for (__pyx_t_9 = __pyx_v_value_count; __pyx_t_9 < __pyx_t_8; __pyx_t_9+=1) {
      __pyx_v_i = __pyx_t_9;

      /* "pysam/libcbcf.pyx":397
 *                 dataf[i] = val
 *         for i in range(value_count, n):
 *             bcf_float_set(dataf + i, bcf_float_vector_end)             # <<<<<<<<<<<<<<
 *     else:
 *         raise TypeError('unsupported type')
*/
      bcf_float_set((__pyx_v_dataf + __pyx_v_i), bcf_float_vector_end);
    }

    /* "pysam/libcbcf.pyx":388
 *         for i in range(value_count, n):
 *             datai32[i] = bcf_int32_vector_end
 *     elif bt_type == BCF_BT_FLOAT:             # <<<<<<<<<<<<<<
 *         dataf = <float *>data
 *         for i in range(value_count):
*/
    goto __pyx_L3;
  }

  /* "pysam/libcbcf.pyx":399
 *             bcf_float_set(dataf + i, bcf_float_vector_end)
 *     else:
 *         raise TypeError('unsupported type')             # <<<<<<<<<<<<<<
 * 
 * 
*/
  /*else*/ {
    __pyx_t_4 = NULL;
    __Pyx_INCREF(__pyx_builtin_TypeError);
    __pyx_t_17 = __pyx_builtin_TypeError; 
    __pyx_t_18 = 1;
    {
      PyObject *__pyx_callargs[2] = {__pyx_t_4, __pyx_mstate_global->__pyx_kp_u_unsupported_type};
      __pyx_t_5 = __Pyx_PyObject_FastCall(__pyx_t_17, __pyx_callargs+__pyx_t_18, (2-__pyx_t_18) | (__pyx_t_18*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
      __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
      __Pyx_DECREF(__pyx_t_17); __pyx_t_17 = 0;
      if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 399, __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, 399, __pyx_L1_error)
  }
  __pyx_L3:;

  /* "pysam/libcbcf.pyx":348
 * 
 * 
 * cdef bcf_object_to_array(values, void *data, int bt_type, ssize_t n, int vlen):             # <<<<<<<<<<<<<<
 *     cdef char    *datac
 *     cdef int8_t  *data8
*/

  /* function exit code */
  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  __Pyx_TraceReturnValue(__pyx_r, 0, 0, __PYX_ERR(0, 348, __pyx_L1_error));
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_XDECREF(__pyx_t_5);
  __Pyx_XDECREF(__pyx_t_17);
  __Pyx_TraceException(__pyx_lineno, 0, 0);
  #if CYTHON_USE_SYS_MONITORING
  __Pyx_TraceExceptionUnwind(0, 0);
  #else
  __Pyx_TraceReturnValue(NULL, 0, 0, __PYX_ERR(0, 348, __pyx_L1_error));
  #endif
  __Pyx_AddTraceback("pysam.libcbcf.bcf_object_to_array", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_val);
  __Pyx_XDECREF(__pyx_gb_5pysam_7libcbcf_19bcf_object_to_array_2generator30);
  __Pyx_XDECREF(__pyx_v_values);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_PyMonitoring_ExitScope(0);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "pysam/libcbcf.pyx":402
 * 
 * 
 * cdef bcf_empty_array(int type, ssize_t n, int vlen):             # <<<<<<<<<<<<<<
 *     cdef char    *datac
 *     cdef int32_t *data32
*/

static PyObject *__pyx_f_5pysam_7libcbcf_bcf_empty_array(int __pyx_v_type, Py_ssize_t __pyx_v_n, int __pyx_v_vlen) {
  char *__pyx_v_datac;
  int32_t *__pyx_v_data32;
  float *__pyx_v_dataf;
  int __pyx_v_i;
  PyObject *__pyx_v_value = NULL;
  PyObject *__pyx_r = NULL;
  __Pyx_TraceDeclarationsFunc
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  PyObject *__pyx_t_4 = NULL;
  size_t __pyx_t_5;
  char *__pyx_t_6;
  Py_ssize_t __pyx_t_7;
  Py_ssize_t __pyx_t_8;
  int __pyx_t_9;
  int32_t __pyx_t_10;
  uint32_t __pyx_t_11;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_TraceFrameInit(((PyObject *)__pyx_mstate_global->__pyx_codeobj_tab[12]))
  __Pyx_RefNannySetupContext("bcf_empty_array", 0);
  __Pyx_TraceStartFunc("bcf_empty_array", __pyx_f[0], 402, 0, 0, 0, __PYX_ERR(0, 402, __pyx_L1_error));

  /* "pysam/libcbcf.pyx":408
 *     cdef int      i
 * 
 *     if n <= 0:             # <<<<<<<<<<<<<<
 *         raise ValueError('Cannot create empty array')
 * 
*/
  __pyx_t_1 = (__pyx_v_n <= 0);
  if (unlikely(__pyx_t_1)) {

    /* "pysam/libcbcf.pyx":409
 * 
 *     if n <= 0:
 *         raise ValueError('Cannot create empty array')             # <<<<<<<<<<<<<<
 * 
 *     if type == BCF_HT_STR:
*/
    __pyx_t_3 = NULL;
    __Pyx_INCREF(__pyx_builtin_ValueError);
    __pyx_t_4 = __pyx_builtin_ValueError; 
    __pyx_t_5 = 1;
    {
      PyObject *__pyx_callargs[2] = {__pyx_t_3, __pyx_mstate_global->__pyx_kp_u_Cannot_create_empty_array};
      __pyx_t_2 = __Pyx_PyObject_FastCall(__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_2)) __PYX_ERR(0, 409, __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, 409, __pyx_L1_error)

    /* "pysam/libcbcf.pyx":408
 *     cdef int      i
 * 
 *     if n <= 0:             # <<<<<<<<<<<<<<
 *         raise ValueError('Cannot create empty array')
 * 
*/
  }

  /* "pysam/libcbcf.pyx":411
 *         raise ValueError('Cannot create empty array')
 * 
 *     if type == BCF_HT_STR:             # <<<<<<<<<<<<<<
 *         value = PyBytes_FromStringAndSize(NULL, sizeof(char)*n)
 *         datac = <char *>value
*/
  __pyx_t_1 = (__pyx_v_type == BCF_HT_STR);
  if (__pyx_t_1) {

    /* "pysam/libcbcf.pyx":412
 * 
 *     if type == BCF_HT_STR:
 *         value = PyBytes_FromStringAndSize(NULL, sizeof(char)*n)             # <<<<<<<<<<<<<<
 *         datac = <char *>value
 *         for i in range(n):
*/
    __pyx_t_2 = PyBytes_FromStringAndSize(NULL, ((sizeof(char)) * __pyx_v_n)); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 412, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __pyx_v_value = ((PyObject*)__pyx_t_2);
    __pyx_t_2 = 0;

    /* "pysam/libcbcf.pyx":413
 *     if type == BCF_HT_STR:
 *         value = PyBytes_FromStringAndSize(NULL, sizeof(char)*n)
 *         datac = <char *>value             # <<<<<<<<<<<<<<
 *         for i in range(n):
 *             datac[i] = bcf_str_missing if not vlen else bcf_str_vector_end
*/
    if (unlikely(__pyx_v_value == Py_None)) {
      PyErr_SetString(PyExc_TypeError, "expected bytes, NoneType found");
      __PYX_ERR(0, 413, __pyx_L1_error)
    }
    __pyx_t_6 = __Pyx_PyBytes_AsWritableString(__pyx_v_value); if (unlikely((!__pyx_t_6) && PyErr_Occurred())) __PYX_ERR(0, 413, __pyx_L1_error)
    __pyx_v_datac = ((char *)__pyx_t_6);

    /* "pysam/libcbcf.pyx":414
 *         value = PyBytes_FromStringAndSize(NULL, sizeof(char)*n)
 *         datac = <char *>value
 *         for i in range(n):             # <<<<<<<<<<<<<<
 *             datac[i] = bcf_str_missing if not vlen else bcf_str_vector_end
 *     elif type == BCF_HT_INT:
*/
    __pyx_t_7 = __pyx_v_n;
    __pyx_t_8 = __pyx_t_7;
    for (__pyx_t_9 = 0; __pyx_t_9 < __pyx_t_8; __pyx_t_9+=1) {
      __pyx_v_i = __pyx_t_9;

      /* "pysam/libcbcf.pyx":415
 *         datac = <char *>value
 *         for i in range(n):
 *             datac[i] = bcf_str_missing if not vlen else bcf_str_vector_end             # <<<<<<<<<<<<<<
 *     elif type == BCF_HT_INT:
 *         value = PyBytes_FromStringAndSize(NULL, sizeof(int32_t)*n)
*/
      __pyx_t_1 = (!(__pyx_v_vlen != 0));
      if (__pyx_t_1) {
        __pyx_t_10 = bcf_str_missing;
      } else {
        __pyx_t_10 = bcf_str_vector_end;
      }
      (__pyx_v_datac[__pyx_v_i]) = __pyx_t_10;
    }

    /* "pysam/libcbcf.pyx":411
 *         raise ValueError('Cannot create empty array')
 * 
 *     if type == BCF_HT_STR:             # <<<<<<<<<<<<<<
 *         value = PyBytes_FromStringAndSize(NULL, sizeof(char)*n)
 *         datac = <char *>value
*/
    goto __pyx_L4;
  }

  /* "pysam/libcbcf.pyx":416
 *         for i in range(n):
 *             datac[i] = bcf_str_missing if not vlen else bcf_str_vector_end
 *     elif type == BCF_HT_INT:             # <<<<<<<<<<<<<<
 *         value = PyBytes_FromStringAndSize(NULL, sizeof(int32_t)*n)
 *         data32 = <int32_t *><char *>value
*/
  __pyx_t_1 = (__pyx_v_type == BCF_HT_INT);
  if (__pyx_t_1) {

    /* "pysam/libcbcf.pyx":417
 *             datac[i] = bcf_str_missing if not vlen else bcf_str_vector_end
 *     elif type == BCF_HT_INT:
 *         value = PyBytes_FromStringAndSize(NULL, sizeof(int32_t)*n)             # <<<<<<<<<<<<<<
 *         data32 = <int32_t *><char *>value
 *         for i in range(n):
*/
    __pyx_t_2 = PyBytes_FromStringAndSize(NULL, ((sizeof(int32_t)) * __pyx_v_n)); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 417, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __pyx_v_value = ((PyObject*)__pyx_t_2);
    __pyx_t_2 = 0;

    /* "pysam/libcbcf.pyx":418
 *     elif type == BCF_HT_INT:
 *         value = PyBytes_FromStringAndSize(NULL, sizeof(int32_t)*n)
 *         data32 = <int32_t *><char *>value             # <<<<<<<<<<<<<<
 *         for i in range(n):
 *             data32[i] = bcf_int32_missing if not vlen else bcf_int32_vector_end
*/
    if (unlikely(__pyx_v_value == Py_None)) {
      PyErr_SetString(PyExc_TypeError, "expected bytes, NoneType found");
      __PYX_ERR(0, 418, __pyx_L1_error)
    }
    __pyx_t_6 = __Pyx_PyBytes_AsWritableString(__pyx_v_value); if (unlikely((!__pyx_t_6) && PyErr_Occurred())) __PYX_ERR(0, 418, __pyx_L1_error)
    __pyx_v_data32 = ((int32_t *)((char *)__pyx_t_6));

    /* "pysam/libcbcf.pyx":419
 *         value = PyBytes_FromStringAndSize(NULL, sizeof(int32_t)*n)
 *         data32 = <int32_t *><char *>value
 *         for i in range(n):             # <<<<<<<<<<<<<<
 *             data32[i] = bcf_int32_missing if not vlen else bcf_int32_vector_end
 *     elif type == BCF_HT_REAL:
*/
    __pyx_t_7 = __pyx_v_n;
    __pyx_t_8 = __pyx_t_7;
    for (__pyx_t_9 = 0; __pyx_t_9 < __pyx_t_8; __pyx_t_9+=1) {
      __pyx_v_i = __pyx_t_9;

      /* "pysam/libcbcf.pyx":420
 *         data32 = <int32_t *><char *>value
 *         for i in range(n):
 *             data32[i] = bcf_int32_missing if not vlen else bcf_int32_vector_end             # <<<<<<<<<<<<<<
 *     elif type == BCF_HT_REAL:
 *         value = PyBytes_FromStringAndSize(NULL, sizeof(float)*n)
*/
      __pyx_t_1 = (!(__pyx_v_vlen != 0));
      if (__pyx_t_1) {
        __pyx_t_10 = bcf_int32_missing;
      } else {
        __pyx_t_10 = bcf_int32_vector_end;
      }
      (__pyx_v_data32[__pyx_v_i]) = __pyx_t_10;
    }

    /* "pysam/libcbcf.pyx":416
 *         for i in range(n):
 *             datac[i] = bcf_str_missing if not vlen else bcf_str_vector_end
 *     elif type == BCF_HT_INT:             # <<<<<<<<<<<<<<
 *         value = PyBytes_FromStringAndSize(NULL, sizeof(int32_t)*n)
 *         data32 = <int32_t *><char *>value
*/
    goto __pyx_L4;
  }

  /* "pysam/libcbcf.pyx":421
 *         for i in range(n):
 *             data32[i] = bcf_int32_missing if not vlen else bcf_int32_vector_end
 *     elif type == BCF_HT_REAL:             # <<<<<<<<<<<<<<
 *         value = PyBytes_FromStringAndSize(NULL, sizeof(float)*n)
 *         dataf = <float *><char *>value
*/
  __pyx_t_1 = (__pyx_v_type == BCF_HT_REAL);
  if (likely(__pyx_t_1)) {

    /* "pysam/libcbcf.pyx":422
 *             data32[i] = bcf_int32_missing if not vlen else bcf_int32_vector_end
 *     elif type == BCF_HT_REAL:
 *         value = PyBytes_FromStringAndSize(NULL, sizeof(float)*n)             # <<<<<<<<<<<<<<
 *         dataf = <float *><char *>value
 *         for i in range(n):
*/
    __pyx_t_2 = PyBytes_FromStringAndSize(NULL, ((sizeof(float)) * __pyx_v_n)); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 422, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __pyx_v_value = ((PyObject*)__pyx_t_2);
    __pyx_t_2 = 0;

    /* "pysam/libcbcf.pyx":423
 *     elif type == BCF_HT_REAL:
 *         value = PyBytes_FromStringAndSize(NULL, sizeof(float)*n)
 *         dataf = <float *><char *>value             # <<<<<<<<<<<<<<
 *         for i in range(n):
 *             bcf_float_set(dataf + i, bcf_float_missing if not vlen else bcf_float_vector_end)
*/
    if (unlikely(__pyx_v_value == Py_None)) {
      PyErr_SetString(PyExc_TypeError, "expected bytes, NoneType found");
      __PYX_ERR(0, 423, __pyx_L1_error)
    }
    __pyx_t_6 = __Pyx_PyBytes_AsWritableString(__pyx_v_value); if (unlikely((!__pyx_t_6) && PyErr_Occurred())) __PYX_ERR(0, 423, __pyx_L1_error)
    __pyx_v_dataf = ((float *)((char *)__pyx_t_6));

    /* "pysam/libcbcf.pyx":424
 *         value = PyBytes_FromStringAndSize(NULL, sizeof(float)*n)
 *         dataf = <float *><char *>value
 *         for i in range(n):             # <<<<<<<<<<<<<<
 *             bcf_float_set(dataf + i, bcf_float_missing if not vlen else bcf_float_vector_end)
 *     else:
*/
    __pyx_t_7 = __pyx_v_n;
    __pyx_t_8 = __pyx_t_7;
    for (__pyx_t_9 = 0; __pyx_t_9 < __pyx_t_8; __pyx_t_9+=1) {
      __pyx_v_i = __pyx_t_9;

      /* "pysam/libcbcf.pyx":425
 *         dataf = <float *><char *>value
 *         for i in range(n):
 *             bcf_float_set(dataf + i, bcf_float_missing if not vlen else bcf_float_vector_end)             # <<<<<<<<<<<<<<
 *     else:
 *         raise TypeError('unsupported header type code')
*/
      __pyx_t_1 = (!(__pyx_v_vlen != 0));
      if (__pyx_t_1) {
        __pyx_t_11 = bcf_float_missing;
      } else {
        __pyx_t_11 = bcf_float_vector_end;
      }
      bcf_float_set((__pyx_v_dataf + __pyx_v_i), __pyx_t_11);
    }

    /* "pysam/libcbcf.pyx":421
 *         for i in range(n):
 *             data32[i] = bcf_int32_missing if not vlen else bcf_int32_vector_end
 *     elif type == BCF_HT_REAL:             # <<<<<<<<<<<<<<
 *         value = PyBytes_FromStringAndSize(NULL, sizeof(float)*n)
 *         dataf = <float *><char *>value
*/
    goto __pyx_L4;
  }

  /* "pysam/libcbcf.pyx":427
 *             bcf_float_set(dataf + i, bcf_float_missing if not vlen else bcf_float_vector_end)
 *     else:
 *         raise TypeError('unsupported header type code')             # <<<<<<<<<<<<<<
 * 
 *     return value
*/
  /*else*/ {
    __pyx_t_4 = NULL;
    __Pyx_INCREF(__pyx_builtin_TypeError);
    __pyx_t_3 = __pyx_builtin_TypeError; 
    __pyx_t_5 = 1;
    {
      PyObject *__pyx_callargs[2] = {__pyx_t_4, __pyx_mstate_global->__pyx_kp_u_unsupported_header_type_code};
      __pyx_t_2 = __Pyx_PyObject_FastCall(__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_2)) __PYX_ERR(0, 427, __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, 427, __pyx_L1_error)
  }
  __pyx_L4:;

  /* "pysam/libcbcf.pyx":429
 *         raise TypeError('unsupported header type code')
 * 
 *     return value             # <<<<<<<<<<<<<<
 * 
 * 
*/
  __Pyx_XDECREF(__pyx_r);
  __Pyx_INCREF(__pyx_v_value);
  __pyx_r = __pyx_v_value;
  __Pyx_TraceReturnValue(__pyx_r, 93, 0, __PYX_ERR(0, 429, __pyx_L1_error));
  goto __pyx_L0;

  /* "pysam/libcbcf.pyx":402
 * 
 * 
 * cdef bcf_empty_array(int type, ssize_t n, int vlen):             # <<<<<<<<<<<<<<
 *     cdef char    *datac
 *     cdef int32_t *data32
*/

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_TraceException(__pyx_lineno, 0, 0);
  #if CYTHON_USE_SYS_MONITORING
  __Pyx_TraceExceptionUnwind(0, 0);
  #else
  __Pyx_TraceReturnValue(NULL, 0, 0, __PYX_ERR(0, 402, __pyx_L1_error));
  #endif
  __Pyx_AddTraceback("pysam.libcbcf.bcf_empty_array", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_value);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_PyMonitoring_ExitScope(0);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "pysam/libcbcf.pyx":432
 * 
 * 
 * cdef bcf_copy_expand_array(void *src_data, int src_type, size_t src_values,             # <<<<<<<<<<<<<<
 *                            void *dst_data, int dst_type, size_t dst_values,
 *                            int vlen):
*/

static PyObject *__pyx_f_5pysam_7libcbcf_bcf_copy_expand_array(void *__pyx_v_src_data, int __pyx_v_src_type, size_t __pyx_v_src_values, void *__pyx_v_dst_data, int __pyx_v_dst_type, size_t __pyx_v_dst_values, int __pyx_v_vlen) {
  char *__pyx_v_src_datac;
  char *__pyx_v_dst_datac;
  int8_t *__pyx_v_src_datai8;
  int16_t *__pyx_v_src_datai16;
  int32_t *__pyx_v_src_datai32;
  int32_t *__pyx_v_dst_datai;
  float *__pyx_v_src_dataf;
  float *__pyx_v_dst_dataf;
  Py_ssize_t __pyx_v_i;
  int __pyx_v_val;
  PyObject *__pyx_r = NULL;
  __Pyx_TraceDeclarationsFunc
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  PyObject *__pyx_t_4 = NULL;
  PyObject *__pyx_t_5 = NULL;
  PyObject *__pyx_t_6 = NULL;
  PyObject *__pyx_t_7 = NULL;
  PyObject *__pyx_t_8 = NULL;
  size_t __pyx_t_9;
  size_t __pyx_t_10;
  Py_ssize_t __pyx_t_11;
  int __pyx_t_12;
  int32_t __pyx_t_13;
  uint32_t __pyx_t_14;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_TraceFrameInit(((PyObject *)__pyx_mstate_global->__pyx_codeobj_tab[13]))
  __Pyx_RefNannySetupContext("bcf_copy_expand_array", 0);
  __Pyx_TraceStartFunc("bcf_copy_expand_array", __pyx_f[0], 432, 0, 0, 0, __PYX_ERR(0, 432, __pyx_L1_error));

  /* "pysam/libcbcf.pyx":450
 *     cdef int val
 * 
 *     if src_values > dst_values:             # <<<<<<<<<<<<<<
 *         raise ValueError('Cannot copy arrays with src_values={} > dst_values={}'.format(src_values, dst_values))
 * 
*/
  __pyx_t_1 = (__pyx_v_src_values > __pyx_v_dst_values);
  if (unlikely(__pyx_t_1)) {

    /* "pysam/libcbcf.pyx":451
 * 
 *     if src_values > dst_values:
 *         raise ValueError('Cannot copy arrays with src_values={} > dst_values={}'.format(src_values, dst_values))             # <<<<<<<<<<<<<<
 * 
 *     if src_type == dst_type == BCF_BT_CHAR:
*/
    __pyx_t_3 = NULL;
    __Pyx_INCREF(__pyx_builtin_ValueError);
    __pyx_t_4 = __pyx_builtin_ValueError; 
    __pyx_t_6 = __pyx_mstate_global->__pyx_kp_u_Cannot_copy_arrays_with_src_valu;
    __Pyx_INCREF(__pyx_t_6);
    __pyx_t_7 = __Pyx_PyLong_FromSize_t(__pyx_v_src_values); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 451, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_7);
    __pyx_t_8 = __Pyx_PyLong_FromSize_t(__pyx_v_dst_values); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 451, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_8);
    __pyx_t_9 = 0;
    {
      PyObject *__pyx_callargs[3] = {__pyx_t_6, __pyx_t_7, __pyx_t_8};
      __pyx_t_5 = __Pyx_PyObject_FastCallMethod(__pyx_mstate_global->__pyx_n_u_format, __pyx_callargs+__pyx_t_9, (3-__pyx_t_9) | (1*__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_8); __pyx_t_8 = 0;
      if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 451, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_5);
    }
    __pyx_t_9 = 1;
    {
      PyObject *__pyx_callargs[2] = {__pyx_t_3, __pyx_t_5};
      __pyx_t_2 = __Pyx_PyObject_FastCall(__pyx_t_4, __pyx_callargs+__pyx_t_9, (2-__pyx_t_9) | (__pyx_t_9*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
      __Pyx_XDECREF(__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_2)) __PYX_ERR(0, 451, __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, 451, __pyx_L1_error)

    /* "pysam/libcbcf.pyx":450
 *     cdef int val
 * 
 *     if src_values > dst_values:             # <<<<<<<<<<<<<<
 *         raise ValueError('Cannot copy arrays with src_values={} > dst_values={}'.format(src_values, dst_values))
 * 
*/
  }

  /* "pysam/libcbcf.pyx":453
 *         raise ValueError('Cannot copy arrays with src_values={} > dst_values={}'.format(src_values, dst_values))
 * 
 *     if src_type == dst_type == BCF_BT_CHAR:             # <<<<<<<<<<<<<<
 *         src_datac = <char *>src_data
 *         dst_datac = <char *>dst_data
*/
  __pyx_t_1 = (__pyx_v_src_type == __pyx_v_dst_type);
  if (__pyx_t_1) {
    __pyx_t_1 = (__pyx_v_dst_type == BCF_BT_CHAR);
  }
  if (__pyx_t_1) {

    /* "pysam/libcbcf.pyx":454
 * 
 *     if src_type == dst_type == BCF_BT_CHAR:
 *         src_datac = <char *>src_data             # <<<<<<<<<<<<<<
 *         dst_datac = <char *>dst_data
 *         memcpy(dst_datac, src_datac, src_values)
*/
    __pyx_v_src_datac = ((char *)__pyx_v_src_data);

    /* "pysam/libcbcf.pyx":455
 *     if src_type == dst_type == BCF_BT_CHAR:
 *         src_datac = <char *>src_data
 *         dst_datac = <char *>dst_data             # <<<<<<<<<<<<<<
 *         memcpy(dst_datac, src_datac, src_values)
 *         for i in range(src_values, dst_values):
*/
    __pyx_v_dst_datac = ((char *)__pyx_v_dst_data);

    /* "pysam/libcbcf.pyx":456
 *         src_datac = <char *>src_data
 *         dst_datac = <char *>dst_data
 *         memcpy(dst_datac, src_datac, src_values)             # <<<<<<<<<<<<<<
 *         for i in range(src_values, dst_values):
 *             dst_datac[i] = 0
*/
    (void)(memcpy(__pyx_v_dst_datac, __pyx_v_src_datac, __pyx_v_src_values));

    /* "pysam/libcbcf.pyx":457
 *         dst_datac = <char *>dst_data
 *         memcpy(dst_datac, src_datac, src_values)
 *         for i in range(src_values, dst_values):             # <<<<<<<<<<<<<<
 *             dst_datac[i] = 0
 *     elif src_type == BCF_BT_INT8 and dst_type == BCF_BT_INT32:
*/
    __pyx_t_9 = __pyx_v_dst_values;
    __pyx_t_10 = __pyx_t_9;
    for (__pyx_t_11 = __pyx_v_src_values; __pyx_t_11 < __pyx_t_10; __pyx_t_11+=1) {
      __pyx_v_i = __pyx_t_11;

      /* "pysam/libcbcf.pyx":458
 *         memcpy(dst_datac, src_datac, src_values)
 *         for i in range(src_values, dst_values):
 *             dst_datac[i] = 0             # <<<<<<<<<<<<<<
 *     elif src_type == BCF_BT_INT8 and dst_type == BCF_BT_INT32:
 *         src_datai8 = <int8_t *>src_data
*/
      (__pyx_v_dst_datac[__pyx_v_i]) = 0;
    }

    /* "pysam/libcbcf.pyx":453
 *         raise ValueError('Cannot copy arrays with src_values={} > dst_values={}'.format(src_values, dst_values))
 * 
 *     if src_type == dst_type == BCF_BT_CHAR:             # <<<<<<<<<<<<<<
 *         src_datac = <char *>src_data
 *         dst_datac = <char *>dst_data
*/
    goto __pyx_L4;
  }

  /* "pysam/libcbcf.pyx":459
 *         for i in range(src_values, dst_values):
 *             dst_datac[i] = 0
 *     elif src_type == BCF_BT_INT8 and dst_type == BCF_BT_INT32:             # <<<<<<<<<<<<<<
 *         src_datai8 = <int8_t *>src_data
 *         dst_datai  = <int32_t *>dst_data
*/
  __pyx_t_12 = (__pyx_v_src_type == BCF_BT_INT8);
  if (__pyx_t_12) {
  } else {
    __pyx_t_1 = __pyx_t_12;
    goto __pyx_L7_bool_binop_done;
  }
  __pyx_t_12 = (__pyx_v_dst_type == BCF_BT_INT32);
  __pyx_t_1 = __pyx_t_12;
  __pyx_L7_bool_binop_done:;
  if (__pyx_t_1) {

    /* "pysam/libcbcf.pyx":460
 *             dst_datac[i] = 0
 *     elif src_type == BCF_BT_INT8 and dst_type == BCF_BT_INT32:
 *         src_datai8 = <int8_t *>src_data             # <<<<<<<<<<<<<<
 *         dst_datai  = <int32_t *>dst_data
 *         for i in range(src_values):
*/
    __pyx_v_src_datai8 = ((int8_t *)__pyx_v_src_data);

    /* "pysam/libcbcf.pyx":461
 *     elif src_type == BCF_BT_INT8 and dst_type == BCF_BT_INT32:
 *         src_datai8 = <int8_t *>src_data
 *         dst_datai  = <int32_t *>dst_data             # <<<<<<<<<<<<<<
 *         for i in range(src_values):
 *             val = src_datai8[i]
*/
    __pyx_v_dst_datai = ((int32_t *)__pyx_v_dst_data);

    /* "pysam/libcbcf.pyx":462
 *         src_datai8 = <int8_t *>src_data
 *         dst_datai  = <int32_t *>dst_data
 *         for i in range(src_values):             # <<<<<<<<<<<<<<
 *             val = src_datai8[i]
 *             if val == bcf_int8_missing:
*/
    __pyx_t_9 = __pyx_v_src_values;
    __pyx_t_10 = __pyx_t_9;
    for (__pyx_t_11 = 0; __pyx_t_11 < __pyx_t_10; __pyx_t_11+=1) {
      __pyx_v_i = __pyx_t_11;

      /* "pysam/libcbcf.pyx":463
 *         dst_datai  = <int32_t *>dst_data
 *         for i in range(src_values):
 *             val = src_datai8[i]             # <<<<<<<<<<<<<<
 *             if val == bcf_int8_missing:
 *                 val = bcf_int32_missing
*/
      __pyx_v_val = (__pyx_v_src_datai8[__pyx_v_i]);

      /* "pysam/libcbcf.pyx":464
 *         for i in range(src_values):
 *             val = src_datai8[i]
 *             if val == bcf_int8_missing:             # <<<<<<<<<<<<<<
 *                 val = bcf_int32_missing
 *             elif val == bcf_int8_vector_end:
*/
      __pyx_t_1 = (__pyx_v_val == bcf_int8_missing);
      if (__pyx_t_1) {

        /* "pysam/libcbcf.pyx":465
 *             val = src_datai8[i]
 *             if val == bcf_int8_missing:
 *                 val = bcf_int32_missing             # <<<<<<<<<<<<<<
 *             elif val == bcf_int8_vector_end:
 *                 val = bcf_int32_vector_end
*/
        __pyx_v_val = bcf_int32_missing;

        /* "pysam/libcbcf.pyx":464
 *         for i in range(src_values):
 *             val = src_datai8[i]
 *             if val == bcf_int8_missing:             # <<<<<<<<<<<<<<
 *                 val = bcf_int32_missing
 *             elif val == bcf_int8_vector_end:
*/
        goto __pyx_L11;
      }

      /* "pysam/libcbcf.pyx":466
 *             if val == bcf_int8_missing:
 *                 val = bcf_int32_missing
 *             elif val == bcf_int8_vector_end:             # <<<<<<<<<<<<<<
 *                 val = bcf_int32_vector_end
 *             dst_datai[i] = val
*/
      __pyx_t_1 = (__pyx_v_val == bcf_int8_vector_end);
      if (__pyx_t_1) {

        /* "pysam/libcbcf.pyx":467
 *                 val = bcf_int32_missing
 *             elif val == bcf_int8_vector_end:
 *                 val = bcf_int32_vector_end             # <<<<<<<<<<<<<<
 *             dst_datai[i] = val
 *         for i in range(src_values, dst_values):
*/
        __pyx_v_val = bcf_int32_vector_end;

        /* "pysam/libcbcf.pyx":466
 *             if val == bcf_int8_missing:
 *                 val = bcf_int32_missing
 *             elif val == bcf_int8_vector_end:             # <<<<<<<<<<<<<<
 *                 val = bcf_int32_vector_end
 *             dst_datai[i] = val
*/
      }
      __pyx_L11:;

      /* "pysam/libcbcf.pyx":468
 *             elif val == bcf_int8_vector_end:
 *                 val = bcf_int32_vector_end
 *             dst_datai[i] = val             # <<<<<<<<<<<<<<
 *         for i in range(src_values, dst_values):
 *             dst_datai[i] = bcf_int32_missing if not vlen else bcf_int32_vector_end
*/
      (__pyx_v_dst_datai[__pyx_v_i]) = __pyx_v_val;
    }

    /* "pysam/libcbcf.pyx":469
 *                 val = bcf_int32_vector_end
 *             dst_datai[i] = val
 *         for i in range(src_values, dst_values):             # <<<<<<<<<<<<<<
 *             dst_datai[i] = bcf_int32_missing if not vlen else bcf_int32_vector_end
 *     elif src_type == BCF_BT_INT16 and dst_type == BCF_BT_INT32:
*/
    __pyx_t_9 = __pyx_v_dst_values;
    __pyx_t_10 = __pyx_t_9;
    for (__pyx_t_11 = __pyx_v_src_values; __pyx_t_11 < __pyx_t_10; __pyx_t_11+=1) {
      __pyx_v_i = __pyx_t_11;

      /* "pysam/libcbcf.pyx":470
 *             dst_datai[i] = val
 *         for i in range(src_values, dst_values):
 *             dst_datai[i] = bcf_int32_missing if not vlen else bcf_int32_vector_end             # <<<<<<<<<<<<<<
 *     elif src_type == BCF_BT_INT16 and dst_type == BCF_BT_INT32:
 *         src_datai16 = <int16_t *>src_data
*/
      __pyx_t_1 = (!(__pyx_v_vlen != 0));
      if (__pyx_t_1) {
        __pyx_t_13 = bcf_int32_missing;
      } else {
        __pyx_t_13 = bcf_int32_vector_end;
      }
      (__pyx_v_dst_datai[__pyx_v_i]) = __pyx_t_13;
    }

    /* "pysam/libcbcf.pyx":459
 *         for i in range(src_values, dst_values):
 *             dst_datac[i] = 0
 *     elif src_type == BCF_BT_INT8 and dst_type == BCF_BT_INT32:             # <<<<<<<<<<<<<<
 *         src_datai8 = <int8_t *>src_data
 *         dst_datai  = <int32_t *>dst_data
*/
    goto __pyx_L4;
  }

  /* "pysam/libcbcf.pyx":471
 *         for i in range(src_values, dst_values):
 *             dst_datai[i] = bcf_int32_missing if not vlen else bcf_int32_vector_end
 *     elif src_type == BCF_BT_INT16 and dst_type == BCF_BT_INT32:             # <<<<<<<<<<<<<<
 *         src_datai16 = <int16_t *>src_data
 *         dst_datai   = <int32_t *>dst_data
*/
  __pyx_t_12 = (__pyx_v_src_type == BCF_BT_INT16);
  if (__pyx_t_12) {
  } else {
    __pyx_t_1 = __pyx_t_12;
    goto __pyx_L14_bool_binop_done;
  }
  __pyx_t_12 = (__pyx_v_dst_type == BCF_BT_INT32);
  __pyx_t_1 = __pyx_t_12;
  __pyx_L14_bool_binop_done:;
  if (__pyx_t_1) {

    /* "pysam/libcbcf.pyx":472
 *             dst_datai[i] = bcf_int32_missing if not vlen else bcf_int32_vector_end
 *     elif src_type == BCF_BT_INT16 and dst_type == BCF_BT_INT32:
 *         src_datai16 = <int16_t *>src_data             # <<<<<<<<<<<<<<
 *         dst_datai   = <int32_t *>dst_data
 *         for i in range(src_values):
*/
    __pyx_v_src_datai16 = ((int16_t *)__pyx_v_src_data);

    /* "pysam/libcbcf.pyx":473
 *     elif src_type == BCF_BT_INT16 and dst_type == BCF_BT_INT32:
 *         src_datai16 = <int16_t *>src_data
 *         dst_datai   = <int32_t *>dst_data             # <<<<<<<<<<<<<<
 *         for i in range(src_values):
 *             val = src_datai16[i]
*/
    __pyx_v_dst_datai = ((int32_t *)__pyx_v_dst_data);

    /* "pysam/libcbcf.pyx":474
 *         src_datai16 = <int16_t *>src_data
 *         dst_datai   = <int32_t *>dst_data
 *         for i in range(src_values):             # <<<<<<<<<<<<<<
 *             val = src_datai16[i]
 *             if val == bcf_int16_missing:
*/
    __pyx_t_9 = __pyx_v_src_values;
    __pyx_t_10 = __pyx_t_9;
    for (__pyx_t_11 = 0; __pyx_t_11 < __pyx_t_10; __pyx_t_11+=1) {
      __pyx_v_i = __pyx_t_11;

      /* "pysam/libcbcf.pyx":475
 *         dst_datai   = <int32_t *>dst_data
 *         for i in range(src_values):
 *             val = src_datai16[i]             # <<<<<<<<<<<<<<
 *             if val == bcf_int16_missing:
 *                 val = bcf_int32_missing
*/
      __pyx_v_val = (__pyx_v_src_datai16[__pyx_v_i]);

      /* "pysam/libcbcf.pyx":476
 *         for i in range(src_values):
 *             val = src_datai16[i]
 *             if val == bcf_int16_missing:             # <<<<<<<<<<<<<<
 *                 val = bcf_int32_missing
 *             elif val == bcf_int16_vector_end:
*/
      __pyx_t_1 = (__pyx_v_val == bcf_int16_missing);
      if (__pyx_t_1) {

        /* "pysam/libcbcf.pyx":477
 *             val = src_datai16[i]
 *             if val == bcf_int16_missing:
 *                 val = bcf_int32_missing             # <<<<<<<<<<<<<<
 *             elif val == bcf_int16_vector_end:
 *                 val = bcf_int32_vector_end
*/
        __pyx_v_val = bcf_int32_missing;

        /* "pysam/libcbcf.pyx":476
 *         for i in range(src_values):
 *             val = src_datai16[i]
 *             if val == bcf_int16_missing:             # <<<<<<<<<<<<<<
 *                 val = bcf_int32_missing
 *             elif val == bcf_int16_vector_end:
*/
        goto __pyx_L18;
      }

      /* "pysam/libcbcf.pyx":478
 *             if val == bcf_int16_missing:
 *                 val = bcf_int32_missing
 *             elif val == bcf_int16_vector_end:             # <<<<<<<<<<<<<<
 *                 val = bcf_int32_vector_end
 *             dst_datai[i] = val
*/
      __pyx_t_1 = (__pyx_v_val == bcf_int16_vector_end);
      if (__pyx_t_1) {

        /* "pysam/libcbcf.pyx":479
 *                 val = bcf_int32_missing
 *             elif val == bcf_int16_vector_end:
 *                 val = bcf_int32_vector_end             # <<<<<<<<<<<<<<
 *             dst_datai[i] = val
 *         for i in range(src_values, dst_values):
*/
        __pyx_v_val = bcf_int32_vector_end;

        /* "pysam/libcbcf.pyx":478
 *             if val == bcf_int16_missing:
 *                 val = bcf_int32_missing
 *             elif val == bcf_int16_vector_end:             # <<<<<<<<<<<<<<
 *                 val = bcf_int32_vector_end
 *             dst_datai[i] = val
*/
      }
      __pyx_L18:;

      /* "pysam/libcbcf.pyx":480
 *             elif val == bcf_int16_vector_end:
 *                 val = bcf_int32_vector_end
 *             dst_datai[i] = val             # <<<<<<<<<<<<<<
 *         for i in range(src_values, dst_values):
 *             dst_datai[i] = bcf_int32_missing if not vlen else bcf_int32_vector_end
*/
      (__pyx_v_dst_datai[__pyx_v_i]) = __pyx_v_val;
    }

    /* "pysam/libcbcf.pyx":481
 *                 val = bcf_int32_vector_end
 *             dst_datai[i] = val
 *         for i in range(src_values, dst_values):             # <<<<<<<<<<<<<<
 *             dst_datai[i] = bcf_int32_missing if not vlen else bcf_int32_vector_end
 *     elif src_type == BCF_BT_INT32 and dst_type == BCF_BT_INT32:
*/
    __pyx_t_9 = __pyx_v_dst_values;
    __pyx_t_10 = __pyx_t_9;
    for (__pyx_t_11 = __pyx_v_src_values; __pyx_t_11 < __pyx_t_10; __pyx_t_11+=1) {
      __pyx_v_i = __pyx_t_11;

      /* "pysam/libcbcf.pyx":482
 *             dst_datai[i] = val
 *         for i in range(src_values, dst_values):
 *             dst_datai[i] = bcf_int32_missing if not vlen else bcf_int32_vector_end             # <<<<<<<<<<<<<<
 *     elif src_type == BCF_BT_INT32 and dst_type == BCF_BT_INT32:
 *         src_datai32 = <int32_t *>src_data
*/
      __pyx_t_1 = (!(__pyx_v_vlen != 0));
      if (__pyx_t_1) {
        __pyx_t_13 = bcf_int32_missing;
      } else {
        __pyx_t_13 = bcf_int32_vector_end;
      }
      (__pyx_v_dst_datai[__pyx_v_i]) = __pyx_t_13;
    }

    /* "pysam/libcbcf.pyx":471
 *         for i in range(src_values, dst_values):
 *             dst_datai[i] = bcf_int32_missing if not vlen else bcf_int32_vector_end
 *     elif src_type == BCF_BT_INT16 and dst_type == BCF_BT_INT32:             # <<<<<<<<<<<<<<
 *         src_datai16 = <int16_t *>src_data
 *         dst_datai   = <int32_t *>dst_data
*/
    goto __pyx_L4;
  }

  /* "pysam/libcbcf.pyx":483
 *         for i in range(src_values, dst_values):
 *             dst_datai[i] = bcf_int32_missing if not vlen else bcf_int32_vector_end
 *     elif src_type == BCF_BT_INT32 and dst_type == BCF_BT_INT32:             # <<<<<<<<<<<<<<
 *         src_datai32 = <int32_t *>src_data
 *         dst_datai   = <int32_t *>dst_data
*/
  __pyx_t_12 = (__pyx_v_src_type == BCF_BT_INT32);
  if (__pyx_t_12) {
  } else {
    __pyx_t_1 = __pyx_t_12;
    goto __pyx_L21_bool_binop_done;
  }
  __pyx_t_12 = (__pyx_v_dst_type == BCF_BT_INT32);
  __pyx_t_1 = __pyx_t_12;
  __pyx_L21_bool_binop_done:;
  if (__pyx_t_1) {

    /* "pysam/libcbcf.pyx":484
 *             dst_datai[i] = bcf_int32_missing if not vlen else bcf_int32_vector_end
 *     elif src_type == BCF_BT_INT32 and dst_type == BCF_BT_INT32:
 *         src_datai32 = <int32_t *>src_data             # <<<<<<<<<<<<<<
 *         dst_datai   = <int32_t *>dst_data
 *         for i in range(src_values):
*/
    __pyx_v_src_datai32 = ((int32_t *)__pyx_v_src_data);

    /* "pysam/libcbcf.pyx":485
 *     elif src_type == BCF_BT_INT32 and dst_type == BCF_BT_INT32:
 *         src_datai32 = <int32_t *>src_data
 *         dst_datai   = <int32_t *>dst_data             # <<<<<<<<<<<<<<
 *         for i in range(src_values):
 *             dst_datai[i] = src_datai32[i]
*/
    __pyx_v_dst_datai = ((int32_t *)__pyx_v_dst_data);

    /* "pysam/libcbcf.pyx":486
 *         src_datai32 = <int32_t *>src_data
 *         dst_datai   = <int32_t *>dst_data
 *         for i in range(src_values):             # <<<<<<<<<<<<<<
 *             dst_datai[i] = src_datai32[i]
 *         for i in range(src_values, dst_values):
*/
    __pyx_t_9 = __pyx_v_src_values;
    __pyx_t_10 = __pyx_t_9;
    for (__pyx_t_11 = 0; __pyx_t_11 < __pyx_t_10; __pyx_t_11+=1) {
      __pyx_v_i = __pyx_t_11;

      /* "pysam/libcbcf.pyx":487
 *         dst_datai   = <int32_t *>dst_data
 *         for i in range(src_values):
 *             dst_datai[i] = src_datai32[i]             # <<<<<<<<<<<<<<
 *         for i in range(src_values, dst_values):
 *             dst_datai[i] = bcf_int32_missing if not vlen else bcf_int32_vector_end
*/
      (__pyx_v_dst_datai[__pyx_v_i]) = (__pyx_v_src_datai32[__pyx_v_i]);
    }

    /* "pysam/libcbcf.pyx":488
 *         for i in range(src_values):
 *             dst_datai[i] = src_datai32[i]
 *         for i in range(src_values, dst_values):             # <<<<<<<<<<<<<<
 *             dst_datai[i] = bcf_int32_missing if not vlen else bcf_int32_vector_end
 *     elif src_type == BCF_BT_FLOAT and dst_type == BCF_BT_FLOAT:
*/
    __pyx_t_9 = __pyx_v_dst_values;
    __pyx_t_10 = __pyx_t_9;
    for (__pyx_t_11 = __pyx_v_src_values; __pyx_t_11 < __pyx_t_10; __pyx_t_11+=1) {
      __pyx_v_i = __pyx_t_11;

      /* "pysam/libcbcf.pyx":489
 *             dst_datai[i] = src_datai32[i]
 *         for i in range(src_values, dst_values):
 *             dst_datai[i] = bcf_int32_missing if not vlen else bcf_int32_vector_end             # <<<<<<<<<<<<<<
 *     elif src_type == BCF_BT_FLOAT and dst_type == BCF_BT_FLOAT:
 *         src_dataf = <float *>src_data
*/
      __pyx_t_1 = (!(__pyx_v_vlen != 0));
      if (__pyx_t_1) {
        __pyx_t_13 = bcf_int32_missing;
      } else {
        __pyx_t_13 = bcf_int32_vector_end;
      }
      (__pyx_v_dst_datai[__pyx_v_i]) = __pyx_t_13;
    }

    /* "pysam/libcbcf.pyx":483
 *         for i in range(src_values, dst_values):
 *             dst_datai[i] = bcf_int32_missing if not vlen else bcf_int32_vector_end
 *     elif src_type == BCF_BT_INT32 and dst_type == BCF_BT_INT32:             # <<<<<<<<<<<<<<
 *         src_datai32 = <int32_t *>src_data
 *         dst_datai   = <int32_t *>dst_data
*/
    goto __pyx_L4;
  }

  /* "pysam/libcbcf.pyx":490
 *         for i in range(src_values, dst_values):
 *             dst_datai[i] = bcf_int32_missing if not vlen else bcf_int32_vector_end
 *     elif src_type == BCF_BT_FLOAT and dst_type == BCF_BT_FLOAT:             # <<<<<<<<<<<<<<
 *         src_dataf = <float *>src_data
 *         dst_dataf = <float *>dst_data
*/
  __pyx_t_12 = (__pyx_v_src_type == BCF_BT_FLOAT);
  if (__pyx_t_12) {
  } else {
    __pyx_t_1 = __pyx_t_12;
    goto __pyx_L27_bool_binop_done;
  }
  __pyx_t_12 = (__pyx_v_dst_type == BCF_BT_FLOAT);
  __pyx_t_1 = __pyx_t_12;
  __pyx_L27_bool_binop_done:;
  if (likely(__pyx_t_1)) {

    /* "pysam/libcbcf.pyx":491
 *             dst_datai[i] = bcf_int32_missing if not vlen else bcf_int32_vector_end
 *     elif src_type == BCF_BT_FLOAT and dst_type == BCF_BT_FLOAT:
 *         src_dataf = <float *>src_data             # <<<<<<<<<<<<<<
 *         dst_dataf = <float *>dst_data
 *         for i in range(src_values):
*/
    __pyx_v_src_dataf = ((float *)__pyx_v_src_data);

    /* "pysam/libcbcf.pyx":492
 *     elif src_type == BCF_BT_FLOAT and dst_type == BCF_BT_FLOAT:
 *         src_dataf = <float *>src_data
 *         dst_dataf = <float *>dst_data             # <<<<<<<<<<<<<<
 *         for i in range(src_values):
 *             dst_dataf[i] = src_dataf[i]
*/
    __pyx_v_dst_dataf = ((float *)__pyx_v_dst_data);

    /* "pysam/libcbcf.pyx":493
 *         src_dataf = <float *>src_data
 *         dst_dataf = <float *>dst_data
 *         for i in range(src_values):             # <<<<<<<<<<<<<<
 *             dst_dataf[i] = src_dataf[i]
 *         for i in range(src_values, dst_values):
*/
    __pyx_t_9 = __pyx_v_src_values;
    __pyx_t_10 = __pyx_t_9;
    for (__pyx_t_11 = 0; __pyx_t_11 < __pyx_t_10; __pyx_t_11+=1) {
      __pyx_v_i = __pyx_t_11;

      /* "pysam/libcbcf.pyx":494
 *         dst_dataf = <float *>dst_data
 *         for i in range(src_values):
 *             dst_dataf[i] = src_dataf[i]             # <<<<<<<<<<<<<<
 *         for i in range(src_values, dst_values):
 *             bcf_float_set(dst_dataf + i, bcf_float_missing if not vlen else bcf_float_vector_end)
*/
      (__pyx_v_dst_dataf[__pyx_v_i]) = (__pyx_v_src_dataf[__pyx_v_i]);
    }

    /* "pysam/libcbcf.pyx":495
 *         for i in range(src_values):
 *             dst_dataf[i] = src_dataf[i]
 *         for i in range(src_values, dst_values):             # <<<<<<<<<<<<<<
 *             bcf_float_set(dst_dataf + i, bcf_float_missing if not vlen else bcf_float_vector_end)
 *     else:
*/
    __pyx_t_9 = __pyx_v_dst_values;
    __pyx_t_10 = __pyx_t_9;
    for (__pyx_t_11 = __pyx_v_src_values; __pyx_t_11 < __pyx_t_10; __pyx_t_11+=1) {
      __pyx_v_i = __pyx_t_11;

      /* "pysam/libcbcf.pyx":496
 *             dst_dataf[i] = src_dataf[i]
 *         for i in range(src_values, dst_values):
 *             bcf_float_set(dst_dataf + i, bcf_float_missing if not vlen else bcf_float_vector_end)             # <<<<<<<<<<<<<<
 *     else:
 *         raise TypeError('unsupported types')
*/
      __pyx_t_1 = (!(__pyx_v_vlen != 0));
      if (__pyx_t_1) {
        __pyx_t_14 = bcf_float_missing;
      } else {
        __pyx_t_14 = bcf_float_vector_end;
      }
      bcf_float_set((__pyx_v_dst_dataf + __pyx_v_i), __pyx_t_14);
    }

    /* "pysam/libcbcf.pyx":490
 *         for i in range(src_values, dst_values):
 *             dst_datai[i] = bcf_int32_missing if not vlen else bcf_int32_vector_end
 *     elif src_type == BCF_BT_FLOAT and dst_type == BCF_BT_FLOAT:             # <<<<<<<<<<<<<<
 *         src_dataf = <float *>src_data
 *         dst_dataf = <float *>dst_data
*/
    goto __pyx_L4;
  }

  /* "pysam/libcbcf.pyx":498
 *             bcf_float_set(dst_dataf + i, bcf_float_missing if not vlen else bcf_float_vector_end)
 *     else:
 *         raise TypeError('unsupported types')             # <<<<<<<<<<<<<<
 * 
 * 
*/
  /*else*/ {
    __pyx_t_4 = NULL;
    __Pyx_INCREF(__pyx_builtin_TypeError);
    __pyx_t_5 = __pyx_builtin_TypeError; 
    __pyx_t_9 = 1;
    {
      PyObject *__pyx_callargs[2] = {__pyx_t_4, __pyx_mstate_global->__pyx_kp_u_unsupported_types};
      __pyx_t_2 = __Pyx_PyObject_FastCall(__pyx_t_5, __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_5); __pyx_t_5 = 0;
      if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 498, __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, 498, __pyx_L1_error)
  }
  __pyx_L4:;

  /* "pysam/libcbcf.pyx":432
 * 
 * 
 * cdef bcf_copy_expand_array(void *src_data, int src_type, size_t src_values,             # <<<<<<<<<<<<<<
 *                            void *dst_data, int dst_type, size_t dst_values,
 *                            int vlen):
*/

  /* function exit code */
  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  __Pyx_TraceReturnValue(__pyx_r, 0, 0, __PYX_ERR(0, 432, __pyx_L1_error));
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_XDECREF(__pyx_t_5);
  __Pyx_XDECREF(__pyx_t_6);
  __Pyx_XDECREF(__pyx_t_7);
  __Pyx_XDECREF(__pyx_t_8);
  __Pyx_TraceException(__pyx_lineno, 0, 0);
  #if CYTHON_USE_SYS_MONITORING
  __Pyx_TraceExceptionUnwind(0, 0);
  #else
  __Pyx_TraceReturnValue(NULL, 0, 0, __PYX_ERR(0, 432, __pyx_L1_error));
  #endif
  __Pyx_AddTraceback("pysam.libcbcf.bcf_copy_expand_array", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_PyMonitoring_ExitScope(0);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "pysam/libcbcf.pyx":501
 * 
 * 
 * cdef bcf_get_value_count(VariantRecord record, int hl_type, int id, ssize_t *count, int *scalar, int sample):             # <<<<<<<<<<<<<<
 *     if record is None:
 *         raise ValueError('record must not be None')
*/

static PyObject *__pyx_f_5pysam_7libcbcf_bcf_get_value_count(struct __pyx_obj_5pysam_7libcbcf_VariantRecord *__pyx_v_record, int __pyx_v_hl_type, int __pyx_v_id, Py_ssize_t *__pyx_v_count, int *__pyx_v_scalar, int __pyx_v_sample) {
  bcf_hdr_t *__pyx_v_hdr;
  bcf1_t *__pyx_v_r;
  int __pyx_v_length;
  int __pyx_v_number;
  PyObject *__pyx_r = NULL;
  __Pyx_TraceDeclarationsFunc
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  PyObject *__pyx_t_4 = NULL;
  size_t __pyx_t_5;
  bcf_hdr_t *__pyx_t_6;
  bcf1_t *__pyx_t_7;
  int __pyx_t_8;
  int __pyx_t_9;
  uint32_t __pyx_t_10;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_TraceFrameInit(((PyObject *)__pyx_mstate_global->__pyx_codeobj_tab[14]))
  __Pyx_RefNannySetupContext("bcf_get_value_count", 0);
  __Pyx_TraceStartFunc("bcf_get_value_count", __pyx_f[0], 501, 0, 0, 0, __PYX_ERR(0, 501, __pyx_L1_error));

  /* "pysam/libcbcf.pyx":502
 * 
 * cdef bcf_get_value_count(VariantRecord record, int hl_type, int id, ssize_t *count, int *scalar, int sample):
 *     if record is None:             # <<<<<<<<<<<<<<
 *         raise ValueError('record must not be None')
 * 
*/
  __pyx_t_1 = (((PyObject *)__pyx_v_record) == Py_None);
  if (unlikely(__pyx_t_1)) {

    /* "pysam/libcbcf.pyx":503
 * cdef bcf_get_value_count(VariantRecord record, int hl_type, int id, ssize_t *count, int *scalar, int sample):
 *     if record is None:
 *         raise ValueError('record must not be None')             # <<<<<<<<<<<<<<
 * 
 *     cdef bcf_hdr_t *hdr = record.header.ptr
*/
    __pyx_t_3 = NULL;
    __Pyx_INCREF(__pyx_builtin_ValueError);
    __pyx_t_4 = __pyx_builtin_ValueError; 
    __pyx_t_5 = 1;
    {
      PyObject *__pyx_callargs[2] = {__pyx_t_3, __pyx_mstate_global->__pyx_kp_u_record_must_not_be_None};
      __pyx_t_2 = __Pyx_PyObject_FastCall(__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_2)) __PYX_ERR(0, 503, __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, 503, __pyx_L1_error)

    /* "pysam/libcbcf.pyx":502
 * 
 * cdef bcf_get_value_count(VariantRecord record, int hl_type, int id, ssize_t *count, int *scalar, int sample):
 *     if record is None:             # <<<<<<<<<<<<<<
 *         raise ValueError('record must not be None')
 * 
*/
  }

  /* "pysam/libcbcf.pyx":505
 *         raise ValueError('record must not be None')
 * 
 *     cdef bcf_hdr_t *hdr = record.header.ptr             # <<<<<<<<<<<<<<
 *     cdef bcf1_t *r = record.ptr
 * 
*/
  __pyx_t_6 = __pyx_v_record->header->ptr;
  __pyx_v_hdr = __pyx_t_6;

  /* "pysam/libcbcf.pyx":506
 * 
 *     cdef bcf_hdr_t *hdr = record.header.ptr
 *     cdef bcf1_t *r = record.ptr             # <<<<<<<<<<<<<<
 * 
 *     if not check_header_id(hdr, hl_type, id):
*/
  __pyx_t_7 = __pyx_v_record->ptr;
  __pyx_v_r = __pyx_t_7;

  /* "pysam/libcbcf.pyx":508
 *     cdef bcf1_t *r = record.ptr
 * 
 *     if not check_header_id(hdr, hl_type, id):             # <<<<<<<<<<<<<<
 *         raise ValueError('Invalid header')
 * 
*/
  __pyx_t_1 = __pyx_f_5pysam_7libcbcf_check_header_id(__pyx_v_hdr, __pyx_v_hl_type, __pyx_v_id); if (unlikely(__pyx_t_1 == ((int)-1) && PyErr_Occurred())) __PYX_ERR(0, 508, __pyx_L1_error)
  __pyx_t_8 = (!__pyx_t_1);
  if (unlikely(__pyx_t_8)) {

    /* "pysam/libcbcf.pyx":509
 * 
 *     if not check_header_id(hdr, hl_type, id):
 *         raise ValueError('Invalid header')             # <<<<<<<<<<<<<<
 * 
 *     cdef int length = bcf_hdr_id2length(hdr, hl_type, id)
*/
    __pyx_t_4 = NULL;
    __Pyx_INCREF(__pyx_builtin_ValueError);
    __pyx_t_3 = __pyx_builtin_ValueError; 
    __pyx_t_5 = 1;
    {
      PyObject *__pyx_callargs[2] = {__pyx_t_4, __pyx_mstate_global->__pyx_kp_u_Invalid_header};
      __pyx_t_2 = __Pyx_PyObject_FastCall(__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_2)) __PYX_ERR(0, 509, __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, 509, __pyx_L1_error)

    /* "pysam/libcbcf.pyx":508
 *     cdef bcf1_t *r = record.ptr
 * 
 *     if not check_header_id(hdr, hl_type, id):             # <<<<<<<<<<<<<<
 *         raise ValueError('Invalid header')
 * 
*/
  }

  /* "pysam/libcbcf.pyx":511
 *         raise ValueError('Invalid header')
 * 
 *     cdef int length = bcf_hdr_id2length(hdr, hl_type, id)             # <<<<<<<<<<<<<<
 *     cdef int number = bcf_hdr_id2number(hdr, hl_type, id)
 * 
*/
  __pyx_v_length = bcf_hdr_id2length(__pyx_v_hdr, __pyx_v_hl_type, __pyx_v_id);

  /* "pysam/libcbcf.pyx":512
 * 
 *     cdef int length = bcf_hdr_id2length(hdr, hl_type, id)
 *     cdef int number = bcf_hdr_id2number(hdr, hl_type, id)             # <<<<<<<<<<<<<<
 * 
 *     scalar[0] = 0
*/
  __pyx_v_number = bcf_hdr_id2number(__pyx_v_hdr, __pyx_v_hl_type, __pyx_v_id);

  /* "pysam/libcbcf.pyx":514
 *     cdef int number = bcf_hdr_id2number(hdr, hl_type, id)
 * 
 *     scalar[0] = 0             # <<<<<<<<<<<<<<
 * 
 *     if hl_type == BCF_HL_FMT and is_gt_fmt(hdr, id):
*/
  (__pyx_v_scalar[0]) = 0;

  /* "pysam/libcbcf.pyx":516
 *     scalar[0] = 0
 * 
 *     if hl_type == BCF_HL_FMT and is_gt_fmt(hdr, id):             # <<<<<<<<<<<<<<
 *         count[0] = number
 *     elif length == BCF_VL_FIXED:
*/
  __pyx_t_1 = (__pyx_v_hl_type == BCF_HL_FMT);
  if (__pyx_t_1) {
  } else {
    __pyx_t_8 = __pyx_t_1;
    goto __pyx_L6_bool_binop_done;
  }
  __pyx_t_9 = __pyx_f_5pysam_7libcbcf_is_gt_fmt(__pyx_v_hdr, __pyx_v_id); if (unlikely(__pyx_t_9 == ((int)-1) && PyErr_Occurred())) __PYX_ERR(0, 516, __pyx_L1_error)
  __pyx_t_1 = (__pyx_t_9 != 0);
  __pyx_t_8 = __pyx_t_1;
  __pyx_L6_bool_binop_done:;
  if (__pyx_t_8) {

    /* "pysam/libcbcf.pyx":517
 * 
 *     if hl_type == BCF_HL_FMT and is_gt_fmt(hdr, id):
 *         count[0] = number             # <<<<<<<<<<<<<<
 *     elif length == BCF_VL_FIXED:
 *         if number == 1:
*/
    (__pyx_v_count[0]) = __pyx_v_number;

    /* "pysam/libcbcf.pyx":516
 *     scalar[0] = 0
 * 
 *     if hl_type == BCF_HL_FMT and is_gt_fmt(hdr, id):             # <<<<<<<<<<<<<<
 *         count[0] = number
 *     elif length == BCF_VL_FIXED:
*/
    goto __pyx_L5;
  }

  /* "pysam/libcbcf.pyx":518
 *     if hl_type == BCF_HL_FMT and is_gt_fmt(hdr, id):
 *         count[0] = number
 *     elif length == BCF_VL_FIXED:             # <<<<<<<<<<<<<<
 *         if number == 1:
 *             scalar[0] = 1
*/
  __pyx_t_8 = (__pyx_v_length == BCF_VL_FIXED);
  if (__pyx_t_8) {

    /* "pysam/libcbcf.pyx":519
 *         count[0] = number
 *     elif length == BCF_VL_FIXED:
 *         if number == 1:             # <<<<<<<<<<<<<<
 *             scalar[0] = 1
 *         count[0] = number
*/
    __pyx_t_8 = (__pyx_v_number == 1);
    if (__pyx_t_8) {

      /* "pysam/libcbcf.pyx":520
 *     elif length == BCF_VL_FIXED:
 *         if number == 1:
 *             scalar[0] = 1             # <<<<<<<<<<<<<<
 *         count[0] = number
 *     elif length == BCF_VL_R:
*/
      (__pyx_v_scalar[0]) = 1;

      /* "pysam/libcbcf.pyx":519
 *         count[0] = number
 *     elif length == BCF_VL_FIXED:
 *         if number == 1:             # <<<<<<<<<<<<<<
 *             scalar[0] = 1
 *         count[0] = number
*/
    }

    /* "pysam/libcbcf.pyx":521
 *         if number == 1:
 *             scalar[0] = 1
 *         count[0] = number             # <<<<<<<<<<<<<<
 *     elif length == BCF_VL_R:
 *         count[0] = r.n_allele
*/
    (__pyx_v_count[0]) = __pyx_v_number;

    /* "pysam/libcbcf.pyx":518
 *     if hl_type == BCF_HL_FMT and is_gt_fmt(hdr, id):
 *         count[0] = number
 *     elif length == BCF_VL_FIXED:             # <<<<<<<<<<<<<<
 *         if number == 1:
 *             scalar[0] = 1
*/
    goto __pyx_L5;
  }

  /* "pysam/libcbcf.pyx":522
 *             scalar[0] = 1
 *         count[0] = number
 *     elif length == BCF_VL_R:             # <<<<<<<<<<<<<<
 *         count[0] = r.n_allele
 *     elif length == BCF_VL_A:
*/
  __pyx_t_8 = (__pyx_v_length == BCF_VL_R);
  if (__pyx_t_8) {

    /* "pysam/libcbcf.pyx":523
 *         count[0] = number
 *     elif length == BCF_VL_R:
 *         count[0] = r.n_allele             # <<<<<<<<<<<<<<
 *     elif length == BCF_VL_A:
 *         count[0] = r.n_allele - 1
*/
    __pyx_t_10 = __pyx_v_r->n_allele;
    (__pyx_v_count[0]) = __pyx_t_10;

    /* "pysam/libcbcf.pyx":522
 *             scalar[0] = 1
 *         count[0] = number
 *     elif length == BCF_VL_R:             # <<<<<<<<<<<<<<
 *         count[0] = r.n_allele
 *     elif length == BCF_VL_A:
*/
    goto __pyx_L5;
  }

  /* "pysam/libcbcf.pyx":524
 *     elif length == BCF_VL_R:
 *         count[0] = r.n_allele
 *     elif length == BCF_VL_A:             # <<<<<<<<<<<<<<
 *         count[0] = r.n_allele - 1
 *     elif length == BCF_VL_G:
*/
  __pyx_t_8 = (__pyx_v_length == BCF_VL_A);
  if (__pyx_t_8) {

    /* "pysam/libcbcf.pyx":525
 *         count[0] = r.n_allele
 *     elif length == BCF_VL_A:
 *         count[0] = r.n_allele - 1             # <<<<<<<<<<<<<<
 *     elif length == BCF_VL_G:
 *         count[0] = bcf_genotype_count(hdr, r, sample)
*/
    (__pyx_v_count[0]) = (__pyx_v_r->n_allele - 1);

    /* "pysam/libcbcf.pyx":524
 *     elif length == BCF_VL_R:
 *         count[0] = r.n_allele
 *     elif length == BCF_VL_A:             # <<<<<<<<<<<<<<
 *         count[0] = r.n_allele - 1
 *     elif length == BCF_VL_G:
*/
    goto __pyx_L5;
  }

  /* "pysam/libcbcf.pyx":526
 *     elif length == BCF_VL_A:
 *         count[0] = r.n_allele - 1
 *     elif length == BCF_VL_G:             # <<<<<<<<<<<<<<
 *         count[0] = bcf_genotype_count(hdr, r, sample)
 *     elif length == BCF_VL_VAR:
*/
  __pyx_t_8 = (__pyx_v_length == BCF_VL_G);
  if (__pyx_t_8) {

    /* "pysam/libcbcf.pyx":527
 *         count[0] = r.n_allele - 1
 *     elif length == BCF_VL_G:
 *         count[0] = bcf_genotype_count(hdr, r, sample)             # <<<<<<<<<<<<<<
 *     elif length == BCF_VL_VAR:
 *         count[0] = -1
*/
    __pyx_t_9 = __pyx_f_5pysam_7libcbcf_bcf_genotype_count(__pyx_v_hdr, __pyx_v_r, __pyx_v_sample); if (unlikely(__pyx_t_9 == ((int)-1))) __PYX_ERR(0, 527, __pyx_L1_error)
    (__pyx_v_count[0]) = __pyx_t_9;

    /* "pysam/libcbcf.pyx":526
 *     elif length == BCF_VL_A:
 *         count[0] = r.n_allele - 1
 *     elif length == BCF_VL_G:             # <<<<<<<<<<<<<<
 *         count[0] = bcf_genotype_count(hdr, r, sample)
 *     elif length == BCF_VL_VAR:
*/
    goto __pyx_L5;
  }

  /* "pysam/libcbcf.pyx":528
 *     elif length == BCF_VL_G:
 *         count[0] = bcf_genotype_count(hdr, r, sample)
 *     elif length == BCF_VL_VAR:             # <<<<<<<<<<<<<<
 *         count[0] = -1
 *     else:
*/
  __pyx_t_8 = (__pyx_v_length == BCF_VL_VAR);
  if (likely(__pyx_t_8)) {

    /* "pysam/libcbcf.pyx":529
 *         count[0] = bcf_genotype_count(hdr, r, sample)
 *     elif length == BCF_VL_VAR:
 *         count[0] = -1             # <<<<<<<<<<<<<<
 *     else:
 *         raise ValueError('Unknown format length')
*/
    (__pyx_v_count[0]) = -1L;

    /* "pysam/libcbcf.pyx":528
 *     elif length == BCF_VL_G:
 *         count[0] = bcf_genotype_count(hdr, r, sample)
 *     elif length == BCF_VL_VAR:             # <<<<<<<<<<<<<<
 *         count[0] = -1
 *     else:
*/
    goto __pyx_L5;
  }

  /* "pysam/libcbcf.pyx":531
 *         count[0] = -1
 *     else:
 *         raise ValueError('Unknown format length')             # <<<<<<<<<<<<<<
 * 
 * 
*/
  /*else*/ {
    __pyx_t_3 = NULL;
    __Pyx_INCREF(__pyx_builtin_ValueError);
    __pyx_t_4 = __pyx_builtin_ValueError; 
    __pyx_t_5 = 1;
    {
      PyObject *__pyx_callargs[2] = {__pyx_t_3, __pyx_mstate_global->__pyx_kp_u_Unknown_format_length};
      __pyx_t_2 = __Pyx_PyObject_FastCall(__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_2)) __PYX_ERR(0, 531, __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, 531, __pyx_L1_error)
  }
  __pyx_L5:;

  /* "pysam/libcbcf.pyx":501
 * 
 * 
 * cdef bcf_get_value_count(VariantRecord record, int hl_type, int id, ssize_t *count, int *scalar, int sample):             # <<<<<<<<<<<<<<
 *     if record is None:
 *         raise ValueError('record must not be None')
*/

  /* function exit code */
  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  __Pyx_TraceReturnValue(__pyx_r, 0, 0, __PYX_ERR(0, 501, __pyx_L1_error));
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_TraceException(__pyx_lineno, 0, 0);
  #if CYTHON_USE_SYS_MONITORING
  __Pyx_TraceExceptionUnwind(0, 0);
  #else
  __Pyx_TraceReturnValue(NULL, 0, 0, __PYX_ERR(0, 501, __pyx_L1_error));
  #endif
  __Pyx_AddTraceback("pysam.libcbcf.bcf_get_value_count", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_PyMonitoring_ExitScope(0);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "pysam/libcbcf.pyx":534
 * 
 * 
 * cdef object bcf_info_get_value(VariantRecord record, const bcf_info_t *z):             # <<<<<<<<<<<<<<
 *     if record is None:
 *         raise ValueError('record must not be None')
*/

static PyObject *__pyx_f_5pysam_7libcbcf_bcf_info_get_value(struct __pyx_obj_5pysam_7libcbcf_VariantRecord *__pyx_v_record, bcf_info_t const *__pyx_v_z) {
  bcf_hdr_t *__pyx_v_hdr;
  Py_ssize_t __pyx_v_count;
  int __pyx_v_scalar;
  PyObject *__pyx_v_value = NULL;
  PyObject *__pyx_r = NULL;
  __Pyx_TraceDeclarationsFunc
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  PyObject *__pyx_t_4 = NULL;
  size_t __pyx_t_5;
  bcf_hdr_t *__pyx_t_6;
  int __pyx_t_7;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_TraceFrameInit(((PyObject *)__pyx_mstate_global->__pyx_codeobj_tab[15]))
  __Pyx_RefNannySetupContext("bcf_info_get_value", 0);
  __Pyx_TraceStartFunc("bcf_info_get_value", __pyx_f[0], 534, 0, 0, 0, __PYX_ERR(0, 534, __pyx_L1_error));

  /* "pysam/libcbcf.pyx":535
 * 
 * cdef object bcf_info_get_value(VariantRecord record, const bcf_info_t *z):
 *     if record is None:             # <<<<<<<<<<<<<<
 *         raise ValueError('record must not be None')
 * 
*/
  __pyx_t_1 = (((PyObject *)__pyx_v_record) == Py_None);
  if (unlikely(__pyx_t_1)) {

    /* "pysam/libcbcf.pyx":536
 * cdef object bcf_info_get_value(VariantRecord record, const bcf_info_t *z):
 *     if record is None:
 *         raise ValueError('record must not be None')             # <<<<<<<<<<<<<<
 * 
 *     cdef bcf_hdr_t *hdr = record.header.ptr
*/
    __pyx_t_3 = NULL;
    __Pyx_INCREF(__pyx_builtin_ValueError);
    __pyx_t_4 = __pyx_builtin_ValueError; 
    __pyx_t_5 = 1;
    {
      PyObject *__pyx_callargs[2] = {__pyx_t_3, __pyx_mstate_global->__pyx_kp_u_record_must_not_be_None};
      __pyx_t_2 = __Pyx_PyObject_FastCall(__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_2)) __PYX_ERR(0, 536, __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, 536, __pyx_L1_error)

    /* "pysam/libcbcf.pyx":535
 * 
 * cdef object bcf_info_get_value(VariantRecord record, const bcf_info_t *z):
 *     if record is None:             # <<<<<<<<<<<<<<
 *         raise ValueError('record must not be None')
 * 
*/
  }

  /* "pysam/libcbcf.pyx":538
 *         raise ValueError('record must not be None')
 * 
 *     cdef bcf_hdr_t *hdr = record.header.ptr             # <<<<<<<<<<<<<<
 * 
 *     cdef char *s
*/
  __pyx_t_6 = __pyx_v_record->header->ptr;
  __pyx_v_hdr = __pyx_t_6;

  /* "pysam/libcbcf.pyx":544
 *     cdef int scalar
 * 
 *     bcf_get_value_count(record, BCF_HL_INFO, z.key, &count, &scalar, -1)             # <<<<<<<<<<<<<<
 * 
 *     if z.len == 0:
*/
  __pyx_t_2 = __pyx_f_5pysam_7libcbcf_bcf_get_value_count(__pyx_v_record, BCF_HL_INFO, __pyx_v_z->key, (&__pyx_v_count), (&__pyx_v_scalar), -1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 544, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

  /* "pysam/libcbcf.pyx":546
 *     bcf_get_value_count(record, BCF_HL_INFO, z.key, &count, &scalar, -1)
 * 
 *     if z.len == 0:             # <<<<<<<<<<<<<<
 *         if  bcf_hdr_id2type(hdr, BCF_HL_INFO, z.key) == BCF_HT_FLAG:
 *             value = True
*/
  switch (__pyx_v_z->len) {
    case 0:

    /* "pysam/libcbcf.pyx":547
 * 
 *     if z.len == 0:
 *         if  bcf_hdr_id2type(hdr, BCF_HL_INFO, z.key) == BCF_HT_FLAG:             # <<<<<<<<<<<<<<
 *             value = True
 *         elif scalar:
*/
    __pyx_t_1 = (bcf_hdr_id2type(__pyx_v_hdr, BCF_HL_INFO, __pyx_v_z->key) == BCF_HT_FLAG);
    if (__pyx_t_1) {

      /* "pysam/libcbcf.pyx":548
 *     if z.len == 0:
 *         if  bcf_hdr_id2type(hdr, BCF_HL_INFO, z.key) == BCF_HT_FLAG:
 *             value = True             # <<<<<<<<<<<<<<
 *         elif scalar:
 *             value = None
*/
      __Pyx_INCREF(Py_True);
      __pyx_v_value = Py_True;

      /* "pysam/libcbcf.pyx":547
 * 
 *     if z.len == 0:
 *         if  bcf_hdr_id2type(hdr, BCF_HL_INFO, z.key) == BCF_HT_FLAG:             # <<<<<<<<<<<<<<
 *             value = True
 *         elif scalar:
*/
      goto __pyx_L4;
    }

    /* "pysam/libcbcf.pyx":549
 *         if  bcf_hdr_id2type(hdr, BCF_HL_INFO, z.key) == BCF_HT_FLAG:
 *             value = True
 *         elif scalar:             # <<<<<<<<<<<<<<
 *             value = None
 *         else:
*/
    __pyx_t_1 = (__pyx_v_scalar != 0);
    if (__pyx_t_1) {

      /* "pysam/libcbcf.pyx":550
 *             value = True
 *         elif scalar:
 *             value = None             # <<<<<<<<<<<<<<
 *         else:
 *             value = ()
*/
      __Pyx_INCREF(Py_None);
      __pyx_v_value = Py_None;

      /* "pysam/libcbcf.pyx":549
 *         if  bcf_hdr_id2type(hdr, BCF_HL_INFO, z.key) == BCF_HT_FLAG:
 *             value = True
 *         elif scalar:             # <<<<<<<<<<<<<<
 *             value = None
 *         else:
*/
      goto __pyx_L4;
    }

    /* "pysam/libcbcf.pyx":552
 *             value = None
 *         else:
 *             value = ()             # <<<<<<<<<<<<<<
 *     elif z.len == 1:
 *         if z.type == BCF_BT_INT8:
*/
    /*else*/ {
      __Pyx_INCREF(__pyx_mstate_global->__pyx_empty_tuple);
      __pyx_v_value = __pyx_mstate_global->__pyx_empty_tuple;
    }
    __pyx_L4:;

    /* "pysam/libcbcf.pyx":546
 *     bcf_get_value_count(record, BCF_HL_INFO, z.key, &count, &scalar, -1)
 * 
 *     if z.len == 0:             # <<<<<<<<<<<<<<
 *         if  bcf_hdr_id2type(hdr, BCF_HL_INFO, z.key) == BCF_HT_FLAG:
 *             value = True
*/
    break;
    case 1:

    /* "pysam/libcbcf.pyx":554
 *             value = ()
 *     elif z.len == 1:
 *         if z.type == BCF_BT_INT8:             # <<<<<<<<<<<<<<
 *             value = z.v1.i if z.v1.i != bcf_int8_missing else None
 *         elif z.type == BCF_BT_INT16:
*/
    __pyx_t_1 = (__pyx_v_z->type == BCF_BT_INT8);
    if (__pyx_t_1) {

      /* "pysam/libcbcf.pyx":555
 *     elif z.len == 1:
 *         if z.type == BCF_BT_INT8:
 *             value = z.v1.i if z.v1.i != bcf_int8_missing else None             # <<<<<<<<<<<<<<
 *         elif z.type == BCF_BT_INT16:
 *             value = z.v1.i if z.v1.i != bcf_int16_missing else None
*/
      __pyx_t_1 = (__pyx_v_z->v1.i != bcf_int8_missing);
      if (__pyx_t_1) {
        __pyx_t_4 = __Pyx_PyLong_From_int32_t(__pyx_v_z->v1.i); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 555, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_4);
        __pyx_t_2 = __pyx_t_4;
        __pyx_t_4 = 0;
      } else {
        __Pyx_INCREF(Py_None);
        __pyx_t_2 = Py_None;
      }
      __pyx_v_value = __pyx_t_2;
      __pyx_t_2 = 0;

      /* "pysam/libcbcf.pyx":554
 *             value = ()
 *     elif z.len == 1:
 *         if z.type == BCF_BT_INT8:             # <<<<<<<<<<<<<<
 *             value = z.v1.i if z.v1.i != bcf_int8_missing else None
 *         elif z.type == BCF_BT_INT16:
*/
      goto __pyx_L5;
    }

    /* "pysam/libcbcf.pyx":556
 *         if z.type == BCF_BT_INT8:
 *             value = z.v1.i if z.v1.i != bcf_int8_missing else None
 *         elif z.type == BCF_BT_INT16:             # <<<<<<<<<<<<<<
 *             value = z.v1.i if z.v1.i != bcf_int16_missing else None
 *         elif z.type == BCF_BT_INT32:
*/
    __pyx_t_1 = (__pyx_v_z->type == BCF_BT_INT16);
    if (__pyx_t_1) {

      /* "pysam/libcbcf.pyx":557
 *             value = z.v1.i if z.v1.i != bcf_int8_missing else None
 *         elif z.type == BCF_BT_INT16:
 *             value = z.v1.i if z.v1.i != bcf_int16_missing else None             # <<<<<<<<<<<<<<
 *         elif z.type == BCF_BT_INT32:
 *             value = z.v1.i if z.v1.i != bcf_int32_missing else None
*/
      __pyx_t_1 = (__pyx_v_z->v1.i != bcf_int16_missing);
      if (__pyx_t_1) {
        __pyx_t_4 = __Pyx_PyLong_From_int32_t(__pyx_v_z->v1.i); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 557, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_4);
        __pyx_t_2 = __pyx_t_4;
        __pyx_t_4 = 0;
      } else {
        __Pyx_INCREF(Py_None);
        __pyx_t_2 = Py_None;
      }
      __pyx_v_value = __pyx_t_2;
      __pyx_t_2 = 0;

      /* "pysam/libcbcf.pyx":556
 *         if z.type == BCF_BT_INT8:
 *             value = z.v1.i if z.v1.i != bcf_int8_missing else None
 *         elif z.type == BCF_BT_INT16:             # <<<<<<<<<<<<<<
 *             value = z.v1.i if z.v1.i != bcf_int16_missing else None
 *         elif z.type == BCF_BT_INT32:
*/
      goto __pyx_L5;
    }

    /* "pysam/libcbcf.pyx":558
 *         elif z.type == BCF_BT_INT16:
 *             value = z.v1.i if z.v1.i != bcf_int16_missing else None
 *         elif z.type == BCF_BT_INT32:             # <<<<<<<<<<<<<<
 *             value = z.v1.i if z.v1.i != bcf_int32_missing else None
 *         elif z.type == BCF_BT_FLOAT:
*/
    __pyx_t_1 = (__pyx_v_z->type == BCF_BT_INT32);
    if (__pyx_t_1) {

      /* "pysam/libcbcf.pyx":559
 *             value = z.v1.i if z.v1.i != bcf_int16_missing else None
 *         elif z.type == BCF_BT_INT32:
 *             value = z.v1.i if z.v1.i != bcf_int32_missing else None             # <<<<<<<<<<<<<<
 *         elif z.type == BCF_BT_FLOAT:
 *             value = z.v1.f if not bcf_float_is_missing(z.v1.f) else None
*/
      __pyx_t_1 = (__pyx_v_z->v1.i != bcf_int32_missing);
      if (__pyx_t_1) {
        __pyx_t_4 = __Pyx_PyLong_From_int32_t(__pyx_v_z->v1.i); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 559, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_4);
        __pyx_t_2 = __pyx_t_4;
        __pyx_t_4 = 0;
      } else {
        __Pyx_INCREF(Py_None);
        __pyx_t_2 = Py_None;
      }
      __pyx_v_value = __pyx_t_2;
      __pyx_t_2 = 0;

      /* "pysam/libcbcf.pyx":558
 *         elif z.type == BCF_BT_INT16:
 *             value = z.v1.i if z.v1.i != bcf_int16_missing else None
 *         elif z.type == BCF_BT_INT32:             # <<<<<<<<<<<<<<
 *             value = z.v1.i if z.v1.i != bcf_int32_missing else None
 *         elif z.type == BCF_BT_FLOAT:
*/
      goto __pyx_L5;
    }

    /* "pysam/libcbcf.pyx":560
 *         elif z.type == BCF_BT_INT32:
 *             value = z.v1.i if z.v1.i != bcf_int32_missing else None
 *         elif z.type == BCF_BT_FLOAT:             # <<<<<<<<<<<<<<
 *             value = z.v1.f if not bcf_float_is_missing(z.v1.f) else None
 *         elif z.type == BCF_BT_CHAR:
*/
    __pyx_t_1 = (__pyx_v_z->type == BCF_BT_FLOAT);
    if (__pyx_t_1) {

      /* "pysam/libcbcf.pyx":561
 *             value = z.v1.i if z.v1.i != bcf_int32_missing else None
 *         elif z.type == BCF_BT_FLOAT:
 *             value = z.v1.f if not bcf_float_is_missing(z.v1.f) else None             # <<<<<<<<<<<<<<
 *         elif z.type == BCF_BT_CHAR:
 *             value = force_str(chr(z.v1.i))
*/
      __pyx_t_1 = (!(bcf_float_is_missing(__pyx_v_z->v1.f) != 0));
      if (__pyx_t_1) {
        __pyx_t_4 = PyFloat_FromDouble(__pyx_v_z->v1.f); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 561, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_4);
        __pyx_t_2 = __pyx_t_4;
        __pyx_t_4 = 0;
      } else {
        __Pyx_INCREF(Py_None);
        __pyx_t_2 = Py_None;
      }
      __pyx_v_value = __pyx_t_2;
      __pyx_t_2 = 0;

      /* "pysam/libcbcf.pyx":560
 *         elif z.type == BCF_BT_INT32:
 *             value = z.v1.i if z.v1.i != bcf_int32_missing else None
 *         elif z.type == BCF_BT_FLOAT:             # <<<<<<<<<<<<<<
 *             value = z.v1.f if not bcf_float_is_missing(z.v1.f) else None
 *         elif z.type == BCF_BT_CHAR:
*/
      goto __pyx_L5;
    }

    /* "pysam/libcbcf.pyx":562
 *         elif z.type == BCF_BT_FLOAT:
 *             value = z.v1.f if not bcf_float_is_missing(z.v1.f) else None
 *         elif z.type == BCF_BT_CHAR:             # <<<<<<<<<<<<<<
 *             value = force_str(chr(z.v1.i))
 *         else:
*/
    __pyx_t_1 = (__pyx_v_z->type == BCF_BT_CHAR);
    if (likely(__pyx_t_1)) {

      /* "pysam/libcbcf.pyx":563
 *             value = z.v1.f if not bcf_float_is_missing(z.v1.f) else None
 *         elif z.type == BCF_BT_CHAR:
 *             value = force_str(chr(z.v1.i))             # <<<<<<<<<<<<<<
 *         else:
 *             raise TypeError('unsupported info type code')
*/
      __pyx_t_2 = PyUnicode_FromOrdinal(__pyx_v_z->v1.i); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 563, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_2);
      __pyx_t_4 = __pyx_f_5pysam_9libcutils_force_str(__pyx_t_2, NULL); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 563, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_4);
      __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
      __pyx_v_value = __pyx_t_4;
      __pyx_t_4 = 0;

      /* "pysam/libcbcf.pyx":562
 *         elif z.type == BCF_BT_FLOAT:
 *             value = z.v1.f if not bcf_float_is_missing(z.v1.f) else None
 *         elif z.type == BCF_BT_CHAR:             # <<<<<<<<<<<<<<
 *             value = force_str(chr(z.v1.i))
 *         else:
*/
      goto __pyx_L5;
    }

    /* "pysam/libcbcf.pyx":565
 *             value = force_str(chr(z.v1.i))
 *         else:
 *             raise TypeError('unsupported info type code')             # <<<<<<<<<<<<<<
 * 
 *         if not scalar and value != ():
*/
    /*else*/ {
      __pyx_t_2 = NULL;
      __Pyx_INCREF(__pyx_builtin_TypeError);
      __pyx_t_3 = __pyx_builtin_TypeError; 
      __pyx_t_5 = 1;
      {
        PyObject *__pyx_callargs[2] = {__pyx_t_2, __pyx_mstate_global->__pyx_kp_u_unsupported_info_type_code};
        __pyx_t_4 = __Pyx_PyObject_FastCall(__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_3); __pyx_t_3 = 0;
        if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 565, __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, 565, __pyx_L1_error)
    }
    __pyx_L5:;

    /* "pysam/libcbcf.pyx":567
 *             raise TypeError('unsupported info type code')
 * 
 *         if not scalar and value != ():             # <<<<<<<<<<<<<<
 *             value = (value,)
 *     else:
*/
    __pyx_t_7 = (!(__pyx_v_scalar != 0));
    if (__pyx_t_7) {
    } else {
      __pyx_t_1 = __pyx_t_7;
      goto __pyx_L7_bool_binop_done;
    }
    __pyx_t_4 = PyObject_RichCompare(__pyx_v_value, __pyx_mstate_global->__pyx_empty_tuple, Py_NE); __Pyx_XGOTREF(__pyx_t_4); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 567, __pyx_L1_error)
    __pyx_t_7 = __Pyx_PyObject_IsTrue(__pyx_t_4); if (unlikely((__pyx_t_7 < 0))) __PYX_ERR(0, 567, __pyx_L1_error)
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    __pyx_t_1 = __pyx_t_7;
    __pyx_L7_bool_binop_done:;
    if (__pyx_t_1) {

      /* "pysam/libcbcf.pyx":568
 * 
 *         if not scalar and value != ():
 *             value = (value,)             # <<<<<<<<<<<<<<
 *     else:
 *         value = bcf_array_to_object(z.vptr, z.type, z.len, count, scalar)
*/
      __pyx_t_4 = PyTuple_New(1); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 568, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_4);
      __Pyx_INCREF(__pyx_v_value);
      __Pyx_GIVEREF(__pyx_v_value);
      if (__Pyx_PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_v_value) != (0)) __PYX_ERR(0, 568, __pyx_L1_error);
      __Pyx_DECREF_SET(__pyx_v_value, __pyx_t_4);
      __pyx_t_4 = 0;

      /* "pysam/libcbcf.pyx":567
 *             raise TypeError('unsupported info type code')
 * 
 *         if not scalar and value != ():             # <<<<<<<<<<<<<<
 *             value = (value,)
 *     else:
*/
    }

    /* "pysam/libcbcf.pyx":553
 *         else:
 *             value = ()
 *     elif z.len == 1:             # <<<<<<<<<<<<<<
 *         if z.type == BCF_BT_INT8:
 *             value = z.v1.i if z.v1.i != bcf_int8_missing else None
*/
    break;
    default:

    /* "pysam/libcbcf.pyx":570
 *             value = (value,)
 *     else:
 *         value = bcf_array_to_object(z.vptr, z.type, z.len, count, scalar)             # <<<<<<<<<<<<<<
 * 
 *     return value
*/
    __pyx_t_4 = __pyx_f_5pysam_7libcbcf_bcf_array_to_object(__pyx_v_z->vptr, __pyx_v_z->type, __pyx_v_z->len, __pyx_v_count, __pyx_v_scalar); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 570, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
    __pyx_v_value = __pyx_t_4;
    __pyx_t_4 = 0;
    break;
  }

  /* "pysam/libcbcf.pyx":572
 *         value = bcf_array_to_object(z.vptr, z.type, z.len, count, scalar)
 * 
 *     return value             # <<<<<<<<<<<<<<
 * 
 * 
*/
  __Pyx_XDECREF(__pyx_r);
  __Pyx_INCREF(__pyx_v_value);
  __pyx_r = __pyx_v_value;
  __Pyx_TraceReturnValue(__pyx_r, 143, 0, __PYX_ERR(0, 572, __pyx_L1_error));
  goto __pyx_L0;

  /* "pysam/libcbcf.pyx":534
 * 
 * 
 * cdef object bcf_info_get_value(VariantRecord record, const bcf_info_t *z):             # <<<<<<<<<<<<<<
 *     if record is None:
 *         raise ValueError('record must not be None')
*/

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_TraceException(__pyx_lineno, 0, 0);
  #if CYTHON_USE_SYS_MONITORING
  __Pyx_TraceExceptionUnwind(0, 0);
  #else
  __Pyx_TraceReturnValue(NULL, 0, 0, __PYX_ERR(0, 534, __pyx_L1_error));
  #endif
  __Pyx_AddTraceback("pysam.libcbcf.bcf_info_get_value", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_value);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_PyMonitoring_ExitScope(0);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}
static PyObject *__pyx_gb_5pysam_7libcbcf_16bcf_check_values_2generator31(__pyx_CoroutineObject *__pyx_generator, CYTHON_UNUSED PyThreadState *__pyx_tstate, PyObject *__pyx_sent_value); /* proto */

/* "pysam/libcbcf.pyx":614
 *                 raise ValueError('Integer value too small/large to store in VCF/BCF')
 *     elif ht_type == BCF_HT_STR:
 *         values = b','.join(force_bytes(v) if v is not None else b'' for v in values)             # <<<<<<<<<<<<<<
 *     elif ht_type == BCF_HT_FLAG:
 *         if values[0] not in (True, False, None, 1, 0):
*/

static PyObject *__pyx_pf_5pysam_7libcbcf_16bcf_check_values_genexpr(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_genexpr_arg_0) {
  struct __pyx_obj_5pysam_7libcbcf___pyx_scope_struct_4_genexpr *__pyx_cur_scope;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("genexpr", 0);
  __pyx_cur_scope = (struct __pyx_obj_5pysam_7libcbcf___pyx_scope_struct_4_genexpr *)__pyx_tp_new_5pysam_7libcbcf___pyx_scope_struct_4_genexpr(__pyx_mstate_global->__pyx_ptype_5pysam_7libcbcf___pyx_scope_struct_4_genexpr, __pyx_mstate_global->__pyx_empty_tuple, NULL);
  if (unlikely(!__pyx_cur_scope)) {
    __pyx_cur_scope = ((struct __pyx_obj_5pysam_7libcbcf___pyx_scope_struct_4_genexpr *)Py_None);
    __Pyx_INCREF(Py_None);
    __PYX_ERR(0, 614, __pyx_L1_error)
  } else {
    __Pyx_GOTREF((PyObject *)__pyx_cur_scope);
  }
  __pyx_cur_scope->__pyx_genexpr_arg_0 = __pyx_genexpr_arg_0;
  __Pyx_INCREF(__pyx_cur_scope->__pyx_genexpr_arg_0);
  __Pyx_GIVEREF(__pyx_cur_scope->__pyx_genexpr_arg_0);
  {
    __pyx_CoroutineObject *gen = __Pyx_Generator_New((__pyx_coroutine_body_t) __pyx_gb_5pysam_7libcbcf_16bcf_check_values_2generator31, ((PyObject *)__pyx_mstate_global->__pyx_codeobj_tab[16]), (PyObject *) __pyx_cur_scope, __pyx_mstate_global->__pyx_n_u_genexpr, __pyx_mstate_global->__pyx_n_u_bcf_check_values_locals_genexpr, __pyx_mstate_global->__pyx_n_u_pysam_libcbcf); if (unlikely(!gen)) __PYX_ERR(0, 614, __pyx_L1_error)
    __Pyx_DECREF(__pyx_cur_scope);
    __Pyx_RefNannyFinishContext();
    return (PyObject *) gen;
  }

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_AddTraceback("pysam.libcbcf.bcf_check_values.genexpr", __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_5pysam_7libcbcf_16bcf_check_values_2generator31(__pyx_CoroutineObject *__pyx_generator, CYTHON_UNUSED PyThreadState *__pyx_tstate, PyObject *__pyx_sent_value) /* generator body */
{
  struct __pyx_obj_5pysam_7libcbcf___pyx_scope_struct_4_genexpr *__pyx_cur_scope = ((struct __pyx_obj_5pysam_7libcbcf___pyx_scope_struct_4_genexpr *)__pyx_generator->closure);
  PyObject *__pyx_r = NULL;
  __Pyx_TraceDeclarationsGen
  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;
  PyObject *__pyx_t_6 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("genexpr", 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_TraceStartGen("genexpr", __pyx_f[0], 614, 0, 0, 0, __PYX_ERR(0, 614, __pyx_L1_error));
    __Pyx_TraceReturnValue(Py_None, 0, 0, __PYX_ERR(0, 614, __pyx_L1_error));
    __Pyx_RefNannyFinishContext();
    return NULL;
  }
  __pyx_L3_first_run:;
  __Pyx_TraceStartGen("genexpr", __pyx_f[0], 614, 0, 0, 0, __PYX_ERR(0, 614, __pyx_L1_error));
  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, 614, __pyx_L1_error)
  }
  if (unlikely(!__pyx_cur_scope->__pyx_genexpr_arg_0)) { __Pyx_RaiseUnboundLocalError(".0"); __PYX_ERR(0, 614, __pyx_L1_error) }
  if (likely(PyList_CheckExact(__pyx_cur_scope->__pyx_genexpr_arg_0)) || PyTuple_CheckExact(__pyx_cur_scope->__pyx_genexpr_arg_0)) {
    __pyx_t_1 = __pyx_cur_scope->__pyx_genexpr_arg_0; __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_genexpr_arg_0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 614, __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, 614, __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, 614, __pyx_L1_error)
          #endif
          if (__pyx_t_2 >= __pyx_temp) break;
        }
        __pyx_t_4 = __Pyx_PyList_GetItemRef(__pyx_t_1, __pyx_t_2);
        ++__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, 614, __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, 614, __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, 614, __pyx_L1_error)
          PyErr_Clear();
        }
        break;
      }
    }
    __Pyx_GOTREF(__pyx_t_4);
    __Pyx_XGOTREF(__pyx_cur_scope->__pyx_v_v);
    __Pyx_XDECREF_SET(__pyx_cur_scope->__pyx_v_v, __pyx_t_4);
    __Pyx_GIVEREF(__pyx_t_4);
    __pyx_t_4 = 0;
    __pyx_t_5 = (__pyx_cur_scope->__pyx_v_v != Py_None);
    if (__pyx_t_5) {
      __pyx_t_6 = __pyx_f_5pysam_9libcutils_force_bytes(__pyx_cur_scope->__pyx_v_v, NULL); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 614, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_6);
      __pyx_t_4 = __pyx_t_6;
      __pyx_t_6 = 0;
    } else {
      __Pyx_INCREF(__pyx_mstate_global->__pyx_kp_b__2);
      __pyx_t_4 = __pyx_mstate_global->__pyx_kp_b__2;
    }
    __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_TraceYield(__pyx_r, 0, __PYX_ERR(0, 614, __pyx_L1_error));
    __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_TraceResumeGen("genexpr", __pyx_f[0], 614, 0, __PYX_ERR(0, 614, __pyx_L1_error));
    __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, 614, __pyx_L1_error)
  }
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  CYTHON_MAYBE_UNUSED_VAR(__pyx_cur_scope);
  __Pyx_TraceReturnValue(Py_None, 0, 0, __PYX_ERR(0, 614, __pyx_L1_error));

  /* 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_6);
  if (__Pyx_PyErr_Occurred()) {
    __Pyx_TraceException(__pyx_lineno, 0, 0);
    __Pyx_Generator_Replace_StopIteration(0);
    __Pyx_AddTraceback("genexpr", __pyx_clineno, __pyx_lineno, __pyx_filename);
    __Pyx_TraceExceptionUnwind(0, 0);
  }
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_PyMonitoring_ExitScope(0);
  #if !CYTHON_USE_EXC_INFO_STACK
  __Pyx_Coroutine_ResetAndClearException(__pyx_generator);
  #endif
  __pyx_generator->resume_label = -1;
  __Pyx_Coroutine_clear((PyObject*)__pyx_generator);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "pysam/libcbcf.pyx":575
 * 
 * 
 * cdef object bcf_check_values(VariantRecord record, value, int sample,             # <<<<<<<<<<<<<<
 *                              int hl_type, int ht_type,
 *                              int id, int bt_type, ssize_t bt_len,
*/

static PyObject *__pyx_f_5pysam_7libcbcf_bcf_check_values(struct __pyx_obj_5pysam_7libcbcf_VariantRecord *__pyx_v_record, PyObject *__pyx_v_value, int __pyx_v_sample, int __pyx_v_hl_type, int __pyx_v_ht_type, int __pyx_v_id, int __pyx_v_bt_type, Py_ssize_t __pyx_v_bt_len, Py_ssize_t *__pyx_v_value_count, int *__pyx_v_scalar, int *__pyx_v_realloc) {
  PyObject *__pyx_v_values = NULL;
  int __pyx_v_given;
  PyObject *__pyx_v_v = NULL;
  PyObject *__pyx_gb_5pysam_7libcbcf_16bcf_check_values_2generator31 = 0;
  PyObject *__pyx_r = NULL;
  __Pyx_TraceDeclarationsFunc
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  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;
  Py_ssize_t __pyx_t_8;
  PyObject *__pyx_t_9 = NULL;
  PyObject *__pyx_t_10 = NULL;
  PyObject *__pyx_t_11 = NULL;
  PyObject *__pyx_t_12 = NULL;
  PyObject *(*__pyx_t_13)(PyObject *);
  int __pyx_t_14;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_TraceFrameInit(((PyObject *)__pyx_mstate_global->__pyx_codeobj_tab[17]))
  __Pyx_RefNannySetupContext("bcf_check_values", 0);
  __Pyx_TraceStartFunc("bcf_check_values", __pyx_f[0], 575, 0, 0, 0, __PYX_ERR(0, 575, __pyx_L1_error));

  /* "pysam/libcbcf.pyx":580
 *                              ssize_t *value_count, int *scalar, int *realloc):
 * 
 *     if record is None:             # <<<<<<<<<<<<<<
 *         raise ValueError('record must not be None')
 * 
*/
  __pyx_t_1 = (((PyObject *)__pyx_v_record) == Py_None);
  if (unlikely(__pyx_t_1)) {

    /* "pysam/libcbcf.pyx":581
 * 
 *     if record is None:
 *         raise ValueError('record must not be None')             # <<<<<<<<<<<<<<
 * 
 *     bcf_get_value_count(record, hl_type, id, value_count, scalar, sample)
*/
    __pyx_t_3 = NULL;
    __Pyx_INCREF(__pyx_builtin_ValueError);
    __pyx_t_4 = __pyx_builtin_ValueError; 
    __pyx_t_5 = 1;
    {
      PyObject *__pyx_callargs[2] = {__pyx_t_3, __pyx_mstate_global->__pyx_kp_u_record_must_not_be_None};
      __pyx_t_2 = __Pyx_PyObject_FastCall(__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_2)) __PYX_ERR(0, 581, __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, 581, __pyx_L1_error)

    /* "pysam/libcbcf.pyx":580
 *                              ssize_t *value_count, int *scalar, int *realloc):
 * 
 *     if record is None:             # <<<<<<<<<<<<<<
 *         raise ValueError('record must not be None')
 * 
*/
  }

  /* "pysam/libcbcf.pyx":583
 *         raise ValueError('record must not be None')
 * 
 *     bcf_get_value_count(record, hl_type, id, value_count, scalar, sample)             # <<<<<<<<<<<<<<
 * 
 *     # Validate values now that we know the type and size
*/
  __pyx_t_2 = __pyx_f_5pysam_7libcbcf_bcf_get_value_count(__pyx_v_record, __pyx_v_hl_type, __pyx_v_id, __pyx_v_value_count, __pyx_v_scalar, __pyx_v_sample); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 583, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

  /* "pysam/libcbcf.pyx":586
 * 
 *     # Validate values now that we know the type and size
 *     values = (value,) if not isinstance(value, (list, tuple)) else value             # <<<<<<<<<<<<<<
 * 
 *     # Validate values now that we know the type and size
*/
  __pyx_t_6 = PyList_Check(__pyx_v_value); 
  if (!__pyx_t_6) {
  } else {
    __pyx_t_1 = __pyx_t_6;
    goto __pyx_L4_bool_binop_done;
  }
  __pyx_t_6 = PyTuple_Check(__pyx_v_value); 
  __pyx_t_1 = __pyx_t_6;
  __pyx_L4_bool_binop_done:;
  __pyx_t_6 = (!__pyx_t_1);
  if (__pyx_t_6) {
    __pyx_t_4 = PyTuple_New(1); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 586, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
    __Pyx_INCREF(__pyx_v_value);
    __Pyx_GIVEREF(__pyx_v_value);
    if (__Pyx_PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_v_value) != (0)) __PYX_ERR(0, 586, __pyx_L1_error);
    __pyx_t_2 = __pyx_t_4;
    __pyx_t_4 = 0;
  } else {
    __Pyx_INCREF(__pyx_v_value);
    __pyx_t_2 = __pyx_v_value;
  }
  __pyx_v_values = __pyx_t_2;
  __pyx_t_2 = 0;

  /* "pysam/libcbcf.pyx":589
 * 
 *     # Validate values now that we know the type and size
 *     if ht_type == BCF_HT_FLAG:             # <<<<<<<<<<<<<<
 *         value_count[0] = 1
 *     elif hl_type == BCF_HL_FMT and is_gt_fmt(record.header.ptr, id):
*/
  __pyx_t_6 = (__pyx_v_ht_type == BCF_HT_FLAG);
  if (__pyx_t_6) {

    /* "pysam/libcbcf.pyx":590
 *     # Validate values now that we know the type and size
 *     if ht_type == BCF_HT_FLAG:
 *         value_count[0] = 1             # <<<<<<<<<<<<<<
 *     elif hl_type == BCF_HL_FMT and is_gt_fmt(record.header.ptr, id):
 *         # KBJ: htslib lies about the cardinality of GT fields-- they're really VLEN (-1)
*/
    (__pyx_v_value_count[0]) = 1;

    /* "pysam/libcbcf.pyx":589
 * 
 *     # Validate values now that we know the type and size
 *     if ht_type == BCF_HT_FLAG:             # <<<<<<<<<<<<<<
 *         value_count[0] = 1
 *     elif hl_type == BCF_HL_FMT and is_gt_fmt(record.header.ptr, id):
*/
    goto __pyx_L6;
  }

  /* "pysam/libcbcf.pyx":591
 *     if ht_type == BCF_HT_FLAG:
 *         value_count[0] = 1
 *     elif hl_type == BCF_HL_FMT and is_gt_fmt(record.header.ptr, id):             # <<<<<<<<<<<<<<
 *         # KBJ: htslib lies about the cardinality of GT fields-- they're really VLEN (-1)
 *         value_count[0] = -1
*/
  __pyx_t_1 = (__pyx_v_hl_type == BCF_HL_FMT);
  if (__pyx_t_1) {
  } else {
    __pyx_t_6 = __pyx_t_1;
    goto __pyx_L7_bool_binop_done;
  }
  __pyx_t_7 = __pyx_f_5pysam_7libcbcf_is_gt_fmt(__pyx_v_record->header->ptr, __pyx_v_id); if (unlikely(__pyx_t_7 == ((int)-1) && PyErr_Occurred())) __PYX_ERR(0, 591, __pyx_L1_error)
  __pyx_t_1 = (__pyx_t_7 != 0);
  __pyx_t_6 = __pyx_t_1;
  __pyx_L7_bool_binop_done:;
  if (__pyx_t_6) {

    /* "pysam/libcbcf.pyx":593
 *     elif hl_type == BCF_HL_FMT and is_gt_fmt(record.header.ptr, id):
 *         # KBJ: htslib lies about the cardinality of GT fields-- they're really VLEN (-1)
 *         value_count[0] = -1             # <<<<<<<<<<<<<<
 * 
 *     cdef int given = len(values)
*/
    (__pyx_v_value_count[0]) = -1L;

    /* "pysam/libcbcf.pyx":591
 *     if ht_type == BCF_HT_FLAG:
 *         value_count[0] = 1
 *     elif hl_type == BCF_HL_FMT and is_gt_fmt(record.header.ptr, id):             # <<<<<<<<<<<<<<
 *         # KBJ: htslib lies about the cardinality of GT fields-- they're really VLEN (-1)
 *         value_count[0] = -1
*/
  }
  __pyx_L6:;

  /* "pysam/libcbcf.pyx":595
 *         value_count[0] = -1
 * 
 *     cdef int given = len(values)             # <<<<<<<<<<<<<<
 *     if value_count[0] != -1 and value_count[0] != given:
 *         if scalar[0]:
*/
  __pyx_t_8 = PyObject_Length(__pyx_v_values); if (unlikely(__pyx_t_8 == ((Py_ssize_t)-1))) __PYX_ERR(0, 595, __pyx_L1_error)
  __pyx_v_given = __pyx_t_8;

  /* "pysam/libcbcf.pyx":596
 * 
 *     cdef int given = len(values)
 *     if value_count[0] != -1 and value_count[0] != given:             # <<<<<<<<<<<<<<
 *         if scalar[0]:
 *             raise TypeError('value expected to be scalar, given len={}'.format(given))
*/
  __pyx_t_1 = ((__pyx_v_value_count[0]) != -1L);
  if (__pyx_t_1) {
  } else {
    __pyx_t_6 = __pyx_t_1;
    goto __pyx_L10_bool_binop_done;
  }
  __pyx_t_1 = ((__pyx_v_value_count[0]) != __pyx_v_given);
  __pyx_t_6 = __pyx_t_1;
  __pyx_L10_bool_binop_done:;
  if (__pyx_t_6) {

    /* "pysam/libcbcf.pyx":597
 *     cdef int given = len(values)
 *     if value_count[0] != -1 and value_count[0] != given:
 *         if scalar[0]:             # <<<<<<<<<<<<<<
 *             raise TypeError('value expected to be scalar, given len={}'.format(given))
 *         else:
*/
    __pyx_t_6 = ((__pyx_v_scalar[0]) != 0);
    if (unlikely(__pyx_t_6)) {

      /* "pysam/libcbcf.pyx":598
 *     if value_count[0] != -1 and value_count[0] != given:
 *         if scalar[0]:
 *             raise TypeError('value expected to be scalar, given len={}'.format(given))             # <<<<<<<<<<<<<<
 *         else:
 *             raise TypeError('values expected to be {}-tuple, given len={}'.format(value_count[0], given))
*/
      __pyx_t_4 = NULL;
      __Pyx_INCREF(__pyx_builtin_TypeError);
      __pyx_t_3 = __pyx_builtin_TypeError; 
      __pyx_t_10 = __pyx_mstate_global->__pyx_kp_u_value_expected_to_be_scalar_give;
      __Pyx_INCREF(__pyx_t_10);
      __pyx_t_11 = __Pyx_PyLong_From_int(__pyx_v_given); if (unlikely(!__pyx_t_11)) __PYX_ERR(0, 598, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_11);
      __pyx_t_5 = 0;
      {
        PyObject *__pyx_callargs[2] = {__pyx_t_10, __pyx_t_11};
        __pyx_t_9 = __Pyx_PyObject_FastCallMethod(__pyx_mstate_global->__pyx_n_u_format, __pyx_callargs+__pyx_t_5, (2-__pyx_t_5) | (1*__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, 598, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_9);
      }
      __pyx_t_5 = 1;
      {
        PyObject *__pyx_callargs[2] = {__pyx_t_4, __pyx_t_9};
        __pyx_t_2 = __Pyx_PyObject_FastCall(__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_9); __pyx_t_9 = 0;
        __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
        if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 598, __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, 598, __pyx_L1_error)

      /* "pysam/libcbcf.pyx":597
 *     cdef int given = len(values)
 *     if value_count[0] != -1 and value_count[0] != given:
 *         if scalar[0]:             # <<<<<<<<<<<<<<
 *             raise TypeError('value expected to be scalar, given len={}'.format(given))
 *         else:
*/
    }

    /* "pysam/libcbcf.pyx":600
 *             raise TypeError('value expected to be scalar, given len={}'.format(given))
 *         else:
 *             raise TypeError('values expected to be {}-tuple, given len={}'.format(value_count[0], given))             # <<<<<<<<<<<<<<
 * 
 *     if ht_type == BCF_HT_REAL:
*/
    /*else*/ {
      __pyx_t_3 = NULL;
      __Pyx_INCREF(__pyx_builtin_TypeError);
      __pyx_t_9 = __pyx_builtin_TypeError; 
      __pyx_t_11 = __pyx_mstate_global->__pyx_kp_u_values_expected_to_be_tuple_give;
      __Pyx_INCREF(__pyx_t_11);
      __pyx_t_10 = PyLong_FromSsize_t((__pyx_v_value_count[0])); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 600, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_10);
      __pyx_t_12 = __Pyx_PyLong_From_int(__pyx_v_given); if (unlikely(!__pyx_t_12)) __PYX_ERR(0, 600, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_12);
      __pyx_t_5 = 0;
      {
        PyObject *__pyx_callargs[3] = {__pyx_t_11, __pyx_t_10, __pyx_t_12};
        __pyx_t_4 = __Pyx_PyObject_FastCallMethod(__pyx_mstate_global->__pyx_n_u_format, __pyx_callargs+__pyx_t_5, (3-__pyx_t_5) | (1*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
        __Pyx_XDECREF(__pyx_t_11); __pyx_t_11 = 0;
        __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
        __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0;
        if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 600, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_4);
      }
      __pyx_t_5 = 1;
      {
        PyObject *__pyx_callargs[2] = {__pyx_t_3, __pyx_t_4};
        __pyx_t_2 = __Pyx_PyObject_FastCall(__pyx_t_9, __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;
        __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
        if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 600, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_2);
      }
      __Pyx_Raise(__pyx_t_2, 0, 0, 0);
      __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
      __PYX_ERR(0, 600, __pyx_L1_error)
    }

    /* "pysam/libcbcf.pyx":596
 * 
 *     cdef int given = len(values)
 *     if value_count[0] != -1 and value_count[0] != given:             # <<<<<<<<<<<<<<
 *         if scalar[0]:
 *             raise TypeError('value expected to be scalar, given len={}'.format(given))
*/
  }

  /* "pysam/libcbcf.pyx":602
 *             raise TypeError('values expected to be {}-tuple, given len={}'.format(value_count[0], given))
 * 
 *     if ht_type == BCF_HT_REAL:             # <<<<<<<<<<<<<<
 *         for v in values:
 *             if not(v is None or isinstance(v, (float, int))):
*/
  __pyx_t_6 = (__pyx_v_ht_type == BCF_HT_REAL);
  if (__pyx_t_6) {

    /* "pysam/libcbcf.pyx":603
 * 
 *     if ht_type == BCF_HT_REAL:
 *         for v in values:             # <<<<<<<<<<<<<<
 *             if not(v is None or isinstance(v, (float, int))):
 *                 raise TypeError('invalid value for Float format')
*/
    if (likely(PyList_CheckExact(__pyx_v_values)) || PyTuple_CheckExact(__pyx_v_values)) {
      __pyx_t_2 = __pyx_v_values; __Pyx_INCREF(__pyx_t_2);
      __pyx_t_8 = 0;
      __pyx_t_13 = NULL;
    } else {
      __pyx_t_8 = -1; __pyx_t_2 = PyObject_GetIter(__pyx_v_values); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 603, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_2);
      __pyx_t_13 = (CYTHON_COMPILING_IN_LIMITED_API) ? PyIter_Next : __Pyx_PyObject_GetIterNextFunc(__pyx_t_2); if (unlikely(!__pyx_t_13)) __PYX_ERR(0, 603, __pyx_L1_error)
    }
    for (;;) {
      if (likely(!__pyx_t_13)) {
        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, 603, __pyx_L1_error)
            #endif
            if (__pyx_t_8 >= __pyx_temp) break;
          }
          __pyx_t_9 = __Pyx_PyList_GetItemRef(__pyx_t_2, __pyx_t_8);
          ++__pyx_t_8;
        } 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, 603, __pyx_L1_error)
            #endif
            if (__pyx_t_8 >= __pyx_temp) break;
          }
          #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
          __pyx_t_9 = __Pyx_NewRef(PyTuple_GET_ITEM(__pyx_t_2, __pyx_t_8));
          #else
          __pyx_t_9 = __Pyx_PySequence_ITEM(__pyx_t_2, __pyx_t_8);
          #endif
          ++__pyx_t_8;
        }
        if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 603, __pyx_L1_error)
      } else {
        __pyx_t_9 = __pyx_t_13(__pyx_t_2);
        if (unlikely(!__pyx_t_9)) {
          PyObject* exc_type = PyErr_Occurred();
          if (exc_type) {
            if (unlikely(!__Pyx_PyErr_GivenExceptionMatches(exc_type, PyExc_StopIteration))) __PYX_ERR(0, 603, __pyx_L1_error)
            PyErr_Clear();
          }
          break;
        }
      }
      __Pyx_GOTREF(__pyx_t_9);
      __Pyx_XDECREF_SET(__pyx_v_v, __pyx_t_9);
      __pyx_t_9 = 0;

      /* "pysam/libcbcf.pyx":604
 *     if ht_type == BCF_HT_REAL:
 *         for v in values:
 *             if not(v is None or isinstance(v, (float, int))):             # <<<<<<<<<<<<<<
 *                 raise TypeError('invalid value for Float format')
 *     elif ht_type == BCF_HT_INT:
*/
      __pyx_t_1 = (__pyx_v_v == Py_None);
      if (!__pyx_t_1) {
      } else {
        __pyx_t_6 = __pyx_t_1;
        goto __pyx_L17_bool_binop_done;
      }
      __pyx_t_14 = PyFloat_Check(__pyx_v_v); 
      if (!__pyx_t_14) {
      } else {
        __pyx_t_1 = __pyx_t_14;
        goto __pyx_L19_bool_binop_done;
      }
      __pyx_t_14 = PyLong_Check(__pyx_v_v); 
      __pyx_t_1 = __pyx_t_14;
      __pyx_L19_bool_binop_done:;
      __pyx_t_6 = __pyx_t_1;
      __pyx_L17_bool_binop_done:;
      __pyx_t_1 = (!__pyx_t_6);
      if (unlikely(__pyx_t_1)) {

        /* "pysam/libcbcf.pyx":605
 *         for v in values:
 *             if not(v is None or isinstance(v, (float, int))):
 *                 raise TypeError('invalid value for Float format')             # <<<<<<<<<<<<<<
 *     elif ht_type == BCF_HT_INT:
 *         for v in values:
*/
        __pyx_t_4 = NULL;
        __Pyx_INCREF(__pyx_builtin_TypeError);
        __pyx_t_3 = __pyx_builtin_TypeError; 
        __pyx_t_5 = 1;
        {
          PyObject *__pyx_callargs[2] = {__pyx_t_4, __pyx_mstate_global->__pyx_kp_u_invalid_value_for_Float_format};
          __pyx_t_9 = __Pyx_PyObject_FastCall(__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_9)) __PYX_ERR(0, 605, __pyx_L1_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, 605, __pyx_L1_error)

        /* "pysam/libcbcf.pyx":604
 *     if ht_type == BCF_HT_REAL:
 *         for v in values:
 *             if not(v is None or isinstance(v, (float, int))):             # <<<<<<<<<<<<<<
 *                 raise TypeError('invalid value for Float format')
 *     elif ht_type == BCF_HT_INT:
*/
      }

      /* "pysam/libcbcf.pyx":603
 * 
 *     if ht_type == BCF_HT_REAL:
 *         for v in values:             # <<<<<<<<<<<<<<
 *             if not(v is None or isinstance(v, (float, int))):
 *                 raise TypeError('invalid value for Float format')
*/
    }
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

    /* "pysam/libcbcf.pyx":602
 *             raise TypeError('values expected to be {}-tuple, given len={}'.format(value_count[0], given))
 * 
 *     if ht_type == BCF_HT_REAL:             # <<<<<<<<<<<<<<
 *         for v in values:
 *             if not(v is None or isinstance(v, (float, int))):
*/
    goto __pyx_L13;
  }

  /* "pysam/libcbcf.pyx":606
 *             if not(v is None or isinstance(v, (float, int))):
 *                 raise TypeError('invalid value for Float format')
 *     elif ht_type == BCF_HT_INT:             # <<<<<<<<<<<<<<
 *         for v in values:
 *             if not(v is None or (isinstance(v, (float, int)) and int(v) == v)):
*/
  __pyx_t_1 = (__pyx_v_ht_type == BCF_HT_INT);
  if (__pyx_t_1) {

    /* "pysam/libcbcf.pyx":607
 *                 raise TypeError('invalid value for Float format')
 *     elif ht_type == BCF_HT_INT:
 *         for v in values:             # <<<<<<<<<<<<<<
 *             if not(v is None or (isinstance(v, (float, int)) and int(v) == v)):
 *                 raise TypeError('invalid value for Integer format')
*/
    if (likely(PyList_CheckExact(__pyx_v_values)) || PyTuple_CheckExact(__pyx_v_values)) {
      __pyx_t_2 = __pyx_v_values; __Pyx_INCREF(__pyx_t_2);
      __pyx_t_8 = 0;
      __pyx_t_13 = NULL;
    } else {
      __pyx_t_8 = -1; __pyx_t_2 = PyObject_GetIter(__pyx_v_values); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 607, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_2);
      __pyx_t_13 = (CYTHON_COMPILING_IN_LIMITED_API) ? PyIter_Next : __Pyx_PyObject_GetIterNextFunc(__pyx_t_2); if (unlikely(!__pyx_t_13)) __PYX_ERR(0, 607, __pyx_L1_error)
    }
    for (;;) {
      if (likely(!__pyx_t_13)) {
        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, 607, __pyx_L1_error)
            #endif
            if (__pyx_t_8 >= __pyx_temp) break;
          }
          __pyx_t_9 = __Pyx_PyList_GetItemRef(__pyx_t_2, __pyx_t_8);
          ++__pyx_t_8;
        } 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, 607, __pyx_L1_error)
            #endif
            if (__pyx_t_8 >= __pyx_temp) break;
          }
          #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
          __pyx_t_9 = __Pyx_NewRef(PyTuple_GET_ITEM(__pyx_t_2, __pyx_t_8));
          #else
          __pyx_t_9 = __Pyx_PySequence_ITEM(__pyx_t_2, __pyx_t_8);
          #endif
          ++__pyx_t_8;
        }
        if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 607, __pyx_L1_error)
      } else {
        __pyx_t_9 = __pyx_t_13(__pyx_t_2);
        if (unlikely(!__pyx_t_9)) {
          PyObject* exc_type = PyErr_Occurred();
          if (exc_type) {
            if (unlikely(!__Pyx_PyErr_GivenExceptionMatches(exc_type, PyExc_StopIteration))) __PYX_ERR(0, 607, __pyx_L1_error)
            PyErr_Clear();
          }
          break;
        }
      }
      __Pyx_GOTREF(__pyx_t_9);
      __Pyx_XDECREF_SET(__pyx_v_v, __pyx_t_9);
      __pyx_t_9 = 0;

      /* "pysam/libcbcf.pyx":608
 *     elif ht_type == BCF_HT_INT:
 *         for v in values:
 *             if not(v is None or (isinstance(v, (float, int)) and int(v) == v)):             # <<<<<<<<<<<<<<
 *                 raise TypeError('invalid value for Integer format')
 *         for v in values:
*/
      __pyx_t_6 = (__pyx_v_v == Py_None);
      if (!__pyx_t_6) {
      } else {
        __pyx_t_1 = __pyx_t_6;
        goto __pyx_L25_bool_binop_done;
      }
      __pyx_t_14 = PyFloat_Check(__pyx_v_v); 
      if (!__pyx_t_14) {
      } else {
        __pyx_t_6 = __pyx_t_14;
        goto __pyx_L28_bool_binop_done;
      }
      __pyx_t_14 = PyLong_Check(__pyx_v_v); 
      __pyx_t_6 = __pyx_t_14;
      __pyx_L28_bool_binop_done:;
      if (__pyx_t_6) {
      } else {
        __pyx_t_1 = __pyx_t_6;
        goto __pyx_L25_bool_binop_done;
      }
      __pyx_t_9 = __Pyx_PyNumber_Int(__pyx_v_v); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 608, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_9);
      __pyx_t_3 = PyObject_RichCompare(__pyx_t_9, __pyx_v_v, Py_EQ); __Pyx_XGOTREF(__pyx_t_3); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 608, __pyx_L1_error)
      __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
      __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely((__pyx_t_6 < 0))) __PYX_ERR(0, 608, __pyx_L1_error)
      __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
      __pyx_t_1 = __pyx_t_6;
      __pyx_L25_bool_binop_done:;
      __pyx_t_6 = (!__pyx_t_1);
      if (unlikely(__pyx_t_6)) {

        /* "pysam/libcbcf.pyx":609
 *         for v in values:
 *             if not(v is None or (isinstance(v, (float, int)) and int(v) == v)):
 *                 raise TypeError('invalid value for Integer format')             # <<<<<<<<<<<<<<
 *         for v in values:
 *             if not(v is None or bcf_int32_missing < v <= INT32_MAX):
*/
        __pyx_t_9 = NULL;
        __Pyx_INCREF(__pyx_builtin_TypeError);
        __pyx_t_4 = __pyx_builtin_TypeError; 
        __pyx_t_5 = 1;
        {
          PyObject *__pyx_callargs[2] = {__pyx_t_9, __pyx_mstate_global->__pyx_kp_u_invalid_value_for_Integer_format};
          __pyx_t_3 = __Pyx_PyObject_FastCall(__pyx_t_4, __pyx_callargs+__pyx_t_5, (2-__pyx_t_5) | (__pyx_t_5*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
          __Pyx_XDECREF(__pyx_t_9); __pyx_t_9 = 0;
          __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
          if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 609, __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, 609, __pyx_L1_error)

        /* "pysam/libcbcf.pyx":608
 *     elif ht_type == BCF_HT_INT:
 *         for v in values:
 *             if not(v is None or (isinstance(v, (float, int)) and int(v) == v)):             # <<<<<<<<<<<<<<
 *                 raise TypeError('invalid value for Integer format')
 *         for v in values:
*/
      }

      /* "pysam/libcbcf.pyx":607
 *                 raise TypeError('invalid value for Float format')
 *     elif ht_type == BCF_HT_INT:
 *         for v in values:             # <<<<<<<<<<<<<<
 *             if not(v is None or (isinstance(v, (float, int)) and int(v) == v)):
 *                 raise TypeError('invalid value for Integer format')
*/
    }
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

    /* "pysam/libcbcf.pyx":610
 *             if not(v is None or (isinstance(v, (float, int)) and int(v) == v)):
 *                 raise TypeError('invalid value for Integer format')
 *         for v in values:             # <<<<<<<<<<<<<<
 *             if not(v is None or bcf_int32_missing < v <= INT32_MAX):
 *                 raise ValueError('Integer value too small/large to store in VCF/BCF')
*/
    if (likely(PyList_CheckExact(__pyx_v_values)) || PyTuple_CheckExact(__pyx_v_values)) {
      __pyx_t_2 = __pyx_v_values; __Pyx_INCREF(__pyx_t_2);
      __pyx_t_8 = 0;
      __pyx_t_13 = NULL;
    } else {
      __pyx_t_8 = -1; __pyx_t_2 = PyObject_GetIter(__pyx_v_values); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 610, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_2);
      __pyx_t_13 = (CYTHON_COMPILING_IN_LIMITED_API) ? PyIter_Next : __Pyx_PyObject_GetIterNextFunc(__pyx_t_2); if (unlikely(!__pyx_t_13)) __PYX_ERR(0, 610, __pyx_L1_error)
    }
    for (;;) {
      if (likely(!__pyx_t_13)) {
        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, 610, __pyx_L1_error)
            #endif
            if (__pyx_t_8 >= __pyx_temp) break;
          }
          __pyx_t_3 = __Pyx_PyList_GetItemRef(__pyx_t_2, __pyx_t_8);
          ++__pyx_t_8;
        } 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, 610, __pyx_L1_error)
            #endif
            if (__pyx_t_8 >= __pyx_temp) break;
          }
          #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
          __pyx_t_3 = __Pyx_NewRef(PyTuple_GET_ITEM(__pyx_t_2, __pyx_t_8));
          #else
          __pyx_t_3 = __Pyx_PySequence_ITEM(__pyx_t_2, __pyx_t_8);
          #endif
          ++__pyx_t_8;
        }
        if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 610, __pyx_L1_error)
      } else {
        __pyx_t_3 = __pyx_t_13(__pyx_t_2);
        if (unlikely(!__pyx_t_3)) {
          PyObject* exc_type = PyErr_Occurred();
          if (exc_type) {
            if (unlikely(!__Pyx_PyErr_GivenExceptionMatches(exc_type, PyExc_StopIteration))) __PYX_ERR(0, 610, __pyx_L1_error)
            PyErr_Clear();
          }
          break;
        }
      }
      __Pyx_GOTREF(__pyx_t_3);
      __Pyx_XDECREF_SET(__pyx_v_v, __pyx_t_3);
      __pyx_t_3 = 0;

      /* "pysam/libcbcf.pyx":611
 *                 raise TypeError('invalid value for Integer format')
 *         for v in values:
 *             if not(v is None or bcf_int32_missing < v <= INT32_MAX):             # <<<<<<<<<<<<<<
 *                 raise ValueError('Integer value too small/large to store in VCF/BCF')
 *     elif ht_type == BCF_HT_STR:
*/
      __pyx_t_1 = (__pyx_v_v == Py_None);
      if (!__pyx_t_1) {
      } else {
        __pyx_t_6 = __pyx_t_1;
        goto __pyx_L34_bool_binop_done;
      }
      __pyx_t_3 = __Pyx_PyLong_From_int32_t(bcf_int32_missing); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 611, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_3);
      __pyx_t_4 = PyObject_RichCompare(__pyx_t_3, __pyx_v_v, Py_LT); __Pyx_XGOTREF(__pyx_t_4); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 611, __pyx_L1_error)
      if (__Pyx_PyObject_IsTrue(__pyx_t_4)) {
        __Pyx_DECREF(__pyx_t_4);
        __pyx_t_9 = __Pyx_PyLong_From_int32_t(INT32_MAX); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 611, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_9);
        __pyx_t_4 = PyObject_RichCompare(__pyx_v_v, __pyx_t_9, Py_LE); __Pyx_XGOTREF(__pyx_t_4); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 611, __pyx_L1_error)
        __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
      }
      __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
      __pyx_t_1 = __Pyx_PyObject_IsTrue(__pyx_t_4); if (unlikely((__pyx_t_1 < 0))) __PYX_ERR(0, 611, __pyx_L1_error)
      __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
      __pyx_t_6 = __pyx_t_1;
      __pyx_L34_bool_binop_done:;
      __pyx_t_1 = (!__pyx_t_6);
      if (unlikely(__pyx_t_1)) {

        /* "pysam/libcbcf.pyx":612
 *         for v in values:
 *             if not(v is None or bcf_int32_missing < v <= INT32_MAX):
 *                 raise ValueError('Integer value too small/large to store in VCF/BCF')             # <<<<<<<<<<<<<<
 *     elif ht_type == BCF_HT_STR:
 *         values = b','.join(force_bytes(v) if v is not None else b'' for v in values)
*/
        __pyx_t_3 = NULL;
        __Pyx_INCREF(__pyx_builtin_ValueError);
        __pyx_t_9 = __pyx_builtin_ValueError; 
        __pyx_t_5 = 1;
        {
          PyObject *__pyx_callargs[2] = {__pyx_t_3, __pyx_mstate_global->__pyx_kp_u_Integer_value_too_small_large_to};
          __pyx_t_4 = __Pyx_PyObject_FastCall(__pyx_t_9, __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_9); __pyx_t_9 = 0;
          if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 612, __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, 612, __pyx_L1_error)

        /* "pysam/libcbcf.pyx":611
 *                 raise TypeError('invalid value for Integer format')
 *         for v in values:
 *             if not(v is None or bcf_int32_missing < v <= INT32_MAX):             # <<<<<<<<<<<<<<
 *                 raise ValueError('Integer value too small/large to store in VCF/BCF')
 *     elif ht_type == BCF_HT_STR:
*/
      }

      /* "pysam/libcbcf.pyx":610
 *             if not(v is None or (isinstance(v, (float, int)) and int(v) == v)):
 *                 raise TypeError('invalid value for Integer format')
 *         for v in values:             # <<<<<<<<<<<<<<
 *             if not(v is None or bcf_int32_missing < v <= INT32_MAX):
 *                 raise ValueError('Integer value too small/large to store in VCF/BCF')
*/
    }
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

    /* "pysam/libcbcf.pyx":606
 *             if not(v is None or isinstance(v, (float, int))):
 *                 raise TypeError('invalid value for Float format')
 *     elif ht_type == BCF_HT_INT:             # <<<<<<<<<<<<<<
 *         for v in values:
 *             if not(v is None or (isinstance(v, (float, int)) and int(v) == v)):
*/
    goto __pyx_L13;
  }

  /* "pysam/libcbcf.pyx":613
 *             if not(v is None or bcf_int32_missing < v <= INT32_MAX):
 *                 raise ValueError('Integer value too small/large to store in VCF/BCF')
 *     elif ht_type == BCF_HT_STR:             # <<<<<<<<<<<<<<
 *         values = b','.join(force_bytes(v) if v is not None else b'' for v in values)
 *     elif ht_type == BCF_HT_FLAG:
*/
  __pyx_t_1 = (__pyx_v_ht_type == BCF_HT_STR);
  if (__pyx_t_1) {

    /* "pysam/libcbcf.pyx":614
 *                 raise ValueError('Integer value too small/large to store in VCF/BCF')
 *     elif ht_type == BCF_HT_STR:
 *         values = b','.join(force_bytes(v) if v is not None else b'' for v in values)             # <<<<<<<<<<<<<<
 *     elif ht_type == BCF_HT_FLAG:
 *         if values[0] not in (True, False, None, 1, 0):
*/
    __pyx_t_2 = __pyx_pf_5pysam_7libcbcf_16bcf_check_values_genexpr(NULL, __pyx_v_values); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 614, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __pyx_t_4 = __Pyx_PyBytes_Join(__pyx_mstate_global->__pyx_kp_b_, __pyx_t_2); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 614, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    __Pyx_DECREF_SET(__pyx_v_values, __pyx_t_4);
    __pyx_t_4 = 0;

    /* "pysam/libcbcf.pyx":613
 *             if not(v is None or bcf_int32_missing < v <= INT32_MAX):
 *                 raise ValueError('Integer value too small/large to store in VCF/BCF')
 *     elif ht_type == BCF_HT_STR:             # <<<<<<<<<<<<<<
 *         values = b','.join(force_bytes(v) if v is not None else b'' for v in values)
 *     elif ht_type == BCF_HT_FLAG:
*/
    goto __pyx_L13;
  }

  /* "pysam/libcbcf.pyx":615
 *     elif ht_type == BCF_HT_STR:
 *         values = b','.join(force_bytes(v) if v is not None else b'' for v in values)
 *     elif ht_type == BCF_HT_FLAG:             # <<<<<<<<<<<<<<
 *         if values[0] not in (True, False, None, 1, 0):
 *             raise ValueError('Flag values must be: True, False, None, 1, 0')
*/
  __pyx_t_1 = (__pyx_v_ht_type == BCF_HT_FLAG);
  if (likely(__pyx_t_1)) {

    /* "pysam/libcbcf.pyx":616
 *         values = b','.join(force_bytes(v) if v is not None else b'' for v in values)
 *     elif ht_type == BCF_HT_FLAG:
 *         if values[0] not in (True, False, None, 1, 0):             # <<<<<<<<<<<<<<
 *             raise ValueError('Flag values must be: True, False, None, 1, 0')
 *     else:
*/
    __pyx_t_4 = __Pyx_GetItemInt(__pyx_v_values, 0, long, 1, __Pyx_PyLong_From_long, 0, 0, 1, 1); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 616, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
    __pyx_t_2 = PyObject_RichCompare(__pyx_t_4, Py_True, Py_NE); __Pyx_XGOTREF(__pyx_t_2); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 616, __pyx_L1_error)
    __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_2); if (unlikely((__pyx_t_6 < 0))) __PYX_ERR(0, 616, __pyx_L1_error)
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    if (__pyx_t_6) {
    } else {
      __pyx_t_1 = __pyx_t_6;
      goto __pyx_L38_bool_binop_done;
    }
    __pyx_t_2 = PyObject_RichCompare(__pyx_t_4, Py_False, Py_NE); __Pyx_XGOTREF(__pyx_t_2); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 616, __pyx_L1_error)
    __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_2); if (unlikely((__pyx_t_6 < 0))) __PYX_ERR(0, 616, __pyx_L1_error)
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    if (__pyx_t_6) {
    } else {
      __pyx_t_1 = __pyx_t_6;
      goto __pyx_L38_bool_binop_done;
    }
    __pyx_t_2 = PyObject_RichCompare(__pyx_t_4, Py_None, Py_NE); __Pyx_XGOTREF(__pyx_t_2); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 616, __pyx_L1_error)
    __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_2); if (unlikely((__pyx_t_6 < 0))) __PYX_ERR(0, 616, __pyx_L1_error)
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    if (__pyx_t_6) {
    } else {
      __pyx_t_1 = __pyx_t_6;
      goto __pyx_L38_bool_binop_done;
    }
    __pyx_t_6 = (__Pyx_PyLong_BoolNeObjC(__pyx_t_4, __pyx_mstate_global->__pyx_int_1, 1, 0)); if (unlikely((__pyx_t_6 < 0))) __PYX_ERR(0, 616, __pyx_L1_error)
    if (__pyx_t_6) {
    } else {
      __pyx_t_1 = __pyx_t_6;
      goto __pyx_L38_bool_binop_done;
    }
    __pyx_t_6 = (__Pyx_PyLong_BoolNeObjC(__pyx_t_4, __pyx_mstate_global->__pyx_int_0, 0, 0)); if (unlikely((__pyx_t_6 < 0))) __PYX_ERR(0, 616, __pyx_L1_error)
    __pyx_t_1 = __pyx_t_6;
    __pyx_L38_bool_binop_done:;
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    __pyx_t_6 = __pyx_t_1;
    if (unlikely(__pyx_t_6)) {

      /* "pysam/libcbcf.pyx":617
 *     elif ht_type == BCF_HT_FLAG:
 *         if values[0] not in (True, False, None, 1, 0):
 *             raise ValueError('Flag values must be: True, False, None, 1, 0')             # <<<<<<<<<<<<<<
 *     else:
 *         raise TypeError('unsupported type')
*/
      __pyx_t_2 = NULL;
      __Pyx_INCREF(__pyx_builtin_ValueError);
      __pyx_t_9 = __pyx_builtin_ValueError; 
      __pyx_t_5 = 1;
      {
        PyObject *__pyx_callargs[2] = {__pyx_t_2, __pyx_mstate_global->__pyx_kp_u_Flag_values_must_be_True_False_N};
        __pyx_t_4 = __Pyx_PyObject_FastCall(__pyx_t_9, __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_9); __pyx_t_9 = 0;
        if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 617, __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, 617, __pyx_L1_error)

      /* "pysam/libcbcf.pyx":616
 *         values = b','.join(force_bytes(v) if v is not None else b'' for v in values)
 *     elif ht_type == BCF_HT_FLAG:
 *         if values[0] not in (True, False, None, 1, 0):             # <<<<<<<<<<<<<<
 *             raise ValueError('Flag values must be: True, False, None, 1, 0')
 *     else:
*/
    }

    /* "pysam/libcbcf.pyx":615
 *     elif ht_type == BCF_HT_STR:
 *         values = b','.join(force_bytes(v) if v is not None else b'' for v in values)
 *     elif ht_type == BCF_HT_FLAG:             # <<<<<<<<<<<<<<
 *         if values[0] not in (True, False, None, 1, 0):
 *             raise ValueError('Flag values must be: True, False, None, 1, 0')
*/
    goto __pyx_L13;
  }

  /* "pysam/libcbcf.pyx":619
 *             raise ValueError('Flag values must be: True, False, None, 1, 0')
 *     else:
 *         raise TypeError('unsupported type')             # <<<<<<<<<<<<<<
 * 
 *     realloc[0] = 0
*/
  /*else*/ {
    __pyx_t_9 = NULL;
    __Pyx_INCREF(__pyx_builtin_TypeError);
    __pyx_t_2 = __pyx_builtin_TypeError; 
    __pyx_t_5 = 1;
    {
      PyObject *__pyx_callargs[2] = {__pyx_t_9, __pyx_mstate_global->__pyx_kp_u_unsupported_type};
      __pyx_t_4 = __Pyx_PyObject_FastCall(__pyx_t_2, __pyx_callargs+__pyx_t_5, (2-__pyx_t_5) | (__pyx_t_5*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
      __Pyx_XDECREF(__pyx_t_9); __pyx_t_9 = 0;
      __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
      if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 619, __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, 619, __pyx_L1_error)
  }
  __pyx_L13:;

  /* "pysam/libcbcf.pyx":621
 *         raise TypeError('unsupported type')
 * 
 *     realloc[0] = 0             # <<<<<<<<<<<<<<
 *     if len(values) <= 1 and hl_type == BCF_HL_INFO:
 *         realloc[0] = 0
*/
  (__pyx_v_realloc[0]) = 0;

  /* "pysam/libcbcf.pyx":622
 * 
 *     realloc[0] = 0
 *     if len(values) <= 1 and hl_type == BCF_HL_INFO:             # <<<<<<<<<<<<<<
 *         realloc[0] = 0
 *     elif len(values) > bt_len:
*/
  __pyx_t_8 = PyObject_Length(__pyx_v_values); if (unlikely(__pyx_t_8 == ((Py_ssize_t)-1))) __PYX_ERR(0, 622, __pyx_L1_error)
  __pyx_t_1 = (__pyx_t_8 <= 1);
  if (__pyx_t_1) {
  } else {
    __pyx_t_6 = __pyx_t_1;
    goto __pyx_L44_bool_binop_done;
  }
  __pyx_t_1 = (__pyx_v_hl_type == BCF_HL_INFO);
  __pyx_t_6 = __pyx_t_1;
  __pyx_L44_bool_binop_done:;
  if (__pyx_t_6) {

    /* "pysam/libcbcf.pyx":623
 *     realloc[0] = 0
 *     if len(values) <= 1 and hl_type == BCF_HL_INFO:
 *         realloc[0] = 0             # <<<<<<<<<<<<<<
 *     elif len(values) > bt_len:
 *         realloc[0] = 1
*/
    (__pyx_v_realloc[0]) = 0;

    /* "pysam/libcbcf.pyx":622
 * 
 *     realloc[0] = 0
 *     if len(values) <= 1 and hl_type == BCF_HL_INFO:             # <<<<<<<<<<<<<<
 *         realloc[0] = 0
 *     elif len(values) > bt_len:
*/
    goto __pyx_L43;
  }

  /* "pysam/libcbcf.pyx":624
 *     if len(values) <= 1 and hl_type == BCF_HL_INFO:
 *         realloc[0] = 0
 *     elif len(values) > bt_len:             # <<<<<<<<<<<<<<
 *         realloc[0] = 1
 *     elif bt_type == BCF_BT_INT8:
*/
  __pyx_t_8 = PyObject_Length(__pyx_v_values); if (unlikely(__pyx_t_8 == ((Py_ssize_t)-1))) __PYX_ERR(0, 624, __pyx_L1_error)
  __pyx_t_6 = (__pyx_t_8 > __pyx_v_bt_len);
  if (__pyx_t_6) {

    /* "pysam/libcbcf.pyx":625
 *         realloc[0] = 0
 *     elif len(values) > bt_len:
 *         realloc[0] = 1             # <<<<<<<<<<<<<<
 *     elif bt_type == BCF_BT_INT8:
 *         for v in values:
*/
    (__pyx_v_realloc[0]) = 1;

    /* "pysam/libcbcf.pyx":624
 *     if len(values) <= 1 and hl_type == BCF_HL_INFO:
 *         realloc[0] = 0
 *     elif len(values) > bt_len:             # <<<<<<<<<<<<<<
 *         realloc[0] = 1
 *     elif bt_type == BCF_BT_INT8:
*/
    goto __pyx_L43;
  }

  /* "pysam/libcbcf.pyx":626
 *     elif len(values) > bt_len:
 *         realloc[0] = 1
 *     elif bt_type == BCF_BT_INT8:             # <<<<<<<<<<<<<<
 *         for v in values:
 *             if v is not None and not(bcf_int8_missing < v <= INT8_MAX):
*/
  __pyx_t_6 = (__pyx_v_bt_type == BCF_BT_INT8);
  if (__pyx_t_6) {

    /* "pysam/libcbcf.pyx":627
 *         realloc[0] = 1
 *     elif bt_type == BCF_BT_INT8:
 *         for v in values:             # <<<<<<<<<<<<<<
 *             if v is not None and not(bcf_int8_missing < v <= INT8_MAX):
 *                 realloc[0] = 1
*/
    if (likely(PyList_CheckExact(__pyx_v_values)) || PyTuple_CheckExact(__pyx_v_values)) {
      __pyx_t_4 = __pyx_v_values; __Pyx_INCREF(__pyx_t_4);
      __pyx_t_8 = 0;
      __pyx_t_13 = NULL;
    } else {
      __pyx_t_8 = -1; __pyx_t_4 = PyObject_GetIter(__pyx_v_values); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 627, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_4);
      __pyx_t_13 = (CYTHON_COMPILING_IN_LIMITED_API) ? PyIter_Next : __Pyx_PyObject_GetIterNextFunc(__pyx_t_4); if (unlikely(!__pyx_t_13)) __PYX_ERR(0, 627, __pyx_L1_error)
    }
    for (;;) {
      if (likely(!__pyx_t_13)) {
        if (likely(PyList_CheckExact(__pyx_t_4))) {
          {
            Py_ssize_t __pyx_temp = __Pyx_PyList_GET_SIZE(__pyx_t_4);
            #if !CYTHON_ASSUME_SAFE_SIZE
            if (unlikely((__pyx_temp < 0))) __PYX_ERR(0, 627, __pyx_L1_error)
            #endif
            if (__pyx_t_8 >= __pyx_temp) break;
          }
          __pyx_t_2 = __Pyx_PyList_GetItemRef(__pyx_t_4, __pyx_t_8);
          ++__pyx_t_8;
        } else {
          {
            Py_ssize_t __pyx_temp = __Pyx_PyTuple_GET_SIZE(__pyx_t_4);
            #if !CYTHON_ASSUME_SAFE_SIZE
            if (unlikely((__pyx_temp < 0))) __PYX_ERR(0, 627, __pyx_L1_error)
            #endif
            if (__pyx_t_8 >= __pyx_temp) break;
          }
          #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
          __pyx_t_2 = __Pyx_NewRef(PyTuple_GET_ITEM(__pyx_t_4, __pyx_t_8));
          #else
          __pyx_t_2 = __Pyx_PySequence_ITEM(__pyx_t_4, __pyx_t_8);
          #endif
          ++__pyx_t_8;
        }
        if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 627, __pyx_L1_error)
      } else {
        __pyx_t_2 = __pyx_t_13(__pyx_t_4);
        if (unlikely(!__pyx_t_2)) {
          PyObject* exc_type = PyErr_Occurred();
          if (exc_type) {
            if (unlikely(!__Pyx_PyErr_GivenExceptionMatches(exc_type, PyExc_StopIteration))) __PYX_ERR(0, 627, __pyx_L1_error)
            PyErr_Clear();
          }
          break;
        }
      }
      __Pyx_GOTREF(__pyx_t_2);
      __Pyx_XDECREF_SET(__pyx_v_v, __pyx_t_2);
      __pyx_t_2 = 0;

      /* "pysam/libcbcf.pyx":628
 *     elif bt_type == BCF_BT_INT8:
 *         for v in values:
 *             if v is not None and not(bcf_int8_missing < v <= INT8_MAX):             # <<<<<<<<<<<<<<
 *                 realloc[0] = 1
 *                 break
*/
      __pyx_t_1 = (__pyx_v_v != Py_None);
      if (__pyx_t_1) {
      } else {
        __pyx_t_6 = __pyx_t_1;
        goto __pyx_L49_bool_binop_done;
      }
      __pyx_t_2 = __Pyx_PyLong_From_int32_t(bcf_int8_missing); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 628, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_2);
      __pyx_t_9 = PyObject_RichCompare(__pyx_t_2, __pyx_v_v, Py_LT); __Pyx_XGOTREF(__pyx_t_9); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 628, __pyx_L1_error)
      if (__Pyx_PyObject_IsTrue(__pyx_t_9)) {
        __Pyx_DECREF(__pyx_t_9);
        __pyx_t_3 = __Pyx_PyLong_From_int8_t(INT8_MAX); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 628, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_3);
        __pyx_t_9 = PyObject_RichCompare(__pyx_v_v, __pyx_t_3, Py_LE); __Pyx_XGOTREF(__pyx_t_9); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 628, __pyx_L1_error)
        __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
      }
      __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
      __pyx_t_1 = __Pyx_PyObject_IsTrue(__pyx_t_9); if (unlikely((__pyx_t_1 < 0))) __PYX_ERR(0, 628, __pyx_L1_error)
      __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
      __pyx_t_14 = (!__pyx_t_1);
      __pyx_t_6 = __pyx_t_14;
      __pyx_L49_bool_binop_done:;
      if (__pyx_t_6) {

        /* "pysam/libcbcf.pyx":629
 *         for v in values:
 *             if v is not None and not(bcf_int8_missing < v <= INT8_MAX):
 *                 realloc[0] = 1             # <<<<<<<<<<<<<<
 *                 break
 *     elif bt_type == BCF_BT_INT16:
*/
        (__pyx_v_realloc[0]) = 1;

        /* "pysam/libcbcf.pyx":630
 *             if v is not None and not(bcf_int8_missing < v <= INT8_MAX):
 *                 realloc[0] = 1
 *                 break             # <<<<<<<<<<<<<<
 *     elif bt_type == BCF_BT_INT16:
 *         for v in values:
*/
        goto __pyx_L47_break;

        /* "pysam/libcbcf.pyx":628
 *     elif bt_type == BCF_BT_INT8:
 *         for v in values:
 *             if v is not None and not(bcf_int8_missing < v <= INT8_MAX):             # <<<<<<<<<<<<<<
 *                 realloc[0] = 1
 *                 break
*/
      }

      /* "pysam/libcbcf.pyx":627
 *         realloc[0] = 1
 *     elif bt_type == BCF_BT_INT8:
 *         for v in values:             # <<<<<<<<<<<<<<
 *             if v is not None and not(bcf_int8_missing < v <= INT8_MAX):
 *                 realloc[0] = 1
*/
    }
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    goto __pyx_L51_for_end;
    __pyx_L47_break:;
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    goto __pyx_L51_for_end;
    __pyx_L51_for_end:;

    /* "pysam/libcbcf.pyx":626
 *     elif len(values) > bt_len:
 *         realloc[0] = 1
 *     elif bt_type == BCF_BT_INT8:             # <<<<<<<<<<<<<<
 *         for v in values:
 *             if v is not None and not(bcf_int8_missing < v <= INT8_MAX):
*/
    goto __pyx_L43;
  }

  /* "pysam/libcbcf.pyx":631
 *                 realloc[0] = 1
 *                 break
 *     elif bt_type == BCF_BT_INT16:             # <<<<<<<<<<<<<<
 *         for v in values:
 *             if v is not None and not(bcf_int16_missing < v <= INT16_MAX):
*/
  __pyx_t_6 = (__pyx_v_bt_type == BCF_BT_INT16);
  if (__pyx_t_6) {

    /* "pysam/libcbcf.pyx":632
 *                 break
 *     elif bt_type == BCF_BT_INT16:
 *         for v in values:             # <<<<<<<<<<<<<<
 *             if v is not None and not(bcf_int16_missing < v <= INT16_MAX):
 *                 realloc[0] = 1
*/
    if (likely(PyList_CheckExact(__pyx_v_values)) || PyTuple_CheckExact(__pyx_v_values)) {
      __pyx_t_4 = __pyx_v_values; __Pyx_INCREF(__pyx_t_4);
      __pyx_t_8 = 0;
      __pyx_t_13 = NULL;
    } else {
      __pyx_t_8 = -1; __pyx_t_4 = PyObject_GetIter(__pyx_v_values); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 632, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_4);
      __pyx_t_13 = (CYTHON_COMPILING_IN_LIMITED_API) ? PyIter_Next : __Pyx_PyObject_GetIterNextFunc(__pyx_t_4); if (unlikely(!__pyx_t_13)) __PYX_ERR(0, 632, __pyx_L1_error)
    }
    for (;;) {
      if (likely(!__pyx_t_13)) {
        if (likely(PyList_CheckExact(__pyx_t_4))) {
          {
            Py_ssize_t __pyx_temp = __Pyx_PyList_GET_SIZE(__pyx_t_4);
            #if !CYTHON_ASSUME_SAFE_SIZE
            if (unlikely((__pyx_temp < 0))) __PYX_ERR(0, 632, __pyx_L1_error)
            #endif
            if (__pyx_t_8 >= __pyx_temp) break;
          }
          __pyx_t_9 = __Pyx_PyList_GetItemRef(__pyx_t_4, __pyx_t_8);
          ++__pyx_t_8;
        } else {
          {
            Py_ssize_t __pyx_temp = __Pyx_PyTuple_GET_SIZE(__pyx_t_4);
            #if !CYTHON_ASSUME_SAFE_SIZE
            if (unlikely((__pyx_temp < 0))) __PYX_ERR(0, 632, __pyx_L1_error)
            #endif
            if (__pyx_t_8 >= __pyx_temp) break;
          }
          #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
          __pyx_t_9 = __Pyx_NewRef(PyTuple_GET_ITEM(__pyx_t_4, __pyx_t_8));
          #else
          __pyx_t_9 = __Pyx_PySequence_ITEM(__pyx_t_4, __pyx_t_8);
          #endif
          ++__pyx_t_8;
        }
        if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 632, __pyx_L1_error)
      } else {
        __pyx_t_9 = __pyx_t_13(__pyx_t_4);
        if (unlikely(!__pyx_t_9)) {
          PyObject* exc_type = PyErr_Occurred();
          if (exc_type) {
            if (unlikely(!__Pyx_PyErr_GivenExceptionMatches(exc_type, PyExc_StopIteration))) __PYX_ERR(0, 632, __pyx_L1_error)
            PyErr_Clear();
          }
          break;
        }
      }
      __Pyx_GOTREF(__pyx_t_9);
      __Pyx_XDECREF_SET(__pyx_v_v, __pyx_t_9);
      __pyx_t_9 = 0;

      /* "pysam/libcbcf.pyx":633
 *     elif bt_type == BCF_BT_INT16:
 *         for v in values:
 *             if v is not None and not(bcf_int16_missing < v <= INT16_MAX):             # <<<<<<<<<<<<<<
 *                 realloc[0] = 1
 *                 break
*/
      __pyx_t_14 = (__pyx_v_v != Py_None);
      if (__pyx_t_14) {
      } else {
        __pyx_t_6 = __pyx_t_14;
        goto __pyx_L55_bool_binop_done;
      }
      __pyx_t_9 = __Pyx_PyLong_From_int32_t(bcf_int16_missing); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 633, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_9);
      __pyx_t_2 = PyObject_RichCompare(__pyx_t_9, __pyx_v_v, Py_LT); __Pyx_XGOTREF(__pyx_t_2); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 633, __pyx_L1_error)
      if (__Pyx_PyObject_IsTrue(__pyx_t_2)) {
        __Pyx_DECREF(__pyx_t_2);
        __pyx_t_3 = __Pyx_PyLong_From_int16_t(INT16_MAX); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 633, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_3);
        __pyx_t_2 = PyObject_RichCompare(__pyx_v_v, __pyx_t_3, Py_LE); __Pyx_XGOTREF(__pyx_t_2); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 633, __pyx_L1_error)
        __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
      }
      __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
      __pyx_t_14 = __Pyx_PyObject_IsTrue(__pyx_t_2); if (unlikely((__pyx_t_14 < 0))) __PYX_ERR(0, 633, __pyx_L1_error)
      __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
      __pyx_t_1 = (!__pyx_t_14);
      __pyx_t_6 = __pyx_t_1;
      __pyx_L55_bool_binop_done:;
      if (__pyx_t_6) {

        /* "pysam/libcbcf.pyx":634
 *         for v in values:
 *             if v is not None and not(bcf_int16_missing < v <= INT16_MAX):
 *                 realloc[0] = 1             # <<<<<<<<<<<<<<
 *                 break
 * 
*/
        (__pyx_v_realloc[0]) = 1;

        /* "pysam/libcbcf.pyx":635
 *             if v is not None and not(bcf_int16_missing < v <= INT16_MAX):
 *                 realloc[0] = 1
 *                 break             # <<<<<<<<<<<<<<
 * 
 *     return values
*/
        goto __pyx_L53_break;

        /* "pysam/libcbcf.pyx":633
 *     elif bt_type == BCF_BT_INT16:
 *         for v in values:
 *             if v is not None and not(bcf_int16_missing < v <= INT16_MAX):             # <<<<<<<<<<<<<<
 *                 realloc[0] = 1
 *                 break
*/
      }

      /* "pysam/libcbcf.pyx":632
 *                 break
 *     elif bt_type == BCF_BT_INT16:
 *         for v in values:             # <<<<<<<<<<<<<<
 *             if v is not None and not(bcf_int16_missing < v <= INT16_MAX):
 *                 realloc[0] = 1
*/
    }
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    goto __pyx_L57_for_end;
    __pyx_L53_break:;
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    goto __pyx_L57_for_end;
    __pyx_L57_for_end:;

    /* "pysam/libcbcf.pyx":631
 *                 realloc[0] = 1
 *                 break
 *     elif bt_type == BCF_BT_INT16:             # <<<<<<<<<<<<<<
 *         for v in values:
 *             if v is not None and not(bcf_int16_missing < v <= INT16_MAX):
*/
  }
  __pyx_L43:;

  /* "pysam/libcbcf.pyx":637
 *                 break
 * 
 *     return values             # <<<<<<<<<<<<<<
 * 
 * 
*/
  __Pyx_XDECREF(__pyx_r);
  __Pyx_INCREF(__pyx_v_values);
  __pyx_r = __pyx_v_values;
  __Pyx_TraceReturnValue(__pyx_r, 250, 0, __PYX_ERR(0, 637, __pyx_L1_error));
  goto __pyx_L0;

  /* "pysam/libcbcf.pyx":575
 * 
 * 
 * cdef object bcf_check_values(VariantRecord record, value, int sample,             # <<<<<<<<<<<<<<
 *                              int hl_type, int ht_type,
 *                              int id, int bt_type, ssize_t bt_len,
*/

  /* 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_9);
  __Pyx_XDECREF(__pyx_t_10);
  __Pyx_XDECREF(__pyx_t_11);
  __Pyx_XDECREF(__pyx_t_12);
  __Pyx_TraceException(__pyx_lineno, 0, 0);
  #if CYTHON_USE_SYS_MONITORING
  __Pyx_TraceExceptionUnwind(0, 0);
  #else
  __Pyx_TraceReturnValue(NULL, 0, 0, __PYX_ERR(0, 575, __pyx_L1_error));
  #endif
  __Pyx_AddTraceback("pysam.libcbcf.bcf_check_values", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_values);
  __Pyx_XDECREF(__pyx_v_v);
  __Pyx_XDECREF(__pyx_gb_5pysam_7libcbcf_16bcf_check_values_2generator31);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_PyMonitoring_ExitScope(0);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "pysam/libcbcf.pyx":640
 * 
 * 
 * cdef bcf_encode_alleles(VariantRecord record, values):             # <<<<<<<<<<<<<<
 *     if record is None:
 *         raise ValueError('record must not be None')
*/

static PyObject *__pyx_f_5pysam_7libcbcf_bcf_encode_alleles(struct __pyx_obj_5pysam_7libcbcf_VariantRecord *__pyx_v_record, PyObject *__pyx_v_values) {
  bcf1_t *__pyx_v_r;
  int32_t __pyx_v_nalleles;
  PyObject *__pyx_v_gt_values = 0;
  char *__pyx_v_s;
  int __pyx_v_i;
  PyObject *__pyx_v_value = NULL;
  PyObject *__pyx_v_bvalue = NULL;
  PyObject *__pyx_r = NULL;
  __Pyx_TraceDeclarationsFunc
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  PyObject *__pyx_t_4 = NULL;
  size_t __pyx_t_5;
  bcf1_t *__pyx_t_6;
  uint32_t __pyx_t_7;
  int __pyx_t_8;
  Py_ssize_t __pyx_t_9;
  PyObject *(*__pyx_t_10)(PyObject *);
  int __pyx_t_11;
  char *__pyx_t_12;
  uint32_t __pyx_t_13;
  int __pyx_t_14;
  PyObject *__pyx_t_15 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_TraceFrameInit(((PyObject *)__pyx_mstate_global->__pyx_codeobj_tab[18]))
  __Pyx_RefNannySetupContext("bcf_encode_alleles", 0);
  __Pyx_TraceStartFunc("bcf_encode_alleles", __pyx_f[0], 640, 0, 0, 0, __PYX_ERR(0, 640, __pyx_L1_error));
  __Pyx_INCREF(__pyx_v_values);

  /* "pysam/libcbcf.pyx":641
 * 
 * cdef bcf_encode_alleles(VariantRecord record, values):
 *     if record is None:             # <<<<<<<<<<<<<<
 *         raise ValueError('record must not be None')
 * 
*/
  __pyx_t_1 = (((PyObject *)__pyx_v_record) == Py_None);
  if (unlikely(__pyx_t_1)) {

    /* "pysam/libcbcf.pyx":642
 * cdef bcf_encode_alleles(VariantRecord record, values):
 *     if record is None:
 *         raise ValueError('record must not be None')             # <<<<<<<<<<<<<<
 * 
 *     cdef bcf1_t *r = record.ptr
*/
    __pyx_t_3 = NULL;
    __Pyx_INCREF(__pyx_builtin_ValueError);
    __pyx_t_4 = __pyx_builtin_ValueError; 
    __pyx_t_5 = 1;
    {
      PyObject *__pyx_callargs[2] = {__pyx_t_3, __pyx_mstate_global->__pyx_kp_u_record_must_not_be_None};
      __pyx_t_2 = __Pyx_PyObject_FastCall(__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_2)) __PYX_ERR(0, 642, __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, 642, __pyx_L1_error)

    /* "pysam/libcbcf.pyx":641
 * 
 * cdef bcf_encode_alleles(VariantRecord record, values):
 *     if record is None:             # <<<<<<<<<<<<<<
 *         raise ValueError('record must not be None')
 * 
*/
  }

  /* "pysam/libcbcf.pyx":644
 *         raise ValueError('record must not be None')
 * 
 *     cdef bcf1_t *r = record.ptr             # <<<<<<<<<<<<<<
 *     cdef int32_t nalleles = r.n_allele
 *     cdef list gt_values = []
*/
  __pyx_t_6 = __pyx_v_record->ptr;
  __pyx_v_r = __pyx_t_6;

  /* "pysam/libcbcf.pyx":645
 * 
 *     cdef bcf1_t *r = record.ptr
 *     cdef int32_t nalleles = r.n_allele             # <<<<<<<<<<<<<<
 *     cdef list gt_values = []
 *     cdef char *s
*/
  __pyx_t_7 = __pyx_v_r->n_allele;
  __pyx_v_nalleles = __pyx_t_7;

  /* "pysam/libcbcf.pyx":646
 *     cdef bcf1_t *r = record.ptr
 *     cdef int32_t nalleles = r.n_allele
 *     cdef list gt_values = []             # <<<<<<<<<<<<<<
 *     cdef char *s
 *     cdef int i
*/
  __pyx_t_2 = PyList_New(0); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 646, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_v_gt_values = ((PyObject*)__pyx_t_2);
  __pyx_t_2 = 0;

  /* "pysam/libcbcf.pyx":650
 *     cdef int i
 * 
 *     if values is None:             # <<<<<<<<<<<<<<
 *         return ()
 * 
*/
  __pyx_t_1 = (__pyx_v_values == Py_None);
  if (__pyx_t_1) {

    /* "pysam/libcbcf.pyx":651
 * 
 *     if values is None:
 *         return ()             # <<<<<<<<<<<<<<
 * 
 *     if not isinstance(values, (list, tuple)):
*/
    __Pyx_XDECREF(__pyx_r);
    __Pyx_INCREF(__pyx_mstate_global->__pyx_empty_tuple);
    __pyx_r = __pyx_mstate_global->__pyx_empty_tuple;
    __Pyx_TraceReturnValue(__pyx_r, 21, 0, __PYX_ERR(0, 651, __pyx_L1_error));
    goto __pyx_L0;

    /* "pysam/libcbcf.pyx":650
 *     cdef int i
 * 
 *     if values is None:             # <<<<<<<<<<<<<<
 *         return ()
 * 
*/
  }

  /* "pysam/libcbcf.pyx":653
 *         return ()
 * 
 *     if not isinstance(values, (list, tuple)):             # <<<<<<<<<<<<<<
 *         values = (values,)
 * 
*/
  __pyx_t_8 = PyList_Check(__pyx_v_values); 
  if (!__pyx_t_8) {
  } else {
    __pyx_t_1 = __pyx_t_8;
    goto __pyx_L6_bool_binop_done;
  }
  __pyx_t_8 = PyTuple_Check(__pyx_v_values); 
  __pyx_t_1 = __pyx_t_8;
  __pyx_L6_bool_binop_done:;
  __pyx_t_8 = (!__pyx_t_1);
  if (__pyx_t_8) {

    /* "pysam/libcbcf.pyx":654
 * 
 *     if not isinstance(values, (list, tuple)):
 *         values = (values,)             # <<<<<<<<<<<<<<
 * 
 *     for value in values:
*/
    __pyx_t_2 = PyTuple_New(1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 654, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __Pyx_INCREF(__pyx_v_values);
    __Pyx_GIVEREF(__pyx_v_values);
    if (__Pyx_PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_v_values) != (0)) __PYX_ERR(0, 654, __pyx_L1_error);
    __Pyx_DECREF_SET(__pyx_v_values, __pyx_t_2);
    __pyx_t_2 = 0;

    /* "pysam/libcbcf.pyx":653
 *         return ()
 * 
 *     if not isinstance(values, (list, tuple)):             # <<<<<<<<<<<<<<
 *         values = (values,)
 * 
*/
  }

  /* "pysam/libcbcf.pyx":656
 *         values = (values,)
 * 
 *     for value in values:             # <<<<<<<<<<<<<<
 *         if value is None:
 *             gt_values.append(bcf_gt_missing)
*/
  if (likely(PyList_CheckExact(__pyx_v_values)) || PyTuple_CheckExact(__pyx_v_values)) {
    __pyx_t_2 = __pyx_v_values; __Pyx_INCREF(__pyx_t_2);
    __pyx_t_9 = 0;
    __pyx_t_10 = NULL;
  } else {
    __pyx_t_9 = -1; __pyx_t_2 = PyObject_GetIter(__pyx_v_values); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 656, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __pyx_t_10 = (CYTHON_COMPILING_IN_LIMITED_API) ? PyIter_Next : __Pyx_PyObject_GetIterNextFunc(__pyx_t_2); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 656, __pyx_L1_error)
  }
  for (;;) {
    if (likely(!__pyx_t_10)) {
      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, 656, __pyx_L1_error)
          #endif
          if (__pyx_t_9 >= __pyx_temp) break;
        }
        __pyx_t_4 = __Pyx_PyList_GetItemRef(__pyx_t_2, __pyx_t_9);
        ++__pyx_t_9;
      } 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, 656, __pyx_L1_error)
          #endif
          if (__pyx_t_9 >= __pyx_temp) break;
        }
        #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
        __pyx_t_4 = __Pyx_NewRef(PyTuple_GET_ITEM(__pyx_t_2, __pyx_t_9));
        #else
        __pyx_t_4 = __Pyx_PySequence_ITEM(__pyx_t_2, __pyx_t_9);
        #endif
        ++__pyx_t_9;
      }
      if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 656, __pyx_L1_error)
    } else {
      __pyx_t_4 = __pyx_t_10(__pyx_t_2);
      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, 656, __pyx_L1_error)
          PyErr_Clear();
        }
        break;
      }
    }
    __Pyx_GOTREF(__pyx_t_4);
    __Pyx_XDECREF_SET(__pyx_v_value, __pyx_t_4);
    __pyx_t_4 = 0;

    /* "pysam/libcbcf.pyx":657
 * 
 *     for value in values:
 *         if value is None:             # <<<<<<<<<<<<<<
 *             gt_values.append(bcf_gt_missing)
 *         elif isinstance(value, (str, bytes)):
*/
    __pyx_t_8 = (__pyx_v_value == Py_None);
    if (__pyx_t_8) {

      /* "pysam/libcbcf.pyx":658
 *     for value in values:
 *         if value is None:
 *             gt_values.append(bcf_gt_missing)             # <<<<<<<<<<<<<<
 *         elif isinstance(value, (str, bytes)):
 *             bvalue = force_bytes(value)
*/
      __pyx_t_4 = __Pyx_PyLong_From_uint32_t(bcf_gt_missing); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 658, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_4);
      __pyx_t_11 = __Pyx_PyList_Append(__pyx_v_gt_values, __pyx_t_4); if (unlikely(__pyx_t_11 == ((int)-1))) __PYX_ERR(0, 658, __pyx_L1_error)
      __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;

      /* "pysam/libcbcf.pyx":657
 * 
 *     for value in values:
 *         if value is None:             # <<<<<<<<<<<<<<
 *             gt_values.append(bcf_gt_missing)
 *         elif isinstance(value, (str, bytes)):
*/
      goto __pyx_L10;
    }

    /* "pysam/libcbcf.pyx":659
 *         if value is None:
 *             gt_values.append(bcf_gt_missing)
 *         elif isinstance(value, (str, bytes)):             # <<<<<<<<<<<<<<
 *             bvalue = force_bytes(value)
 *             s = bvalue
*/
    __pyx_t_1 = PyUnicode_Check(__pyx_v_value); 
    if (!__pyx_t_1) {
    } else {
      __pyx_t_8 = __pyx_t_1;
      goto __pyx_L11_bool_binop_done;
    }
    __pyx_t_1 = PyBytes_Check(__pyx_v_value); 
    __pyx_t_8 = __pyx_t_1;
    __pyx_L11_bool_binop_done:;
    if (__pyx_t_8) {

      /* "pysam/libcbcf.pyx":660
 *             gt_values.append(bcf_gt_missing)
 *         elif isinstance(value, (str, bytes)):
 *             bvalue = force_bytes(value)             # <<<<<<<<<<<<<<
 *             s = bvalue
 *             for i in range(r.n_allele):
*/
      __pyx_t_4 = __pyx_f_5pysam_9libcutils_force_bytes(__pyx_v_value, NULL); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 660, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_4);
      __Pyx_XDECREF_SET(__pyx_v_bvalue, ((PyObject*)__pyx_t_4));
      __pyx_t_4 = 0;

      /* "pysam/libcbcf.pyx":661
 *         elif isinstance(value, (str, bytes)):
 *             bvalue = force_bytes(value)
 *             s = bvalue             # <<<<<<<<<<<<<<
 *             for i in range(r.n_allele):
 *                 if strcmp(r.d.allele[i], s) != 0:
*/
      if (unlikely(__pyx_v_bvalue == Py_None)) {
        PyErr_SetString(PyExc_TypeError, "expected bytes, NoneType found");
        __PYX_ERR(0, 661, __pyx_L1_error)
      }
      __pyx_t_12 = __Pyx_PyBytes_AsWritableString(__pyx_v_bvalue); if (unlikely((!__pyx_t_12) && PyErr_Occurred())) __PYX_ERR(0, 661, __pyx_L1_error)
      __pyx_v_s = __pyx_t_12;

      /* "pysam/libcbcf.pyx":662
 *             bvalue = force_bytes(value)
 *             s = bvalue
 *             for i in range(r.n_allele):             # <<<<<<<<<<<<<<
 *                 if strcmp(r.d.allele[i], s) != 0:
 *                     gt_values.append(bcf_gt_unphased(i))
*/
      __pyx_t_7 = __pyx_v_r->n_allele;
      __pyx_t_13 = __pyx_t_7;
      for (__pyx_t_14 = 0; __pyx_t_14 < __pyx_t_13; __pyx_t_14+=1) {
        __pyx_v_i = __pyx_t_14;

        /* "pysam/libcbcf.pyx":663
 *             s = bvalue
 *             for i in range(r.n_allele):
 *                 if strcmp(r.d.allele[i], s) != 0:             # <<<<<<<<<<<<<<
 *                     gt_values.append(bcf_gt_unphased(i))
 *                     break
*/
        __pyx_t_8 = (strcmp((__pyx_v_r->d.allele[__pyx_v_i]), __pyx_v_s) != 0);
        if (__pyx_t_8) {

          /* "pysam/libcbcf.pyx":664
 *             for i in range(r.n_allele):
 *                 if strcmp(r.d.allele[i], s) != 0:
 *                     gt_values.append(bcf_gt_unphased(i))             # <<<<<<<<<<<<<<
 *                     break
 *             else:
*/
          __pyx_t_4 = __Pyx_PyLong_From_uint32_t(bcf_gt_unphased(__pyx_v_i)); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 664, __pyx_L1_error)
          __Pyx_GOTREF(__pyx_t_4);
          __pyx_t_11 = __Pyx_PyList_Append(__pyx_v_gt_values, __pyx_t_4); if (unlikely(__pyx_t_11 == ((int)-1))) __PYX_ERR(0, 664, __pyx_L1_error)
          __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;

          /* "pysam/libcbcf.pyx":665
 *                 if strcmp(r.d.allele[i], s) != 0:
 *                     gt_values.append(bcf_gt_unphased(i))
 *                     break             # <<<<<<<<<<<<<<
 *             else:
 *                 raise ValueError('Unknown allele')
*/
          goto __pyx_L14_break;

          /* "pysam/libcbcf.pyx":663
 *             s = bvalue
 *             for i in range(r.n_allele):
 *                 if strcmp(r.d.allele[i], s) != 0:             # <<<<<<<<<<<<<<
 *                     gt_values.append(bcf_gt_unphased(i))
 *                     break
*/
        }
      }
      /*else*/ {

        /* "pysam/libcbcf.pyx":667
 *                     break
 *             else:
 *                 raise ValueError('Unknown allele')             # <<<<<<<<<<<<<<
 *         else:
 *             i = value
*/
        __pyx_t_3 = NULL;
        __Pyx_INCREF(__pyx_builtin_ValueError);
        __pyx_t_15 = __pyx_builtin_ValueError; 
        __pyx_t_5 = 1;
        {
          PyObject *__pyx_callargs[2] = {__pyx_t_3, __pyx_mstate_global->__pyx_kp_u_Unknown_allele};
          __pyx_t_4 = __Pyx_PyObject_FastCall(__pyx_t_15, __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_15); __pyx_t_15 = 0;
          if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 667, __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, 667, __pyx_L1_error)
      }
      __pyx_L14_break:;

      /* "pysam/libcbcf.pyx":659
 *         if value is None:
 *             gt_values.append(bcf_gt_missing)
 *         elif isinstance(value, (str, bytes)):             # <<<<<<<<<<<<<<
 *             bvalue = force_bytes(value)
 *             s = bvalue
*/
      goto __pyx_L10;
    }

    /* "pysam/libcbcf.pyx":669
 *                 raise ValueError('Unknown allele')
 *         else:
 *             i = value             # <<<<<<<<<<<<<<
 *             if not (0 <= i < nalleles):
 *                 raise ValueError('Invalid allele index')
*/
    /*else*/ {
      __pyx_t_14 = __Pyx_PyLong_As_int(__pyx_v_value); if (unlikely((__pyx_t_14 == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 669, __pyx_L1_error)
      __pyx_v_i = __pyx_t_14;

      /* "pysam/libcbcf.pyx":670
 *         else:
 *             i = value
 *             if not (0 <= i < nalleles):             # <<<<<<<<<<<<<<
 *                 raise ValueError('Invalid allele index')
 *             gt_values.append(bcf_gt_unphased(i))
*/
      __pyx_t_8 = (0 <= __pyx_v_i);
      if (__pyx_t_8) {
        __pyx_t_8 = (__pyx_v_i < __pyx_v_nalleles);
      }
      __pyx_t_1 = (!__pyx_t_8);
      if (unlikely(__pyx_t_1)) {

        /* "pysam/libcbcf.pyx":671
 *             i = value
 *             if not (0 <= i < nalleles):
 *                 raise ValueError('Invalid allele index')             # <<<<<<<<<<<<<<
 *             gt_values.append(bcf_gt_unphased(i))
 * 
*/
        __pyx_t_15 = NULL;
        __Pyx_INCREF(__pyx_builtin_ValueError);
        __pyx_t_3 = __pyx_builtin_ValueError; 
        __pyx_t_5 = 1;
        {
          PyObject *__pyx_callargs[2] = {__pyx_t_15, __pyx_mstate_global->__pyx_kp_u_Invalid_allele_index};
          __pyx_t_4 = __Pyx_PyObject_FastCall(__pyx_t_3, __pyx_callargs+__pyx_t_5, (2-__pyx_t_5) | (__pyx_t_5*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
          __Pyx_XDECREF(__pyx_t_15); __pyx_t_15 = 0;
          __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
          if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 671, __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, 671, __pyx_L1_error)

        /* "pysam/libcbcf.pyx":670
 *         else:
 *             i = value
 *             if not (0 <= i < nalleles):             # <<<<<<<<<<<<<<
 *                 raise ValueError('Invalid allele index')
 *             gt_values.append(bcf_gt_unphased(i))
*/
      }

      /* "pysam/libcbcf.pyx":672
 *             if not (0 <= i < nalleles):
 *                 raise ValueError('Invalid allele index')
 *             gt_values.append(bcf_gt_unphased(i))             # <<<<<<<<<<<<<<
 * 
 *     return gt_values
*/
      __pyx_t_4 = __Pyx_PyLong_From_uint32_t(bcf_gt_unphased(__pyx_v_i)); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 672, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_4);
      __pyx_t_11 = __Pyx_PyList_Append(__pyx_v_gt_values, __pyx_t_4); if (unlikely(__pyx_t_11 == ((int)-1))) __PYX_ERR(0, 672, __pyx_L1_error)
      __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    }
    __pyx_L10:;

    /* "pysam/libcbcf.pyx":656
 *         values = (values,)
 * 
 *     for value in values:             # <<<<<<<<<<<<<<
 *         if value is None:
 *             gt_values.append(bcf_gt_missing)
*/
  }
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

  /* "pysam/libcbcf.pyx":674
 *             gt_values.append(bcf_gt_unphased(i))
 * 
 *     return gt_values             # <<<<<<<<<<<<<<
 * 
 * 
*/
  __Pyx_XDECREF(__pyx_r);
  __Pyx_INCREF(__pyx_v_gt_values);
  __pyx_r = __pyx_v_gt_values;
  __Pyx_TraceReturnValue(__pyx_r, 100, 0, __PYX_ERR(0, 674, __pyx_L1_error));
  goto __pyx_L0;

  /* "pysam/libcbcf.pyx":640
 * 
 * 
 * cdef bcf_encode_alleles(VariantRecord record, values):             # <<<<<<<<<<<<<<
 *     if record is None:
 *         raise ValueError('record must not be None')
*/

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_XDECREF(__pyx_t_15);
  __Pyx_TraceException(__pyx_lineno, 0, 0);
  #if CYTHON_USE_SYS_MONITORING
  __Pyx_TraceExceptionUnwind(0, 0);
  #else
  __Pyx_TraceReturnValue(NULL, 0, 0, __PYX_ERR(0, 640, __pyx_L1_error));
  #endif
  __Pyx_AddTraceback("pysam.libcbcf.bcf_encode_alleles", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_gt_values);
  __Pyx_XDECREF(__pyx_v_value);
  __Pyx_XDECREF(__pyx_v_bvalue);
  __Pyx_XDECREF(__pyx_v_values);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_PyMonitoring_ExitScope(0);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "pysam/libcbcf.pyx":677
 * 
 * 
 * cdef bcf_info_set_value(VariantRecord record, key, value):             # <<<<<<<<<<<<<<
 *     if record is None:
 *         raise ValueError('record must not be None')
*/

static PyObject *__pyx_f_5pysam_7libcbcf_bcf_info_set_value(struct __pyx_obj_5pysam_7libcbcf_VariantRecord *__pyx_v_record, PyObject *__pyx_v_key, PyObject *__pyx_v_value) {
  bcf_hdr_t *__pyx_v_hdr;
  bcf1_t *__pyx_v_r;
  int __pyx_v_info_id;
  int __pyx_v_info_type;
  int __pyx_v_scalar;
  int __pyx_v_dst_type;
  int __pyx_v_realloc;
  int __pyx_v_vlen;
  Py_ssize_t __pyx_v_value_count;
  Py_ssize_t __pyx_v_alloc_len;
  PyObject *__pyx_v_bkey = 0;
  bcf_info_t *__pyx_v_info;
  PyObject *__pyx_v_values = NULL;
  PyObject *__pyx_v_new_values = NULL;
  char *__pyx_v_valp;
  PyObject *__pyx_r = NULL;
  __Pyx_TraceDeclarationsFunc
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  PyObject *__pyx_t_4 = NULL;
  size_t __pyx_t_5;
  bcf_hdr_t *__pyx_t_6;
  bcf1_t *__pyx_t_7;
  char const *__pyx_t_8;
  int __pyx_t_9;
  PyObject *__pyx_t_10 = NULL;
  PyObject *__pyx_t_11 = NULL;
  int __pyx_t_12;
  Py_ssize_t __pyx_t_13;
  char const *__pyx_t_14;
  Py_ssize_t __pyx_t_15;
  long __pyx_t_16;
  Py_ssize_t __pyx_t_17;
  char *__pyx_t_18;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_TraceFrameInit(((PyObject *)__pyx_mstate_global->__pyx_codeobj_tab[19]))
  __Pyx_RefNannySetupContext("bcf_info_set_value", 0);
  __Pyx_TraceStartFunc("bcf_info_set_value", __pyx_f[0], 677, 0, 0, 0, __PYX_ERR(0, 677, __pyx_L1_error));

  /* "pysam/libcbcf.pyx":678
 * 
 * cdef bcf_info_set_value(VariantRecord record, key, value):
 *     if record is None:             # <<<<<<<<<<<<<<
 *         raise ValueError('record must not be None')
 * 
*/
  __pyx_t_1 = (((PyObject *)__pyx_v_record) == Py_None);
  if (unlikely(__pyx_t_1)) {

    /* "pysam/libcbcf.pyx":679
 * cdef bcf_info_set_value(VariantRecord record, key, value):
 *     if record is None:
 *         raise ValueError('record must not be None')             # <<<<<<<<<<<<<<
 * 
 *     cdef bcf_hdr_t *hdr = record.header.ptr
*/
    __pyx_t_3 = NULL;
    __Pyx_INCREF(__pyx_builtin_ValueError);
    __pyx_t_4 = __pyx_builtin_ValueError; 
    __pyx_t_5 = 1;
    {
      PyObject *__pyx_callargs[2] = {__pyx_t_3, __pyx_mstate_global->__pyx_kp_u_record_must_not_be_None};
      __pyx_t_2 = __Pyx_PyObject_FastCall(__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_2)) __PYX_ERR(0, 679, __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, 679, __pyx_L1_error)

    /* "pysam/libcbcf.pyx":678
 * 
 * cdef bcf_info_set_value(VariantRecord record, key, value):
 *     if record is None:             # <<<<<<<<<<<<<<
 *         raise ValueError('record must not be None')
 * 
*/
  }

  /* "pysam/libcbcf.pyx":681
 *         raise ValueError('record must not be None')
 * 
 *     cdef bcf_hdr_t *hdr = record.header.ptr             # <<<<<<<<<<<<<<
 *     cdef bcf1_t *r = record.ptr
 *     cdef int info_id, info_type, scalar, dst_type, realloc, vlen = 0
*/
  __pyx_t_6 = __pyx_v_record->header->ptr;
  __pyx_v_hdr = __pyx_t_6;

  /* "pysam/libcbcf.pyx":682
 * 
 *     cdef bcf_hdr_t *hdr = record.header.ptr
 *     cdef bcf1_t *r = record.ptr             # <<<<<<<<<<<<<<
 *     cdef int info_id, info_type, scalar, dst_type, realloc, vlen = 0
 *     cdef ssize_t i, value_count, alloc_len, alloc_size, dst_size
*/
  __pyx_t_7 = __pyx_v_record->ptr;
  __pyx_v_r = __pyx_t_7;

  /* "pysam/libcbcf.pyx":683
 *     cdef bcf_hdr_t *hdr = record.header.ptr
 *     cdef bcf1_t *r = record.ptr
 *     cdef int info_id, info_type, scalar, dst_type, realloc, vlen = 0             # <<<<<<<<<<<<<<
 *     cdef ssize_t i, value_count, alloc_len, alloc_size, dst_size
 * 
*/
  __pyx_v_vlen = 0;

  /* "pysam/libcbcf.pyx":686
 *     cdef ssize_t i, value_count, alloc_len, alloc_size, dst_size
 * 
 *     if bcf_unpack(r, BCF_UN_INFO) < 0:             # <<<<<<<<<<<<<<
 *         raise ValueError('Error unpacking VariantRecord')
 * 
*/
  __pyx_t_1 = (bcf_unpack(__pyx_v_r, BCF_UN_INFO) < 0);
  if (unlikely(__pyx_t_1)) {

    /* "pysam/libcbcf.pyx":687
 * 
 *     if bcf_unpack(r, BCF_UN_INFO) < 0:
 *         raise ValueError('Error unpacking VariantRecord')             # <<<<<<<<<<<<<<
 * 
 *     cdef bytes bkey = force_bytes(key)
*/
    __pyx_t_4 = NULL;
    __Pyx_INCREF(__pyx_builtin_ValueError);
    __pyx_t_3 = __pyx_builtin_ValueError; 
    __pyx_t_5 = 1;
    {
      PyObject *__pyx_callargs[2] = {__pyx_t_4, __pyx_mstate_global->__pyx_kp_u_Error_unpacking_VariantRecord};
      __pyx_t_2 = __Pyx_PyObject_FastCall(__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_2)) __PYX_ERR(0, 687, __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, 687, __pyx_L1_error)

    /* "pysam/libcbcf.pyx":686
 *     cdef ssize_t i, value_count, alloc_len, alloc_size, dst_size
 * 
 *     if bcf_unpack(r, BCF_UN_INFO) < 0:             # <<<<<<<<<<<<<<
 *         raise ValueError('Error unpacking VariantRecord')
 * 
*/
  }

  /* "pysam/libcbcf.pyx":689
 *         raise ValueError('Error unpacking VariantRecord')
 * 
 *     cdef bytes bkey = force_bytes(key)             # <<<<<<<<<<<<<<
 *     cdef bcf_info_t *info = bcf_get_info(hdr, r, bkey)
 * 
*/
  __pyx_t_2 = __pyx_f_5pysam_9libcutils_force_bytes(__pyx_v_key, NULL); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 689, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_v_bkey = ((PyObject*)__pyx_t_2);
  __pyx_t_2 = 0;

  /* "pysam/libcbcf.pyx":690
 * 
 *     cdef bytes bkey = force_bytes(key)
 *     cdef bcf_info_t *info = bcf_get_info(hdr, r, bkey)             # <<<<<<<<<<<<<<
 * 
 *     if info:
*/
  if (unlikely(__pyx_v_bkey == Py_None)) {
    PyErr_SetString(PyExc_TypeError, "expected bytes, NoneType found");
    __PYX_ERR(0, 690, __pyx_L1_error)
  }
  __pyx_t_8 = __Pyx_PyBytes_AsString(__pyx_v_bkey); if (unlikely((!__pyx_t_8) && PyErr_Occurred())) __PYX_ERR(0, 690, __pyx_L1_error)
  __pyx_v_info = bcf_get_info(__pyx_v_hdr, __pyx_v_r, __pyx_t_8);

  /* "pysam/libcbcf.pyx":692
 *     cdef bcf_info_t *info = bcf_get_info(hdr, r, bkey)
 * 
 *     if info:             # <<<<<<<<<<<<<<
 *         info_id = info.key
 *     else:
*/
  __pyx_t_1 = (__pyx_v_info != 0);
  if (__pyx_t_1) {

    /* "pysam/libcbcf.pyx":693
 * 
 *     if info:
 *         info_id = info.key             # <<<<<<<<<<<<<<
 *     else:
 *         info_id = bcf_header_get_info_id(hdr, bkey)
*/
    __pyx_t_9 = __pyx_v_info->key;
    __pyx_v_info_id = __pyx_t_9;

    /* "pysam/libcbcf.pyx":692
 *     cdef bcf_info_t *info = bcf_get_info(hdr, r, bkey)
 * 
 *     if info:             # <<<<<<<<<<<<<<
 *         info_id = info.key
 *     else:
*/
    goto __pyx_L5;
  }

  /* "pysam/libcbcf.pyx":695
 *         info_id = info.key
 *     else:
 *         info_id = bcf_header_get_info_id(hdr, bkey)             # <<<<<<<<<<<<<<
 * 
 *     if info_id < 0:
*/
  /*else*/ {
    __pyx_t_9 = __pyx_f_5pysam_7libcbcf_bcf_header_get_info_id(__pyx_v_hdr, __pyx_v_bkey); if (unlikely(__pyx_t_9 == ((int)-2) && PyErr_Occurred())) __PYX_ERR(0, 695, __pyx_L1_error)
    __pyx_v_info_id = __pyx_t_9;
  }
  __pyx_L5:;

  /* "pysam/libcbcf.pyx":697
 *         info_id = bcf_header_get_info_id(hdr, bkey)
 * 
 *     if info_id < 0:             # <<<<<<<<<<<<<<
 *         raise KeyError('unknown INFO: {}'.format(key))
 * 
*/
  __pyx_t_1 = (__pyx_v_info_id < 0);
  if (unlikely(__pyx_t_1)) {

    /* "pysam/libcbcf.pyx":698
 * 
 *     if info_id < 0:
 *         raise KeyError('unknown INFO: {}'.format(key))             # <<<<<<<<<<<<<<
 * 
 *     if not check_header_id(hdr, BCF_HL_INFO, info_id):
*/
    __pyx_t_3 = NULL;
    __Pyx_INCREF(__pyx_builtin_KeyError);
    __pyx_t_4 = __pyx_builtin_KeyError; 
    __pyx_t_11 = __pyx_mstate_global->__pyx_kp_u_unknown_INFO;
    __Pyx_INCREF(__pyx_t_11);
    __pyx_t_5 = 0;
    {
      PyObject *__pyx_callargs[2] = {__pyx_t_11, __pyx_v_key};
      __pyx_t_10 = __Pyx_PyObject_FastCallMethod(__pyx_mstate_global->__pyx_n_u_format, __pyx_callargs+__pyx_t_5, (2-__pyx_t_5) | (1*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
      __Pyx_XDECREF(__pyx_t_11); __pyx_t_11 = 0;
      if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 698, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_10);
    }
    __pyx_t_5 = 1;
    {
      PyObject *__pyx_callargs[2] = {__pyx_t_3, __pyx_t_10};
      __pyx_t_2 = __Pyx_PyObject_FastCall(__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_10); __pyx_t_10 = 0;
      __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
      if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 698, __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, 698, __pyx_L1_error)

    /* "pysam/libcbcf.pyx":697
 *         info_id = bcf_header_get_info_id(hdr, bkey)
 * 
 *     if info_id < 0:             # <<<<<<<<<<<<<<
 *         raise KeyError('unknown INFO: {}'.format(key))
 * 
*/
  }

  /* "pysam/libcbcf.pyx":700
 *         raise KeyError('unknown INFO: {}'.format(key))
 * 
 *     if not check_header_id(hdr, BCF_HL_INFO, info_id):             # <<<<<<<<<<<<<<
 *         raise ValueError('Invalid header')
 * 
*/
  __pyx_t_1 = __pyx_f_5pysam_7libcbcf_check_header_id(__pyx_v_hdr, BCF_HL_INFO, __pyx_v_info_id); if (unlikely(__pyx_t_1 == ((int)-1) && PyErr_Occurred())) __PYX_ERR(0, 700, __pyx_L1_error)
  __pyx_t_12 = (!__pyx_t_1);
  if (unlikely(__pyx_t_12)) {

    /* "pysam/libcbcf.pyx":701
 * 
 *     if not check_header_id(hdr, BCF_HL_INFO, info_id):
 *         raise ValueError('Invalid header')             # <<<<<<<<<<<<<<
 * 
 *     info_type = bcf_hdr_id2type(hdr, BCF_HL_INFO, info_id)
*/
    __pyx_t_4 = NULL;
    __Pyx_INCREF(__pyx_builtin_ValueError);
    __pyx_t_10 = __pyx_builtin_ValueError; 
    __pyx_t_5 = 1;
    {
      PyObject *__pyx_callargs[2] = {__pyx_t_4, __pyx_mstate_global->__pyx_kp_u_Invalid_header};
      __pyx_t_2 = __Pyx_PyObject_FastCall(__pyx_t_10, __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_10); __pyx_t_10 = 0;
      if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 701, __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, 701, __pyx_L1_error)

    /* "pysam/libcbcf.pyx":700
 *         raise KeyError('unknown INFO: {}'.format(key))
 * 
 *     if not check_header_id(hdr, BCF_HL_INFO, info_id):             # <<<<<<<<<<<<<<
 *         raise ValueError('Invalid header')
 * 
*/
  }

  /* "pysam/libcbcf.pyx":703
 *         raise ValueError('Invalid header')
 * 
 *     info_type = bcf_hdr_id2type(hdr, BCF_HL_INFO, info_id)             # <<<<<<<<<<<<<<
 *     values = bcf_check_values(record, value, -1,
 *                               BCF_HL_INFO, info_type, info_id,
*/
  __pyx_v_info_type = bcf_hdr_id2type(__pyx_v_hdr, BCF_HL_INFO, __pyx_v_info_id);

  /* "pysam/libcbcf.pyx":706
 *     values = bcf_check_values(record, value, -1,
 *                               BCF_HL_INFO, info_type, info_id,
 *                               info.type if info else -1,             # <<<<<<<<<<<<<<
 *                               info.len  if info else -1,
 *                               &value_count, &scalar, &realloc)
*/
  __pyx_t_12 = (__pyx_v_info != 0);
  if (__pyx_t_12) {
    __pyx_t_9 = __pyx_v_info->type;
  } else {
    __pyx_t_9 = -1;
  }

  /* "pysam/libcbcf.pyx":707
 *                               BCF_HL_INFO, info_type, info_id,
 *                               info.type if info else -1,
 *                               info.len  if info else -1,             # <<<<<<<<<<<<<<
 *                               &value_count, &scalar, &realloc)
 * 
*/
  __pyx_t_12 = (__pyx_v_info != 0);
  if (__pyx_t_12) {
    __pyx_t_13 = __pyx_v_info->len;
  } else {
    __pyx_t_13 = -1L;
  }

  /* "pysam/libcbcf.pyx":704
 * 
 *     info_type = bcf_hdr_id2type(hdr, BCF_HL_INFO, info_id)
 *     values = bcf_check_values(record, value, -1,             # <<<<<<<<<<<<<<
 *                               BCF_HL_INFO, info_type, info_id,
 *                               info.type if info else -1,
*/
  __pyx_t_2 = __pyx_f_5pysam_7libcbcf_bcf_check_values(__pyx_v_record, __pyx_v_value, -1, BCF_HL_INFO, __pyx_v_info_type, __pyx_v_info_id, __pyx_t_9, __pyx_t_13, (&__pyx_v_value_count), (&__pyx_v_scalar), (&__pyx_v_realloc)); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 704, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_v_values = __pyx_t_2;
  __pyx_t_2 = 0;

  /* "pysam/libcbcf.pyx":710
 *                               &value_count, &scalar, &realloc)
 * 
 *     if info_type == BCF_HT_FLAG:             # <<<<<<<<<<<<<<
 *         if bcf_update_info(hdr, r, bkey, NULL, bool(values[0]), info_type) < 0:
 *             raise ValueError('Unable to update INFO values')
*/
  __pyx_t_12 = (__pyx_v_info_type == BCF_HT_FLAG);
  if (__pyx_t_12) {

    /* "pysam/libcbcf.pyx":711
 * 
 *     if info_type == BCF_HT_FLAG:
 *         if bcf_update_info(hdr, r, bkey, NULL, bool(values[0]), info_type) < 0:             # <<<<<<<<<<<<<<
 *             raise ValueError('Unable to update INFO values')
 *         return
*/
    if (unlikely(__pyx_v_bkey == Py_None)) {
      PyErr_SetString(PyExc_TypeError, "expected bytes, NoneType found");
      __PYX_ERR(0, 711, __pyx_L1_error)
    }
    __pyx_t_14 = __Pyx_PyBytes_AsString(__pyx_v_bkey); if (unlikely((!__pyx_t_14) && PyErr_Occurred())) __PYX_ERR(0, 711, __pyx_L1_error)
    __pyx_t_2 = __Pyx_GetItemInt(__pyx_v_values, 0, long, 1, __Pyx_PyLong_From_long, 0, 0, 1, 1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 711, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __pyx_t_12 = __Pyx_PyObject_IsTrue(__pyx_t_2); if (unlikely((__pyx_t_12 < 0))) __PYX_ERR(0, 711, __pyx_L1_error)
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    __pyx_t_1 = (bcf_update_info(__pyx_v_hdr, __pyx_v_r, __pyx_t_14, NULL, (!(!__pyx_t_12)), __pyx_v_info_type) < 0);
    if (unlikely(__pyx_t_1)) {

      /* "pysam/libcbcf.pyx":712
 *     if info_type == BCF_HT_FLAG:
 *         if bcf_update_info(hdr, r, bkey, NULL, bool(values[0]), info_type) < 0:
 *             raise ValueError('Unable to update INFO values')             # <<<<<<<<<<<<<<
 *         return
 * 
*/
      __pyx_t_10 = NULL;
      __Pyx_INCREF(__pyx_builtin_ValueError);
      __pyx_t_4 = __pyx_builtin_ValueError; 
      __pyx_t_5 = 1;
      {
        PyObject *__pyx_callargs[2] = {__pyx_t_10, __pyx_mstate_global->__pyx_kp_u_Unable_to_update_INFO_values};
        __pyx_t_2 = __Pyx_PyObject_FastCall(__pyx_t_4, __pyx_callargs+__pyx_t_5, (2-__pyx_t_5) | (__pyx_t_5*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
        __Pyx_XDECREF(__pyx_t_10); __pyx_t_10 = 0;
        __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
        if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 712, __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, 712, __pyx_L1_error)

      /* "pysam/libcbcf.pyx":711
 * 
 *     if info_type == BCF_HT_FLAG:
 *         if bcf_update_info(hdr, r, bkey, NULL, bool(values[0]), info_type) < 0:             # <<<<<<<<<<<<<<
 *             raise ValueError('Unable to update INFO values')
 *         return
*/
    }

    /* "pysam/libcbcf.pyx":713
 *         if bcf_update_info(hdr, r, bkey, NULL, bool(values[0]), info_type) < 0:
 *             raise ValueError('Unable to update INFO values')
 *         return             # <<<<<<<<<<<<<<
 * 
 *     vlen = value_count < 0
*/
    __Pyx_XDECREF(__pyx_r);
    __pyx_r = Py_None; __Pyx_INCREF(Py_None);
    goto __pyx_L0;

    /* "pysam/libcbcf.pyx":710
 *                               &value_count, &scalar, &realloc)
 * 
 *     if info_type == BCF_HT_FLAG:             # <<<<<<<<<<<<<<
 *         if bcf_update_info(hdr, r, bkey, NULL, bool(values[0]), info_type) < 0:
 *             raise ValueError('Unable to update INFO values')
*/
  }

  /* "pysam/libcbcf.pyx":715
 *         return
 * 
 *     vlen = value_count < 0             # <<<<<<<<<<<<<<
 *     value_count = len(values)
 * 
*/
  __pyx_v_vlen = (__pyx_v_value_count < 0);

  /* "pysam/libcbcf.pyx":716
 * 
 *     vlen = value_count < 0
 *     value_count = len(values)             # <<<<<<<<<<<<<<
 * 
 *     # DISABLED DUE TO ISSUES WITH THE CRAZY POINTERS
*/
  __pyx_t_15 = PyObject_Length(__pyx_v_values); if (unlikely(__pyx_t_15 == ((Py_ssize_t)-1))) __PYX_ERR(0, 716, __pyx_L1_error)
  __pyx_v_value_count = __pyx_t_15;

  /* "pysam/libcbcf.pyx":745
 *         return
 * 
 *     alloc_len = max(1, value_count)             # <<<<<<<<<<<<<<
 *     if info and info.len > alloc_len:
 *         alloc_len = info.len
*/
  __pyx_t_13 = __pyx_v_value_count;
  __pyx_t_16 = 1;
  __pyx_t_1 = (__pyx_t_13 > __pyx_t_16);
  if (__pyx_t_1) {
    __pyx_t_17 = __pyx_t_13;
  } else {
    __pyx_t_17 = __pyx_t_16;
  }
  __pyx_v_alloc_len = __pyx_t_17;

  /* "pysam/libcbcf.pyx":746
 * 
 *     alloc_len = max(1, value_count)
 *     if info and info.len > alloc_len:             # <<<<<<<<<<<<<<
 *         alloc_len = info.len
 * 
*/
  __pyx_t_12 = (__pyx_v_info != 0);
  if (__pyx_t_12) {
  } else {
    __pyx_t_1 = __pyx_t_12;
    goto __pyx_L11_bool_binop_done;
  }
  __pyx_t_12 = (__pyx_v_info->len > __pyx_v_alloc_len);
  __pyx_t_1 = __pyx_t_12;
  __pyx_L11_bool_binop_done:;
  if (__pyx_t_1) {

    /* "pysam/libcbcf.pyx":747
 *     alloc_len = max(1, value_count)
 *     if info and info.len > alloc_len:
 *         alloc_len = info.len             # <<<<<<<<<<<<<<
 * 
 *     new_values = bcf_empty_array(info_type, alloc_len, vlen)
*/
    __pyx_t_9 = __pyx_v_info->len;
    __pyx_v_alloc_len = __pyx_t_9;

    /* "pysam/libcbcf.pyx":746
 * 
 *     alloc_len = max(1, value_count)
 *     if info and info.len > alloc_len:             # <<<<<<<<<<<<<<
 *         alloc_len = info.len
 * 
*/
  }

  /* "pysam/libcbcf.pyx":749
 *         alloc_len = info.len
 * 
 *     new_values = bcf_empty_array(info_type, alloc_len, vlen)             # <<<<<<<<<<<<<<
 *     cdef char *valp = <char *>new_values
 * 
*/
  __pyx_t_2 = __pyx_f_5pysam_7libcbcf_bcf_empty_array(__pyx_v_info_type, __pyx_v_alloc_len, __pyx_v_vlen); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 749, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_v_new_values = __pyx_t_2;
  __pyx_t_2 = 0;

  /* "pysam/libcbcf.pyx":750
 * 
 *     new_values = bcf_empty_array(info_type, alloc_len, vlen)
 *     cdef char *valp = <char *>new_values             # <<<<<<<<<<<<<<
 * 
 *     if info_type == BCF_HT_INT:
*/
  __pyx_t_18 = __Pyx_PyObject_AsWritableString(__pyx_v_new_values); if (unlikely((!__pyx_t_18) && PyErr_Occurred())) __PYX_ERR(0, 750, __pyx_L1_error)
  __pyx_v_valp = ((char *)__pyx_t_18);

  /* "pysam/libcbcf.pyx":752
 *     cdef char *valp = <char *>new_values
 * 
 *     if info_type == BCF_HT_INT:             # <<<<<<<<<<<<<<
 *         dst_type = BCF_BT_INT32
 *     elif info_type == BCF_HT_REAL:
*/
  __pyx_t_1 = (__pyx_v_info_type == BCF_HT_INT);
  if (__pyx_t_1) {

    /* "pysam/libcbcf.pyx":753
 * 
 *     if info_type == BCF_HT_INT:
 *         dst_type = BCF_BT_INT32             # <<<<<<<<<<<<<<
 *     elif info_type == BCF_HT_REAL:
 *         dst_type = BCF_BT_FLOAT
*/
    __pyx_v_dst_type = BCF_BT_INT32;

    /* "pysam/libcbcf.pyx":752
 *     cdef char *valp = <char *>new_values
 * 
 *     if info_type == BCF_HT_INT:             # <<<<<<<<<<<<<<
 *         dst_type = BCF_BT_INT32
 *     elif info_type == BCF_HT_REAL:
*/
    goto __pyx_L13;
  }

  /* "pysam/libcbcf.pyx":754
 *     if info_type == BCF_HT_INT:
 *         dst_type = BCF_BT_INT32
 *     elif info_type == BCF_HT_REAL:             # <<<<<<<<<<<<<<
 *         dst_type = BCF_BT_FLOAT
 *     elif info_type == BCF_HT_STR:
*/
  __pyx_t_1 = (__pyx_v_info_type == BCF_HT_REAL);
  if (__pyx_t_1) {

    /* "pysam/libcbcf.pyx":755
 *         dst_type = BCF_BT_INT32
 *     elif info_type == BCF_HT_REAL:
 *         dst_type = BCF_BT_FLOAT             # <<<<<<<<<<<<<<
 *     elif info_type == BCF_HT_STR:
 *         dst_type = BCF_BT_CHAR
*/
    __pyx_v_dst_type = BCF_BT_FLOAT;

    /* "pysam/libcbcf.pyx":754
 *     if info_type == BCF_HT_INT:
 *         dst_type = BCF_BT_INT32
 *     elif info_type == BCF_HT_REAL:             # <<<<<<<<<<<<<<
 *         dst_type = BCF_BT_FLOAT
 *     elif info_type == BCF_HT_STR:
*/
    goto __pyx_L13;
  }

  /* "pysam/libcbcf.pyx":756
 *     elif info_type == BCF_HT_REAL:
 *         dst_type = BCF_BT_FLOAT
 *     elif info_type == BCF_HT_STR:             # <<<<<<<<<<<<<<
 *         dst_type = BCF_BT_CHAR
 *     else:
*/
  __pyx_t_1 = (__pyx_v_info_type == BCF_HT_STR);
  if (likely(__pyx_t_1)) {

    /* "pysam/libcbcf.pyx":757
 *         dst_type = BCF_BT_FLOAT
 *     elif info_type == BCF_HT_STR:
 *         dst_type = BCF_BT_CHAR             # <<<<<<<<<<<<<<
 *     else:
 *         raise ValueError('Unsupported INFO type')
*/
    __pyx_v_dst_type = BCF_BT_CHAR;

    /* "pysam/libcbcf.pyx":756
 *     elif info_type == BCF_HT_REAL:
 *         dst_type = BCF_BT_FLOAT
 *     elif info_type == BCF_HT_STR:             # <<<<<<<<<<<<<<
 *         dst_type = BCF_BT_CHAR
 *     else:
*/
    goto __pyx_L13;
  }

  /* "pysam/libcbcf.pyx":759
 *         dst_type = BCF_BT_CHAR
 *     else:
 *         raise ValueError('Unsupported INFO type')             # <<<<<<<<<<<<<<
 * 
 *     bcf_object_to_array(values, valp, dst_type, alloc_len, vlen)
*/
  /*else*/ {
    __pyx_t_4 = NULL;
    __Pyx_INCREF(__pyx_builtin_ValueError);
    __pyx_t_10 = __pyx_builtin_ValueError; 
    __pyx_t_5 = 1;
    {
      PyObject *__pyx_callargs[2] = {__pyx_t_4, __pyx_mstate_global->__pyx_kp_u_Unsupported_INFO_type};
      __pyx_t_2 = __Pyx_PyObject_FastCall(__pyx_t_10, __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_10); __pyx_t_10 = 0;
      if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 759, __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, 759, __pyx_L1_error)
  }
  __pyx_L13:;

  /* "pysam/libcbcf.pyx":761
 *         raise ValueError('Unsupported INFO type')
 * 
 *     bcf_object_to_array(values, valp, dst_type, alloc_len, vlen)             # <<<<<<<<<<<<<<
 * 
 *     if bcf_update_info(hdr, r, bkey, valp, <int>alloc_len, info_type) < 0:
*/
  __pyx_t_2 = __pyx_f_5pysam_7libcbcf_bcf_object_to_array(__pyx_v_values, __pyx_v_valp, __pyx_v_dst_type, __pyx_v_alloc_len, __pyx_v_vlen); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 761, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

  /* "pysam/libcbcf.pyx":763
 *     bcf_object_to_array(values, valp, dst_type, alloc_len, vlen)
 * 
 *     if bcf_update_info(hdr, r, bkey, valp, <int>alloc_len, info_type) < 0:             # <<<<<<<<<<<<<<
 *         raise ValueError('Unable to update INFO values')
 * 
*/
  if (unlikely(__pyx_v_bkey == Py_None)) {
    PyErr_SetString(PyExc_TypeError, "expected bytes, NoneType found");
    __PYX_ERR(0, 763, __pyx_L1_error)
  }
  __pyx_t_14 = __Pyx_PyBytes_AsString(__pyx_v_bkey); if (unlikely((!__pyx_t_14) && PyErr_Occurred())) __PYX_ERR(0, 763, __pyx_L1_error)
  __pyx_t_1 = (bcf_update_info(__pyx_v_hdr, __pyx_v_r, __pyx_t_14, __pyx_v_valp, ((int)__pyx_v_alloc_len), __pyx_v_info_type) < 0);
  if (unlikely(__pyx_t_1)) {

    /* "pysam/libcbcf.pyx":764
 * 
 *     if bcf_update_info(hdr, r, bkey, valp, <int>alloc_len, info_type) < 0:
 *         raise ValueError('Unable to update INFO values')             # <<<<<<<<<<<<<<
 * 
 * 
*/
    __pyx_t_10 = NULL;
    __Pyx_INCREF(__pyx_builtin_ValueError);
    __pyx_t_4 = __pyx_builtin_ValueError; 
    __pyx_t_5 = 1;
    {
      PyObject *__pyx_callargs[2] = {__pyx_t_10, __pyx_mstate_global->__pyx_kp_u_Unable_to_update_INFO_values};
      __pyx_t_2 = __Pyx_PyObject_FastCall(__pyx_t_4, __pyx_callargs+__pyx_t_5, (2-__pyx_t_5) | (__pyx_t_5*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
      __Pyx_XDECREF(__pyx_t_10); __pyx_t_10 = 0;
      __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
      if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 764, __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, 764, __pyx_L1_error)

    /* "pysam/libcbcf.pyx":763
 *     bcf_object_to_array(values, valp, dst_type, alloc_len, vlen)
 * 
 *     if bcf_update_info(hdr, r, bkey, valp, <int>alloc_len, info_type) < 0:             # <<<<<<<<<<<<<<
 *         raise ValueError('Unable to update INFO values')
 * 
*/
  }

  /* "pysam/libcbcf.pyx":677
 * 
 * 
 * cdef bcf_info_set_value(VariantRecord record, key, value):             # <<<<<<<<<<<<<<
 *     if record is None:
 *         raise ValueError('record must not be None')
*/

  /* function exit code */
  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  __Pyx_TraceReturnValue(__pyx_r, 0, 0, __PYX_ERR(0, 677, __pyx_L1_error));
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_XDECREF(__pyx_t_10);
  __Pyx_XDECREF(__pyx_t_11);
  __Pyx_TraceException(__pyx_lineno, 0, 0);
  #if CYTHON_USE_SYS_MONITORING
  __Pyx_TraceExceptionUnwind(0, 0);
  #else
  __Pyx_TraceReturnValue(NULL, 0, 0, __PYX_ERR(0, 677, __pyx_L1_error));
  #endif
  __Pyx_AddTraceback("pysam.libcbcf.bcf_info_set_value", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_bkey);
  __Pyx_XDECREF(__pyx_v_values);
  __Pyx_XDECREF(__pyx_v_new_values);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_PyMonitoring_ExitScope(0);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "pysam/libcbcf.pyx":767
 * 
 * 
 * cdef bcf_info_del_value(VariantRecord record, key):             # <<<<<<<<<<<<<<
 *     if record is None:
 *         raise ValueError('record must not be None')
*/

static PyObject *__pyx_f_5pysam_7libcbcf_bcf_info_del_value(struct __pyx_obj_5pysam_7libcbcf_VariantRecord *__pyx_v_record, PyObject *__pyx_v_key) {
  bcf_hdr_t *__pyx_v_hdr;
  bcf1_t *__pyx_v_r;
  Py_ssize_t __pyx_v_value_count;
  int __pyx_v_scalar;
  PyObject *__pyx_v_bkey = 0;
  bcf_info_t *__pyx_v_info;
  PyObject *__pyx_v_null_value = NULL;
  PyObject *__pyx_r = NULL;
  __Pyx_TraceDeclarationsFunc
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  PyObject *__pyx_t_4 = NULL;
  size_t __pyx_t_5;
  bcf_hdr_t *__pyx_t_6;
  bcf1_t *__pyx_t_7;
  char const *__pyx_t_8;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_TraceFrameInit(((PyObject *)__pyx_mstate_global->__pyx_codeobj_tab[20]))
  __Pyx_RefNannySetupContext("bcf_info_del_value", 0);
  __Pyx_TraceStartFunc("bcf_info_del_value", __pyx_f[0], 767, 0, 0, 0, __PYX_ERR(0, 767, __pyx_L1_error));

  /* "pysam/libcbcf.pyx":768
 * 
 * cdef bcf_info_del_value(VariantRecord record, key):
 *     if record is None:             # <<<<<<<<<<<<<<
 *         raise ValueError('record must not be None')
 * 
*/
  __pyx_t_1 = (((PyObject *)__pyx_v_record) == Py_None);
  if (unlikely(__pyx_t_1)) {

    /* "pysam/libcbcf.pyx":769
 * cdef bcf_info_del_value(VariantRecord record, key):
 *     if record is None:
 *         raise ValueError('record must not be None')             # <<<<<<<<<<<<<<
 * 
 *     cdef bcf_hdr_t *hdr = record.header.ptr
*/
    __pyx_t_3 = NULL;
    __Pyx_INCREF(__pyx_builtin_ValueError);
    __pyx_t_4 = __pyx_builtin_ValueError; 
    __pyx_t_5 = 1;
    {
      PyObject *__pyx_callargs[2] = {__pyx_t_3, __pyx_mstate_global->__pyx_kp_u_record_must_not_be_None};
      __pyx_t_2 = __Pyx_PyObject_FastCall(__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_2)) __PYX_ERR(0, 769, __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, 769, __pyx_L1_error)

    /* "pysam/libcbcf.pyx":768
 * 
 * cdef bcf_info_del_value(VariantRecord record, key):
 *     if record is None:             # <<<<<<<<<<<<<<
 *         raise ValueError('record must not be None')
 * 
*/
  }

  /* "pysam/libcbcf.pyx":771
 *         raise ValueError('record must not be None')
 * 
 *     cdef bcf_hdr_t *hdr = record.header.ptr             # <<<<<<<<<<<<<<
 *     cdef bcf1_t *r = record.ptr
 *     cdef ssize_t value_count
*/
  __pyx_t_6 = __pyx_v_record->header->ptr;
  __pyx_v_hdr = __pyx_t_6;

  /* "pysam/libcbcf.pyx":772
 * 
 *     cdef bcf_hdr_t *hdr = record.header.ptr
 *     cdef bcf1_t *r = record.ptr             # <<<<<<<<<<<<<<
 *     cdef ssize_t value_count
 *     cdef int scalar
*/
  __pyx_t_7 = __pyx_v_record->ptr;
  __pyx_v_r = __pyx_t_7;

  /* "pysam/libcbcf.pyx":776
 *     cdef int scalar
 * 
 *     if bcf_unpack(r, BCF_UN_INFO) < 0:             # <<<<<<<<<<<<<<
 *         raise ValueError('Error unpacking VariantRecord')
 * 
*/
  __pyx_t_1 = (bcf_unpack(__pyx_v_r, BCF_UN_INFO) < 0);
  if (unlikely(__pyx_t_1)) {

    /* "pysam/libcbcf.pyx":777
 * 
 *     if bcf_unpack(r, BCF_UN_INFO) < 0:
 *         raise ValueError('Error unpacking VariantRecord')             # <<<<<<<<<<<<<<
 * 
 *     cdef bytes bkey = force_bytes(key)
*/
    __pyx_t_4 = NULL;
    __Pyx_INCREF(__pyx_builtin_ValueError);
    __pyx_t_3 = __pyx_builtin_ValueError; 
    __pyx_t_5 = 1;
    {
      PyObject *__pyx_callargs[2] = {__pyx_t_4, __pyx_mstate_global->__pyx_kp_u_Error_unpacking_VariantRecord};
      __pyx_t_2 = __Pyx_PyObject_FastCall(__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_2)) __PYX_ERR(0, 777, __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, 777, __pyx_L1_error)

    /* "pysam/libcbcf.pyx":776
 *     cdef int scalar
 * 
 *     if bcf_unpack(r, BCF_UN_INFO) < 0:             # <<<<<<<<<<<<<<
 *         raise ValueError('Error unpacking VariantRecord')
 * 
*/
  }

  /* "pysam/libcbcf.pyx":779
 *         raise ValueError('Error unpacking VariantRecord')
 * 
 *     cdef bytes bkey = force_bytes(key)             # <<<<<<<<<<<<<<
 *     cdef bcf_info_t *info = bcf_get_info(hdr, r, bkey)
 * 
*/
  __pyx_t_2 = __pyx_f_5pysam_9libcutils_force_bytes(__pyx_v_key, NULL); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 779, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_v_bkey = ((PyObject*)__pyx_t_2);
  __pyx_t_2 = 0;

  /* "pysam/libcbcf.pyx":780
 * 
 *     cdef bytes bkey = force_bytes(key)
 *     cdef bcf_info_t *info = bcf_get_info(hdr, r, bkey)             # <<<<<<<<<<<<<<
 * 
 *     if not info:
*/
  if (unlikely(__pyx_v_bkey == Py_None)) {
    PyErr_SetString(PyExc_TypeError, "expected bytes, NoneType found");
    __PYX_ERR(0, 780, __pyx_L1_error)
  }
  __pyx_t_8 = __Pyx_PyBytes_AsString(__pyx_v_bkey); if (unlikely((!__pyx_t_8) && PyErr_Occurred())) __PYX_ERR(0, 780, __pyx_L1_error)
  __pyx_v_info = bcf_get_info(__pyx_v_hdr, __pyx_v_r, __pyx_t_8);

  /* "pysam/libcbcf.pyx":782
 *     cdef bcf_info_t *info = bcf_get_info(hdr, r, bkey)
 * 
 *     if not info:             # <<<<<<<<<<<<<<
 *         raise KeyError(key)
 * 
*/
  __pyx_t_1 = (!(__pyx_v_info != 0));
  if (unlikely(__pyx_t_1)) {

    /* "pysam/libcbcf.pyx":783
 * 
 *     if not info:
 *         raise KeyError(key)             # <<<<<<<<<<<<<<
 * 
 *     bcf_get_value_count(record, BCF_HL_INFO, info.key, &value_count, &scalar, -1)
*/
    __pyx_t_3 = NULL;
    __Pyx_INCREF(__pyx_builtin_KeyError);
    __pyx_t_4 = __pyx_builtin_KeyError; 
    __pyx_t_5 = 1;
    {
      PyObject *__pyx_callargs[2] = {__pyx_t_3, __pyx_v_key};
      __pyx_t_2 = __Pyx_PyObject_FastCall(__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_2)) __PYX_ERR(0, 783, __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, 783, __pyx_L1_error)

    /* "pysam/libcbcf.pyx":782
 *     cdef bcf_info_t *info = bcf_get_info(hdr, r, bkey)
 * 
 *     if not info:             # <<<<<<<<<<<<<<
 *         raise KeyError(key)
 * 
*/
  }

  /* "pysam/libcbcf.pyx":785
 *         raise KeyError(key)
 * 
 *     bcf_get_value_count(record, BCF_HL_INFO, info.key, &value_count, &scalar, -1)             # <<<<<<<<<<<<<<
 * 
 *     if value_count <= 0:
*/
  __pyx_t_2 = __pyx_f_5pysam_7libcbcf_bcf_get_value_count(__pyx_v_record, BCF_HL_INFO, __pyx_v_info->key, (&__pyx_v_value_count), (&__pyx_v_scalar), -1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 785, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

  /* "pysam/libcbcf.pyx":787
 *     bcf_get_value_count(record, BCF_HL_INFO, info.key, &value_count, &scalar, -1)
 * 
 *     if value_count <= 0:             # <<<<<<<<<<<<<<
 *         null_value = ()
 *     elif scalar:
*/
  __pyx_t_1 = (__pyx_v_value_count <= 0);
  if (__pyx_t_1) {

    /* "pysam/libcbcf.pyx":788
 * 
 *     if value_count <= 0:
 *         null_value = ()             # <<<<<<<<<<<<<<
 *     elif scalar:
 *         null_value = None
*/
    __Pyx_INCREF(__pyx_mstate_global->__pyx_empty_tuple);
    __pyx_v_null_value = __pyx_mstate_global->__pyx_empty_tuple;

    /* "pysam/libcbcf.pyx":787
 *     bcf_get_value_count(record, BCF_HL_INFO, info.key, &value_count, &scalar, -1)
 * 
 *     if value_count <= 0:             # <<<<<<<<<<<<<<
 *         null_value = ()
 *     elif scalar:
*/
    goto __pyx_L6;
  }

  /* "pysam/libcbcf.pyx":789
 *     if value_count <= 0:
 *         null_value = ()
 *     elif scalar:             # <<<<<<<<<<<<<<
 *         null_value = None
 *     else:
*/
  __pyx_t_1 = (__pyx_v_scalar != 0);
  if (__pyx_t_1) {

    /* "pysam/libcbcf.pyx":790
 *         null_value = ()
 *     elif scalar:
 *         null_value = None             # <<<<<<<<<<<<<<
 *     else:
 *         null_value = (None,)*value_count
*/
    __Pyx_INCREF(Py_None);
    __pyx_v_null_value = ((PyObject*)Py_None);

    /* "pysam/libcbcf.pyx":789
 *     if value_count <= 0:
 *         null_value = ()
 *     elif scalar:             # <<<<<<<<<<<<<<
 *         null_value = None
 *     else:
*/
    goto __pyx_L6;
  }

  /* "pysam/libcbcf.pyx":792
 *         null_value = None
 *     else:
 *         null_value = (None,)*value_count             # <<<<<<<<<<<<<<
 * 
 *     bcf_info_set_value(record, bkey, null_value)
*/
  /*else*/ {
    __pyx_t_2 = __Pyx_PySequence_Multiply(__pyx_mstate_global->__pyx_tuple[0], __pyx_v_value_count); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 792, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __pyx_v_null_value = ((PyObject*)__pyx_t_2);
    __pyx_t_2 = 0;
  }
  __pyx_L6:;

  /* "pysam/libcbcf.pyx":794
 *         null_value = (None,)*value_count
 * 
 *     bcf_info_set_value(record, bkey, null_value)             # <<<<<<<<<<<<<<
 * 
 * 
*/
  __pyx_t_2 = __pyx_f_5pysam_7libcbcf_bcf_info_set_value(__pyx_v_record, __pyx_v_bkey, __pyx_v_null_value); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 794, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

  /* "pysam/libcbcf.pyx":767
 * 
 * 
 * cdef bcf_info_del_value(VariantRecord record, key):             # <<<<<<<<<<<<<<
 *     if record is None:
 *         raise ValueError('record must not be None')
*/

  /* function exit code */
  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  __Pyx_TraceReturnValue(__pyx_r, 0, 0, __PYX_ERR(0, 767, __pyx_L1_error));
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_TraceException(__pyx_lineno, 0, 0);
  #if CYTHON_USE_SYS_MONITORING
  __Pyx_TraceExceptionUnwind(0, 0);
  #else
  __Pyx_TraceReturnValue(NULL, 0, 0, __PYX_ERR(0, 767, __pyx_L1_error));
  #endif
  __Pyx_AddTraceback("pysam.libcbcf.bcf_info_del_value", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_bkey);
  __Pyx_XDECREF(__pyx_v_null_value);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_PyMonitoring_ExitScope(0);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "pysam/libcbcf.pyx":797
 * 
 * 
 * cdef bcf_format_get_value(VariantRecordSample sample, key):             # <<<<<<<<<<<<<<
 *     if sample is None:
 *         raise ValueError('sample must not be None')
*/

static PyObject *__pyx_f_5pysam_7libcbcf_bcf_format_get_value(struct __pyx_obj_5pysam_7libcbcf_VariantRecordSample *__pyx_v_sample, PyObject *__pyx_v_key) {
  bcf_hdr_t *__pyx_v_hdr;
  bcf1_t *__pyx_v_r;
  Py_ssize_t __pyx_v_count;
  int __pyx_v_scalar;
  PyObject *__pyx_v_bkey = 0;
  bcf_fmt_t *__pyx_v_fmt;
  PyObject *__pyx_r = NULL;
  __Pyx_TraceDeclarationsFunc
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  PyObject *__pyx_t_4 = NULL;
  size_t __pyx_t_5;
  bcf_hdr_t *__pyx_t_6;
  bcf1_t *__pyx_t_7;
  char const *__pyx_t_8;
  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_TraceFrameInit(((PyObject *)__pyx_mstate_global->__pyx_codeobj_tab[21]))
  __Pyx_RefNannySetupContext("bcf_format_get_value", 0);
  __Pyx_TraceStartFunc("bcf_format_get_value", __pyx_f[0], 797, 0, 0, 0, __PYX_ERR(0, 797, __pyx_L1_error));

  /* "pysam/libcbcf.pyx":798
 * 
 * cdef bcf_format_get_value(VariantRecordSample sample, key):
 *     if sample is None:             # <<<<<<<<<<<<<<
 *         raise ValueError('sample must not be None')
 * 
*/
  __pyx_t_1 = (((PyObject *)__pyx_v_sample) == Py_None);
  if (unlikely(__pyx_t_1)) {

    /* "pysam/libcbcf.pyx":799
 * cdef bcf_format_get_value(VariantRecordSample sample, key):
 *     if sample is None:
 *         raise ValueError('sample must not be None')             # <<<<<<<<<<<<<<
 * 
 *     cdef bcf_hdr_t *hdr = sample.record.header.ptr
*/
    __pyx_t_3 = NULL;
    __Pyx_INCREF(__pyx_builtin_ValueError);
    __pyx_t_4 = __pyx_builtin_ValueError; 
    __pyx_t_5 = 1;
    {
      PyObject *__pyx_callargs[2] = {__pyx_t_3, __pyx_mstate_global->__pyx_kp_u_sample_must_not_be_None};
      __pyx_t_2 = __Pyx_PyObject_FastCall(__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_2)) __PYX_ERR(0, 799, __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, 799, __pyx_L1_error)

    /* "pysam/libcbcf.pyx":798
 * 
 * cdef bcf_format_get_value(VariantRecordSample sample, key):
 *     if sample is None:             # <<<<<<<<<<<<<<
 *         raise ValueError('sample must not be None')
 * 
*/
  }

  /* "pysam/libcbcf.pyx":801
 *         raise ValueError('sample must not be None')
 * 
 *     cdef bcf_hdr_t *hdr = sample.record.header.ptr             # <<<<<<<<<<<<<<
 *     cdef bcf1_t *r = sample.record.ptr
 *     cdef ssize_t count
*/
  __pyx_t_6 = __pyx_v_sample->record->header->ptr;
  __pyx_v_hdr = __pyx_t_6;

  /* "pysam/libcbcf.pyx":802
 * 
 *     cdef bcf_hdr_t *hdr = sample.record.header.ptr
 *     cdef bcf1_t *r = sample.record.ptr             # <<<<<<<<<<<<<<
 *     cdef ssize_t count
 *     cdef int scalar
*/
  __pyx_t_7 = __pyx_v_sample->record->ptr;
  __pyx_v_r = __pyx_t_7;

  /* "pysam/libcbcf.pyx":806
 *     cdef int scalar
 * 
 *     if bcf_unpack(r, BCF_UN_ALL) < 0:             # <<<<<<<<<<<<<<
 *         raise ValueError('Error unpacking VariantRecord')
 * 
*/
  __pyx_t_1 = (bcf_unpack(__pyx_v_r, BCF_UN_ALL) < 0);
  if (unlikely(__pyx_t_1)) {

    /* "pysam/libcbcf.pyx":807
 * 
 *     if bcf_unpack(r, BCF_UN_ALL) < 0:
 *         raise ValueError('Error unpacking VariantRecord')             # <<<<<<<<<<<<<<
 * 
 *     cdef bytes bkey = force_bytes(key)
*/
    __pyx_t_4 = NULL;
    __Pyx_INCREF(__pyx_builtin_ValueError);
    __pyx_t_3 = __pyx_builtin_ValueError; 
    __pyx_t_5 = 1;
    {
      PyObject *__pyx_callargs[2] = {__pyx_t_4, __pyx_mstate_global->__pyx_kp_u_Error_unpacking_VariantRecord};
      __pyx_t_2 = __Pyx_PyObject_FastCall(__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_2)) __PYX_ERR(0, 807, __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, 807, __pyx_L1_error)

    /* "pysam/libcbcf.pyx":806
 *     cdef int scalar
 * 
 *     if bcf_unpack(r, BCF_UN_ALL) < 0:             # <<<<<<<<<<<<<<
 *         raise ValueError('Error unpacking VariantRecord')
 * 
*/
  }

  /* "pysam/libcbcf.pyx":809
 *         raise ValueError('Error unpacking VariantRecord')
 * 
 *     cdef bytes bkey = force_bytes(key)             # <<<<<<<<<<<<<<
 *     cdef bcf_fmt_t *fmt = bcf_get_fmt(hdr, r, bkey)
 * 
*/
  __pyx_t_2 = __pyx_f_5pysam_9libcutils_force_bytes(__pyx_v_key, NULL); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 809, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_v_bkey = ((PyObject*)__pyx_t_2);
  __pyx_t_2 = 0;

  /* "pysam/libcbcf.pyx":810
 * 
 *     cdef bytes bkey = force_bytes(key)
 *     cdef bcf_fmt_t *fmt = bcf_get_fmt(hdr, r, bkey)             # <<<<<<<<<<<<<<
 * 
 *     if not fmt or not fmt.p:
*/
  if (unlikely(__pyx_v_bkey == Py_None)) {
    PyErr_SetString(PyExc_TypeError, "expected bytes, NoneType found");
    __PYX_ERR(0, 810, __pyx_L1_error)
  }
  __pyx_t_8 = __Pyx_PyBytes_AsString(__pyx_v_bkey); if (unlikely((!__pyx_t_8) && PyErr_Occurred())) __PYX_ERR(0, 810, __pyx_L1_error)
  __pyx_v_fmt = bcf_get_fmt(__pyx_v_hdr, __pyx_v_r, __pyx_t_8);

  /* "pysam/libcbcf.pyx":812
 *     cdef bcf_fmt_t *fmt = bcf_get_fmt(hdr, r, bkey)
 * 
 *     if not fmt or not fmt.p:             # <<<<<<<<<<<<<<
 *         raise KeyError('invalid FORMAT: {}'.format(key))
 * 
*/
  __pyx_t_9 = (!(__pyx_v_fmt != 0));
  if (!__pyx_t_9) {
  } else {
    __pyx_t_1 = __pyx_t_9;
    goto __pyx_L6_bool_binop_done;
  }
  __pyx_t_9 = (!(__pyx_v_fmt->p != 0));
  __pyx_t_1 = __pyx_t_9;
  __pyx_L6_bool_binop_done:;
  if (unlikely(__pyx_t_1)) {

    /* "pysam/libcbcf.pyx":813
 * 
 *     if not fmt or not fmt.p:
 *         raise KeyError('invalid FORMAT: {}'.format(key))             # <<<<<<<<<<<<<<
 * 
 *     if is_gt_fmt(hdr, fmt.id):
*/
    __pyx_t_3 = NULL;
    __Pyx_INCREF(__pyx_builtin_KeyError);
    __pyx_t_4 = __pyx_builtin_KeyError; 
    __pyx_t_11 = __pyx_mstate_global->__pyx_kp_u_invalid_FORMAT;
    __Pyx_INCREF(__pyx_t_11);
    __pyx_t_5 = 0;
    {
      PyObject *__pyx_callargs[2] = {__pyx_t_11, __pyx_v_key};
      __pyx_t_10 = __Pyx_PyObject_FastCallMethod(__pyx_mstate_global->__pyx_n_u_format, __pyx_callargs+__pyx_t_5, (2-__pyx_t_5) | (1*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
      __Pyx_XDECREF(__pyx_t_11); __pyx_t_11 = 0;
      if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 813, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_10);
    }
    __pyx_t_5 = 1;
    {
      PyObject *__pyx_callargs[2] = {__pyx_t_3, __pyx_t_10};
      __pyx_t_2 = __Pyx_PyObject_FastCall(__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_10); __pyx_t_10 = 0;
      __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
      if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 813, __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, 813, __pyx_L1_error)

    /* "pysam/libcbcf.pyx":812
 *     cdef bcf_fmt_t *fmt = bcf_get_fmt(hdr, r, bkey)
 * 
 *     if not fmt or not fmt.p:             # <<<<<<<<<<<<<<
 *         raise KeyError('invalid FORMAT: {}'.format(key))
 * 
*/
  }

  /* "pysam/libcbcf.pyx":815
 *         raise KeyError('invalid FORMAT: {}'.format(key))
 * 
 *     if is_gt_fmt(hdr, fmt.id):             # <<<<<<<<<<<<<<
 *         return bcf_format_get_allele_indices(sample)
 * 
*/
  __pyx_t_12 = __pyx_f_5pysam_7libcbcf_is_gt_fmt(__pyx_v_hdr, __pyx_v_fmt->id); if (unlikely(__pyx_t_12 == ((int)-1) && PyErr_Occurred())) __PYX_ERR(0, 815, __pyx_L1_error)
  __pyx_t_1 = (__pyx_t_12 != 0);
  if (__pyx_t_1) {

    /* "pysam/libcbcf.pyx":816
 * 
 *     if is_gt_fmt(hdr, fmt.id):
 *         return bcf_format_get_allele_indices(sample)             # <<<<<<<<<<<<<<
 * 
 *     bcf_get_value_count(sample.record, BCF_HL_FMT, fmt.id, &count, &scalar, sample.index)
*/
    __Pyx_XDECREF(__pyx_r);
    __pyx_t_2 = __pyx_f_5pysam_7libcbcf_bcf_format_get_allele_indices(__pyx_v_sample); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 816, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __pyx_r = __pyx_t_2;
    __pyx_t_2 = 0;
    __Pyx_TraceReturnValue(__pyx_r, 59, 0, __PYX_ERR(0, 816, __pyx_L1_error));
    goto __pyx_L0;

    /* "pysam/libcbcf.pyx":815
 *         raise KeyError('invalid FORMAT: {}'.format(key))
 * 
 *     if is_gt_fmt(hdr, fmt.id):             # <<<<<<<<<<<<<<
 *         return bcf_format_get_allele_indices(sample)
 * 
*/
  }

  /* "pysam/libcbcf.pyx":818
 *         return bcf_format_get_allele_indices(sample)
 * 
 *     bcf_get_value_count(sample.record, BCF_HL_FMT, fmt.id, &count, &scalar, sample.index)             # <<<<<<<<<<<<<<
 * 
 *     if fmt.p and fmt.n and fmt.size:
*/
  __pyx_t_2 = ((PyObject *)__pyx_v_sample->record);
  __Pyx_INCREF(__pyx_t_2);
  __pyx_t_4 = __pyx_f_5pysam_7libcbcf_bcf_get_value_count(((struct __pyx_obj_5pysam_7libcbcf_VariantRecord *)__pyx_t_2), BCF_HL_FMT, __pyx_v_fmt->id, (&__pyx_v_count), (&__pyx_v_scalar), __pyx_v_sample->index); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 818, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;

  /* "pysam/libcbcf.pyx":820
 *     bcf_get_value_count(sample.record, BCF_HL_FMT, fmt.id, &count, &scalar, sample.index)
 * 
 *     if fmt.p and fmt.n and fmt.size:             # <<<<<<<<<<<<<<
 *         return bcf_array_to_object(fmt.p + sample.index * fmt.size, fmt.type, fmt.n, count, scalar)
 *     elif scalar:
*/
  __pyx_t_9 = (__pyx_v_fmt->p != 0);
  if (__pyx_t_9) {
  } else {
    __pyx_t_1 = __pyx_t_9;
    goto __pyx_L10_bool_binop_done;
  }
  __pyx_t_9 = (__pyx_v_fmt->n != 0);
  if (__pyx_t_9) {
  } else {
    __pyx_t_1 = __pyx_t_9;
    goto __pyx_L10_bool_binop_done;
  }
  __pyx_t_9 = (__pyx_v_fmt->size != 0);
  __pyx_t_1 = __pyx_t_9;
  __pyx_L10_bool_binop_done:;
  if (__pyx_t_1) {

    /* "pysam/libcbcf.pyx":821
 * 
 *     if fmt.p and fmt.n and fmt.size:
 *         return bcf_array_to_object(fmt.p + sample.index * fmt.size, fmt.type, fmt.n, count, scalar)             # <<<<<<<<<<<<<<
 *     elif scalar:
 *         return None
*/
    __Pyx_XDECREF(__pyx_r);
    __pyx_t_4 = __pyx_f_5pysam_7libcbcf_bcf_array_to_object((__pyx_v_fmt->p + (__pyx_v_sample->index * __pyx_v_fmt->size)), __pyx_v_fmt->type, __pyx_v_fmt->n, __pyx_v_count, __pyx_v_scalar); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 821, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
    __pyx_r = __pyx_t_4;
    __pyx_t_4 = 0;
    __Pyx_TraceReturnValue(__pyx_r, 85, 0, __PYX_ERR(0, 821, __pyx_L1_error));
    goto __pyx_L0;

    /* "pysam/libcbcf.pyx":820
 *     bcf_get_value_count(sample.record, BCF_HL_FMT, fmt.id, &count, &scalar, sample.index)
 * 
 *     if fmt.p and fmt.n and fmt.size:             # <<<<<<<<<<<<<<
 *         return bcf_array_to_object(fmt.p + sample.index * fmt.size, fmt.type, fmt.n, count, scalar)
 *     elif scalar:
*/
  }

  /* "pysam/libcbcf.pyx":822
 *     if fmt.p and fmt.n and fmt.size:
 *         return bcf_array_to_object(fmt.p + sample.index * fmt.size, fmt.type, fmt.n, count, scalar)
 *     elif scalar:             # <<<<<<<<<<<<<<
 *         return None
 *     elif count <= 0:
*/
  __pyx_t_1 = (__pyx_v_scalar != 0);
  if (__pyx_t_1) {

    /* "pysam/libcbcf.pyx":823
 *         return bcf_array_to_object(fmt.p + sample.index * fmt.size, fmt.type, fmt.n, count, scalar)
 *     elif scalar:
 *         return None             # <<<<<<<<<<<<<<
 *     elif count <= 0:
 *         return ()
*/
    __Pyx_XDECREF(__pyx_r);
    __pyx_r = Py_None; __Pyx_INCREF(Py_None);
    goto __pyx_L0;

    /* "pysam/libcbcf.pyx":822
 *     if fmt.p and fmt.n and fmt.size:
 *         return bcf_array_to_object(fmt.p + sample.index * fmt.size, fmt.type, fmt.n, count, scalar)
 *     elif scalar:             # <<<<<<<<<<<<<<
 *         return None
 *     elif count <= 0:
*/
  }

  /* "pysam/libcbcf.pyx":824
 *     elif scalar:
 *         return None
 *     elif count <= 0:             # <<<<<<<<<<<<<<
 *         return ()
 *     else:
*/
  __pyx_t_1 = (__pyx_v_count <= 0);
  if (__pyx_t_1) {

    /* "pysam/libcbcf.pyx":825
 *         return None
 *     elif count <= 0:
 *         return ()             # <<<<<<<<<<<<<<
 *     else:
 *         return (None,)*count
*/
    __Pyx_XDECREF(__pyx_r);
    __Pyx_INCREF(__pyx_mstate_global->__pyx_empty_tuple);
    __pyx_r = __pyx_mstate_global->__pyx_empty_tuple;
    __Pyx_TraceReturnValue(__pyx_r, 108, 0, __PYX_ERR(0, 825, __pyx_L1_error));
    goto __pyx_L0;

    /* "pysam/libcbcf.pyx":824
 *     elif scalar:
 *         return None
 *     elif count <= 0:             # <<<<<<<<<<<<<<
 *         return ()
 *     else:
*/
  }

  /* "pysam/libcbcf.pyx":827
 *         return ()
 *     else:
 *         return (None,)*count             # <<<<<<<<<<<<<<
 * 
 * 
*/
  /*else*/ {
    __Pyx_XDECREF(__pyx_r);
    __pyx_t_4 = __Pyx_PySequence_Multiply(__pyx_mstate_global->__pyx_tuple[0], __pyx_v_count); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 827, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
    __pyx_r = __pyx_t_4;
    __pyx_t_4 = 0;
    __Pyx_TraceReturnValue(__pyx_r, 110, 0, __PYX_ERR(0, 827, __pyx_L1_error));
    goto __pyx_L0;
  }

  /* "pysam/libcbcf.pyx":797
 * 
 * 
 * cdef bcf_format_get_value(VariantRecordSample sample, key):             # <<<<<<<<<<<<<<
 *     if sample is None:
 *         raise ValueError('sample must not be None')
*/

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_XDECREF(__pyx_t_10);
  __Pyx_XDECREF(__pyx_t_11);
  __Pyx_TraceException(__pyx_lineno, 0, 0);
  #if CYTHON_USE_SYS_MONITORING
  __Pyx_TraceExceptionUnwind(0, 0);
  #else
  __Pyx_TraceReturnValue(NULL, 0, 0, __PYX_ERR(0, 797, __pyx_L1_error));
  #endif
  __Pyx_AddTraceback("pysam.libcbcf.bcf_format_get_value", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_bkey);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_PyMonitoring_ExitScope(0);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "pysam/libcbcf.pyx":830
 * 
 * 
 * cdef bcf_format_set_value(VariantRecordSample sample, key, value):             # <<<<<<<<<<<<<<
 *     if sample is None:
 *         raise ValueError('sample must not be None')
*/

static PyObject *__pyx_f_5pysam_7libcbcf_bcf_format_set_value(struct __pyx_obj_5pysam_7libcbcf_VariantRecordSample *__pyx_v_sample, PyObject *__pyx_v_key, PyObject *__pyx_v_value) {
  bcf_hdr_t *__pyx_v_hdr;
  bcf1_t *__pyx_v_r;
  int __pyx_v_fmt_id;
  vdict_t *__pyx_v_d;
  khiter_t __pyx_v_k;
  int __pyx_v_fmt_type;
  int __pyx_v_scalar;
  int __pyx_v_realloc;
  int __pyx_v_dst_type;
  int __pyx_v_vlen;
  Py_ssize_t __pyx_v_i;
  Py_ssize_t __pyx_v_nsamples;
  Py_ssize_t __pyx_v_value_count;
  Py_ssize_t __pyx_v_alloc_len;
  Py_ssize_t __pyx_v_dst_size;
  PyObject *__pyx_v_bkey = 0;
  bcf_fmt_t *__pyx_v_fmt;
  PyObject *__pyx_v_values = NULL;
  PyObject *__pyx_v_new_values = NULL;
  char *__pyx_v_new_values_p;
  PyObject *__pyx_r = NULL;
  __Pyx_TraceDeclarationsFunc
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  PyObject *__pyx_t_4 = NULL;
  size_t __pyx_t_5;
  bcf_hdr_t *__pyx_t_6;
  bcf1_t *__pyx_t_7;
  char const *__pyx_t_8;
  int __pyx_t_9;
  char const *__pyx_t_10;
  int __pyx_t_11;
  PyObject *__pyx_t_12 = NULL;
  PyObject *__pyx_t_13 = NULL;
  Py_ssize_t __pyx_t_14;
  Py_ssize_t __pyx_t_15;
  long __pyx_t_16;
  Py_ssize_t __pyx_t_17;
  uint32_t __pyx_t_18;
  char *__pyx_t_19;
  Py_ssize_t __pyx_t_20;
  char const *__pyx_t_21;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_TraceFrameInit(((PyObject *)__pyx_mstate_global->__pyx_codeobj_tab[22]))
  __Pyx_RefNannySetupContext("bcf_format_set_value", 0);
  __Pyx_TraceStartFunc("bcf_format_set_value", __pyx_f[0], 830, 0, 0, 0, __PYX_ERR(0, 830, __pyx_L1_error));
  __Pyx_INCREF(__pyx_v_value);

  /* "pysam/libcbcf.pyx":831
 * 
 * cdef bcf_format_set_value(VariantRecordSample sample, key, value):
 *     if sample is None:             # <<<<<<<<<<<<<<
 *         raise ValueError('sample must not be None')
 * 
*/
  __pyx_t_1 = (((PyObject *)__pyx_v_sample) == Py_None);
  if (unlikely(__pyx_t_1)) {

    /* "pysam/libcbcf.pyx":832
 * cdef bcf_format_set_value(VariantRecordSample sample, key, value):
 *     if sample is None:
 *         raise ValueError('sample must not be None')             # <<<<<<<<<<<<<<
 * 
 *     if key == 'phased':
*/
    __pyx_t_3 = NULL;
    __Pyx_INCREF(__pyx_builtin_ValueError);
    __pyx_t_4 = __pyx_builtin_ValueError; 
    __pyx_t_5 = 1;
    {
      PyObject *__pyx_callargs[2] = {__pyx_t_3, __pyx_mstate_global->__pyx_kp_u_sample_must_not_be_None};
      __pyx_t_2 = __Pyx_PyObject_FastCall(__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_2)) __PYX_ERR(0, 832, __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, 832, __pyx_L1_error)

    /* "pysam/libcbcf.pyx":831
 * 
 * cdef bcf_format_set_value(VariantRecordSample sample, key, value):
 *     if sample is None:             # <<<<<<<<<<<<<<
 *         raise ValueError('sample must not be None')
 * 
*/
  }

  /* "pysam/libcbcf.pyx":834
 *         raise ValueError('sample must not be None')
 * 
 *     if key == 'phased':             # <<<<<<<<<<<<<<
 *         sample.phased = bool(value)
 *         return
*/
  __pyx_t_1 = (__Pyx_PyUnicode_Equals(__pyx_v_key, __pyx_mstate_global->__pyx_n_u_phased, Py_EQ)); if (unlikely((__pyx_t_1 < 0))) __PYX_ERR(0, 834, __pyx_L1_error)
  if (__pyx_t_1) {

    /* "pysam/libcbcf.pyx":835
 * 
 *     if key == 'phased':
 *         sample.phased = bool(value)             # <<<<<<<<<<<<<<
 *         return
 * 
*/
    __pyx_t_1 = __Pyx_PyObject_IsTrue(__pyx_v_value); if (unlikely((__pyx_t_1 < 0))) __PYX_ERR(0, 835, __pyx_L1_error)
    __pyx_t_2 = __Pyx_PyBool_FromLong((!(!__pyx_t_1))); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 835, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    if (__Pyx_PyObject_SetAttrStr(((PyObject *)__pyx_v_sample), __pyx_mstate_global->__pyx_n_u_phased, __pyx_t_2) < 0) __PYX_ERR(0, 835, __pyx_L1_error)
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

    /* "pysam/libcbcf.pyx":836
 *     if key == 'phased':
 *         sample.phased = bool(value)
 *         return             # <<<<<<<<<<<<<<
 * 
 *     cdef bcf_hdr_t *hdr = sample.record.header.ptr
*/
    __Pyx_XDECREF(__pyx_r);
    __pyx_r = Py_None; __Pyx_INCREF(Py_None);
    goto __pyx_L0;

    /* "pysam/libcbcf.pyx":834
 *         raise ValueError('sample must not be None')
 * 
 *     if key == 'phased':             # <<<<<<<<<<<<<<
 *         sample.phased = bool(value)
 *         return
*/
  }

  /* "pysam/libcbcf.pyx":838
 *         return
 * 
 *     cdef bcf_hdr_t *hdr = sample.record.header.ptr             # <<<<<<<<<<<<<<
 *     cdef bcf1_t *r = sample.record.ptr
 *     cdef int fmt_id
*/
  __pyx_t_6 = __pyx_v_sample->record->header->ptr;
  __pyx_v_hdr = __pyx_t_6;

  /* "pysam/libcbcf.pyx":839
 * 
 *     cdef bcf_hdr_t *hdr = sample.record.header.ptr
 *     cdef bcf1_t *r = sample.record.ptr             # <<<<<<<<<<<<<<
 *     cdef int fmt_id
 *     cdef vdict_t *d
*/
  __pyx_t_7 = __pyx_v_sample->record->ptr;
  __pyx_v_r = __pyx_t_7;

  /* "pysam/libcbcf.pyx":843
 *     cdef vdict_t *d
 *     cdef khiter_t k
 *     cdef int fmt_type, scalar, realloc, dst_type, vlen = 0             # <<<<<<<<<<<<<<
 *     cdef ssize_t i, nsamples, value_count, alloc_size, alloc_len, dst_size
 * 
*/
  __pyx_v_vlen = 0;

  /* "pysam/libcbcf.pyx":846
 *     cdef ssize_t i, nsamples, value_count, alloc_size, alloc_len, dst_size
 * 
 *     if bcf_unpack(r, BCF_UN_ALL) < 0:             # <<<<<<<<<<<<<<
 *         raise ValueError('Error unpacking VariantRecord')
 * 
*/
  __pyx_t_1 = (bcf_unpack(__pyx_v_r, BCF_UN_ALL) < 0);
  if (unlikely(__pyx_t_1)) {

    /* "pysam/libcbcf.pyx":847
 * 
 *     if bcf_unpack(r, BCF_UN_ALL) < 0:
 *         raise ValueError('Error unpacking VariantRecord')             # <<<<<<<<<<<<<<
 * 
 *     cdef bytes bkey = force_bytes(key)
*/
    __pyx_t_4 = NULL;
    __Pyx_INCREF(__pyx_builtin_ValueError);
    __pyx_t_3 = __pyx_builtin_ValueError; 
    __pyx_t_5 = 1;
    {
      PyObject *__pyx_callargs[2] = {__pyx_t_4, __pyx_mstate_global->__pyx_kp_u_Error_unpacking_VariantRecord};
      __pyx_t_2 = __Pyx_PyObject_FastCall(__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_2)) __PYX_ERR(0, 847, __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, 847, __pyx_L1_error)

    /* "pysam/libcbcf.pyx":846
 *     cdef ssize_t i, nsamples, value_count, alloc_size, alloc_len, dst_size
 * 
 *     if bcf_unpack(r, BCF_UN_ALL) < 0:             # <<<<<<<<<<<<<<
 *         raise ValueError('Error unpacking VariantRecord')
 * 
*/
  }

  /* "pysam/libcbcf.pyx":849
 *         raise ValueError('Error unpacking VariantRecord')
 * 
 *     cdef bytes bkey = force_bytes(key)             # <<<<<<<<<<<<<<
 *     cdef bcf_fmt_t *fmt = bcf_get_fmt(hdr, r, bkey)
 * 
*/
  __pyx_t_2 = __pyx_f_5pysam_9libcutils_force_bytes(__pyx_v_key, NULL); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 849, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_v_bkey = ((PyObject*)__pyx_t_2);
  __pyx_t_2 = 0;

  /* "pysam/libcbcf.pyx":850
 * 
 *     cdef bytes bkey = force_bytes(key)
 *     cdef bcf_fmt_t *fmt = bcf_get_fmt(hdr, r, bkey)             # <<<<<<<<<<<<<<
 * 
 *     if fmt:
*/
  if (unlikely(__pyx_v_bkey == Py_None)) {
    PyErr_SetString(PyExc_TypeError, "expected bytes, NoneType found");
    __PYX_ERR(0, 850, __pyx_L1_error)
  }
  __pyx_t_8 = __Pyx_PyBytes_AsString(__pyx_v_bkey); if (unlikely((!__pyx_t_8) && PyErr_Occurred())) __PYX_ERR(0, 850, __pyx_L1_error)
  __pyx_v_fmt = bcf_get_fmt(__pyx_v_hdr, __pyx_v_r, __pyx_t_8);

  /* "pysam/libcbcf.pyx":852
 *     cdef bcf_fmt_t *fmt = bcf_get_fmt(hdr, r, bkey)
 * 
 *     if fmt:             # <<<<<<<<<<<<<<
 *         fmt_id = fmt.id
 *     else:
*/
  __pyx_t_1 = (__pyx_v_fmt != 0);
  if (__pyx_t_1) {

    /* "pysam/libcbcf.pyx":853
 * 
 *     if fmt:
 *         fmt_id = fmt.id             # <<<<<<<<<<<<<<
 *     else:
 *         d = <vdict_t *>hdr.dict[BCF_DT_ID]
*/
    __pyx_t_9 = __pyx_v_fmt->id;
    __pyx_v_fmt_id = __pyx_t_9;

    /* "pysam/libcbcf.pyx":852
 *     cdef bcf_fmt_t *fmt = bcf_get_fmt(hdr, r, bkey)
 * 
 *     if fmt:             # <<<<<<<<<<<<<<
 *         fmt_id = fmt.id
 *     else:
*/
    goto __pyx_L6;
  }

  /* "pysam/libcbcf.pyx":855
 *         fmt_id = fmt.id
 *     else:
 *         d = <vdict_t *>hdr.dict[BCF_DT_ID]             # <<<<<<<<<<<<<<
 *         k = kh_get_vdict(d, bkey)
 * 
*/
  /*else*/ {
    __pyx_v_d = ((vdict_t *)(__pyx_v_hdr->dict[BCF_DT_ID]));

    /* "pysam/libcbcf.pyx":856
 *     else:
 *         d = <vdict_t *>hdr.dict[BCF_DT_ID]
 *         k = kh_get_vdict(d, bkey)             # <<<<<<<<<<<<<<
 * 
 *         if k == kh_end(d) or kh_val_vdict(d, k).info[BCF_HL_FMT] & 0xF == 0xF:
*/
    if (unlikely(__pyx_v_bkey == Py_None)) {
      PyErr_SetString(PyExc_TypeError, "expected bytes, NoneType found");
      __PYX_ERR(0, 856, __pyx_L1_error)
    }
    __pyx_t_10 = __Pyx_PyBytes_AsString(__pyx_v_bkey); if (unlikely((!__pyx_t_10) && PyErr_Occurred())) __PYX_ERR(0, 856, __pyx_L1_error)
    __pyx_v_k = kh_get_vdict(__pyx_v_d, __pyx_t_10);

    /* "pysam/libcbcf.pyx":858
 *         k = kh_get_vdict(d, bkey)
 * 
 *         if k == kh_end(d) or kh_val_vdict(d, k).info[BCF_HL_FMT] & 0xF == 0xF:             # <<<<<<<<<<<<<<
 *             raise KeyError('unknown format: {}'.format(key))
 * 
*/
    __pyx_t_11 = (__pyx_v_k == kh_end(__pyx_v_d));
    if (!__pyx_t_11) {
    } else {
      __pyx_t_1 = __pyx_t_11;
      goto __pyx_L8_bool_binop_done;
    }
    __pyx_t_11 = (((kh_val(__pyx_v_d, __pyx_v_k).info[BCF_HL_FMT]) & 0xF) == 0xF);
    __pyx_t_1 = __pyx_t_11;
    __pyx_L8_bool_binop_done:;
    if (unlikely(__pyx_t_1)) {

      /* "pysam/libcbcf.pyx":859
 * 
 *         if k == kh_end(d) or kh_val_vdict(d, k).info[BCF_HL_FMT] & 0xF == 0xF:
 *             raise KeyError('unknown format: {}'.format(key))             # <<<<<<<<<<<<<<
 * 
 *         fmt_id = kh_val_vdict(d, k).id
*/
      __pyx_t_3 = NULL;
      __Pyx_INCREF(__pyx_builtin_KeyError);
      __pyx_t_4 = __pyx_builtin_KeyError; 
      __pyx_t_13 = __pyx_mstate_global->__pyx_kp_u_unknown_format;
      __Pyx_INCREF(__pyx_t_13);
      __pyx_t_5 = 0;
      {
        PyObject *__pyx_callargs[2] = {__pyx_t_13, __pyx_v_key};
        __pyx_t_12 = __Pyx_PyObject_FastCallMethod(__pyx_mstate_global->__pyx_n_u_format, __pyx_callargs+__pyx_t_5, (2-__pyx_t_5) | (1*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
        __Pyx_XDECREF(__pyx_t_13); __pyx_t_13 = 0;
        if (unlikely(!__pyx_t_12)) __PYX_ERR(0, 859, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_12);
      }
      __pyx_t_5 = 1;
      {
        PyObject *__pyx_callargs[2] = {__pyx_t_3, __pyx_t_12};
        __pyx_t_2 = __Pyx_PyObject_FastCall(__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_12); __pyx_t_12 = 0;
        __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
        if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 859, __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, 859, __pyx_L1_error)

      /* "pysam/libcbcf.pyx":858
 *         k = kh_get_vdict(d, bkey)
 * 
 *         if k == kh_end(d) or kh_val_vdict(d, k).info[BCF_HL_FMT] & 0xF == 0xF:             # <<<<<<<<<<<<<<
 *             raise KeyError('unknown format: {}'.format(key))
 * 
*/
    }

    /* "pysam/libcbcf.pyx":861
 *             raise KeyError('unknown format: {}'.format(key))
 * 
 *         fmt_id = kh_val_vdict(d, k).id             # <<<<<<<<<<<<<<
 * 
 *     if not check_header_id(hdr, BCF_HL_FMT, fmt_id):
*/
    __pyx_t_9 = kh_val(__pyx_v_d, __pyx_v_k).id;
    __pyx_v_fmt_id = __pyx_t_9;
  }
  __pyx_L6:;

  /* "pysam/libcbcf.pyx":863
 *         fmt_id = kh_val_vdict(d, k).id
 * 
 *     if not check_header_id(hdr, BCF_HL_FMT, fmt_id):             # <<<<<<<<<<<<<<
 *         raise ValueError('Invalid header')
 * 
*/
  __pyx_t_1 = __pyx_f_5pysam_7libcbcf_check_header_id(__pyx_v_hdr, BCF_HL_FMT, __pyx_v_fmt_id); if (unlikely(__pyx_t_1 == ((int)-1) && PyErr_Occurred())) __PYX_ERR(0, 863, __pyx_L1_error)
  __pyx_t_11 = (!__pyx_t_1);
  if (unlikely(__pyx_t_11)) {

    /* "pysam/libcbcf.pyx":864
 * 
 *     if not check_header_id(hdr, BCF_HL_FMT, fmt_id):
 *         raise ValueError('Invalid header')             # <<<<<<<<<<<<<<
 * 
 *     fmt_type = bcf_hdr_id2type(hdr, BCF_HL_FMT, fmt_id)
*/
    __pyx_t_4 = NULL;
    __Pyx_INCREF(__pyx_builtin_ValueError);
    __pyx_t_12 = __pyx_builtin_ValueError; 
    __pyx_t_5 = 1;
    {
      PyObject *__pyx_callargs[2] = {__pyx_t_4, __pyx_mstate_global->__pyx_kp_u_Invalid_header};
      __pyx_t_2 = __Pyx_PyObject_FastCall(__pyx_t_12, __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_12); __pyx_t_12 = 0;
      if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 864, __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, 864, __pyx_L1_error)

    /* "pysam/libcbcf.pyx":863
 *         fmt_id = kh_val_vdict(d, k).id
 * 
 *     if not check_header_id(hdr, BCF_HL_FMT, fmt_id):             # <<<<<<<<<<<<<<
 *         raise ValueError('Invalid header')
 * 
*/
  }

  /* "pysam/libcbcf.pyx":866
 *         raise ValueError('Invalid header')
 * 
 *     fmt_type = bcf_hdr_id2type(hdr, BCF_HL_FMT, fmt_id)             # <<<<<<<<<<<<<<
 * 
 *     if fmt_type == BCF_HT_FLAG:
*/
  __pyx_v_fmt_type = bcf_hdr_id2type(__pyx_v_hdr, BCF_HL_FMT, __pyx_v_fmt_id);

  /* "pysam/libcbcf.pyx":868
 *     fmt_type = bcf_hdr_id2type(hdr, BCF_HL_FMT, fmt_id)
 * 
 *     if fmt_type == BCF_HT_FLAG:             # <<<<<<<<<<<<<<
 *         raise ValueError('Flag types are not allowed on FORMATs')
 * 
*/
  __pyx_t_11 = (__pyx_v_fmt_type == BCF_HT_FLAG);
  if (unlikely(__pyx_t_11)) {

    /* "pysam/libcbcf.pyx":869
 * 
 *     if fmt_type == BCF_HT_FLAG:
 *         raise ValueError('Flag types are not allowed on FORMATs')             # <<<<<<<<<<<<<<
 * 
 *     if is_gt_fmt(hdr, fmt_id):
*/
    __pyx_t_12 = NULL;
    __Pyx_INCREF(__pyx_builtin_ValueError);
    __pyx_t_4 = __pyx_builtin_ValueError; 
    __pyx_t_5 = 1;
    {
      PyObject *__pyx_callargs[2] = {__pyx_t_12, __pyx_mstate_global->__pyx_kp_u_Flag_types_are_not_allowed_on_FO};
      __pyx_t_2 = __Pyx_PyObject_FastCall(__pyx_t_4, __pyx_callargs+__pyx_t_5, (2-__pyx_t_5) | (__pyx_t_5*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
      __Pyx_XDECREF(__pyx_t_12); __pyx_t_12 = 0;
      __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
      if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 869, __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, 869, __pyx_L1_error)

    /* "pysam/libcbcf.pyx":868
 *     fmt_type = bcf_hdr_id2type(hdr, BCF_HL_FMT, fmt_id)
 * 
 *     if fmt_type == BCF_HT_FLAG:             # <<<<<<<<<<<<<<
 *         raise ValueError('Flag types are not allowed on FORMATs')
 * 
*/
  }

  /* "pysam/libcbcf.pyx":871
 *         raise ValueError('Flag types are not allowed on FORMATs')
 * 
 *     if is_gt_fmt(hdr, fmt_id):             # <<<<<<<<<<<<<<
 *         value = bcf_encode_alleles(sample.record, value)
 *         # KBJ: GT field is considered to be a string by the VCF header but BCF represents it as INT.
*/
  __pyx_t_9 = __pyx_f_5pysam_7libcbcf_is_gt_fmt(__pyx_v_hdr, __pyx_v_fmt_id); if (unlikely(__pyx_t_9 == ((int)-1) && PyErr_Occurred())) __PYX_ERR(0, 871, __pyx_L1_error)
  __pyx_t_11 = (__pyx_t_9 != 0);
  if (__pyx_t_11) {

    /* "pysam/libcbcf.pyx":872
 * 
 *     if is_gt_fmt(hdr, fmt_id):
 *         value = bcf_encode_alleles(sample.record, value)             # <<<<<<<<<<<<<<
 *         # KBJ: GT field is considered to be a string by the VCF header but BCF represents it as INT.
 *         fmt_type = BCF_HT_INT
*/
    __pyx_t_2 = ((PyObject *)__pyx_v_sample->record);
    __Pyx_INCREF(__pyx_t_2);
    __pyx_t_4 = __pyx_f_5pysam_7libcbcf_bcf_encode_alleles(((struct __pyx_obj_5pysam_7libcbcf_VariantRecord *)__pyx_t_2), __pyx_v_value); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 872, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    __Pyx_DECREF_SET(__pyx_v_value, __pyx_t_4);
    __pyx_t_4 = 0;

    /* "pysam/libcbcf.pyx":874
 *         value = bcf_encode_alleles(sample.record, value)
 *         # KBJ: GT field is considered to be a string by the VCF header but BCF represents it as INT.
 *         fmt_type = BCF_HT_INT             # <<<<<<<<<<<<<<
 * 
 *     values = bcf_check_values(sample.record, value, sample.index,
*/
    __pyx_v_fmt_type = BCF_HT_INT;

    /* "pysam/libcbcf.pyx":871
 *         raise ValueError('Flag types are not allowed on FORMATs')
 * 
 *     if is_gt_fmt(hdr, fmt_id):             # <<<<<<<<<<<<<<
 *         value = bcf_encode_alleles(sample.record, value)
 *         # KBJ: GT field is considered to be a string by the VCF header but BCF represents it as INT.
*/
  }

  /* "pysam/libcbcf.pyx":876
 *         fmt_type = BCF_HT_INT
 * 
 *     values = bcf_check_values(sample.record, value, sample.index,             # <<<<<<<<<<<<<<
 *                               BCF_HL_FMT, fmt_type, fmt_id,
 *                               fmt.type if fmt else -1,
*/
  __pyx_t_4 = ((PyObject *)__pyx_v_sample->record);
  __Pyx_INCREF(__pyx_t_4);

  /* "pysam/libcbcf.pyx":878
 *     values = bcf_check_values(sample.record, value, sample.index,
 *                               BCF_HL_FMT, fmt_type, fmt_id,
 *                               fmt.type if fmt else -1,             # <<<<<<<<<<<<<<
 *                               fmt.n    if fmt else -1,
 *                               &value_count, &scalar, &realloc)
*/
  __pyx_t_11 = (__pyx_v_fmt != 0);
  if (__pyx_t_11) {
    __pyx_t_9 = __pyx_v_fmt->type;
  } else {
    __pyx_t_9 = -1;
  }

  /* "pysam/libcbcf.pyx":879
 *                               BCF_HL_FMT, fmt_type, fmt_id,
 *                               fmt.type if fmt else -1,
 *                               fmt.n    if fmt else -1,             # <<<<<<<<<<<<<<
 *                               &value_count, &scalar, &realloc)
 *     vlen = value_count < 0
*/
  __pyx_t_11 = (__pyx_v_fmt != 0);
  if (__pyx_t_11) {
    __pyx_t_14 = __pyx_v_fmt->n;
  } else {
    __pyx_t_14 = -1L;
  }

  /* "pysam/libcbcf.pyx":876
 *         fmt_type = BCF_HT_INT
 * 
 *     values = bcf_check_values(sample.record, value, sample.index,             # <<<<<<<<<<<<<<
 *                               BCF_HL_FMT, fmt_type, fmt_id,
 *                               fmt.type if fmt else -1,
*/
  __pyx_t_2 = __pyx_f_5pysam_7libcbcf_bcf_check_values(((struct __pyx_obj_5pysam_7libcbcf_VariantRecord *)__pyx_t_4), __pyx_v_value, __pyx_v_sample->index, BCF_HL_FMT, __pyx_v_fmt_type, __pyx_v_fmt_id, __pyx_t_9, __pyx_t_14, (&__pyx_v_value_count), (&__pyx_v_scalar), (&__pyx_v_realloc)); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 876, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  __pyx_v_values = __pyx_t_2;
  __pyx_t_2 = 0;

  /* "pysam/libcbcf.pyx":881
 *                               fmt.n    if fmt else -1,
 *                               &value_count, &scalar, &realloc)
 *     vlen = value_count < 0             # <<<<<<<<<<<<<<
 *     value_count = len(values)
 * 
*/
  __pyx_v_vlen = (__pyx_v_value_count < 0);

  /* "pysam/libcbcf.pyx":882
 *                               &value_count, &scalar, &realloc)
 *     vlen = value_count < 0
 *     value_count = len(values)             # <<<<<<<<<<<<<<
 * 
 *     # If we can, write updated values to existing allocated storage.
*/
  __pyx_t_15 = PyObject_Length(__pyx_v_values); if (unlikely(__pyx_t_15 == ((Py_ssize_t)-1))) __PYX_ERR(0, 882, __pyx_L1_error)
  __pyx_v_value_count = __pyx_t_15;

  /* "pysam/libcbcf.pyx":885
 * 
 *     # If we can, write updated values to existing allocated storage.
 *     if fmt and not realloc:             # <<<<<<<<<<<<<<
 *         r.d.indiv_dirty = 1
 *         bcf_object_to_array(values, fmt.p + sample.index * fmt.size, fmt.type, fmt.n, vlen)
*/
  __pyx_t_1 = (__pyx_v_fmt != 0);
  if (__pyx_t_1) {
  } else {
    __pyx_t_11 = __pyx_t_1;
    goto __pyx_L14_bool_binop_done;
  }
  __pyx_t_1 = (!(__pyx_v_realloc != 0));
  __pyx_t_11 = __pyx_t_1;
  __pyx_L14_bool_binop_done:;
  if (__pyx_t_11) {

    /* "pysam/libcbcf.pyx":886
 *     # If we can, write updated values to existing allocated storage.
 *     if fmt and not realloc:
 *         r.d.indiv_dirty = 1             # <<<<<<<<<<<<<<
 *         bcf_object_to_array(values, fmt.p + sample.index * fmt.size, fmt.type, fmt.n, vlen)
 *         return
*/
    __pyx_v_r->d.indiv_dirty = 1;

    /* "pysam/libcbcf.pyx":887
 *     if fmt and not realloc:
 *         r.d.indiv_dirty = 1
 *         bcf_object_to_array(values, fmt.p + sample.index * fmt.size, fmt.type, fmt.n, vlen)             # <<<<<<<<<<<<<<
 *         return
 * 
*/
    __pyx_t_2 = __pyx_f_5pysam_7libcbcf_bcf_object_to_array(__pyx_v_values, (__pyx_v_fmt->p + (__pyx_v_sample->index * __pyx_v_fmt->size)), __pyx_v_fmt->type, __pyx_v_fmt->n, __pyx_v_vlen); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 887, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

    /* "pysam/libcbcf.pyx":888
 *         r.d.indiv_dirty = 1
 *         bcf_object_to_array(values, fmt.p + sample.index * fmt.size, fmt.type, fmt.n, vlen)
 *         return             # <<<<<<<<<<<<<<
 * 
 *     alloc_len = max(1, value_count)
*/
    __Pyx_XDECREF(__pyx_r);
    __pyx_r = Py_None; __Pyx_INCREF(Py_None);
    goto __pyx_L0;

    /* "pysam/libcbcf.pyx":885
 * 
 *     # If we can, write updated values to existing allocated storage.
 *     if fmt and not realloc:             # <<<<<<<<<<<<<<
 *         r.d.indiv_dirty = 1
 *         bcf_object_to_array(values, fmt.p + sample.index * fmt.size, fmt.type, fmt.n, vlen)
*/
  }

  /* "pysam/libcbcf.pyx":890
 *         return
 * 
 *     alloc_len = max(1, value_count)             # <<<<<<<<<<<<<<
 *     if fmt and fmt.n > alloc_len:
 *         alloc_len = fmt.n
*/
  __pyx_t_14 = __pyx_v_value_count;
  __pyx_t_16 = 1;
  __pyx_t_11 = (__pyx_t_14 > __pyx_t_16);
  if (__pyx_t_11) {
    __pyx_t_17 = __pyx_t_14;
  } else {
    __pyx_t_17 = __pyx_t_16;
  }
  __pyx_v_alloc_len = __pyx_t_17;

  /* "pysam/libcbcf.pyx":891
 * 
 *     alloc_len = max(1, value_count)
 *     if fmt and fmt.n > alloc_len:             # <<<<<<<<<<<<<<
 *         alloc_len = fmt.n
 * 
*/
  __pyx_t_1 = (__pyx_v_fmt != 0);
  if (__pyx_t_1) {
  } else {
    __pyx_t_11 = __pyx_t_1;
    goto __pyx_L17_bool_binop_done;
  }
  __pyx_t_1 = (__pyx_v_fmt->n > __pyx_v_alloc_len);
  __pyx_t_11 = __pyx_t_1;
  __pyx_L17_bool_binop_done:;
  if (__pyx_t_11) {

    /* "pysam/libcbcf.pyx":892
 *     alloc_len = max(1, value_count)
 *     if fmt and fmt.n > alloc_len:
 *         alloc_len = fmt.n             # <<<<<<<<<<<<<<
 * 
 *     nsamples = r.n_sample
*/
    __pyx_t_9 = __pyx_v_fmt->n;
    __pyx_v_alloc_len = __pyx_t_9;

    /* "pysam/libcbcf.pyx":891
 * 
 *     alloc_len = max(1, value_count)
 *     if fmt and fmt.n > alloc_len:             # <<<<<<<<<<<<<<
 *         alloc_len = fmt.n
 * 
*/
  }

  /* "pysam/libcbcf.pyx":894
 *         alloc_len = fmt.n
 * 
 *     nsamples = r.n_sample             # <<<<<<<<<<<<<<
 *     new_values = bcf_empty_array(fmt_type, nsamples * alloc_len, vlen)
 *     cdef char *new_values_p = <char *>new_values
*/
  __pyx_t_18 = __pyx_v_r->n_sample;
  __pyx_v_nsamples = __pyx_t_18;

  /* "pysam/libcbcf.pyx":895
 * 
 *     nsamples = r.n_sample
 *     new_values = bcf_empty_array(fmt_type, nsamples * alloc_len, vlen)             # <<<<<<<<<<<<<<
 *     cdef char *new_values_p = <char *>new_values
 * 
*/
  __pyx_t_2 = __pyx_f_5pysam_7libcbcf_bcf_empty_array(__pyx_v_fmt_type, (__pyx_v_nsamples * __pyx_v_alloc_len), __pyx_v_vlen); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 895, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_v_new_values = __pyx_t_2;
  __pyx_t_2 = 0;

  /* "pysam/libcbcf.pyx":896
 *     nsamples = r.n_sample
 *     new_values = bcf_empty_array(fmt_type, nsamples * alloc_len, vlen)
 *     cdef char *new_values_p = <char *>new_values             # <<<<<<<<<<<<<<
 * 
 *     if fmt_type == BCF_HT_INT:
*/
  __pyx_t_19 = __Pyx_PyObject_AsWritableString(__pyx_v_new_values); if (unlikely((!__pyx_t_19) && PyErr_Occurred())) __PYX_ERR(0, 896, __pyx_L1_error)
  __pyx_v_new_values_p = ((char *)__pyx_t_19);

  /* "pysam/libcbcf.pyx":898
 *     cdef char *new_values_p = <char *>new_values
 * 
 *     if fmt_type == BCF_HT_INT:             # <<<<<<<<<<<<<<
 *         dst_type = BCF_BT_INT32
 *         dst_size = sizeof(int32_t) * alloc_len
*/
  __pyx_t_11 = (__pyx_v_fmt_type == BCF_HT_INT);
  if (__pyx_t_11) {

    /* "pysam/libcbcf.pyx":899
 * 
 *     if fmt_type == BCF_HT_INT:
 *         dst_type = BCF_BT_INT32             # <<<<<<<<<<<<<<
 *         dst_size = sizeof(int32_t) * alloc_len
 *     elif fmt_type == BCF_HT_REAL:
*/
    __pyx_v_dst_type = BCF_BT_INT32;

    /* "pysam/libcbcf.pyx":900
 *     if fmt_type == BCF_HT_INT:
 *         dst_type = BCF_BT_INT32
 *         dst_size = sizeof(int32_t) * alloc_len             # <<<<<<<<<<<<<<
 *     elif fmt_type == BCF_HT_REAL:
 *         dst_type = BCF_BT_FLOAT
*/
    __pyx_v_dst_size = ((sizeof(int32_t)) * __pyx_v_alloc_len);

    /* "pysam/libcbcf.pyx":898
 *     cdef char *new_values_p = <char *>new_values
 * 
 *     if fmt_type == BCF_HT_INT:             # <<<<<<<<<<<<<<
 *         dst_type = BCF_BT_INT32
 *         dst_size = sizeof(int32_t) * alloc_len
*/
    goto __pyx_L19;
  }

  /* "pysam/libcbcf.pyx":901
 *         dst_type = BCF_BT_INT32
 *         dst_size = sizeof(int32_t) * alloc_len
 *     elif fmt_type == BCF_HT_REAL:             # <<<<<<<<<<<<<<
 *         dst_type = BCF_BT_FLOAT
 *         dst_size = sizeof(float) * alloc_len
*/
  __pyx_t_11 = (__pyx_v_fmt_type == BCF_HT_REAL);
  if (__pyx_t_11) {

    /* "pysam/libcbcf.pyx":902
 *         dst_size = sizeof(int32_t) * alloc_len
 *     elif fmt_type == BCF_HT_REAL:
 *         dst_type = BCF_BT_FLOAT             # <<<<<<<<<<<<<<
 *         dst_size = sizeof(float) * alloc_len
 *     elif fmt_type == BCF_HT_STR:
*/
    __pyx_v_dst_type = BCF_BT_FLOAT;

    /* "pysam/libcbcf.pyx":903
 *     elif fmt_type == BCF_HT_REAL:
 *         dst_type = BCF_BT_FLOAT
 *         dst_size = sizeof(float) * alloc_len             # <<<<<<<<<<<<<<
 *     elif fmt_type == BCF_HT_STR:
 *         dst_type = BCF_BT_CHAR
*/
    __pyx_v_dst_size = ((sizeof(float)) * __pyx_v_alloc_len);

    /* "pysam/libcbcf.pyx":901
 *         dst_type = BCF_BT_INT32
 *         dst_size = sizeof(int32_t) * alloc_len
 *     elif fmt_type == BCF_HT_REAL:             # <<<<<<<<<<<<<<
 *         dst_type = BCF_BT_FLOAT
 *         dst_size = sizeof(float) * alloc_len
*/
    goto __pyx_L19;
  }

  /* "pysam/libcbcf.pyx":904
 *         dst_type = BCF_BT_FLOAT
 *         dst_size = sizeof(float) * alloc_len
 *     elif fmt_type == BCF_HT_STR:             # <<<<<<<<<<<<<<
 *         dst_type = BCF_BT_CHAR
 *         dst_size = sizeof(char) * alloc_len
*/
  __pyx_t_11 = (__pyx_v_fmt_type == BCF_HT_STR);
  if (likely(__pyx_t_11)) {

    /* "pysam/libcbcf.pyx":905
 *         dst_size = sizeof(float) * alloc_len
 *     elif fmt_type == BCF_HT_STR:
 *         dst_type = BCF_BT_CHAR             # <<<<<<<<<<<<<<
 *         dst_size = sizeof(char) * alloc_len
 *     else:
*/
    __pyx_v_dst_type = BCF_BT_CHAR;

    /* "pysam/libcbcf.pyx":906
 *     elif fmt_type == BCF_HT_STR:
 *         dst_type = BCF_BT_CHAR
 *         dst_size = sizeof(char) * alloc_len             # <<<<<<<<<<<<<<
 *     else:
 *         raise ValueError('Unsupported FORMAT type')
*/
    __pyx_v_dst_size = ((sizeof(char)) * __pyx_v_alloc_len);

    /* "pysam/libcbcf.pyx":904
 *         dst_type = BCF_BT_FLOAT
 *         dst_size = sizeof(float) * alloc_len
 *     elif fmt_type == BCF_HT_STR:             # <<<<<<<<<<<<<<
 *         dst_type = BCF_BT_CHAR
 *         dst_size = sizeof(char) * alloc_len
*/
    goto __pyx_L19;
  }

  /* "pysam/libcbcf.pyx":908
 *         dst_size = sizeof(char) * alloc_len
 *     else:
 *         raise ValueError('Unsupported FORMAT type')             # <<<<<<<<<<<<<<
 * 
 *     if fmt and nsamples > 1:
*/
  /*else*/ {
    __pyx_t_4 = NULL;
    __Pyx_INCREF(__pyx_builtin_ValueError);
    __pyx_t_12 = __pyx_builtin_ValueError; 
    __pyx_t_5 = 1;
    {
      PyObject *__pyx_callargs[2] = {__pyx_t_4, __pyx_mstate_global->__pyx_kp_u_Unsupported_FORMAT_type};
      __pyx_t_2 = __Pyx_PyObject_FastCall(__pyx_t_12, __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_12); __pyx_t_12 = 0;
      if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 908, __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, 908, __pyx_L1_error)
  }
  __pyx_L19:;

  /* "pysam/libcbcf.pyx":910
 *         raise ValueError('Unsupported FORMAT type')
 * 
 *     if fmt and nsamples > 1:             # <<<<<<<<<<<<<<
 *         for i in range(nsamples):
 *             bcf_copy_expand_array(fmt.p + i * fmt.size, fmt.type, fmt.n,
*/
  __pyx_t_1 = (__pyx_v_fmt != 0);
  if (__pyx_t_1) {
  } else {
    __pyx_t_11 = __pyx_t_1;
    goto __pyx_L21_bool_binop_done;
  }
  __pyx_t_1 = (__pyx_v_nsamples > 1);
  __pyx_t_11 = __pyx_t_1;
  __pyx_L21_bool_binop_done:;
  if (__pyx_t_11) {

    /* "pysam/libcbcf.pyx":911
 * 
 *     if fmt and nsamples > 1:
 *         for i in range(nsamples):             # <<<<<<<<<<<<<<
 *             bcf_copy_expand_array(fmt.p + i * fmt.size, fmt.type, fmt.n,
 *                                   new_values_p  + i * dst_size, dst_type, alloc_len,
*/
    __pyx_t_17 = __pyx_v_nsamples;
    __pyx_t_14 = __pyx_t_17;
    for (__pyx_t_20 = 0; __pyx_t_20 < __pyx_t_14; __pyx_t_20+=1) {
      __pyx_v_i = __pyx_t_20;

      /* "pysam/libcbcf.pyx":912
 *     if fmt and nsamples > 1:
 *         for i in range(nsamples):
 *             bcf_copy_expand_array(fmt.p + i * fmt.size, fmt.type, fmt.n,             # <<<<<<<<<<<<<<
 *                                   new_values_p  + i * dst_size, dst_type, alloc_len,
 *                                   vlen)
*/
      __pyx_t_2 = __pyx_f_5pysam_7libcbcf_bcf_copy_expand_array((__pyx_v_fmt->p + (__pyx_v_i * __pyx_v_fmt->size)), __pyx_v_fmt->type, __pyx_v_fmt->n, (__pyx_v_new_values_p + (__pyx_v_i * __pyx_v_dst_size)), __pyx_v_dst_type, __pyx_v_alloc_len, __pyx_v_vlen); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 912, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_2);
      __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    }

    /* "pysam/libcbcf.pyx":910
 *         raise ValueError('Unsupported FORMAT type')
 * 
 *     if fmt and nsamples > 1:             # <<<<<<<<<<<<<<
 *         for i in range(nsamples):
 *             bcf_copy_expand_array(fmt.p + i * fmt.size, fmt.type, fmt.n,
*/
  }

  /* "pysam/libcbcf.pyx":916
 *                                   vlen)
 * 
 *     bcf_object_to_array(values, new_values_p + sample.index * dst_size, dst_type, alloc_len, vlen)             # <<<<<<<<<<<<<<
 * 
 *     if bcf_update_format(hdr, r, bkey, new_values_p, <int>(nsamples * alloc_len), fmt_type) < 0:
*/
  __pyx_t_2 = __pyx_f_5pysam_7libcbcf_bcf_object_to_array(__pyx_v_values, (__pyx_v_new_values_p + (__pyx_v_sample->index * __pyx_v_dst_size)), __pyx_v_dst_type, __pyx_v_alloc_len, __pyx_v_vlen); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 916, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

  /* "pysam/libcbcf.pyx":918
 *     bcf_object_to_array(values, new_values_p + sample.index * dst_size, dst_type, alloc_len, vlen)
 * 
 *     if bcf_update_format(hdr, r, bkey, new_values_p, <int>(nsamples * alloc_len), fmt_type) < 0:             # <<<<<<<<<<<<<<
 *         raise ValueError('Unable to update format values')
 * 
*/
  if (unlikely(__pyx_v_bkey == Py_None)) {
    PyErr_SetString(PyExc_TypeError, "expected bytes, NoneType found");
    __PYX_ERR(0, 918, __pyx_L1_error)
  }
  __pyx_t_21 = __Pyx_PyBytes_AsString(__pyx_v_bkey); if (unlikely((!__pyx_t_21) && PyErr_Occurred())) __PYX_ERR(0, 918, __pyx_L1_error)
  __pyx_t_11 = (bcf_update_format(__pyx_v_hdr, __pyx_v_r, __pyx_t_21, __pyx_v_new_values_p, ((int)(__pyx_v_nsamples * __pyx_v_alloc_len)), __pyx_v_fmt_type) < 0);
  if (unlikely(__pyx_t_11)) {

    /* "pysam/libcbcf.pyx":919
 * 
 *     if bcf_update_format(hdr, r, bkey, new_values_p, <int>(nsamples * alloc_len), fmt_type) < 0:
 *         raise ValueError('Unable to update format values')             # <<<<<<<<<<<<<<
 * 
 * 
*/
    __pyx_t_12 = NULL;
    __Pyx_INCREF(__pyx_builtin_ValueError);
    __pyx_t_4 = __pyx_builtin_ValueError; 
    __pyx_t_5 = 1;
    {
      PyObject *__pyx_callargs[2] = {__pyx_t_12, __pyx_mstate_global->__pyx_kp_u_Unable_to_update_format_values};
      __pyx_t_2 = __Pyx_PyObject_FastCall(__pyx_t_4, __pyx_callargs+__pyx_t_5, (2-__pyx_t_5) | (__pyx_t_5*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
      __Pyx_XDECREF(__pyx_t_12); __pyx_t_12 = 0;
      __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
      if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 919, __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, 919, __pyx_L1_error)

    /* "pysam/libcbcf.pyx":918
 *     bcf_object_to_array(values, new_values_p + sample.index * dst_size, dst_type, alloc_len, vlen)
 * 
 *     if bcf_update_format(hdr, r, bkey, new_values_p, <int>(nsamples * alloc_len), fmt_type) < 0:             # <<<<<<<<<<<<<<
 *         raise ValueError('Unable to update format values')
 * 
*/
  }

  /* "pysam/libcbcf.pyx":830
 * 
 * 
 * cdef bcf_format_set_value(VariantRecordSample sample, key, value):             # <<<<<<<<<<<<<<
 *     if sample is None:
 *         raise ValueError('sample must not be None')
*/

  /* function exit code */
  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  __Pyx_TraceReturnValue(__pyx_r, 0, 0, __PYX_ERR(0, 830, __pyx_L1_error));
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_XDECREF(__pyx_t_12);
  __Pyx_XDECREF(__pyx_t_13);
  __Pyx_TraceException(__pyx_lineno, 0, 0);
  #if CYTHON_USE_SYS_MONITORING
  __Pyx_TraceExceptionUnwind(0, 0);
  #else
  __Pyx_TraceReturnValue(NULL, 0, 0, __PYX_ERR(0, 830, __pyx_L1_error));
  #endif
  __Pyx_AddTraceback("pysam.libcbcf.bcf_format_set_value", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_bkey);
  __Pyx_XDECREF(__pyx_v_values);
  __Pyx_XDECREF(__pyx_v_new_values);
  __Pyx_XDECREF(__pyx_v_value);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_PyMonitoring_ExitScope(0);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "pysam/libcbcf.pyx":922
 * 
 * 
 * cdef bcf_format_del_value(VariantRecordSample sample, key):             # <<<<<<<<<<<<<<
 *     if sample is None:
 *         raise ValueError('sample must not be None')
*/

static PyObject *__pyx_f_5pysam_7libcbcf_bcf_format_del_value(struct __pyx_obj_5pysam_7libcbcf_VariantRecordSample *__pyx_v_sample, PyObject *__pyx_v_key) {
  bcf_hdr_t *__pyx_v_hdr;
  bcf1_t *__pyx_v_r;
  Py_ssize_t __pyx_v_value_count;
  int __pyx_v_scalar;
  PyObject *__pyx_v_bkey = 0;
  bcf_fmt_t *__pyx_v_fmt;
  PyObject *__pyx_v_null_value = NULL;
  PyObject *__pyx_r = NULL;
  __Pyx_TraceDeclarationsFunc
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  PyObject *__pyx_t_4 = NULL;
  size_t __pyx_t_5;
  bcf_hdr_t *__pyx_t_6;
  bcf1_t *__pyx_t_7;
  char const *__pyx_t_8;
  int __pyx_t_9;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_TraceFrameInit(((PyObject *)__pyx_mstate_global->__pyx_codeobj_tab[23]))
  __Pyx_RefNannySetupContext("bcf_format_del_value", 0);
  __Pyx_TraceStartFunc("bcf_format_del_value", __pyx_f[0], 922, 0, 0, 0, __PYX_ERR(0, 922, __pyx_L1_error));

  /* "pysam/libcbcf.pyx":923
 * 
 * cdef bcf_format_del_value(VariantRecordSample sample, key):
 *     if sample is None:             # <<<<<<<<<<<<<<
 *         raise ValueError('sample must not be None')
 * 
*/
  __pyx_t_1 = (((PyObject *)__pyx_v_sample) == Py_None);
  if (unlikely(__pyx_t_1)) {

    /* "pysam/libcbcf.pyx":924
 * cdef bcf_format_del_value(VariantRecordSample sample, key):
 *     if sample is None:
 *         raise ValueError('sample must not be None')             # <<<<<<<<<<<<<<
 * 
 *     cdef bcf_hdr_t *hdr = sample.record.header.ptr
*/
    __pyx_t_3 = NULL;
    __Pyx_INCREF(__pyx_builtin_ValueError);
    __pyx_t_4 = __pyx_builtin_ValueError; 
    __pyx_t_5 = 1;
    {
      PyObject *__pyx_callargs[2] = {__pyx_t_3, __pyx_mstate_global->__pyx_kp_u_sample_must_not_be_None};
      __pyx_t_2 = __Pyx_PyObject_FastCall(__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_2)) __PYX_ERR(0, 924, __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, 924, __pyx_L1_error)

    /* "pysam/libcbcf.pyx":923
 * 
 * cdef bcf_format_del_value(VariantRecordSample sample, key):
 *     if sample is None:             # <<<<<<<<<<<<<<
 *         raise ValueError('sample must not be None')
 * 
*/
  }

  /* "pysam/libcbcf.pyx":926
 *         raise ValueError('sample must not be None')
 * 
 *     cdef bcf_hdr_t *hdr = sample.record.header.ptr             # <<<<<<<<<<<<<<
 *     cdef bcf1_t *r = sample.record.ptr
 *     cdef ssize_t value_count
*/
  __pyx_t_6 = __pyx_v_sample->record->header->ptr;
  __pyx_v_hdr = __pyx_t_6;

  /* "pysam/libcbcf.pyx":927
 * 
 *     cdef bcf_hdr_t *hdr = sample.record.header.ptr
 *     cdef bcf1_t *r = sample.record.ptr             # <<<<<<<<<<<<<<
 *     cdef ssize_t value_count
 *     cdef int scalar
*/
  __pyx_t_7 = __pyx_v_sample->record->ptr;
  __pyx_v_r = __pyx_t_7;

  /* "pysam/libcbcf.pyx":931
 *     cdef int scalar
 * 
 *     if bcf_unpack(r, BCF_UN_ALL) < 0:             # <<<<<<<<<<<<<<
 *         raise ValueError('Error unpacking VariantRecord')
 * 
*/
  __pyx_t_1 = (bcf_unpack(__pyx_v_r, BCF_UN_ALL) < 0);
  if (unlikely(__pyx_t_1)) {

    /* "pysam/libcbcf.pyx":932
 * 
 *     if bcf_unpack(r, BCF_UN_ALL) < 0:
 *         raise ValueError('Error unpacking VariantRecord')             # <<<<<<<<<<<<<<
 * 
 *     cdef bytes bkey = force_bytes(key)
*/
    __pyx_t_4 = NULL;
    __Pyx_INCREF(__pyx_builtin_ValueError);
    __pyx_t_3 = __pyx_builtin_ValueError; 
    __pyx_t_5 = 1;
    {
      PyObject *__pyx_callargs[2] = {__pyx_t_4, __pyx_mstate_global->__pyx_kp_u_Error_unpacking_VariantRecord};
      __pyx_t_2 = __Pyx_PyObject_FastCall(__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_2)) __PYX_ERR(0, 932, __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, 932, __pyx_L1_error)

    /* "pysam/libcbcf.pyx":931
 *     cdef int scalar
 * 
 *     if bcf_unpack(r, BCF_UN_ALL) < 0:             # <<<<<<<<<<<<<<
 *         raise ValueError('Error unpacking VariantRecord')
 * 
*/
  }

  /* "pysam/libcbcf.pyx":934
 *         raise ValueError('Error unpacking VariantRecord')
 * 
 *     cdef bytes bkey = force_bytes(key)             # <<<<<<<<<<<<<<
 *     cdef bcf_fmt_t *fmt = bcf_get_fmt(hdr, r, bkey)
 * 
*/
  __pyx_t_2 = __pyx_f_5pysam_9libcutils_force_bytes(__pyx_v_key, NULL); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 934, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_v_bkey = ((PyObject*)__pyx_t_2);
  __pyx_t_2 = 0;

  /* "pysam/libcbcf.pyx":935
 * 
 *     cdef bytes bkey = force_bytes(key)
 *     cdef bcf_fmt_t *fmt = bcf_get_fmt(hdr, r, bkey)             # <<<<<<<<<<<<<<
 * 
 *     if not fmt or not fmt.p:
*/
  if (unlikely(__pyx_v_bkey == Py_None)) {
    PyErr_SetString(PyExc_TypeError, "expected bytes, NoneType found");
    __PYX_ERR(0, 935, __pyx_L1_error)
  }
  __pyx_t_8 = __Pyx_PyBytes_AsString(__pyx_v_bkey); if (unlikely((!__pyx_t_8) && PyErr_Occurred())) __PYX_ERR(0, 935, __pyx_L1_error)
  __pyx_v_fmt = bcf_get_fmt(__pyx_v_hdr, __pyx_v_r, __pyx_t_8);

  /* "pysam/libcbcf.pyx":937
 *     cdef bcf_fmt_t *fmt = bcf_get_fmt(hdr, r, bkey)
 * 
 *     if not fmt or not fmt.p:             # <<<<<<<<<<<<<<
 *         raise KeyError(key)
 * 
*/
  __pyx_t_9 = (!(__pyx_v_fmt != 0));
  if (!__pyx_t_9) {
  } else {
    __pyx_t_1 = __pyx_t_9;
    goto __pyx_L6_bool_binop_done;
  }
  __pyx_t_9 = (!(__pyx_v_fmt->p != 0));
  __pyx_t_1 = __pyx_t_9;
  __pyx_L6_bool_binop_done:;
  if (unlikely(__pyx_t_1)) {

    /* "pysam/libcbcf.pyx":938
 * 
 *     if not fmt or not fmt.p:
 *         raise KeyError(key)             # <<<<<<<<<<<<<<
 * 
 *     bcf_get_value_count(sample.record, BCF_HL_FMT, fmt.id, &value_count, &scalar, sample.index)
*/
    __pyx_t_3 = NULL;
    __Pyx_INCREF(__pyx_builtin_KeyError);
    __pyx_t_4 = __pyx_builtin_KeyError; 
    __pyx_t_5 = 1;
    {
      PyObject *__pyx_callargs[2] = {__pyx_t_3, __pyx_v_key};
      __pyx_t_2 = __Pyx_PyObject_FastCall(__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_2)) __PYX_ERR(0, 938, __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, 938, __pyx_L1_error)

    /* "pysam/libcbcf.pyx":937
 *     cdef bcf_fmt_t *fmt = bcf_get_fmt(hdr, r, bkey)
 * 
 *     if not fmt or not fmt.p:             # <<<<<<<<<<<<<<
 *         raise KeyError(key)
 * 
*/
  }

  /* "pysam/libcbcf.pyx":940
 *         raise KeyError(key)
 * 
 *     bcf_get_value_count(sample.record, BCF_HL_FMT, fmt.id, &value_count, &scalar, sample.index)             # <<<<<<<<<<<<<<
 * 
 *     if value_count <= 0:
*/
  __pyx_t_2 = ((PyObject *)__pyx_v_sample->record);
  __Pyx_INCREF(__pyx_t_2);
  __pyx_t_4 = __pyx_f_5pysam_7libcbcf_bcf_get_value_count(((struct __pyx_obj_5pysam_7libcbcf_VariantRecord *)__pyx_t_2), BCF_HL_FMT, __pyx_v_fmt->id, (&__pyx_v_value_count), (&__pyx_v_scalar), __pyx_v_sample->index); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 940, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;

  /* "pysam/libcbcf.pyx":942
 *     bcf_get_value_count(sample.record, BCF_HL_FMT, fmt.id, &value_count, &scalar, sample.index)
 * 
 *     if value_count <= 0:             # <<<<<<<<<<<<<<
 *         null_value = ()
 *     elif scalar:
*/
  __pyx_t_1 = (__pyx_v_value_count <= 0);
  if (__pyx_t_1) {

    /* "pysam/libcbcf.pyx":943
 * 
 *     if value_count <= 0:
 *         null_value = ()             # <<<<<<<<<<<<<<
 *     elif scalar:
 *         null_value = None
*/
    __Pyx_INCREF(__pyx_mstate_global->__pyx_empty_tuple);
    __pyx_v_null_value = __pyx_mstate_global->__pyx_empty_tuple;

    /* "pysam/libcbcf.pyx":942
 *     bcf_get_value_count(sample.record, BCF_HL_FMT, fmt.id, &value_count, &scalar, sample.index)
 * 
 *     if value_count <= 0:             # <<<<<<<<<<<<<<
 *         null_value = ()
 *     elif scalar:
*/
    goto __pyx_L8;
  }

  /* "pysam/libcbcf.pyx":944
 *     if value_count <= 0:
 *         null_value = ()
 *     elif scalar:             # <<<<<<<<<<<<<<
 *         null_value = None
 *     else:
*/
  __pyx_t_1 = (__pyx_v_scalar != 0);
  if (__pyx_t_1) {

    /* "pysam/libcbcf.pyx":945
 *         null_value = ()
 *     elif scalar:
 *         null_value = None             # <<<<<<<<<<<<<<
 *     else:
 *         null_value = (None,)*value_count
*/
    __Pyx_INCREF(Py_None);
    __pyx_v_null_value = ((PyObject*)Py_None);

    /* "pysam/libcbcf.pyx":944
 *     if value_count <= 0:
 *         null_value = ()
 *     elif scalar:             # <<<<<<<<<<<<<<
 *         null_value = None
 *     else:
*/
    goto __pyx_L8;
  }

  /* "pysam/libcbcf.pyx":947
 *         null_value = None
 *     else:
 *         null_value = (None,)*value_count             # <<<<<<<<<<<<<<
 * 
 *     bcf_format_set_value(sample, bkey, null_value)
*/
  /*else*/ {
    __pyx_t_4 = __Pyx_PySequence_Multiply(__pyx_mstate_global->__pyx_tuple[0], __pyx_v_value_count); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 947, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
    __pyx_v_null_value = ((PyObject*)__pyx_t_4);
    __pyx_t_4 = 0;
  }
  __pyx_L8:;

  /* "pysam/libcbcf.pyx":949
 *         null_value = (None,)*value_count
 * 
 *     bcf_format_set_value(sample, bkey, null_value)             # <<<<<<<<<<<<<<
 * 
 * 
*/
  __pyx_t_4 = __pyx_f_5pysam_7libcbcf_bcf_format_set_value(__pyx_v_sample, __pyx_v_bkey, __pyx_v_null_value); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 949, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;

  /* "pysam/libcbcf.pyx":922
 * 
 * 
 * cdef bcf_format_del_value(VariantRecordSample sample, key):             # <<<<<<<<<<<<<<
 *     if sample is None:
 *         raise ValueError('sample must not be None')
*/

  /* function exit code */
  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  __Pyx_TraceReturnValue(__pyx_r, 0, 0, __PYX_ERR(0, 922, __pyx_L1_error));
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_TraceException(__pyx_lineno, 0, 0);
  #if CYTHON_USE_SYS_MONITORING
  __Pyx_TraceExceptionUnwind(0, 0);
  #else
  __Pyx_TraceReturnValue(NULL, 0, 0, __PYX_ERR(0, 922, __pyx_L1_error));
  #endif
  __Pyx_AddTraceback("pysam.libcbcf.bcf_format_del_value", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_bkey);
  __Pyx_XDECREF(__pyx_v_null_value);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_PyMonitoring_ExitScope(0);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "pysam/libcbcf.pyx":952
 * 
 * 
 * cdef bcf_format_get_allele_indices(VariantRecordSample sample):             # <<<<<<<<<<<<<<
 *     if sample is None:
 *         raise ValueError('sample must not be None')
*/

static PyObject *__pyx_f_5pysam_7libcbcf_bcf_format_get_allele_indices(struct __pyx_obj_5pysam_7libcbcf_VariantRecordSample *__pyx_v_sample) {
  bcf_hdr_t *__pyx_v_hdr;
  bcf1_t *__pyx_v_r;
  int32_t __pyx_v_n;
  bcf_fmt_t *__pyx_v_fmt0;
  int __pyx_v_gt0;
  int8_t *__pyx_v_data8;
  int16_t *__pyx_v_data16;
  int32_t *__pyx_v_data32;
  int32_t __pyx_v_a;
  int32_t __pyx_v_nalleles;
  PyObject *__pyx_v_alleles = 0;
  int __pyx_v_i;
  PyObject *__pyx_r = NULL;
  __Pyx_TraceDeclarationsFunc
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  PyObject *__pyx_t_4 = NULL;
  size_t __pyx_t_5;
  bcf_hdr_t *__pyx_t_6;
  bcf1_t *__pyx_t_7;
  uint32_t __pyx_t_8;
  int __pyx_t_9;
  bcf_fmt_t *__pyx_t_10;
  int __pyx_t_11;
  int __pyx_t_12;
  int __pyx_t_13;
  int __pyx_t_14;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_TraceFrameInit(((PyObject *)__pyx_mstate_global->__pyx_codeobj_tab[24]))
  __Pyx_RefNannySetupContext("bcf_format_get_allele_indices", 0);
  __Pyx_TraceStartFunc("bcf_format_get_allele_indices", __pyx_f[0], 952, 0, 0, 0, __PYX_ERR(0, 952, __pyx_L1_error));

  /* "pysam/libcbcf.pyx":953
 * 
 * cdef bcf_format_get_allele_indices(VariantRecordSample sample):
 *     if sample is None:             # <<<<<<<<<<<<<<
 *         raise ValueError('sample must not be None')
 * 
*/
  __pyx_t_1 = (((PyObject *)__pyx_v_sample) == Py_None);
  if (unlikely(__pyx_t_1)) {

    /* "pysam/libcbcf.pyx":954
 * cdef bcf_format_get_allele_indices(VariantRecordSample sample):
 *     if sample is None:
 *         raise ValueError('sample must not be None')             # <<<<<<<<<<<<<<
 * 
 *     cdef bcf_hdr_t *hdr = sample.record.header.ptr
*/
    __pyx_t_3 = NULL;
    __Pyx_INCREF(__pyx_builtin_ValueError);
    __pyx_t_4 = __pyx_builtin_ValueError; 
    __pyx_t_5 = 1;
    {
      PyObject *__pyx_callargs[2] = {__pyx_t_3, __pyx_mstate_global->__pyx_kp_u_sample_must_not_be_None};
      __pyx_t_2 = __Pyx_PyObject_FastCall(__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_2)) __PYX_ERR(0, 954, __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, 954, __pyx_L1_error)

    /* "pysam/libcbcf.pyx":953
 * 
 * cdef bcf_format_get_allele_indices(VariantRecordSample sample):
 *     if sample is None:             # <<<<<<<<<<<<<<
 *         raise ValueError('sample must not be None')
 * 
*/
  }

  /* "pysam/libcbcf.pyx":956
 *         raise ValueError('sample must not be None')
 * 
 *     cdef bcf_hdr_t *hdr = sample.record.header.ptr             # <<<<<<<<<<<<<<
 *     cdef bcf1_t *r = sample.record.ptr
 *     cdef int32_t n = r.n_sample
*/
  __pyx_t_6 = __pyx_v_sample->record->header->ptr;
  __pyx_v_hdr = __pyx_t_6;

  /* "pysam/libcbcf.pyx":957
 * 
 *     cdef bcf_hdr_t *hdr = sample.record.header.ptr
 *     cdef bcf1_t *r = sample.record.ptr             # <<<<<<<<<<<<<<
 *     cdef int32_t n = r.n_sample
 * 
*/
  __pyx_t_7 = __pyx_v_sample->record->ptr;
  __pyx_v_r = __pyx_t_7;

  /* "pysam/libcbcf.pyx":958
 *     cdef bcf_hdr_t *hdr = sample.record.header.ptr
 *     cdef bcf1_t *r = sample.record.ptr
 *     cdef int32_t n = r.n_sample             # <<<<<<<<<<<<<<
 * 
 *     if bcf_unpack(r, BCF_UN_ALL) < 0:
*/
  __pyx_t_8 = __pyx_v_r->n_sample;
  __pyx_v_n = __pyx_t_8;

  /* "pysam/libcbcf.pyx":960
 *     cdef int32_t n = r.n_sample
 * 
 *     if bcf_unpack(r, BCF_UN_ALL) < 0:             # <<<<<<<<<<<<<<
 *         raise ValueError('Error unpacking VariantRecord')
 * 
*/
  __pyx_t_1 = (bcf_unpack(__pyx_v_r, BCF_UN_ALL) < 0);
  if (unlikely(__pyx_t_1)) {

    /* "pysam/libcbcf.pyx":961
 * 
 *     if bcf_unpack(r, BCF_UN_ALL) < 0:
 *         raise ValueError('Error unpacking VariantRecord')             # <<<<<<<<<<<<<<
 * 
 *     if sample.index < 0 or sample.index >= n or not r.n_fmt:
*/
    __pyx_t_4 = NULL;
    __Pyx_INCREF(__pyx_builtin_ValueError);
    __pyx_t_3 = __pyx_builtin_ValueError; 
    __pyx_t_5 = 1;
    {
      PyObject *__pyx_callargs[2] = {__pyx_t_4, __pyx_mstate_global->__pyx_kp_u_Error_unpacking_VariantRecord};
      __pyx_t_2 = __Pyx_PyObject_FastCall(__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_2)) __PYX_ERR(0, 961, __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, 961, __pyx_L1_error)

    /* "pysam/libcbcf.pyx":960
 *     cdef int32_t n = r.n_sample
 * 
 *     if bcf_unpack(r, BCF_UN_ALL) < 0:             # <<<<<<<<<<<<<<
 *         raise ValueError('Error unpacking VariantRecord')
 * 
*/
  }

  /* "pysam/libcbcf.pyx":963
 *         raise ValueError('Error unpacking VariantRecord')
 * 
 *     if sample.index < 0 or sample.index >= n or not r.n_fmt:             # <<<<<<<<<<<<<<
 *         return ()
 * 
*/
  __pyx_t_9 = (__pyx_v_sample->index < 0);
  if (!__pyx_t_9) {
  } else {
    __pyx_t_1 = __pyx_t_9;
    goto __pyx_L6_bool_binop_done;
  }
  __pyx_t_9 = (__pyx_v_sample->index >= __pyx_v_n);
  if (!__pyx_t_9) {
  } else {
    __pyx_t_1 = __pyx_t_9;
    goto __pyx_L6_bool_binop_done;
  }
  __pyx_t_9 = (!(__pyx_v_r->n_fmt != 0));
  __pyx_t_1 = __pyx_t_9;
  __pyx_L6_bool_binop_done:;
  if (__pyx_t_1) {

    /* "pysam/libcbcf.pyx":964
 * 
 *     if sample.index < 0 or sample.index >= n or not r.n_fmt:
 *         return ()             # <<<<<<<<<<<<<<
 * 
 *     cdef bcf_fmt_t *fmt0 = r.d.fmt
*/
    __Pyx_XDECREF(__pyx_r);
    __Pyx_INCREF(__pyx_mstate_global->__pyx_empty_tuple);
    __pyx_r = __pyx_mstate_global->__pyx_empty_tuple;
    __Pyx_TraceReturnValue(__pyx_r, 46, 0, __PYX_ERR(0, 964, __pyx_L1_error));
    goto __pyx_L0;

    /* "pysam/libcbcf.pyx":963
 *         raise ValueError('Error unpacking VariantRecord')
 * 
 *     if sample.index < 0 or sample.index >= n or not r.n_fmt:             # <<<<<<<<<<<<<<
 *         return ()
 * 
*/
  }

  /* "pysam/libcbcf.pyx":966
 *         return ()
 * 
 *     cdef bcf_fmt_t *fmt0 = r.d.fmt             # <<<<<<<<<<<<<<
 *     cdef int gt0 = is_gt_fmt(hdr, fmt0.id)
 * 
*/
  __pyx_t_10 = __pyx_v_r->d.fmt;
  __pyx_v_fmt0 = __pyx_t_10;

  /* "pysam/libcbcf.pyx":967
 * 
 *     cdef bcf_fmt_t *fmt0 = r.d.fmt
 *     cdef int gt0 = is_gt_fmt(hdr, fmt0.id)             # <<<<<<<<<<<<<<
 * 
 *     if not gt0 or not fmt0.n:
*/
  __pyx_t_11 = __pyx_f_5pysam_7libcbcf_is_gt_fmt(__pyx_v_hdr, __pyx_v_fmt0->id); if (unlikely(__pyx_t_11 == ((int)-1) && PyErr_Occurred())) __PYX_ERR(0, 967, __pyx_L1_error)
  __pyx_v_gt0 = __pyx_t_11;

  /* "pysam/libcbcf.pyx":969
 *     cdef int gt0 = is_gt_fmt(hdr, fmt0.id)
 * 
 *     if not gt0 or not fmt0.n:             # <<<<<<<<<<<<<<
 *         return ()
 * 
*/
  __pyx_t_9 = (!(__pyx_v_gt0 != 0));
  if (!__pyx_t_9) {
  } else {
    __pyx_t_1 = __pyx_t_9;
    goto __pyx_L10_bool_binop_done;
  }
  __pyx_t_9 = (!(__pyx_v_fmt0->n != 0));
  __pyx_t_1 = __pyx_t_9;
  __pyx_L10_bool_binop_done:;
  if (__pyx_t_1) {

    /* "pysam/libcbcf.pyx":970
 * 
 *     if not gt0 or not fmt0.n:
 *         return ()             # <<<<<<<<<<<<<<
 * 
 *     cdef int8_t  *data8
*/
    __Pyx_XDECREF(__pyx_r);
    __Pyx_INCREF(__pyx_mstate_global->__pyx_empty_tuple);
    __pyx_r = __pyx_mstate_global->__pyx_empty_tuple;
    __Pyx_TraceReturnValue(__pyx_r, 65, 0, __PYX_ERR(0, 970, __pyx_L1_error));
    goto __pyx_L0;

    /* "pysam/libcbcf.pyx":969
 *     cdef int gt0 = is_gt_fmt(hdr, fmt0.id)
 * 
 *     if not gt0 or not fmt0.n:             # <<<<<<<<<<<<<<
 *         return ()
 * 
*/
  }

  /* "pysam/libcbcf.pyx":975
 *     cdef int16_t *data16
 *     cdef int32_t *data32
 *     cdef int32_t a, nalleles = r.n_allele             # <<<<<<<<<<<<<<
 *     cdef list alleles = []
 * 
*/
  __pyx_t_8 = __pyx_v_r->n_allele;
  __pyx_v_nalleles = __pyx_t_8;

  /* "pysam/libcbcf.pyx":976
 *     cdef int32_t *data32
 *     cdef int32_t a, nalleles = r.n_allele
 *     cdef list alleles = []             # <<<<<<<<<<<<<<
 * 
 *     if fmt0.type == BCF_BT_INT8:
*/
  __pyx_t_2 = PyList_New(0); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 976, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_v_alleles = ((PyObject*)__pyx_t_2);
  __pyx_t_2 = 0;

  /* "pysam/libcbcf.pyx":978
 *     cdef list alleles = []
 * 
 *     if fmt0.type == BCF_BT_INT8:             # <<<<<<<<<<<<<<
 *         data8 = <int8_t *>(fmt0.p + sample.index * fmt0.size)
 *         for i in range(fmt0.n):
*/
  __pyx_t_1 = (__pyx_v_fmt0->type == BCF_BT_INT8);
  if (__pyx_t_1) {

    /* "pysam/libcbcf.pyx":979
 * 
 *     if fmt0.type == BCF_BT_INT8:
 *         data8 = <int8_t *>(fmt0.p + sample.index * fmt0.size)             # <<<<<<<<<<<<<<
 *         for i in range(fmt0.n):
 *             if data8[i] == bcf_int8_vector_end:
*/
    __pyx_v_data8 = ((int8_t *)(__pyx_v_fmt0->p + (__pyx_v_sample->index * __pyx_v_fmt0->size)));

    /* "pysam/libcbcf.pyx":980
 *     if fmt0.type == BCF_BT_INT8:
 *         data8 = <int8_t *>(fmt0.p + sample.index * fmt0.size)
 *         for i in range(fmt0.n):             # <<<<<<<<<<<<<<
 *             if data8[i] == bcf_int8_vector_end:
 *                 break
*/
    __pyx_t_11 = __pyx_v_fmt0->n;
    __pyx_t_12 = __pyx_t_11;
    for (__pyx_t_13 = 0; __pyx_t_13 < __pyx_t_12; __pyx_t_13+=1) {
      __pyx_v_i = __pyx_t_13;

      /* "pysam/libcbcf.pyx":981
 *         data8 = <int8_t *>(fmt0.p + sample.index * fmt0.size)
 *         for i in range(fmt0.n):
 *             if data8[i] == bcf_int8_vector_end:             # <<<<<<<<<<<<<<
 *                 break
 *             elif data8[i] == bcf_gt_missing:
*/
      __pyx_t_1 = ((__pyx_v_data8[__pyx_v_i]) == bcf_int8_vector_end);
      if (__pyx_t_1) {

        /* "pysam/libcbcf.pyx":982
 *         for i in range(fmt0.n):
 *             if data8[i] == bcf_int8_vector_end:
 *                 break             # <<<<<<<<<<<<<<
 *             elif data8[i] == bcf_gt_missing:
 *                 a = -1
*/
        goto __pyx_L14_break;

        /* "pysam/libcbcf.pyx":981
 *         data8 = <int8_t *>(fmt0.p + sample.index * fmt0.size)
 *         for i in range(fmt0.n):
 *             if data8[i] == bcf_int8_vector_end:             # <<<<<<<<<<<<<<
 *                 break
 *             elif data8[i] == bcf_gt_missing:
*/
      }

      /* "pysam/libcbcf.pyx":983
 *             if data8[i] == bcf_int8_vector_end:
 *                 break
 *             elif data8[i] == bcf_gt_missing:             # <<<<<<<<<<<<<<
 *                 a = -1
 *             else:
*/
      __pyx_t_1 = ((__pyx_v_data8[__pyx_v_i]) == bcf_gt_missing);
      if (__pyx_t_1) {

        /* "pysam/libcbcf.pyx":984
 *                 break
 *             elif data8[i] == bcf_gt_missing:
 *                 a = -1             # <<<<<<<<<<<<<<
 *             else:
 *                 a = bcf_gt_allele(data8[i])
*/
        __pyx_v_a = -1;

        /* "pysam/libcbcf.pyx":983
 *             if data8[i] == bcf_int8_vector_end:
 *                 break
 *             elif data8[i] == bcf_gt_missing:             # <<<<<<<<<<<<<<
 *                 a = -1
 *             else:
*/
        goto __pyx_L15;
      }

      /* "pysam/libcbcf.pyx":986
 *                 a = -1
 *             else:
 *                 a = bcf_gt_allele(data8[i])             # <<<<<<<<<<<<<<
 *             alleles.append(a if 0 <= a < nalleles else None)
 *     elif fmt0.type == BCF_BT_INT16:
*/
      /*else*/ {
        __pyx_v_a = bcf_gt_allele((__pyx_v_data8[__pyx_v_i]));
      }
      __pyx_L15:;

      /* "pysam/libcbcf.pyx":987
 *             else:
 *                 a = bcf_gt_allele(data8[i])
 *             alleles.append(a if 0 <= a < nalleles else None)             # <<<<<<<<<<<<<<
 *     elif fmt0.type == BCF_BT_INT16:
 *         data16 = <int16_t *>(fmt0.p + sample.index * fmt0.size)
*/
      __pyx_t_1 = (0 <= __pyx_v_a);
      if (__pyx_t_1) {
        __pyx_t_1 = (__pyx_v_a < __pyx_v_nalleles);
      }
      if (__pyx_t_1) {
        __pyx_t_3 = __Pyx_PyLong_From_int32_t(__pyx_v_a); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 987, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_3);
        __pyx_t_2 = __pyx_t_3;
        __pyx_t_3 = 0;
      } else {
        __Pyx_INCREF(Py_None);
        __pyx_t_2 = Py_None;
      }
      __pyx_t_14 = __Pyx_PyList_Append(__pyx_v_alleles, __pyx_t_2); if (unlikely(__pyx_t_14 == ((int)-1))) __PYX_ERR(0, 987, __pyx_L1_error)
      __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    }
    __pyx_L14_break:;

    /* "pysam/libcbcf.pyx":978
 *     cdef list alleles = []
 * 
 *     if fmt0.type == BCF_BT_INT8:             # <<<<<<<<<<<<<<
 *         data8 = <int8_t *>(fmt0.p + sample.index * fmt0.size)
 *         for i in range(fmt0.n):
*/
    goto __pyx_L12;
  }

  /* "pysam/libcbcf.pyx":988
 *                 a = bcf_gt_allele(data8[i])
 *             alleles.append(a if 0 <= a < nalleles else None)
 *     elif fmt0.type == BCF_BT_INT16:             # <<<<<<<<<<<<<<
 *         data16 = <int16_t *>(fmt0.p + sample.index * fmt0.size)
 *         for i in range(fmt0.n):
*/
  __pyx_t_1 = (__pyx_v_fmt0->type == BCF_BT_INT16);
  if (__pyx_t_1) {

    /* "pysam/libcbcf.pyx":989
 *             alleles.append(a if 0 <= a < nalleles else None)
 *     elif fmt0.type == BCF_BT_INT16:
 *         data16 = <int16_t *>(fmt0.p + sample.index * fmt0.size)             # <<<<<<<<<<<<<<
 *         for i in range(fmt0.n):
 *             if data16[i] == bcf_int16_vector_end:
*/
    __pyx_v_data16 = ((int16_t *)(__pyx_v_fmt0->p + (__pyx_v_sample->index * __pyx_v_fmt0->size)));

    /* "pysam/libcbcf.pyx":990
 *     elif fmt0.type == BCF_BT_INT16:
 *         data16 = <int16_t *>(fmt0.p + sample.index * fmt0.size)
 *         for i in range(fmt0.n):             # <<<<<<<<<<<<<<
 *             if data16[i] == bcf_int16_vector_end:
 *                 break
*/
    __pyx_t_11 = __pyx_v_fmt0->n;
    __pyx_t_12 = __pyx_t_11;
    for (__pyx_t_13 = 0; __pyx_t_13 < __pyx_t_12; __pyx_t_13+=1) {
      __pyx_v_i = __pyx_t_13;

      /* "pysam/libcbcf.pyx":991
 *         data16 = <int16_t *>(fmt0.p + sample.index * fmt0.size)
 *         for i in range(fmt0.n):
 *             if data16[i] == bcf_int16_vector_end:             # <<<<<<<<<<<<<<
 *                 break
 *             elif data16[i] == bcf_gt_missing:
*/
      __pyx_t_1 = ((__pyx_v_data16[__pyx_v_i]) == bcf_int16_vector_end);
      if (__pyx_t_1) {

        /* "pysam/libcbcf.pyx":992
 *         for i in range(fmt0.n):
 *             if data16[i] == bcf_int16_vector_end:
 *                 break             # <<<<<<<<<<<<<<
 *             elif data16[i] == bcf_gt_missing:
 *                 a = -1
*/
        goto __pyx_L17_break;

        /* "pysam/libcbcf.pyx":991
 *         data16 = <int16_t *>(fmt0.p + sample.index * fmt0.size)
 *         for i in range(fmt0.n):
 *             if data16[i] == bcf_int16_vector_end:             # <<<<<<<<<<<<<<
 *                 break
 *             elif data16[i] == bcf_gt_missing:
*/
      }

      /* "pysam/libcbcf.pyx":993
 *             if data16[i] == bcf_int16_vector_end:
 *                 break
 *             elif data16[i] == bcf_gt_missing:             # <<<<<<<<<<<<<<
 *                 a = -1
 *             else:
*/
      __pyx_t_1 = ((__pyx_v_data16[__pyx_v_i]) == bcf_gt_missing);
      if (__pyx_t_1) {

        /* "pysam/libcbcf.pyx":994
 *                 break
 *             elif data16[i] == bcf_gt_missing:
 *                 a = -1             # <<<<<<<<<<<<<<
 *             else:
 *                 a = bcf_gt_allele(data16[i])
*/
        __pyx_v_a = -1;

        /* "pysam/libcbcf.pyx":993
 *             if data16[i] == bcf_int16_vector_end:
 *                 break
 *             elif data16[i] == bcf_gt_missing:             # <<<<<<<<<<<<<<
 *                 a = -1
 *             else:
*/
        goto __pyx_L18;
      }

      /* "pysam/libcbcf.pyx":996
 *                 a = -1
 *             else:
 *                 a = bcf_gt_allele(data16[i])             # <<<<<<<<<<<<<<
 *             alleles.append(a if 0 <= a < nalleles else None)
 *     elif fmt0.type == BCF_BT_INT32:
*/
      /*else*/ {
        __pyx_v_a = bcf_gt_allele((__pyx_v_data16[__pyx_v_i]));
      }
      __pyx_L18:;

      /* "pysam/libcbcf.pyx":997
 *             else:
 *                 a = bcf_gt_allele(data16[i])
 *             alleles.append(a if 0 <= a < nalleles else None)             # <<<<<<<<<<<<<<
 *     elif fmt0.type == BCF_BT_INT32:
 *         data32 = <int32_t *>(fmt0.p + sample.index * fmt0.size)
*/
      __pyx_t_1 = (0 <= __pyx_v_a);
      if (__pyx_t_1) {
        __pyx_t_1 = (__pyx_v_a < __pyx_v_nalleles);
      }
      if (__pyx_t_1) {
        __pyx_t_3 = __Pyx_PyLong_From_int32_t(__pyx_v_a); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 997, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_3);
        __pyx_t_2 = __pyx_t_3;
        __pyx_t_3 = 0;
      } else {
        __Pyx_INCREF(Py_None);
        __pyx_t_2 = Py_None;
      }
      __pyx_t_14 = __Pyx_PyList_Append(__pyx_v_alleles, __pyx_t_2); if (unlikely(__pyx_t_14 == ((int)-1))) __PYX_ERR(0, 997, __pyx_L1_error)
      __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    }
    __pyx_L17_break:;

    /* "pysam/libcbcf.pyx":988
 *                 a = bcf_gt_allele(data8[i])
 *             alleles.append(a if 0 <= a < nalleles else None)
 *     elif fmt0.type == BCF_BT_INT16:             # <<<<<<<<<<<<<<
 *         data16 = <int16_t *>(fmt0.p + sample.index * fmt0.size)
 *         for i in range(fmt0.n):
*/
    goto __pyx_L12;
  }

  /* "pysam/libcbcf.pyx":998
 *                 a = bcf_gt_allele(data16[i])
 *             alleles.append(a if 0 <= a < nalleles else None)
 *     elif fmt0.type == BCF_BT_INT32:             # <<<<<<<<<<<<<<
 *         data32 = <int32_t *>(fmt0.p + sample.index * fmt0.size)
 *         for i in range(fmt0.n):
*/
  __pyx_t_1 = (__pyx_v_fmt0->type == BCF_BT_INT32);
  if (__pyx_t_1) {

    /* "pysam/libcbcf.pyx":999
 *             alleles.append(a if 0 <= a < nalleles else None)
 *     elif fmt0.type == BCF_BT_INT32:
 *         data32 = <int32_t *>(fmt0.p + sample.index * fmt0.size)             # <<<<<<<<<<<<<<
 *         for i in range(fmt0.n):
 *             if data32[i] == bcf_int32_vector_end:
*/
    __pyx_v_data32 = ((int32_t *)(__pyx_v_fmt0->p + (__pyx_v_sample->index * __pyx_v_fmt0->size)));

    /* "pysam/libcbcf.pyx":1000
 *     elif fmt0.type == BCF_BT_INT32:
 *         data32 = <int32_t *>(fmt0.p + sample.index * fmt0.size)
 *         for i in range(fmt0.n):             # <<<<<<<<<<<<<<
 *             if data32[i] == bcf_int32_vector_end:
 *                 break
*/
    __pyx_t_11 = __pyx_v_fmt0->n;
    __pyx_t_12 = __pyx_t_11;
    for (__pyx_t_13 = 0; __pyx_t_13 < __pyx_t_12; __pyx_t_13+=1) {
      __pyx_v_i = __pyx_t_13;

      /* "pysam/libcbcf.pyx":1001
 *         data32 = <int32_t *>(fmt0.p + sample.index * fmt0.size)
 *         for i in range(fmt0.n):
 *             if data32[i] == bcf_int32_vector_end:             # <<<<<<<<<<<<<<
 *                 break
 *             elif data32[i] == bcf_gt_missing:
*/
      __pyx_t_1 = ((__pyx_v_data32[__pyx_v_i]) == bcf_int32_vector_end);
      if (__pyx_t_1) {

        /* "pysam/libcbcf.pyx":1002
 *         for i in range(fmt0.n):
 *             if data32[i] == bcf_int32_vector_end:
 *                 break             # <<<<<<<<<<<<<<
 *             elif data32[i] == bcf_gt_missing:
 *                 a = -1
*/
        goto __pyx_L20_break;

        /* "pysam/libcbcf.pyx":1001
 *         data32 = <int32_t *>(fmt0.p + sample.index * fmt0.size)
 *         for i in range(fmt0.n):
 *             if data32[i] == bcf_int32_vector_end:             # <<<<<<<<<<<<<<
 *                 break
 *             elif data32[i] == bcf_gt_missing:
*/
      }

      /* "pysam/libcbcf.pyx":1003
 *             if data32[i] == bcf_int32_vector_end:
 *                 break
 *             elif data32[i] == bcf_gt_missing:             # <<<<<<<<<<<<<<
 *                 a = -1
 *             else:
*/
      __pyx_t_1 = ((__pyx_v_data32[__pyx_v_i]) == bcf_gt_missing);
      if (__pyx_t_1) {

        /* "pysam/libcbcf.pyx":1004
 *                 break
 *             elif data32[i] == bcf_gt_missing:
 *                 a = -1             # <<<<<<<<<<<<<<
 *             else:
 *                 a = bcf_gt_allele(data32[i])
*/
        __pyx_v_a = -1;

        /* "pysam/libcbcf.pyx":1003
 *             if data32[i] == bcf_int32_vector_end:
 *                 break
 *             elif data32[i] == bcf_gt_missing:             # <<<<<<<<<<<<<<
 *                 a = -1
 *             else:
*/
        goto __pyx_L21;
      }

      /* "pysam/libcbcf.pyx":1006
 *                 a = -1
 *             else:
 *                 a = bcf_gt_allele(data32[i])             # <<<<<<<<<<<<<<
 *             alleles.append(a if 0 <= a < nalleles else None)
 * 
*/
      /*else*/ {
        __pyx_v_a = bcf_gt_allele((__pyx_v_data32[__pyx_v_i]));
      }
      __pyx_L21:;

      /* "pysam/libcbcf.pyx":1007
 *             else:
 *                 a = bcf_gt_allele(data32[i])
 *             alleles.append(a if 0 <= a < nalleles else None)             # <<<<<<<<<<<<<<
 * 
 *     return tuple(alleles)
*/
      __pyx_t_1 = (0 <= __pyx_v_a);
      if (__pyx_t_1) {
        __pyx_t_1 = (__pyx_v_a < __pyx_v_nalleles);
      }
      if (__pyx_t_1) {
        __pyx_t_3 = __Pyx_PyLong_From_int32_t(__pyx_v_a); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1007, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_3);
        __pyx_t_2 = __pyx_t_3;
        __pyx_t_3 = 0;
      } else {
        __Pyx_INCREF(Py_None);
        __pyx_t_2 = Py_None;
      }
      __pyx_t_14 = __Pyx_PyList_Append(__pyx_v_alleles, __pyx_t_2); if (unlikely(__pyx_t_14 == ((int)-1))) __PYX_ERR(0, 1007, __pyx_L1_error)
      __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    }
    __pyx_L20_break:;

    /* "pysam/libcbcf.pyx":998
 *                 a = bcf_gt_allele(data16[i])
 *             alleles.append(a if 0 <= a < nalleles else None)
 *     elif fmt0.type == BCF_BT_INT32:             # <<<<<<<<<<<<<<
 *         data32 = <int32_t *>(fmt0.p + sample.index * fmt0.size)
 *         for i in range(fmt0.n):
*/
  }
  __pyx_L12:;

  /* "pysam/libcbcf.pyx":1009
 *             alleles.append(a if 0 <= a < nalleles else None)
 * 
 *     return tuple(alleles)             # <<<<<<<<<<<<<<
 * 
 * 
*/
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_2 = PyList_AsTuple(__pyx_v_alleles); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1009, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_r = __pyx_t_2;
  __pyx_t_2 = 0;
  __Pyx_TraceReturnValue(__pyx_r, 220, 0, __PYX_ERR(0, 1009, __pyx_L1_error));
  goto __pyx_L0;

  /* "pysam/libcbcf.pyx":952
 * 
 * 
 * cdef bcf_format_get_allele_indices(VariantRecordSample sample):             # <<<<<<<<<<<<<<
 *     if sample is None:
 *         raise ValueError('sample must not be None')
*/

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_TraceException(__pyx_lineno, 0, 0);
  #if CYTHON_USE_SYS_MONITORING
  __Pyx_TraceExceptionUnwind(0, 0);
  #else
  __Pyx_TraceReturnValue(NULL, 0, 0, __PYX_ERR(0, 952, __pyx_L1_error));
  #endif
  __Pyx_AddTraceback("pysam.libcbcf.bcf_format_get_allele_indices", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_alleles);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_PyMonitoring_ExitScope(0);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "pysam/libcbcf.pyx":1012
 * 
 * 
 * cdef bcf_format_get_alleles(VariantRecordSample sample):             # <<<<<<<<<<<<<<
 *     if sample is None:
 *         raise ValueError('sample must not be None')
*/

static PyObject *__pyx_f_5pysam_7libcbcf_bcf_format_get_alleles(struct __pyx_obj_5pysam_7libcbcf_VariantRecordSample *__pyx_v_sample) {
  bcf_hdr_t *__pyx_v_hdr;
  bcf1_t *__pyx_v_r;
  int32_t __pyx_v_nsamples;
  int32_t __pyx_v_nalleles;
  bcf_fmt_t *__pyx_v_fmt0;
  int __pyx_v_gt0;
  int32_t __pyx_v_a;
  int8_t *__pyx_v_data8;
  int16_t *__pyx_v_data16;
  int32_t *__pyx_v_data32;
  PyObject *__pyx_v_alleles = NULL;
  int __pyx_v_i;
  PyObject *__pyx_r = NULL;
  __Pyx_TraceDeclarationsFunc
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  PyObject *__pyx_t_4 = NULL;
  size_t __pyx_t_5;
  bcf_hdr_t *__pyx_t_6;
  bcf1_t *__pyx_t_7;
  uint32_t __pyx_t_8;
  int __pyx_t_9;
  bcf_fmt_t *__pyx_t_10;
  int __pyx_t_11;
  int __pyx_t_12;
  int __pyx_t_13;
  int __pyx_t_14;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_TraceFrameInit(((PyObject *)__pyx_mstate_global->__pyx_codeobj_tab[25]))
  __Pyx_RefNannySetupContext("bcf_format_get_alleles", 0);
  __Pyx_TraceStartFunc("bcf_format_get_alleles", __pyx_f[0], 1012, 0, 0, 0, __PYX_ERR(0, 1012, __pyx_L1_error));

  /* "pysam/libcbcf.pyx":1013
 * 
 * cdef bcf_format_get_alleles(VariantRecordSample sample):
 *     if sample is None:             # <<<<<<<<<<<<<<
 *         raise ValueError('sample must not be None')
 * 
*/
  __pyx_t_1 = (((PyObject *)__pyx_v_sample) == Py_None);
  if (unlikely(__pyx_t_1)) {

    /* "pysam/libcbcf.pyx":1014
 * cdef bcf_format_get_alleles(VariantRecordSample sample):
 *     if sample is None:
 *         raise ValueError('sample must not be None')             # <<<<<<<<<<<<<<
 * 
 *     cdef bcf_hdr_t *hdr = sample.record.header.ptr
*/
    __pyx_t_3 = NULL;
    __Pyx_INCREF(__pyx_builtin_ValueError);
    __pyx_t_4 = __pyx_builtin_ValueError; 
    __pyx_t_5 = 1;
    {
      PyObject *__pyx_callargs[2] = {__pyx_t_3, __pyx_mstate_global->__pyx_kp_u_sample_must_not_be_None};
      __pyx_t_2 = __Pyx_PyObject_FastCall(__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_2)) __PYX_ERR(0, 1014, __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, 1014, __pyx_L1_error)

    /* "pysam/libcbcf.pyx":1013
 * 
 * cdef bcf_format_get_alleles(VariantRecordSample sample):
 *     if sample is None:             # <<<<<<<<<<<<<<
 *         raise ValueError('sample must not be None')
 * 
*/
  }

  /* "pysam/libcbcf.pyx":1016
 *         raise ValueError('sample must not be None')
 * 
 *     cdef bcf_hdr_t *hdr = sample.record.header.ptr             # <<<<<<<<<<<<<<
 *     cdef bcf1_t *r = sample.record.ptr
 *     cdef int32_t nsamples = r.n_sample
*/
  __pyx_t_6 = __pyx_v_sample->record->header->ptr;
  __pyx_v_hdr = __pyx_t_6;

  /* "pysam/libcbcf.pyx":1017
 * 
 *     cdef bcf_hdr_t *hdr = sample.record.header.ptr
 *     cdef bcf1_t *r = sample.record.ptr             # <<<<<<<<<<<<<<
 *     cdef int32_t nsamples = r.n_sample
 * 
*/
  __pyx_t_7 = __pyx_v_sample->record->ptr;
  __pyx_v_r = __pyx_t_7;

  /* "pysam/libcbcf.pyx":1018
 *     cdef bcf_hdr_t *hdr = sample.record.header.ptr
 *     cdef bcf1_t *r = sample.record.ptr
 *     cdef int32_t nsamples = r.n_sample             # <<<<<<<<<<<<<<
 * 
 *     if bcf_unpack(r, BCF_UN_ALL) < 0:
*/
  __pyx_t_8 = __pyx_v_r->n_sample;
  __pyx_v_nsamples = __pyx_t_8;

  /* "pysam/libcbcf.pyx":1020
 *     cdef int32_t nsamples = r.n_sample
 * 
 *     if bcf_unpack(r, BCF_UN_ALL) < 0:             # <<<<<<<<<<<<<<
 *         raise ValueError('Error unpacking VariantRecord')
 * 
*/
  __pyx_t_1 = (bcf_unpack(__pyx_v_r, BCF_UN_ALL) < 0);
  if (unlikely(__pyx_t_1)) {

    /* "pysam/libcbcf.pyx":1021
 * 
 *     if bcf_unpack(r, BCF_UN_ALL) < 0:
 *         raise ValueError('Error unpacking VariantRecord')             # <<<<<<<<<<<<<<
 * 
 *     cdef int32_t nalleles = r.n_allele
*/
    __pyx_t_4 = NULL;
    __Pyx_INCREF(__pyx_builtin_ValueError);
    __pyx_t_3 = __pyx_builtin_ValueError; 
    __pyx_t_5 = 1;
    {
      PyObject *__pyx_callargs[2] = {__pyx_t_4, __pyx_mstate_global->__pyx_kp_u_Error_unpacking_VariantRecord};
      __pyx_t_2 = __Pyx_PyObject_FastCall(__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_2)) __PYX_ERR(0, 1021, __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, 1021, __pyx_L1_error)

    /* "pysam/libcbcf.pyx":1020
 *     cdef int32_t nsamples = r.n_sample
 * 
 *     if bcf_unpack(r, BCF_UN_ALL) < 0:             # <<<<<<<<<<<<<<
 *         raise ValueError('Error unpacking VariantRecord')
 * 
*/
  }

  /* "pysam/libcbcf.pyx":1023
 *         raise ValueError('Error unpacking VariantRecord')
 * 
 *     cdef int32_t nalleles = r.n_allele             # <<<<<<<<<<<<<<
 * 
 *     if sample.index < 0 or sample.index >= nsamples or not r.n_fmt:
*/
  __pyx_t_8 = __pyx_v_r->n_allele;
  __pyx_v_nalleles = __pyx_t_8;

  /* "pysam/libcbcf.pyx":1025
 *     cdef int32_t nalleles = r.n_allele
 * 
 *     if sample.index < 0 or sample.index >= nsamples or not r.n_fmt:             # <<<<<<<<<<<<<<
 *         return ()
 * 
*/
  __pyx_t_9 = (__pyx_v_sample->index < 0);
  if (!__pyx_t_9) {
  } else {
    __pyx_t_1 = __pyx_t_9;
    goto __pyx_L6_bool_binop_done;
  }
  __pyx_t_9 = (__pyx_v_sample->index >= __pyx_v_nsamples);
  if (!__pyx_t_9) {
  } else {
    __pyx_t_1 = __pyx_t_9;
    goto __pyx_L6_bool_binop_done;
  }
  __pyx_t_9 = (!(__pyx_v_r->n_fmt != 0));
  __pyx_t_1 = __pyx_t_9;
  __pyx_L6_bool_binop_done:;
  if (__pyx_t_1) {

    /* "pysam/libcbcf.pyx":1026
 * 
 *     if sample.index < 0 or sample.index >= nsamples or not r.n_fmt:
 *         return ()             # <<<<<<<<<<<<<<
 * 
 *     cdef bcf_fmt_t *fmt0 = r.d.fmt
*/
    __Pyx_XDECREF(__pyx_r);
    __Pyx_INCREF(__pyx_mstate_global->__pyx_empty_tuple);
    __pyx_r = __pyx_mstate_global->__pyx_empty_tuple;
    __Pyx_TraceReturnValue(__pyx_r, 49, 0, __PYX_ERR(0, 1026, __pyx_L1_error));
    goto __pyx_L0;

    /* "pysam/libcbcf.pyx":1025
 *     cdef int32_t nalleles = r.n_allele
 * 
 *     if sample.index < 0 or sample.index >= nsamples or not r.n_fmt:             # <<<<<<<<<<<<<<
 *         return ()
 * 
*/
  }

  /* "pysam/libcbcf.pyx":1028
 *         return ()
 * 
 *     cdef bcf_fmt_t *fmt0 = r.d.fmt             # <<<<<<<<<<<<<<
 *     cdef int gt0 = is_gt_fmt(hdr, fmt0.id)
 * 
*/
  __pyx_t_10 = __pyx_v_r->d.fmt;
  __pyx_v_fmt0 = __pyx_t_10;

  /* "pysam/libcbcf.pyx":1029
 * 
 *     cdef bcf_fmt_t *fmt0 = r.d.fmt
 *     cdef int gt0 = is_gt_fmt(hdr, fmt0.id)             # <<<<<<<<<<<<<<
 * 
 *     if not gt0 or not fmt0.n:
*/
  __pyx_t_11 = __pyx_f_5pysam_7libcbcf_is_gt_fmt(__pyx_v_hdr, __pyx_v_fmt0->id); if (unlikely(__pyx_t_11 == ((int)-1) && PyErr_Occurred())) __PYX_ERR(0, 1029, __pyx_L1_error)
  __pyx_v_gt0 = __pyx_t_11;

  /* "pysam/libcbcf.pyx":1031
 *     cdef int gt0 = is_gt_fmt(hdr, fmt0.id)
 * 
 *     if not gt0 or not fmt0.n:             # <<<<<<<<<<<<<<
 *         return ()
 * 
*/
  __pyx_t_9 = (!(__pyx_v_gt0 != 0));
  if (!__pyx_t_9) {
  } else {
    __pyx_t_1 = __pyx_t_9;
    goto __pyx_L10_bool_binop_done;
  }
  __pyx_t_9 = (!(__pyx_v_fmt0->n != 0));
  __pyx_t_1 = __pyx_t_9;
  __pyx_L10_bool_binop_done:;
  if (__pyx_t_1) {

    /* "pysam/libcbcf.pyx":1032
 * 
 *     if not gt0 or not fmt0.n:
 *         return ()             # <<<<<<<<<<<<<<
 * 
 *     cdef int32_t  a
*/
    __Pyx_XDECREF(__pyx_r);
    __Pyx_INCREF(__pyx_mstate_global->__pyx_empty_tuple);
    __pyx_r = __pyx_mstate_global->__pyx_empty_tuple;
    __Pyx_TraceReturnValue(__pyx_r, 68, 0, __PYX_ERR(0, 1032, __pyx_L1_error));
    goto __pyx_L0;

    /* "pysam/libcbcf.pyx":1031
 *     cdef int gt0 = is_gt_fmt(hdr, fmt0.id)
 * 
 *     if not gt0 or not fmt0.n:             # <<<<<<<<<<<<<<
 *         return ()
 * 
*/
  }

  /* "pysam/libcbcf.pyx":1038
 *     cdef int16_t *data16
 *     cdef int32_t *data32
 *     alleles = []             # <<<<<<<<<<<<<<
 *     if fmt0.type == BCF_BT_INT8:
 *         data8 = <int8_t *>(fmt0.p + sample.index * fmt0.size)
*/
  __pyx_t_2 = PyList_New(0); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1038, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_v_alleles = ((PyObject*)__pyx_t_2);
  __pyx_t_2 = 0;

  /* "pysam/libcbcf.pyx":1039
 *     cdef int32_t *data32
 *     alleles = []
 *     if fmt0.type == BCF_BT_INT8:             # <<<<<<<<<<<<<<
 *         data8 = <int8_t *>(fmt0.p + sample.index * fmt0.size)
 *         for i in range(fmt0.n):
*/
  __pyx_t_1 = (__pyx_v_fmt0->type == BCF_BT_INT8);
  if (__pyx_t_1) {

    /* "pysam/libcbcf.pyx":1040
 *     alleles = []
 *     if fmt0.type == BCF_BT_INT8:
 *         data8 = <int8_t *>(fmt0.p + sample.index * fmt0.size)             # <<<<<<<<<<<<<<
 *         for i in range(fmt0.n):
 *             if data8[i] == bcf_int8_vector_end:
*/
    __pyx_v_data8 = ((int8_t *)(__pyx_v_fmt0->p + (__pyx_v_sample->index * __pyx_v_fmt0->size)));

    /* "pysam/libcbcf.pyx":1041
 *     if fmt0.type == BCF_BT_INT8:
 *         data8 = <int8_t *>(fmt0.p + sample.index * fmt0.size)
 *         for i in range(fmt0.n):             # <<<<<<<<<<<<<<
 *             if data8[i] == bcf_int8_vector_end:
 *                 break
*/
    __pyx_t_11 = __pyx_v_fmt0->n;
    __pyx_t_12 = __pyx_t_11;
    for (__pyx_t_13 = 0; __pyx_t_13 < __pyx_t_12; __pyx_t_13+=1) {
      __pyx_v_i = __pyx_t_13;

      /* "pysam/libcbcf.pyx":1042
 *         data8 = <int8_t *>(fmt0.p + sample.index * fmt0.size)
 *         for i in range(fmt0.n):
 *             if data8[i] == bcf_int8_vector_end:             # <<<<<<<<<<<<<<
 *                 break
 *             a = bcf_gt_allele(data8[i])
*/
      __pyx_t_1 = ((__pyx_v_data8[__pyx_v_i]) == bcf_int8_vector_end);
      if (__pyx_t_1) {

        /* "pysam/libcbcf.pyx":1043
 *         for i in range(fmt0.n):
 *             if data8[i] == bcf_int8_vector_end:
 *                 break             # <<<<<<<<<<<<<<
 *             a = bcf_gt_allele(data8[i])
 *             alleles.append(charptr_to_str(r.d.allele[a]) if 0 <= a < nalleles else None)
*/
        goto __pyx_L14_break;

        /* "pysam/libcbcf.pyx":1042
 *         data8 = <int8_t *>(fmt0.p + sample.index * fmt0.size)
 *         for i in range(fmt0.n):
 *             if data8[i] == bcf_int8_vector_end:             # <<<<<<<<<<<<<<
 *                 break
 *             a = bcf_gt_allele(data8[i])
*/
      }

      /* "pysam/libcbcf.pyx":1044
 *             if data8[i] == bcf_int8_vector_end:
 *                 break
 *             a = bcf_gt_allele(data8[i])             # <<<<<<<<<<<<<<
 *             alleles.append(charptr_to_str(r.d.allele[a]) if 0 <= a < nalleles else None)
 *     elif fmt0.type == BCF_BT_INT16:
*/
      __pyx_v_a = bcf_gt_allele((__pyx_v_data8[__pyx_v_i]));

      /* "pysam/libcbcf.pyx":1045
 *                 break
 *             a = bcf_gt_allele(data8[i])
 *             alleles.append(charptr_to_str(r.d.allele[a]) if 0 <= a < nalleles else None)             # <<<<<<<<<<<<<<
 *     elif fmt0.type == BCF_BT_INT16:
 *         data16 = <int16_t *>(fmt0.p + sample.index * fmt0.size)
*/
      __pyx_t_1 = (0 <= __pyx_v_a);
      if (__pyx_t_1) {
        __pyx_t_1 = (__pyx_v_a < __pyx_v_nalleles);
      }
      if (__pyx_t_1) {
        __pyx_t_3 = __pyx_f_5pysam_9libcutils_charptr_to_str((__pyx_v_r->d.allele[__pyx_v_a]), NULL); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1045, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_3);
        __pyx_t_2 = __pyx_t_3;
        __pyx_t_3 = 0;
      } else {
        __Pyx_INCREF(Py_None);
        __pyx_t_2 = Py_None;
      }
      __pyx_t_14 = __Pyx_PyList_Append(__pyx_v_alleles, __pyx_t_2); if (unlikely(__pyx_t_14 == ((int)-1))) __PYX_ERR(0, 1045, __pyx_L1_error)
      __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    }
    __pyx_L14_break:;

    /* "pysam/libcbcf.pyx":1039
 *     cdef int32_t *data32
 *     alleles = []
 *     if fmt0.type == BCF_BT_INT8:             # <<<<<<<<<<<<<<
 *         data8 = <int8_t *>(fmt0.p + sample.index * fmt0.size)
 *         for i in range(fmt0.n):
*/
    goto __pyx_L12;
  }

  /* "pysam/libcbcf.pyx":1046
 *             a = bcf_gt_allele(data8[i])
 *             alleles.append(charptr_to_str(r.d.allele[a]) if 0 <= a < nalleles else None)
 *     elif fmt0.type == BCF_BT_INT16:             # <<<<<<<<<<<<<<
 *         data16 = <int16_t *>(fmt0.p + sample.index * fmt0.size)
 *         for i in range(fmt0.n):
*/
  __pyx_t_1 = (__pyx_v_fmt0->type == BCF_BT_INT16);
  if (__pyx_t_1) {

    /* "pysam/libcbcf.pyx":1047
 *             alleles.append(charptr_to_str(r.d.allele[a]) if 0 <= a < nalleles else None)
 *     elif fmt0.type == BCF_BT_INT16:
 *         data16 = <int16_t *>(fmt0.p + sample.index * fmt0.size)             # <<<<<<<<<<<<<<
 *         for i in range(fmt0.n):
 *             if data16[i] == bcf_int16_vector_end:
*/
    __pyx_v_data16 = ((int16_t *)(__pyx_v_fmt0->p + (__pyx_v_sample->index * __pyx_v_fmt0->size)));

    /* "pysam/libcbcf.pyx":1048
 *     elif fmt0.type == BCF_BT_INT16:
 *         data16 = <int16_t *>(fmt0.p + sample.index * fmt0.size)
 *         for i in range(fmt0.n):             # <<<<<<<<<<<<<<
 *             if data16[i] == bcf_int16_vector_end:
 *                 break
*/
    __pyx_t_11 = __pyx_v_fmt0->n;
    __pyx_t_12 = __pyx_t_11;
    for (__pyx_t_13 = 0; __pyx_t_13 < __pyx_t_12; __pyx_t_13+=1) {
      __pyx_v_i = __pyx_t_13;

      /* "pysam/libcbcf.pyx":1049
 *         data16 = <int16_t *>(fmt0.p + sample.index * fmt0.size)
 *         for i in range(fmt0.n):
 *             if data16[i] == bcf_int16_vector_end:             # <<<<<<<<<<<<<<
 *                 break
 *             a = bcf_gt_allele(data16[i])
*/
      __pyx_t_1 = ((__pyx_v_data16[__pyx_v_i]) == bcf_int16_vector_end);
      if (__pyx_t_1) {

        /* "pysam/libcbcf.pyx":1050
 *         for i in range(fmt0.n):
 *             if data16[i] == bcf_int16_vector_end:
 *                 break             # <<<<<<<<<<<<<<
 *             a = bcf_gt_allele(data16[i])
 *             alleles.append(charptr_to_str(r.d.allele[a]) if 0 <= a < nalleles else None)
*/
        goto __pyx_L17_break;

        /* "pysam/libcbcf.pyx":1049
 *         data16 = <int16_t *>(fmt0.p + sample.index * fmt0.size)
 *         for i in range(fmt0.n):
 *             if data16[i] == bcf_int16_vector_end:             # <<<<<<<<<<<<<<
 *                 break
 *             a = bcf_gt_allele(data16[i])
*/
      }

      /* "pysam/libcbcf.pyx":1051
 *             if data16[i] == bcf_int16_vector_end:
 *                 break
 *             a = bcf_gt_allele(data16[i])             # <<<<<<<<<<<<<<
 *             alleles.append(charptr_to_str(r.d.allele[a]) if 0 <= a < nalleles else None)
 *     elif fmt0.type == BCF_BT_INT32:
*/
      __pyx_v_a = bcf_gt_allele((__pyx_v_data16[__pyx_v_i]));

      /* "pysam/libcbcf.pyx":1052
 *                 break
 *             a = bcf_gt_allele(data16[i])
 *             alleles.append(charptr_to_str(r.d.allele[a]) if 0 <= a < nalleles else None)             # <<<<<<<<<<<<<<
 *     elif fmt0.type == BCF_BT_INT32:
 *         data32 = <int32_t *>(fmt0.p + sample.index * fmt0.size)
*/
      __pyx_t_1 = (0 <= __pyx_v_a);
      if (__pyx_t_1) {
        __pyx_t_1 = (__pyx_v_a < __pyx_v_nalleles);
      }
      if (__pyx_t_1) {
        __pyx_t_3 = __pyx_f_5pysam_9libcutils_charptr_to_str((__pyx_v_r->d.allele[__pyx_v_a]), NULL); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1052, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_3);
        __pyx_t_2 = __pyx_t_3;
        __pyx_t_3 = 0;
      } else {
        __Pyx_INCREF(Py_None);
        __pyx_t_2 = Py_None;
      }
      __pyx_t_14 = __Pyx_PyList_Append(__pyx_v_alleles, __pyx_t_2); if (unlikely(__pyx_t_14 == ((int)-1))) __PYX_ERR(0, 1052, __pyx_L1_error)
      __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    }
    __pyx_L17_break:;

    /* "pysam/libcbcf.pyx":1046
 *             a = bcf_gt_allele(data8[i])
 *             alleles.append(charptr_to_str(r.d.allele[a]) if 0 <= a < nalleles else None)
 *     elif fmt0.type == BCF_BT_INT16:             # <<<<<<<<<<<<<<
 *         data16 = <int16_t *>(fmt0.p + sample.index * fmt0.size)
 *         for i in range(fmt0.n):
*/
    goto __pyx_L12;
  }

  /* "pysam/libcbcf.pyx":1053
 *             a = bcf_gt_allele(data16[i])
 *             alleles.append(charptr_to_str(r.d.allele[a]) if 0 <= a < nalleles else None)
 *     elif fmt0.type == BCF_BT_INT32:             # <<<<<<<<<<<<<<
 *         data32 = <int32_t *>(fmt0.p + sample.index * fmt0.size)
 *         for i in range(fmt0.n):
*/
  __pyx_t_1 = (__pyx_v_fmt0->type == BCF_BT_INT32);
  if (__pyx_t_1) {

    /* "pysam/libcbcf.pyx":1054
 *             alleles.append(charptr_to_str(r.d.allele[a]) if 0 <= a < nalleles else None)
 *     elif fmt0.type == BCF_BT_INT32:
 *         data32 = <int32_t *>(fmt0.p + sample.index * fmt0.size)             # <<<<<<<<<<<<<<
 *         for i in range(fmt0.n):
 *             if data32[i] == bcf_int32_vector_end:
*/
    __pyx_v_data32 = ((int32_t *)(__pyx_v_fmt0->p + (__pyx_v_sample->index * __pyx_v_fmt0->size)));

    /* "pysam/libcbcf.pyx":1055
 *     elif fmt0.type == BCF_BT_INT32:
 *         data32 = <int32_t *>(fmt0.p + sample.index * fmt0.size)
 *         for i in range(fmt0.n):             # <<<<<<<<<<<<<<
 *             if data32[i] == bcf_int32_vector_end:
 *                 break
*/
    __pyx_t_11 = __pyx_v_fmt0->n;
    __pyx_t_12 = __pyx_t_11;
    for (__pyx_t_13 = 0; __pyx_t_13 < __pyx_t_12; __pyx_t_13+=1) {
      __pyx_v_i = __pyx_t_13;

      /* "pysam/libcbcf.pyx":1056
 *         data32 = <int32_t *>(fmt0.p + sample.index * fmt0.size)
 *         for i in range(fmt0.n):
 *             if data32[i] == bcf_int32_vector_end:             # <<<<<<<<<<<<<<
 *                 break
 *             a = bcf_gt_allele(data32[i])
*/
      __pyx_t_1 = ((__pyx_v_data32[__pyx_v_i]) == bcf_int32_vector_end);
      if (__pyx_t_1) {

        /* "pysam/libcbcf.pyx":1057
 *         for i in range(fmt0.n):
 *             if data32[i] == bcf_int32_vector_end:
 *                 break             # <<<<<<<<<<<<<<
 *             a = bcf_gt_allele(data32[i])
 *             alleles.append(charptr_to_str(r.d.allele[a]) if 0 <= a < nalleles else None)
*/
        goto __pyx_L20_break;

        /* "pysam/libcbcf.pyx":1056
 *         data32 = <int32_t *>(fmt0.p + sample.index * fmt0.size)
 *         for i in range(fmt0.n):
 *             if data32[i] == bcf_int32_vector_end:             # <<<<<<<<<<<<<<
 *                 break
 *             a = bcf_gt_allele(data32[i])
*/
      }

      /* "pysam/libcbcf.pyx":1058
 *             if data32[i] == bcf_int32_vector_end:
 *                 break
 *             a = bcf_gt_allele(data32[i])             # <<<<<<<<<<<<<<
 *             alleles.append(charptr_to_str(r.d.allele[a]) if 0 <= a < nalleles else None)
 *     return tuple(alleles)
*/
      __pyx_v_a = bcf_gt_allele((__pyx_v_data32[__pyx_v_i]));

      /* "pysam/libcbcf.pyx":1059
 *                 break
 *             a = bcf_gt_allele(data32[i])
 *             alleles.append(charptr_to_str(r.d.allele[a]) if 0 <= a < nalleles else None)             # <<<<<<<<<<<<<<
 *     return tuple(alleles)
 * 
*/
      __pyx_t_1 = (0 <= __pyx_v_a);
      if (__pyx_t_1) {
        __pyx_t_1 = (__pyx_v_a < __pyx_v_nalleles);
      }
      if (__pyx_t_1) {
        __pyx_t_3 = __pyx_f_5pysam_9libcutils_charptr_to_str((__pyx_v_r->d.allele[__pyx_v_a]), NULL); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1059, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_3);
        __pyx_t_2 = __pyx_t_3;
        __pyx_t_3 = 0;
      } else {
        __Pyx_INCREF(Py_None);
        __pyx_t_2 = Py_None;
      }
      __pyx_t_14 = __Pyx_PyList_Append(__pyx_v_alleles, __pyx_t_2); if (unlikely(__pyx_t_14 == ((int)-1))) __PYX_ERR(0, 1059, __pyx_L1_error)
      __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    }
    __pyx_L20_break:;

    /* "pysam/libcbcf.pyx":1053
 *             a = bcf_gt_allele(data16[i])
 *             alleles.append(charptr_to_str(r.d.allele[a]) if 0 <= a < nalleles else None)
 *     elif fmt0.type == BCF_BT_INT32:             # <<<<<<<<<<<<<<
 *         data32 = <int32_t *>(fmt0.p + sample.index * fmt0.size)
 *         for i in range(fmt0.n):
*/
  }
  __pyx_L12:;

  /* "pysam/libcbcf.pyx":1060
 *             a = bcf_gt_allele(data32[i])
 *             alleles.append(charptr_to_str(r.d.allele[a]) if 0 <= a < nalleles else None)
 *     return tuple(alleles)             # <<<<<<<<<<<<<<
 * 
 * 
*/
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_2 = PyList_AsTuple(__pyx_v_alleles); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1060, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_r = __pyx_t_2;
  __pyx_t_2 = 0;
  __Pyx_TraceReturnValue(__pyx_r, 217, 0, __PYX_ERR(0, 1060, __pyx_L1_error));
  goto __pyx_L0;

  /* "pysam/libcbcf.pyx":1012
 * 
 * 
 * cdef bcf_format_get_alleles(VariantRecordSample sample):             # <<<<<<<<<<<<<<
 *     if sample is None:
 *         raise ValueError('sample must not be None')
*/

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_TraceException(__pyx_lineno, 0, 0);
  #if CYTHON_USE_SYS_MONITORING
  __Pyx_TraceExceptionUnwind(0, 0);
  #else
  __Pyx_TraceReturnValue(NULL, 0, 0, __PYX_ERR(0, 1012, __pyx_L1_error));
  #endif
  __Pyx_AddTraceback("pysam.libcbcf.bcf_format_get_alleles", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_alleles);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_PyMonitoring_ExitScope(0);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "pysam/libcbcf.pyx":1063
 * 
 * 
 * cdef bint bcf_sample_get_phased(VariantRecordSample sample):             # <<<<<<<<<<<<<<
 *     if sample is None:
 *         raise ValueError('sample must not be None')
*/

static int __pyx_f_5pysam_7libcbcf_bcf_sample_get_phased(struct __pyx_obj_5pysam_7libcbcf_VariantRecordSample *__pyx_v_sample) {
  bcf_hdr_t *__pyx_v_hdr;
  bcf1_t *__pyx_v_r;
  int32_t __pyx_v_n;
  bcf_fmt_t *__pyx_v_fmt0;
  int __pyx_v_gt0;
  int8_t *__pyx_v_data8;
  int16_t *__pyx_v_data16;
  int32_t *__pyx_v_data32;
  int __pyx_v_phased;
  int __pyx_v_i;
  int __pyx_r;
  __Pyx_TraceDeclarationsFunc
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  PyObject *__pyx_t_4 = NULL;
  size_t __pyx_t_5;
  bcf_hdr_t *__pyx_t_6;
  bcf1_t *__pyx_t_7;
  uint32_t __pyx_t_8;
  int __pyx_t_9;
  bcf_fmt_t *__pyx_t_10;
  int __pyx_t_11;
  int __pyx_t_12;
  int __pyx_t_13;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_TraceFrameInit(((PyObject *)__pyx_mstate_global->__pyx_codeobj_tab[26]))
  __Pyx_RefNannySetupContext("bcf_sample_get_phased", 0);
  __Pyx_TraceStartFunc("bcf_sample_get_phased", __pyx_f[0], 1063, 0, 0, 0, __PYX_ERR(0, 1063, __pyx_L1_error));

  /* "pysam/libcbcf.pyx":1064
 * 
 * cdef bint bcf_sample_get_phased(VariantRecordSample sample):
 *     if sample is None:             # <<<<<<<<<<<<<<
 *         raise ValueError('sample must not be None')
 * 
*/
  __pyx_t_1 = (((PyObject *)__pyx_v_sample) == Py_None);
  if (unlikely(__pyx_t_1)) {

    /* "pysam/libcbcf.pyx":1065
 * cdef bint bcf_sample_get_phased(VariantRecordSample sample):
 *     if sample is None:
 *         raise ValueError('sample must not be None')             # <<<<<<<<<<<<<<
 * 
 *     cdef bcf_hdr_t *hdr = sample.record.header.ptr
*/
    __pyx_t_3 = NULL;
    __Pyx_INCREF(__pyx_builtin_ValueError);
    __pyx_t_4 = __pyx_builtin_ValueError; 
    __pyx_t_5 = 1;
    {
      PyObject *__pyx_callargs[2] = {__pyx_t_3, __pyx_mstate_global->__pyx_kp_u_sample_must_not_be_None};
      __pyx_t_2 = __Pyx_PyObject_FastCall(__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_2)) __PYX_ERR(0, 1065, __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, 1065, __pyx_L1_error)

    /* "pysam/libcbcf.pyx":1064
 * 
 * cdef bint bcf_sample_get_phased(VariantRecordSample sample):
 *     if sample is None:             # <<<<<<<<<<<<<<
 *         raise ValueError('sample must not be None')
 * 
*/
  }

  /* "pysam/libcbcf.pyx":1067
 *         raise ValueError('sample must not be None')
 * 
 *     cdef bcf_hdr_t *hdr = sample.record.header.ptr             # <<<<<<<<<<<<<<
 *     cdef bcf1_t *r = sample.record.ptr
 *     cdef int32_t n = r.n_sample
*/
  __pyx_t_6 = __pyx_v_sample->record->header->ptr;
  __pyx_v_hdr = __pyx_t_6;

  /* "pysam/libcbcf.pyx":1068
 * 
 *     cdef bcf_hdr_t *hdr = sample.record.header.ptr
 *     cdef bcf1_t *r = sample.record.ptr             # <<<<<<<<<<<<<<
 *     cdef int32_t n = r.n_sample
 * 
*/
  __pyx_t_7 = __pyx_v_sample->record->ptr;
  __pyx_v_r = __pyx_t_7;

  /* "pysam/libcbcf.pyx":1069
 *     cdef bcf_hdr_t *hdr = sample.record.header.ptr
 *     cdef bcf1_t *r = sample.record.ptr
 *     cdef int32_t n = r.n_sample             # <<<<<<<<<<<<<<
 * 
 *     if bcf_unpack(r, BCF_UN_ALL) < 0:
*/
  __pyx_t_8 = __pyx_v_r->n_sample;
  __pyx_v_n = __pyx_t_8;

  /* "pysam/libcbcf.pyx":1071
 *     cdef int32_t n = r.n_sample
 * 
 *     if bcf_unpack(r, BCF_UN_ALL) < 0:             # <<<<<<<<<<<<<<
 *         raise ValueError('Error unpacking VariantRecord')
 * 
*/
  __pyx_t_1 = (bcf_unpack(__pyx_v_r, BCF_UN_ALL) < 0);
  if (unlikely(__pyx_t_1)) {

    /* "pysam/libcbcf.pyx":1072
 * 
 *     if bcf_unpack(r, BCF_UN_ALL) < 0:
 *         raise ValueError('Error unpacking VariantRecord')             # <<<<<<<<<<<<<<
 * 
 *     if sample.index < 0 or sample.index >= n or not r.n_fmt:
*/
    __pyx_t_4 = NULL;
    __Pyx_INCREF(__pyx_builtin_ValueError);
    __pyx_t_3 = __pyx_builtin_ValueError; 
    __pyx_t_5 = 1;
    {
      PyObject *__pyx_callargs[2] = {__pyx_t_4, __pyx_mstate_global->__pyx_kp_u_Error_unpacking_VariantRecord};
      __pyx_t_2 = __Pyx_PyObject_FastCall(__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_2)) __PYX_ERR(0, 1072, __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, 1072, __pyx_L1_error)

    /* "pysam/libcbcf.pyx":1071
 *     cdef int32_t n = r.n_sample
 * 
 *     if bcf_unpack(r, BCF_UN_ALL) < 0:             # <<<<<<<<<<<<<<
 *         raise ValueError('Error unpacking VariantRecord')
 * 
*/
  }

  /* "pysam/libcbcf.pyx":1074
 *         raise ValueError('Error unpacking VariantRecord')
 * 
 *     if sample.index < 0 or sample.index >= n or not r.n_fmt:             # <<<<<<<<<<<<<<
 *         return False
 * 
*/
  __pyx_t_9 = (__pyx_v_sample->index < 0);
  if (!__pyx_t_9) {
  } else {
    __pyx_t_1 = __pyx_t_9;
    goto __pyx_L6_bool_binop_done;
  }
  __pyx_t_9 = (__pyx_v_sample->index >= __pyx_v_n);
  if (!__pyx_t_9) {
  } else {
    __pyx_t_1 = __pyx_t_9;
    goto __pyx_L6_bool_binop_done;
  }
  __pyx_t_9 = (!(__pyx_v_r->n_fmt != 0));
  __pyx_t_1 = __pyx_t_9;
  __pyx_L6_bool_binop_done:;
  if (__pyx_t_1) {

    /* "pysam/libcbcf.pyx":1075
 * 
 *     if sample.index < 0 or sample.index >= n or not r.n_fmt:
 *         return False             # <<<<<<<<<<<<<<
 * 
 *     cdef bcf_fmt_t *fmt0 = r.d.fmt
*/
    __pyx_r = 0;
    __Pyx_TraceReturnCValue(__pyx_r, __Pyx_PyBool_FromLong, 47, 0, __PYX_ERR(0, 1075, __pyx_L1_error));
    goto __pyx_L0;

    /* "pysam/libcbcf.pyx":1074
 *         raise ValueError('Error unpacking VariantRecord')
 * 
 *     if sample.index < 0 or sample.index >= n or not r.n_fmt:             # <<<<<<<<<<<<<<
 *         return False
 * 
*/
  }

  /* "pysam/libcbcf.pyx":1077
 *         return False
 * 
 *     cdef bcf_fmt_t *fmt0 = r.d.fmt             # <<<<<<<<<<<<<<
 *     cdef int gt0 = is_gt_fmt(hdr, fmt0.id)
 * 
*/
  __pyx_t_10 = __pyx_v_r->d.fmt;
  __pyx_v_fmt0 = __pyx_t_10;

  /* "pysam/libcbcf.pyx":1078
 * 
 *     cdef bcf_fmt_t *fmt0 = r.d.fmt
 *     cdef int gt0 = is_gt_fmt(hdr, fmt0.id)             # <<<<<<<<<<<<<<
 * 
 *     if not gt0 or not fmt0.n:
*/
  __pyx_t_11 = __pyx_f_5pysam_7libcbcf_is_gt_fmt(__pyx_v_hdr, __pyx_v_fmt0->id); if (unlikely(__pyx_t_11 == ((int)-1) && PyErr_Occurred())) __PYX_ERR(0, 1078, __pyx_L1_error)
  __pyx_v_gt0 = __pyx_t_11;

  /* "pysam/libcbcf.pyx":1080
 *     cdef int gt0 = is_gt_fmt(hdr, fmt0.id)
 * 
 *     if not gt0 or not fmt0.n:             # <<<<<<<<<<<<<<
 *         return False
 * 
*/
  __pyx_t_9 = (!(__pyx_v_gt0 != 0));
  if (!__pyx_t_9) {
  } else {
    __pyx_t_1 = __pyx_t_9;
    goto __pyx_L10_bool_binop_done;
  }
  __pyx_t_9 = (!(__pyx_v_fmt0->n != 0));
  __pyx_t_1 = __pyx_t_9;
  __pyx_L10_bool_binop_done:;
  if (__pyx_t_1) {

    /* "pysam/libcbcf.pyx":1081
 * 
 *     if not gt0 or not fmt0.n:
 *         return False             # <<<<<<<<<<<<<<
 * 
 *     cdef int8_t  *data8
*/
    __pyx_r = 0;
    __Pyx_TraceReturnCValue(__pyx_r, __Pyx_PyBool_FromLong, 66, 0, __PYX_ERR(0, 1081, __pyx_L1_error));
    goto __pyx_L0;

    /* "pysam/libcbcf.pyx":1080
 *     cdef int gt0 = is_gt_fmt(hdr, fmt0.id)
 * 
 *     if not gt0 or not fmt0.n:             # <<<<<<<<<<<<<<
 *         return False
 * 
*/
  }

  /* "pysam/libcbcf.pyx":1087
 *     cdef int32_t *data32
 * 
 *     cdef bint phased = False             # <<<<<<<<<<<<<<
 * 
 *     if fmt0.type == BCF_BT_INT8:
*/
  __pyx_v_phased = 0;

  /* "pysam/libcbcf.pyx":1089
 *     cdef bint phased = False
 * 
 *     if fmt0.type == BCF_BT_INT8:             # <<<<<<<<<<<<<<
 *         data8 = <int8_t *>(fmt0.p + sample.index * fmt0.size)
 *         for i in range(fmt0.n):
*/
  __pyx_t_1 = (__pyx_v_fmt0->type == BCF_BT_INT8);
  if (__pyx_t_1) {

    /* "pysam/libcbcf.pyx":1090
 * 
 *     if fmt0.type == BCF_BT_INT8:
 *         data8 = <int8_t *>(fmt0.p + sample.index * fmt0.size)             # <<<<<<<<<<<<<<
 *         for i in range(fmt0.n):
 *             if data8[i] == bcf_int8_vector_end:
*/
    __pyx_v_data8 = ((int8_t *)(__pyx_v_fmt0->p + (__pyx_v_sample->index * __pyx_v_fmt0->size)));

    /* "pysam/libcbcf.pyx":1091
 *     if fmt0.type == BCF_BT_INT8:
 *         data8 = <int8_t *>(fmt0.p + sample.index * fmt0.size)
 *         for i in range(fmt0.n):             # <<<<<<<<<<<<<<
 *             if data8[i] == bcf_int8_vector_end:
 *                 break
*/
    __pyx_t_11 = __pyx_v_fmt0->n;
    __pyx_t_12 = __pyx_t_11;
    for (__pyx_t_13 = 0; __pyx_t_13 < __pyx_t_12; __pyx_t_13+=1) {
      __pyx_v_i = __pyx_t_13;

      /* "pysam/libcbcf.pyx":1092
 *         data8 = <int8_t *>(fmt0.p + sample.index * fmt0.size)
 *         for i in range(fmt0.n):
 *             if data8[i] == bcf_int8_vector_end:             # <<<<<<<<<<<<<<
 *                 break
 *             elif data8[i] == bcf_int8_missing:
*/
      __pyx_t_1 = ((__pyx_v_data8[__pyx_v_i]) == bcf_int8_vector_end);
      if (__pyx_t_1) {

        /* "pysam/libcbcf.pyx":1093
 *         for i in range(fmt0.n):
 *             if data8[i] == bcf_int8_vector_end:
 *                 break             # <<<<<<<<<<<<<<
 *             elif data8[i] == bcf_int8_missing:
 *                 continue
*/
        goto __pyx_L14_break;

        /* "pysam/libcbcf.pyx":1092
 *         data8 = <int8_t *>(fmt0.p + sample.index * fmt0.size)
 *         for i in range(fmt0.n):
 *             if data8[i] == bcf_int8_vector_end:             # <<<<<<<<<<<<<<
 *                 break
 *             elif data8[i] == bcf_int8_missing:
*/
      }

      /* "pysam/libcbcf.pyx":1094
 *             if data8[i] == bcf_int8_vector_end:
 *                 break
 *             elif data8[i] == bcf_int8_missing:             # <<<<<<<<<<<<<<
 *                 continue
 *             elif i and not bcf_gt_is_phased(data8[i]):
*/
      __pyx_t_1 = ((__pyx_v_data8[__pyx_v_i]) == bcf_int8_missing);
      if (__pyx_t_1) {

        /* "pysam/libcbcf.pyx":1095
 *                 break
 *             elif data8[i] == bcf_int8_missing:
 *                 continue             # <<<<<<<<<<<<<<
 *             elif i and not bcf_gt_is_phased(data8[i]):
 *                 return False
*/
        goto __pyx_L13_continue;

        /* "pysam/libcbcf.pyx":1094
 *             if data8[i] == bcf_int8_vector_end:
 *                 break
 *             elif data8[i] == bcf_int8_missing:             # <<<<<<<<<<<<<<
 *                 continue
 *             elif i and not bcf_gt_is_phased(data8[i]):
*/
      }

      /* "pysam/libcbcf.pyx":1096
 *             elif data8[i] == bcf_int8_missing:
 *                 continue
 *             elif i and not bcf_gt_is_phased(data8[i]):             # <<<<<<<<<<<<<<
 *                 return False
 *             else:
*/
      __pyx_t_9 = (__pyx_v_i != 0);
      if (__pyx_t_9) {
      } else {
        __pyx_t_1 = __pyx_t_9;
        goto __pyx_L16_bool_binop_done;
      }
      __pyx_t_9 = (!(bcf_gt_is_phased((__pyx_v_data8[__pyx_v_i])) != 0));
      __pyx_t_1 = __pyx_t_9;
      __pyx_L16_bool_binop_done:;
      if (__pyx_t_1) {

        /* "pysam/libcbcf.pyx":1097
 *                 continue
 *             elif i and not bcf_gt_is_phased(data8[i]):
 *                 return False             # <<<<<<<<<<<<<<
 *             else:
 *                 phased = True
*/
        __pyx_r = 0;
        __Pyx_TraceReturnCValue(__pyx_r, __Pyx_PyBool_FromLong, 112, 0, __PYX_ERR(0, 1097, __pyx_L1_error));
        goto __pyx_L0;

        /* "pysam/libcbcf.pyx":1096
 *             elif data8[i] == bcf_int8_missing:
 *                 continue
 *             elif i and not bcf_gt_is_phased(data8[i]):             # <<<<<<<<<<<<<<
 *                 return False
 *             else:
*/
      }

      /* "pysam/libcbcf.pyx":1099
 *                 return False
 *             else:
 *                 phased = True             # <<<<<<<<<<<<<<
 *     elif fmt0.type == BCF_BT_INT16:
 *         data16 = <int16_t *>(fmt0.p + sample.index * fmt0.size)
*/
      /*else*/ {
        __pyx_v_phased = 1;
      }
      __pyx_L13_continue:;
    }
    __pyx_L14_break:;

    /* "pysam/libcbcf.pyx":1089
 *     cdef bint phased = False
 * 
 *     if fmt0.type == BCF_BT_INT8:             # <<<<<<<<<<<<<<
 *         data8 = <int8_t *>(fmt0.p + sample.index * fmt0.size)
 *         for i in range(fmt0.n):
*/
    goto __pyx_L12;
  }

  /* "pysam/libcbcf.pyx":1100
 *             else:
 *                 phased = True
 *     elif fmt0.type == BCF_BT_INT16:             # <<<<<<<<<<<<<<
 *         data16 = <int16_t *>(fmt0.p + sample.index * fmt0.size)
 *         for i in range(fmt0.n):
*/
  __pyx_t_1 = (__pyx_v_fmt0->type == BCF_BT_INT16);
  if (__pyx_t_1) {

    /* "pysam/libcbcf.pyx":1101
 *                 phased = True
 *     elif fmt0.type == BCF_BT_INT16:
 *         data16 = <int16_t *>(fmt0.p + sample.index * fmt0.size)             # <<<<<<<<<<<<<<
 *         for i in range(fmt0.n):
 *             if data16[i] == bcf_int16_vector_end:
*/
    __pyx_v_data16 = ((int16_t *)(__pyx_v_fmt0->p + (__pyx_v_sample->index * __pyx_v_fmt0->size)));

    /* "pysam/libcbcf.pyx":1102
 *     elif fmt0.type == BCF_BT_INT16:
 *         data16 = <int16_t *>(fmt0.p + sample.index * fmt0.size)
 *         for i in range(fmt0.n):             # <<<<<<<<<<<<<<
 *             if data16[i] == bcf_int16_vector_end:
 *                 break
*/
    __pyx_t_11 = __pyx_v_fmt0->n;
    __pyx_t_12 = __pyx_t_11;
    for (__pyx_t_13 = 0; __pyx_t_13 < __pyx_t_12; __pyx_t_13+=1) {
      __pyx_v_i = __pyx_t_13;

      /* "pysam/libcbcf.pyx":1103
 *         data16 = <int16_t *>(fmt0.p + sample.index * fmt0.size)
 *         for i in range(fmt0.n):
 *             if data16[i] == bcf_int16_vector_end:             # <<<<<<<<<<<<<<
 *                 break
 *             elif data16[i] == bcf_int16_missing:
*/
      __pyx_t_1 = ((__pyx_v_data16[__pyx_v_i]) == bcf_int16_vector_end);
      if (__pyx_t_1) {

        /* "pysam/libcbcf.pyx":1104
 *         for i in range(fmt0.n):
 *             if data16[i] == bcf_int16_vector_end:
 *                 break             # <<<<<<<<<<<<<<
 *             elif data16[i] == bcf_int16_missing:
 *                 continue
*/
        goto __pyx_L19_break;

        /* "pysam/libcbcf.pyx":1103
 *         data16 = <int16_t *>(fmt0.p + sample.index * fmt0.size)
 *         for i in range(fmt0.n):
 *             if data16[i] == bcf_int16_vector_end:             # <<<<<<<<<<<<<<
 *                 break
 *             elif data16[i] == bcf_int16_missing:
*/
      }

      /* "pysam/libcbcf.pyx":1105
 *             if data16[i] == bcf_int16_vector_end:
 *                 break
 *             elif data16[i] == bcf_int16_missing:             # <<<<<<<<<<<<<<
 *                 continue
 *             elif i and not bcf_gt_is_phased(data16[i]):
*/
      __pyx_t_1 = ((__pyx_v_data16[__pyx_v_i]) == bcf_int16_missing);
      if (__pyx_t_1) {

        /* "pysam/libcbcf.pyx":1106
 *                 break
 *             elif data16[i] == bcf_int16_missing:
 *                 continue             # <<<<<<<<<<<<<<
 *             elif i and not bcf_gt_is_phased(data16[i]):
 *                 return False
*/
        goto __pyx_L18_continue;

        /* "pysam/libcbcf.pyx":1105
 *             if data16[i] == bcf_int16_vector_end:
 *                 break
 *             elif data16[i] == bcf_int16_missing:             # <<<<<<<<<<<<<<
 *                 continue
 *             elif i and not bcf_gt_is_phased(data16[i]):
*/
      }

      /* "pysam/libcbcf.pyx":1107
 *             elif data16[i] == bcf_int16_missing:
 *                 continue
 *             elif i and not bcf_gt_is_phased(data16[i]):             # <<<<<<<<<<<<<<
 *                 return False
 *             else:
*/
      __pyx_t_9 = (__pyx_v_i != 0);
      if (__pyx_t_9) {
      } else {
        __pyx_t_1 = __pyx_t_9;
        goto __pyx_L21_bool_binop_done;
      }
      __pyx_t_9 = (!(bcf_gt_is_phased((__pyx_v_data16[__pyx_v_i])) != 0));
      __pyx_t_1 = __pyx_t_9;
      __pyx_L21_bool_binop_done:;
      if (__pyx_t_1) {

        /* "pysam/libcbcf.pyx":1108
 *                 continue
 *             elif i and not bcf_gt_is_phased(data16[i]):
 *                 return False             # <<<<<<<<<<<<<<
 *             else:
 *                 phased = True
*/
        __pyx_r = 0;
        __Pyx_TraceReturnCValue(__pyx_r, __Pyx_PyBool_FromLong, 157, 0, __PYX_ERR(0, 1108, __pyx_L1_error));
        goto __pyx_L0;

        /* "pysam/libcbcf.pyx":1107
 *             elif data16[i] == bcf_int16_missing:
 *                 continue
 *             elif i and not bcf_gt_is_phased(data16[i]):             # <<<<<<<<<<<<<<
 *                 return False
 *             else:
*/
      }

      /* "pysam/libcbcf.pyx":1110
 *                 return False
 *             else:
 *                 phased = True             # <<<<<<<<<<<<<<
 *     elif fmt0.type == BCF_BT_INT32:
 *         data32 = <int32_t *>(fmt0.p + sample.index * fmt0.size)
*/
      /*else*/ {
        __pyx_v_phased = 1;
      }
      __pyx_L18_continue:;
    }
    __pyx_L19_break:;

    /* "pysam/libcbcf.pyx":1100
 *             else:
 *                 phased = True
 *     elif fmt0.type == BCF_BT_INT16:             # <<<<<<<<<<<<<<
 *         data16 = <int16_t *>(fmt0.p + sample.index * fmt0.size)
 *         for i in range(fmt0.n):
*/
    goto __pyx_L12;
  }

  /* "pysam/libcbcf.pyx":1111
 *             else:
 *                 phased = True
 *     elif fmt0.type == BCF_BT_INT32:             # <<<<<<<<<<<<<<
 *         data32 = <int32_t *>(fmt0.p + sample.index * fmt0.size)
 *         for i in range(fmt0.n):
*/
  __pyx_t_1 = (__pyx_v_fmt0->type == BCF_BT_INT32);
  if (__pyx_t_1) {

    /* "pysam/libcbcf.pyx":1112
 *                 phased = True
 *     elif fmt0.type == BCF_BT_INT32:
 *         data32 = <int32_t *>(fmt0.p + sample.index * fmt0.size)             # <<<<<<<<<<<<<<
 *         for i in range(fmt0.n):
 *             if data32[i] == bcf_int32_vector_end:
*/
    __pyx_v_data32 = ((int32_t *)(__pyx_v_fmt0->p + (__pyx_v_sample->index * __pyx_v_fmt0->size)));

    /* "pysam/libcbcf.pyx":1113
 *     elif fmt0.type == BCF_BT_INT32:
 *         data32 = <int32_t *>(fmt0.p + sample.index * fmt0.size)
 *         for i in range(fmt0.n):             # <<<<<<<<<<<<<<
 *             if data32[i] == bcf_int32_vector_end:
 *                 break
*/
    __pyx_t_11 = __pyx_v_fmt0->n;
    __pyx_t_12 = __pyx_t_11;
    for (__pyx_t_13 = 0; __pyx_t_13 < __pyx_t_12; __pyx_t_13+=1) {
      __pyx_v_i = __pyx_t_13;

      /* "pysam/libcbcf.pyx":1114
 *         data32 = <int32_t *>(fmt0.p + sample.index * fmt0.size)
 *         for i in range(fmt0.n):
 *             if data32[i] == bcf_int32_vector_end:             # <<<<<<<<<<<<<<
 *                 break
 *             elif data32[i] == bcf_int32_missing:
*/
      __pyx_t_1 = ((__pyx_v_data32[__pyx_v_i]) == bcf_int32_vector_end);
      if (__pyx_t_1) {

        /* "pysam/libcbcf.pyx":1115
 *         for i in range(fmt0.n):
 *             if data32[i] == bcf_int32_vector_end:
 *                 break             # <<<<<<<<<<<<<<
 *             elif data32[i] == bcf_int32_missing:
 *                 continue
*/
        goto __pyx_L24_break;

        /* "pysam/libcbcf.pyx":1114
 *         data32 = <int32_t *>(fmt0.p + sample.index * fmt0.size)
 *         for i in range(fmt0.n):
 *             if data32[i] == bcf_int32_vector_end:             # <<<<<<<<<<<<<<
 *                 break
 *             elif data32[i] == bcf_int32_missing:
*/
      }

      /* "pysam/libcbcf.pyx":1116
 *             if data32[i] == bcf_int32_vector_end:
 *                 break
 *             elif data32[i] == bcf_int32_missing:             # <<<<<<<<<<<<<<
 *                 continue
 *             elif i and not bcf_gt_is_phased(data32[i]):
*/
      __pyx_t_1 = ((__pyx_v_data32[__pyx_v_i]) == bcf_int32_missing);
      if (__pyx_t_1) {

        /* "pysam/libcbcf.pyx":1117
 *                 break
 *             elif data32[i] == bcf_int32_missing:
 *                 continue             # <<<<<<<<<<<<<<
 *             elif i and not bcf_gt_is_phased(data32[i]):
 *                 return False
*/
        goto __pyx_L23_continue;

        /* "pysam/libcbcf.pyx":1116
 *             if data32[i] == bcf_int32_vector_end:
 *                 break
 *             elif data32[i] == bcf_int32_missing:             # <<<<<<<<<<<<<<
 *                 continue
 *             elif i and not bcf_gt_is_phased(data32[i]):
*/
      }

      /* "pysam/libcbcf.pyx":1118
 *             elif data32[i] == bcf_int32_missing:
 *                 continue
 *             elif i and not bcf_gt_is_phased(data32[i]):             # <<<<<<<<<<<<<<
 *                 return False
 *             else:
*/
      __pyx_t_9 = (__pyx_v_i != 0);
      if (__pyx_t_9) {
      } else {
        __pyx_t_1 = __pyx_t_9;
        goto __pyx_L26_bool_binop_done;
      }
      __pyx_t_9 = (!(bcf_gt_is_phased((__pyx_v_data32[__pyx_v_i])) != 0));
      __pyx_t_1 = __pyx_t_9;
      __pyx_L26_bool_binop_done:;
      if (__pyx_t_1) {

        /* "pysam/libcbcf.pyx":1119
 *                 continue
 *             elif i and not bcf_gt_is_phased(data32[i]):
 *                 return False             # <<<<<<<<<<<<<<
 *             else:
 *                 phased = True
*/
        __pyx_r = 0;
        __Pyx_TraceReturnCValue(__pyx_r, __Pyx_PyBool_FromLong, 202, 0, __PYX_ERR(0, 1119, __pyx_L1_error));
        goto __pyx_L0;

        /* "pysam/libcbcf.pyx":1118
 *             elif data32[i] == bcf_int32_missing:
 *                 continue
 *             elif i and not bcf_gt_is_phased(data32[i]):             # <<<<<<<<<<<<<<
 *                 return False
 *             else:
*/
      }

      /* "pysam/libcbcf.pyx":1121
 *                 return False
 *             else:
 *                 phased = True             # <<<<<<<<<<<<<<
 * 
 *     return phased
*/
      /*else*/ {
        __pyx_v_phased = 1;
      }
      __pyx_L23_continue:;
    }
    __pyx_L24_break:;

    /* "pysam/libcbcf.pyx":1111
 *             else:
 *                 phased = True
 *     elif fmt0.type == BCF_BT_INT32:             # <<<<<<<<<<<<<<
 *         data32 = <int32_t *>(fmt0.p + sample.index * fmt0.size)
 *         for i in range(fmt0.n):
*/
  }
  __pyx_L12:;

  /* "pysam/libcbcf.pyx":1123
 *                 phased = True
 * 
 *     return phased             # <<<<<<<<<<<<<<
 * 
 * 
*/
  __pyx_r = __pyx_v_phased;
  __Pyx_TraceReturnCValue(__pyx_r, __Pyx_PyBool_FromLong, 206, 0, __PYX_ERR(0, 1123, __pyx_L1_error));
  goto __pyx_L0;

  /* "pysam/libcbcf.pyx":1063
 * 
 * 
 * cdef bint bcf_sample_get_phased(VariantRecordSample sample):             # <<<<<<<<<<<<<<
 *     if sample is None:
 *         raise ValueError('sample must not be None')
*/

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_TraceException(__pyx_lineno, 0, 0);
  #if CYTHON_USE_SYS_MONITORING
  __Pyx_TraceExceptionUnwind(0, 0);
  #else
  __Pyx_TraceReturnValue(NULL, 0, 0, __PYX_ERR(0, 1063, __pyx_L1_error));
  #endif
  __Pyx_AddTraceback("pysam.libcbcf.bcf_sample_get_phased", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = -1;
  __pyx_L0:;
  __Pyx_PyMonitoring_ExitScope(0);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "pysam/libcbcf.pyx":1126
 * 
 * 
 * cdef bcf_sample_set_phased(VariantRecordSample sample, bint phased):             # <<<<<<<<<<<<<<
 *     if sample is None:
 *         raise ValueError('sample must not be None')
*/

static PyObject *__pyx_f_5pysam_7libcbcf_bcf_sample_set_phased(struct __pyx_obj_5pysam_7libcbcf_VariantRecordSample *__pyx_v_sample, int __pyx_v_phased) {
  bcf_hdr_t *__pyx_v_hdr;
  bcf1_t *__pyx_v_r;
  int32_t __pyx_v_n;
  bcf_fmt_t *__pyx_v_fmt0;
  int __pyx_v_gt0;
  int8_t *__pyx_v_data8;
  int16_t *__pyx_v_data16;
  int32_t *__pyx_v_data32;
  int __pyx_v_i;
  PyObject *__pyx_r = NULL;
  __Pyx_TraceDeclarationsFunc
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  PyObject *__pyx_t_4 = NULL;
  size_t __pyx_t_5;
  bcf_hdr_t *__pyx_t_6;
  bcf1_t *__pyx_t_7;
  uint32_t __pyx_t_8;
  int __pyx_t_9;
  bcf_fmt_t *__pyx_t_10;
  int __pyx_t_11;
  int __pyx_t_12;
  int __pyx_t_13;
  int32_t __pyx_t_14;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_TraceFrameInit(((PyObject *)__pyx_mstate_global->__pyx_codeobj_tab[27]))
  __Pyx_RefNannySetupContext("bcf_sample_set_phased", 0);
  __Pyx_TraceStartFunc("bcf_sample_set_phased", __pyx_f[0], 1126, 0, 0, 0, __PYX_ERR(0, 1126, __pyx_L1_error));

  /* "pysam/libcbcf.pyx":1127
 * 
 * cdef bcf_sample_set_phased(VariantRecordSample sample, bint phased):
 *     if sample is None:             # <<<<<<<<<<<<<<
 *         raise ValueError('sample must not be None')
 * 
*/
  __pyx_t_1 = (((PyObject *)__pyx_v_sample) == Py_None);
  if (unlikely(__pyx_t_1)) {

    /* "pysam/libcbcf.pyx":1128
 * cdef bcf_sample_set_phased(VariantRecordSample sample, bint phased):
 *     if sample is None:
 *         raise ValueError('sample must not be None')             # <<<<<<<<<<<<<<
 * 
 *     cdef bcf_hdr_t *hdr = sample.record.header.ptr
*/
    __pyx_t_3 = NULL;
    __Pyx_INCREF(__pyx_builtin_ValueError);
    __pyx_t_4 = __pyx_builtin_ValueError; 
    __pyx_t_5 = 1;
    {
      PyObject *__pyx_callargs[2] = {__pyx_t_3, __pyx_mstate_global->__pyx_kp_u_sample_must_not_be_None};
      __pyx_t_2 = __Pyx_PyObject_FastCall(__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_2)) __PYX_ERR(0, 1128, __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, 1128, __pyx_L1_error)

    /* "pysam/libcbcf.pyx":1127
 * 
 * cdef bcf_sample_set_phased(VariantRecordSample sample, bint phased):
 *     if sample is None:             # <<<<<<<<<<<<<<
 *         raise ValueError('sample must not be None')
 * 
*/
  }

  /* "pysam/libcbcf.pyx":1130
 *         raise ValueError('sample must not be None')
 * 
 *     cdef bcf_hdr_t *hdr = sample.record.header.ptr             # <<<<<<<<<<<<<<
 *     cdef bcf1_t *r = sample.record.ptr
 *     cdef int32_t n = r.n_sample
*/
  __pyx_t_6 = __pyx_v_sample->record->header->ptr;
  __pyx_v_hdr = __pyx_t_6;

  /* "pysam/libcbcf.pyx":1131
 * 
 *     cdef bcf_hdr_t *hdr = sample.record.header.ptr
 *     cdef bcf1_t *r = sample.record.ptr             # <<<<<<<<<<<<<<
 *     cdef int32_t n = r.n_sample
 * 
*/
  __pyx_t_7 = __pyx_v_sample->record->ptr;
  __pyx_v_r = __pyx_t_7;

  /* "pysam/libcbcf.pyx":1132
 *     cdef bcf_hdr_t *hdr = sample.record.header.ptr
 *     cdef bcf1_t *r = sample.record.ptr
 *     cdef int32_t n = r.n_sample             # <<<<<<<<<<<<<<
 * 
 *     if bcf_unpack(r, BCF_UN_ALL) < 0:
*/
  __pyx_t_8 = __pyx_v_r->n_sample;
  __pyx_v_n = __pyx_t_8;

  /* "pysam/libcbcf.pyx":1134
 *     cdef int32_t n = r.n_sample
 * 
 *     if bcf_unpack(r, BCF_UN_ALL) < 0:             # <<<<<<<<<<<<<<
 *         raise ValueError('Error unpacking VariantRecord')
 * 
*/
  __pyx_t_1 = (bcf_unpack(__pyx_v_r, BCF_UN_ALL) < 0);
  if (unlikely(__pyx_t_1)) {

    /* "pysam/libcbcf.pyx":1135
 * 
 *     if bcf_unpack(r, BCF_UN_ALL) < 0:
 *         raise ValueError('Error unpacking VariantRecord')             # <<<<<<<<<<<<<<
 * 
 *     if sample.index < 0 or sample.index >= n or not r.n_fmt:
*/
    __pyx_t_4 = NULL;
    __Pyx_INCREF(__pyx_builtin_ValueError);
    __pyx_t_3 = __pyx_builtin_ValueError; 
    __pyx_t_5 = 1;
    {
      PyObject *__pyx_callargs[2] = {__pyx_t_4, __pyx_mstate_global->__pyx_kp_u_Error_unpacking_VariantRecord};
      __pyx_t_2 = __Pyx_PyObject_FastCall(__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_2)) __PYX_ERR(0, 1135, __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, 1135, __pyx_L1_error)

    /* "pysam/libcbcf.pyx":1134
 *     cdef int32_t n = r.n_sample
 * 
 *     if bcf_unpack(r, BCF_UN_ALL) < 0:             # <<<<<<<<<<<<<<
 *         raise ValueError('Error unpacking VariantRecord')
 * 
*/
  }

  /* "pysam/libcbcf.pyx":1137
 *         raise ValueError('Error unpacking VariantRecord')
 * 
 *     if sample.index < 0 or sample.index >= n or not r.n_fmt:             # <<<<<<<<<<<<<<
 *         return
 * 
*/
  __pyx_t_9 = (__pyx_v_sample->index < 0);
  if (!__pyx_t_9) {
  } else {
    __pyx_t_1 = __pyx_t_9;
    goto __pyx_L6_bool_binop_done;
  }
  __pyx_t_9 = (__pyx_v_sample->index >= __pyx_v_n);
  if (!__pyx_t_9) {
  } else {
    __pyx_t_1 = __pyx_t_9;
    goto __pyx_L6_bool_binop_done;
  }
  __pyx_t_9 = (!(__pyx_v_r->n_fmt != 0));
  __pyx_t_1 = __pyx_t_9;
  __pyx_L6_bool_binop_done:;
  if (__pyx_t_1) {

    /* "pysam/libcbcf.pyx":1138
 * 
 *     if sample.index < 0 or sample.index >= n or not r.n_fmt:
 *         return             # <<<<<<<<<<<<<<
 * 
 *     cdef bcf_fmt_t *fmt0 = r.d.fmt
*/
    __Pyx_XDECREF(__pyx_r);
    __pyx_r = Py_None; __Pyx_INCREF(Py_None);
    goto __pyx_L0;

    /* "pysam/libcbcf.pyx":1137
 *         raise ValueError('Error unpacking VariantRecord')
 * 
 *     if sample.index < 0 or sample.index >= n or not r.n_fmt:             # <<<<<<<<<<<<<<
 *         return
 * 
*/
  }

  /* "pysam/libcbcf.pyx":1140
 *         return
 * 
 *     cdef bcf_fmt_t *fmt0 = r.d.fmt             # <<<<<<<<<<<<<<
 *     cdef int gt0 = is_gt_fmt(hdr, fmt0.id)
 * 
*/
  __pyx_t_10 = __pyx_v_r->d.fmt;
  __pyx_v_fmt0 = __pyx_t_10;

  /* "pysam/libcbcf.pyx":1141
 * 
 *     cdef bcf_fmt_t *fmt0 = r.d.fmt
 *     cdef int gt0 = is_gt_fmt(hdr, fmt0.id)             # <<<<<<<<<<<<<<
 * 
 *     if not gt0 or not fmt0.n:
*/
  __pyx_t_11 = __pyx_f_5pysam_7libcbcf_is_gt_fmt(__pyx_v_hdr, __pyx_v_fmt0->id); if (unlikely(__pyx_t_11 == ((int)-1) && PyErr_Occurred())) __PYX_ERR(0, 1141, __pyx_L1_error)
  __pyx_v_gt0 = __pyx_t_11;

  /* "pysam/libcbcf.pyx":1143
 *     cdef int gt0 = is_gt_fmt(hdr, fmt0.id)
 * 
 *     if not gt0 or not fmt0.n:             # <<<<<<<<<<<<<<
 *         raise ValueError('Cannot set phased before genotype is set')
 * 
*/
  __pyx_t_9 = (!(__pyx_v_gt0 != 0));
  if (!__pyx_t_9) {
  } else {
    __pyx_t_1 = __pyx_t_9;
    goto __pyx_L10_bool_binop_done;
  }
  __pyx_t_9 = (!(__pyx_v_fmt0->n != 0));
  __pyx_t_1 = __pyx_t_9;
  __pyx_L10_bool_binop_done:;
  if (unlikely(__pyx_t_1)) {

    /* "pysam/libcbcf.pyx":1144
 * 
 *     if not gt0 or not fmt0.n:
 *         raise ValueError('Cannot set phased before genotype is set')             # <<<<<<<<<<<<<<
 * 
 *     cdef int8_t  *data8
*/
    __pyx_t_3 = NULL;
    __Pyx_INCREF(__pyx_builtin_ValueError);
    __pyx_t_4 = __pyx_builtin_ValueError; 
    __pyx_t_5 = 1;
    {
      PyObject *__pyx_callargs[2] = {__pyx_t_3, __pyx_mstate_global->__pyx_kp_u_Cannot_set_phased_before_genotyp};
      __pyx_t_2 = __Pyx_PyObject_FastCall(__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_2)) __PYX_ERR(0, 1144, __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, 1144, __pyx_L1_error)

    /* "pysam/libcbcf.pyx":1143
 *     cdef int gt0 = is_gt_fmt(hdr, fmt0.id)
 * 
 *     if not gt0 or not fmt0.n:             # <<<<<<<<<<<<<<
 *         raise ValueError('Cannot set phased before genotype is set')
 * 
*/
  }

  /* "pysam/libcbcf.pyx":1150
 *     cdef int32_t *data32
 * 
 *     if fmt0.type == BCF_BT_INT8:             # <<<<<<<<<<<<<<
 *         data8 = <int8_t *>(fmt0.p + sample.index * fmt0.size)
 *         for i in range(fmt0.n):
*/
  __pyx_t_1 = (__pyx_v_fmt0->type == BCF_BT_INT8);
  if (__pyx_t_1) {

    /* "pysam/libcbcf.pyx":1151
 * 
 *     if fmt0.type == BCF_BT_INT8:
 *         data8 = <int8_t *>(fmt0.p + sample.index * fmt0.size)             # <<<<<<<<<<<<<<
 *         for i in range(fmt0.n):
 *             if data8[i] == bcf_int8_vector_end:
*/
    __pyx_v_data8 = ((int8_t *)(__pyx_v_fmt0->p + (__pyx_v_sample->index * __pyx_v_fmt0->size)));

    /* "pysam/libcbcf.pyx":1152
 *     if fmt0.type == BCF_BT_INT8:
 *         data8 = <int8_t *>(fmt0.p + sample.index * fmt0.size)
 *         for i in range(fmt0.n):             # <<<<<<<<<<<<<<
 *             if data8[i] == bcf_int8_vector_end:
 *                 break
*/
    __pyx_t_11 = __pyx_v_fmt0->n;
    __pyx_t_12 = __pyx_t_11;
    for (__pyx_t_13 = 0; __pyx_t_13 < __pyx_t_12; __pyx_t_13+=1) {
      __pyx_v_i = __pyx_t_13;

      /* "pysam/libcbcf.pyx":1153
 *         data8 = <int8_t *>(fmt0.p + sample.index * fmt0.size)
 *         for i in range(fmt0.n):
 *             if data8[i] == bcf_int8_vector_end:             # <<<<<<<<<<<<<<
 *                 break
 *             elif data8[i] == bcf_int8_missing:
*/
      __pyx_t_1 = ((__pyx_v_data8[__pyx_v_i]) == bcf_int8_vector_end);
      if (__pyx_t_1) {

        /* "pysam/libcbcf.pyx":1154
 *         for i in range(fmt0.n):
 *             if data8[i] == bcf_int8_vector_end:
 *                 break             # <<<<<<<<<<<<<<
 *             elif data8[i] == bcf_int8_missing:
 *                 continue
*/
        goto __pyx_L14_break;

        /* "pysam/libcbcf.pyx":1153
 *         data8 = <int8_t *>(fmt0.p + sample.index * fmt0.size)
 *         for i in range(fmt0.n):
 *             if data8[i] == bcf_int8_vector_end:             # <<<<<<<<<<<<<<
 *                 break
 *             elif data8[i] == bcf_int8_missing:
*/
      }

      /* "pysam/libcbcf.pyx":1155
 *             if data8[i] == bcf_int8_vector_end:
 *                 break
 *             elif data8[i] == bcf_int8_missing:             # <<<<<<<<<<<<<<
 *                 continue
 *             elif i:
*/
      __pyx_t_1 = ((__pyx_v_data8[__pyx_v_i]) == bcf_int8_missing);
      if (__pyx_t_1) {

        /* "pysam/libcbcf.pyx":1156
 *                 break
 *             elif data8[i] == bcf_int8_missing:
 *                 continue             # <<<<<<<<<<<<<<
 *             elif i:
 *                 data8[i] = (data8[i] & 0xFE) | phased
*/
        goto __pyx_L13_continue;

        /* "pysam/libcbcf.pyx":1155
 *             if data8[i] == bcf_int8_vector_end:
 *                 break
 *             elif data8[i] == bcf_int8_missing:             # <<<<<<<<<<<<<<
 *                 continue
 *             elif i:
*/
      }

      /* "pysam/libcbcf.pyx":1157
 *             elif data8[i] == bcf_int8_missing:
 *                 continue
 *             elif i:             # <<<<<<<<<<<<<<
 *                 data8[i] = (data8[i] & 0xFE) | phased
 *     elif fmt0.type == BCF_BT_INT16:
*/
      __pyx_t_1 = (__pyx_v_i != 0);
      if (__pyx_t_1) {

        /* "pysam/libcbcf.pyx":1158
 *                 continue
 *             elif i:
 *                 data8[i] = (data8[i] & 0xFE) | phased             # <<<<<<<<<<<<<<
 *     elif fmt0.type == BCF_BT_INT16:
 *         data16 = <int16_t *>(fmt0.p + sample.index * fmt0.size)
*/
        (__pyx_v_data8[__pyx_v_i]) = (((__pyx_v_data8[__pyx_v_i]) & 0xFE) | __pyx_v_phased);

        /* "pysam/libcbcf.pyx":1157
 *             elif data8[i] == bcf_int8_missing:
 *                 continue
 *             elif i:             # <<<<<<<<<<<<<<
 *                 data8[i] = (data8[i] & 0xFE) | phased
 *     elif fmt0.type == BCF_BT_INT16:
*/
      }
      __pyx_L13_continue:;
    }
    __pyx_L14_break:;

    /* "pysam/libcbcf.pyx":1150
 *     cdef int32_t *data32
 * 
 *     if fmt0.type == BCF_BT_INT8:             # <<<<<<<<<<<<<<
 *         data8 = <int8_t *>(fmt0.p + sample.index * fmt0.size)
 *         for i in range(fmt0.n):
*/
    goto __pyx_L12;
  }

  /* "pysam/libcbcf.pyx":1159
 *             elif i:
 *                 data8[i] = (data8[i] & 0xFE) | phased
 *     elif fmt0.type == BCF_BT_INT16:             # <<<<<<<<<<<<<<
 *         data16 = <int16_t *>(fmt0.p + sample.index * fmt0.size)
 *         for i in range(fmt0.n):
*/
  __pyx_t_1 = (__pyx_v_fmt0->type == BCF_BT_INT16);
  if (__pyx_t_1) {

    /* "pysam/libcbcf.pyx":1160
 *                 data8[i] = (data8[i] & 0xFE) | phased
 *     elif fmt0.type == BCF_BT_INT16:
 *         data16 = <int16_t *>(fmt0.p + sample.index * fmt0.size)             # <<<<<<<<<<<<<<
 *         for i in range(fmt0.n):
 *             if data16[i] == bcf_int16_vector_end:
*/
    __pyx_v_data16 = ((int16_t *)(__pyx_v_fmt0->p + (__pyx_v_sample->index * __pyx_v_fmt0->size)));

    /* "pysam/libcbcf.pyx":1161
 *     elif fmt0.type == BCF_BT_INT16:
 *         data16 = <int16_t *>(fmt0.p + sample.index * fmt0.size)
 *         for i in range(fmt0.n):             # <<<<<<<<<<<<<<
 *             if data16[i] == bcf_int16_vector_end:
 *                 break
*/
    __pyx_t_11 = __pyx_v_fmt0->n;
    __pyx_t_12 = __pyx_t_11;
    for (__pyx_t_13 = 0; __pyx_t_13 < __pyx_t_12; __pyx_t_13+=1) {
      __pyx_v_i = __pyx_t_13;

      /* "pysam/libcbcf.pyx":1162
 *         data16 = <int16_t *>(fmt0.p + sample.index * fmt0.size)
 *         for i in range(fmt0.n):
 *             if data16[i] == bcf_int16_vector_end:             # <<<<<<<<<<<<<<
 *                 break
 *             elif data16[i] == bcf_int16_missing:
*/
      __pyx_t_1 = ((__pyx_v_data16[__pyx_v_i]) == bcf_int16_vector_end);
      if (__pyx_t_1) {

        /* "pysam/libcbcf.pyx":1163
 *         for i in range(fmt0.n):
 *             if data16[i] == bcf_int16_vector_end:
 *                 break             # <<<<<<<<<<<<<<
 *             elif data16[i] == bcf_int16_missing:
 *                 continue
*/
        goto __pyx_L17_break;

        /* "pysam/libcbcf.pyx":1162
 *         data16 = <int16_t *>(fmt0.p + sample.index * fmt0.size)
 *         for i in range(fmt0.n):
 *             if data16[i] == bcf_int16_vector_end:             # <<<<<<<<<<<<<<
 *                 break
 *             elif data16[i] == bcf_int16_missing:
*/
      }

      /* "pysam/libcbcf.pyx":1164
 *             if data16[i] == bcf_int16_vector_end:
 *                 break
 *             elif data16[i] == bcf_int16_missing:             # <<<<<<<<<<<<<<
 *                 continue
 *             elif i:
*/
      __pyx_t_1 = ((__pyx_v_data16[__pyx_v_i]) == bcf_int16_missing);
      if (__pyx_t_1) {

        /* "pysam/libcbcf.pyx":1165
 *                 break
 *             elif data16[i] == bcf_int16_missing:
 *                 continue             # <<<<<<<<<<<<<<
 *             elif i:
 *                 data16[i] = (data16[i] & 0xFFFE) | phased
*/
        goto __pyx_L16_continue;

        /* "pysam/libcbcf.pyx":1164
 *             if data16[i] == bcf_int16_vector_end:
 *                 break
 *             elif data16[i] == bcf_int16_missing:             # <<<<<<<<<<<<<<
 *                 continue
 *             elif i:
*/
      }

      /* "pysam/libcbcf.pyx":1166
 *             elif data16[i] == bcf_int16_missing:
 *                 continue
 *             elif i:             # <<<<<<<<<<<<<<
 *                 data16[i] = (data16[i] & 0xFFFE) | phased
 *     elif fmt0.type == BCF_BT_INT32:
*/
      __pyx_t_1 = (__pyx_v_i != 0);
      if (__pyx_t_1) {

        /* "pysam/libcbcf.pyx":1167
 *                 continue
 *             elif i:
 *                 data16[i] = (data16[i] & 0xFFFE) | phased             # <<<<<<<<<<<<<<
 *     elif fmt0.type == BCF_BT_INT32:
 *         data32 = <int32_t *>(fmt0.p + sample.index * fmt0.size)
*/
        (__pyx_v_data16[__pyx_v_i]) = (((__pyx_v_data16[__pyx_v_i]) & 0xFFFE) | __pyx_v_phased);

        /* "pysam/libcbcf.pyx":1166
 *             elif data16[i] == bcf_int16_missing:
 *                 continue
 *             elif i:             # <<<<<<<<<<<<<<
 *                 data16[i] = (data16[i] & 0xFFFE) | phased
 *     elif fmt0.type == BCF_BT_INT32:
*/
      }
      __pyx_L16_continue:;
    }
    __pyx_L17_break:;

    /* "pysam/libcbcf.pyx":1159
 *             elif i:
 *                 data8[i] = (data8[i] & 0xFE) | phased
 *     elif fmt0.type == BCF_BT_INT16:             # <<<<<<<<<<<<<<
 *         data16 = <int16_t *>(fmt0.p + sample.index * fmt0.size)
 *         for i in range(fmt0.n):
*/
    goto __pyx_L12;
  }

  /* "pysam/libcbcf.pyx":1168
 *             elif i:
 *                 data16[i] = (data16[i] & 0xFFFE) | phased
 *     elif fmt0.type == BCF_BT_INT32:             # <<<<<<<<<<<<<<
 *         data32 = <int32_t *>(fmt0.p + sample.index * fmt0.size)
 *         for i in range(fmt0.n):
*/
  __pyx_t_1 = (__pyx_v_fmt0->type == BCF_BT_INT32);
  if (__pyx_t_1) {

    /* "pysam/libcbcf.pyx":1169
 *                 data16[i] = (data16[i] & 0xFFFE) | phased
 *     elif fmt0.type == BCF_BT_INT32:
 *         data32 = <int32_t *>(fmt0.p + sample.index * fmt0.size)             # <<<<<<<<<<<<<<
 *         for i in range(fmt0.n):
 *             if data32[i] == bcf_int32_vector_end:
*/
    __pyx_v_data32 = ((int32_t *)(__pyx_v_fmt0->p + (__pyx_v_sample->index * __pyx_v_fmt0->size)));

    /* "pysam/libcbcf.pyx":1170
 *     elif fmt0.type == BCF_BT_INT32:
 *         data32 = <int32_t *>(fmt0.p + sample.index * fmt0.size)
 *         for i in range(fmt0.n):             # <<<<<<<<<<<<<<
 *             if data32[i] == bcf_int32_vector_end:
 *                 break
*/
    __pyx_t_11 = __pyx_v_fmt0->n;
    __pyx_t_12 = __pyx_t_11;
    for (__pyx_t_13 = 0; __pyx_t_13 < __pyx_t_12; __pyx_t_13+=1) {
      __pyx_v_i = __pyx_t_13;

      /* "pysam/libcbcf.pyx":1171
 *         data32 = <int32_t *>(fmt0.p + sample.index * fmt0.size)
 *         for i in range(fmt0.n):
 *             if data32[i] == bcf_int32_vector_end:             # <<<<<<<<<<<<<<
 *                 break
 *             elif data32[i] == bcf_int32_missing:
*/
      __pyx_t_1 = ((__pyx_v_data32[__pyx_v_i]) == bcf_int32_vector_end);
      if (__pyx_t_1) {

        /* "pysam/libcbcf.pyx":1172
 *         for i in range(fmt0.n):
 *             if data32[i] == bcf_int32_vector_end:
 *                 break             # <<<<<<<<<<<<<<
 *             elif data32[i] == bcf_int32_missing:
 *                 continue
*/
        goto __pyx_L20_break;

        /* "pysam/libcbcf.pyx":1171
 *         data32 = <int32_t *>(fmt0.p + sample.index * fmt0.size)
 *         for i in range(fmt0.n):
 *             if data32[i] == bcf_int32_vector_end:             # <<<<<<<<<<<<<<
 *                 break
 *             elif data32[i] == bcf_int32_missing:
*/
      }

      /* "pysam/libcbcf.pyx":1173
 *             if data32[i] == bcf_int32_vector_end:
 *                 break
 *             elif data32[i] == bcf_int32_missing:             # <<<<<<<<<<<<<<
 *                 continue
 *             elif i:
*/
      __pyx_t_1 = ((__pyx_v_data32[__pyx_v_i]) == bcf_int32_missing);
      if (__pyx_t_1) {

        /* "pysam/libcbcf.pyx":1174
 *                 break
 *             elif data32[i] == bcf_int32_missing:
 *                 continue             # <<<<<<<<<<<<<<
 *             elif i:
 *                 data32[i] = (data32[i] & 0xFFFFFFFE) | phased
*/
        goto __pyx_L19_continue;

        /* "pysam/libcbcf.pyx":1173
 *             if data32[i] == bcf_int32_vector_end:
 *                 break
 *             elif data32[i] == bcf_int32_missing:             # <<<<<<<<<<<<<<
 *                 continue
 *             elif i:
*/
      }

      /* "pysam/libcbcf.pyx":1175
 *             elif data32[i] == bcf_int32_missing:
 *                 continue
 *             elif i:             # <<<<<<<<<<<<<<
 *                 data32[i] = (data32[i] & 0xFFFFFFFE) | phased
 * 
*/
      __pyx_t_1 = (__pyx_v_i != 0);
      if (__pyx_t_1) {

        /* "pysam/libcbcf.pyx":1176
 *                 continue
 *             elif i:
 *                 data32[i] = (data32[i] & 0xFFFFFFFE) | phased             # <<<<<<<<<<<<<<
 * 
 * 
*/
        __pyx_t_2 = __Pyx_PyLong_From_int32_t((__pyx_v_data32[__pyx_v_i])); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1176, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_2);
        __pyx_t_4 = PyNumber_And(__pyx_t_2, __pyx_mstate_global->__pyx_int_4294967294); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1176, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_4);
        __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
        __pyx_t_2 = __Pyx_PyBool_FromLong(__pyx_v_phased); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1176, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_2);
        __pyx_t_3 = PyNumber_Or(__pyx_t_4, __pyx_t_2); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1176, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_3);
        __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
        __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
        __pyx_t_14 = __Pyx_PyLong_As_int32_t(__pyx_t_3); if (unlikely((__pyx_t_14 == ((int32_t)-1)) && PyErr_Occurred())) __PYX_ERR(0, 1176, __pyx_L1_error)
        __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
        (__pyx_v_data32[__pyx_v_i]) = __pyx_t_14;

        /* "pysam/libcbcf.pyx":1175
 *             elif data32[i] == bcf_int32_missing:
 *                 continue
 *             elif i:             # <<<<<<<<<<<<<<
 *                 data32[i] = (data32[i] & 0xFFFFFFFE) | phased
 * 
*/
      }
      __pyx_L19_continue:;
    }
    __pyx_L20_break:;

    /* "pysam/libcbcf.pyx":1168
 *             elif i:
 *                 data16[i] = (data16[i] & 0xFFFE) | phased
 *     elif fmt0.type == BCF_BT_INT32:             # <<<<<<<<<<<<<<
 *         data32 = <int32_t *>(fmt0.p + sample.index * fmt0.size)
 *         for i in range(fmt0.n):
*/
  }
  __pyx_L12:;

  /* "pysam/libcbcf.pyx":1126
 * 
 * 
 * cdef bcf_sample_set_phased(VariantRecordSample sample, bint phased):             # <<<<<<<<<<<<<<
 *     if sample is None:
 *         raise ValueError('sample must not be None')
*/

  /* function exit code */
  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  __Pyx_TraceReturnValue(__pyx_r, 0, 0, __PYX_ERR(0, 1126, __pyx_L1_error));
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_TraceException(__pyx_lineno, 0, 0);
  #if CYTHON_USE_SYS_MONITORING
  __Pyx_TraceExceptionUnwind(0, 0);
  #else
  __Pyx_TraceReturnValue(NULL, 0, 0, __PYX_ERR(0, 1126, __pyx_L1_error));
  #endif
  __Pyx_AddTraceback("pysam.libcbcf.bcf_sample_set_phased", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_PyMonitoring_ExitScope(0);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "pysam/libcbcf.pyx":1179
 * 
 * 
 * cdef inline bcf_sync_end(VariantRecord record):             # <<<<<<<<<<<<<<
 *     cdef bcf_hdr_t *hdr = record.header.ptr
 *     cdef bcf_info_t *info
*/

static CYTHON_INLINE PyObject *__pyx_f_5pysam_7libcbcf_bcf_sync_end(struct __pyx_obj_5pysam_7libcbcf_VariantRecord *__pyx_v_record) {
  bcf_hdr_t *__pyx_v_hdr;
  bcf_info_t *__pyx_v_info;
  int __pyx_v_end_id;
  int __pyx_v_ref_len;
  PyObject *__pyx_r = NULL;
  __Pyx_TraceDeclarationsFunc
  __Pyx_RefNannyDeclarations
  bcf_hdr_t *__pyx_t_1;
  int __pyx_t_2;
  PyObject *__pyx_t_3 = NULL;
  int __pyx_t_4;
  Py_ssize_t __pyx_t_5;
  int __pyx_t_6;
  PyObject *__pyx_t_7 = NULL;
  PyObject *__pyx_t_8 = NULL;
  size_t __pyx_t_9;
  PyObject *__pyx_t_10 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_TraceFrameInit(((PyObject *)__pyx_mstate_global->__pyx_codeobj_tab[28]))
  __Pyx_RefNannySetupContext("bcf_sync_end", 0);
  __Pyx_TraceStartFunc("bcf_sync_end", __pyx_f[0], 1179, 0, 0, 0, __PYX_ERR(0, 1179, __pyx_L1_error));

  /* "pysam/libcbcf.pyx":1180
 * 
 * cdef inline bcf_sync_end(VariantRecord record):
 *     cdef bcf_hdr_t *hdr = record.header.ptr             # <<<<<<<<<<<<<<
 *     cdef bcf_info_t *info
 *     cdef int end_id = bcf_header_get_info_id(record.header.ptr, b'END')
*/
  __pyx_t_1 = __pyx_v_record->header->ptr;
  __pyx_v_hdr = __pyx_t_1;

  /* "pysam/libcbcf.pyx":1182
 *     cdef bcf_hdr_t *hdr = record.header.ptr
 *     cdef bcf_info_t *info
 *     cdef int end_id = bcf_header_get_info_id(record.header.ptr, b'END')             # <<<<<<<<<<<<<<
 *     cdef int ref_len
 * 
*/
  __pyx_t_2 = __pyx_f_5pysam_7libcbcf_bcf_header_get_info_id(__pyx_v_record->header->ptr, __pyx_mstate_global->__pyx_n_b_END); if (unlikely(__pyx_t_2 == ((int)-2) && PyErr_Occurred())) __PYX_ERR(0, 1182, __pyx_L1_error)
  __pyx_v_end_id = __pyx_t_2;

  /* "pysam/libcbcf.pyx":1186
 * 
 *     # allow missing ref when instantiating a new record
 *     if record.ref is not None:             # <<<<<<<<<<<<<<
 *         ref_len = len(record.ref)
 *     else:
*/
  __pyx_t_3 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_record), __pyx_mstate_global->__pyx_n_u_ref); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1186, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __pyx_t_4 = (__pyx_t_3 != Py_None);
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  if (__pyx_t_4) {

    /* "pysam/libcbcf.pyx":1187
 *     # allow missing ref when instantiating a new record
 *     if record.ref is not None:
 *         ref_len = len(record.ref)             # <<<<<<<<<<<<<<
 *     else:
 *         ref_len = 0
*/
    __pyx_t_3 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_record), __pyx_mstate_global->__pyx_n_u_ref); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1187, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __pyx_t_5 = PyObject_Length(__pyx_t_3); if (unlikely(__pyx_t_5 == ((Py_ssize_t)-1))) __PYX_ERR(0, 1187, __pyx_L1_error)
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    __pyx_v_ref_len = __pyx_t_5;

    /* "pysam/libcbcf.pyx":1186
 * 
 *     # allow missing ref when instantiating a new record
 *     if record.ref is not None:             # <<<<<<<<<<<<<<
 *         ref_len = len(record.ref)
 *     else:
*/
    goto __pyx_L3;
  }

  /* "pysam/libcbcf.pyx":1189
 *         ref_len = len(record.ref)
 *     else:
 *         ref_len = 0             # <<<<<<<<<<<<<<
 * 
 *     # Delete INFO/END if no alleles are present or if rlen is equal to len(ref)
*/
  /*else*/ {
    __pyx_v_ref_len = 0;
  }
  __pyx_L3:;

  /* "pysam/libcbcf.pyx":1193
 *     # Delete INFO/END if no alleles are present or if rlen is equal to len(ref)
 *     # Always keep END for symbolic alleles
 *     if not has_symbolic_allele(record) and (not record.ptr.n_allele or record.ptr.rlen == ref_len):             # <<<<<<<<<<<<<<
 *         # If INFO/END is not defined in the header, it doesn't exist in the record
 *         if end_id >= 0:
*/
  __pyx_t_2 = __pyx_f_5pysam_7libcbcf_has_symbolic_allele(__pyx_v_record); if (unlikely(__pyx_t_2 == ((int)-1) && PyErr_Occurred())) __PYX_ERR(0, 1193, __pyx_L1_error)
  __pyx_t_6 = (!(__pyx_t_2 != 0));
  if (__pyx_t_6) {
  } else {
    __pyx_t_4 = __pyx_t_6;
    goto __pyx_L5_bool_binop_done;
  }
  __pyx_t_6 = (!(__pyx_v_record->ptr->n_allele != 0));
  if (!__pyx_t_6) {
  } else {
    __pyx_t_4 = __pyx_t_6;
    goto __pyx_L5_bool_binop_done;
  }
  __pyx_t_6 = (__pyx_v_record->ptr->rlen == __pyx_v_ref_len);
  __pyx_t_4 = __pyx_t_6;
  __pyx_L5_bool_binop_done:;
  if (__pyx_t_4) {

    /* "pysam/libcbcf.pyx":1195
 *     if not has_symbolic_allele(record) and (not record.ptr.n_allele or record.ptr.rlen == ref_len):
 *         # If INFO/END is not defined in the header, it doesn't exist in the record
 *         if end_id >= 0:             # <<<<<<<<<<<<<<
 *             info = bcf_get_info(hdr, record.ptr, b'END')
 *             if info and info.vptr:
*/
    __pyx_t_4 = (__pyx_v_end_id >= 0);
    if (__pyx_t_4) {

      /* "pysam/libcbcf.pyx":1196
 *         # If INFO/END is not defined in the header, it doesn't exist in the record
 *         if end_id >= 0:
 *             info = bcf_get_info(hdr, record.ptr, b'END')             # <<<<<<<<<<<<<<
 *             if info and info.vptr:
 *                 if bcf_update_info(hdr, record.ptr, b'END', NULL, 0, info.type) < 0:
*/
      __pyx_v_info = bcf_get_info(__pyx_v_hdr, __pyx_v_record->ptr, ((char const *)"END"));

      /* "pysam/libcbcf.pyx":1197
 *         if end_id >= 0:
 *             info = bcf_get_info(hdr, record.ptr, b'END')
 *             if info and info.vptr:             # <<<<<<<<<<<<<<
 *                 if bcf_update_info(hdr, record.ptr, b'END', NULL, 0, info.type) < 0:
 *                     raise ValueError('Unable to delete END')
*/
      __pyx_t_6 = (__pyx_v_info != 0);
      if (__pyx_t_6) {
      } else {
        __pyx_t_4 = __pyx_t_6;
        goto __pyx_L10_bool_binop_done;
      }
      __pyx_t_6 = (__pyx_v_info->vptr != 0);
      __pyx_t_4 = __pyx_t_6;
      __pyx_L10_bool_binop_done:;
      if (__pyx_t_4) {

        /* "pysam/libcbcf.pyx":1198
 *             info = bcf_get_info(hdr, record.ptr, b'END')
 *             if info and info.vptr:
 *                 if bcf_update_info(hdr, record.ptr, b'END', NULL, 0, info.type) < 0:             # <<<<<<<<<<<<<<
 *                     raise ValueError('Unable to delete END')
 *     else:
*/
        __pyx_t_4 = (bcf_update_info(__pyx_v_hdr, __pyx_v_record->ptr, ((char const *)"END"), NULL, 0, __pyx_v_info->type) < 0);
        if (unlikely(__pyx_t_4)) {

          /* "pysam/libcbcf.pyx":1199
 *             if info and info.vptr:
 *                 if bcf_update_info(hdr, record.ptr, b'END', NULL, 0, info.type) < 0:
 *                     raise ValueError('Unable to delete END')             # <<<<<<<<<<<<<<
 *     else:
 *         # Create END header, if not present
*/
          __pyx_t_7 = NULL;
          __Pyx_INCREF(__pyx_builtin_ValueError);
          __pyx_t_8 = __pyx_builtin_ValueError; 
          __pyx_t_9 = 1;
          {
            PyObject *__pyx_callargs[2] = {__pyx_t_7, __pyx_mstate_global->__pyx_kp_u_Unable_to_delete_END};
            __pyx_t_3 = __Pyx_PyObject_FastCall(__pyx_t_8, __pyx_callargs+__pyx_t_9, (2-__pyx_t_9) | (__pyx_t_9*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
            __Pyx_XDECREF(__pyx_t_7); __pyx_t_7 = 0;
            __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
            if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1199, __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, 1199, __pyx_L1_error)

          /* "pysam/libcbcf.pyx":1198
 *             info = bcf_get_info(hdr, record.ptr, b'END')
 *             if info and info.vptr:
 *                 if bcf_update_info(hdr, record.ptr, b'END', NULL, 0, info.type) < 0:             # <<<<<<<<<<<<<<
 *                     raise ValueError('Unable to delete END')
 *     else:
*/
        }

        /* "pysam/libcbcf.pyx":1197
 *         if end_id >= 0:
 *             info = bcf_get_info(hdr, record.ptr, b'END')
 *             if info and info.vptr:             # <<<<<<<<<<<<<<
 *                 if bcf_update_info(hdr, record.ptr, b'END', NULL, 0, info.type) < 0:
 *                     raise ValueError('Unable to delete END')
*/
      }

      /* "pysam/libcbcf.pyx":1195
 *     if not has_symbolic_allele(record) and (not record.ptr.n_allele or record.ptr.rlen == ref_len):
 *         # If INFO/END is not defined in the header, it doesn't exist in the record
 *         if end_id >= 0:             # <<<<<<<<<<<<<<
 *             info = bcf_get_info(hdr, record.ptr, b'END')
 *             if info and info.vptr:
*/
    }

    /* "pysam/libcbcf.pyx":1193
 *     # Delete INFO/END if no alleles are present or if rlen is equal to len(ref)
 *     # Always keep END for symbolic alleles
 *     if not has_symbolic_allele(record) and (not record.ptr.n_allele or record.ptr.rlen == ref_len):             # <<<<<<<<<<<<<<
 *         # If INFO/END is not defined in the header, it doesn't exist in the record
 *         if end_id >= 0:
*/
    goto __pyx_L4;
  }

  /* "pysam/libcbcf.pyx":1202
 *     else:
 *         # Create END header, if not present
 *         if end_id < 0:             # <<<<<<<<<<<<<<
 *             record.header.info.add('END', number=1, type='Integer', description='Stop position of the interval')
 * 
*/
  /*else*/ {
    __pyx_t_4 = (__pyx_v_end_id < 0);
    if (__pyx_t_4) {

      /* "pysam/libcbcf.pyx":1203
 *         # Create END header, if not present
 *         if end_id < 0:
 *             record.header.info.add('END', number=1, type='Integer', description='Stop position of the interval')             # <<<<<<<<<<<<<<
 * 
 *         # Update to reflect stop position
*/
      __pyx_t_7 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_record->header), __pyx_mstate_global->__pyx_n_u_info); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 1203, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_7);
      __pyx_t_8 = __pyx_t_7;
      __Pyx_INCREF(__pyx_t_8);
      __pyx_t_9 = 0;
      {
        PyObject *__pyx_callargs[2 + ((CYTHON_VECTORCALL) ? 3 : 0)] = {__pyx_t_8, __pyx_mstate_global->__pyx_n_u_END};
        __pyx_t_10 = __Pyx_MakeVectorcallBuilderKwds(3); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 1203, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_10);
        if (__Pyx_VectorcallBuilder_AddArg(__pyx_mstate_global->__pyx_n_u_number, __pyx_mstate_global->__pyx_int_1, __pyx_t_10, __pyx_callargs+2, 0) < 0) __PYX_ERR(0, 1203, __pyx_L1_error)
        if (__Pyx_VectorcallBuilder_AddArg(__pyx_mstate_global->__pyx_n_u_type, __pyx_mstate_global->__pyx_n_u_Integer, __pyx_t_10, __pyx_callargs+2, 1) < 0) __PYX_ERR(0, 1203, __pyx_L1_error)
        if (__Pyx_VectorcallBuilder_AddArg(__pyx_mstate_global->__pyx_n_u_description, __pyx_mstate_global->__pyx_kp_u_Stop_position_of_the_interval, __pyx_t_10, __pyx_callargs+2, 2) < 0) __PYX_ERR(0, 1203, __pyx_L1_error)
        __pyx_t_3 = __Pyx_Object_VectorcallMethod_CallFromBuilder(__pyx_mstate_global->__pyx_n_u_add, __pyx_callargs+__pyx_t_9, (2-__pyx_t_9) | (1*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET), __pyx_t_10);
        __Pyx_XDECREF(__pyx_t_8); __pyx_t_8 = 0;
        __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
        __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
        if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1203, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_3);
      }
      __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;

      /* "pysam/libcbcf.pyx":1202
 *     else:
 *         # Create END header, if not present
 *         if end_id < 0:             # <<<<<<<<<<<<<<
 *             record.header.info.add('END', number=1, type='Integer', description='Stop position of the interval')
 * 
*/
    }

    /* "pysam/libcbcf.pyx":1206
 * 
 *         # Update to reflect stop position
 *         bcf_info_set_value(record, b'END', record.ptr.pos + record.ptr.rlen)             # <<<<<<<<<<<<<<
 * 
 * 
*/
    __pyx_t_3 = __Pyx_PyLong_From_int32_t((__pyx_v_record->ptr->pos + __pyx_v_record->ptr->rlen)); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1206, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __pyx_t_7 = __pyx_f_5pysam_7libcbcf_bcf_info_set_value(__pyx_v_record, __pyx_mstate_global->__pyx_n_b_END, __pyx_t_3); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 1206, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_7);
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
  }
  __pyx_L4:;

  /* "pysam/libcbcf.pyx":1179
 * 
 * 
 * cdef inline bcf_sync_end(VariantRecord record):             # <<<<<<<<<<<<<<
 *     cdef bcf_hdr_t *hdr = record.header.ptr
 *     cdef bcf_info_t *info
*/

  /* function exit code */
  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  __Pyx_TraceReturnValue(__pyx_r, 0, 0, __PYX_ERR(0, 1179, __pyx_L1_error));
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_7);
  __Pyx_XDECREF(__pyx_t_8);
  __Pyx_XDECREF(__pyx_t_10);
  __Pyx_TraceException(__pyx_lineno, 0, 0);
  #if CYTHON_USE_SYS_MONITORING
  __Pyx_TraceExceptionUnwind(0, 0);
  #else
  __Pyx_TraceReturnValue(NULL, 0, 0, __PYX_ERR(0, 1179, __pyx_L1_error));
  #endif
  __Pyx_AddTraceback("pysam.libcbcf.bcf_sync_end", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_PyMonitoring_ExitScope(0);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "pysam/libcbcf.pyx":1209
 * 
 * 
 * cdef inline int has_symbolic_allele(VariantRecord record):             # <<<<<<<<<<<<<<
 *     """Return index of first symbolic allele. 0 if no symbolic alleles."""
 * 
*/

static CYTHON_INLINE int __pyx_f_5pysam_7libcbcf_has_symbolic_allele(struct __pyx_obj_5pysam_7libcbcf_VariantRecord *__pyx_v_record) {
  long __pyx_v_i;
  char *__pyx_v_alt;
  int __pyx_r;
  __Pyx_TraceDeclarationsFunc
  uint32_t __pyx_t_1;
  uint32_t __pyx_t_2;
  long __pyx_t_3;
  int __pyx_t_4;
  int __pyx_t_5;
  Py_ssize_t __pyx_t_6;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_TraceFrameInit(((PyObject *)__pyx_mstate_global->__pyx_codeobj_tab[29]))
  __Pyx_TraceStartFunc("has_symbolic_allele", __pyx_f[0], 1209, 0, 0, 0, __PYX_ERR(0, 1209, __pyx_L1_error));

  /* "pysam/libcbcf.pyx":1212
 *     """Return index of first symbolic allele. 0 if no symbolic alleles."""
 * 
 *     for i in range(1, record.ptr.n_allele):             # <<<<<<<<<<<<<<
 *         alt = record.ptr.d.allele[i]
 *         if alt[0] == b'<' and alt[len(alt) - 1] == b'>':
*/
  __pyx_t_1 = __pyx_v_record->ptr->n_allele;
  __pyx_t_2 = __pyx_t_1;
  for (__pyx_t_3 = 1; __pyx_t_3 < __pyx_t_2; __pyx_t_3+=1) {
    __pyx_v_i = __pyx_t_3;

    /* "pysam/libcbcf.pyx":1213
 * 
 *     for i in range(1, record.ptr.n_allele):
 *         alt = record.ptr.d.allele[i]             # <<<<<<<<<<<<<<
 *         if alt[0] == b'<' and alt[len(alt) - 1] == b'>':
 *             return i
*/
    __pyx_v_alt = (__pyx_v_record->ptr->d.allele[__pyx_v_i]);

    /* "pysam/libcbcf.pyx":1214
 *     for i in range(1, record.ptr.n_allele):
 *         alt = record.ptr.d.allele[i]
 *         if alt[0] == b'<' and alt[len(alt) - 1] == b'>':             # <<<<<<<<<<<<<<
 *             return i
 * 
*/
    __pyx_t_5 = ((__pyx_v_alt[0]) == '<');
    if (__pyx_t_5) {
    } else {
      __pyx_t_4 = __pyx_t_5;
      goto __pyx_L6_bool_binop_done;
    }
    __pyx_t_6 = __Pyx_ssize_strlen(__pyx_v_alt); if (unlikely(__pyx_t_6 == ((Py_ssize_t)-1))) __PYX_ERR(0, 1214, __pyx_L1_error)
    __pyx_t_5 = ((__pyx_v_alt[(__pyx_t_6 - 1)]) == '>');
    __pyx_t_4 = __pyx_t_5;
    __pyx_L6_bool_binop_done:;
    if (__pyx_t_4) {

      /* "pysam/libcbcf.pyx":1215
 *         alt = record.ptr.d.allele[i]
 *         if alt[0] == b'<' and alt[len(alt) - 1] == b'>':
 *             return i             # <<<<<<<<<<<<<<
 * 
 *     return 0
*/
      __pyx_r = __pyx_v_i;
      __Pyx_TraceReturnCValue(__pyx_r, __Pyx_PyLong_From_int, 33, 0, __PYX_ERR(0, 1215, __pyx_L1_error));
      goto __pyx_L0;

      /* "pysam/libcbcf.pyx":1214
 *     for i in range(1, record.ptr.n_allele):
 *         alt = record.ptr.d.allele[i]
 *         if alt[0] == b'<' and alt[len(alt) - 1] == b'>':             # <<<<<<<<<<<<<<
 *             return i
 * 
*/
    }
  }

  /* "pysam/libcbcf.pyx":1217
 *             return i
 * 
 *     return 0             # <<<<<<<<<<<<<<
 * 
 * 
*/
  __pyx_r = 0;
  __Pyx_TraceReturnCValue(__pyx_r, __Pyx_PyLong_From_int, 35, 0, __PYX_ERR(0, 1217, __pyx_L1_error));
  goto __pyx_L0;

  /* "pysam/libcbcf.pyx":1209
 * 
 * 
 * cdef inline int has_symbolic_allele(VariantRecord record):             # <<<<<<<<<<<<<<
 *     """Return index of first symbolic allele. 0 if no symbolic alleles."""
 * 
*/

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_TraceException(__pyx_lineno, 0, 0);
  #if CYTHON_USE_SYS_MONITORING
  __Pyx_TraceExceptionUnwind(0, 0);
  #else
  __Pyx_TraceReturnValue(NULL, 0, 0, __PYX_ERR(0, 1209, __pyx_L1_error));
  #endif
  __Pyx_AddTraceback("pysam.libcbcf.has_symbolic_allele", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = -1;
  __pyx_L0:;
  __Pyx_PyMonitoring_ExitScope(0);
  return __pyx_r;
}

/* "pysam/libcbcf.pyx":1226
 * 
 * 
 * cdef bcf_header_remove_hrec(VariantHeader header, int i):             # <<<<<<<<<<<<<<
 *     if header is None:
 *         raise ValueError('header must not be None')
*/

static PyObject *__pyx_f_5pysam_7libcbcf_bcf_header_remove_hrec(struct __pyx_obj_5pysam_7libcbcf_VariantHeader *__pyx_v_header, int __pyx_v_i) {
  bcf_hdr_t *__pyx_v_hdr;
  bcf_hrec_t *__pyx_v_hrec;
  PyObject *__pyx_r = NULL;
  __Pyx_TraceDeclarationsFunc
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  PyObject *__pyx_t_4 = NULL;
  size_t __pyx_t_5;
  bcf_hdr_t *__pyx_t_6;
  int __pyx_t_7;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_TraceFrameInit(((PyObject *)__pyx_mstate_global->__pyx_codeobj_tab[30]))
  __Pyx_RefNannySetupContext("bcf_header_remove_hrec", 0);
  __Pyx_TraceStartFunc("bcf_header_remove_hrec", __pyx_f[0], 1226, 0, 0, 0, __PYX_ERR(0, 1226, __pyx_L1_error));

  /* "pysam/libcbcf.pyx":1227
 * 
 * cdef bcf_header_remove_hrec(VariantHeader header, int i):
 *     if header is None:             # <<<<<<<<<<<<<<
 *         raise ValueError('header must not be None')
 * 
*/
  __pyx_t_1 = (((PyObject *)__pyx_v_header) == Py_None);
  if (unlikely(__pyx_t_1)) {

    /* "pysam/libcbcf.pyx":1228
 * cdef bcf_header_remove_hrec(VariantHeader header, int i):
 *     if header is None:
 *         raise ValueError('header must not be None')             # <<<<<<<<<<<<<<
 * 
 *     cdef bcf_hdr_t *hdr = header.ptr
*/
    __pyx_t_3 = NULL;
    __Pyx_INCREF(__pyx_builtin_ValueError);
    __pyx_t_4 = __pyx_builtin_ValueError; 
    __pyx_t_5 = 1;
    {
      PyObject *__pyx_callargs[2] = {__pyx_t_3, __pyx_mstate_global->__pyx_kp_u_header_must_not_be_None};
      __pyx_t_2 = __Pyx_PyObject_FastCall(__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_2)) __PYX_ERR(0, 1228, __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, 1228, __pyx_L1_error)

    /* "pysam/libcbcf.pyx":1227
 * 
 * cdef bcf_header_remove_hrec(VariantHeader header, int i):
 *     if header is None:             # <<<<<<<<<<<<<<
 *         raise ValueError('header must not be None')
 * 
*/
  }

  /* "pysam/libcbcf.pyx":1230
 *         raise ValueError('header must not be None')
 * 
 *     cdef bcf_hdr_t *hdr = header.ptr             # <<<<<<<<<<<<<<
 * 
 *     if i < 0 or i >= hdr.nhrec:
*/
  __pyx_t_6 = __pyx_v_header->ptr;
  __pyx_v_hdr = __pyx_t_6;

  /* "pysam/libcbcf.pyx":1232
 *     cdef bcf_hdr_t *hdr = header.ptr
 * 
 *     if i < 0 or i >= hdr.nhrec:             # <<<<<<<<<<<<<<
 *         raise ValueError('Invalid header record index')
 * 
*/
  __pyx_t_7 = (__pyx_v_i < 0);
  if (!__pyx_t_7) {
  } else {
    __pyx_t_1 = __pyx_t_7;
    goto __pyx_L5_bool_binop_done;
  }
  __pyx_t_7 = (__pyx_v_i >= __pyx_v_hdr->nhrec);
  __pyx_t_1 = __pyx_t_7;
  __pyx_L5_bool_binop_done:;
  if (unlikely(__pyx_t_1)) {

    /* "pysam/libcbcf.pyx":1233
 * 
 *     if i < 0 or i >= hdr.nhrec:
 *         raise ValueError('Invalid header record index')             # <<<<<<<<<<<<<<
 * 
 *     cdef bcf_hrec_t *hrec = hdr.hrec[i]
*/
    __pyx_t_4 = NULL;
    __Pyx_INCREF(__pyx_builtin_ValueError);
    __pyx_t_3 = __pyx_builtin_ValueError; 
    __pyx_t_5 = 1;
    {
      PyObject *__pyx_callargs[2] = {__pyx_t_4, __pyx_mstate_global->__pyx_kp_u_Invalid_header_record_index};
      __pyx_t_2 = __Pyx_PyObject_FastCall(__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_2)) __PYX_ERR(0, 1233, __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, 1233, __pyx_L1_error)

    /* "pysam/libcbcf.pyx":1232
 *     cdef bcf_hdr_t *hdr = header.ptr
 * 
 *     if i < 0 or i >= hdr.nhrec:             # <<<<<<<<<<<<<<
 *         raise ValueError('Invalid header record index')
 * 
*/
  }

  /* "pysam/libcbcf.pyx":1235
 *         raise ValueError('Invalid header record index')
 * 
 *     cdef bcf_hrec_t *hrec = hdr.hrec[i]             # <<<<<<<<<<<<<<
 *     hdr.nhrec -= 1
 * 
*/
  __pyx_v_hrec = (__pyx_v_hdr->hrec[__pyx_v_i]);

  /* "pysam/libcbcf.pyx":1236
 * 
 *     cdef bcf_hrec_t *hrec = hdr.hrec[i]
 *     hdr.nhrec -= 1             # <<<<<<<<<<<<<<
 * 
 *     if i < hdr.nhrec:
*/
  __pyx_v_hdr->nhrec = (__pyx_v_hdr->nhrec - 1);

  /* "pysam/libcbcf.pyx":1238
 *     hdr.nhrec -= 1
 * 
 *     if i < hdr.nhrec:             # <<<<<<<<<<<<<<
 *         memmove(&hdr.hrec[i], &hdr.hrec[i+1], (hdr.nhrec-i)*sizeof(bcf_hrec_t*))
 * 
*/
  __pyx_t_1 = (__pyx_v_i < __pyx_v_hdr->nhrec);
  if (__pyx_t_1) {

    /* "pysam/libcbcf.pyx":1239
 * 
 *     if i < hdr.nhrec:
 *         memmove(&hdr.hrec[i], &hdr.hrec[i+1], (hdr.nhrec-i)*sizeof(bcf_hrec_t*))             # <<<<<<<<<<<<<<
 * 
 *     bcf_hrec_destroy(hrec)
*/
    (void)(memmove((&(__pyx_v_hdr->hrec[__pyx_v_i])), (&(__pyx_v_hdr->hrec[(__pyx_v_i + 1)])), ((__pyx_v_hdr->nhrec - __pyx_v_i) * (sizeof(bcf_hrec_t *)))));

    /* "pysam/libcbcf.pyx":1238
 *     hdr.nhrec -= 1
 * 
 *     if i < hdr.nhrec:             # <<<<<<<<<<<<<<
 *         memmove(&hdr.hrec[i], &hdr.hrec[i+1], (hdr.nhrec-i)*sizeof(bcf_hrec_t*))
 * 
*/
  }

  /* "pysam/libcbcf.pyx":1241
 *         memmove(&hdr.hrec[i], &hdr.hrec[i+1], (hdr.nhrec-i)*sizeof(bcf_hrec_t*))
 * 
 *     bcf_hrec_destroy(hrec)             # <<<<<<<<<<<<<<
 *     hdr.hrec[hdr.nhrec] = NULL
 *     hdr.dirty = 1
*/
  bcf_hrec_destroy(__pyx_v_hrec);

  /* "pysam/libcbcf.pyx":1242
 * 
 *     bcf_hrec_destroy(hrec)
 *     hdr.hrec[hdr.nhrec] = NULL             # <<<<<<<<<<<<<<
 *     hdr.dirty = 1
 * 
*/
  (__pyx_v_hdr->hrec[__pyx_v_hdr->nhrec]) = NULL;

  /* "pysam/libcbcf.pyx":1243
 *     bcf_hrec_destroy(hrec)
 *     hdr.hrec[hdr.nhrec] = NULL
 *     hdr.dirty = 1             # <<<<<<<<<<<<<<
 * 
 * 
*/
  __pyx_v_hdr->dirty = 1;

  /* "pysam/libcbcf.pyx":1226
 * 
 * 
 * cdef bcf_header_remove_hrec(VariantHeader header, int i):             # <<<<<<<<<<<<<<
 *     if header is None:
 *         raise ValueError('header must not be None')
*/

  /* function exit code */
  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  __Pyx_TraceReturnValue(__pyx_r, 0, 0, __PYX_ERR(0, 1226, __pyx_L1_error));
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_TraceException(__pyx_lineno, 0, 0);
  #if CYTHON_USE_SYS_MONITORING
  __Pyx_TraceExceptionUnwind(0, 0);
  #else
  __Pyx_TraceReturnValue(NULL, 0, 0, __PYX_ERR(0, 1226, __pyx_L1_error));
  #endif
  __Pyx_AddTraceback("pysam.libcbcf.bcf_header_remove_hrec", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_PyMonitoring_ExitScope(0);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "pysam/libcbcf.pyx":1251
 * cdef class VariantHeaderRecord(object):
 *     """header record from a :class:`VariantHeader` object"""
 *     def __init__(self, *args, **kwargs):             # <<<<<<<<<<<<<<
 *         raise TypeError('this class cannot be instantiated from Python')
 * 
*/

/* Python wrapper */
static int __pyx_pw_5pysam_7libcbcf_19VariantHeaderRecord_1__init__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static int __pyx_pw_5pysam_7libcbcf_19VariantHeaderRecord_1__init__(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("__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);
  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("__init__", __pyx_kwds) == -1)) return -1;
  }
  __Pyx_INCREF(__pyx_args);
  __pyx_v_args = __pyx_args;
  __pyx_r = __pyx_pf_5pysam_7libcbcf_19VariantHeaderRecord___init__(((struct __pyx_obj_5pysam_7libcbcf_VariantHeaderRecord *)__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_5pysam_7libcbcf_19VariantHeaderRecord___init__(CYTHON_UNUSED struct __pyx_obj_5pysam_7libcbcf_VariantHeaderRecord *__pyx_v_self, CYTHON_UNUSED PyObject *__pyx_v_args, CYTHON_UNUSED PyObject *__pyx_v_kwargs) {
  int __pyx_r;
  __Pyx_TraceDeclarationsFunc
  __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_TraceFrameInit(((PyObject *)__pyx_mstate_global->__pyx_codeobj_tab[31]))
  __Pyx_RefNannySetupContext("__init__", 0);
  __Pyx_TraceStartFunc("__init__", __pyx_f[0], 1251, 0, 0, 0, __PYX_ERR(0, 1251, __pyx_L1_error));

  /* "pysam/libcbcf.pyx":1252
 *     """header record from a :class:`VariantHeader` object"""
 *     def __init__(self, *args, **kwargs):
 *         raise TypeError('this class cannot be instantiated from Python')             # <<<<<<<<<<<<<<
 * 
 *     @property
*/
  __pyx_t_2 = NULL;
  __Pyx_INCREF(__pyx_builtin_TypeError);
  __pyx_t_3 = __pyx_builtin_TypeError; 
  __pyx_t_4 = 1;
  {
    PyObject *__pyx_callargs[2] = {__pyx_t_2, __pyx_mstate_global->__pyx_kp_u_this_class_cannot_be_instantiate};
    __pyx_t_1 = __Pyx_PyObject_FastCall(__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, 1252, __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, 1252, __pyx_L1_error)

  /* "pysam/libcbcf.pyx":1251
 * cdef class VariantHeaderRecord(object):
 *     """header record from a :class:`VariantHeader` object"""
 *     def __init__(self, *args, **kwargs):             # <<<<<<<<<<<<<<
 *         raise TypeError('this class cannot be instantiated from Python')
 * 
*/

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_TraceException(__pyx_lineno, 0, 0);
  #if CYTHON_USE_SYS_MONITORING
  __Pyx_TraceExceptionUnwind(0, 0);
  #else
  __Pyx_TraceReturnValue(NULL, 0, 0, __PYX_ERR(0, 1251, __pyx_L1_error));
  #endif
  __Pyx_AddTraceback("pysam.libcbcf.VariantHeaderRecord.__init__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = -1;
  __Pyx_PyMonitoring_ExitScope(0);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "pysam/libcbcf.pyx":1254
 *         raise TypeError('this class cannot be instantiated from Python')
 * 
 *     @property             # <<<<<<<<<<<<<<
 *     def type(self):
 *         """header type: FILTER, INFO, FORMAT, CONTIG, STRUCTURED, or GENERIC"""
*/

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

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

static PyObject *__pyx_pf_5pysam_7libcbcf_19VariantHeaderRecord_4type___get__(struct __pyx_obj_5pysam_7libcbcf_VariantHeaderRecord *__pyx_v_self) {
  bcf_hrec_t *__pyx_v_r;
  PyObject *__pyx_r = NULL;
  __Pyx_TraceDeclarationsFunc
  __Pyx_RefNannyDeclarations
  bcf_hrec_t *__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_TraceFrameInit(((PyObject *)__pyx_mstate_global->__pyx_codeobj_tab[32]))
  __Pyx_RefNannySetupContext("__get__", 0);
  __Pyx_TraceStartFunc("__get__", __pyx_f[0], 1254, 0, 0, 0, __PYX_ERR(0, 1254, __pyx_L1_error));

  /* "pysam/libcbcf.pyx":1257
 *     def type(self):
 *         """header type: FILTER, INFO, FORMAT, CONTIG, STRUCTURED, or GENERIC"""
 *         cdef bcf_hrec_t *r = self.ptr             # <<<<<<<<<<<<<<
 *         if not r:
 *             return None
*/
  __pyx_t_1 = __pyx_v_self->ptr;
  __pyx_v_r = __pyx_t_1;

  /* "pysam/libcbcf.pyx":1258
 *         """header type: FILTER, INFO, FORMAT, CONTIG, STRUCTURED, or GENERIC"""
 *         cdef bcf_hrec_t *r = self.ptr
 *         if not r:             # <<<<<<<<<<<<<<
 *             return None
 *         return METADATA_TYPES[r.type]
*/
  __pyx_t_2 = (!(__pyx_v_r != 0));
  if (__pyx_t_2) {

    /* "pysam/libcbcf.pyx":1259
 *         cdef bcf_hrec_t *r = self.ptr
 *         if not r:
 *             return None             # <<<<<<<<<<<<<<
 *         return METADATA_TYPES[r.type]
 * 
*/
    __Pyx_XDECREF(__pyx_r);
    __pyx_r = Py_None; __Pyx_INCREF(Py_None);
    goto __pyx_L0;

    /* "pysam/libcbcf.pyx":1258
 *         """header type: FILTER, INFO, FORMAT, CONTIG, STRUCTURED, or GENERIC"""
 *         cdef bcf_hrec_t *r = self.ptr
 *         if not r:             # <<<<<<<<<<<<<<
 *             return None
 *         return METADATA_TYPES[r.type]
*/
  }

  /* "pysam/libcbcf.pyx":1260
 *         if not r:
 *             return None
 *         return METADATA_TYPES[r.type]             # <<<<<<<<<<<<<<
 * 
 *     @property
*/
  __Pyx_XDECREF(__pyx_r);
  if (unlikely(__pyx_v_5pysam_7libcbcf_METADATA_TYPES == Py_None)) {
    PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable");
    __PYX_ERR(0, 1260, __pyx_L1_error)
  }
  __pyx_t_3 = __Pyx_GetItemInt_Tuple(__pyx_v_5pysam_7libcbcf_METADATA_TYPES, __pyx_v_r->type, int, 1, __Pyx_PyLong_From_int, 0, 1, 1, 1); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1260, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __pyx_r = __pyx_t_3;
  __pyx_t_3 = 0;
  __Pyx_TraceReturnValue(__pyx_r, 9, 0, __PYX_ERR(0, 1260, __pyx_L1_error));
  goto __pyx_L0;

  /* "pysam/libcbcf.pyx":1254
 *         raise TypeError('this class cannot be instantiated from Python')
 * 
 *     @property             # <<<<<<<<<<<<<<
 *     def type(self):
 *         """header type: FILTER, INFO, FORMAT, CONTIG, STRUCTURED, or GENERIC"""
*/

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_TraceException(__pyx_lineno, 0, 0);
  #if CYTHON_USE_SYS_MONITORING
  __Pyx_TraceExceptionUnwind(0, 0);
  #else
  __Pyx_TraceReturnValue(NULL, 0, 0, __PYX_ERR(0, 1254, __pyx_L1_error));
  #endif
  __Pyx_AddTraceback("pysam.libcbcf.VariantHeaderRecord.type.__get__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_PyMonitoring_ExitScope(0);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "pysam/libcbcf.pyx":1262
 *         return METADATA_TYPES[r.type]
 * 
 *     @property             # <<<<<<<<<<<<<<
 *     def key(self):
 *         """header key (the part before '=', in FILTER/INFO/FORMAT/contig/fileformat etc.)"""
*/

/* Python wrapper */
static PyObject *__pyx_pw_5pysam_7libcbcf_19VariantHeaderRecord_3key_1__get__(PyObject *__pyx_v_self); /*proto*/
static PyObject *__pyx_pw_5pysam_7libcbcf_19VariantHeaderRecord_3key_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_5pysam_7libcbcf_19VariantHeaderRecord_3key___get__(((struct __pyx_obj_5pysam_7libcbcf_VariantHeaderRecord *)__pyx_v_self));

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

static PyObject *__pyx_pf_5pysam_7libcbcf_19VariantHeaderRecord_3key___get__(struct __pyx_obj_5pysam_7libcbcf_VariantHeaderRecord *__pyx_v_self) {
  bcf_hrec_t *__pyx_v_r;
  PyObject *__pyx_r = NULL;
  __Pyx_TraceDeclarationsFunc
  __Pyx_RefNannyDeclarations
  bcf_hrec_t *__pyx_t_1;
  PyObject *__pyx_t_2 = NULL;
  int __pyx_t_3;
  int __pyx_t_4;
  PyObject *__pyx_t_5 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_TraceFrameInit(((PyObject *)__pyx_mstate_global->__pyx_codeobj_tab[33]))
  __Pyx_RefNannySetupContext("__get__", 0);
  __Pyx_TraceStartFunc("__get__", __pyx_f[0], 1262, 0, 0, 0, __PYX_ERR(0, 1262, __pyx_L1_error));

  /* "pysam/libcbcf.pyx":1265
 *     def key(self):
 *         """header key (the part before '=', in FILTER/INFO/FORMAT/contig/fileformat etc.)"""
 *         cdef bcf_hrec_t *r = self.ptr             # <<<<<<<<<<<<<<
 *         return bcf_str_cache_get_charptr(r.key) if r and r.key else None
 * 
*/
  __pyx_t_1 = __pyx_v_self->ptr;
  __pyx_v_r = __pyx_t_1;

  /* "pysam/libcbcf.pyx":1266
 *         """header key (the part before '=', in FILTER/INFO/FORMAT/contig/fileformat etc.)"""
 *         cdef bcf_hrec_t *r = self.ptr
 *         return bcf_str_cache_get_charptr(r.key) if r and r.key else None             # <<<<<<<<<<<<<<
 * 
 *     @property
*/
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_4 = (__pyx_v_r != 0);
  if (__pyx_t_4) {
  } else {
    __pyx_t_3 = __pyx_t_4;
    goto __pyx_L3_bool_binop_done;
  }
  __pyx_t_4 = (__pyx_v_r->key != 0);
  __pyx_t_3 = __pyx_t_4;
  __pyx_L3_bool_binop_done:;
  if (__pyx_t_3) {
    __pyx_t_5 = __pyx_f_5pysam_7libcbcf_bcf_str_cache_get_charptr(__pyx_v_r->key); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1266, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_5);
    __pyx_t_2 = __pyx_t_5;
    __pyx_t_5 = 0;
  } else {
    __Pyx_INCREF(Py_None);
    __pyx_t_2 = Py_None;
  }
  __pyx_r = __pyx_t_2;
  __pyx_t_2 = 0;
  __Pyx_TraceReturnValue(__pyx_r, 4, 0, __PYX_ERR(0, 1266, __pyx_L1_error));
  goto __pyx_L0;

  /* "pysam/libcbcf.pyx":1262
 *         return METADATA_TYPES[r.type]
 * 
 *     @property             # <<<<<<<<<<<<<<
 *     def key(self):
 *         """header key (the part before '=', in FILTER/INFO/FORMAT/contig/fileformat etc.)"""
*/

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_5);
  __Pyx_TraceException(__pyx_lineno, 0, 0);
  #if CYTHON_USE_SYS_MONITORING
  __Pyx_TraceExceptionUnwind(0, 0);
  #else
  __Pyx_TraceReturnValue(NULL, 0, 0, __PYX_ERR(0, 1262, __pyx_L1_error));
  #endif
  __Pyx_AddTraceback("pysam.libcbcf.VariantHeaderRecord.key.__get__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_PyMonitoring_ExitScope(0);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "pysam/libcbcf.pyx":1268
 *         return bcf_str_cache_get_charptr(r.key) if r and r.key else None
 * 
 *     @property             # <<<<<<<<<<<<<<
 *     def value(self):
 *         """header value.  Set only for generic lines, None for FILTER/INFO, etc."""
*/

/* Python wrapper */
static PyObject *__pyx_pw_5pysam_7libcbcf_19VariantHeaderRecord_5value_1__get__(PyObject *__pyx_v_self); /*proto*/
static PyObject *__pyx_pw_5pysam_7libcbcf_19VariantHeaderRecord_5value_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_5pysam_7libcbcf_19VariantHeaderRecord_5value___get__(((struct __pyx_obj_5pysam_7libcbcf_VariantHeaderRecord *)__pyx_v_self));

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

static PyObject *__pyx_pf_5pysam_7libcbcf_19VariantHeaderRecord_5value___get__(struct __pyx_obj_5pysam_7libcbcf_VariantHeaderRecord *__pyx_v_self) {
  bcf_hrec_t *__pyx_v_r;
  PyObject *__pyx_r = NULL;
  __Pyx_TraceDeclarationsFunc
  __Pyx_RefNannyDeclarations
  bcf_hrec_t *__pyx_t_1;
  PyObject *__pyx_t_2 = NULL;
  int __pyx_t_3;
  int __pyx_t_4;
  PyObject *__pyx_t_5 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_TraceFrameInit(((PyObject *)__pyx_mstate_global->__pyx_codeobj_tab[34]))
  __Pyx_RefNannySetupContext("__get__", 0);
  __Pyx_TraceStartFunc("__get__", __pyx_f[0], 1268, 0, 0, 0, __PYX_ERR(0, 1268, __pyx_L1_error));

  /* "pysam/libcbcf.pyx":1271
 *     def value(self):
 *         """header value.  Set only for generic lines, None for FILTER/INFO, etc."""
 *         cdef bcf_hrec_t *r = self.ptr             # <<<<<<<<<<<<<<
 *         return charptr_to_str(r.value) if r and r.value else None
 * 
*/
  __pyx_t_1 = __pyx_v_self->ptr;
  __pyx_v_r = __pyx_t_1;

  /* "pysam/libcbcf.pyx":1272
 *         """header value.  Set only for generic lines, None for FILTER/INFO, etc."""
 *         cdef bcf_hrec_t *r = self.ptr
 *         return charptr_to_str(r.value) if r and r.value else None             # <<<<<<<<<<<<<<
 * 
 *     @property
*/
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_4 = (__pyx_v_r != 0);
  if (__pyx_t_4) {
  } else {
    __pyx_t_3 = __pyx_t_4;
    goto __pyx_L3_bool_binop_done;
  }
  __pyx_t_4 = (__pyx_v_r->value != 0);
  __pyx_t_3 = __pyx_t_4;
  __pyx_L3_bool_binop_done:;
  if (__pyx_t_3) {
    __pyx_t_5 = __pyx_f_5pysam_9libcutils_charptr_to_str(__pyx_v_r->value, NULL); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1272, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_5);
    __pyx_t_2 = __pyx_t_5;
    __pyx_t_5 = 0;
  } else {
    __Pyx_INCREF(Py_None);
    __pyx_t_2 = Py_None;
  }
  __pyx_r = __pyx_t_2;
  __pyx_t_2 = 0;
  __Pyx_TraceReturnValue(__pyx_r, 4, 0, __PYX_ERR(0, 1272, __pyx_L1_error));
  goto __pyx_L0;

  /* "pysam/libcbcf.pyx":1268
 *         return bcf_str_cache_get_charptr(r.key) if r and r.key else None
 * 
 *     @property             # <<<<<<<<<<<<<<
 *     def value(self):
 *         """header value.  Set only for generic lines, None for FILTER/INFO, etc."""
*/

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_5);
  __Pyx_TraceException(__pyx_lineno, 0, 0);
  #if CYTHON_USE_SYS_MONITORING
  __Pyx_TraceExceptionUnwind(0, 0);
  #else
  __Pyx_TraceReturnValue(NULL, 0, 0, __PYX_ERR(0, 1268, __pyx_L1_error));
  #endif
  __Pyx_AddTraceback("pysam.libcbcf.VariantHeaderRecord.value.__get__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_PyMonitoring_ExitScope(0);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "pysam/libcbcf.pyx":1274
 *         return charptr_to_str(r.value) if r and r.value else None
 * 
 *     @property             # <<<<<<<<<<<<<<
 *     def attrs(self):
 *         """sequence of additional header attributes"""
*/

/* Python wrapper */
static PyObject *__pyx_pw_5pysam_7libcbcf_19VariantHeaderRecord_5attrs_1__get__(PyObject *__pyx_v_self); /*proto*/
static PyObject *__pyx_pw_5pysam_7libcbcf_19VariantHeaderRecord_5attrs_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_5pysam_7libcbcf_19VariantHeaderRecord_5attrs___get__(((struct __pyx_obj_5pysam_7libcbcf_VariantHeaderRecord *)__pyx_v_self));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}
static PyObject *__pyx_gb_5pysam_7libcbcf_19VariantHeaderRecord_5attrs_7__get___2generator32(__pyx_CoroutineObject *__pyx_generator, CYTHON_UNUSED PyThreadState *__pyx_tstate, PyObject *__pyx_sent_value); /* proto */

/* "pysam/libcbcf.pyx":1281
 *             return ()
 *         cdef int i
 *         return tuple((bcf_str_cache_get_charptr(r.keys[i]) if r.keys[i] else None,             # <<<<<<<<<<<<<<
 *                       charptr_to_str(r.vals[i]) if r.vals[i] else None)
 *                      for i in range(r.nkeys))
*/

static PyObject *__pyx_pf_5pysam_7libcbcf_19VariantHeaderRecord_5attrs_7__get___genexpr(PyObject *__pyx_self, int __pyx_genexpr_arg_0) {
  struct __pyx_obj_5pysam_7libcbcf___pyx_scope_struct_6_genexpr *__pyx_cur_scope;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("genexpr", 0);
  __pyx_cur_scope = (struct __pyx_obj_5pysam_7libcbcf___pyx_scope_struct_6_genexpr *)__pyx_tp_new_5pysam_7libcbcf___pyx_scope_struct_6_genexpr(__pyx_mstate_global->__pyx_ptype_5pysam_7libcbcf___pyx_scope_struct_6_genexpr, __pyx_mstate_global->__pyx_empty_tuple, NULL);
  if (unlikely(!__pyx_cur_scope)) {
    __pyx_cur_scope = ((struct __pyx_obj_5pysam_7libcbcf___pyx_scope_struct_6_genexpr *)Py_None);
    __Pyx_INCREF(Py_None);
    __PYX_ERR(0, 1281, __pyx_L1_error)
  } else {
    __Pyx_GOTREF((PyObject *)__pyx_cur_scope);
  }
  __pyx_cur_scope->__pyx_outer_scope = (struct __pyx_obj_5pysam_7libcbcf___pyx_scope_struct_5___get__ *) __pyx_self;
  __Pyx_INCREF((PyObject *)__pyx_cur_scope->__pyx_outer_scope);
  __Pyx_GIVEREF((PyObject *)__pyx_cur_scope->__pyx_outer_scope);
  __pyx_cur_scope->__pyx_genexpr_arg_0 = __pyx_genexpr_arg_0;
  {
    __pyx_CoroutineObject *gen = __Pyx_Generator_New((__pyx_coroutine_body_t) __pyx_gb_5pysam_7libcbcf_19VariantHeaderRecord_5attrs_7__get___2generator32, ((PyObject *)__pyx_mstate_global->__pyx_codeobj_tab[35]), (PyObject *) __pyx_cur_scope, __pyx_mstate_global->__pyx_n_u_genexpr, __pyx_mstate_global->__pyx_n_u_VariantHeaderRecord___get___loca, __pyx_mstate_global->__pyx_n_u_pysam_libcbcf); if (unlikely(!gen)) __PYX_ERR(0, 1281, __pyx_L1_error)
    __Pyx_DECREF(__pyx_cur_scope);
    __Pyx_RefNannyFinishContext();
    return (PyObject *) gen;
  }

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_AddTraceback("pysam.libcbcf.VariantHeaderRecord.attrs.__get__.genexpr", __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_5pysam_7libcbcf_19VariantHeaderRecord_5attrs_7__get___2generator32(__pyx_CoroutineObject *__pyx_generator, CYTHON_UNUSED PyThreadState *__pyx_tstate, PyObject *__pyx_sent_value) /* generator body */
{
  struct __pyx_obj_5pysam_7libcbcf___pyx_scope_struct_6_genexpr *__pyx_cur_scope = ((struct __pyx_obj_5pysam_7libcbcf___pyx_scope_struct_6_genexpr *)__pyx_generator->closure);
  PyObject *__pyx_r = NULL;
  __Pyx_TraceDeclarationsGen
  int __pyx_t_1;
  int __pyx_t_2;
  int __pyx_t_3;
  PyObject *__pyx_t_4 = NULL;
  int __pyx_t_5;
  PyObject *__pyx_t_6 = NULL;
  PyObject *__pyx_t_7 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("genexpr", 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_TraceStartGen("genexpr", __pyx_f[0], 1281, 0, 0, 0, __PYX_ERR(0, 1281, __pyx_L1_error));
    __Pyx_TraceReturnValue(Py_None, 0, 0, __PYX_ERR(0, 1281, __pyx_L1_error));
    __Pyx_RefNannyFinishContext();
    return NULL;
  }
  __pyx_L3_first_run:;
  __Pyx_TraceStartGen("genexpr", __pyx_f[0], 1281, 0, 0, 0, __PYX_ERR(0, 1281, __pyx_L1_error));
  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, 1281, __pyx_L1_error)
  }

  /* "pysam/libcbcf.pyx":1283
 *         return tuple((bcf_str_cache_get_charptr(r.keys[i]) if r.keys[i] else None,
 *                       charptr_to_str(r.vals[i]) if r.vals[i] else None)
 *                      for i in range(r.nkeys))             # <<<<<<<<<<<<<<
 * 
 *     def __len__(self):
*/
  __pyx_t_1 = __pyx_cur_scope->__pyx_genexpr_arg_0;
  __pyx_t_2 = __pyx_t_1;
  for (__pyx_t_3 = 0; __pyx_t_3 < __pyx_t_2; __pyx_t_3+=1) {
    __pyx_cur_scope->__pyx_v_i = __pyx_t_3;

    /* "pysam/libcbcf.pyx":1281
 *             return ()
 *         cdef int i
 *         return tuple((bcf_str_cache_get_charptr(r.keys[i]) if r.keys[i] else None,             # <<<<<<<<<<<<<<
 *                       charptr_to_str(r.vals[i]) if r.vals[i] else None)
 *                      for i in range(r.nkeys))
*/
    __pyx_t_5 = ((__pyx_cur_scope->__pyx_outer_scope->__pyx_v_r->keys[__pyx_cur_scope->__pyx_v_i]) != 0);
    if (__pyx_t_5) {
      __pyx_t_6 = __pyx_f_5pysam_7libcbcf_bcf_str_cache_get_charptr((__pyx_cur_scope->__pyx_outer_scope->__pyx_v_r->keys[__pyx_cur_scope->__pyx_v_i])); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 1281, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_6);
      __pyx_t_4 = __pyx_t_6;
      __pyx_t_6 = 0;
    } else {
      __Pyx_INCREF(Py_None);
      __pyx_t_4 = Py_None;
    }

    /* "pysam/libcbcf.pyx":1282
 *         cdef int i
 *         return tuple((bcf_str_cache_get_charptr(r.keys[i]) if r.keys[i] else None,
 *                       charptr_to_str(r.vals[i]) if r.vals[i] else None)             # <<<<<<<<<<<<<<
 *                      for i in range(r.nkeys))
 * 
*/
    __pyx_t_5 = ((__pyx_cur_scope->__pyx_outer_scope->__pyx_v_r->vals[__pyx_cur_scope->__pyx_v_i]) != 0);
    if (__pyx_t_5) {
      __pyx_t_7 = __pyx_f_5pysam_9libcutils_charptr_to_str((__pyx_cur_scope->__pyx_outer_scope->__pyx_v_r->vals[__pyx_cur_scope->__pyx_v_i]), NULL); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 1282, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_7);
      __pyx_t_6 = __pyx_t_7;
      __pyx_t_7 = 0;
    } else {
      __Pyx_INCREF(Py_None);
      __pyx_t_6 = Py_None;
    }

    /* "pysam/libcbcf.pyx":1281
 *             return ()
 *         cdef int i
 *         return tuple((bcf_str_cache_get_charptr(r.keys[i]) if r.keys[i] else None,             # <<<<<<<<<<<<<<
 *                       charptr_to_str(r.vals[i]) if r.vals[i] else None)
 *                      for i in range(r.nkeys))
*/
    __pyx_t_7 = PyTuple_New(2); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 1281, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_7);
    __Pyx_GIVEREF(__pyx_t_4);
    if (__Pyx_PyTuple_SET_ITEM(__pyx_t_7, 0, __pyx_t_4) != (0)) __PYX_ERR(0, 1281, __pyx_L1_error);
    __Pyx_GIVEREF(__pyx_t_6);
    if (__Pyx_PyTuple_SET_ITEM(__pyx_t_7, 1, __pyx_t_6) != (0)) __PYX_ERR(0, 1281, __pyx_L1_error);
    __pyx_t_4 = 0;
    __pyx_t_6 = 0;
    __pyx_r = __pyx_t_7;
    __pyx_t_7 = 0;
    __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_TraceYield(__pyx_r, 0, __PYX_ERR(0, 1281, __pyx_L1_error));
    __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_TraceResumeGen("genexpr", __pyx_f[0], 1281, 0, __PYX_ERR(0, 1281, __pyx_L1_error));
    __pyx_t_1 = __pyx_cur_scope->__pyx_t_0;
    __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, 1281, __pyx_L1_error)
  }
  CYTHON_MAYBE_UNUSED_VAR(__pyx_cur_scope);
  __Pyx_TraceReturnValue(Py_None, 0, 0, __PYX_ERR(0, 1281, __pyx_L1_error));

  /* function exit code */
  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_XDECREF(__pyx_t_6);
  __Pyx_XDECREF(__pyx_t_7);
  if (__Pyx_PyErr_Occurred()) {
    __Pyx_TraceException(__pyx_lineno, 0, 0);
    __Pyx_Generator_Replace_StopIteration(0);
    __Pyx_AddTraceback("genexpr", __pyx_clineno, __pyx_lineno, __pyx_filename);
    __Pyx_TraceExceptionUnwind(0, 0);
  }
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_PyMonitoring_ExitScope(0);
  #if !CYTHON_USE_EXC_INFO_STACK
  __Pyx_Coroutine_ResetAndClearException(__pyx_generator);
  #endif
  __pyx_generator->resume_label = -1;
  __Pyx_Coroutine_clear((PyObject*)__pyx_generator);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "pysam/libcbcf.pyx":1274
 *         return charptr_to_str(r.value) if r and r.value else None
 * 
 *     @property             # <<<<<<<<<<<<<<
 *     def attrs(self):
 *         """sequence of additional header attributes"""
*/

static PyObject *__pyx_pf_5pysam_7libcbcf_19VariantHeaderRecord_5attrs___get__(struct __pyx_obj_5pysam_7libcbcf_VariantHeaderRecord *__pyx_v_self) {
  struct __pyx_obj_5pysam_7libcbcf___pyx_scope_struct_5___get__ *__pyx_cur_scope;
  PyObject *__pyx_gb_5pysam_7libcbcf_19VariantHeaderRecord_5attrs_7__get___2generator32 = 0;
  PyObject *__pyx_r = NULL;
  __Pyx_TraceDeclarationsFunc
  __Pyx_RefNannyDeclarations
  bcf_hrec_t *__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_TraceFrameInit(((PyObject *)__pyx_mstate_global->__pyx_codeobj_tab[36]))
  __Pyx_RefNannySetupContext("__get__", 0);
  __pyx_cur_scope = (struct __pyx_obj_5pysam_7libcbcf___pyx_scope_struct_5___get__ *)__pyx_tp_new_5pysam_7libcbcf___pyx_scope_struct_5___get__(__pyx_mstate_global->__pyx_ptype_5pysam_7libcbcf___pyx_scope_struct_5___get__, __pyx_mstate_global->__pyx_empty_tuple, NULL);
  if (unlikely(!__pyx_cur_scope)) {
    __pyx_cur_scope = ((struct __pyx_obj_5pysam_7libcbcf___pyx_scope_struct_5___get__ *)Py_None);
    __Pyx_INCREF(Py_None);
    __PYX_ERR(0, 1274, __pyx_L1_error)
  } else {
    __Pyx_GOTREF((PyObject *)__pyx_cur_scope);
  }
  __Pyx_TraceStartFunc("__get__", __pyx_f[0], 1274, 0, 0, 0, __PYX_ERR(0, 1274, __pyx_L1_error));

  /* "pysam/libcbcf.pyx":1277
 *     def attrs(self):
 *         """sequence of additional header attributes"""
 *         cdef bcf_hrec_t *r = self.ptr             # <<<<<<<<<<<<<<
 *         if not r:
 *             return ()
*/
  __pyx_t_1 = __pyx_v_self->ptr;
  __pyx_cur_scope->__pyx_v_r = __pyx_t_1;

  /* "pysam/libcbcf.pyx":1278
 *         """sequence of additional header attributes"""
 *         cdef bcf_hrec_t *r = self.ptr
 *         if not r:             # <<<<<<<<<<<<<<
 *             return ()
 *         cdef int i
*/
  __pyx_t_2 = (!(__pyx_cur_scope->__pyx_v_r != 0));
  if (__pyx_t_2) {

    /* "pysam/libcbcf.pyx":1279
 *         cdef bcf_hrec_t *r = self.ptr
 *         if not r:
 *             return ()             # <<<<<<<<<<<<<<
 *         cdef int i
 *         return tuple((bcf_str_cache_get_charptr(r.keys[i]) if r.keys[i] else None,
*/
    __Pyx_XDECREF(__pyx_r);
    __Pyx_INCREF(__pyx_mstate_global->__pyx_empty_tuple);
    __pyx_r = __pyx_mstate_global->__pyx_empty_tuple;
    __Pyx_TraceReturnValue(__pyx_r, 7, 0, __PYX_ERR(0, 1279, __pyx_L1_error));
    goto __pyx_L0;

    /* "pysam/libcbcf.pyx":1278
 *         """sequence of additional header attributes"""
 *         cdef bcf_hrec_t *r = self.ptr
 *         if not r:             # <<<<<<<<<<<<<<
 *             return ()
 *         cdef int i
*/
  }

  /* "pysam/libcbcf.pyx":1281
 *             return ()
 *         cdef int i
 *         return tuple((bcf_str_cache_get_charptr(r.keys[i]) if r.keys[i] else None,             # <<<<<<<<<<<<<<
 *                       charptr_to_str(r.vals[i]) if r.vals[i] else None)
 *                      for i in range(r.nkeys))
*/
  __Pyx_XDECREF(__pyx_r);

  /* "pysam/libcbcf.pyx":1283
 *         return tuple((bcf_str_cache_get_charptr(r.keys[i]) if r.keys[i] else None,
 *                       charptr_to_str(r.vals[i]) if r.vals[i] else None)
 *                      for i in range(r.nkeys))             # <<<<<<<<<<<<<<
 * 
 *     def __len__(self):
*/
  __pyx_t_3 = __pyx_pf_5pysam_7libcbcf_19VariantHeaderRecord_5attrs_7__get___genexpr(((PyObject*)__pyx_cur_scope), __pyx_cur_scope->__pyx_v_r->nkeys); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1281, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);

  /* "pysam/libcbcf.pyx":1281
 *             return ()
 *         cdef int i
 *         return tuple((bcf_str_cache_get_charptr(r.keys[i]) if r.keys[i] else None,             # <<<<<<<<<<<<<<
 *                       charptr_to_str(r.vals[i]) if r.vals[i] else None)
 *                      for i in range(r.nkeys))
*/
  __pyx_t_4 = __Pyx_PySequence_Tuple(__pyx_t_3); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1281, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  __pyx_r = __pyx_t_4;
  __pyx_t_4 = 0;
  __Pyx_TraceReturnValue(__pyx_r, 9, 0, __PYX_ERR(0, 1281, __pyx_L1_error));
  goto __pyx_L0;

  /* "pysam/libcbcf.pyx":1274
 *         return charptr_to_str(r.value) if r and r.value else None
 * 
 *     @property             # <<<<<<<<<<<<<<
 *     def attrs(self):
 *         """sequence of additional header attributes"""
*/

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_TraceException(__pyx_lineno, 0, 0);
  #if CYTHON_USE_SYS_MONITORING
  __Pyx_TraceExceptionUnwind(0, 0);
  #else
  __Pyx_TraceReturnValue(NULL, 0, 0, __PYX_ERR(0, 1274, __pyx_L1_error));
  #endif
  __Pyx_AddTraceback("pysam.libcbcf.VariantHeaderRecord.attrs.__get__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_gb_5pysam_7libcbcf_19VariantHeaderRecord_5attrs_7__get___2generator32);
  __Pyx_DECREF((PyObject *)__pyx_cur_scope);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_PyMonitoring_ExitScope(0);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "pysam/libcbcf.pyx":1285
 *                      for i in range(r.nkeys))
 * 
 *     def __len__(self):             # <<<<<<<<<<<<<<
 *         cdef bcf_hrec_t *r = self.ptr
 *         return r.nkeys if r else 0
*/

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

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

static Py_ssize_t __pyx_pf_5pysam_7libcbcf_19VariantHeaderRecord_2__len__(struct __pyx_obj_5pysam_7libcbcf_VariantHeaderRecord *__pyx_v_self) {
  bcf_hrec_t *__pyx_v_r;
  Py_ssize_t __pyx_r;
  __Pyx_TraceDeclarationsFunc
  bcf_hrec_t *__pyx_t_1;
  Py_ssize_t __pyx_t_2;
  int __pyx_t_3;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_TraceFrameInit(((PyObject *)__pyx_mstate_global->__pyx_codeobj_tab[37]))
  __Pyx_TraceStartFunc("__len__", __pyx_f[0], 1285, 0, 0, 0, __PYX_ERR(0, 1285, __pyx_L1_error));

  /* "pysam/libcbcf.pyx":1286
 * 
 *     def __len__(self):
 *         cdef bcf_hrec_t *r = self.ptr             # <<<<<<<<<<<<<<
 *         return r.nkeys if r else 0
 * 
*/
  __pyx_t_1 = __pyx_v_self->ptr;
  __pyx_v_r = __pyx_t_1;

  /* "pysam/libcbcf.pyx":1287
 *     def __len__(self):
 *         cdef bcf_hrec_t *r = self.ptr
 *         return r.nkeys if r else 0             # <<<<<<<<<<<<<<
 * 
 *     def __bool__(self):
*/
  __pyx_t_3 = (__pyx_v_r != 0);
  if (__pyx_t_3) {
    __pyx_t_2 = __pyx_v_r->nkeys;
  } else {
    __pyx_t_2 = 0;
  }
  __pyx_r = __pyx_t_2;
  __Pyx_TraceReturnCValue(__pyx_r, PyLong_FromSsize_t, 4, 0, __PYX_ERR(0, 1287, __pyx_L1_error));
  goto __pyx_L0;

  /* "pysam/libcbcf.pyx":1285
 *                      for i in range(r.nkeys))
 * 
 *     def __len__(self):             # <<<<<<<<<<<<<<
 *         cdef bcf_hrec_t *r = self.ptr
 *         return r.nkeys if r else 0
*/

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_TraceException(__pyx_lineno, 0, 0);
  #if CYTHON_USE_SYS_MONITORING
  __Pyx_TraceExceptionUnwind(0, 0);
  #else
  __Pyx_TraceReturnValue(NULL, 0, 0, __PYX_ERR(0, 1285, __pyx_L1_error));
  #endif
  __Pyx_AddTraceback("pysam.libcbcf.VariantHeaderRecord.__len__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = -1;
  __pyx_L0:;
  __Pyx_PyMonitoring_ExitScope(0);
  return __pyx_r;
}

/* "pysam/libcbcf.pyx":1289
 *         return r.nkeys if r else 0
 * 
 *     def __bool__(self):             # <<<<<<<<<<<<<<
 *         cdef bcf_hrec_t *r = self.ptr
 *         return r != NULL and r.nkeys != 0
*/

/* Python wrapper */
static int __pyx_pw_5pysam_7libcbcf_19VariantHeaderRecord_5__bool__(PyObject *__pyx_v_self); /*proto*/
static int __pyx_pw_5pysam_7libcbcf_19VariantHeaderRecord_5__bool__(PyObject *__pyx_v_self) {
  CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__bool__ (wrapper)", 0);
  __pyx_kwvalues = __Pyx_KwValues_VARARGS(__pyx_args, __pyx_nargs);
  __pyx_r = __pyx_pf_5pysam_7libcbcf_19VariantHeaderRecord_4__bool__(((struct __pyx_obj_5pysam_7libcbcf_VariantHeaderRecord *)__pyx_v_self));

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

static int __pyx_pf_5pysam_7libcbcf_19VariantHeaderRecord_4__bool__(struct __pyx_obj_5pysam_7libcbcf_VariantHeaderRecord *__pyx_v_self) {
  bcf_hrec_t *__pyx_v_r;
  int __pyx_r;
  __Pyx_TraceDeclarationsFunc
  bcf_hrec_t *__pyx_t_1;
  int __pyx_t_2;
  int __pyx_t_3;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_TraceFrameInit(((PyObject *)__pyx_mstate_global->__pyx_codeobj_tab[38]))
  __Pyx_TraceStartFunc("__bool__", __pyx_f[0], 1289, 0, 0, 0, __PYX_ERR(0, 1289, __pyx_L1_error));

  /* "pysam/libcbcf.pyx":1290
 * 
 *     def __bool__(self):
 *         cdef bcf_hrec_t *r = self.ptr             # <<<<<<<<<<<<<<
 *         return r != NULL and r.nkeys != 0
 * 
*/
  __pyx_t_1 = __pyx_v_self->ptr;
  __pyx_v_r = __pyx_t_1;

  /* "pysam/libcbcf.pyx":1291
 *     def __bool__(self):
 *         cdef bcf_hrec_t *r = self.ptr
 *         return r != NULL and r.nkeys != 0             # <<<<<<<<<<<<<<
 * 
 *     def __getitem__(self, key):
*/
  __pyx_t_3 = (__pyx_v_r != NULL);
  if (__pyx_t_3) {
  } else {
    __pyx_t_2 = __pyx_t_3;
    goto __pyx_L3_bool_binop_done;
  }
  __pyx_t_3 = (__pyx_v_r->nkeys != 0);
  __pyx_t_2 = __pyx_t_3;
  __pyx_L3_bool_binop_done:;
  __pyx_r = __pyx_t_2;
  __Pyx_TraceReturnCValue(__pyx_r, __Pyx_PyLong_From_int, 4, 0, __PYX_ERR(0, 1291, __pyx_L1_error));
  goto __pyx_L0;

  /* "pysam/libcbcf.pyx":1289
 *         return r.nkeys if r else 0
 * 
 *     def __bool__(self):             # <<<<<<<<<<<<<<
 *         cdef bcf_hrec_t *r = self.ptr
 *         return r != NULL and r.nkeys != 0
*/

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_TraceException(__pyx_lineno, 0, 0);
  #if CYTHON_USE_SYS_MONITORING
  __Pyx_TraceExceptionUnwind(0, 0);
  #else
  __Pyx_TraceReturnValue(NULL, 0, 0, __PYX_ERR(0, 1289, __pyx_L1_error));
  #endif
  __Pyx_AddTraceback("pysam.libcbcf.VariantHeaderRecord.__bool__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = -1;
  __pyx_L0:;
  __Pyx_PyMonitoring_ExitScope(0);
  return __pyx_r;
}

/* "pysam/libcbcf.pyx":1293
 *         return r != NULL and r.nkeys != 0
 * 
 *     def __getitem__(self, key):             # <<<<<<<<<<<<<<
 *         """get attribute value"""
 *         cdef bcf_hrec_t *r = self.ptr
*/

/* Python wrapper */
static PyObject *__pyx_pw_5pysam_7libcbcf_19VariantHeaderRecord_7__getitem__(PyObject *__pyx_v_self, PyObject *__pyx_v_key); /*proto*/
PyDoc_STRVAR(__pyx_doc_5pysam_7libcbcf_19VariantHeaderRecord_6__getitem__, "VariantHeaderRecord.__getitem__(self, key)\n\nget attribute value");
#if CYTHON_UPDATE_DESCRIPTOR_DOC
struct wrapperbase __pyx_wrapperbase_5pysam_7libcbcf_19VariantHeaderRecord_6__getitem__;
#endif
static PyObject *__pyx_pw_5pysam_7libcbcf_19VariantHeaderRecord_7__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_5pysam_7libcbcf_19VariantHeaderRecord_6__getitem__(((struct __pyx_obj_5pysam_7libcbcf_VariantHeaderRecord *)__pyx_v_self), ((PyObject *)__pyx_v_key));

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

static PyObject *__pyx_pf_5pysam_7libcbcf_19VariantHeaderRecord_6__getitem__(struct __pyx_obj_5pysam_7libcbcf_VariantHeaderRecord *__pyx_v_self, PyObject *__pyx_v_key) {
  bcf_hrec_t *__pyx_v_r;
  int __pyx_v_i;
  PyObject *__pyx_v_bkey = NULL;
  PyObject *__pyx_r = NULL;
  __Pyx_TraceDeclarationsFunc
  __Pyx_RefNannyDeclarations
  bcf_hrec_t *__pyx_t_1;
  int __pyx_t_2;
  PyObject *__pyx_t_3 = NULL;
  int __pyx_t_4;
  int __pyx_t_5;
  int __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_TraceFrameInit(((PyObject *)__pyx_mstate_global->__pyx_codeobj_tab[39]))
  __Pyx_RefNannySetupContext("__getitem__", 0);
  __Pyx_TraceStartFunc("__getitem__", __pyx_f[0], 1293, 0, 0, 0, __PYX_ERR(0, 1293, __pyx_L1_error));

  /* "pysam/libcbcf.pyx":1295
 *     def __getitem__(self, key):
 *         """get attribute value"""
 *         cdef bcf_hrec_t *r = self.ptr             # <<<<<<<<<<<<<<
 *         cdef int i
 *         if r:
*/
  __pyx_t_1 = __pyx_v_self->ptr;
  __pyx_v_r = __pyx_t_1;

  /* "pysam/libcbcf.pyx":1297
 *         cdef bcf_hrec_t *r = self.ptr
 *         cdef int i
 *         if r:             # <<<<<<<<<<<<<<
 *             bkey = force_bytes(key)
 *             for i in range(r.nkeys):
*/
  __pyx_t_2 = (__pyx_v_r != 0);
  if (__pyx_t_2) {

    /* "pysam/libcbcf.pyx":1298
 *         cdef int i
 *         if r:
 *             bkey = force_bytes(key)             # <<<<<<<<<<<<<<
 *             for i in range(r.nkeys):
 *                 if r.keys[i] and r.keys[i] == bkey:
*/
    __pyx_t_3 = __pyx_f_5pysam_9libcutils_force_bytes(__pyx_v_key, NULL); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1298, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __pyx_v_bkey = ((PyObject*)__pyx_t_3);
    __pyx_t_3 = 0;

    /* "pysam/libcbcf.pyx":1299
 *         if r:
 *             bkey = force_bytes(key)
 *             for i in range(r.nkeys):             # <<<<<<<<<<<<<<
 *                 if r.keys[i] and r.keys[i] == bkey:
 *                     return charptr_to_str(r.vals[i]) if r.vals[i] else None
*/
    __pyx_t_4 = __pyx_v_r->nkeys;
    __pyx_t_5 = __pyx_t_4;
    for (__pyx_t_6 = 0; __pyx_t_6 < __pyx_t_5; __pyx_t_6+=1) {
      __pyx_v_i = __pyx_t_6;

      /* "pysam/libcbcf.pyx":1300
 *             bkey = force_bytes(key)
 *             for i in range(r.nkeys):
 *                 if r.keys[i] and r.keys[i] == bkey:             # <<<<<<<<<<<<<<
 *                     return charptr_to_str(r.vals[i]) if r.vals[i] else None
 *         raise KeyError('cannot find metadata key')
*/
      __pyx_t_7 = ((__pyx_v_r->keys[__pyx_v_i]) != 0);
      if (__pyx_t_7) {
      } else {
        __pyx_t_2 = __pyx_t_7;
        goto __pyx_L7_bool_binop_done;
      }
      __pyx_t_3 = __Pyx_PyBytes_FromString((__pyx_v_r->keys[__pyx_v_i])); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1300, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_3);
      __pyx_t_7 = (__Pyx_PyBytes_Equals(__pyx_t_3, __pyx_v_bkey, Py_EQ)); if (unlikely((__pyx_t_7 < 0))) __PYX_ERR(0, 1300, __pyx_L1_error)
      __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
      __pyx_t_2 = __pyx_t_7;
      __pyx_L7_bool_binop_done:;
      if (__pyx_t_2) {

        /* "pysam/libcbcf.pyx":1301
 *             for i in range(r.nkeys):
 *                 if r.keys[i] and r.keys[i] == bkey:
 *                     return charptr_to_str(r.vals[i]) if r.vals[i] else None             # <<<<<<<<<<<<<<
 *         raise KeyError('cannot find metadata key')
 * 
*/
        __Pyx_XDECREF(__pyx_r);
        __pyx_t_2 = ((__pyx_v_r->vals[__pyx_v_i]) != 0);
        if (__pyx_t_2) {
          __pyx_t_8 = __pyx_f_5pysam_9libcutils_charptr_to_str((__pyx_v_r->vals[__pyx_v_i]), NULL); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 1301, __pyx_L1_error)
          __Pyx_GOTREF(__pyx_t_8);
          __pyx_t_3 = __pyx_t_8;
          __pyx_t_8 = 0;
        } else {
          __Pyx_INCREF(Py_None);
          __pyx_t_3 = Py_None;
        }
        __pyx_r = __pyx_t_3;
        __pyx_t_3 = 0;
        __Pyx_TraceReturnValue(__pyx_r, 28, 0, __PYX_ERR(0, 1301, __pyx_L1_error));
        goto __pyx_L0;

        /* "pysam/libcbcf.pyx":1300
 *             bkey = force_bytes(key)
 *             for i in range(r.nkeys):
 *                 if r.keys[i] and r.keys[i] == bkey:             # <<<<<<<<<<<<<<
 *                     return charptr_to_str(r.vals[i]) if r.vals[i] else None
 *         raise KeyError('cannot find metadata key')
*/
      }
    }

    /* "pysam/libcbcf.pyx":1297
 *         cdef bcf_hrec_t *r = self.ptr
 *         cdef int i
 *         if r:             # <<<<<<<<<<<<<<
 *             bkey = force_bytes(key)
 *             for i in range(r.nkeys):
*/
  }

  /* "pysam/libcbcf.pyx":1302
 *                 if r.keys[i] and r.keys[i] == bkey:
 *                     return charptr_to_str(r.vals[i]) if r.vals[i] else None
 *         raise KeyError('cannot find metadata key')             # <<<<<<<<<<<<<<
 * 
 *     def __iter__(self):
*/
  __pyx_t_8 = NULL;
  __Pyx_INCREF(__pyx_builtin_KeyError);
  __pyx_t_9 = __pyx_builtin_KeyError; 
  __pyx_t_10 = 1;
  {
    PyObject *__pyx_callargs[2] = {__pyx_t_8, __pyx_mstate_global->__pyx_kp_u_cannot_find_metadata_key};
    __pyx_t_3 = __Pyx_PyObject_FastCall(__pyx_t_9, __pyx_callargs+__pyx_t_10, (2-__pyx_t_10) | (__pyx_t_10*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
    __Pyx_XDECREF(__pyx_t_8); __pyx_t_8 = 0;
    __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
    if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1302, __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, 1302, __pyx_L1_error)

  /* "pysam/libcbcf.pyx":1293
 *         return r != NULL and r.nkeys != 0
 * 
 *     def __getitem__(self, key):             # <<<<<<<<<<<<<<
 *         """get attribute value"""
 *         cdef bcf_hrec_t *r = self.ptr
*/

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_8);
  __Pyx_XDECREF(__pyx_t_9);
  __Pyx_TraceException(__pyx_lineno, 0, 0);
  #if CYTHON_USE_SYS_MONITORING
  __Pyx_TraceExceptionUnwind(0, 0);
  #else
  __Pyx_TraceReturnValue(NULL, 0, 0, __PYX_ERR(0, 1293, __pyx_L1_error));
  #endif
  __Pyx_AddTraceback("pysam.libcbcf.VariantHeaderRecord.__getitem__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_bkey);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_PyMonitoring_ExitScope(0);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}
static PyObject *__pyx_gb_5pysam_7libcbcf_19VariantHeaderRecord_10generator(__pyx_CoroutineObject *__pyx_generator, CYTHON_UNUSED PyThreadState *__pyx_tstate, PyObject *__pyx_sent_value); /* proto */

/* "pysam/libcbcf.pyx":1304
 *         raise KeyError('cannot find metadata key')
 * 
 *     def __iter__(self):             # <<<<<<<<<<<<<<
 *         cdef bcf_hrec_t *r = self.ptr
 *         if not r:
*/

/* Python wrapper */
static PyObject *__pyx_pw_5pysam_7libcbcf_19VariantHeaderRecord_9__iter__(PyObject *__pyx_v_self); /*proto*/
static PyObject *__pyx_pw_5pysam_7libcbcf_19VariantHeaderRecord_9__iter__(PyObject *__pyx_v_self) {
  CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__iter__ (wrapper)", 0);
  __pyx_kwvalues = __Pyx_KwValues_VARARGS(__pyx_args, __pyx_nargs);
  __pyx_r = __pyx_pf_5pysam_7libcbcf_19VariantHeaderRecord_8__iter__(((struct __pyx_obj_5pysam_7libcbcf_VariantHeaderRecord *)__pyx_v_self));

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

static PyObject *__pyx_pf_5pysam_7libcbcf_19VariantHeaderRecord_8__iter__(struct __pyx_obj_5pysam_7libcbcf_VariantHeaderRecord *__pyx_v_self) {
  struct __pyx_obj_5pysam_7libcbcf___pyx_scope_struct_7___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("__iter__", 0);
  __pyx_cur_scope = (struct __pyx_obj_5pysam_7libcbcf___pyx_scope_struct_7___iter__ *)__pyx_tp_new_5pysam_7libcbcf___pyx_scope_struct_7___iter__(__pyx_mstate_global->__pyx_ptype_5pysam_7libcbcf___pyx_scope_struct_7___iter__, __pyx_mstate_global->__pyx_empty_tuple, NULL);
  if (unlikely(!__pyx_cur_scope)) {
    __pyx_cur_scope = ((struct __pyx_obj_5pysam_7libcbcf___pyx_scope_struct_7___iter__ *)Py_None);
    __Pyx_INCREF(Py_None);
    __PYX_ERR(0, 1304, __pyx_L1_error)
  } else {
    __Pyx_GOTREF((PyObject *)__pyx_cur_scope);
  }
  __pyx_cur_scope->__pyx_v_self = __pyx_v_self;
  __Pyx_INCREF((PyObject *)__pyx_cur_scope->__pyx_v_self);
  __Pyx_GIVEREF((PyObject *)__pyx_cur_scope->__pyx_v_self);
  {
    __pyx_CoroutineObject *gen = __Pyx_Generator_New((__pyx_coroutine_body_t) __pyx_gb_5pysam_7libcbcf_19VariantHeaderRecord_10generator, ((PyObject *)__pyx_mstate_global->__pyx_codeobj_tab[40]), (PyObject *) __pyx_cur_scope, __pyx_mstate_global->__pyx_n_u_iter, __pyx_mstate_global->__pyx_n_u_VariantHeaderRecord___iter, __pyx_mstate_global->__pyx_n_u_pysam_libcbcf); if (unlikely(!gen)) __PYX_ERR(0, 1304, __pyx_L1_error)
    __Pyx_DECREF(__pyx_cur_scope);
    __Pyx_RefNannyFinishContext();
    return (PyObject *) gen;
  }

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_AddTraceback("pysam.libcbcf.VariantHeaderRecord.__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_5pysam_7libcbcf_19VariantHeaderRecord_10generator(__pyx_CoroutineObject *__pyx_generator, CYTHON_UNUSED PyThreadState *__pyx_tstate, PyObject *__pyx_sent_value) /* generator body */
{
  struct __pyx_obj_5pysam_7libcbcf___pyx_scope_struct_7___iter__ *__pyx_cur_scope = ((struct __pyx_obj_5pysam_7libcbcf___pyx_scope_struct_7___iter__ *)__pyx_generator->closure);
  PyObject *__pyx_r = NULL;
  __Pyx_TraceDeclarationsGen
  bcf_hrec_t *__pyx_t_1;
  int __pyx_t_2;
  int __pyx_t_3;
  int __pyx_t_4;
  int __pyx_t_5;
  PyObject *__pyx_t_6 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__iter__", 0);
  switch (__pyx_generator->resume_label) {
    case 0: goto __pyx_L3_first_run;
    case 1: goto __pyx_L8_resume_from_yield;
    default: /* CPython raises the right error here */
    __Pyx_TraceStartGen("__iter__", __pyx_f[0], 1304, 0, 0, 0, __PYX_ERR(0, 1304, __pyx_L1_error));
    __Pyx_TraceReturnValue(Py_None, 0, 0, __PYX_ERR(0, 1304, __pyx_L1_error));
    __Pyx_RefNannyFinishContext();
    return NULL;
  }
  __pyx_L3_first_run:;
  __Pyx_TraceStartGen("__iter__", __pyx_f[0], 1304, 0, 0, 0, __PYX_ERR(0, 1304, __pyx_L1_error));
  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, 1304, __pyx_L1_error)
  }

  /* "pysam/libcbcf.pyx":1305
 * 
 *     def __iter__(self):
 *         cdef bcf_hrec_t *r = self.ptr             # <<<<<<<<<<<<<<
 *         if not r:
 *             return
*/
  __pyx_t_1 = __pyx_cur_scope->__pyx_v_self->ptr;
  __pyx_cur_scope->__pyx_v_r = __pyx_t_1;

  /* "pysam/libcbcf.pyx":1306
 *     def __iter__(self):
 *         cdef bcf_hrec_t *r = self.ptr
 *         if not r:             # <<<<<<<<<<<<<<
 *             return
 *         cdef int i
*/
  __pyx_t_2 = (!(__pyx_cur_scope->__pyx_v_r != 0));
  if (__pyx_t_2) {

    /* "pysam/libcbcf.pyx":1307
 *         cdef bcf_hrec_t *r = self.ptr
 *         if not r:
 *             return             # <<<<<<<<<<<<<<
 *         cdef int i
 *         for i in range(r.nkeys):
*/
    __Pyx_XDECREF(__pyx_r);
    __pyx_r = Py_None; __Pyx_INCREF(Py_None);
    goto __pyx_L0;

    /* "pysam/libcbcf.pyx":1306
 *     def __iter__(self):
 *         cdef bcf_hrec_t *r = self.ptr
 *         if not r:             # <<<<<<<<<<<<<<
 *             return
 *         cdef int i
*/
  }

  /* "pysam/libcbcf.pyx":1309
 *             return
 *         cdef int i
 *         for i in range(r.nkeys):             # <<<<<<<<<<<<<<
 *             if r.keys[i]:
 *                 yield bcf_str_cache_get_charptr(r.keys[i])
*/
  __pyx_t_3 = __pyx_cur_scope->__pyx_v_r->nkeys;
  __pyx_t_4 = __pyx_t_3;
  for (__pyx_t_5 = 0; __pyx_t_5 < __pyx_t_4; __pyx_t_5+=1) {
    __pyx_cur_scope->__pyx_v_i = __pyx_t_5;

    /* "pysam/libcbcf.pyx":1310
 *         cdef int i
 *         for i in range(r.nkeys):
 *             if r.keys[i]:             # <<<<<<<<<<<<<<
 *                 yield bcf_str_cache_get_charptr(r.keys[i])
 * 
*/
    __pyx_t_2 = ((__pyx_cur_scope->__pyx_v_r->keys[__pyx_cur_scope->__pyx_v_i]) != 0);
    if (__pyx_t_2) {

      /* "pysam/libcbcf.pyx":1311
 *         for i in range(r.nkeys):
 *             if r.keys[i]:
 *                 yield bcf_str_cache_get_charptr(r.keys[i])             # <<<<<<<<<<<<<<
 * 
 *     def get(self, key, default=None):
*/
      __pyx_t_6 = __pyx_f_5pysam_7libcbcf_bcf_str_cache_get_charptr((__pyx_cur_scope->__pyx_v_r->keys[__pyx_cur_scope->__pyx_v_i])); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 1311, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_6);
      __pyx_r = __pyx_t_6;
      __pyx_t_6 = 0;
      __pyx_cur_scope->__pyx_t_0 = __pyx_t_3;
      __pyx_cur_scope->__pyx_t_1 = __pyx_t_4;
      __pyx_cur_scope->__pyx_t_2 = __pyx_t_5;
      __Pyx_TraceYield(__pyx_r, 0, __PYX_ERR(0, 1311, __pyx_L1_error));
      __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_L8_resume_from_yield:;
      __Pyx_TraceResumeGen("__iter__", __pyx_f[0], 1304, 0, __PYX_ERR(0, 1311, __pyx_L1_error));
      __pyx_t_3 = __pyx_cur_scope->__pyx_t_0;
      __pyx_t_4 = __pyx_cur_scope->__pyx_t_1;
      __pyx_t_5 = __pyx_cur_scope->__pyx_t_2;
      if (unlikely(!__pyx_sent_value)) __PYX_ERR(0, 1311, __pyx_L1_error)

      /* "pysam/libcbcf.pyx":1310
 *         cdef int i
 *         for i in range(r.nkeys):
 *             if r.keys[i]:             # <<<<<<<<<<<<<<
 *                 yield bcf_str_cache_get_charptr(r.keys[i])
 * 
*/
    }
  }
  CYTHON_MAYBE_UNUSED_VAR(__pyx_cur_scope);
  __Pyx_TraceReturnValue(Py_None, 0, 0, __PYX_ERR(0, 1304, __pyx_L1_error));

  /* "pysam/libcbcf.pyx":1304
 *         raise KeyError('cannot find metadata key')
 * 
 *     def __iter__(self):             # <<<<<<<<<<<<<<
 *         cdef bcf_hrec_t *r = self.ptr
 *         if not r:
*/

  /* function exit code */
  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_6);
  if (__Pyx_PyErr_Occurred()) {
    __Pyx_TraceException(__pyx_lineno, 0, 0);
    __Pyx_Generator_Replace_StopIteration(0);
    __Pyx_AddTraceback("__iter__", __pyx_clineno, __pyx_lineno, __pyx_filename);
    __Pyx_TraceExceptionUnwind(0, 0);
  }
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_PyMonitoring_ExitScope(0);
  #if !CYTHON_USE_EXC_INFO_STACK
  __Pyx_Coroutine_ResetAndClearException(__pyx_generator);
  #endif
  __pyx_generator->resume_label = -1;
  __Pyx_Coroutine_clear((PyObject*)__pyx_generator);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "pysam/libcbcf.pyx":1313
 *                 yield bcf_str_cache_get_charptr(r.keys[i])
 * 
 *     def get(self, key, default=None):             # <<<<<<<<<<<<<<
 *         """D.get(k[,d]) -> D[k] if k in D, else d.  d defaults to None."""
 *         try:
*/

/* Python wrapper */
static PyObject *__pyx_pw_5pysam_7libcbcf_19VariantHeaderRecord_12get(PyObject *__pyx_v_self, 
#if 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_5pysam_7libcbcf_19VariantHeaderRecord_11get, "VariantHeaderRecord.get(self, key, default=None)\n\nD.get(k[,d]) -> D[k] if k in D, else d.  d defaults to None.");
static PyMethodDef __pyx_mdef_5pysam_7libcbcf_19VariantHeaderRecord_12get = {"get", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_5pysam_7libcbcf_19VariantHeaderRecord_12get, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_5pysam_7libcbcf_19VariantHeaderRecord_11get};
static PyObject *__pyx_pw_5pysam_7libcbcf_19VariantHeaderRecord_12get(PyObject *__pyx_v_self, 
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
) {
  PyObject *__pyx_v_key = 0;
  PyObject *__pyx_v_default = 0;
  #if !CYTHON_METH_FASTCALL
  CYTHON_UNUSED Py_ssize_t __pyx_nargs;
  #endif
  CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
  PyObject* values[2] = {0,0};
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("get (wrapper)", 0);
  #if !CYTHON_METH_FASTCALL
  #if CYTHON_ASSUME_SAFE_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,&__pyx_mstate_global->__pyx_n_u_default,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, "get", 0) < 0) __PYX_ERR(0, 1313, __pyx_L3_error)
      if (!values[1]) values[1] = __Pyx_NewRef(((PyObject *)Py_None));
      for (Py_ssize_t i = __pyx_nargs; i < 1; i++) {
        if (unlikely(!values[i])) { __Pyx_RaiseArgtupleInvalid("get", 0, 1, 2, i); __PYX_ERR(0, 1313, __pyx_L3_error) }
      }
    } 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, 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)
        break;
        default: goto __pyx_L5_argtuple_error;
      }
      if (!values[1]) values[1] = __Pyx_NewRef(((PyObject *)Py_None));
    }
    __pyx_v_key = values[0];
    __pyx_v_default = values[1];
  }
  goto __pyx_L6_skip;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("get", 0, 1, 2, __pyx_nargs); __PYX_ERR(0, 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("pysam.libcbcf.VariantHeaderRecord.get", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_5pysam_7libcbcf_19VariantHeaderRecord_11get(((struct __pyx_obj_5pysam_7libcbcf_VariantHeaderRecord *)__pyx_v_self), __pyx_v_key, __pyx_v_default);

  /* 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_5pysam_7libcbcf_19VariantHeaderRecord_11get(struct __pyx_obj_5pysam_7libcbcf_VariantHeaderRecord *__pyx_v_self, PyObject *__pyx_v_key, PyObject *__pyx_v_default) {
  PyObject *__pyx_r = NULL;
  __Pyx_TraceDeclarationsFunc
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  PyObject *__pyx_t_4 = NULL;
  int __pyx_t_5;
  PyObject *__pyx_t_6 = NULL;
  PyObject *__pyx_t_7 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_TraceFrameInit(((PyObject *)__pyx_mstate_global->__pyx_codeobj_tab[41]))
  __Pyx_RefNannySetupContext("get", 0);
  __Pyx_TraceStartFunc("get", __pyx_f[0], 1313, 0, 0, 0, __PYX_ERR(0, 1313, __pyx_L1_error));

  /* "pysam/libcbcf.pyx":1315
 *     def get(self, key, default=None):
 *         """D.get(k[,d]) -> D[k] if k in D, else d.  d defaults to None."""
 *         try:             # <<<<<<<<<<<<<<
 *             return self[key]
 *         except KeyError:
*/
  {
    __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:*/ {

      /* "pysam/libcbcf.pyx":1316
 *         """D.get(k[,d]) -> D[k] if k in D, else d.  d defaults to None."""
 *         try:
 *             return self[key]             # <<<<<<<<<<<<<<
 *         except KeyError:
 *             return default
*/
      __Pyx_XDECREF(__pyx_r);
      __pyx_t_4 = __Pyx_PyObject_GetItem(((PyObject *)__pyx_v_self), __pyx_v_key); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1316, __pyx_L3_error)
      __Pyx_GOTREF(__pyx_t_4);
      __pyx_r = __pyx_t_4;
      __pyx_t_4 = 0;
      __Pyx_TraceReturnValue(__pyx_r, 3, 0, __PYX_ERR(0, 1316, __pyx_L3_error));
      goto __pyx_L7_try_return;

      /* "pysam/libcbcf.pyx":1315
 *     def get(self, key, default=None):
 *         """D.get(k[,d]) -> D[k] if k in D, else d.  d defaults to None."""
 *         try:             # <<<<<<<<<<<<<<
 *             return self[key]
 *         except KeyError:
*/
    }
    __pyx_L3_error:;
    __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
    __Pyx_TraceException(__pyx_lineno, 0, 0);

    /* "pysam/libcbcf.pyx":1317
 *         try:
 *             return self[key]
 *         except KeyError:             # <<<<<<<<<<<<<<
 *             return default
 * 
*/
    __pyx_t_5 = __Pyx_PyErr_ExceptionMatches(__pyx_builtin_KeyError);
    if (__pyx_t_5) {
      __Pyx_AddTraceback("pysam.libcbcf.VariantHeaderRecord.get", __pyx_clineno, __pyx_lineno, __pyx_filename);
      __Pyx_TraceExceptionHandled(0);
      if (__Pyx_GetException(&__pyx_t_4, &__pyx_t_6, &__pyx_t_7) < 0) __PYX_ERR(0, 1317, __pyx_L5_except_error)
      __Pyx_XGOTREF(__pyx_t_4);
      __Pyx_XGOTREF(__pyx_t_6);
      __Pyx_XGOTREF(__pyx_t_7);
      __Pyx_TraceExceptionDone();

      /* "pysam/libcbcf.pyx":1318
 *             return self[key]
 *         except KeyError:
 *             return default             # <<<<<<<<<<<<<<
 * 
 *     def __contains__(self, key):
*/
      __Pyx_XDECREF(__pyx_r);
      __Pyx_INCREF(__pyx_v_default);
      __pyx_r = __pyx_v_default;
      __Pyx_TraceReturnValue(__pyx_r, 8, 0, __PYX_ERR(0, 1318, __pyx_L5_except_error));
      __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;

    /* "pysam/libcbcf.pyx":1315
 *     def get(self, key, default=None):
 *         """D.get(k[,d]) -> D[k] if k in D, else d.  d defaults to None."""
 *         try:             # <<<<<<<<<<<<<<
 *             return self[key]
 *         except KeyError:
*/
    __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;
  }

  /* "pysam/libcbcf.pyx":1313
 *                 yield bcf_str_cache_get_charptr(r.keys[i])
 * 
 *     def get(self, key, default=None):             # <<<<<<<<<<<<<<
 *         """D.get(k[,d]) -> D[k] if k in D, else d.  d defaults to None."""
 *         try:
*/

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_XDECREF(__pyx_t_6);
  __Pyx_XDECREF(__pyx_t_7);
  __Pyx_TraceException(__pyx_lineno, 0, 0);
  #if CYTHON_USE_SYS_MONITORING
  __Pyx_TraceExceptionUnwind(0, 0);
  #else
  __Pyx_TraceReturnValue(NULL, 0, 0, __PYX_ERR(0, 1313, __pyx_L1_error));
  #endif
  __Pyx_AddTraceback("pysam.libcbcf.VariantHeaderRecord.get", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_PyMonitoring_ExitScope(0);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "pysam/libcbcf.pyx":1320
 *             return default
 * 
 *     def __contains__(self, key):             # <<<<<<<<<<<<<<
 *         try:
 *             self[key]
*/

/* Python wrapper */
static int __pyx_pw_5pysam_7libcbcf_19VariantHeaderRecord_14__contains__(PyObject *__pyx_v_self, PyObject *__pyx_v_key); /*proto*/
static int __pyx_pw_5pysam_7libcbcf_19VariantHeaderRecord_14__contains__(PyObject *__pyx_v_self, PyObject *__pyx_v_key) {
  CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__contains__ (wrapper)", 0);
  __pyx_kwvalues = __Pyx_KwValues_VARARGS(__pyx_args, __pyx_nargs);
  __pyx_r = __pyx_pf_5pysam_7libcbcf_19VariantHeaderRecord_13__contains__(((struct __pyx_obj_5pysam_7libcbcf_VariantHeaderRecord *)__pyx_v_self), ((PyObject *)__pyx_v_key));

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

static int __pyx_pf_5pysam_7libcbcf_19VariantHeaderRecord_13__contains__(struct __pyx_obj_5pysam_7libcbcf_VariantHeaderRecord *__pyx_v_self, PyObject *__pyx_v_key) {
  int __pyx_r;
  __Pyx_TraceDeclarationsFunc
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  PyObject *__pyx_t_4 = NULL;
  int __pyx_t_5;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_TraceFrameInit(((PyObject *)__pyx_mstate_global->__pyx_codeobj_tab[42]))
  __Pyx_RefNannySetupContext("__contains__", 0);
  __Pyx_TraceStartFunc("__contains__", __pyx_f[0], 1320, 0, 0, 0, __PYX_ERR(0, 1320, __pyx_L1_error));

  /* "pysam/libcbcf.pyx":1321
 * 
 *     def __contains__(self, key):
 *         try:             # <<<<<<<<<<<<<<
 *             self[key]
 *         except KeyError:
*/
  {
    __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:*/ {

      /* "pysam/libcbcf.pyx":1322
 *     def __contains__(self, key):
 *         try:
 *             self[key]             # <<<<<<<<<<<<<<
 *         except KeyError:
 *             return False
*/
      __pyx_t_4 = __Pyx_PyObject_GetItem(((PyObject *)__pyx_v_self), __pyx_v_key); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1322, __pyx_L3_error)
      __Pyx_GOTREF(__pyx_t_4);
      __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;

      /* "pysam/libcbcf.pyx":1321
 * 
 *     def __contains__(self, key):
 *         try:             # <<<<<<<<<<<<<<
 *             self[key]
 *         except KeyError:
*/
    }

    /* "pysam/libcbcf.pyx":1326
 *             return False
 *         else:
 *             return True             # <<<<<<<<<<<<<<
 * 
 *     def iterkeys(self):
*/
    /*else:*/ {
      __pyx_r = 1;
      __Pyx_TraceReturnCValue(__pyx_r, __Pyx_PyLong_From_int, 8, 0, __PYX_ERR(0, 1326, __pyx_L5_except_error));
      goto __pyx_L6_except_return;
    }
    __pyx_L3_error:;
    __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
    __Pyx_TraceException(__pyx_lineno, 0, 0);

    /* "pysam/libcbcf.pyx":1323
 *         try:
 *             self[key]
 *         except KeyError:             # <<<<<<<<<<<<<<
 *             return False
 *         else:
*/
    __pyx_t_5 = __Pyx_PyErr_ExceptionMatches(__pyx_builtin_KeyError);
    if (__pyx_t_5) {
      __Pyx_AddTraceback("pysam.libcbcf.VariantHeaderRecord.__contains__", __pyx_clineno, __pyx_lineno, __pyx_filename);
      __Pyx_TraceExceptionHandled(0);
      __Pyx_ErrRestore(0,0,0);
      __Pyx_TraceExceptionDone();

      /* "pysam/libcbcf.pyx":1324
 *             self[key]
 *         except KeyError:
 *             return False             # <<<<<<<<<<<<<<
 *         else:
 *             return True
*/
      __pyx_r = 0;
      __Pyx_TraceReturnCValue(__pyx_r, __Pyx_PyLong_From_int, 6, 0, __PYX_ERR(0, 1324, __pyx_L5_except_error));
      goto __pyx_L6_except_return;
    }
    goto __pyx_L5_except_error;

    /* "pysam/libcbcf.pyx":1321
 * 
 *     def __contains__(self, key):
 *         try:             # <<<<<<<<<<<<<<
 *             self[key]
 *         except KeyError:
*/
    __pyx_L5_except_error:;
    __Pyx_XGIVEREF(__pyx_t_1);
    __Pyx_XGIVEREF(__pyx_t_2);
    __Pyx_XGIVEREF(__pyx_t_3);
    __Pyx_ExceptionReset(__pyx_t_1, __pyx_t_2, __pyx_t_3);
    goto __pyx_L1_error;
    __pyx_L6_except_return:;
    __Pyx_XGIVEREF(__pyx_t_1);
    __Pyx_XGIVEREF(__pyx_t_2);
    __Pyx_XGIVEREF(__pyx_t_3);
    __Pyx_ExceptionReset(__pyx_t_1, __pyx_t_2, __pyx_t_3);
    goto __pyx_L0;
  }

  /* "pysam/libcbcf.pyx":1320
 *             return default
 * 
 *     def __contains__(self, key):             # <<<<<<<<<<<<<<
 *         try:
 *             self[key]
*/

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_TraceException(__pyx_lineno, 0, 0);
  #if CYTHON_USE_SYS_MONITORING
  __Pyx_TraceExceptionUnwind(0, 0);
  #else
  __Pyx_TraceReturnValue(NULL, 0, 0, __PYX_ERR(0, 1320, __pyx_L1_error));
  #endif
  __Pyx_AddTraceback("pysam.libcbcf.VariantHeaderRecord.__contains__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = -1;
  __pyx_L0:;
  __Pyx_PyMonitoring_ExitScope(0);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "pysam/libcbcf.pyx":1328
 *             return True
 * 
 *     def iterkeys(self):             # <<<<<<<<<<<<<<
 *         """D.iterkeys() -> an iterator over the keys of D"""
 *         return iter(self)
*/

/* Python wrapper */
static PyObject *__pyx_pw_5pysam_7libcbcf_19VariantHeaderRecord_16iterkeys(PyObject *__pyx_v_self, 
#if 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_5pysam_7libcbcf_19VariantHeaderRecord_15iterkeys, "VariantHeaderRecord.iterkeys(self)\n\nD.iterkeys() -> an iterator over the keys of D");
static PyMethodDef __pyx_mdef_5pysam_7libcbcf_19VariantHeaderRecord_16iterkeys = {"iterkeys", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_5pysam_7libcbcf_19VariantHeaderRecord_16iterkeys, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_5pysam_7libcbcf_19VariantHeaderRecord_15iterkeys};
static PyObject *__pyx_pw_5pysam_7libcbcf_19VariantHeaderRecord_16iterkeys(PyObject *__pyx_v_self, 
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
) {
  #if !CYTHON_METH_FASTCALL
  CYTHON_UNUSED Py_ssize_t __pyx_nargs;
  #endif
  CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("iterkeys (wrapper)", 0);
  #if !CYTHON_METH_FASTCALL
  #if CYTHON_ASSUME_SAFE_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("iterkeys", 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("iterkeys", __pyx_kwds); return NULL;}
  __pyx_r = __pyx_pf_5pysam_7libcbcf_19VariantHeaderRecord_15iterkeys(((struct __pyx_obj_5pysam_7libcbcf_VariantHeaderRecord *)__pyx_v_self));

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

static PyObject *__pyx_pf_5pysam_7libcbcf_19VariantHeaderRecord_15iterkeys(struct __pyx_obj_5pysam_7libcbcf_VariantHeaderRecord *__pyx_v_self) {
  PyObject *__pyx_r = NULL;
  __Pyx_TraceDeclarationsFunc
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_TraceFrameInit(((PyObject *)__pyx_mstate_global->__pyx_codeobj_tab[43]))
  __Pyx_RefNannySetupContext("iterkeys", 0);
  __Pyx_TraceStartFunc("iterkeys", __pyx_f[0], 1328, 0, 0, 0, __PYX_ERR(0, 1328, __pyx_L1_error));

  /* "pysam/libcbcf.pyx":1330
 *     def iterkeys(self):
 *         """D.iterkeys() -> an iterator over the keys of D"""
 *         return iter(self)             # <<<<<<<<<<<<<<
 * 
 *     def itervalues(self):
*/
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = PyObject_GetIter(((PyObject *)__pyx_v_self)); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1330, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  __Pyx_TraceReturnValue(__pyx_r, 1, 0, __PYX_ERR(0, 1330, __pyx_L1_error));
  goto __pyx_L0;

  /* "pysam/libcbcf.pyx":1328
 *             return True
 * 
 *     def iterkeys(self):             # <<<<<<<<<<<<<<
 *         """D.iterkeys() -> an iterator over the keys of D"""
 *         return iter(self)
*/

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_TraceException(__pyx_lineno, 0, 0);
  #if CYTHON_USE_SYS_MONITORING
  __Pyx_TraceExceptionUnwind(0, 0);
  #else
  __Pyx_TraceReturnValue(NULL, 0, 0, __PYX_ERR(0, 1328, __pyx_L1_error));
  #endif
  __Pyx_AddTraceback("pysam.libcbcf.VariantHeaderRecord.iterkeys", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_PyMonitoring_ExitScope(0);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}
static PyObject *__pyx_gb_5pysam_7libcbcf_19VariantHeaderRecord_19generator1(__pyx_CoroutineObject *__pyx_generator, CYTHON_UNUSED PyThreadState *__pyx_tstate, PyObject *__pyx_sent_value); /* proto */

/* "pysam/libcbcf.pyx":1332
 *         return iter(self)
 * 
 *     def itervalues(self):             # <<<<<<<<<<<<<<
 *         """D.itervalues() -> an iterator over the values of D"""
 *         cdef bcf_hrec_t *r = self.ptr
*/

/* Python wrapper */
static PyObject *__pyx_pw_5pysam_7libcbcf_19VariantHeaderRecord_18itervalues(PyObject *__pyx_v_self, 
#if 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_5pysam_7libcbcf_19VariantHeaderRecord_17itervalues, "VariantHeaderRecord.itervalues(self)\n\nD.itervalues() -> an iterator over the values of D");
static PyMethodDef __pyx_mdef_5pysam_7libcbcf_19VariantHeaderRecord_18itervalues = {"itervalues", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_5pysam_7libcbcf_19VariantHeaderRecord_18itervalues, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_5pysam_7libcbcf_19VariantHeaderRecord_17itervalues};
static PyObject *__pyx_pw_5pysam_7libcbcf_19VariantHeaderRecord_18itervalues(PyObject *__pyx_v_self, 
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
) {
  #if !CYTHON_METH_FASTCALL
  CYTHON_UNUSED Py_ssize_t __pyx_nargs;
  #endif
  CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("itervalues (wrapper)", 0);
  #if !CYTHON_METH_FASTCALL
  #if CYTHON_ASSUME_SAFE_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("itervalues", 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("itervalues", __pyx_kwds); return NULL;}
  __pyx_r = __pyx_pf_5pysam_7libcbcf_19VariantHeaderRecord_17itervalues(((struct __pyx_obj_5pysam_7libcbcf_VariantHeaderRecord *)__pyx_v_self));

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

static PyObject *__pyx_pf_5pysam_7libcbcf_19VariantHeaderRecord_17itervalues(struct __pyx_obj_5pysam_7libcbcf_VariantHeaderRecord *__pyx_v_self) {
  struct __pyx_obj_5pysam_7libcbcf___pyx_scope_struct_8_itervalues *__pyx_cur_scope;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("itervalues", 0);
  __pyx_cur_scope = (struct __pyx_obj_5pysam_7libcbcf___pyx_scope_struct_8_itervalues *)__pyx_tp_new_5pysam_7libcbcf___pyx_scope_struct_8_itervalues(__pyx_mstate_global->__pyx_ptype_5pysam_7libcbcf___pyx_scope_struct_8_itervalues, __pyx_mstate_global->__pyx_empty_tuple, NULL);
  if (unlikely(!__pyx_cur_scope)) {
    __pyx_cur_scope = ((struct __pyx_obj_5pysam_7libcbcf___pyx_scope_struct_8_itervalues *)Py_None);
    __Pyx_INCREF(Py_None);
    __PYX_ERR(0, 1332, __pyx_L1_error)
  } else {
    __Pyx_GOTREF((PyObject *)__pyx_cur_scope);
  }
  __pyx_cur_scope->__pyx_v_self = __pyx_v_self;
  __Pyx_INCREF((PyObject *)__pyx_cur_scope->__pyx_v_self);
  __Pyx_GIVEREF((PyObject *)__pyx_cur_scope->__pyx_v_self);
  {
    __pyx_CoroutineObject *gen = __Pyx_Generator_New((__pyx_coroutine_body_t) __pyx_gb_5pysam_7libcbcf_19VariantHeaderRecord_19generator1, ((PyObject *)__pyx_mstate_global->__pyx_codeobj_tab[44]), (PyObject *) __pyx_cur_scope, __pyx_mstate_global->__pyx_n_u_itervalues, __pyx_mstate_global->__pyx_n_u_VariantHeaderRecord_itervalues, __pyx_mstate_global->__pyx_n_u_pysam_libcbcf); if (unlikely(!gen)) __PYX_ERR(0, 1332, __pyx_L1_error)
    __Pyx_DECREF(__pyx_cur_scope);
    __Pyx_RefNannyFinishContext();
    return (PyObject *) gen;
  }

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_AddTraceback("pysam.libcbcf.VariantHeaderRecord.itervalues", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __Pyx_DECREF((PyObject *)__pyx_cur_scope);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_gb_5pysam_7libcbcf_19VariantHeaderRecord_19generator1(__pyx_CoroutineObject *__pyx_generator, CYTHON_UNUSED PyThreadState *__pyx_tstate, PyObject *__pyx_sent_value) /* generator body */
{
  struct __pyx_obj_5pysam_7libcbcf___pyx_scope_struct_8_itervalues *__pyx_cur_scope = ((struct __pyx_obj_5pysam_7libcbcf___pyx_scope_struct_8_itervalues *)__pyx_generator->closure);
  PyObject *__pyx_r = NULL;
  __Pyx_TraceDeclarationsGen
  bcf_hrec_t *__pyx_t_1;
  int __pyx_t_2;
  int __pyx_t_3;
  int __pyx_t_4;
  int __pyx_t_5;
  PyObject *__pyx_t_6 = NULL;
  PyObject *__pyx_t_7 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("itervalues", 0);
  switch (__pyx_generator->resume_label) {
    case 0: goto __pyx_L3_first_run;
    case 1: goto __pyx_L8_resume_from_yield;
    default: /* CPython raises the right error here */
    __Pyx_TraceStartGen("itervalues", __pyx_f[0], 1332, 0, 0, 0, __PYX_ERR(0, 1332, __pyx_L1_error));
    __Pyx_TraceReturnValue(Py_None, 0, 0, __PYX_ERR(0, 1332, __pyx_L1_error));
    __Pyx_RefNannyFinishContext();
    return NULL;
  }
  __pyx_L3_first_run:;
  __Pyx_TraceStartGen("itervalues", __pyx_f[0], 1332, 0, 0, 0, __PYX_ERR(0, 1332, __pyx_L1_error));
  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, 1332, __pyx_L1_error)
  }

  /* "pysam/libcbcf.pyx":1334
 *     def itervalues(self):
 *         """D.itervalues() -> an iterator over the values of D"""
 *         cdef bcf_hrec_t *r = self.ptr             # <<<<<<<<<<<<<<
 *         if not r:
 *             return
*/
  __pyx_t_1 = __pyx_cur_scope->__pyx_v_self->ptr;
  __pyx_cur_scope->__pyx_v_r = __pyx_t_1;

  /* "pysam/libcbcf.pyx":1335
 *         """D.itervalues() -> an iterator over the values of D"""
 *         cdef bcf_hrec_t *r = self.ptr
 *         if not r:             # <<<<<<<<<<<<<<
 *             return
 *         cdef int i
*/
  __pyx_t_2 = (!(__pyx_cur_scope->__pyx_v_r != 0));
  if (__pyx_t_2) {

    /* "pysam/libcbcf.pyx":1336
 *         cdef bcf_hrec_t *r = self.ptr
 *         if not r:
 *             return             # <<<<<<<<<<<<<<
 *         cdef int i
 *         for i in range(r.nkeys):
*/
    __Pyx_XDECREF(__pyx_r);
    __pyx_r = Py_None; __Pyx_INCREF(Py_None);
    goto __pyx_L0;

    /* "pysam/libcbcf.pyx":1335
 *         """D.itervalues() -> an iterator over the values of D"""
 *         cdef bcf_hrec_t *r = self.ptr
 *         if not r:             # <<<<<<<<<<<<<<
 *             return
 *         cdef int i
*/
  }

  /* "pysam/libcbcf.pyx":1338
 *             return
 *         cdef int i
 *         for i in range(r.nkeys):             # <<<<<<<<<<<<<<
 *             if r.keys[i]:
 *                 yield charptr_to_str(r.vals[i]) if r.vals[i] else None
*/
  __pyx_t_3 = __pyx_cur_scope->__pyx_v_r->nkeys;
  __pyx_t_4 = __pyx_t_3;
  for (__pyx_t_5 = 0; __pyx_t_5 < __pyx_t_4; __pyx_t_5+=1) {
    __pyx_cur_scope->__pyx_v_i = __pyx_t_5;

    /* "pysam/libcbcf.pyx":1339
 *         cdef int i
 *         for i in range(r.nkeys):
 *             if r.keys[i]:             # <<<<<<<<<<<<<<
 *                 yield charptr_to_str(r.vals[i]) if r.vals[i] else None
 * 
*/
    __pyx_t_2 = ((__pyx_cur_scope->__pyx_v_r->keys[__pyx_cur_scope->__pyx_v_i]) != 0);
    if (__pyx_t_2) {

      /* "pysam/libcbcf.pyx":1340
 *         for i in range(r.nkeys):
 *             if r.keys[i]:
 *                 yield charptr_to_str(r.vals[i]) if r.vals[i] else None             # <<<<<<<<<<<<<<
 * 
 *     def iteritems(self):
*/
      __pyx_t_2 = ((__pyx_cur_scope->__pyx_v_r->vals[__pyx_cur_scope->__pyx_v_i]) != 0);
      if (__pyx_t_2) {
        __pyx_t_7 = __pyx_f_5pysam_9libcutils_charptr_to_str((__pyx_cur_scope->__pyx_v_r->vals[__pyx_cur_scope->__pyx_v_i]), NULL); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 1340, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_7);
        __pyx_t_6 = __pyx_t_7;
        __pyx_t_7 = 0;
      } else {
        __Pyx_INCREF(Py_None);
        __pyx_t_6 = Py_None;
      }
      __pyx_r = __pyx_t_6;
      __pyx_t_6 = 0;
      __pyx_cur_scope->__pyx_t_0 = __pyx_t_3;
      __pyx_cur_scope->__pyx_t_1 = __pyx_t_4;
      __pyx_cur_scope->__pyx_t_2 = __pyx_t_5;
      __Pyx_TraceYield(__pyx_r, 0, __PYX_ERR(0, 1340, __pyx_L1_error));
      __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_L8_resume_from_yield:;
      __Pyx_TraceResumeGen("itervalues", __pyx_f[0], 1332, 0, __PYX_ERR(0, 1340, __pyx_L1_error));
      __pyx_t_3 = __pyx_cur_scope->__pyx_t_0;
      __pyx_t_4 = __pyx_cur_scope->__pyx_t_1;
      __pyx_t_5 = __pyx_cur_scope->__pyx_t_2;
      if (unlikely(!__pyx_sent_value)) __PYX_ERR(0, 1340, __pyx_L1_error)

      /* "pysam/libcbcf.pyx":1339
 *         cdef int i
 *         for i in range(r.nkeys):
 *             if r.keys[i]:             # <<<<<<<<<<<<<<
 *                 yield charptr_to_str(r.vals[i]) if r.vals[i] else None
 * 
*/
    }
  }
  CYTHON_MAYBE_UNUSED_VAR(__pyx_cur_scope);
  __Pyx_TraceReturnValue(Py_None, 0, 0, __PYX_ERR(0, 1332, __pyx_L1_error));

  /* "pysam/libcbcf.pyx":1332
 *         return iter(self)
 * 
 *     def itervalues(self):             # <<<<<<<<<<<<<<
 *         """D.itervalues() -> an iterator over the values of D"""
 *         cdef bcf_hrec_t *r = self.ptr
*/

  /* function exit code */
  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_6);
  __Pyx_XDECREF(__pyx_t_7);
  if (__Pyx_PyErr_Occurred()) {
    __Pyx_TraceException(__pyx_lineno, 0, 0);
    __Pyx_Generator_Replace_StopIteration(0);
    __Pyx_AddTraceback("itervalues", __pyx_clineno, __pyx_lineno, __pyx_filename);
    __Pyx_TraceExceptionUnwind(0, 0);
  }
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_PyMonitoring_ExitScope(0);
  #if !CYTHON_USE_EXC_INFO_STACK
  __Pyx_Coroutine_ResetAndClearException(__pyx_generator);
  #endif
  __pyx_generator->resume_label = -1;
  __Pyx_Coroutine_clear((PyObject*)__pyx_generator);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}
static PyObject *__pyx_gb_5pysam_7libcbcf_19VariantHeaderRecord_22generator2(__pyx_CoroutineObject *__pyx_generator, CYTHON_UNUSED PyThreadState *__pyx_tstate, PyObject *__pyx_sent_value); /* proto */

/* "pysam/libcbcf.pyx":1342
 *                 yield charptr_to_str(r.vals[i]) if r.vals[i] else None
 * 
 *     def iteritems(self):             # <<<<<<<<<<<<<<
 *         """D.iteritems() -> an iterator over the (key, value) items of D"""
 *         cdef bcf_hrec_t *r = self.ptr
*/

/* Python wrapper */
static PyObject *__pyx_pw_5pysam_7libcbcf_19VariantHeaderRecord_21iteritems(PyObject *__pyx_v_self, 
#if 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_5pysam_7libcbcf_19VariantHeaderRecord_20iteritems, "VariantHeaderRecord.iteritems(self)\n\nD.iteritems() -> an iterator over the (key, value) items of D");
static PyMethodDef __pyx_mdef_5pysam_7libcbcf_19VariantHeaderRecord_21iteritems = {"iteritems", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_5pysam_7libcbcf_19VariantHeaderRecord_21iteritems, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_5pysam_7libcbcf_19VariantHeaderRecord_20iteritems};
static PyObject *__pyx_pw_5pysam_7libcbcf_19VariantHeaderRecord_21iteritems(PyObject *__pyx_v_self, 
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
) {
  #if !CYTHON_METH_FASTCALL
  CYTHON_UNUSED Py_ssize_t __pyx_nargs;
  #endif
  CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("iteritems (wrapper)", 0);
  #if !CYTHON_METH_FASTCALL
  #if CYTHON_ASSUME_SAFE_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("iteritems", 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("iteritems", __pyx_kwds); return NULL;}
  __pyx_r = __pyx_pf_5pysam_7libcbcf_19VariantHeaderRecord_20iteritems(((struct __pyx_obj_5pysam_7libcbcf_VariantHeaderRecord *)__pyx_v_self));

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

static PyObject *__pyx_pf_5pysam_7libcbcf_19VariantHeaderRecord_20iteritems(struct __pyx_obj_5pysam_7libcbcf_VariantHeaderRecord *__pyx_v_self) {
  struct __pyx_obj_5pysam_7libcbcf___pyx_scope_struct_9_iteritems *__pyx_cur_scope;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("iteritems", 0);
  __pyx_cur_scope = (struct __pyx_obj_5pysam_7libcbcf___pyx_scope_struct_9_iteritems *)__pyx_tp_new_5pysam_7libcbcf___pyx_scope_struct_9_iteritems(__pyx_mstate_global->__pyx_ptype_5pysam_7libcbcf___pyx_scope_struct_9_iteritems, __pyx_mstate_global->__pyx_empty_tuple, NULL);
  if (unlikely(!__pyx_cur_scope)) {
    __pyx_cur_scope = ((struct __pyx_obj_5pysam_7libcbcf___pyx_scope_struct_9_iteritems *)Py_None);
    __Pyx_INCREF(Py_None);
    __PYX_ERR(0, 1342, __pyx_L1_error)
  } else {
    __Pyx_GOTREF((PyObject *)__pyx_cur_scope);
  }
  __pyx_cur_scope->__pyx_v_self = __pyx_v_self;
  __Pyx_INCREF((PyObject *)__pyx_cur_scope->__pyx_v_self);
  __Pyx_GIVEREF((PyObject *)__pyx_cur_scope->__pyx_v_self);
  {
    __pyx_CoroutineObject *gen = __Pyx_Generator_New((__pyx_coroutine_body_t) __pyx_gb_5pysam_7libcbcf_19VariantHeaderRecord_22generator2, ((PyObject *)__pyx_mstate_global->__pyx_codeobj_tab[45]), (PyObject *) __pyx_cur_scope, __pyx_mstate_global->__pyx_n_u_iteritems, __pyx_mstate_global->__pyx_n_u_VariantHeaderRecord_iteritems, __pyx_mstate_global->__pyx_n_u_pysam_libcbcf); if (unlikely(!gen)) __PYX_ERR(0, 1342, __pyx_L1_error)
    __Pyx_DECREF(__pyx_cur_scope);
    __Pyx_RefNannyFinishContext();
    return (PyObject *) gen;
  }

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_AddTraceback("pysam.libcbcf.VariantHeaderRecord.iteritems", __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_5pysam_7libcbcf_19VariantHeaderRecord_22generator2(__pyx_CoroutineObject *__pyx_generator, CYTHON_UNUSED PyThreadState *__pyx_tstate, PyObject *__pyx_sent_value) /* generator body */
{
  struct __pyx_obj_5pysam_7libcbcf___pyx_scope_struct_9_iteritems *__pyx_cur_scope = ((struct __pyx_obj_5pysam_7libcbcf___pyx_scope_struct_9_iteritems *)__pyx_generator->closure);
  PyObject *__pyx_r = NULL;
  __Pyx_TraceDeclarationsGen
  bcf_hrec_t *__pyx_t_1;
  int __pyx_t_2;
  int __pyx_t_3;
  int __pyx_t_4;
  int __pyx_t_5;
  PyObject *__pyx_t_6 = NULL;
  PyObject *__pyx_t_7 = NULL;
  PyObject *__pyx_t_8 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("iteritems", 0);
  switch (__pyx_generator->resume_label) {
    case 0: goto __pyx_L3_first_run;
    case 1: goto __pyx_L8_resume_from_yield;
    default: /* CPython raises the right error here */
    __Pyx_TraceStartGen("iteritems", __pyx_f[0], 1342, 0, 0, 0, __PYX_ERR(0, 1342, __pyx_L1_error));
    __Pyx_TraceReturnValue(Py_None, 0, 0, __PYX_ERR(0, 1342, __pyx_L1_error));
    __Pyx_RefNannyFinishContext();
    return NULL;
  }
  __pyx_L3_first_run:;
  __Pyx_TraceStartGen("iteritems", __pyx_f[0], 1342, 0, 0, 0, __PYX_ERR(0, 1342, __pyx_L1_error));
  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, 1342, __pyx_L1_error)
  }

  /* "pysam/libcbcf.pyx":1344
 *     def iteritems(self):
 *         """D.iteritems() -> an iterator over the (key, value) items of D"""
 *         cdef bcf_hrec_t *r = self.ptr             # <<<<<<<<<<<<<<
 *         if not r:
 *             return
*/
  __pyx_t_1 = __pyx_cur_scope->__pyx_v_self->ptr;
  __pyx_cur_scope->__pyx_v_r = __pyx_t_1;

  /* "pysam/libcbcf.pyx":1345
 *         """D.iteritems() -> an iterator over the (key, value) items of D"""
 *         cdef bcf_hrec_t *r = self.ptr
 *         if not r:             # <<<<<<<<<<<<<<
 *             return
 *         cdef int i
*/
  __pyx_t_2 = (!(__pyx_cur_scope->__pyx_v_r != 0));
  if (__pyx_t_2) {

    /* "pysam/libcbcf.pyx":1346
 *         cdef bcf_hrec_t *r = self.ptr
 *         if not r:
 *             return             # <<<<<<<<<<<<<<
 *         cdef int i
 *         for i in range(r.nkeys):
*/
    __Pyx_XDECREF(__pyx_r);
    __pyx_r = Py_None; __Pyx_INCREF(Py_None);
    goto __pyx_L0;

    /* "pysam/libcbcf.pyx":1345
 *         """D.iteritems() -> an iterator over the (key, value) items of D"""
 *         cdef bcf_hrec_t *r = self.ptr
 *         if not r:             # <<<<<<<<<<<<<<
 *             return
 *         cdef int i
*/
  }

  /* "pysam/libcbcf.pyx":1348
 *             return
 *         cdef int i
 *         for i in range(r.nkeys):             # <<<<<<<<<<<<<<
 *             if r.keys[i]:
 *                 yield (bcf_str_cache_get_charptr(r.keys[i]), charptr_to_str(r.vals[i]) if r.vals[i] else None)
*/
  __pyx_t_3 = __pyx_cur_scope->__pyx_v_r->nkeys;
  __pyx_t_4 = __pyx_t_3;
  for (__pyx_t_5 = 0; __pyx_t_5 < __pyx_t_4; __pyx_t_5+=1) {
    __pyx_cur_scope->__pyx_v_i = __pyx_t_5;

    /* "pysam/libcbcf.pyx":1349
 *         cdef int i
 *         for i in range(r.nkeys):
 *             if r.keys[i]:             # <<<<<<<<<<<<<<
 *                 yield (bcf_str_cache_get_charptr(r.keys[i]), charptr_to_str(r.vals[i]) if r.vals[i] else None)
 * 
*/
    __pyx_t_2 = ((__pyx_cur_scope->__pyx_v_r->keys[__pyx_cur_scope->__pyx_v_i]) != 0);
    if (__pyx_t_2) {

      /* "pysam/libcbcf.pyx":1350
 *         for i in range(r.nkeys):
 *             if r.keys[i]:
 *                 yield (bcf_str_cache_get_charptr(r.keys[i]), charptr_to_str(r.vals[i]) if r.vals[i] else None)             # <<<<<<<<<<<<<<
 * 
 *     def keys(self):
*/
      __pyx_t_6 = __pyx_f_5pysam_7libcbcf_bcf_str_cache_get_charptr((__pyx_cur_scope->__pyx_v_r->keys[__pyx_cur_scope->__pyx_v_i])); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 1350, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_6);
      __pyx_t_2 = ((__pyx_cur_scope->__pyx_v_r->vals[__pyx_cur_scope->__pyx_v_i]) != 0);
      if (__pyx_t_2) {
        __pyx_t_8 = __pyx_f_5pysam_9libcutils_charptr_to_str((__pyx_cur_scope->__pyx_v_r->vals[__pyx_cur_scope->__pyx_v_i]), NULL); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 1350, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_8);
        __pyx_t_7 = __pyx_t_8;
        __pyx_t_8 = 0;
      } else {
        __Pyx_INCREF(Py_None);
        __pyx_t_7 = Py_None;
      }
      __pyx_t_8 = PyTuple_New(2); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 1350, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_8);
      __Pyx_GIVEREF(__pyx_t_6);
      if (__Pyx_PyTuple_SET_ITEM(__pyx_t_8, 0, __pyx_t_6) != (0)) __PYX_ERR(0, 1350, __pyx_L1_error);
      __Pyx_GIVEREF(__pyx_t_7);
      if (__Pyx_PyTuple_SET_ITEM(__pyx_t_8, 1, __pyx_t_7) != (0)) __PYX_ERR(0, 1350, __pyx_L1_error);
      __pyx_t_6 = 0;
      __pyx_t_7 = 0;
      __pyx_r = __pyx_t_8;
      __pyx_t_8 = 0;
      __pyx_cur_scope->__pyx_t_0 = __pyx_t_3;
      __pyx_cur_scope->__pyx_t_1 = __pyx_t_4;
      __pyx_cur_scope->__pyx_t_2 = __pyx_t_5;
      __Pyx_TraceYield(__pyx_r, 0, __PYX_ERR(0, 1350, __pyx_L1_error));
      __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_L8_resume_from_yield:;
      __Pyx_TraceResumeGen("iteritems", __pyx_f[0], 1342, 0, __PYX_ERR(0, 1350, __pyx_L1_error));
      __pyx_t_3 = __pyx_cur_scope->__pyx_t_0;
      __pyx_t_4 = __pyx_cur_scope->__pyx_t_1;
      __pyx_t_5 = __pyx_cur_scope->__pyx_t_2;
      if (unlikely(!__pyx_sent_value)) __PYX_ERR(0, 1350, __pyx_L1_error)

      /* "pysam/libcbcf.pyx":1349
 *         cdef int i
 *         for i in range(r.nkeys):
 *             if r.keys[i]:             # <<<<<<<<<<<<<<
 *                 yield (bcf_str_cache_get_charptr(r.keys[i]), charptr_to_str(r.vals[i]) if r.vals[i] else None)
 * 
*/
    }
  }
  CYTHON_MAYBE_UNUSED_VAR(__pyx_cur_scope);
  __Pyx_TraceReturnValue(Py_None, 0, 0, __PYX_ERR(0, 1342, __pyx_L1_error));

  /* "pysam/libcbcf.pyx":1342
 *                 yield charptr_to_str(r.vals[i]) if r.vals[i] else None
 * 
 *     def iteritems(self):             # <<<<<<<<<<<<<<
 *         """D.iteritems() -> an iterator over the (key, value) items of D"""
 *         cdef bcf_hrec_t *r = self.ptr
*/

  /* function exit code */
  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_6);
  __Pyx_XDECREF(__pyx_t_7);
  __Pyx_XDECREF(__pyx_t_8);
  if (__Pyx_PyErr_Occurred()) {
    __Pyx_TraceException(__pyx_lineno, 0, 0);
    __Pyx_Generator_Replace_StopIteration(0);
    __Pyx_AddTraceback("iteritems", __pyx_clineno, __pyx_lineno, __pyx_filename);
    __Pyx_TraceExceptionUnwind(0, 0);
  }
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_PyMonitoring_ExitScope(0);
  #if !CYTHON_USE_EXC_INFO_STACK
  __Pyx_Coroutine_ResetAndClearException(__pyx_generator);
  #endif
  __pyx_generator->resume_label = -1;
  __Pyx_Coroutine_clear((PyObject*)__pyx_generator);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "pysam/libcbcf.pyx":1352
 *                 yield (bcf_str_cache_get_charptr(r.keys[i]), charptr_to_str(r.vals[i]) if r.vals[i] else None)
 * 
 *     def keys(self):             # <<<<<<<<<<<<<<
 *         """D.keys() -> list of D's keys"""
 *         return list(self)
*/

/* Python wrapper */
static PyObject *__pyx_pw_5pysam_7libcbcf_19VariantHeaderRecord_24keys(PyObject *__pyx_v_self, 
#if 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_5pysam_7libcbcf_19VariantHeaderRecord_23keys, "VariantHeaderRecord.keys(self)\n\nD.keys() -> list of D's keys");
static PyMethodDef __pyx_mdef_5pysam_7libcbcf_19VariantHeaderRecord_24keys = {"keys", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_5pysam_7libcbcf_19VariantHeaderRecord_24keys, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_5pysam_7libcbcf_19VariantHeaderRecord_23keys};
static PyObject *__pyx_pw_5pysam_7libcbcf_19VariantHeaderRecord_24keys(PyObject *__pyx_v_self, 
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
) {
  #if !CYTHON_METH_FASTCALL
  CYTHON_UNUSED Py_ssize_t __pyx_nargs;
  #endif
  CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("keys (wrapper)", 0);
  #if !CYTHON_METH_FASTCALL
  #if CYTHON_ASSUME_SAFE_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("keys", 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("keys", __pyx_kwds); return NULL;}
  __pyx_r = __pyx_pf_5pysam_7libcbcf_19VariantHeaderRecord_23keys(((struct __pyx_obj_5pysam_7libcbcf_VariantHeaderRecord *)__pyx_v_self));

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

static PyObject *__pyx_pf_5pysam_7libcbcf_19VariantHeaderRecord_23keys(struct __pyx_obj_5pysam_7libcbcf_VariantHeaderRecord *__pyx_v_self) {
  PyObject *__pyx_r = NULL;
  __Pyx_TraceDeclarationsFunc
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_TraceFrameInit(((PyObject *)__pyx_mstate_global->__pyx_codeobj_tab[46]))
  __Pyx_RefNannySetupContext("keys", 0);
  __Pyx_TraceStartFunc("keys", __pyx_f[0], 1352, 0, 0, 0, __PYX_ERR(0, 1352, __pyx_L1_error));

  /* "pysam/libcbcf.pyx":1354
 *     def keys(self):
 *         """D.keys() -> list of D's keys"""
 *         return list(self)             # <<<<<<<<<<<<<<
 * 
 *     def items(self):
*/
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = PySequence_List(((PyObject *)__pyx_v_self)); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1354, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  __Pyx_TraceReturnValue(__pyx_r, 1, 0, __PYX_ERR(0, 1354, __pyx_L1_error));
  goto __pyx_L0;

  /* "pysam/libcbcf.pyx":1352
 *                 yield (bcf_str_cache_get_charptr(r.keys[i]), charptr_to_str(r.vals[i]) if r.vals[i] else None)
 * 
 *     def keys(self):             # <<<<<<<<<<<<<<
 *         """D.keys() -> list of D's keys"""
 *         return list(self)
*/

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_TraceException(__pyx_lineno, 0, 0);
  #if CYTHON_USE_SYS_MONITORING
  __Pyx_TraceExceptionUnwind(0, 0);
  #else
  __Pyx_TraceReturnValue(NULL, 0, 0, __PYX_ERR(0, 1352, __pyx_L1_error));
  #endif
  __Pyx_AddTraceback("pysam.libcbcf.VariantHeaderRecord.keys", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_PyMonitoring_ExitScope(0);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "pysam/libcbcf.pyx":1356
 *         return list(self)
 * 
 *     def items(self):             # <<<<<<<<<<<<<<
 *         """D.items() -> list of D's (key, value) pairs, as 2-tuples"""
 *         return list(self.iteritems())
*/

/* Python wrapper */
static PyObject *__pyx_pw_5pysam_7libcbcf_19VariantHeaderRecord_26items(PyObject *__pyx_v_self, 
#if 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_5pysam_7libcbcf_19VariantHeaderRecord_25items, "VariantHeaderRecord.items(self)\n\nD.items() -> list of D's (key, value) pairs, as 2-tuples");
static PyMethodDef __pyx_mdef_5pysam_7libcbcf_19VariantHeaderRecord_26items = {"items", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_5pysam_7libcbcf_19VariantHeaderRecord_26items, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_5pysam_7libcbcf_19VariantHeaderRecord_25items};
static PyObject *__pyx_pw_5pysam_7libcbcf_19VariantHeaderRecord_26items(PyObject *__pyx_v_self, 
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
) {
  #if !CYTHON_METH_FASTCALL
  CYTHON_UNUSED Py_ssize_t __pyx_nargs;
  #endif
  CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("items (wrapper)", 0);
  #if !CYTHON_METH_FASTCALL
  #if CYTHON_ASSUME_SAFE_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("items", 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("items", __pyx_kwds); return NULL;}
  __pyx_r = __pyx_pf_5pysam_7libcbcf_19VariantHeaderRecord_25items(((struct __pyx_obj_5pysam_7libcbcf_VariantHeaderRecord *)__pyx_v_self));

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

static PyObject *__pyx_pf_5pysam_7libcbcf_19VariantHeaderRecord_25items(struct __pyx_obj_5pysam_7libcbcf_VariantHeaderRecord *__pyx_v_self) {
  PyObject *__pyx_r = NULL;
  __Pyx_TraceDeclarationsFunc
  __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_TraceFrameInit(((PyObject *)__pyx_mstate_global->__pyx_codeobj_tab[47]))
  __Pyx_RefNannySetupContext("items", 0);
  __Pyx_TraceStartFunc("items", __pyx_f[0], 1356, 0, 0, 0, __PYX_ERR(0, 1356, __pyx_L1_error));

  /* "pysam/libcbcf.pyx":1358
 *     def items(self):
 *         """D.items() -> list of D's (key, value) pairs, as 2-tuples"""
 *         return list(self.iteritems())             # <<<<<<<<<<<<<<
 * 
 *     def values(self):
*/
  __Pyx_XDECREF(__pyx_r);
  __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(__pyx_mstate_global->__pyx_n_u_iteritems, __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, 1358, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
  }
  __pyx_t_2 = __Pyx_PySequence_ListKeepNew(__pyx_t_1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1358, __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;
  __Pyx_TraceReturnValue(__pyx_r, 1, 0, __PYX_ERR(0, 1358, __pyx_L1_error));
  goto __pyx_L0;

  /* "pysam/libcbcf.pyx":1356
 *         return list(self)
 * 
 *     def items(self):             # <<<<<<<<<<<<<<
 *         """D.items() -> list of D's (key, value) pairs, as 2-tuples"""
 *         return list(self.iteritems())
*/

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_TraceException(__pyx_lineno, 0, 0);
  #if CYTHON_USE_SYS_MONITORING
  __Pyx_TraceExceptionUnwind(0, 0);
  #else
  __Pyx_TraceReturnValue(NULL, 0, 0, __PYX_ERR(0, 1356, __pyx_L1_error));
  #endif
  __Pyx_AddTraceback("pysam.libcbcf.VariantHeaderRecord.items", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_PyMonitoring_ExitScope(0);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "pysam/libcbcf.pyx":1360
 *         return list(self.iteritems())
 * 
 *     def values(self):             # <<<<<<<<<<<<<<
 *         """D.values() -> list of D's values"""
 *         return list(self.itervalues())
*/

/* Python wrapper */
static PyObject *__pyx_pw_5pysam_7libcbcf_19VariantHeaderRecord_28values(PyObject *__pyx_v_self, 
#if 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_5pysam_7libcbcf_19VariantHeaderRecord_27values, "VariantHeaderRecord.values(self)\n\nD.values() -> list of D's values");
static PyMethodDef __pyx_mdef_5pysam_7libcbcf_19VariantHeaderRecord_28values = {"values", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_5pysam_7libcbcf_19VariantHeaderRecord_28values, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_5pysam_7libcbcf_19VariantHeaderRecord_27values};
static PyObject *__pyx_pw_5pysam_7libcbcf_19VariantHeaderRecord_28values(PyObject *__pyx_v_self, 
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
) {
  #if !CYTHON_METH_FASTCALL
  CYTHON_UNUSED Py_ssize_t __pyx_nargs;
  #endif
  CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("values (wrapper)", 0);
  #if !CYTHON_METH_FASTCALL
  #if CYTHON_ASSUME_SAFE_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("values", 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("values", __pyx_kwds); return NULL;}
  __pyx_r = __pyx_pf_5pysam_7libcbcf_19VariantHeaderRecord_27values(((struct __pyx_obj_5pysam_7libcbcf_VariantHeaderRecord *)__pyx_v_self));

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

static PyObject *__pyx_pf_5pysam_7libcbcf_19VariantHeaderRecord_27values(struct __pyx_obj_5pysam_7libcbcf_VariantHeaderRecord *__pyx_v_self) {
  PyObject *__pyx_r = NULL;
  __Pyx_TraceDeclarationsFunc
  __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_TraceFrameInit(((PyObject *)__pyx_mstate_global->__pyx_codeobj_tab[48]))
  __Pyx_RefNannySetupContext("values", 0);
  __Pyx_TraceStartFunc("values", __pyx_f[0], 1360, 0, 0, 0, __PYX_ERR(0, 1360, __pyx_L1_error));

  /* "pysam/libcbcf.pyx":1362
 *     def values(self):
 *         """D.values() -> list of D's values"""
 *         return list(self.itervalues())             # <<<<<<<<<<<<<<
 * 
 *     def update(self, items=None, **kwargs):
*/
  __Pyx_XDECREF(__pyx_r);
  __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(__pyx_mstate_global->__pyx_n_u_itervalues, __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, 1362, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
  }
  __pyx_t_2 = __Pyx_PySequence_ListKeepNew(__pyx_t_1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1362, __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;
  __Pyx_TraceReturnValue(__pyx_r, 1, 0, __PYX_ERR(0, 1362, __pyx_L1_error));
  goto __pyx_L0;

  /* "pysam/libcbcf.pyx":1360
 *         return list(self.iteritems())
 * 
 *     def values(self):             # <<<<<<<<<<<<<<
 *         """D.values() -> list of D's values"""
 *         return list(self.itervalues())
*/

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_TraceException(__pyx_lineno, 0, 0);
  #if CYTHON_USE_SYS_MONITORING
  __Pyx_TraceExceptionUnwind(0, 0);
  #else
  __Pyx_TraceReturnValue(NULL, 0, 0, __PYX_ERR(0, 1360, __pyx_L1_error));
  #endif
  __Pyx_AddTraceback("pysam.libcbcf.VariantHeaderRecord.values", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_PyMonitoring_ExitScope(0);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "pysam/libcbcf.pyx":1364
 *         return list(self.itervalues())
 * 
 *     def update(self, items=None, **kwargs):             # <<<<<<<<<<<<<<
 *         """D.update([E, ]**F) -> None.
 * 
*/

/* Python wrapper */
static PyObject *__pyx_pw_5pysam_7libcbcf_19VariantHeaderRecord_30update(PyObject *__pyx_v_self, 
#if 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_5pysam_7libcbcf_19VariantHeaderRecord_29update, "VariantHeaderRecord.update(self, items=None, **kwargs)\n\nD.update([E, ]**F) -> None.\n\nUpdate D from dict/iterable E and F.");
static PyMethodDef __pyx_mdef_5pysam_7libcbcf_19VariantHeaderRecord_30update = {"update", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_5pysam_7libcbcf_19VariantHeaderRecord_30update, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_5pysam_7libcbcf_19VariantHeaderRecord_29update};
static PyObject *__pyx_pw_5pysam_7libcbcf_19VariantHeaderRecord_30update(PyObject *__pyx_v_self, 
#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_items = 0;
  PyObject *__pyx_v_kwargs = 0;
  #if !CYTHON_METH_FASTCALL
  CYTHON_UNUSED Py_ssize_t __pyx_nargs;
  #endif
  CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
  PyObject* values[1] = {0};
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("update (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_kwargs = PyDict_New(); if (unlikely(!__pyx_v_kwargs)) return NULL;
  __Pyx_GOTREF(__pyx_v_kwargs);
  {
    PyObject ** const __pyx_pyargnames[] = {&__pyx_mstate_global->__pyx_n_u_items,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, 1364, __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, 1364, __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, __pyx_v_kwargs, values, kwd_pos_args, __pyx_kwds_len, "update", 1) < 0) __PYX_ERR(0, 1364, __pyx_L3_error)
      if (!values[0]) values[0] = __Pyx_NewRef(((PyObject *)Py_None));
    } 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, 1364, __pyx_L3_error)
        CYTHON_FALLTHROUGH;
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      if (!values[0]) values[0] = __Pyx_NewRef(((PyObject *)Py_None));
    }
    __pyx_v_items = values[0];
  }
  goto __pyx_L6_skip;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("update", 0, 0, 1, __pyx_nargs); __PYX_ERR(0, 1364, __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_kwargs); __pyx_v_kwargs = 0;
  __Pyx_AddTraceback("pysam.libcbcf.VariantHeaderRecord.update", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_5pysam_7libcbcf_19VariantHeaderRecord_29update(((struct __pyx_obj_5pysam_7libcbcf_VariantHeaderRecord *)__pyx_v_self), __pyx_v_items, __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_kwargs);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_5pysam_7libcbcf_19VariantHeaderRecord_29update(struct __pyx_obj_5pysam_7libcbcf_VariantHeaderRecord *__pyx_v_self, PyObject *__pyx_v_items, PyObject *__pyx_v_kwargs) {
  PyObject *__pyx_v_k = NULL;
  PyObject *__pyx_v_v = NULL;
  PyObject *__pyx_r = NULL;
  __Pyx_TraceDeclarationsFunc
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  Py_ssize_t __pyx_t_2;
  Py_ssize_t __pyx_t_3;
  int __pyx_t_4;
  PyObject *__pyx_t_5 = NULL;
  PyObject *__pyx_t_6 = NULL;
  int __pyx_t_7;
  int __pyx_t_8;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_TraceFrameInit(((PyObject *)__pyx_mstate_global->__pyx_codeobj_tab[49]))
  __Pyx_RefNannySetupContext("update", 0);
  __Pyx_TraceStartFunc("update", __pyx_f[0], 1364, 0, 0, 0, __PYX_ERR(0, 1364, __pyx_L1_error));

  /* "pysam/libcbcf.pyx":1369
 *         Update D from dict/iterable E and F.
 *         """
 *         for k, v in items.items():             # <<<<<<<<<<<<<<
 *             self[k] = v
 * 
*/
  __pyx_t_2 = 0;
  if (unlikely(__pyx_v_items == Py_None)) {
    PyErr_Format(PyExc_AttributeError, "'NoneType' object has no attribute '%.30s'", "items");
    __PYX_ERR(0, 1369, __pyx_L1_error)
  }
  __pyx_t_5 = __Pyx_dict_iterator(__pyx_v_items, 0, __pyx_mstate_global->__pyx_n_u_items, (&__pyx_t_3), (&__pyx_t_4)); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1369, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_5);
  __Pyx_XDECREF(__pyx_t_1);
  __pyx_t_1 = __pyx_t_5;
  __pyx_t_5 = 0;
  while (1) {
    __pyx_t_7 = __Pyx_dict_iter_next(__pyx_t_1, __pyx_t_3, &__pyx_t_2, &__pyx_t_5, &__pyx_t_6, NULL, __pyx_t_4);
    if (unlikely(__pyx_t_7 == 0)) break;
    if (unlikely(__pyx_t_7 == -1)) __PYX_ERR(0, 1369, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_5);
    __Pyx_GOTREF(__pyx_t_6);
    __Pyx_XDECREF_SET(__pyx_v_k, __pyx_t_5);
    __pyx_t_5 = 0;
    __Pyx_XDECREF_SET(__pyx_v_v, __pyx_t_6);
    __pyx_t_6 = 0;

    /* "pysam/libcbcf.pyx":1370
 *         """
 *         for k, v in items.items():
 *             self[k] = v             # <<<<<<<<<<<<<<
 * 
 *         if kwargs:
*/
    if (unlikely((PyObject_SetItem(((PyObject *)__pyx_v_self), __pyx_v_k, __pyx_v_v) < 0))) __PYX_ERR(0, 1370, __pyx_L1_error)
  }
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "pysam/libcbcf.pyx":1372
 *             self[k] = v
 * 
 *         if kwargs:             # <<<<<<<<<<<<<<
 *             for k, v in kwargs.items():
 *                 self[k] = v
*/
  __pyx_t_8 = __Pyx_PyObject_IsTrue(__pyx_v_kwargs); if (unlikely((__pyx_t_8 < 0))) __PYX_ERR(0, 1372, __pyx_L1_error)
  if (__pyx_t_8) {

    /* "pysam/libcbcf.pyx":1373
 * 
 *         if kwargs:
 *             for k, v in kwargs.items():             # <<<<<<<<<<<<<<
 *                 self[k] = v
 * 
*/
    __pyx_t_3 = 0;
    __pyx_t_6 = __Pyx_dict_iterator(__pyx_v_kwargs, 1, __pyx_mstate_global->__pyx_n_u_items, (&__pyx_t_2), (&__pyx_t_4)); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 1373, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_6);
    __Pyx_XDECREF(__pyx_t_1);
    __pyx_t_1 = __pyx_t_6;
    __pyx_t_6 = 0;
    while (1) {
      __pyx_t_7 = __Pyx_dict_iter_next(__pyx_t_1, __pyx_t_2, &__pyx_t_3, &__pyx_t_6, &__pyx_t_5, NULL, __pyx_t_4);
      if (unlikely(__pyx_t_7 == 0)) break;
      if (unlikely(__pyx_t_7 == -1)) __PYX_ERR(0, 1373, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_6);
      __Pyx_GOTREF(__pyx_t_5);
      __Pyx_XDECREF_SET(__pyx_v_k, __pyx_t_6);
      __pyx_t_6 = 0;
      __Pyx_XDECREF_SET(__pyx_v_v, __pyx_t_5);
      __pyx_t_5 = 0;

      /* "pysam/libcbcf.pyx":1374
 *         if kwargs:
 *             for k, v in kwargs.items():
 *                 self[k] = v             # <<<<<<<<<<<<<<
 * 
 *     def pop(self, key, default=_nothing):
*/
      if (unlikely((PyObject_SetItem(((PyObject *)__pyx_v_self), __pyx_v_k, __pyx_v_v) < 0))) __PYX_ERR(0, 1374, __pyx_L1_error)
    }
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

    /* "pysam/libcbcf.pyx":1372
 *             self[k] = v
 * 
 *         if kwargs:             # <<<<<<<<<<<<<<
 *             for k, v in kwargs.items():
 *                 self[k] = v
*/
  }

  /* "pysam/libcbcf.pyx":1364
 *         return list(self.itervalues())
 * 
 *     def update(self, items=None, **kwargs):             # <<<<<<<<<<<<<<
 *         """D.update([E, ]**F) -> None.
 * 
*/

  /* function exit code */
  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  __Pyx_TraceReturnValue(__pyx_r, 0, 0, __PYX_ERR(0, 1364, __pyx_L1_error));
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_5);
  __Pyx_XDECREF(__pyx_t_6);
  __Pyx_TraceException(__pyx_lineno, 0, 0);
  #if CYTHON_USE_SYS_MONITORING
  __Pyx_TraceExceptionUnwind(0, 0);
  #else
  __Pyx_TraceReturnValue(NULL, 0, 0, __PYX_ERR(0, 1364, __pyx_L1_error));
  #endif
  __Pyx_AddTraceback("pysam.libcbcf.VariantHeaderRecord.update", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_k);
  __Pyx_XDECREF(__pyx_v_v);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_PyMonitoring_ExitScope(0);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "pysam/libcbcf.pyx":1376
 *                 self[k] = v
 * 
 *     def pop(self, key, default=_nothing):             # <<<<<<<<<<<<<<
 *         try:
 *             value = self[key]
*/

/* Python wrapper */
static PyObject *__pyx_pw_5pysam_7libcbcf_19VariantHeaderRecord_32pop(PyObject *__pyx_v_self, 
#if 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_5pysam_7libcbcf_19VariantHeaderRecord_31pop, "VariantHeaderRecord.pop(self, key, default=_nothing)");
static PyMethodDef __pyx_mdef_5pysam_7libcbcf_19VariantHeaderRecord_32pop = {"pop", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_5pysam_7libcbcf_19VariantHeaderRecord_32pop, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_5pysam_7libcbcf_19VariantHeaderRecord_31pop};
static PyObject *__pyx_pw_5pysam_7libcbcf_19VariantHeaderRecord_32pop(PyObject *__pyx_v_self, 
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
) {
  PyObject *__pyx_v_key = 0;
  PyObject *__pyx_v_default = 0;
  #if !CYTHON_METH_FASTCALL
  CYTHON_UNUSED Py_ssize_t __pyx_nargs;
  #endif
  CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
  PyObject* values[2] = {0,0};
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("pop (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,&__pyx_mstate_global->__pyx_n_u_default,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, 1376, __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, 1376, __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, 1376, __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, "pop", 0) < 0) __PYX_ERR(0, 1376, __pyx_L3_error)
      if (!values[1]) values[1] = __Pyx_NewRef(__pyx_mstate_global->__pyx_k__3);
      for (Py_ssize_t i = __pyx_nargs; i < 1; i++) {
        if (unlikely(!values[i])) { __Pyx_RaiseArgtupleInvalid("pop", 0, 1, 2, i); __PYX_ERR(0, 1376, __pyx_L3_error) }
      }
    } 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, 1376, __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, 1376, __pyx_L3_error)
        break;
        default: goto __pyx_L5_argtuple_error;
      }
      if (!values[1]) values[1] = __Pyx_NewRef(__pyx_mstate_global->__pyx_k__3);
    }
    __pyx_v_key = values[0];
    __pyx_v_default = values[1];
  }
  goto __pyx_L6_skip;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("pop", 0, 1, 2, __pyx_nargs); __PYX_ERR(0, 1376, __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("pysam.libcbcf.VariantHeaderRecord.pop", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_5pysam_7libcbcf_19VariantHeaderRecord_31pop(((struct __pyx_obj_5pysam_7libcbcf_VariantHeaderRecord *)__pyx_v_self), __pyx_v_key, __pyx_v_default);

  /* 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_5pysam_7libcbcf_19VariantHeaderRecord_31pop(struct __pyx_obj_5pysam_7libcbcf_VariantHeaderRecord *__pyx_v_self, PyObject *__pyx_v_key, PyObject *__pyx_v_default) {
  PyObject *__pyx_v_value = NULL;
  PyObject *__pyx_r = NULL;
  __Pyx_TraceDeclarationsFunc
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  PyObject *__pyx_t_4 = NULL;
  int __pyx_t_5;
  PyObject *__pyx_t_6 = NULL;
  PyObject *__pyx_t_7 = NULL;
  int __pyx_t_8;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_TraceFrameInit(((PyObject *)__pyx_mstate_global->__pyx_codeobj_tab[50]))
  __Pyx_RefNannySetupContext("pop", 0);
  __Pyx_TraceStartFunc("pop", __pyx_f[0], 1376, 0, 0, 0, __PYX_ERR(0, 1376, __pyx_L1_error));

  /* "pysam/libcbcf.pyx":1377
 * 
 *     def pop(self, key, default=_nothing):
 *         try:             # <<<<<<<<<<<<<<
 *             value = self[key]
 *             del self[key]
*/
  {
    __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:*/ {

      /* "pysam/libcbcf.pyx":1378
 *     def pop(self, key, default=_nothing):
 *         try:
 *             value = self[key]             # <<<<<<<<<<<<<<
 *             del self[key]
 *             return value
*/
      __pyx_t_4 = __Pyx_PyObject_GetItem(((PyObject *)__pyx_v_self), __pyx_v_key); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1378, __pyx_L3_error)
      __Pyx_GOTREF(__pyx_t_4);
      __pyx_v_value = __pyx_t_4;
      __pyx_t_4 = 0;

      /* "pysam/libcbcf.pyx":1379
 *         try:
 *             value = self[key]
 *             del self[key]             # <<<<<<<<<<<<<<
 *             return value
 *         except KeyError:
*/
      if (unlikely((PyObject_DelItem(((PyObject *)__pyx_v_self), __pyx_v_key) < 0))) __PYX_ERR(0, 1379, __pyx_L3_error)

      /* "pysam/libcbcf.pyx":1380
 *             value = self[key]
 *             del self[key]
 *             return value             # <<<<<<<<<<<<<<
 *         except KeyError:
 *             if default is not _nothing:
*/
      __Pyx_XDECREF(__pyx_r);
      __Pyx_INCREF(__pyx_v_value);
      __pyx_r = __pyx_v_value;
      __Pyx_TraceReturnValue(__pyx_r, 11, 0, __PYX_ERR(0, 1380, __pyx_L3_error));
      goto __pyx_L7_try_return;

      /* "pysam/libcbcf.pyx":1377
 * 
 *     def pop(self, key, default=_nothing):
 *         try:             # <<<<<<<<<<<<<<
 *             value = self[key]
 *             del self[key]
*/
    }
    __pyx_L3_error:;
    __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
    __Pyx_TraceException(__pyx_lineno, 0, 0);

    /* "pysam/libcbcf.pyx":1381
 *             del self[key]
 *             return value
 *         except KeyError:             # <<<<<<<<<<<<<<
 *             if default is not _nothing:
 *                 return default
*/
    __pyx_t_5 = __Pyx_PyErr_ExceptionMatches(__pyx_builtin_KeyError);
    if (__pyx_t_5) {
      __Pyx_AddTraceback("pysam.libcbcf.VariantHeaderRecord.pop", __pyx_clineno, __pyx_lineno, __pyx_filename);
      __Pyx_TraceExceptionHandled(0);
      if (__Pyx_GetException(&__pyx_t_4, &__pyx_t_6, &__pyx_t_7) < 0) __PYX_ERR(0, 1381, __pyx_L5_except_error)
      __Pyx_XGOTREF(__pyx_t_4);
      __Pyx_XGOTREF(__pyx_t_6);
      __Pyx_XGOTREF(__pyx_t_7);
      __Pyx_TraceExceptionDone();

      /* "pysam/libcbcf.pyx":1382
 *             return value
 *         except KeyError:
 *             if default is not _nothing:             # <<<<<<<<<<<<<<
 *                 return default
 *             raise
*/
      __pyx_t_8 = (__pyx_v_default != __pyx_v_5pysam_7libcbcf__nothing);
      if (__pyx_t_8) {

        /* "pysam/libcbcf.pyx":1383
 *         except KeyError:
 *             if default is not _nothing:
 *                 return default             # <<<<<<<<<<<<<<
 *             raise
 * 
*/
        __Pyx_XDECREF(__pyx_r);
        __Pyx_INCREF(__pyx_v_default);
        __pyx_r = __pyx_v_default;
        __Pyx_TraceReturnValue(__pyx_r, 18, 0, __PYX_ERR(0, 1383, __pyx_L5_except_error));
        __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;

        /* "pysam/libcbcf.pyx":1382
 *             return value
 *         except KeyError:
 *             if default is not _nothing:             # <<<<<<<<<<<<<<
 *                 return default
 *             raise
*/
      }

      /* "pysam/libcbcf.pyx":1384
 *             if default is not _nothing:
 *                 return default
 *             raise             # <<<<<<<<<<<<<<
 * 
 *     # Mappings are not hashable by default, but subclasses can change this
*/
      __Pyx_GIVEREF(__pyx_t_4);
      __Pyx_GIVEREF(__pyx_t_6);
      __Pyx_XGIVEREF(__pyx_t_7);
      __Pyx_ErrRestoreWithState(__pyx_t_4, __pyx_t_6, __pyx_t_7);
      __pyx_t_4 = 0;  __pyx_t_6 = 0;  __pyx_t_7 = 0; 
      __Pyx_TraceException(20, 1, 0);
      __PYX_ERR(0, 1384, __pyx_L5_except_error)
    }
    goto __pyx_L5_except_error;

    /* "pysam/libcbcf.pyx":1377
 * 
 *     def pop(self, key, default=_nothing):
 *         try:             # <<<<<<<<<<<<<<
 *             value = self[key]
 *             del self[key]
*/
    __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;
  }

  /* "pysam/libcbcf.pyx":1376
 *                 self[k] = v
 * 
 *     def pop(self, key, default=_nothing):             # <<<<<<<<<<<<<<
 *         try:
 *             value = self[key]
*/

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_XDECREF(__pyx_t_6);
  __Pyx_XDECREF(__pyx_t_7);
  __Pyx_TraceException(__pyx_lineno, 0, 0);
  #if CYTHON_USE_SYS_MONITORING
  __Pyx_TraceExceptionUnwind(0, 0);
  #else
  __Pyx_TraceReturnValue(NULL, 0, 0, __PYX_ERR(0, 1376, __pyx_L1_error));
  #endif
  __Pyx_AddTraceback("pysam.libcbcf.VariantHeaderRecord.pop", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_value);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_PyMonitoring_ExitScope(0);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "pysam/libcbcf.pyx":1391
 *     #TODO: implement __richcmp__
 * 
 *     def __str__(self):             # <<<<<<<<<<<<<<
 *         cdef bcf_hrec_t *r = self.ptr
 * 
*/

/* Python wrapper */
static PyObject *__pyx_pw_5pysam_7libcbcf_19VariantHeaderRecord_34__str__(PyObject *__pyx_v_self); /*proto*/
static PyObject *__pyx_pw_5pysam_7libcbcf_19VariantHeaderRecord_34__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_5pysam_7libcbcf_19VariantHeaderRecord_33__str__(((struct __pyx_obj_5pysam_7libcbcf_VariantHeaderRecord *)__pyx_v_self));

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

static PyObject *__pyx_pf_5pysam_7libcbcf_19VariantHeaderRecord_33__str__(struct __pyx_obj_5pysam_7libcbcf_VariantHeaderRecord *__pyx_v_self) {
  bcf_hrec_t *__pyx_v_r;
  kstring_t __pyx_v_hrec_str;
  PyObject *__pyx_v_ret = NULL;
  PyObject *__pyx_r = NULL;
  __Pyx_TraceDeclarationsFunc
  __Pyx_RefNannyDeclarations
  bcf_hrec_t *__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_TraceFrameInit(((PyObject *)__pyx_mstate_global->__pyx_codeobj_tab[51]))
  __Pyx_RefNannySetupContext("__str__", 0);
  __Pyx_TraceStartFunc("__str__", __pyx_f[0], 1391, 0, 0, 0, __PYX_ERR(0, 1391, __pyx_L1_error));

  /* "pysam/libcbcf.pyx":1392
 * 
 *     def __str__(self):
 *         cdef bcf_hrec_t *r = self.ptr             # <<<<<<<<<<<<<<
 * 
 *         if not r:
*/
  __pyx_t_1 = __pyx_v_self->ptr;
  __pyx_v_r = __pyx_t_1;

  /* "pysam/libcbcf.pyx":1394
 *         cdef bcf_hrec_t *r = self.ptr
 * 
 *         if not r:             # <<<<<<<<<<<<<<
 *             raise ValueError('cannot convert deleted record to str')
 * 
*/
  __pyx_t_2 = (!(__pyx_v_r != 0));
  if (unlikely(__pyx_t_2)) {

    /* "pysam/libcbcf.pyx":1395
 * 
 *         if not r:
 *             raise ValueError('cannot convert deleted record to str')             # <<<<<<<<<<<<<<
 * 
 *         cdef kstring_t hrec_str
*/
    __pyx_t_4 = NULL;
    __Pyx_INCREF(__pyx_builtin_ValueError);
    __pyx_t_5 = __pyx_builtin_ValueError; 
    __pyx_t_6 = 1;
    {
      PyObject *__pyx_callargs[2] = {__pyx_t_4, __pyx_mstate_global->__pyx_kp_u_cannot_convert_deleted_record_to};
      __pyx_t_3 = __Pyx_PyObject_FastCall(__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, 1395, __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, 1395, __pyx_L1_error)

    /* "pysam/libcbcf.pyx":1394
 *         cdef bcf_hrec_t *r = self.ptr
 * 
 *         if not r:             # <<<<<<<<<<<<<<
 *             raise ValueError('cannot convert deleted record to str')
 * 
*/
  }

  /* "pysam/libcbcf.pyx":1398
 * 
 *         cdef kstring_t hrec_str
 *         hrec_str.l = hrec_str.m = 0             # <<<<<<<<<<<<<<
 *         hrec_str.s = NULL
 * 
*/
  __pyx_v_hrec_str.l = 0;
  __pyx_v_hrec_str.m = 0;

  /* "pysam/libcbcf.pyx":1399
 *         cdef kstring_t hrec_str
 *         hrec_str.l = hrec_str.m = 0
 *         hrec_str.s = NULL             # <<<<<<<<<<<<<<
 * 
 *         bcf_hrec_format(r, &hrec_str)
*/
  __pyx_v_hrec_str.s = NULL;

  /* "pysam/libcbcf.pyx":1401
 *         hrec_str.s = NULL
 * 
 *         bcf_hrec_format(r, &hrec_str)             # <<<<<<<<<<<<<<
 * 
 *         ret = charptr_to_str_w_len(hrec_str.s, hrec_str.l)
*/
  bcf_hrec_format(__pyx_v_r, (&__pyx_v_hrec_str));

  /* "pysam/libcbcf.pyx":1403
 *         bcf_hrec_format(r, &hrec_str)
 * 
 *         ret = charptr_to_str_w_len(hrec_str.s, hrec_str.l)             # <<<<<<<<<<<<<<
 * 
 *         if hrec_str.m:
*/
  __pyx_t_3 = __pyx_f_5pysam_9libcutils_charptr_to_str_w_len(__pyx_v_hrec_str.s, __pyx_v_hrec_str.l, NULL); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1403, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __pyx_v_ret = __pyx_t_3;
  __pyx_t_3 = 0;

  /* "pysam/libcbcf.pyx":1405
 *         ret = charptr_to_str_w_len(hrec_str.s, hrec_str.l)
 * 
 *         if hrec_str.m:             # <<<<<<<<<<<<<<
 *             free(hrec_str.s)
 * 
*/
  __pyx_t_2 = (__pyx_v_hrec_str.m != 0);
  if (__pyx_t_2) {

    /* "pysam/libcbcf.pyx":1406
 * 
 *         if hrec_str.m:
 *             free(hrec_str.s)             # <<<<<<<<<<<<<<
 * 
 *         return ret
*/
    free(__pyx_v_hrec_str.s);

    /* "pysam/libcbcf.pyx":1405
 *         ret = charptr_to_str_w_len(hrec_str.s, hrec_str.l)
 * 
 *         if hrec_str.m:             # <<<<<<<<<<<<<<
 *             free(hrec_str.s)
 * 
*/
  }

  /* "pysam/libcbcf.pyx":1408
 *             free(hrec_str.s)
 * 
 *         return ret             # <<<<<<<<<<<<<<
 * 
 *     # FIXME: Not safe -- causes trivial segfaults at the moment
*/
  __Pyx_XDECREF(__pyx_r);
  __Pyx_INCREF(__pyx_v_ret);
  __pyx_r = __pyx_v_ret;
  __Pyx_TraceReturnValue(__pyx_r, 38, 0, __PYX_ERR(0, 1408, __pyx_L1_error));
  goto __pyx_L0;

  /* "pysam/libcbcf.pyx":1391
 *     #TODO: implement __richcmp__
 * 
 *     def __str__(self):             # <<<<<<<<<<<<<<
 *         cdef bcf_hrec_t *r = self.ptr
 * 
*/

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_XDECREF(__pyx_t_5);
  __Pyx_TraceException(__pyx_lineno, 0, 0);
  #if CYTHON_USE_SYS_MONITORING
  __Pyx_TraceExceptionUnwind(0, 0);
  #else
  __Pyx_TraceReturnValue(NULL, 0, 0, __PYX_ERR(0, 1391, __pyx_L1_error));
  #endif
  __Pyx_AddTraceback("pysam.libcbcf.VariantHeaderRecord.__str__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_ret);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_PyMonitoring_ExitScope(0);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "pysam/libcbcf.pyx":1411
 * 
 *     # FIXME: Not safe -- causes trivial segfaults at the moment
 *     def remove(self):             # <<<<<<<<<<<<<<
 *         cdef bcf_hdr_t *hdr = self.header.ptr
 *         cdef bcf_hrec_t *r = self.ptr
*/

/* Python wrapper */
static PyObject *__pyx_pw_5pysam_7libcbcf_19VariantHeaderRecord_36remove(PyObject *__pyx_v_self, 
#if 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_5pysam_7libcbcf_19VariantHeaderRecord_35remove, "VariantHeaderRecord.remove(self)");
static PyMethodDef __pyx_mdef_5pysam_7libcbcf_19VariantHeaderRecord_36remove = {"remove", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_5pysam_7libcbcf_19VariantHeaderRecord_36remove, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_5pysam_7libcbcf_19VariantHeaderRecord_35remove};
static PyObject *__pyx_pw_5pysam_7libcbcf_19VariantHeaderRecord_36remove(PyObject *__pyx_v_self, 
#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("remove (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("remove", 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("remove", __pyx_kwds); return NULL;}
  __pyx_r = __pyx_pf_5pysam_7libcbcf_19VariantHeaderRecord_35remove(((struct __pyx_obj_5pysam_7libcbcf_VariantHeaderRecord *)__pyx_v_self));

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

static PyObject *__pyx_pf_5pysam_7libcbcf_19VariantHeaderRecord_35remove(struct __pyx_obj_5pysam_7libcbcf_VariantHeaderRecord *__pyx_v_self) {
  bcf_hdr_t *__pyx_v_hdr;
  bcf_hrec_t *__pyx_v_r;
  char *__pyx_v_key;
  PyObject *__pyx_r = NULL;
  __Pyx_TraceDeclarationsFunc
  __Pyx_RefNannyDeclarations
  bcf_hdr_t *__pyx_t_1;
  bcf_hrec_t *__pyx_t_2;
  int __pyx_t_3;
  char *__pyx_t_4;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_TraceFrameInit(((PyObject *)__pyx_mstate_global->__pyx_codeobj_tab[52]))
  __Pyx_RefNannySetupContext("remove", 0);
  __Pyx_TraceStartFunc("remove", __pyx_f[0], 1411, 0, 0, 0, __PYX_ERR(0, 1411, __pyx_L1_error));

  /* "pysam/libcbcf.pyx":1412
 *     # FIXME: Not safe -- causes trivial segfaults at the moment
 *     def remove(self):
 *         cdef bcf_hdr_t *hdr = self.header.ptr             # <<<<<<<<<<<<<<
 *         cdef bcf_hrec_t *r = self.ptr
 *         if not r:
*/
  __pyx_t_1 = __pyx_v_self->header->ptr;
  __pyx_v_hdr = __pyx_t_1;

  /* "pysam/libcbcf.pyx":1413
 *     def remove(self):
 *         cdef bcf_hdr_t *hdr = self.header.ptr
 *         cdef bcf_hrec_t *r = self.ptr             # <<<<<<<<<<<<<<
 *         if not r:
 *             return
*/
  __pyx_t_2 = __pyx_v_self->ptr;
  __pyx_v_r = __pyx_t_2;

  /* "pysam/libcbcf.pyx":1414
 *         cdef bcf_hdr_t *hdr = self.header.ptr
 *         cdef bcf_hrec_t *r = self.ptr
 *         if not r:             # <<<<<<<<<<<<<<
 *             return
 *         assert r.key
*/
  __pyx_t_3 = (!(__pyx_v_r != 0));
  if (__pyx_t_3) {

    /* "pysam/libcbcf.pyx":1415
 *         cdef bcf_hrec_t *r = self.ptr
 *         if not r:
 *             return             # <<<<<<<<<<<<<<
 *         assert r.key
 *         cdef char *key = r.key if r.type == BCF_HL_GEN else r.value
*/
    __Pyx_XDECREF(__pyx_r);
    __pyx_r = Py_None; __Pyx_INCREF(Py_None);
    goto __pyx_L0;

    /* "pysam/libcbcf.pyx":1414
 *         cdef bcf_hdr_t *hdr = self.header.ptr
 *         cdef bcf_hrec_t *r = self.ptr
 *         if not r:             # <<<<<<<<<<<<<<
 *             return
 *         assert r.key
*/
  }

  /* "pysam/libcbcf.pyx":1416
 *         if not r:
 *             return
 *         assert r.key             # <<<<<<<<<<<<<<
 *         cdef char *key = r.key if r.type == BCF_HL_GEN else r.value
 *         bcf_hdr_remove(hdr, r.type, key)
*/
  #ifndef CYTHON_WITHOUT_ASSERTIONS
  if (unlikely(__pyx_assertions_enabled())) {
    __pyx_t_3 = (__pyx_v_r->key != 0);
    if (unlikely(!__pyx_t_3)) {
      __Pyx_Raise(__pyx_builtin_AssertionError, 0, 0, 0);
      __PYX_ERR(0, 1416, __pyx_L1_error)
    }
  }
  #else
  if ((1)); else __PYX_ERR(0, 1416, __pyx_L1_error)
  #endif

  /* "pysam/libcbcf.pyx":1417
 *             return
 *         assert r.key
 *         cdef char *key = r.key if r.type == BCF_HL_GEN else r.value             # <<<<<<<<<<<<<<
 *         bcf_hdr_remove(hdr, r.type, key)
 *         self.ptr = NULL
*/
  __pyx_t_3 = (__pyx_v_r->type == BCF_HL_GEN);
  if (__pyx_t_3) {
    __pyx_t_4 = __pyx_v_r->key;
  } else {
    __pyx_t_4 = __pyx_v_r->value;
  }
  __pyx_v_key = __pyx_t_4;

  /* "pysam/libcbcf.pyx":1418
 *         assert r.key
 *         cdef char *key = r.key if r.type == BCF_HL_GEN else r.value
 *         bcf_hdr_remove(hdr, r.type, key)             # <<<<<<<<<<<<<<
 *         self.ptr = NULL
 * 
*/
  bcf_hdr_remove(__pyx_v_hdr, __pyx_v_r->type, __pyx_v_key);

  /* "pysam/libcbcf.pyx":1419
 *         cdef char *key = r.key if r.type == BCF_HL_GEN else r.value
 *         bcf_hdr_remove(hdr, r.type, key)
 *         self.ptr = NULL             # <<<<<<<<<<<<<<
 * 
 * 
*/
  __pyx_v_self->ptr = NULL;

  /* "pysam/libcbcf.pyx":1411
 * 
 *     # FIXME: Not safe -- causes trivial segfaults at the moment
 *     def remove(self):             # <<<<<<<<<<<<<<
 *         cdef bcf_hdr_t *hdr = self.header.ptr
 *         cdef bcf_hrec_t *r = self.ptr
*/

  /* function exit code */
  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  __Pyx_TraceReturnValue(__pyx_r, 0, 0, __PYX_ERR(0, 1411, __pyx_L1_error));
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_TraceException(__pyx_lineno, 0, 0);
  #if CYTHON_USE_SYS_MONITORING
  __Pyx_TraceExceptionUnwind(0, 0);
  #else
  __Pyx_TraceReturnValue(NULL, 0, 0, __PYX_ERR(0, 1411, __pyx_L1_error));
  #endif
  __Pyx_AddTraceback("pysam.libcbcf.VariantHeaderRecord.remove", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_PyMonitoring_ExitScope(0);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "pysam/libcbcf.pxd":48
 * 
 * cdef class VariantHeaderRecord(object):
 *     cdef readonly VariantHeader header             # <<<<<<<<<<<<<<
 *     cdef bcf_hrec_t *ptr
 * 
*/

/* Python wrapper */
static PyObject *__pyx_pw_5pysam_7libcbcf_19VariantHeaderRecord_6header_1__get__(PyObject *__pyx_v_self); /*proto*/
static PyObject *__pyx_pw_5pysam_7libcbcf_19VariantHeaderRecord_6header_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_5pysam_7libcbcf_19VariantHeaderRecord_6header___get__(((struct __pyx_obj_5pysam_7libcbcf_VariantHeaderRecord *)__pyx_v_self));

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

static PyObject *__pyx_pf_5pysam_7libcbcf_19VariantHeaderRecord_6header___get__(struct __pyx_obj_5pysam_7libcbcf_VariantHeaderRecord *__pyx_v_self) {
  PyObject *__pyx_r = NULL;
  __Pyx_TraceDeclarationsFunc
  __Pyx_RefNannyDeclarations
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_TraceFrameInit(((PyObject *)__pyx_mstate_global->__pyx_codeobj_tab[53]))
  __Pyx_RefNannySetupContext("__get__", 0);
  __Pyx_TraceStartFunc("__get__", __pyx_f[3], 48, 0, 0, 0, __PYX_ERR(3, 48, __pyx_L1_error));
  __Pyx_XDECREF(__pyx_r);
  __Pyx_INCREF((PyObject *)__pyx_v_self->header);
  __pyx_r = ((PyObject *)__pyx_v_self->header);
  __Pyx_TraceReturnValue(__pyx_r, 0, 0, __PYX_ERR(3, 48, __pyx_L1_error));
  goto __pyx_L0;

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_TraceException(__pyx_lineno, 0, 0);
  #if CYTHON_USE_SYS_MONITORING
  __Pyx_TraceExceptionUnwind(0, 0);
  #else
  __Pyx_TraceReturnValue(NULL, 0, 0, __PYX_ERR(3, 48, __pyx_L1_error));
  #endif
  __Pyx_AddTraceback("pysam.libcbcf.VariantHeaderRecord.header.__get__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_PyMonitoring_ExitScope(0);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "(tree fragment)":1
 * def __reduce_cython__(self):             # <<<<<<<<<<<<<<
 *     raise TypeError, "self.ptr cannot be converted to a Python object for pickling"
 * def __setstate_cython__(self, __pyx_state):
*/

/* Python wrapper */
static PyObject *__pyx_pw_5pysam_7libcbcf_19VariantHeaderRecord_38__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*/
PyDoc_STRVAR(__pyx_doc_5pysam_7libcbcf_19VariantHeaderRecord_37__reduce_cython__, "VariantHeaderRecord.__reduce_cython__(self)");
static PyMethodDef __pyx_mdef_5pysam_7libcbcf_19VariantHeaderRecord_38__reduce_cython__ = {"__reduce_cython__", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_5pysam_7libcbcf_19VariantHeaderRecord_38__reduce_cython__, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_5pysam_7libcbcf_19VariantHeaderRecord_37__reduce_cython__};
static PyObject *__pyx_pw_5pysam_7libcbcf_19VariantHeaderRecord_38__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_5pysam_7libcbcf_19VariantHeaderRecord_37__reduce_cython__(((struct __pyx_obj_5pysam_7libcbcf_VariantHeaderRecord *)__pyx_v_self));

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

static PyObject *__pyx_pf_5pysam_7libcbcf_19VariantHeaderRecord_37__reduce_cython__(CYTHON_UNUSED struct __pyx_obj_5pysam_7libcbcf_VariantHeaderRecord *__pyx_v_self) {
  PyObject *__pyx_r = NULL;
  __Pyx_TraceDeclarationsFunc
  __Pyx_RefNannyDeclarations
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_TraceFrameInit(((PyObject *)__pyx_mstate_global->__pyx_codeobj_tab[54]))
  __Pyx_RefNannySetupContext("__reduce_cython__", 0);
  __Pyx_TraceStartFunc("__reduce_cython__", __pyx_f[4], 1, 0, 0, 0, __PYX_ERR(4, 1, __pyx_L1_error));

  /* "(tree fragment)":2
 * def __reduce_cython__(self):
 *     raise TypeError, "self.ptr cannot be converted to a Python object for pickling"             # <<<<<<<<<<<<<<
 * def __setstate_cython__(self, __pyx_state):
 *     raise TypeError, "self.ptr cannot be converted to a Python object for pickling"
*/
  __Pyx_Raise(__pyx_builtin_TypeError, __pyx_mstate_global->__pyx_kp_u_self_ptr_cannot_be_converted_to, 0, 0);
  __PYX_ERR(4, 2, __pyx_L1_error)

  /* "(tree fragment)":1
 * def __reduce_cython__(self):             # <<<<<<<<<<<<<<
 *     raise TypeError, "self.ptr cannot be converted to a Python object for pickling"
 * def __setstate_cython__(self, __pyx_state):
*/

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_TraceException(__pyx_lineno, 0, 0);
  #if CYTHON_USE_SYS_MONITORING
  __Pyx_TraceExceptionUnwind(0, 0);
  #else
  __Pyx_TraceReturnValue(NULL, 0, 0, __PYX_ERR(4, 1, __pyx_L1_error));
  #endif
  __Pyx_AddTraceback("pysam.libcbcf.VariantHeaderRecord.__reduce_cython__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_PyMonitoring_ExitScope(0);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "(tree fragment)":3
 * def __reduce_cython__(self):
 *     raise TypeError, "self.ptr cannot be converted to a Python object for pickling"
 * def __setstate_cython__(self, __pyx_state):             # <<<<<<<<<<<<<<
 *     raise TypeError, "self.ptr cannot be converted to a Python object for pickling"
*/

/* Python wrapper */
static PyObject *__pyx_pw_5pysam_7libcbcf_19VariantHeaderRecord_40__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*/
PyDoc_STRVAR(__pyx_doc_5pysam_7libcbcf_19VariantHeaderRecord_39__setstate_cython__, "VariantHeaderRecord.__setstate_cython__(self, __pyx_state)");
static PyMethodDef __pyx_mdef_5pysam_7libcbcf_19VariantHeaderRecord_40__setstate_cython__ = {"__setstate_cython__", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_5pysam_7libcbcf_19VariantHeaderRecord_40__setstate_cython__, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_5pysam_7libcbcf_19VariantHeaderRecord_39__setstate_cython__};
static PyObject *__pyx_pw_5pysam_7libcbcf_19VariantHeaderRecord_40__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(4, 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(4, 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(4, 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(4, 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(4, 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(4, 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("pysam.libcbcf.VariantHeaderRecord.__setstate_cython__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_5pysam_7libcbcf_19VariantHeaderRecord_39__setstate_cython__(((struct __pyx_obj_5pysam_7libcbcf_VariantHeaderRecord *)__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_5pysam_7libcbcf_19VariantHeaderRecord_39__setstate_cython__(CYTHON_UNUSED struct __pyx_obj_5pysam_7libcbcf_VariantHeaderRecord *__pyx_v_self, CYTHON_UNUSED PyObject *__pyx_v___pyx_state) {
  PyObject *__pyx_r = NULL;
  __Pyx_TraceDeclarationsFunc
  __Pyx_RefNannyDeclarations
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_TraceFrameInit(((PyObject *)__pyx_mstate_global->__pyx_codeobj_tab[55]))
  __Pyx_RefNannySetupContext("__setstate_cython__", 0);
  __Pyx_TraceStartFunc("__setstate_cython__", __pyx_f[4], 3, 0, 0, 0, __PYX_ERR(4, 3, __pyx_L1_error));

  /* "(tree fragment)":4
 *     raise TypeError, "self.ptr cannot be converted to a Python object for pickling"
 * def __setstate_cython__(self, __pyx_state):
 *     raise TypeError, "self.ptr cannot be converted to a Python object for pickling"             # <<<<<<<<<<<<<<
*/
  __Pyx_Raise(__pyx_builtin_TypeError, __pyx_mstate_global->__pyx_kp_u_self_ptr_cannot_be_converted_to, 0, 0);
  __PYX_ERR(4, 4, __pyx_L1_error)

  /* "(tree fragment)":3
 * def __reduce_cython__(self):
 *     raise TypeError, "self.ptr cannot be converted to a Python object for pickling"
 * def __setstate_cython__(self, __pyx_state):             # <<<<<<<<<<<<<<
 *     raise TypeError, "self.ptr cannot be converted to a Python object for pickling"
*/

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_TraceException(__pyx_lineno, 0, 0);
  #if CYTHON_USE_SYS_MONITORING
  __Pyx_TraceExceptionUnwind(0, 0);
  #else
  __Pyx_TraceReturnValue(NULL, 0, 0, __PYX_ERR(4, 3, __pyx_L1_error));
  #endif
  __Pyx_AddTraceback("pysam.libcbcf.VariantHeaderRecord.__setstate_cython__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_PyMonitoring_ExitScope(0);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "pysam/libcbcf.pyx":1422
 * 
 * 
 * cdef VariantHeaderRecord makeVariantHeaderRecord(VariantHeader header, bcf_hrec_t *hdr):             # <<<<<<<<<<<<<<
 *     if not header:
 *         raise ValueError('invalid VariantHeader')
*/

static struct __pyx_obj_5pysam_7libcbcf_VariantHeaderRecord *__pyx_f_5pysam_7libcbcf_makeVariantHeaderRecord(struct __pyx_obj_5pysam_7libcbcf_VariantHeader *__pyx_v_header, bcf_hrec_t *__pyx_v_hdr) {
  struct __pyx_obj_5pysam_7libcbcf_VariantHeaderRecord *__pyx_v_record = 0;
  struct __pyx_obj_5pysam_7libcbcf_VariantHeaderRecord *__pyx_r = NULL;
  __Pyx_TraceDeclarationsFunc
  __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_TraceFrameInit(((PyObject *)__pyx_mstate_global->__pyx_codeobj_tab[56]))
  __Pyx_RefNannySetupContext("makeVariantHeaderRecord", 0);
  __Pyx_TraceStartFunc("makeVariantHeaderRecord", __pyx_f[0], 1422, 0, 0, 0, __PYX_ERR(0, 1422, __pyx_L1_error));

  /* "pysam/libcbcf.pyx":1423
 * 
 * cdef VariantHeaderRecord makeVariantHeaderRecord(VariantHeader header, bcf_hrec_t *hdr):
 *     if not header:             # <<<<<<<<<<<<<<
 *         raise ValueError('invalid VariantHeader')
 * 
*/
  __pyx_t_1 = __Pyx_PyObject_IsTrue(((PyObject *)__pyx_v_header)); if (unlikely((__pyx_t_1 < 0))) __PYX_ERR(0, 1423, __pyx_L1_error)
  __pyx_t_2 = (!__pyx_t_1);
  if (unlikely(__pyx_t_2)) {

    /* "pysam/libcbcf.pyx":1424
 * cdef VariantHeaderRecord makeVariantHeaderRecord(VariantHeader header, bcf_hrec_t *hdr):
 *     if not header:
 *         raise ValueError('invalid VariantHeader')             # <<<<<<<<<<<<<<
 * 
 *     if not hdr:
*/
    __pyx_t_4 = NULL;
    __Pyx_INCREF(__pyx_builtin_ValueError);
    __pyx_t_5 = __pyx_builtin_ValueError; 
    __pyx_t_6 = 1;
    {
      PyObject *__pyx_callargs[2] = {__pyx_t_4, __pyx_mstate_global->__pyx_kp_u_invalid_VariantHeader};
      __pyx_t_3 = __Pyx_PyObject_FastCall(__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, 1424, __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, 1424, __pyx_L1_error)

    /* "pysam/libcbcf.pyx":1423
 * 
 * cdef VariantHeaderRecord makeVariantHeaderRecord(VariantHeader header, bcf_hrec_t *hdr):
 *     if not header:             # <<<<<<<<<<<<<<
 *         raise ValueError('invalid VariantHeader')
 * 
*/
  }

  /* "pysam/libcbcf.pyx":1426
 *         raise ValueError('invalid VariantHeader')
 * 
 *     if not hdr:             # <<<<<<<<<<<<<<
 *         return None
 * 
*/
  __pyx_t_2 = (!(__pyx_v_hdr != 0));
  if (__pyx_t_2) {

    /* "pysam/libcbcf.pyx":1427
 * 
 *     if not hdr:
 *         return None             # <<<<<<<<<<<<<<
 * 
 *     cdef VariantHeaderRecord record = VariantHeaderRecord.__new__(VariantHeaderRecord)
*/
    __Pyx_XDECREF((PyObject *)__pyx_r);
    __pyx_r = ((struct __pyx_obj_5pysam_7libcbcf_VariantHeaderRecord *)Py_None); __Pyx_INCREF(Py_None);
    goto __pyx_L0;

    /* "pysam/libcbcf.pyx":1426
 *         raise ValueError('invalid VariantHeader')
 * 
 *     if not hdr:             # <<<<<<<<<<<<<<
 *         return None
 * 
*/
  }

  /* "pysam/libcbcf.pyx":1429
 *         return None
 * 
 *     cdef VariantHeaderRecord record = VariantHeaderRecord.__new__(VariantHeaderRecord)             # <<<<<<<<<<<<<<
 *     record.header = header
 *     record.ptr = hdr
*/
  __pyx_t_3 = ((PyObject *)__pyx_tp_new_5pysam_7libcbcf_VariantHeaderRecord(((PyTypeObject *)__pyx_mstate_global->__pyx_ptype_5pysam_7libcbcf_VariantHeaderRecord), __pyx_mstate_global->__pyx_empty_tuple, NULL)); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1429, __pyx_L1_error)
  __Pyx_GOTREF((PyObject *)__pyx_t_3);
  __pyx_v_record = ((struct __pyx_obj_5pysam_7libcbcf_VariantHeaderRecord *)__pyx_t_3);
  __pyx_t_3 = 0;

  /* "pysam/libcbcf.pyx":1430
 * 
 *     cdef VariantHeaderRecord record = VariantHeaderRecord.__new__(VariantHeaderRecord)
 *     record.header = header             # <<<<<<<<<<<<<<
 *     record.ptr = hdr
 * 
*/
  __Pyx_INCREF((PyObject *)__pyx_v_header);
  __Pyx_GIVEREF((PyObject *)__pyx_v_header);
  __Pyx_GOTREF((PyObject *)__pyx_v_record->header);
  __Pyx_DECREF((PyObject *)__pyx_v_record->header);
  __pyx_v_record->header = __pyx_v_header;

  /* "pysam/libcbcf.pyx":1431
 *     cdef VariantHeaderRecord record = VariantHeaderRecord.__new__(VariantHeaderRecord)
 *     record.header = header
 *     record.ptr = hdr             # <<<<<<<<<<<<<<
 * 
 *     return record
*/
  __pyx_v_record->ptr = __pyx_v_hdr;

  /* "pysam/libcbcf.pyx":1433
 *     record.ptr = hdr
 * 
 *     return record             # <<<<<<<<<<<<<<
 * 
 * 
*/
  __Pyx_XDECREF((PyObject *)__pyx_r);
  __Pyx_INCREF((PyObject *)__pyx_v_record);
  __pyx_r = __pyx_v_record;
  __Pyx_TraceReturnValue((PyObject *)__pyx_r, 24, 0, __PYX_ERR(0, 1433, __pyx_L1_error));
  goto __pyx_L0;

  /* "pysam/libcbcf.pyx":1422
 * 
 * 
 * cdef VariantHeaderRecord makeVariantHeaderRecord(VariantHeader header, bcf_hrec_t *hdr):             # <<<<<<<<<<<<<<
 *     if not header:
 *         raise ValueError('invalid VariantHeader')
*/

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_XDECREF(__pyx_t_5);
  __Pyx_TraceException(__pyx_lineno, 0, 0);
  #if CYTHON_USE_SYS_MONITORING
  __Pyx_TraceExceptionUnwind(0, 0);
  #else
  __Pyx_TraceReturnValue(NULL, 0, 0, __PYX_ERR(0, 1422, __pyx_L1_error));
  #endif
  __Pyx_AddTraceback("pysam.libcbcf.makeVariantHeaderRecord", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_XDECREF((PyObject *)__pyx_v_record);
  __Pyx_XGIVEREF((PyObject *)__pyx_r);
  __Pyx_PyMonitoring_ExitScope(0);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "pysam/libcbcf.pyx":1438
 * cdef class VariantHeaderRecords(object):
 *     """sequence of :class:`VariantHeaderRecord` object from a :class:`VariantHeader` object"""
 *     def __init__(self, *args, **kwargs):             # <<<<<<<<<<<<<<
 *         raise TypeError('this class cannot be instantiated from Python')
 * 
*/

/* Python wrapper */
static int __pyx_pw_5pysam_7libcbcf_20VariantHeaderRecords_1__init__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static int __pyx_pw_5pysam_7libcbcf_20VariantHeaderRecords_1__init__(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("__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);
  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("__init__", __pyx_kwds) == -1)) return -1;
  }
  __Pyx_INCREF(__pyx_args);
  __pyx_v_args = __pyx_args;
  __pyx_r = __pyx_pf_5pysam_7libcbcf_20VariantHeaderRecords___init__(((struct __pyx_obj_5pysam_7libcbcf_VariantHeaderRecords *)__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_5pysam_7libcbcf_20VariantHeaderRecords___init__(CYTHON_UNUSED struct __pyx_obj_5pysam_7libcbcf_VariantHeaderRecords *__pyx_v_self, CYTHON_UNUSED PyObject *__pyx_v_args, CYTHON_UNUSED PyObject *__pyx_v_kwargs) {
  int __pyx_r;
  __Pyx_TraceDeclarationsFunc
  __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_TraceFrameInit(((PyObject *)__pyx_mstate_global->__pyx_codeobj_tab[57]))
  __Pyx_RefNannySetupContext("__init__", 0);
  __Pyx_TraceStartFunc("__init__", __pyx_f[0], 1438, 0, 0, 0, __PYX_ERR(0, 1438, __pyx_L1_error));

  /* "pysam/libcbcf.pyx":1439
 *     """sequence of :class:`VariantHeaderRecord` object from a :class:`VariantHeader` object"""
 *     def __init__(self, *args, **kwargs):
 *         raise TypeError('this class cannot be instantiated from Python')             # <<<<<<<<<<<<<<
 * 
 *     def __len__(self):
*/
  __pyx_t_2 = NULL;
  __Pyx_INCREF(__pyx_builtin_TypeError);
  __pyx_t_3 = __pyx_builtin_TypeError; 
  __pyx_t_4 = 1;
  {
    PyObject *__pyx_callargs[2] = {__pyx_t_2, __pyx_mstate_global->__pyx_kp_u_this_class_cannot_be_instantiate};
    __pyx_t_1 = __Pyx_PyObject_FastCall(__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, 1439, __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, 1439, __pyx_L1_error)

  /* "pysam/libcbcf.pyx":1438
 * cdef class VariantHeaderRecords(object):
 *     """sequence of :class:`VariantHeaderRecord` object from a :class:`VariantHeader` object"""
 *     def __init__(self, *args, **kwargs):             # <<<<<<<<<<<<<<
 *         raise TypeError('this class cannot be instantiated from Python')
 * 
*/

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_TraceException(__pyx_lineno, 0, 0);
  #if CYTHON_USE_SYS_MONITORING
  __Pyx_TraceExceptionUnwind(0, 0);
  #else
  __Pyx_TraceReturnValue(NULL, 0, 0, __PYX_ERR(0, 1438, __pyx_L1_error));
  #endif
  __Pyx_AddTraceback("pysam.libcbcf.VariantHeaderRecords.__init__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = -1;
  __Pyx_PyMonitoring_ExitScope(0);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "pysam/libcbcf.pyx":1441
 *         raise TypeError('this class cannot be instantiated from Python')
 * 
 *     def __len__(self):             # <<<<<<<<<<<<<<
 *         return self.header.ptr.nhrec
 * 
*/

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

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

static Py_ssize_t __pyx_pf_5pysam_7libcbcf_20VariantHeaderRecords_2__len__(struct __pyx_obj_5pysam_7libcbcf_VariantHeaderRecords *__pyx_v_self) {
  Py_ssize_t __pyx_r;
  __Pyx_TraceDeclarationsFunc
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_TraceFrameInit(((PyObject *)__pyx_mstate_global->__pyx_codeobj_tab[58]))
  __Pyx_TraceStartFunc("__len__", __pyx_f[0], 1441, 0, 0, 0, __PYX_ERR(0, 1441, __pyx_L1_error));

  /* "pysam/libcbcf.pyx":1442
 * 
 *     def __len__(self):
 *         return self.header.ptr.nhrec             # <<<<<<<<<<<<<<
 * 
 *     def __bool__(self):
*/
  __pyx_r = __pyx_v_self->header->ptr->nhrec;
  __Pyx_TraceReturnCValue(__pyx_r, PyLong_FromSsize_t, 1, 0, __PYX_ERR(0, 1442, __pyx_L1_error));
  goto __pyx_L0;

  /* "pysam/libcbcf.pyx":1441
 *         raise TypeError('this class cannot be instantiated from Python')
 * 
 *     def __len__(self):             # <<<<<<<<<<<<<<
 *         return self.header.ptr.nhrec
 * 
*/

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_TraceException(__pyx_lineno, 0, 0);
  #if CYTHON_USE_SYS_MONITORING
  __Pyx_TraceExceptionUnwind(0, 0);
  #else
  __Pyx_TraceReturnValue(NULL, 0, 0, __PYX_ERR(0, 1441, __pyx_L1_error));
  #endif
  __Pyx_AddTraceback("pysam.libcbcf.VariantHeaderRecords.__len__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = -1;
  __pyx_L0:;
  __Pyx_PyMonitoring_ExitScope(0);
  return __pyx_r;
}

/* "pysam/libcbcf.pyx":1444
 *         return self.header.ptr.nhrec
 * 
 *     def __bool__(self):             # <<<<<<<<<<<<<<
 *         return self.header.ptr.nhrec != 0
 * 
*/

/* Python wrapper */
static int __pyx_pw_5pysam_7libcbcf_20VariantHeaderRecords_5__bool__(PyObject *__pyx_v_self); /*proto*/
static int __pyx_pw_5pysam_7libcbcf_20VariantHeaderRecords_5__bool__(PyObject *__pyx_v_self) {
  CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__bool__ (wrapper)", 0);
  __pyx_kwvalues = __Pyx_KwValues_VARARGS(__pyx_args, __pyx_nargs);
  __pyx_r = __pyx_pf_5pysam_7libcbcf_20VariantHeaderRecords_4__bool__(((struct __pyx_obj_5pysam_7libcbcf_VariantHeaderRecords *)__pyx_v_self));

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

static int __pyx_pf_5pysam_7libcbcf_20VariantHeaderRecords_4__bool__(struct __pyx_obj_5pysam_7libcbcf_VariantHeaderRecords *__pyx_v_self) {
  int __pyx_r;
  __Pyx_TraceDeclarationsFunc
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_TraceFrameInit(((PyObject *)__pyx_mstate_global->__pyx_codeobj_tab[59]))
  __Pyx_TraceStartFunc("__bool__", __pyx_f[0], 1444, 0, 0, 0, __PYX_ERR(0, 1444, __pyx_L1_error));

  /* "pysam/libcbcf.pyx":1445
 * 
 *     def __bool__(self):
 *         return self.header.ptr.nhrec != 0             # <<<<<<<<<<<<<<
 * 
 *     def __getitem__(self, index):
*/
  __pyx_r = (__pyx_v_self->header->ptr->nhrec != 0);
  __Pyx_TraceReturnCValue(__pyx_r, __Pyx_PyLong_From_int, 1, 0, __PYX_ERR(0, 1445, __pyx_L1_error));
  goto __pyx_L0;

  /* "pysam/libcbcf.pyx":1444
 *         return self.header.ptr.nhrec
 * 
 *     def __bool__(self):             # <<<<<<<<<<<<<<
 *         return self.header.ptr.nhrec != 0
 * 
*/

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_TraceException(__pyx_lineno, 0, 0);
  #if CYTHON_USE_SYS_MONITORING
  __Pyx_TraceExceptionUnwind(0, 0);
  #else
  __Pyx_TraceReturnValue(NULL, 0, 0, __PYX_ERR(0, 1444, __pyx_L1_error));
  #endif
  __Pyx_AddTraceback("pysam.libcbcf.VariantHeaderRecords.__bool__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = -1;
  __pyx_L0:;
  __Pyx_PyMonitoring_ExitScope(0);
  return __pyx_r;
}

/* "pysam/libcbcf.pyx":1447
 *         return self.header.ptr.nhrec != 0
 * 
 *     def __getitem__(self, index):             # <<<<<<<<<<<<<<
 *         cdef int32_t i = index
 *         if i < 0 or i >= self.header.ptr.nhrec:
*/

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

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

static PyObject *__pyx_pf_5pysam_7libcbcf_20VariantHeaderRecords_6__getitem__(struct __pyx_obj_5pysam_7libcbcf_VariantHeaderRecords *__pyx_v_self, PyObject *__pyx_v_index) {
  int32_t __pyx_v_i;
  PyObject *__pyx_r = NULL;
  __Pyx_TraceDeclarationsFunc
  __Pyx_RefNannyDeclarations
  int32_t __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;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_TraceFrameInit(((PyObject *)__pyx_mstate_global->__pyx_codeobj_tab[60]))
  __Pyx_RefNannySetupContext("__getitem__", 0);
  __Pyx_TraceStartFunc("__getitem__", __pyx_f[0], 1447, 0, 0, 0, __PYX_ERR(0, 1447, __pyx_L1_error));

  /* "pysam/libcbcf.pyx":1448
 * 
 *     def __getitem__(self, index):
 *         cdef int32_t i = index             # <<<<<<<<<<<<<<
 *         if i < 0 or i >= self.header.ptr.nhrec:
 *             raise IndexError('invalid header record index')
*/
  __pyx_t_1 = __Pyx_PyLong_As_int32_t(__pyx_v_index); if (unlikely((__pyx_t_1 == ((int32_t)-1)) && PyErr_Occurred())) __PYX_ERR(0, 1448, __pyx_L1_error)
  __pyx_v_i = __pyx_t_1;

  /* "pysam/libcbcf.pyx":1449
 *     def __getitem__(self, index):
 *         cdef int32_t i = index
 *         if i < 0 or i >= self.header.ptr.nhrec:             # <<<<<<<<<<<<<<
 *             raise IndexError('invalid header record index')
 *         return makeVariantHeaderRecord(self.header, self.header.ptr.hrec[i])
*/
  __pyx_t_3 = (__pyx_v_i < 0);
  if (!__pyx_t_3) {
  } else {
    __pyx_t_2 = __pyx_t_3;
    goto __pyx_L4_bool_binop_done;
  }
  __pyx_t_3 = (__pyx_v_i >= __pyx_v_self->header->ptr->nhrec);
  __pyx_t_2 = __pyx_t_3;
  __pyx_L4_bool_binop_done:;
  if (unlikely(__pyx_t_2)) {

    /* "pysam/libcbcf.pyx":1450
 *         cdef int32_t i = index
 *         if i < 0 or i >= self.header.ptr.nhrec:
 *             raise IndexError('invalid header record index')             # <<<<<<<<<<<<<<
 *         return makeVariantHeaderRecord(self.header, self.header.ptr.hrec[i])
 * 
*/
    __pyx_t_5 = NULL;
    __Pyx_INCREF(__pyx_builtin_IndexError);
    __pyx_t_6 = __pyx_builtin_IndexError; 
    __pyx_t_7 = 1;
    {
      PyObject *__pyx_callargs[2] = {__pyx_t_5, __pyx_mstate_global->__pyx_kp_u_invalid_header_record_index};
      __pyx_t_4 = __Pyx_PyObject_FastCall(__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, 1450, __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, 1450, __pyx_L1_error)

    /* "pysam/libcbcf.pyx":1449
 *     def __getitem__(self, index):
 *         cdef int32_t i = index
 *         if i < 0 or i >= self.header.ptr.nhrec:             # <<<<<<<<<<<<<<
 *             raise IndexError('invalid header record index')
 *         return makeVariantHeaderRecord(self.header, self.header.ptr.hrec[i])
*/
  }

  /* "pysam/libcbcf.pyx":1451
 *         if i < 0 or i >= self.header.ptr.nhrec:
 *             raise IndexError('invalid header record index')
 *         return makeVariantHeaderRecord(self.header, self.header.ptr.hrec[i])             # <<<<<<<<<<<<<<
 * 
 *     def __iter__(self):
*/
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_4 = ((PyObject *)__pyx_v_self->header);
  __Pyx_INCREF(__pyx_t_4);
  __pyx_t_6 = ((PyObject *)__pyx_f_5pysam_7libcbcf_makeVariantHeaderRecord(((struct __pyx_obj_5pysam_7libcbcf_VariantHeader *)__pyx_t_4), (__pyx_v_self->header->ptr->hrec[__pyx_v_i]))); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 1451, __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;
  __Pyx_TraceReturnValue(__pyx_r, 18, 0, __PYX_ERR(0, 1451, __pyx_L1_error));
  goto __pyx_L0;

  /* "pysam/libcbcf.pyx":1447
 *         return self.header.ptr.nhrec != 0
 * 
 *     def __getitem__(self, index):             # <<<<<<<<<<<<<<
 *         cdef int32_t i = index
 *         if i < 0 or i >= self.header.ptr.nhrec:
*/

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_XDECREF(__pyx_t_5);
  __Pyx_XDECREF(__pyx_t_6);
  __Pyx_TraceException(__pyx_lineno, 0, 0);
  #if CYTHON_USE_SYS_MONITORING
  __Pyx_TraceExceptionUnwind(0, 0);
  #else
  __Pyx_TraceReturnValue(NULL, 0, 0, __PYX_ERR(0, 1447, __pyx_L1_error));
  #endif
  __Pyx_AddTraceback("pysam.libcbcf.VariantHeaderRecords.__getitem__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_PyMonitoring_ExitScope(0);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}
static PyObject *__pyx_gb_5pysam_7libcbcf_20VariantHeaderRecords_10generator3(__pyx_CoroutineObject *__pyx_generator, CYTHON_UNUSED PyThreadState *__pyx_tstate, PyObject *__pyx_sent_value); /* proto */

/* "pysam/libcbcf.pyx":1453
 *         return makeVariantHeaderRecord(self.header, self.header.ptr.hrec[i])
 * 
 *     def __iter__(self):             # <<<<<<<<<<<<<<
 *         cdef int32_t i
 *         for i in range(self.header.ptr.nhrec):
*/

/* Python wrapper */
static PyObject *__pyx_pw_5pysam_7libcbcf_20VariantHeaderRecords_9__iter__(PyObject *__pyx_v_self); /*proto*/
static PyObject *__pyx_pw_5pysam_7libcbcf_20VariantHeaderRecords_9__iter__(PyObject *__pyx_v_self) {
  CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__iter__ (wrapper)", 0);
  __pyx_kwvalues = __Pyx_KwValues_VARARGS(__pyx_args, __pyx_nargs);
  __pyx_r = __pyx_pf_5pysam_7libcbcf_20VariantHeaderRecords_8__iter__(((struct __pyx_obj_5pysam_7libcbcf_VariantHeaderRecords *)__pyx_v_self));

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

static PyObject *__pyx_pf_5pysam_7libcbcf_20VariantHeaderRecords_8__iter__(struct __pyx_obj_5pysam_7libcbcf_VariantHeaderRecords *__pyx_v_self) {
  struct __pyx_obj_5pysam_7libcbcf___pyx_scope_struct_10___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("__iter__", 0);
  __pyx_cur_scope = (struct __pyx_obj_5pysam_7libcbcf___pyx_scope_struct_10___iter__ *)__pyx_tp_new_5pysam_7libcbcf___pyx_scope_struct_10___iter__(__pyx_mstate_global->__pyx_ptype_5pysam_7libcbcf___pyx_scope_struct_10___iter__, __pyx_mstate_global->__pyx_empty_tuple, NULL);
  if (unlikely(!__pyx_cur_scope)) {
    __pyx_cur_scope = ((struct __pyx_obj_5pysam_7libcbcf___pyx_scope_struct_10___iter__ *)Py_None);
    __Pyx_INCREF(Py_None);
    __PYX_ERR(0, 1453, __pyx_L1_error)
  } else {
    __Pyx_GOTREF((PyObject *)__pyx_cur_scope);
  }
  __pyx_cur_scope->__pyx_v_self = __pyx_v_self;
  __Pyx_INCREF((PyObject *)__pyx_cur_scope->__pyx_v_self);
  __Pyx_GIVEREF((PyObject *)__pyx_cur_scope->__pyx_v_self);
  {
    __pyx_CoroutineObject *gen = __Pyx_Generator_New((__pyx_coroutine_body_t) __pyx_gb_5pysam_7libcbcf_20VariantHeaderRecords_10generator3, ((PyObject *)__pyx_mstate_global->__pyx_codeobj_tab[61]), (PyObject *) __pyx_cur_scope, __pyx_mstate_global->__pyx_n_u_iter, __pyx_mstate_global->__pyx_n_u_VariantHeaderRecords___iter, __pyx_mstate_global->__pyx_n_u_pysam_libcbcf); if (unlikely(!gen)) __PYX_ERR(0, 1453, __pyx_L1_error)
    __Pyx_DECREF(__pyx_cur_scope);
    __Pyx_RefNannyFinishContext();
    return (PyObject *) gen;
  }

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_AddTraceback("pysam.libcbcf.VariantHeaderRecords.__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_5pysam_7libcbcf_20VariantHeaderRecords_10generator3(__pyx_CoroutineObject *__pyx_generator, CYTHON_UNUSED PyThreadState *__pyx_tstate, PyObject *__pyx_sent_value) /* generator body */
{
  struct __pyx_obj_5pysam_7libcbcf___pyx_scope_struct_10___iter__ *__pyx_cur_scope = ((struct __pyx_obj_5pysam_7libcbcf___pyx_scope_struct_10___iter__ *)__pyx_generator->closure);
  PyObject *__pyx_r = NULL;
  __Pyx_TraceDeclarationsGen
  int __pyx_t_1;
  int __pyx_t_2;
  int32_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_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__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_TraceStartGen("__iter__", __pyx_f[0], 1453, 0, 0, 0, __PYX_ERR(0, 1453, __pyx_L1_error));
    __Pyx_TraceReturnValue(Py_None, 0, 0, __PYX_ERR(0, 1453, __pyx_L1_error));
    __Pyx_RefNannyFinishContext();
    return NULL;
  }
  __pyx_L3_first_run:;
  __Pyx_TraceStartGen("__iter__", __pyx_f[0], 1453, 0, 0, 0, __PYX_ERR(0, 1453, __pyx_L1_error));
  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, 1453, __pyx_L1_error)
  }

  /* "pysam/libcbcf.pyx":1455
 *     def __iter__(self):
 *         cdef int32_t i
 *         for i in range(self.header.ptr.nhrec):             # <<<<<<<<<<<<<<
 *             yield makeVariantHeaderRecord(self.header, self.header.ptr.hrec[i])
 * 
*/
  __pyx_t_1 = __pyx_cur_scope->__pyx_v_self->header->ptr->nhrec;
  __pyx_t_2 = __pyx_t_1;
  for (__pyx_t_3 = 0; __pyx_t_3 < __pyx_t_2; __pyx_t_3+=1) {
    __pyx_cur_scope->__pyx_v_i = __pyx_t_3;

    /* "pysam/libcbcf.pyx":1456
 *         cdef int32_t i
 *         for i in range(self.header.ptr.nhrec):
 *             yield makeVariantHeaderRecord(self.header, self.header.ptr.hrec[i])             # <<<<<<<<<<<<<<
 * 
 *     __hash__ = None
*/
    __pyx_t_4 = ((PyObject *)__pyx_cur_scope->__pyx_v_self->header);
    __Pyx_INCREF(__pyx_t_4);
    __pyx_t_5 = ((PyObject *)__pyx_f_5pysam_7libcbcf_makeVariantHeaderRecord(((struct __pyx_obj_5pysam_7libcbcf_VariantHeader *)__pyx_t_4), (__pyx_cur_scope->__pyx_v_self->header->ptr->hrec[__pyx_cur_scope->__pyx_v_i]))); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1456, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_5);
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    __pyx_r = __pyx_t_5;
    __pyx_t_5 = 0;
    __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_TraceYield(__pyx_r, 0, __PYX_ERR(0, 1456, __pyx_L1_error));
    __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_TraceResumeGen("__iter__", __pyx_f[0], 1453, 0, __PYX_ERR(0, 1456, __pyx_L1_error));
    __pyx_t_1 = __pyx_cur_scope->__pyx_t_0;
    __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, 1456, __pyx_L1_error)
  }
  CYTHON_MAYBE_UNUSED_VAR(__pyx_cur_scope);
  __Pyx_TraceReturnValue(Py_None, 0, 0, __PYX_ERR(0, 1453, __pyx_L1_error));

  /* "pysam/libcbcf.pyx":1453
 *         return makeVariantHeaderRecord(self.header, self.header.ptr.hrec[i])
 * 
 *     def __iter__(self):             # <<<<<<<<<<<<<<
 *         cdef int32_t i
 *         for i in range(self.header.ptr.nhrec):
*/

  /* 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);
  if (__Pyx_PyErr_Occurred()) {
    __Pyx_TraceException(__pyx_lineno, 0, 0);
    __Pyx_Generator_Replace_StopIteration(0);
    __Pyx_AddTraceback("__iter__", __pyx_clineno, __pyx_lineno, __pyx_filename);
    __Pyx_TraceExceptionUnwind(0, 0);
  }
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_PyMonitoring_ExitScope(0);
  #if !CYTHON_USE_EXC_INFO_STACK
  __Pyx_Coroutine_ResetAndClearException(__pyx_generator);
  #endif
  __pyx_generator->resume_label = -1;
  __Pyx_Coroutine_clear((PyObject*)__pyx_generator);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "pysam/libcbcf.pxd":53
 * 
 * cdef class VariantHeaderRecords(object):
 *     cdef readonly VariantHeader header             # <<<<<<<<<<<<<<
 * 
 * 
*/

/* Python wrapper */
static PyObject *__pyx_pw_5pysam_7libcbcf_20VariantHeaderRecords_6header_1__get__(PyObject *__pyx_v_self); /*proto*/
static PyObject *__pyx_pw_5pysam_7libcbcf_20VariantHeaderRecords_6header_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_5pysam_7libcbcf_20VariantHeaderRecords_6header___get__(((struct __pyx_obj_5pysam_7libcbcf_VariantHeaderRecords *)__pyx_v_self));

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

static PyObject *__pyx_pf_5pysam_7libcbcf_20VariantHeaderRecords_6header___get__(struct __pyx_obj_5pysam_7libcbcf_VariantHeaderRecords *__pyx_v_self) {
  PyObject *__pyx_r = NULL;
  __Pyx_TraceDeclarationsFunc
  __Pyx_RefNannyDeclarations
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_TraceFrameInit(((PyObject *)__pyx_mstate_global->__pyx_codeobj_tab[62]))
  __Pyx_RefNannySetupContext("__get__", 0);
  __Pyx_TraceStartFunc("__get__", __pyx_f[3], 53, 0, 0, 0, __PYX_ERR(3, 53, __pyx_L1_error));
  __Pyx_XDECREF(__pyx_r);
  __Pyx_INCREF((PyObject *)__pyx_v_self->header);
  __pyx_r = ((PyObject *)__pyx_v_self->header);
  __Pyx_TraceReturnValue(__pyx_r, 0, 0, __PYX_ERR(3, 53, __pyx_L1_error));
  goto __pyx_L0;

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_TraceException(__pyx_lineno, 0, 0);
  #if CYTHON_USE_SYS_MONITORING
  __Pyx_TraceExceptionUnwind(0, 0);
  #else
  __Pyx_TraceReturnValue(NULL, 0, 0, __PYX_ERR(3, 53, __pyx_L1_error));
  #endif
  __Pyx_AddTraceback("pysam.libcbcf.VariantHeaderRecords.header.__get__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_PyMonitoring_ExitScope(0);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

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

/* Python wrapper */
static PyObject *__pyx_pw_5pysam_7libcbcf_20VariantHeaderRecords_12__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*/
PyDoc_STRVAR(__pyx_doc_5pysam_7libcbcf_20VariantHeaderRecords_11__reduce_cython__, "VariantHeaderRecords.__reduce_cython__(self)");
static PyMethodDef __pyx_mdef_5pysam_7libcbcf_20VariantHeaderRecords_12__reduce_cython__ = {"__reduce_cython__", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_5pysam_7libcbcf_20VariantHeaderRecords_12__reduce_cython__, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_5pysam_7libcbcf_20VariantHeaderRecords_11__reduce_cython__};
static PyObject *__pyx_pw_5pysam_7libcbcf_20VariantHeaderRecords_12__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_5pysam_7libcbcf_20VariantHeaderRecords_11__reduce_cython__(((struct __pyx_obj_5pysam_7libcbcf_VariantHeaderRecords *)__pyx_v_self));

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

static PyObject *__pyx_pf_5pysam_7libcbcf_20VariantHeaderRecords_11__reduce_cython__(struct __pyx_obj_5pysam_7libcbcf_VariantHeaderRecords *__pyx_v_self) {
  PyObject *__pyx_v_state = 0;
  PyObject *__pyx_v__dict = 0;
  int __pyx_v_use_setstate;
  PyObject *__pyx_r = NULL;
  __Pyx_TraceDeclarationsFunc
  __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_TraceFrameInit(((PyObject *)__pyx_mstate_global->__pyx_codeobj_tab[63]))
  __Pyx_RefNannySetupContext("__reduce_cython__", 0);
  __Pyx_TraceStartFunc("__reduce_cython__", __pyx_f[4], 1, 0, 0, 0, __PYX_ERR(4, 1, __pyx_L1_error));

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

  /* "(tree fragment)":6
 *     cdef bint use_setstate
 *     state = (self.header,)
 *     _dict = getattr(self, '__dict__', None)             # <<<<<<<<<<<<<<
 *     if _dict is not None:
 *         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(4, 6, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_v__dict = __pyx_t_1;
  __pyx_t_1 = 0;

  /* "(tree fragment)":7
 *     state = (self.header,)
 *     _dict = getattr(self, '__dict__', None)
 *     if _dict is not None:             # <<<<<<<<<<<<<<
 *         state += (_dict,)
 *         use_setstate = True
*/
  __pyx_t_2 = (__pyx_v__dict != Py_None);
  if (__pyx_t_2) {

    /* "(tree fragment)":8
 *     _dict = getattr(self, '__dict__', None)
 *     if _dict is not None:
 *         state += (_dict,)             # <<<<<<<<<<<<<<
 *         use_setstate = True
 *     else:
*/
    __pyx_t_1 = PyTuple_New(1); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 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(4, 8, __pyx_L1_error);
    __pyx_t_3 = PyNumber_InPlaceAdd(__pyx_v_state, __pyx_t_1); if (unlikely(!__pyx_t_3)) __PYX_ERR(4, 8, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    __Pyx_DECREF_SET(__pyx_v_state, ((PyObject*)__pyx_t_3));
    __pyx_t_3 = 0;

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

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

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

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

    /* "(tree fragment)":13
 *         use_setstate = self.header is not None
 *     if use_setstate:
 *         return __pyx_unpickle_VariantHeaderRecords, (type(self), 0x1e0584a, None), state             # <<<<<<<<<<<<<<
 *     else:
 *         return __pyx_unpickle_VariantHeaderRecords, (type(self), 0x1e0584a, state)
*/
    __Pyx_XDECREF(__pyx_r);
    __Pyx_GetModuleGlobalName(__pyx_t_3, __pyx_mstate_global->__pyx_n_u_pyx_unpickle_VariantHeaderReco); if (unlikely(!__pyx_t_3)) __PYX_ERR(4, 13, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __pyx_t_1 = PyTuple_New(3); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 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(4, 13, __pyx_L1_error);
    __Pyx_INCREF(__pyx_mstate_global->__pyx_int_31479882);
    __Pyx_GIVEREF(__pyx_mstate_global->__pyx_int_31479882);
    if (__Pyx_PyTuple_SET_ITEM(__pyx_t_1, 1, __pyx_mstate_global->__pyx_int_31479882) != (0)) __PYX_ERR(4, 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(4, 13, __pyx_L1_error);
    __pyx_t_4 = PyTuple_New(3); if (unlikely(!__pyx_t_4)) __PYX_ERR(4, 13, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
    __Pyx_GIVEREF(__pyx_t_3);
    if (__Pyx_PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_t_3) != (0)) __PYX_ERR(4, 13, __pyx_L1_error);
    __Pyx_GIVEREF(__pyx_t_1);
    if (__Pyx_PyTuple_SET_ITEM(__pyx_t_4, 1, __pyx_t_1) != (0)) __PYX_ERR(4, 13, __pyx_L1_error);
    __Pyx_INCREF(__pyx_v_state);
    __Pyx_GIVEREF(__pyx_v_state);
    if (__Pyx_PyTuple_SET_ITEM(__pyx_t_4, 2, __pyx_v_state) != (0)) __PYX_ERR(4, 13, __pyx_L1_error);
    __pyx_t_3 = 0;
    __pyx_t_1 = 0;
    __pyx_r = __pyx_t_4;
    __pyx_t_4 = 0;
    __Pyx_TraceReturnValue(__pyx_r, 25, 0, __PYX_ERR(4, 13, __pyx_L1_error));
    goto __pyx_L0;

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

  /* "(tree fragment)":15
 *         return __pyx_unpickle_VariantHeaderRecords, (type(self), 0x1e0584a, None), state
 *     else:
 *         return __pyx_unpickle_VariantHeaderRecords, (type(self), 0x1e0584a, state)             # <<<<<<<<<<<<<<
 * def __setstate_cython__(self, __pyx_state):
 *     __pyx_unpickle_VariantHeaderRecords__set_state(self, __pyx_state)
*/
  /*else*/ {
    __Pyx_XDECREF(__pyx_r);
    __Pyx_GetModuleGlobalName(__pyx_t_4, __pyx_mstate_global->__pyx_n_u_pyx_unpickle_VariantHeaderReco); if (unlikely(!__pyx_t_4)) __PYX_ERR(4, 15, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
    __pyx_t_1 = PyTuple_New(3); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 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(4, 15, __pyx_L1_error);
    __Pyx_INCREF(__pyx_mstate_global->__pyx_int_31479882);
    __Pyx_GIVEREF(__pyx_mstate_global->__pyx_int_31479882);
    if (__Pyx_PyTuple_SET_ITEM(__pyx_t_1, 1, __pyx_mstate_global->__pyx_int_31479882) != (0)) __PYX_ERR(4, 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(4, 15, __pyx_L1_error);
    __pyx_t_3 = PyTuple_New(2); if (unlikely(!__pyx_t_3)) __PYX_ERR(4, 15, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __Pyx_GIVEREF(__pyx_t_4);
    if (__Pyx_PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_t_4) != (0)) __PYX_ERR(4, 15, __pyx_L1_error);
    __Pyx_GIVEREF(__pyx_t_1);
    if (__Pyx_PyTuple_SET_ITEM(__pyx_t_3, 1, __pyx_t_1) != (0)) __PYX_ERR(4, 15, __pyx_L1_error);
    __pyx_t_4 = 0;
    __pyx_t_1 = 0;
    __pyx_r = __pyx_t_3;
    __pyx_t_3 = 0;
    __Pyx_TraceReturnValue(__pyx_r, 33, 0, __PYX_ERR(4, 15, __pyx_L1_error));
    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_3);
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_TraceException(__pyx_lineno, 0, 0);
  #if CYTHON_USE_SYS_MONITORING
  __Pyx_TraceExceptionUnwind(0, 0);
  #else
  __Pyx_TraceReturnValue(NULL, 0, 0, __PYX_ERR(4, 1, __pyx_L1_error));
  #endif
  __Pyx_AddTraceback("pysam.libcbcf.VariantHeaderRecords.__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_PyMonitoring_ExitScope(0);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "(tree fragment)":16
 *     else:
 *         return __pyx_unpickle_VariantHeaderRecords, (type(self), 0x1e0584a, state)
 * def __setstate_cython__(self, __pyx_state):             # <<<<<<<<<<<<<<
 *     __pyx_unpickle_VariantHeaderRecords__set_state(self, __pyx_state)
*/

/* Python wrapper */
static PyObject *__pyx_pw_5pysam_7libcbcf_20VariantHeaderRecords_14__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*/
PyDoc_STRVAR(__pyx_doc_5pysam_7libcbcf_20VariantHeaderRecords_13__setstate_cython__, "VariantHeaderRecords.__setstate_cython__(self, __pyx_state)");
static PyMethodDef __pyx_mdef_5pysam_7libcbcf_20VariantHeaderRecords_14__setstate_cython__ = {"__setstate_cython__", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_5pysam_7libcbcf_20VariantHeaderRecords_14__setstate_cython__, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_5pysam_7libcbcf_20VariantHeaderRecords_13__setstate_cython__};
static PyObject *__pyx_pw_5pysam_7libcbcf_20VariantHeaderRecords_14__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(4, 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(4, 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(4, 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(4, 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(4, 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(4, 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("pysam.libcbcf.VariantHeaderRecords.__setstate_cython__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_5pysam_7libcbcf_20VariantHeaderRecords_13__setstate_cython__(((struct __pyx_obj_5pysam_7libcbcf_VariantHeaderRecords *)__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_5pysam_7libcbcf_20VariantHeaderRecords_13__setstate_cython__(struct __pyx_obj_5pysam_7libcbcf_VariantHeaderRecords *__pyx_v_self, PyObject *__pyx_v___pyx_state) {
  PyObject *__pyx_r = NULL;
  __Pyx_TraceDeclarationsFunc
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_TraceFrameInit(((PyObject *)__pyx_mstate_global->__pyx_codeobj_tab[64]))
  __Pyx_RefNannySetupContext("__setstate_cython__", 0);
  __Pyx_TraceStartFunc("__setstate_cython__", __pyx_f[4], 16, 0, 0, 0, __PYX_ERR(4, 16, __pyx_L1_error));

  /* "(tree fragment)":17
 *         return __pyx_unpickle_VariantHeaderRecords, (type(self), 0x1e0584a, state)
 * def __setstate_cython__(self, __pyx_state):
 *     __pyx_unpickle_VariantHeaderRecords__set_state(self, __pyx_state)             # <<<<<<<<<<<<<<
*/
  if (!(likely(PyTuple_CheckExact(__pyx_v___pyx_state))||((__pyx_v___pyx_state) == Py_None) || __Pyx_RaiseUnexpectedTypeError("tuple", __pyx_v___pyx_state))) __PYX_ERR(4, 17, __pyx_L1_error)
  __pyx_t_1 = __pyx_f_5pysam_7libcbcf___pyx_unpickle_VariantHeaderRecords__set_state(__pyx_v_self, ((PyObject*)__pyx_v___pyx_state)); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 17, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "(tree fragment)":16
 *     else:
 *         return __pyx_unpickle_VariantHeaderRecords, (type(self), 0x1e0584a, state)
 * def __setstate_cython__(self, __pyx_state):             # <<<<<<<<<<<<<<
 *     __pyx_unpickle_VariantHeaderRecords__set_state(self, __pyx_state)
*/

  /* function exit code */
  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  __Pyx_TraceReturnValue(__pyx_r, 0, 0, __PYX_ERR(4, 16, __pyx_L1_error));
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_TraceException(__pyx_lineno, 0, 0);
  #if CYTHON_USE_SYS_MONITORING
  __Pyx_TraceExceptionUnwind(0, 0);
  #else
  __Pyx_TraceReturnValue(NULL, 0, 0, __PYX_ERR(4, 16, __pyx_L1_error));
  #endif
  __Pyx_AddTraceback("pysam.libcbcf.VariantHeaderRecords.__setstate_cython__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_PyMonitoring_ExitScope(0);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "pysam/libcbcf.pyx":1461
 * 
 * 
 * cdef VariantHeaderRecords makeVariantHeaderRecords(VariantHeader header):             # <<<<<<<<<<<<<<
 *     if not header:
 *         raise ValueError('invalid VariantHeader')
*/

static struct __pyx_obj_5pysam_7libcbcf_VariantHeaderRecords *__pyx_f_5pysam_7libcbcf_makeVariantHeaderRecords(struct __pyx_obj_5pysam_7libcbcf_VariantHeader *__pyx_v_header) {
  struct __pyx_obj_5pysam_7libcbcf_VariantHeaderRecords *__pyx_v_records = 0;
  struct __pyx_obj_5pysam_7libcbcf_VariantHeaderRecords *__pyx_r = NULL;
  __Pyx_TraceDeclarationsFunc
  __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_TraceFrameInit(((PyObject *)__pyx_mstate_global->__pyx_codeobj_tab[65]))
  __Pyx_RefNannySetupContext("makeVariantHeaderRecords", 0);
  __Pyx_TraceStartFunc("makeVariantHeaderRecords", __pyx_f[0], 1461, 0, 0, 0, __PYX_ERR(0, 1461, __pyx_L1_error));

  /* "pysam/libcbcf.pyx":1462
 * 
 * cdef VariantHeaderRecords makeVariantHeaderRecords(VariantHeader header):
 *     if not header:             # <<<<<<<<<<<<<<
 *         raise ValueError('invalid VariantHeader')
 * 
*/
  __pyx_t_1 = __Pyx_PyObject_IsTrue(((PyObject *)__pyx_v_header)); if (unlikely((__pyx_t_1 < 0))) __PYX_ERR(0, 1462, __pyx_L1_error)
  __pyx_t_2 = (!__pyx_t_1);
  if (unlikely(__pyx_t_2)) {

    /* "pysam/libcbcf.pyx":1463
 * cdef VariantHeaderRecords makeVariantHeaderRecords(VariantHeader header):
 *     if not header:
 *         raise ValueError('invalid VariantHeader')             # <<<<<<<<<<<<<<
 * 
 *     cdef VariantHeaderRecords records = VariantHeaderRecords.__new__(VariantHeaderRecords)
*/
    __pyx_t_4 = NULL;
    __Pyx_INCREF(__pyx_builtin_ValueError);
    __pyx_t_5 = __pyx_builtin_ValueError; 
    __pyx_t_6 = 1;
    {
      PyObject *__pyx_callargs[2] = {__pyx_t_4, __pyx_mstate_global->__pyx_kp_u_invalid_VariantHeader};
      __pyx_t_3 = __Pyx_PyObject_FastCall(__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, 1463, __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, 1463, __pyx_L1_error)

    /* "pysam/libcbcf.pyx":1462
 * 
 * cdef VariantHeaderRecords makeVariantHeaderRecords(VariantHeader header):
 *     if not header:             # <<<<<<<<<<<<<<
 *         raise ValueError('invalid VariantHeader')
 * 
*/
  }

  /* "pysam/libcbcf.pyx":1465
 *         raise ValueError('invalid VariantHeader')
 * 
 *     cdef VariantHeaderRecords records = VariantHeaderRecords.__new__(VariantHeaderRecords)             # <<<<<<<<<<<<<<
 *     records.header = header
 *     return records
*/
  __pyx_t_3 = ((PyObject *)__pyx_tp_new_5pysam_7libcbcf_VariantHeaderRecords(((PyTypeObject *)__pyx_mstate_global->__pyx_ptype_5pysam_7libcbcf_VariantHeaderRecords), __pyx_mstate_global->__pyx_empty_tuple, NULL)); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1465, __pyx_L1_error)
  __Pyx_GOTREF((PyObject *)__pyx_t_3);
  __pyx_v_records = ((struct __pyx_obj_5pysam_7libcbcf_VariantHeaderRecords *)__pyx_t_3);
  __pyx_t_3 = 0;

  /* "pysam/libcbcf.pyx":1466
 * 
 *     cdef VariantHeaderRecords records = VariantHeaderRecords.__new__(VariantHeaderRecords)
 *     records.header = header             # <<<<<<<<<<<<<<
 *     return records
 * 
*/
  __Pyx_INCREF((PyObject *)__pyx_v_header);
  __Pyx_GIVEREF((PyObject *)__pyx_v_header);
  __Pyx_GOTREF((PyObject *)__pyx_v_records->header);
  __Pyx_DECREF((PyObject *)__pyx_v_records->header);
  __pyx_v_records->header = __pyx_v_header;

  /* "pysam/libcbcf.pyx":1467
 *     cdef VariantHeaderRecords records = VariantHeaderRecords.__new__(VariantHeaderRecords)
 *     records.header = header
 *     return records             # <<<<<<<<<<<<<<
 * 
 * 
*/
  __Pyx_XDECREF((PyObject *)__pyx_r);
  __Pyx_INCREF((PyObject *)__pyx_v_records);
  __pyx_r = __pyx_v_records;
  __Pyx_TraceReturnValue((PyObject *)__pyx_r, 16, 0, __PYX_ERR(0, 1467, __pyx_L1_error));
  goto __pyx_L0;

  /* "pysam/libcbcf.pyx":1461
 * 
 * 
 * cdef VariantHeaderRecords makeVariantHeaderRecords(VariantHeader header):             # <<<<<<<<<<<<<<
 *     if not header:
 *         raise ValueError('invalid VariantHeader')
*/

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_XDECREF(__pyx_t_5);
  __Pyx_TraceException(__pyx_lineno, 0, 0);
  #if CYTHON_USE_SYS_MONITORING
  __Pyx_TraceExceptionUnwind(0, 0);
  #else
  __Pyx_TraceReturnValue(NULL, 0, 0, __PYX_ERR(0, 1461, __pyx_L1_error));
  #endif
  __Pyx_AddTraceback("pysam.libcbcf.makeVariantHeaderRecords", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_XDECREF((PyObject *)__pyx_v_records);
  __Pyx_XGIVEREF((PyObject *)__pyx_r);
  __Pyx_PyMonitoring_ExitScope(0);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "pysam/libcbcf.pyx":1472
 * cdef class VariantMetadata(object):
 *     """filter, info or format metadata record from a :class:`VariantHeader` object"""
 *     def __init__(self, *args, **kwargs):             # <<<<<<<<<<<<<<
 *         raise TypeError('this class cannot be instantiated from Python')
 * 
*/

/* Python wrapper */
static int __pyx_pw_5pysam_7libcbcf_15VariantMetadata_1__init__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static int __pyx_pw_5pysam_7libcbcf_15VariantMetadata_1__init__(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("__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);
  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("__init__", __pyx_kwds) == -1)) return -1;
  }
  __Pyx_INCREF(__pyx_args);
  __pyx_v_args = __pyx_args;
  __pyx_r = __pyx_pf_5pysam_7libcbcf_15VariantMetadata___init__(((struct __pyx_obj_5pysam_7libcbcf_VariantMetadata *)__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_5pysam_7libcbcf_15VariantMetadata___init__(CYTHON_UNUSED struct __pyx_obj_5pysam_7libcbcf_VariantMetadata *__pyx_v_self, CYTHON_UNUSED PyObject *__pyx_v_args, CYTHON_UNUSED PyObject *__pyx_v_kwargs) {
  int __pyx_r;
  __Pyx_TraceDeclarationsFunc
  __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_TraceFrameInit(((PyObject *)__pyx_mstate_global->__pyx_codeobj_tab[66]))
  __Pyx_RefNannySetupContext("__init__", 0);
  __Pyx_TraceStartFunc("__init__", __pyx_f[0], 1472, 0, 0, 0, __PYX_ERR(0, 1472, __pyx_L1_error));

  /* "pysam/libcbcf.pyx":1473
 *     """filter, info or format metadata record from a :class:`VariantHeader` object"""
 *     def __init__(self, *args, **kwargs):
 *         raise TypeError('this class cannot be instantiated from Python')             # <<<<<<<<<<<<<<
 * 
 *     @property
*/
  __pyx_t_2 = NULL;
  __Pyx_INCREF(__pyx_builtin_TypeError);
  __pyx_t_3 = __pyx_builtin_TypeError; 
  __pyx_t_4 = 1;
  {
    PyObject *__pyx_callargs[2] = {__pyx_t_2, __pyx_mstate_global->__pyx_kp_u_this_class_cannot_be_instantiate};
    __pyx_t_1 = __Pyx_PyObject_FastCall(__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, 1473, __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, 1473, __pyx_L1_error)

  /* "pysam/libcbcf.pyx":1472
 * cdef class VariantMetadata(object):
 *     """filter, info or format metadata record from a :class:`VariantHeader` object"""
 *     def __init__(self, *args, **kwargs):             # <<<<<<<<<<<<<<
 *         raise TypeError('this class cannot be instantiated from Python')
 * 
*/

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_TraceException(__pyx_lineno, 0, 0);
  #if CYTHON_USE_SYS_MONITORING
  __Pyx_TraceExceptionUnwind(0, 0);
  #else
  __Pyx_TraceReturnValue(NULL, 0, 0, __PYX_ERR(0, 1472, __pyx_L1_error));
  #endif
  __Pyx_AddTraceback("pysam.libcbcf.VariantMetadata.__init__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = -1;
  __Pyx_PyMonitoring_ExitScope(0);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "pysam/libcbcf.pyx":1475
 *         raise TypeError('this class cannot be instantiated from Python')
 * 
 *     @property             # <<<<<<<<<<<<<<
 *     def name(self):
 *         """metadata name"""
*/

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

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

static PyObject *__pyx_pf_5pysam_7libcbcf_15VariantMetadata_4name___get__(struct __pyx_obj_5pysam_7libcbcf_VariantMetadata *__pyx_v_self) {
  bcf_hdr_t *__pyx_v_hdr;
  PyObject *__pyx_r = NULL;
  __Pyx_TraceDeclarationsFunc
  __Pyx_RefNannyDeclarations
  bcf_hdr_t *__pyx_t_1;
  PyObject *__pyx_t_2 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_TraceFrameInit(((PyObject *)__pyx_mstate_global->__pyx_codeobj_tab[67]))
  __Pyx_RefNannySetupContext("__get__", 0);
  __Pyx_TraceStartFunc("__get__", __pyx_f[0], 1475, 0, 0, 0, __PYX_ERR(0, 1475, __pyx_L1_error));

  /* "pysam/libcbcf.pyx":1478
 *     def name(self):
 *         """metadata name"""
 *         cdef bcf_hdr_t *hdr = self.header.ptr             # <<<<<<<<<<<<<<
 *         return bcf_str_cache_get_charptr(hdr.id[BCF_DT_ID][self.id].key)
 * 
*/
  __pyx_t_1 = __pyx_v_self->header->ptr;
  __pyx_v_hdr = __pyx_t_1;

  /* "pysam/libcbcf.pyx":1479
 *         """metadata name"""
 *         cdef bcf_hdr_t *hdr = self.header.ptr
 *         return bcf_str_cache_get_charptr(hdr.id[BCF_DT_ID][self.id].key)             # <<<<<<<<<<<<<<
 * 
 *     # Q: Should this be exposed?
*/
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_2 = __pyx_f_5pysam_7libcbcf_bcf_str_cache_get_charptr(((__pyx_v_hdr->id[BCF_DT_ID])[__pyx_v_self->id]).key); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1479, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_r = __pyx_t_2;
  __pyx_t_2 = 0;
  __Pyx_TraceReturnValue(__pyx_r, 5, 0, __PYX_ERR(0, 1479, __pyx_L1_error));
  goto __pyx_L0;

  /* "pysam/libcbcf.pyx":1475
 *         raise TypeError('this class cannot be instantiated from Python')
 * 
 *     @property             # <<<<<<<<<<<<<<
 *     def name(self):
 *         """metadata name"""
*/

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_TraceException(__pyx_lineno, 0, 0);
  #if CYTHON_USE_SYS_MONITORING
  __Pyx_TraceExceptionUnwind(0, 0);
  #else
  __Pyx_TraceReturnValue(NULL, 0, 0, __PYX_ERR(0, 1475, __pyx_L1_error));
  #endif
  __Pyx_AddTraceback("pysam.libcbcf.VariantMetadata.name.__get__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_PyMonitoring_ExitScope(0);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "pysam/libcbcf.pyx":1482
 * 
 *     # Q: Should this be exposed?
 *     @property             # <<<<<<<<<<<<<<
 *     def id(self):
 *         """metadata internal header id number"""
*/

/* Python wrapper */
static PyObject *__pyx_pw_5pysam_7libcbcf_15VariantMetadata_2id_1__get__(PyObject *__pyx_v_self); /*proto*/
static PyObject *__pyx_pw_5pysam_7libcbcf_15VariantMetadata_2id_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_5pysam_7libcbcf_15VariantMetadata_2id___get__(((struct __pyx_obj_5pysam_7libcbcf_VariantMetadata *)__pyx_v_self));

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

static PyObject *__pyx_pf_5pysam_7libcbcf_15VariantMetadata_2id___get__(struct __pyx_obj_5pysam_7libcbcf_VariantMetadata *__pyx_v_self) {
  PyObject *__pyx_r = NULL;
  __Pyx_TraceDeclarationsFunc
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_TraceFrameInit(((PyObject *)__pyx_mstate_global->__pyx_codeobj_tab[68]))
  __Pyx_RefNannySetupContext("__get__", 0);
  __Pyx_TraceStartFunc("__get__", __pyx_f[0], 1482, 0, 0, 0, __PYX_ERR(0, 1482, __pyx_L1_error));

  /* "pysam/libcbcf.pyx":1485
 *     def id(self):
 *         """metadata internal header id number"""
 *         return self.id             # <<<<<<<<<<<<<<
 * 
 *     @property
*/
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = __Pyx_PyLong_From_int(__pyx_v_self->id); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1485, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  __Pyx_TraceReturnValue(__pyx_r, 1, 0, __PYX_ERR(0, 1485, __pyx_L1_error));
  goto __pyx_L0;

  /* "pysam/libcbcf.pyx":1482
 * 
 *     # Q: Should this be exposed?
 *     @property             # <<<<<<<<<<<<<<
 *     def id(self):
 *         """metadata internal header id number"""
*/

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_TraceException(__pyx_lineno, 0, 0);
  #if CYTHON_USE_SYS_MONITORING
  __Pyx_TraceExceptionUnwind(0, 0);
  #else
  __Pyx_TraceReturnValue(NULL, 0, 0, __PYX_ERR(0, 1482, __pyx_L1_error));
  #endif
  __Pyx_AddTraceback("pysam.libcbcf.VariantMetadata.id.__get__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_PyMonitoring_ExitScope(0);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "pysam/libcbcf.pyx":1487
 *         return self.id
 * 
 *     @property             # <<<<<<<<<<<<<<
 *     def number(self):
 *         """metadata number (i.e. cardinality)"""
*/

/* Python wrapper */
static PyObject *__pyx_pw_5pysam_7libcbcf_15VariantMetadata_6number_1__get__(PyObject *__pyx_v_self); /*proto*/
static PyObject *__pyx_pw_5pysam_7libcbcf_15VariantMetadata_6number_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_5pysam_7libcbcf_15VariantMetadata_6number___get__(((struct __pyx_obj_5pysam_7libcbcf_VariantMetadata *)__pyx_v_self));

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

static PyObject *__pyx_pf_5pysam_7libcbcf_15VariantMetadata_6number___get__(struct __pyx_obj_5pysam_7libcbcf_VariantMetadata *__pyx_v_self) {
  bcf_hdr_t *__pyx_v_hdr;
  int __pyx_v_l;
  PyObject *__pyx_r = NULL;
  __Pyx_TraceDeclarationsFunc
  __Pyx_RefNannyDeclarations
  bcf_hdr_t *__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;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_TraceFrameInit(((PyObject *)__pyx_mstate_global->__pyx_codeobj_tab[69]))
  __Pyx_RefNannySetupContext("__get__", 0);
  __Pyx_TraceStartFunc("__get__", __pyx_f[0], 1487, 0, 0, 0, __PYX_ERR(0, 1487, __pyx_L1_error));

  /* "pysam/libcbcf.pyx":1490
 *     def number(self):
 *         """metadata number (i.e. cardinality)"""
 *         cdef bcf_hdr_t *hdr = self.header.ptr             # <<<<<<<<<<<<<<
 * 
 *         if not check_header_id(hdr, self.type, self.id):
*/
  __pyx_t_1 = __pyx_v_self->header->ptr;
  __pyx_v_hdr = __pyx_t_1;

  /* "pysam/libcbcf.pyx":1492
 *         cdef bcf_hdr_t *hdr = self.header.ptr
 * 
 *         if not check_header_id(hdr, self.type, self.id):             # <<<<<<<<<<<<<<
 *             raise ValueError('Invalid header id')
 * 
*/
  __pyx_t_2 = __pyx_f_5pysam_7libcbcf_check_header_id(__pyx_v_hdr, __pyx_v_self->type, __pyx_v_self->id); if (unlikely(__pyx_t_2 == ((int)-1) && PyErr_Occurred())) __PYX_ERR(0, 1492, __pyx_L1_error)
  __pyx_t_3 = (!__pyx_t_2);
  if (unlikely(__pyx_t_3)) {

    /* "pysam/libcbcf.pyx":1493
 * 
 *         if not check_header_id(hdr, self.type, self.id):
 *             raise ValueError('Invalid header id')             # <<<<<<<<<<<<<<
 * 
 *         if self.type == BCF_HL_FLT:
*/
    __pyx_t_5 = NULL;
    __Pyx_INCREF(__pyx_builtin_ValueError);
    __pyx_t_6 = __pyx_builtin_ValueError; 
    __pyx_t_7 = 1;
    {
      PyObject *__pyx_callargs[2] = {__pyx_t_5, __pyx_mstate_global->__pyx_kp_u_Invalid_header_id};
      __pyx_t_4 = __Pyx_PyObject_FastCall(__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, 1493, __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, 1493, __pyx_L1_error)

    /* "pysam/libcbcf.pyx":1492
 *         cdef bcf_hdr_t *hdr = self.header.ptr
 * 
 *         if not check_header_id(hdr, self.type, self.id):             # <<<<<<<<<<<<<<
 *             raise ValueError('Invalid header id')
 * 
*/
  }

  /* "pysam/libcbcf.pyx":1495
 *             raise ValueError('Invalid header id')
 * 
 *         if self.type == BCF_HL_FLT:             # <<<<<<<<<<<<<<
 *             return None
 * 
*/
  __pyx_t_3 = (__pyx_v_self->type == BCF_HL_FLT);
  if (__pyx_t_3) {

    /* "pysam/libcbcf.pyx":1496
 * 
 *         if self.type == BCF_HL_FLT:
 *             return None             # <<<<<<<<<<<<<<
 * 
 *         cdef int l = bcf_hdr_id2length(hdr, self.type, self.id)
*/
    __Pyx_XDECREF(__pyx_r);
    __pyx_r = Py_None; __Pyx_INCREF(Py_None);
    goto __pyx_L0;

    /* "pysam/libcbcf.pyx":1495
 *             raise ValueError('Invalid header id')
 * 
 *         if self.type == BCF_HL_FLT:             # <<<<<<<<<<<<<<
 *             return None
 * 
*/
  }

  /* "pysam/libcbcf.pyx":1498
 *             return None
 * 
 *         cdef int l = bcf_hdr_id2length(hdr, self.type, self.id)             # <<<<<<<<<<<<<<
 *         if l == BCF_VL_FIXED:
 *             return bcf_hdr_id2number(hdr, self.type, self.id)
*/
  __pyx_v_l = bcf_hdr_id2length(__pyx_v_hdr, __pyx_v_self->type, __pyx_v_self->id);

  /* "pysam/libcbcf.pyx":1499
 * 
 *         cdef int l = bcf_hdr_id2length(hdr, self.type, self.id)
 *         if l == BCF_VL_FIXED:             # <<<<<<<<<<<<<<
 *             return bcf_hdr_id2number(hdr, self.type, self.id)
 *         elif l == BCF_VL_VAR:
*/
  __pyx_t_3 = (__pyx_v_l == BCF_VL_FIXED);
  if (__pyx_t_3) {

    /* "pysam/libcbcf.pyx":1500
 *         cdef int l = bcf_hdr_id2length(hdr, self.type, self.id)
 *         if l == BCF_VL_FIXED:
 *             return bcf_hdr_id2number(hdr, self.type, self.id)             # <<<<<<<<<<<<<<
 *         elif l == BCF_VL_VAR:
 *             return '.'
*/
    __Pyx_XDECREF(__pyx_r);
    __pyx_t_4 = __Pyx_PyLong_From_int(bcf_hdr_id2number(__pyx_v_hdr, __pyx_v_self->type, __pyx_v_self->id)); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1500, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
    __pyx_r = __pyx_t_4;
    __pyx_t_4 = 0;
    __Pyx_TraceReturnValue(__pyx_r, 37, 0, __PYX_ERR(0, 1500, __pyx_L1_error));
    goto __pyx_L0;

    /* "pysam/libcbcf.pyx":1499
 * 
 *         cdef int l = bcf_hdr_id2length(hdr, self.type, self.id)
 *         if l == BCF_VL_FIXED:             # <<<<<<<<<<<<<<
 *             return bcf_hdr_id2number(hdr, self.type, self.id)
 *         elif l == BCF_VL_VAR:
*/
  }

  /* "pysam/libcbcf.pyx":1501
 *         if l == BCF_VL_FIXED:
 *             return bcf_hdr_id2number(hdr, self.type, self.id)
 *         elif l == BCF_VL_VAR:             # <<<<<<<<<<<<<<
 *             return '.'
 *         else:
*/
  __pyx_t_3 = (__pyx_v_l == BCF_VL_VAR);
  if (__pyx_t_3) {

    /* "pysam/libcbcf.pyx":1502
 *             return bcf_hdr_id2number(hdr, self.type, self.id)
 *         elif l == BCF_VL_VAR:
 *             return '.'             # <<<<<<<<<<<<<<
 *         else:
 *             return METADATA_LENGTHS[l]
*/
    __Pyx_XDECREF(__pyx_r);
    __Pyx_INCREF(__pyx_mstate_global->__pyx_kp_u__4);
    __pyx_r = __pyx_mstate_global->__pyx_kp_u__4;
    __Pyx_TraceReturnValue(__pyx_r, 48, 0, __PYX_ERR(0, 1502, __pyx_L1_error));
    goto __pyx_L0;

    /* "pysam/libcbcf.pyx":1501
 *         if l == BCF_VL_FIXED:
 *             return bcf_hdr_id2number(hdr, self.type, self.id)
 *         elif l == BCF_VL_VAR:             # <<<<<<<<<<<<<<
 *             return '.'
 *         else:
*/
  }

  /* "pysam/libcbcf.pyx":1504
 *             return '.'
 *         else:
 *             return METADATA_LENGTHS[l]             # <<<<<<<<<<<<<<
 * 
 *     @property
*/
  /*else*/ {
    __Pyx_XDECREF(__pyx_r);
    if (unlikely(__pyx_v_5pysam_7libcbcf_METADATA_LENGTHS == Py_None)) {
      PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable");
      __PYX_ERR(0, 1504, __pyx_L1_error)
    }
    __pyx_t_4 = __Pyx_GetItemInt_Tuple(__pyx_v_5pysam_7libcbcf_METADATA_LENGTHS, __pyx_v_l, int, 1, __Pyx_PyLong_From_int, 0, 1, 1, 1); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1504, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
    __pyx_r = __pyx_t_4;
    __pyx_t_4 = 0;
    __Pyx_TraceReturnValue(__pyx_r, 50, 0, __PYX_ERR(0, 1504, __pyx_L1_error));
    goto __pyx_L0;
  }

  /* "pysam/libcbcf.pyx":1487
 *         return self.id
 * 
 *     @property             # <<<<<<<<<<<<<<
 *     def number(self):
 *         """metadata number (i.e. cardinality)"""
*/

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_XDECREF(__pyx_t_5);
  __Pyx_XDECREF(__pyx_t_6);
  __Pyx_TraceException(__pyx_lineno, 0, 0);
  #if CYTHON_USE_SYS_MONITORING
  __Pyx_TraceExceptionUnwind(0, 0);
  #else
  __Pyx_TraceReturnValue(NULL, 0, 0, __PYX_ERR(0, 1487, __pyx_L1_error));
  #endif
  __Pyx_AddTraceback("pysam.libcbcf.VariantMetadata.number.__get__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_PyMonitoring_ExitScope(0);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "pysam/libcbcf.pyx":1506
 *             return METADATA_LENGTHS[l]
 * 
 *     @property             # <<<<<<<<<<<<<<
 *     def type(self):
 *         """metadata value type"""
*/

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

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

static PyObject *__pyx_pf_5pysam_7libcbcf_15VariantMetadata_4type___get__(struct __pyx_obj_5pysam_7libcbcf_VariantMetadata *__pyx_v_self) {
  bcf_hdr_t *__pyx_v_hdr;
  PyObject *__pyx_r = NULL;
  __Pyx_TraceDeclarationsFunc
  __Pyx_RefNannyDeclarations
  bcf_hdr_t *__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;
  int __pyx_t_8;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_TraceFrameInit(((PyObject *)__pyx_mstate_global->__pyx_codeobj_tab[70]))
  __Pyx_RefNannySetupContext("__get__", 0);
  __Pyx_TraceStartFunc("__get__", __pyx_f[0], 1506, 0, 0, 0, __PYX_ERR(0, 1506, __pyx_L1_error));

  /* "pysam/libcbcf.pyx":1509
 *     def type(self):
 *         """metadata value type"""
 *         cdef bcf_hdr_t *hdr = self.header.ptr             # <<<<<<<<<<<<<<
 *         if not check_header_id(hdr, self.type, self.id):
 *             raise ValueError('Invalid header id')
*/
  __pyx_t_1 = __pyx_v_self->header->ptr;
  __pyx_v_hdr = __pyx_t_1;

  /* "pysam/libcbcf.pyx":1510
 *         """metadata value type"""
 *         cdef bcf_hdr_t *hdr = self.header.ptr
 *         if not check_header_id(hdr, self.type, self.id):             # <<<<<<<<<<<<<<
 *             raise ValueError('Invalid header id')
 * 
*/
  __pyx_t_2 = __pyx_f_5pysam_7libcbcf_check_header_id(__pyx_v_hdr, __pyx_v_self->type, __pyx_v_self->id); if (unlikely(__pyx_t_2 == ((int)-1) && PyErr_Occurred())) __PYX_ERR(0, 1510, __pyx_L1_error)
  __pyx_t_3 = (!__pyx_t_2);
  if (unlikely(__pyx_t_3)) {

    /* "pysam/libcbcf.pyx":1511
 *         cdef bcf_hdr_t *hdr = self.header.ptr
 *         if not check_header_id(hdr, self.type, self.id):
 *             raise ValueError('Invalid header id')             # <<<<<<<<<<<<<<
 * 
 *         if self.type == BCF_HL_FLT:
*/
    __pyx_t_5 = NULL;
    __Pyx_INCREF(__pyx_builtin_ValueError);
    __pyx_t_6 = __pyx_builtin_ValueError; 
    __pyx_t_7 = 1;
    {
      PyObject *__pyx_callargs[2] = {__pyx_t_5, __pyx_mstate_global->__pyx_kp_u_Invalid_header_id};
      __pyx_t_4 = __Pyx_PyObject_FastCall(__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, 1511, __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, 1511, __pyx_L1_error)

    /* "pysam/libcbcf.pyx":1510
 *         """metadata value type"""
 *         cdef bcf_hdr_t *hdr = self.header.ptr
 *         if not check_header_id(hdr, self.type, self.id):             # <<<<<<<<<<<<<<
 *             raise ValueError('Invalid header id')
 * 
*/
  }

  /* "pysam/libcbcf.pyx":1513
 *             raise ValueError('Invalid header id')
 * 
 *         if self.type == BCF_HL_FLT:             # <<<<<<<<<<<<<<
 *             return None
 *         return VALUE_TYPES[bcf_hdr_id2type(hdr, self.type, self.id)]
*/
  __pyx_t_3 = (__pyx_v_self->type == BCF_HL_FLT);
  if (__pyx_t_3) {

    /* "pysam/libcbcf.pyx":1514
 * 
 *         if self.type == BCF_HL_FLT:
 *             return None             # <<<<<<<<<<<<<<
 *         return VALUE_TYPES[bcf_hdr_id2type(hdr, self.type, self.id)]
 * 
*/
    __Pyx_XDECREF(__pyx_r);
    __pyx_r = Py_None; __Pyx_INCREF(Py_None);
    goto __pyx_L0;

    /* "pysam/libcbcf.pyx":1513
 *             raise ValueError('Invalid header id')
 * 
 *         if self.type == BCF_HL_FLT:             # <<<<<<<<<<<<<<
 *             return None
 *         return VALUE_TYPES[bcf_hdr_id2type(hdr, self.type, self.id)]
*/
  }

  /* "pysam/libcbcf.pyx":1515
 *         if self.type == BCF_HL_FLT:
 *             return None
 *         return VALUE_TYPES[bcf_hdr_id2type(hdr, self.type, self.id)]             # <<<<<<<<<<<<<<
 * 
 *     @property
*/
  __Pyx_XDECREF(__pyx_r);
  if (unlikely(__pyx_v_5pysam_7libcbcf_VALUE_TYPES == Py_None)) {
    PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable");
    __PYX_ERR(0, 1515, __pyx_L1_error)
  }
  __pyx_t_8 = bcf_hdr_id2type(__pyx_v_hdr, __pyx_v_self->type, __pyx_v_self->id);
  __pyx_t_4 = __Pyx_GetItemInt_Tuple(__pyx_v_5pysam_7libcbcf_VALUE_TYPES, __pyx_t_8, int, 1, __Pyx_PyLong_From_int, 0, 1, 1, 1); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1515, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  __pyx_r = __pyx_t_4;
  __pyx_t_4 = 0;
  __Pyx_TraceReturnValue(__pyx_r, 25, 0, __PYX_ERR(0, 1515, __pyx_L1_error));
  goto __pyx_L0;

  /* "pysam/libcbcf.pyx":1506
 *             return METADATA_LENGTHS[l]
 * 
 *     @property             # <<<<<<<<<<<<<<
 *     def type(self):
 *         """metadata value type"""
*/

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_XDECREF(__pyx_t_5);
  __Pyx_XDECREF(__pyx_t_6);
  __Pyx_TraceException(__pyx_lineno, 0, 0);
  #if CYTHON_USE_SYS_MONITORING
  __Pyx_TraceExceptionUnwind(0, 0);
  #else
  __Pyx_TraceReturnValue(NULL, 0, 0, __PYX_ERR(0, 1506, __pyx_L1_error));
  #endif
  __Pyx_AddTraceback("pysam.libcbcf.VariantMetadata.type.__get__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_PyMonitoring_ExitScope(0);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "pysam/libcbcf.pyx":1517
 *         return VALUE_TYPES[bcf_hdr_id2type(hdr, self.type, self.id)]
 * 
 *     @property             # <<<<<<<<<<<<<<
 *     def description(self):
 *         """metadata description (or None if not set)"""
*/

/* Python wrapper */
static PyObject *__pyx_pw_5pysam_7libcbcf_15VariantMetadata_11description_1__get__(PyObject *__pyx_v_self); /*proto*/
static PyObject *__pyx_pw_5pysam_7libcbcf_15VariantMetadata_11description_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_5pysam_7libcbcf_15VariantMetadata_11description___get__(((struct __pyx_obj_5pysam_7libcbcf_VariantMetadata *)__pyx_v_self));

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

static PyObject *__pyx_pf_5pysam_7libcbcf_15VariantMetadata_11description___get__(struct __pyx_obj_5pysam_7libcbcf_VariantMetadata *__pyx_v_self) {
  PyObject *__pyx_v_descr = NULL;
  PyObject *__pyx_r = NULL;
  __Pyx_TraceDeclarationsFunc
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  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_TraceFrameInit(((PyObject *)__pyx_mstate_global->__pyx_codeobj_tab[71]))
  __Pyx_RefNannySetupContext("__get__", 0);
  __Pyx_TraceStartFunc("__get__", __pyx_f[0], 1517, 0, 0, 0, __PYX_ERR(0, 1517, __pyx_L1_error));

  /* "pysam/libcbcf.pyx":1520
 *     def description(self):
 *         """metadata description (or None if not set)"""
 *         descr = self.record.get('Description')             # <<<<<<<<<<<<<<
 *         if descr:
 *             descr = descr.strip('"')
*/
  __pyx_t_3 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_mstate_global->__pyx_n_u_record); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1520, __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_mstate_global->__pyx_n_u_Description};
    __pyx_t_1 = __Pyx_PyObject_FastCallMethod(__pyx_mstate_global->__pyx_n_u_get, __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, 1520, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
  }
  __pyx_v_descr = __pyx_t_1;
  __pyx_t_1 = 0;

  /* "pysam/libcbcf.pyx":1521
 *         """metadata description (or None if not set)"""
 *         descr = self.record.get('Description')
 *         if descr:             # <<<<<<<<<<<<<<
 *             descr = descr.strip('"')
 *         return force_str(descr)
*/
  __pyx_t_5 = __Pyx_PyObject_IsTrue(__pyx_v_descr); if (unlikely((__pyx_t_5 < 0))) __PYX_ERR(0, 1521, __pyx_L1_error)
  if (__pyx_t_5) {

    /* "pysam/libcbcf.pyx":1522
 *         descr = self.record.get('Description')
 *         if descr:
 *             descr = descr.strip('"')             # <<<<<<<<<<<<<<
 *         return force_str(descr)
 * 
*/
    __pyx_t_3 = __pyx_v_descr;
    __Pyx_INCREF(__pyx_t_3);
    __pyx_t_4 = 0;
    {
      PyObject *__pyx_callargs[2] = {__pyx_t_3, __pyx_mstate_global->__pyx_kp_u__5};
      __pyx_t_1 = __Pyx_PyObject_FastCallMethod(__pyx_mstate_global->__pyx_n_u_strip, __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_1)) __PYX_ERR(0, 1522, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_1);
    }
    __Pyx_DECREF_SET(__pyx_v_descr, __pyx_t_1);
    __pyx_t_1 = 0;

    /* "pysam/libcbcf.pyx":1521
 *         """metadata description (or None if not set)"""
 *         descr = self.record.get('Description')
 *         if descr:             # <<<<<<<<<<<<<<
 *             descr = descr.strip('"')
 *         return force_str(descr)
*/
  }

  /* "pysam/libcbcf.pyx":1523
 *         if descr:
 *             descr = descr.strip('"')
 *         return force_str(descr)             # <<<<<<<<<<<<<<
 * 
 *     @property
*/
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = __pyx_f_5pysam_9libcutils_force_str(__pyx_v_descr, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1523, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  __Pyx_TraceReturnValue(__pyx_r, 14, 0, __PYX_ERR(0, 1523, __pyx_L1_error));
  goto __pyx_L0;

  /* "pysam/libcbcf.pyx":1517
 *         return VALUE_TYPES[bcf_hdr_id2type(hdr, self.type, self.id)]
 * 
 *     @property             # <<<<<<<<<<<<<<
 *     def description(self):
 *         """metadata description (or None if not set)"""
*/

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_TraceException(__pyx_lineno, 0, 0);
  #if CYTHON_USE_SYS_MONITORING
  __Pyx_TraceExceptionUnwind(0, 0);
  #else
  __Pyx_TraceReturnValue(NULL, 0, 0, __PYX_ERR(0, 1517, __pyx_L1_error));
  #endif
  __Pyx_AddTraceback("pysam.libcbcf.VariantMetadata.description.__get__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_descr);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_PyMonitoring_ExitScope(0);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "pysam/libcbcf.pyx":1525
 *         return force_str(descr)
 * 
 *     @property             # <<<<<<<<<<<<<<
 *     def record(self):
 *         """:class:`VariantHeaderRecord` associated with this :class:`VariantMetadata` object"""
*/

/* Python wrapper */
static PyObject *__pyx_pw_5pysam_7libcbcf_15VariantMetadata_6record_1__get__(PyObject *__pyx_v_self); /*proto*/
static PyObject *__pyx_pw_5pysam_7libcbcf_15VariantMetadata_6record_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_5pysam_7libcbcf_15VariantMetadata_6record___get__(((struct __pyx_obj_5pysam_7libcbcf_VariantMetadata *)__pyx_v_self));

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

static PyObject *__pyx_pf_5pysam_7libcbcf_15VariantMetadata_6record___get__(struct __pyx_obj_5pysam_7libcbcf_VariantMetadata *__pyx_v_self) {
  bcf_hdr_t *__pyx_v_hdr;
  bcf_hrec_t *__pyx_v_hrec;
  PyObject *__pyx_r = NULL;
  __Pyx_TraceDeclarationsFunc
  __Pyx_RefNannyDeclarations
  bcf_hdr_t *__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;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_TraceFrameInit(((PyObject *)__pyx_mstate_global->__pyx_codeobj_tab[72]))
  __Pyx_RefNannySetupContext("__get__", 0);
  __Pyx_TraceStartFunc("__get__", __pyx_f[0], 1525, 0, 0, 0, __PYX_ERR(0, 1525, __pyx_L1_error));

  /* "pysam/libcbcf.pyx":1528
 *     def record(self):
 *         """:class:`VariantHeaderRecord` associated with this :class:`VariantMetadata` object"""
 *         cdef bcf_hdr_t *hdr = self.header.ptr             # <<<<<<<<<<<<<<
 *         if not check_header_id(hdr, self.type, self.id):
 *             raise ValueError('Invalid header id')
*/
  __pyx_t_1 = __pyx_v_self->header->ptr;
  __pyx_v_hdr = __pyx_t_1;

  /* "pysam/libcbcf.pyx":1529
 *         """:class:`VariantHeaderRecord` associated with this :class:`VariantMetadata` object"""
 *         cdef bcf_hdr_t *hdr = self.header.ptr
 *         if not check_header_id(hdr, self.type, self.id):             # <<<<<<<<<<<<<<
 *             raise ValueError('Invalid header id')
 *         cdef bcf_hrec_t *hrec = hdr.id[BCF_DT_ID][self.id].val.hrec[self.type]
*/
  __pyx_t_2 = __pyx_f_5pysam_7libcbcf_check_header_id(__pyx_v_hdr, __pyx_v_self->type, __pyx_v_self->id); if (unlikely(__pyx_t_2 == ((int)-1) && PyErr_Occurred())) __PYX_ERR(0, 1529, __pyx_L1_error)
  __pyx_t_3 = (!__pyx_t_2);
  if (unlikely(__pyx_t_3)) {

    /* "pysam/libcbcf.pyx":1530
 *         cdef bcf_hdr_t *hdr = self.header.ptr
 *         if not check_header_id(hdr, self.type, self.id):
 *             raise ValueError('Invalid header id')             # <<<<<<<<<<<<<<
 *         cdef bcf_hrec_t *hrec = hdr.id[BCF_DT_ID][self.id].val.hrec[self.type]
 *         if not hrec:
*/
    __pyx_t_5 = NULL;
    __Pyx_INCREF(__pyx_builtin_ValueError);
    __pyx_t_6 = __pyx_builtin_ValueError; 
    __pyx_t_7 = 1;
    {
      PyObject *__pyx_callargs[2] = {__pyx_t_5, __pyx_mstate_global->__pyx_kp_u_Invalid_header_id};
      __pyx_t_4 = __Pyx_PyObject_FastCall(__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, 1530, __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, 1530, __pyx_L1_error)

    /* "pysam/libcbcf.pyx":1529
 *         """:class:`VariantHeaderRecord` associated with this :class:`VariantMetadata` object"""
 *         cdef bcf_hdr_t *hdr = self.header.ptr
 *         if not check_header_id(hdr, self.type, self.id):             # <<<<<<<<<<<<<<
 *             raise ValueError('Invalid header id')
 *         cdef bcf_hrec_t *hrec = hdr.id[BCF_DT_ID][self.id].val.hrec[self.type]
*/
  }

  /* "pysam/libcbcf.pyx":1531
 *         if not check_header_id(hdr, self.type, self.id):
 *             raise ValueError('Invalid header id')
 *         cdef bcf_hrec_t *hrec = hdr.id[BCF_DT_ID][self.id].val.hrec[self.type]             # <<<<<<<<<<<<<<
 *         if not hrec:
 *             return None
*/
  __pyx_v_hrec = (((__pyx_v_hdr->id[BCF_DT_ID])[__pyx_v_self->id]).val->hrec[__pyx_v_self->type]);

  /* "pysam/libcbcf.pyx":1532
 *             raise ValueError('Invalid header id')
 *         cdef bcf_hrec_t *hrec = hdr.id[BCF_DT_ID][self.id].val.hrec[self.type]
 *         if not hrec:             # <<<<<<<<<<<<<<
 *             return None
 *         return makeVariantHeaderRecord(self.header, hrec)
*/
  __pyx_t_3 = (!(__pyx_v_hrec != 0));
  if (__pyx_t_3) {

    /* "pysam/libcbcf.pyx":1533
 *         cdef bcf_hrec_t *hrec = hdr.id[BCF_DT_ID][self.id].val.hrec[self.type]
 *         if not hrec:
 *             return None             # <<<<<<<<<<<<<<
 *         return makeVariantHeaderRecord(self.header, hrec)
 * 
*/
    __Pyx_XDECREF(__pyx_r);
    __pyx_r = Py_None; __Pyx_INCREF(Py_None);
    goto __pyx_L0;

    /* "pysam/libcbcf.pyx":1532
 *             raise ValueError('Invalid header id')
 *         cdef bcf_hrec_t *hrec = hdr.id[BCF_DT_ID][self.id].val.hrec[self.type]
 *         if not hrec:             # <<<<<<<<<<<<<<
 *             return None
 *         return makeVariantHeaderRecord(self.header, hrec)
*/
  }

  /* "pysam/libcbcf.pyx":1534
 *         if not hrec:
 *             return None
 *         return makeVariantHeaderRecord(self.header, hrec)             # <<<<<<<<<<<<<<
 * 
 *     def remove_header(self):
*/
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_4 = ((PyObject *)__pyx_v_self->header);
  __Pyx_INCREF(__pyx_t_4);
  __pyx_t_6 = ((PyObject *)__pyx_f_5pysam_7libcbcf_makeVariantHeaderRecord(((struct __pyx_obj_5pysam_7libcbcf_VariantHeader *)__pyx_t_4), __pyx_v_hrec)); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 1534, __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;
  __Pyx_TraceReturnValue(__pyx_r, 36, 0, __PYX_ERR(0, 1534, __pyx_L1_error));
  goto __pyx_L0;

  /* "pysam/libcbcf.pyx":1525
 *         return force_str(descr)
 * 
 *     @property             # <<<<<<<<<<<<<<
 *     def record(self):
 *         """:class:`VariantHeaderRecord` associated with this :class:`VariantMetadata` object"""
*/

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_XDECREF(__pyx_t_5);
  __Pyx_XDECREF(__pyx_t_6);
  __Pyx_TraceException(__pyx_lineno, 0, 0);
  #if CYTHON_USE_SYS_MONITORING
  __Pyx_TraceExceptionUnwind(0, 0);
  #else
  __Pyx_TraceReturnValue(NULL, 0, 0, __PYX_ERR(0, 1525, __pyx_L1_error));
  #endif
  __Pyx_AddTraceback("pysam.libcbcf.VariantMetadata.record.__get__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_PyMonitoring_ExitScope(0);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "pysam/libcbcf.pyx":1536
 *         return makeVariantHeaderRecord(self.header, hrec)
 * 
 *     def remove_header(self):             # <<<<<<<<<<<<<<
 *         cdef bcf_hdr_t *hdr = self.header.ptr
 *         cdef const char *key = hdr.id[BCF_DT_ID][self.id].key
*/

/* Python wrapper */
static PyObject *__pyx_pw_5pysam_7libcbcf_15VariantMetadata_3remove_header(PyObject *__pyx_v_self, 
#if 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_5pysam_7libcbcf_15VariantMetadata_2remove_header, "VariantMetadata.remove_header(self)");
static PyMethodDef __pyx_mdef_5pysam_7libcbcf_15VariantMetadata_3remove_header = {"remove_header", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_5pysam_7libcbcf_15VariantMetadata_3remove_header, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_5pysam_7libcbcf_15VariantMetadata_2remove_header};
static PyObject *__pyx_pw_5pysam_7libcbcf_15VariantMetadata_3remove_header(PyObject *__pyx_v_self, 
#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("remove_header (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("remove_header", 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("remove_header", __pyx_kwds); return NULL;}
  __pyx_r = __pyx_pf_5pysam_7libcbcf_15VariantMetadata_2remove_header(((struct __pyx_obj_5pysam_7libcbcf_VariantMetadata *)__pyx_v_self));

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

static PyObject *__pyx_pf_5pysam_7libcbcf_15VariantMetadata_2remove_header(struct __pyx_obj_5pysam_7libcbcf_VariantMetadata *__pyx_v_self) {
  bcf_hdr_t *__pyx_v_hdr;
  char const *__pyx_v_key;
  PyObject *__pyx_r = NULL;
  __Pyx_TraceDeclarationsFunc
  __Pyx_RefNannyDeclarations
  bcf_hdr_t *__pyx_t_1;
  char const *__pyx_t_2;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_TraceFrameInit(((PyObject *)__pyx_mstate_global->__pyx_codeobj_tab[73]))
  __Pyx_RefNannySetupContext("remove_header", 0);
  __Pyx_TraceStartFunc("remove_header", __pyx_f[0], 1536, 0, 0, 0, __PYX_ERR(0, 1536, __pyx_L1_error));

  /* "pysam/libcbcf.pyx":1537
 * 
 *     def remove_header(self):
 *         cdef bcf_hdr_t *hdr = self.header.ptr             # <<<<<<<<<<<<<<
 *         cdef const char *key = hdr.id[BCF_DT_ID][self.id].key
 *         bcf_hdr_remove(hdr, self.type, key)
*/
  __pyx_t_1 = __pyx_v_self->header->ptr;
  __pyx_v_hdr = __pyx_t_1;

  /* "pysam/libcbcf.pyx":1538
 *     def remove_header(self):
 *         cdef bcf_hdr_t *hdr = self.header.ptr
 *         cdef const char *key = hdr.id[BCF_DT_ID][self.id].key             # <<<<<<<<<<<<<<
 *         bcf_hdr_remove(hdr, self.type, key)
 * 
*/
  __pyx_t_2 = ((__pyx_v_hdr->id[BCF_DT_ID])[__pyx_v_self->id]).key;
  __pyx_v_key = __pyx_t_2;

  /* "pysam/libcbcf.pyx":1539
 *         cdef bcf_hdr_t *hdr = self.header.ptr
 *         cdef const char *key = hdr.id[BCF_DT_ID][self.id].key
 *         bcf_hdr_remove(hdr, self.type, key)             # <<<<<<<<<<<<<<
 * 
 * 
*/
  bcf_hdr_remove(__pyx_v_hdr, __pyx_v_self->type, __pyx_v_key);

  /* "pysam/libcbcf.pyx":1536
 *         return makeVariantHeaderRecord(self.header, hrec)
 * 
 *     def remove_header(self):             # <<<<<<<<<<<<<<
 *         cdef bcf_hdr_t *hdr = self.header.ptr
 *         cdef const char *key = hdr.id[BCF_DT_ID][self.id].key
*/

  /* function exit code */
  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  __Pyx_TraceReturnValue(__pyx_r, 0, 0, __PYX_ERR(0, 1536, __pyx_L1_error));
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_TraceException(__pyx_lineno, 0, 0);
  #if CYTHON_USE_SYS_MONITORING
  __Pyx_TraceExceptionUnwind(0, 0);
  #else
  __Pyx_TraceReturnValue(NULL, 0, 0, __PYX_ERR(0, 1536, __pyx_L1_error));
  #endif
  __Pyx_AddTraceback("pysam.libcbcf.VariantMetadata.remove_header", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_PyMonitoring_ExitScope(0);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "pysam/libcbcf.pxd":70
 * 
 * cdef class VariantMetadata(object):
 *     cdef readonly VariantHeader header             # <<<<<<<<<<<<<<
 *     cdef int type
 *     cdef int id
*/

/* Python wrapper */
static PyObject *__pyx_pw_5pysam_7libcbcf_15VariantMetadata_6header_1__get__(PyObject *__pyx_v_self); /*proto*/
static PyObject *__pyx_pw_5pysam_7libcbcf_15VariantMetadata_6header_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_5pysam_7libcbcf_15VariantMetadata_6header___get__(((struct __pyx_obj_5pysam_7libcbcf_VariantMetadata *)__pyx_v_self));

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

static PyObject *__pyx_pf_5pysam_7libcbcf_15VariantMetadata_6header___get__(struct __pyx_obj_5pysam_7libcbcf_VariantMetadata *__pyx_v_self) {
  PyObject *__pyx_r = NULL;
  __Pyx_TraceDeclarationsFunc
  __Pyx_RefNannyDeclarations
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_TraceFrameInit(((PyObject *)__pyx_mstate_global->__pyx_codeobj_tab[74]))
  __Pyx_RefNannySetupContext("__get__", 0);
  __Pyx_TraceStartFunc("__get__", __pyx_f[3], 70, 0, 0, 0, __PYX_ERR(3, 70, __pyx_L1_error));
  __Pyx_XDECREF(__pyx_r);
  __Pyx_INCREF((PyObject *)__pyx_v_self->header);
  __pyx_r = ((PyObject *)__pyx_v_self->header);
  __Pyx_TraceReturnValue(__pyx_r, 0, 0, __PYX_ERR(3, 70, __pyx_L1_error));
  goto __pyx_L0;

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_TraceException(__pyx_lineno, 0, 0);
  #if CYTHON_USE_SYS_MONITORING
  __Pyx_TraceExceptionUnwind(0, 0);
  #else
  __Pyx_TraceReturnValue(NULL, 0, 0, __PYX_ERR(3, 70, __pyx_L1_error));
  #endif
  __Pyx_AddTraceback("pysam.libcbcf.VariantMetadata.header.__get__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_PyMonitoring_ExitScope(0);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

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

/* Python wrapper */
static PyObject *__pyx_pw_5pysam_7libcbcf_15VariantMetadata_5__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*/
PyDoc_STRVAR(__pyx_doc_5pysam_7libcbcf_15VariantMetadata_4__reduce_cython__, "VariantMetadata.__reduce_cython__(self)");
static PyMethodDef __pyx_mdef_5pysam_7libcbcf_15VariantMetadata_5__reduce_cython__ = {"__reduce_cython__", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_5pysam_7libcbcf_15VariantMetadata_5__reduce_cython__, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_5pysam_7libcbcf_15VariantMetadata_4__reduce_cython__};
static PyObject *__pyx_pw_5pysam_7libcbcf_15VariantMetadata_5__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_5pysam_7libcbcf_15VariantMetadata_4__reduce_cython__(((struct __pyx_obj_5pysam_7libcbcf_VariantMetadata *)__pyx_v_self));

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

static PyObject *__pyx_pf_5pysam_7libcbcf_15VariantMetadata_4__reduce_cython__(struct __pyx_obj_5pysam_7libcbcf_VariantMetadata *__pyx_v_self) {
  PyObject *__pyx_v_state = 0;
  PyObject *__pyx_v__dict = 0;
  int __pyx_v_use_setstate;
  PyObject *__pyx_r = NULL;
  __Pyx_TraceDeclarationsFunc
  __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_TraceFrameInit(((PyObject *)__pyx_mstate_global->__pyx_codeobj_tab[75]))
  __Pyx_RefNannySetupContext("__reduce_cython__", 0);
  __Pyx_TraceStartFunc("__reduce_cython__", __pyx_f[4], 1, 0, 0, 0, __PYX_ERR(4, 1, __pyx_L1_error));

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

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

  /* "(tree fragment)":7
 *     state = (self.header, self.id, self.type)
 *     _dict = getattr(self, '__dict__', None)
 *     if _dict is not None:             # <<<<<<<<<<<<<<
 *         state += (_dict,)
 *         use_setstate = True
*/
  __pyx_t_4 = (__pyx_v__dict != Py_None);
  if (__pyx_t_4) {

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

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

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

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

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

    /* "(tree fragment)":13
 *         use_setstate = self.header is not None
 *     if use_setstate:
 *         return __pyx_unpickle_VariantMetadata, (type(self), 0xcd1335f, None), state             # <<<<<<<<<<<<<<
 *     else:
 *         return __pyx_unpickle_VariantMetadata, (type(self), 0xcd1335f, state)
*/
    __Pyx_XDECREF(__pyx_r);
    __Pyx_GetModuleGlobalName(__pyx_t_2, __pyx_mstate_global->__pyx_n_u_pyx_unpickle_VariantMetadata); if (unlikely(!__pyx_t_2)) __PYX_ERR(4, 13, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __pyx_t_3 = PyTuple_New(3); if (unlikely(!__pyx_t_3)) __PYX_ERR(4, 13, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __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_3, 0, ((PyObject *)Py_TYPE(((PyObject *)__pyx_v_self)))) != (0)) __PYX_ERR(4, 13, __pyx_L1_error);
    __Pyx_INCREF(__pyx_mstate_global->__pyx_int_215036767);
    __Pyx_GIVEREF(__pyx_mstate_global->__pyx_int_215036767);
    if (__Pyx_PyTuple_SET_ITEM(__pyx_t_3, 1, __pyx_mstate_global->__pyx_int_215036767) != (0)) __PYX_ERR(4, 13, __pyx_L1_error);
    __Pyx_INCREF(Py_None);
    __Pyx_GIVEREF(Py_None);
    if (__Pyx_PyTuple_SET_ITEM(__pyx_t_3, 2, Py_None) != (0)) __PYX_ERR(4, 13, __pyx_L1_error);
    __pyx_t_1 = PyTuple_New(3); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 13, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_GIVEREF(__pyx_t_2);
    if (__Pyx_PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_t_2) != (0)) __PYX_ERR(4, 13, __pyx_L1_error);
    __Pyx_GIVEREF(__pyx_t_3);
    if (__Pyx_PyTuple_SET_ITEM(__pyx_t_1, 1, __pyx_t_3) != (0)) __PYX_ERR(4, 13, __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(4, 13, __pyx_L1_error);
    __pyx_t_2 = 0;
    __pyx_t_3 = 0;
    __pyx_r = __pyx_t_1;
    __pyx_t_1 = 0;
    __Pyx_TraceReturnValue(__pyx_r, 29, 0, __PYX_ERR(4, 13, __pyx_L1_error));
    goto __pyx_L0;

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

  /* "(tree fragment)":15
 *         return __pyx_unpickle_VariantMetadata, (type(self), 0xcd1335f, None), state
 *     else:
 *         return __pyx_unpickle_VariantMetadata, (type(self), 0xcd1335f, state)             # <<<<<<<<<<<<<<
 * def __setstate_cython__(self, __pyx_state):
 *     __pyx_unpickle_VariantMetadata__set_state(self, __pyx_state)
*/
  /*else*/ {
    __Pyx_XDECREF(__pyx_r);
    __Pyx_GetModuleGlobalName(__pyx_t_1, __pyx_mstate_global->__pyx_n_u_pyx_unpickle_VariantMetadata); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 15, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __pyx_t_3 = PyTuple_New(3); if (unlikely(!__pyx_t_3)) __PYX_ERR(4, 15, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __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_3, 0, ((PyObject *)Py_TYPE(((PyObject *)__pyx_v_self)))) != (0)) __PYX_ERR(4, 15, __pyx_L1_error);
    __Pyx_INCREF(__pyx_mstate_global->__pyx_int_215036767);
    __Pyx_GIVEREF(__pyx_mstate_global->__pyx_int_215036767);
    if (__Pyx_PyTuple_SET_ITEM(__pyx_t_3, 1, __pyx_mstate_global->__pyx_int_215036767) != (0)) __PYX_ERR(4, 15, __pyx_L1_error);
    __Pyx_INCREF(__pyx_v_state);
    __Pyx_GIVEREF(__pyx_v_state);
    if (__Pyx_PyTuple_SET_ITEM(__pyx_t_3, 2, __pyx_v_state) != (0)) __PYX_ERR(4, 15, __pyx_L1_error);
    __pyx_t_2 = PyTuple_New(2); if (unlikely(!__pyx_t_2)) __PYX_ERR(4, 15, __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(4, 15, __pyx_L1_error);
    __Pyx_GIVEREF(__pyx_t_3);
    if (__Pyx_PyTuple_SET_ITEM(__pyx_t_2, 1, __pyx_t_3) != (0)) __PYX_ERR(4, 15, __pyx_L1_error);
    __pyx_t_1 = 0;
    __pyx_t_3 = 0;
    __pyx_r = __pyx_t_2;
    __pyx_t_2 = 0;
    __Pyx_TraceReturnValue(__pyx_r, 37, 0, __PYX_ERR(4, 15, __pyx_L1_error));
    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_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_TraceException(__pyx_lineno, 0, 0);
  #if CYTHON_USE_SYS_MONITORING
  __Pyx_TraceExceptionUnwind(0, 0);
  #else
  __Pyx_TraceReturnValue(NULL, 0, 0, __PYX_ERR(4, 1, __pyx_L1_error));
  #endif
  __Pyx_AddTraceback("pysam.libcbcf.VariantMetadata.__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_PyMonitoring_ExitScope(0);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "(tree fragment)":16
 *     else:
 *         return __pyx_unpickle_VariantMetadata, (type(self), 0xcd1335f, state)
 * def __setstate_cython__(self, __pyx_state):             # <<<<<<<<<<<<<<
 *     __pyx_unpickle_VariantMetadata__set_state(self, __pyx_state)
*/

/* Python wrapper */
static PyObject *__pyx_pw_5pysam_7libcbcf_15VariantMetadata_7__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*/
PyDoc_STRVAR(__pyx_doc_5pysam_7libcbcf_15VariantMetadata_6__setstate_cython__, "VariantMetadata.__setstate_cython__(self, __pyx_state)");
static PyMethodDef __pyx_mdef_5pysam_7libcbcf_15VariantMetadata_7__setstate_cython__ = {"__setstate_cython__", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_5pysam_7libcbcf_15VariantMetadata_7__setstate_cython__, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_5pysam_7libcbcf_15VariantMetadata_6__setstate_cython__};
static PyObject *__pyx_pw_5pysam_7libcbcf_15VariantMetadata_7__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(4, 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(4, 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(4, 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(4, 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(4, 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(4, 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("pysam.libcbcf.VariantMetadata.__setstate_cython__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_5pysam_7libcbcf_15VariantMetadata_6__setstate_cython__(((struct __pyx_obj_5pysam_7libcbcf_VariantMetadata *)__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_5pysam_7libcbcf_15VariantMetadata_6__setstate_cython__(struct __pyx_obj_5pysam_7libcbcf_VariantMetadata *__pyx_v_self, PyObject *__pyx_v___pyx_state) {
  PyObject *__pyx_r = NULL;
  __Pyx_TraceDeclarationsFunc
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_TraceFrameInit(((PyObject *)__pyx_mstate_global->__pyx_codeobj_tab[76]))
  __Pyx_RefNannySetupContext("__setstate_cython__", 0);
  __Pyx_TraceStartFunc("__setstate_cython__", __pyx_f[4], 16, 0, 0, 0, __PYX_ERR(4, 16, __pyx_L1_error));

  /* "(tree fragment)":17
 *         return __pyx_unpickle_VariantMetadata, (type(self), 0xcd1335f, state)
 * def __setstate_cython__(self, __pyx_state):
 *     __pyx_unpickle_VariantMetadata__set_state(self, __pyx_state)             # <<<<<<<<<<<<<<
*/
  if (!(likely(PyTuple_CheckExact(__pyx_v___pyx_state))||((__pyx_v___pyx_state) == Py_None) || __Pyx_RaiseUnexpectedTypeError("tuple", __pyx_v___pyx_state))) __PYX_ERR(4, 17, __pyx_L1_error)
  __pyx_t_1 = __pyx_f_5pysam_7libcbcf___pyx_unpickle_VariantMetadata__set_state(__pyx_v_self, ((PyObject*)__pyx_v___pyx_state)); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 17, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "(tree fragment)":16
 *     else:
 *         return __pyx_unpickle_VariantMetadata, (type(self), 0xcd1335f, state)
 * def __setstate_cython__(self, __pyx_state):             # <<<<<<<<<<<<<<
 *     __pyx_unpickle_VariantMetadata__set_state(self, __pyx_state)
*/

  /* function exit code */
  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  __Pyx_TraceReturnValue(__pyx_r, 0, 0, __PYX_ERR(4, 16, __pyx_L1_error));
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_TraceException(__pyx_lineno, 0, 0);
  #if CYTHON_USE_SYS_MONITORING
  __Pyx_TraceExceptionUnwind(0, 0);
  #else
  __Pyx_TraceReturnValue(NULL, 0, 0, __PYX_ERR(4, 16, __pyx_L1_error));
  #endif
  __Pyx_AddTraceback("pysam.libcbcf.VariantMetadata.__setstate_cython__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_PyMonitoring_ExitScope(0);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "pysam/libcbcf.pyx":1542
 * 
 * 
 * cdef VariantMetadata makeVariantMetadata(VariantHeader header, int type, int id):             # <<<<<<<<<<<<<<
 *     if not header:
 *         raise ValueError('invalid VariantHeader')
*/

static struct __pyx_obj_5pysam_7libcbcf_VariantMetadata *__pyx_f_5pysam_7libcbcf_makeVariantMetadata(struct __pyx_obj_5pysam_7libcbcf_VariantHeader *__pyx_v_header, int __pyx_v_type, int __pyx_v_id) {
  struct __pyx_obj_5pysam_7libcbcf_VariantMetadata *__pyx_v_meta = 0;
  struct __pyx_obj_5pysam_7libcbcf_VariantMetadata *__pyx_r = NULL;
  __Pyx_TraceDeclarationsFunc
  __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_TraceFrameInit(((PyObject *)__pyx_mstate_global->__pyx_codeobj_tab[77]))
  __Pyx_RefNannySetupContext("makeVariantMetadata", 0);
  __Pyx_TraceStartFunc("makeVariantMetadata", __pyx_f[0], 1542, 0, 0, 0, __PYX_ERR(0, 1542, __pyx_L1_error));

  /* "pysam/libcbcf.pyx":1543
 * 
 * cdef VariantMetadata makeVariantMetadata(VariantHeader header, int type, int id):
 *     if not header:             # <<<<<<<<<<<<<<
 *         raise ValueError('invalid VariantHeader')
 * 
*/
  __pyx_t_1 = __Pyx_PyObject_IsTrue(((PyObject *)__pyx_v_header)); if (unlikely((__pyx_t_1 < 0))) __PYX_ERR(0, 1543, __pyx_L1_error)
  __pyx_t_2 = (!__pyx_t_1);
  if (unlikely(__pyx_t_2)) {

    /* "pysam/libcbcf.pyx":1544
 * cdef VariantMetadata makeVariantMetadata(VariantHeader header, int type, int id):
 *     if not header:
 *         raise ValueError('invalid VariantHeader')             # <<<<<<<<<<<<<<
 * 
 *     if type != BCF_HL_FLT and type != BCF_HL_INFO and type != BCF_HL_FMT:
*/
    __pyx_t_4 = NULL;
    __Pyx_INCREF(__pyx_builtin_ValueError);
    __pyx_t_5 = __pyx_builtin_ValueError; 
    __pyx_t_6 = 1;
    {
      PyObject *__pyx_callargs[2] = {__pyx_t_4, __pyx_mstate_global->__pyx_kp_u_invalid_VariantHeader};
      __pyx_t_3 = __Pyx_PyObject_FastCall(__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, 1544, __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, 1544, __pyx_L1_error)

    /* "pysam/libcbcf.pyx":1543
 * 
 * cdef VariantMetadata makeVariantMetadata(VariantHeader header, int type, int id):
 *     if not header:             # <<<<<<<<<<<<<<
 *         raise ValueError('invalid VariantHeader')
 * 
*/
  }

  /* "pysam/libcbcf.pyx":1546
 *         raise ValueError('invalid VariantHeader')
 * 
 *     if type != BCF_HL_FLT and type != BCF_HL_INFO and type != BCF_HL_FMT:             # <<<<<<<<<<<<<<
 *         raise ValueError('invalid metadata type')
 * 
*/
  __pyx_t_1 = (__pyx_v_type != BCF_HL_FLT);
  if (__pyx_t_1) {
  } else {
    __pyx_t_2 = __pyx_t_1;
    goto __pyx_L5_bool_binop_done;
  }
  __pyx_t_1 = (__pyx_v_type != BCF_HL_INFO);
  if (__pyx_t_1) {
  } else {
    __pyx_t_2 = __pyx_t_1;
    goto __pyx_L5_bool_binop_done;
  }
  __pyx_t_1 = (__pyx_v_type != BCF_HL_FMT);
  __pyx_t_2 = __pyx_t_1;
  __pyx_L5_bool_binop_done:;
  if (unlikely(__pyx_t_2)) {

    /* "pysam/libcbcf.pyx":1547
 * 
 *     if type != BCF_HL_FLT and type != BCF_HL_INFO and type != BCF_HL_FMT:
 *         raise ValueError('invalid metadata type')             # <<<<<<<<<<<<<<
 * 
 *     if id < 0 or id >= header.ptr.n[BCF_DT_ID]:
*/
    __pyx_t_5 = NULL;
    __Pyx_INCREF(__pyx_builtin_ValueError);
    __pyx_t_4 = __pyx_builtin_ValueError; 
    __pyx_t_6 = 1;
    {
      PyObject *__pyx_callargs[2] = {__pyx_t_5, __pyx_mstate_global->__pyx_kp_u_invalid_metadata_type};
      __pyx_t_3 = __Pyx_PyObject_FastCall(__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_3)) __PYX_ERR(0, 1547, __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, 1547, __pyx_L1_error)

    /* "pysam/libcbcf.pyx":1546
 *         raise ValueError('invalid VariantHeader')
 * 
 *     if type != BCF_HL_FLT and type != BCF_HL_INFO and type != BCF_HL_FMT:             # <<<<<<<<<<<<<<
 *         raise ValueError('invalid metadata type')
 * 
*/
  }

  /* "pysam/libcbcf.pyx":1549
 *         raise ValueError('invalid metadata type')
 * 
 *     if id < 0 or id >= header.ptr.n[BCF_DT_ID]:             # <<<<<<<<<<<<<<
 *         raise ValueError('invalid metadata id')
 * 
*/
  __pyx_t_1 = (__pyx_v_id < 0);
  if (!__pyx_t_1) {
  } else {
    __pyx_t_2 = __pyx_t_1;
    goto __pyx_L9_bool_binop_done;
  }
  __pyx_t_1 = (__pyx_v_id >= (__pyx_v_header->ptr->n[BCF_DT_ID]));
  __pyx_t_2 = __pyx_t_1;
  __pyx_L9_bool_binop_done:;
  if (unlikely(__pyx_t_2)) {

    /* "pysam/libcbcf.pyx":1550
 * 
 *     if id < 0 or id >= header.ptr.n[BCF_DT_ID]:
 *         raise ValueError('invalid metadata id')             # <<<<<<<<<<<<<<
 * 
 *     cdef VariantMetadata meta = VariantMetadata.__new__(VariantMetadata)
*/
    __pyx_t_4 = NULL;
    __Pyx_INCREF(__pyx_builtin_ValueError);
    __pyx_t_5 = __pyx_builtin_ValueError; 
    __pyx_t_6 = 1;
    {
      PyObject *__pyx_callargs[2] = {__pyx_t_4, __pyx_mstate_global->__pyx_kp_u_invalid_metadata_id};
      __pyx_t_3 = __Pyx_PyObject_FastCall(__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, 1550, __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, 1550, __pyx_L1_error)

    /* "pysam/libcbcf.pyx":1549
 *         raise ValueError('invalid metadata type')
 * 
 *     if id < 0 or id >= header.ptr.n[BCF_DT_ID]:             # <<<<<<<<<<<<<<
 *         raise ValueError('invalid metadata id')
 * 
*/
  }

  /* "pysam/libcbcf.pyx":1552
 *         raise ValueError('invalid metadata id')
 * 
 *     cdef VariantMetadata meta = VariantMetadata.__new__(VariantMetadata)             # <<<<<<<<<<<<<<
 *     meta.header = header
 *     meta.type = type
*/
  __pyx_t_3 = ((PyObject *)__pyx_tp_new_5pysam_7libcbcf_VariantMetadata(((PyTypeObject *)__pyx_mstate_global->__pyx_ptype_5pysam_7libcbcf_VariantMetadata), __pyx_mstate_global->__pyx_empty_tuple, NULL)); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1552, __pyx_L1_error)
  __Pyx_GOTREF((PyObject *)__pyx_t_3);
  __pyx_v_meta = ((struct __pyx_obj_5pysam_7libcbcf_VariantMetadata *)__pyx_t_3);
  __pyx_t_3 = 0;

  /* "pysam/libcbcf.pyx":1553
 * 
 *     cdef VariantMetadata meta = VariantMetadata.__new__(VariantMetadata)
 *     meta.header = header             # <<<<<<<<<<<<<<
 *     meta.type = type
 *     meta.id = id
*/
  __Pyx_INCREF((PyObject *)__pyx_v_header);
  __Pyx_GIVEREF((PyObject *)__pyx_v_header);
  __Pyx_GOTREF((PyObject *)__pyx_v_meta->header);
  __Pyx_DECREF((PyObject *)__pyx_v_meta->header);
  __pyx_v_meta->header = __pyx_v_header;

  /* "pysam/libcbcf.pyx":1554
 *     cdef VariantMetadata meta = VariantMetadata.__new__(VariantMetadata)
 *     meta.header = header
 *     meta.type = type             # <<<<<<<<<<<<<<
 *     meta.id = id
 * 
*/
  __pyx_v_meta->type = __pyx_v_type;

  /* "pysam/libcbcf.pyx":1555
 *     meta.header = header
 *     meta.type = type
 *     meta.id = id             # <<<<<<<<<<<<<<
 * 
 *     return meta
*/
  __pyx_v_meta->id = __pyx_v_id;

  /* "pysam/libcbcf.pyx":1557
 *     meta.id = id
 * 
 *     return meta             # <<<<<<<<<<<<<<
 * 
 * 
*/
  __Pyx_XDECREF((PyObject *)__pyx_r);
  __Pyx_INCREF((PyObject *)__pyx_v_meta);
  __pyx_r = __pyx_v_meta;
  __Pyx_TraceReturnValue((PyObject *)__pyx_r, 54, 0, __PYX_ERR(0, 1557, __pyx_L1_error));
  goto __pyx_L0;

  /* "pysam/libcbcf.pyx":1542
 * 
 * 
 * cdef VariantMetadata makeVariantMetadata(VariantHeader header, int type, int id):             # <<<<<<<<<<<<<<
 *     if not header:
 *         raise ValueError('invalid VariantHeader')
*/

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_XDECREF(__pyx_t_5);
  __Pyx_TraceException(__pyx_lineno, 0, 0);
  #if CYTHON_USE_SYS_MONITORING
  __Pyx_TraceExceptionUnwind(0, 0);
  #else
  __Pyx_TraceReturnValue(NULL, 0, 0, __PYX_ERR(0, 1542, __pyx_L1_error));
  #endif
  __Pyx_AddTraceback("pysam.libcbcf.makeVariantMetadata", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_XDECREF((PyObject *)__pyx_v_meta);
  __Pyx_XGIVEREF((PyObject *)__pyx_r);
  __Pyx_PyMonitoring_ExitScope(0);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "pysam/libcbcf.pyx":1562
 * cdef class VariantHeaderMetadata(object):
 *     """mapping from filter, info or format name to :class:`VariantMetadata` object"""
 *     def __init__(self, *args, **kwargs):             # <<<<<<<<<<<<<<
 *         raise TypeError('this class cannot be instantiated from Python')
 * 
*/

/* Python wrapper */
static int __pyx_pw_5pysam_7libcbcf_21VariantHeaderMetadata_1__init__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static int __pyx_pw_5pysam_7libcbcf_21VariantHeaderMetadata_1__init__(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("__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);
  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("__init__", __pyx_kwds) == -1)) return -1;
  }
  __Pyx_INCREF(__pyx_args);
  __pyx_v_args = __pyx_args;
  __pyx_r = __pyx_pf_5pysam_7libcbcf_21VariantHeaderMetadata___init__(((struct __pyx_obj_5pysam_7libcbcf_VariantHeaderMetadata *)__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_5pysam_7libcbcf_21VariantHeaderMetadata___init__(CYTHON_UNUSED struct __pyx_obj_5pysam_7libcbcf_VariantHeaderMetadata *__pyx_v_self, CYTHON_UNUSED PyObject *__pyx_v_args, CYTHON_UNUSED PyObject *__pyx_v_kwargs) {
  int __pyx_r;
  __Pyx_TraceDeclarationsFunc
  __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_TraceFrameInit(((PyObject *)__pyx_mstate_global->__pyx_codeobj_tab[78]))
  __Pyx_RefNannySetupContext("__init__", 0);
  __Pyx_TraceStartFunc("__init__", __pyx_f[0], 1562, 0, 0, 0, __PYX_ERR(0, 1562, __pyx_L1_error));

  /* "pysam/libcbcf.pyx":1563
 *     """mapping from filter, info or format name to :class:`VariantMetadata` object"""
 *     def __init__(self, *args, **kwargs):
 *         raise TypeError('this class cannot be instantiated from Python')             # <<<<<<<<<<<<<<
 * 
 *     def add(self, id, number, type, description, **kwargs):
*/
  __pyx_t_2 = NULL;
  __Pyx_INCREF(__pyx_builtin_TypeError);
  __pyx_t_3 = __pyx_builtin_TypeError; 
  __pyx_t_4 = 1;
  {
    PyObject *__pyx_callargs[2] = {__pyx_t_2, __pyx_mstate_global->__pyx_kp_u_this_class_cannot_be_instantiate};
    __pyx_t_1 = __Pyx_PyObject_FastCall(__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, 1563, __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, 1563, __pyx_L1_error)

  /* "pysam/libcbcf.pyx":1562
 * cdef class VariantHeaderMetadata(object):
 *     """mapping from filter, info or format name to :class:`VariantMetadata` object"""
 *     def __init__(self, *args, **kwargs):             # <<<<<<<<<<<<<<
 *         raise TypeError('this class cannot be instantiated from Python')
 * 
*/

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_TraceException(__pyx_lineno, 0, 0);
  #if CYTHON_USE_SYS_MONITORING
  __Pyx_TraceExceptionUnwind(0, 0);
  #else
  __Pyx_TraceReturnValue(NULL, 0, 0, __PYX_ERR(0, 1562, __pyx_L1_error));
  #endif
  __Pyx_AddTraceback("pysam.libcbcf.VariantHeaderMetadata.__init__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = -1;
  __Pyx_PyMonitoring_ExitScope(0);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "pysam/libcbcf.pyx":1565
 *         raise TypeError('this class cannot be instantiated from Python')
 * 
 *     def add(self, id, number, type, description, **kwargs):             # <<<<<<<<<<<<<<
 *         """Add a new filter, info or format record"""
 *         if id in self:
*/

/* Python wrapper */
static PyObject *__pyx_pw_5pysam_7libcbcf_21VariantHeaderMetadata_3add(PyObject *__pyx_v_self, 
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
); /*proto*/
PyDoc_STRVAR(__pyx_doc_5pysam_7libcbcf_21VariantHeaderMetadata_2add, "VariantHeaderMetadata.add(self, id, number, type, description, **kwargs)\n\nAdd a new filter, info or format record");
static PyMethodDef __pyx_mdef_5pysam_7libcbcf_21VariantHeaderMetadata_3add = {"add", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_5pysam_7libcbcf_21VariantHeaderMetadata_3add, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_5pysam_7libcbcf_21VariantHeaderMetadata_2add};
static PyObject *__pyx_pw_5pysam_7libcbcf_21VariantHeaderMetadata_3add(PyObject *__pyx_v_self, 
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
) {
  PyObject *__pyx_v_id = 0;
  PyObject *__pyx_v_number = 0;
  PyObject *__pyx_v_type = 0;
  PyObject *__pyx_v_description = 0;
  PyObject *__pyx_v_kwargs = 0;
  #if !CYTHON_METH_FASTCALL
  CYTHON_UNUSED Py_ssize_t __pyx_nargs;
  #endif
  CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
  PyObject* values[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("add (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_kwargs = PyDict_New(); if (unlikely(!__pyx_v_kwargs)) return NULL;
  __Pyx_GOTREF(__pyx_v_kwargs);
  {
    PyObject ** const __pyx_pyargnames[] = {&__pyx_mstate_global->__pyx_n_u_id,&__pyx_mstate_global->__pyx_n_u_number,&__pyx_mstate_global->__pyx_n_u_type,&__pyx_mstate_global->__pyx_n_u_description,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, 1565, __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, 1565, __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, 1565, __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, 1565, __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, 1565, __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, __pyx_v_kwargs, values, kwd_pos_args, __pyx_kwds_len, "add", 1) < 0) __PYX_ERR(0, 1565, __pyx_L3_error)
      for (Py_ssize_t i = __pyx_nargs; i < 4; i++) {
        if (unlikely(!values[i])) { __Pyx_RaiseArgtupleInvalid("add", 1, 4, 4, i); __PYX_ERR(0, 1565, __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, 1565, __pyx_L3_error)
      values[1] = __Pyx_ArgRef_FASTCALL(__pyx_args, 1);
      if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[1])) __PYX_ERR(0, 1565, __pyx_L3_error)
      values[2] = __Pyx_ArgRef_FASTCALL(__pyx_args, 2);
      if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[2])) __PYX_ERR(0, 1565, __pyx_L3_error)
      values[3] = __Pyx_ArgRef_FASTCALL(__pyx_args, 3);
      if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[3])) __PYX_ERR(0, 1565, __pyx_L3_error)
    }
    __pyx_v_id = values[0];
    __pyx_v_number = values[1];
    __pyx_v_type = values[2];
    __pyx_v_description = values[3];
  }
  goto __pyx_L6_skip;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("add", 1, 4, 4, __pyx_nargs); __PYX_ERR(0, 1565, __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_kwargs); __pyx_v_kwargs = 0;
  __Pyx_AddTraceback("pysam.libcbcf.VariantHeaderMetadata.add", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_5pysam_7libcbcf_21VariantHeaderMetadata_2add(((struct __pyx_obj_5pysam_7libcbcf_VariantHeaderMetadata *)__pyx_v_self), __pyx_v_id, __pyx_v_number, __pyx_v_type, __pyx_v_description, __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_kwargs);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_5pysam_7libcbcf_21VariantHeaderMetadata_2add(struct __pyx_obj_5pysam_7libcbcf_VariantHeaderMetadata *__pyx_v_self, PyObject *__pyx_v_id, PyObject *__pyx_v_number, PyObject *__pyx_v_type, PyObject *__pyx_v_description, PyObject *__pyx_v_kwargs) {
  PyObject *__pyx_v_items = NULL;
  PyObject *__pyx_r = NULL;
  __Pyx_TraceDeclarationsFunc
  __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;
  size_t __pyx_t_7;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_TraceFrameInit(((PyObject *)__pyx_mstate_global->__pyx_codeobj_tab[79]))
  __Pyx_RefNannySetupContext("add", 0);
  __Pyx_TraceStartFunc("add", __pyx_f[0], 1565, 0, 0, 0, __PYX_ERR(0, 1565, __pyx_L1_error));
  __Pyx_INCREF(__pyx_v_number);

  /* "pysam/libcbcf.pyx":1567
 *     def add(self, id, number, type, description, **kwargs):
 *         """Add a new filter, info or format record"""
 *         if id in self:             # <<<<<<<<<<<<<<
 *             raise ValueError('Header already exists for id={}'.format(id))
 * 
*/
  __pyx_t_1 = (__Pyx_PySequence_ContainsTF(__pyx_v_id, ((PyObject *)__pyx_v_self), Py_EQ)); if (unlikely((__pyx_t_1 < 0))) __PYX_ERR(0, 1567, __pyx_L1_error)
  if (unlikely(__pyx_t_1)) {

    /* "pysam/libcbcf.pyx":1568
 *         """Add a new filter, info or format record"""
 *         if id in self:
 *             raise ValueError('Header already exists for id={}'.format(id))             # <<<<<<<<<<<<<<
 * 
 *         if self.type == BCF_HL_FLT:
*/
    __pyx_t_3 = NULL;
    __Pyx_INCREF(__pyx_builtin_ValueError);
    __pyx_t_4 = __pyx_builtin_ValueError; 
    __pyx_t_6 = __pyx_mstate_global->__pyx_kp_u_Header_already_exists_for_id;
    __Pyx_INCREF(__pyx_t_6);
    __pyx_t_7 = 0;
    {
      PyObject *__pyx_callargs[2] = {__pyx_t_6, __pyx_v_id};
      __pyx_t_5 = __Pyx_PyObject_FastCallMethod(__pyx_mstate_global->__pyx_n_u_format, __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_5)) __PYX_ERR(0, 1568, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_5);
    }
    __pyx_t_7 = 1;
    {
      PyObject *__pyx_callargs[2] = {__pyx_t_3, __pyx_t_5};
      __pyx_t_2 = __Pyx_PyObject_FastCall(__pyx_t_4, __pyx_callargs+__pyx_t_7, (2-__pyx_t_7) | (__pyx_t_7*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
      __Pyx_XDECREF(__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_2)) __PYX_ERR(0, 1568, __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, 1568, __pyx_L1_error)

    /* "pysam/libcbcf.pyx":1567
 *     def add(self, id, number, type, description, **kwargs):
 *         """Add a new filter, info or format record"""
 *         if id in self:             # <<<<<<<<<<<<<<
 *             raise ValueError('Header already exists for id={}'.format(id))
 * 
*/
  }

  /* "pysam/libcbcf.pyx":1570
 *             raise ValueError('Header already exists for id={}'.format(id))
 * 
 *         if self.type == BCF_HL_FLT:             # <<<<<<<<<<<<<<
 *             if number is not None:
 *                 raise ValueError('Number must be None when adding a filter')
*/
  __pyx_t_1 = (__pyx_v_self->type == BCF_HL_FLT);
  if (__pyx_t_1) {

    /* "pysam/libcbcf.pyx":1571
 * 
 *         if self.type == BCF_HL_FLT:
 *             if number is not None:             # <<<<<<<<<<<<<<
 *                 raise ValueError('Number must be None when adding a filter')
 *             if type is not None:
*/
    __pyx_t_1 = (__pyx_v_number != Py_None);
    if (unlikely(__pyx_t_1)) {

      /* "pysam/libcbcf.pyx":1572
 *         if self.type == BCF_HL_FLT:
 *             if number is not None:
 *                 raise ValueError('Number must be None when adding a filter')             # <<<<<<<<<<<<<<
 *             if type is not None:
 *                 raise ValueError('Type must be None when adding a filter')
*/
      __pyx_t_4 = NULL;
      __Pyx_INCREF(__pyx_builtin_ValueError);
      __pyx_t_5 = __pyx_builtin_ValueError; 
      __pyx_t_7 = 1;
      {
        PyObject *__pyx_callargs[2] = {__pyx_t_4, __pyx_mstate_global->__pyx_kp_u_Number_must_be_None_when_adding};
        __pyx_t_2 = __Pyx_PyObject_FastCall(__pyx_t_5, __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_5); __pyx_t_5 = 0;
        if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1572, __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, 1572, __pyx_L1_error)

      /* "pysam/libcbcf.pyx":1571
 * 
 *         if self.type == BCF_HL_FLT:
 *             if number is not None:             # <<<<<<<<<<<<<<
 *                 raise ValueError('Number must be None when adding a filter')
 *             if type is not None:
*/
    }

    /* "pysam/libcbcf.pyx":1573
 *             if number is not None:
 *                 raise ValueError('Number must be None when adding a filter')
 *             if type is not None:             # <<<<<<<<<<<<<<
 *                 raise ValueError('Type must be None when adding a filter')
 * 
*/
    __pyx_t_1 = (__pyx_v_type != Py_None);
    if (unlikely(__pyx_t_1)) {

      /* "pysam/libcbcf.pyx":1574
 *                 raise ValueError('Number must be None when adding a filter')
 *             if type is not None:
 *                 raise ValueError('Type must be None when adding a filter')             # <<<<<<<<<<<<<<
 * 
 *             items = [('ID', unquoted_str(id)), ('Description', description)]
*/
      __pyx_t_5 = NULL;
      __Pyx_INCREF(__pyx_builtin_ValueError);
      __pyx_t_4 = __pyx_builtin_ValueError; 
      __pyx_t_7 = 1;
      {
        PyObject *__pyx_callargs[2] = {__pyx_t_5, __pyx_mstate_global->__pyx_kp_u_Type_must_be_None_when_adding_a};
        __pyx_t_2 = __Pyx_PyObject_FastCall(__pyx_t_4, __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_4); __pyx_t_4 = 0;
        if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1574, __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, 1574, __pyx_L1_error)

      /* "pysam/libcbcf.pyx":1573
 *             if number is not None:
 *                 raise ValueError('Number must be None when adding a filter')
 *             if type is not None:             # <<<<<<<<<<<<<<
 *                 raise ValueError('Type must be None when adding a filter')
 * 
*/
    }

    /* "pysam/libcbcf.pyx":1576
 *                 raise ValueError('Type must be None when adding a filter')
 * 
 *             items = [('ID', unquoted_str(id)), ('Description', description)]             # <<<<<<<<<<<<<<
 *         else:
 *             if type not in VALUE_TYPES:
*/
    __pyx_t_4 = NULL;
    __Pyx_GetModuleGlobalName(__pyx_t_5, __pyx_mstate_global->__pyx_n_u_unquoted_str); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1576, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_5);
    __pyx_t_7 = 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_7 = 0;
    }
    #endif
    {
      PyObject *__pyx_callargs[2] = {__pyx_t_4, __pyx_v_id};
      __pyx_t_2 = __Pyx_PyObject_FastCall(__pyx_t_5, __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_5); __pyx_t_5 = 0;
      if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1576, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_2);
    }
    __pyx_t_5 = PyTuple_New(2); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1576, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_5);
    __Pyx_INCREF(__pyx_mstate_global->__pyx_n_u_ID);
    __Pyx_GIVEREF(__pyx_mstate_global->__pyx_n_u_ID);
    if (__Pyx_PyTuple_SET_ITEM(__pyx_t_5, 0, __pyx_mstate_global->__pyx_n_u_ID) != (0)) __PYX_ERR(0, 1576, __pyx_L1_error);
    __Pyx_GIVEREF(__pyx_t_2);
    if (__Pyx_PyTuple_SET_ITEM(__pyx_t_5, 1, __pyx_t_2) != (0)) __PYX_ERR(0, 1576, __pyx_L1_error);
    __pyx_t_2 = 0;
    __pyx_t_2 = PyTuple_New(2); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1576, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __Pyx_INCREF(__pyx_mstate_global->__pyx_n_u_Description);
    __Pyx_GIVEREF(__pyx_mstate_global->__pyx_n_u_Description);
    if (__Pyx_PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_mstate_global->__pyx_n_u_Description) != (0)) __PYX_ERR(0, 1576, __pyx_L1_error);
    __Pyx_INCREF(__pyx_v_description);
    __Pyx_GIVEREF(__pyx_v_description);
    if (__Pyx_PyTuple_SET_ITEM(__pyx_t_2, 1, __pyx_v_description) != (0)) __PYX_ERR(0, 1576, __pyx_L1_error);
    __pyx_t_4 = PyList_New(2); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1576, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
    __Pyx_GIVEREF(__pyx_t_5);
    if (__Pyx_PyList_SET_ITEM(__pyx_t_4, 0, __pyx_t_5) != (0)) __PYX_ERR(0, 1576, __pyx_L1_error);
    __Pyx_GIVEREF(__pyx_t_2);
    if (__Pyx_PyList_SET_ITEM(__pyx_t_4, 1, __pyx_t_2) != (0)) __PYX_ERR(0, 1576, __pyx_L1_error);
    __pyx_t_5 = 0;
    __pyx_t_2 = 0;
    __pyx_v_items = __pyx_t_4;
    __pyx_t_4 = 0;

    /* "pysam/libcbcf.pyx":1570
 *             raise ValueError('Header already exists for id={}'.format(id))
 * 
 *         if self.type == BCF_HL_FLT:             # <<<<<<<<<<<<<<
 *             if number is not None:
 *                 raise ValueError('Number must be None when adding a filter')
*/
    goto __pyx_L4;
  }

  /* "pysam/libcbcf.pyx":1578
 *             items = [('ID', unquoted_str(id)), ('Description', description)]
 *         else:
 *             if type not in VALUE_TYPES:             # <<<<<<<<<<<<<<
 *                 raise ValueError('unknown type specified: {}'.format(type))
 *             if number is None:
*/
  /*else*/ {
    __pyx_t_1 = (__Pyx_PySequence_ContainsTF(__pyx_v_type, __pyx_v_5pysam_7libcbcf_VALUE_TYPES, Py_NE)); if (unlikely((__pyx_t_1 < 0))) __PYX_ERR(0, 1578, __pyx_L1_error)
    if (unlikely(__pyx_t_1)) {

      /* "pysam/libcbcf.pyx":1579
 *         else:
 *             if type not in VALUE_TYPES:
 *                 raise ValueError('unknown type specified: {}'.format(type))             # <<<<<<<<<<<<<<
 *             if number is None:
 *                 number = '.'
*/
      __pyx_t_2 = NULL;
      __Pyx_INCREF(__pyx_builtin_ValueError);
      __pyx_t_5 = __pyx_builtin_ValueError; 
      __pyx_t_6 = __pyx_mstate_global->__pyx_kp_u_unknown_type_specified;
      __Pyx_INCREF(__pyx_t_6);
      __pyx_t_7 = 0;
      {
        PyObject *__pyx_callargs[2] = {__pyx_t_6, __pyx_v_type};
        __pyx_t_3 = __Pyx_PyObject_FastCallMethod(__pyx_mstate_global->__pyx_n_u_format, __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_3)) __PYX_ERR(0, 1579, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_3);
      }
      __pyx_t_7 = 1;
      {
        PyObject *__pyx_callargs[2] = {__pyx_t_2, __pyx_t_3};
        __pyx_t_4 = __Pyx_PyObject_FastCall(__pyx_t_5, __pyx_callargs+__pyx_t_7, (2-__pyx_t_7) | (__pyx_t_7*__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_5); __pyx_t_5 = 0;
        if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1579, __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, 1579, __pyx_L1_error)

      /* "pysam/libcbcf.pyx":1578
 *             items = [('ID', unquoted_str(id)), ('Description', description)]
 *         else:
 *             if type not in VALUE_TYPES:             # <<<<<<<<<<<<<<
 *                 raise ValueError('unknown type specified: {}'.format(type))
 *             if number is None:
*/
    }

    /* "pysam/libcbcf.pyx":1580
 *             if type not in VALUE_TYPES:
 *                 raise ValueError('unknown type specified: {}'.format(type))
 *             if number is None:             # <<<<<<<<<<<<<<
 *                 number = '.'
 * 
*/
    __pyx_t_1 = (__pyx_v_number == Py_None);
    if (__pyx_t_1) {

      /* "pysam/libcbcf.pyx":1581
 *                 raise ValueError('unknown type specified: {}'.format(type))
 *             if number is None:
 *                 number = '.'             # <<<<<<<<<<<<<<
 * 
 *             items = [('ID', unquoted_str(id)),
*/
      __Pyx_INCREF(__pyx_mstate_global->__pyx_kp_u__4);
      __Pyx_DECREF_SET(__pyx_v_number, __pyx_mstate_global->__pyx_kp_u__4);

      /* "pysam/libcbcf.pyx":1580
 *             if type not in VALUE_TYPES:
 *                 raise ValueError('unknown type specified: {}'.format(type))
 *             if number is None:             # <<<<<<<<<<<<<<
 *                 number = '.'
 * 
*/
    }

    /* "pysam/libcbcf.pyx":1583
 *                 number = '.'
 * 
 *             items = [('ID', unquoted_str(id)),             # <<<<<<<<<<<<<<
 *                      ('Number', unquoted_str(number)),
 *                      ('Type', unquoted_str(type)),
*/
    __pyx_t_5 = NULL;
    __Pyx_GetModuleGlobalName(__pyx_t_3, __pyx_mstate_global->__pyx_n_u_unquoted_str); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1583, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __pyx_t_7 = 1;
    #if CYTHON_UNPACK_METHODS
    if (unlikely(PyMethod_Check(__pyx_t_3))) {
      __pyx_t_5 = PyMethod_GET_SELF(__pyx_t_3);
      assert(__pyx_t_5);
      PyObject* __pyx__function = PyMethod_GET_FUNCTION(__pyx_t_3);
      __Pyx_INCREF(__pyx_t_5);
      __Pyx_INCREF(__pyx__function);
      __Pyx_DECREF_SET(__pyx_t_3, __pyx__function);
      __pyx_t_7 = 0;
    }
    #endif
    {
      PyObject *__pyx_callargs[2] = {__pyx_t_5, __pyx_v_id};
      __pyx_t_4 = __Pyx_PyObject_FastCall(__pyx_t_3, __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_3); __pyx_t_3 = 0;
      if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1583, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_4);
    }
    __pyx_t_3 = PyTuple_New(2); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1583, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __Pyx_INCREF(__pyx_mstate_global->__pyx_n_u_ID);
    __Pyx_GIVEREF(__pyx_mstate_global->__pyx_n_u_ID);
    if (__Pyx_PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_mstate_global->__pyx_n_u_ID) != (0)) __PYX_ERR(0, 1583, __pyx_L1_error);
    __Pyx_GIVEREF(__pyx_t_4);
    if (__Pyx_PyTuple_SET_ITEM(__pyx_t_3, 1, __pyx_t_4) != (0)) __PYX_ERR(0, 1583, __pyx_L1_error);
    __pyx_t_4 = 0;

    /* "pysam/libcbcf.pyx":1584
 * 
 *             items = [('ID', unquoted_str(id)),
 *                      ('Number', unquoted_str(number)),             # <<<<<<<<<<<<<<
 *                      ('Type', unquoted_str(type)),
 *                      ('Description', description)]
*/
    __pyx_t_5 = NULL;
    __Pyx_GetModuleGlobalName(__pyx_t_2, __pyx_mstate_global->__pyx_n_u_unquoted_str); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1584, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __pyx_t_7 = 1;
    #if CYTHON_UNPACK_METHODS
    if (unlikely(PyMethod_Check(__pyx_t_2))) {
      __pyx_t_5 = PyMethod_GET_SELF(__pyx_t_2);
      assert(__pyx_t_5);
      PyObject* __pyx__function = PyMethod_GET_FUNCTION(__pyx_t_2);
      __Pyx_INCREF(__pyx_t_5);
      __Pyx_INCREF(__pyx__function);
      __Pyx_DECREF_SET(__pyx_t_2, __pyx__function);
      __pyx_t_7 = 0;
    }
    #endif
    {
      PyObject *__pyx_callargs[2] = {__pyx_t_5, __pyx_v_number};
      __pyx_t_4 = __Pyx_PyObject_FastCall(__pyx_t_2, __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_2); __pyx_t_2 = 0;
      if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1584, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_4);
    }
    __pyx_t_2 = PyTuple_New(2); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1584, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __Pyx_INCREF(__pyx_mstate_global->__pyx_n_u_Number);
    __Pyx_GIVEREF(__pyx_mstate_global->__pyx_n_u_Number);
    if (__Pyx_PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_mstate_global->__pyx_n_u_Number) != (0)) __PYX_ERR(0, 1584, __pyx_L1_error);
    __Pyx_GIVEREF(__pyx_t_4);
    if (__Pyx_PyTuple_SET_ITEM(__pyx_t_2, 1, __pyx_t_4) != (0)) __PYX_ERR(0, 1584, __pyx_L1_error);
    __pyx_t_4 = 0;

    /* "pysam/libcbcf.pyx":1585
 *             items = [('ID', unquoted_str(id)),
 *                      ('Number', unquoted_str(number)),
 *                      ('Type', unquoted_str(type)),             # <<<<<<<<<<<<<<
 *                      ('Description', description)]
 * 
*/
    __pyx_t_5 = NULL;
    __Pyx_GetModuleGlobalName(__pyx_t_6, __pyx_mstate_global->__pyx_n_u_unquoted_str); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 1585, __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_v_type};
      __pyx_t_4 = __Pyx_PyObject_FastCall(__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, 1585, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_4);
    }
    __pyx_t_6 = PyTuple_New(2); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 1585, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_6);
    __Pyx_INCREF(__pyx_mstate_global->__pyx_n_u_Type);
    __Pyx_GIVEREF(__pyx_mstate_global->__pyx_n_u_Type);
    if (__Pyx_PyTuple_SET_ITEM(__pyx_t_6, 0, __pyx_mstate_global->__pyx_n_u_Type) != (0)) __PYX_ERR(0, 1585, __pyx_L1_error);
    __Pyx_GIVEREF(__pyx_t_4);
    if (__Pyx_PyTuple_SET_ITEM(__pyx_t_6, 1, __pyx_t_4) != (0)) __PYX_ERR(0, 1585, __pyx_L1_error);
    __pyx_t_4 = 0;

    /* "pysam/libcbcf.pyx":1586
 *                      ('Number', unquoted_str(number)),
 *                      ('Type', unquoted_str(type)),
 *                      ('Description', description)]             # <<<<<<<<<<<<<<
 * 
 *         items += kwargs.items()
*/
    __pyx_t_4 = PyTuple_New(2); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1586, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
    __Pyx_INCREF(__pyx_mstate_global->__pyx_n_u_Description);
    __Pyx_GIVEREF(__pyx_mstate_global->__pyx_n_u_Description);
    if (__Pyx_PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_mstate_global->__pyx_n_u_Description) != (0)) __PYX_ERR(0, 1586, __pyx_L1_error);
    __Pyx_INCREF(__pyx_v_description);
    __Pyx_GIVEREF(__pyx_v_description);
    if (__Pyx_PyTuple_SET_ITEM(__pyx_t_4, 1, __pyx_v_description) != (0)) __PYX_ERR(0, 1586, __pyx_L1_error);

    /* "pysam/libcbcf.pyx":1583
 *                 number = '.'
 * 
 *             items = [('ID', unquoted_str(id)),             # <<<<<<<<<<<<<<
 *                      ('Number', unquoted_str(number)),
 *                      ('Type', unquoted_str(type)),
*/
    __pyx_t_5 = PyList_New(4); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1583, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_5);
    __Pyx_GIVEREF(__pyx_t_3);
    if (__Pyx_PyList_SET_ITEM(__pyx_t_5, 0, __pyx_t_3) != (0)) __PYX_ERR(0, 1583, __pyx_L1_error);
    __Pyx_GIVEREF(__pyx_t_2);
    if (__Pyx_PyList_SET_ITEM(__pyx_t_5, 1, __pyx_t_2) != (0)) __PYX_ERR(0, 1583, __pyx_L1_error);
    __Pyx_GIVEREF(__pyx_t_6);
    if (__Pyx_PyList_SET_ITEM(__pyx_t_5, 2, __pyx_t_6) != (0)) __PYX_ERR(0, 1583, __pyx_L1_error);
    __Pyx_GIVEREF(__pyx_t_4);
    if (__Pyx_PyList_SET_ITEM(__pyx_t_5, 3, __pyx_t_4) != (0)) __PYX_ERR(0, 1583, __pyx_L1_error);
    __pyx_t_3 = 0;
    __pyx_t_2 = 0;
    __pyx_t_6 = 0;
    __pyx_t_4 = 0;
    __pyx_v_items = __pyx_t_5;
    __pyx_t_5 = 0;
  }
  __pyx_L4:;

  /* "pysam/libcbcf.pyx":1588
 *                      ('Description', description)]
 * 
 *         items += kwargs.items()             # <<<<<<<<<<<<<<
 *         self.header.add_meta(METADATA_TYPES[self.type], items=items)
 * 
*/
  __pyx_t_5 = __Pyx_PyDict_Items(__pyx_v_kwargs); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1588, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_5);
  __pyx_t_4 = PyNumber_InPlaceAdd(__pyx_v_items, __pyx_t_5); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1588, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  __Pyx_DECREF_SET(__pyx_v_items, __pyx_t_4);
  __pyx_t_4 = 0;

  /* "pysam/libcbcf.pyx":1589
 * 
 *         items += kwargs.items()
 *         self.header.add_meta(METADATA_TYPES[self.type], items=items)             # <<<<<<<<<<<<<<
 * 
 *     def __len__(self):
*/
  __pyx_t_5 = ((PyObject *)__pyx_v_self->header);
  __Pyx_INCREF(__pyx_t_5);
  if (unlikely(__pyx_v_5pysam_7libcbcf_METADATA_TYPES == Py_None)) {
    PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable");
    __PYX_ERR(0, 1589, __pyx_L1_error)
  }
  __pyx_t_6 = __Pyx_GetItemInt_Tuple(__pyx_v_5pysam_7libcbcf_METADATA_TYPES, __pyx_v_self->type, int32_t, 1, __Pyx_PyLong_From_int32_t, 0, 1, 1, 1); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 1589, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_6);
  __pyx_t_7 = 0;
  {
    PyObject *__pyx_callargs[2 + ((CYTHON_VECTORCALL) ? 1 : 0)] = {__pyx_t_5, __pyx_t_6};
    __pyx_t_2 = __Pyx_MakeVectorcallBuilderKwds(1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1589, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    if (__Pyx_VectorcallBuilder_AddArg(__pyx_mstate_global->__pyx_n_u_items, __pyx_v_items, __pyx_t_2, __pyx_callargs+2, 0) < 0) __PYX_ERR(0, 1589, __pyx_L1_error)
    __pyx_t_4 = __Pyx_Object_VectorcallMethod_CallFromBuilder(__pyx_mstate_global->__pyx_n_u_add_meta, __pyx_callargs+__pyx_t_7, (2-__pyx_t_7) | (1*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET), __pyx_t_2);
    __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
    __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1589, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
  }
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;

  /* "pysam/libcbcf.pyx":1565
 *         raise TypeError('this class cannot be instantiated from Python')
 * 
 *     def add(self, id, number, type, description, **kwargs):             # <<<<<<<<<<<<<<
 *         """Add a new filter, info or format record"""
 *         if id in self:
*/

  /* function exit code */
  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  __Pyx_TraceReturnValue(__pyx_r, 0, 0, __PYX_ERR(0, 1565, __pyx_L1_error));
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_XDECREF(__pyx_t_5);
  __Pyx_XDECREF(__pyx_t_6);
  __Pyx_TraceException(__pyx_lineno, 0, 0);
  #if CYTHON_USE_SYS_MONITORING
  __Pyx_TraceExceptionUnwind(0, 0);
  #else
  __Pyx_TraceReturnValue(NULL, 0, 0, __PYX_ERR(0, 1565, __pyx_L1_error));
  #endif
  __Pyx_AddTraceback("pysam.libcbcf.VariantHeaderMetadata.add", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_items);
  __Pyx_XDECREF(__pyx_v_number);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_PyMonitoring_ExitScope(0);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "pysam/libcbcf.pyx":1591
 *         self.header.add_meta(METADATA_TYPES[self.type], items=items)
 * 
 *     def __len__(self):             # <<<<<<<<<<<<<<
 *         cdef bcf_hdr_t *hdr = self.header.ptr
 *         cdef bcf_idpair_t *idpair
*/

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

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

static Py_ssize_t __pyx_pf_5pysam_7libcbcf_21VariantHeaderMetadata_4__len__(struct __pyx_obj_5pysam_7libcbcf_VariantHeaderMetadata *__pyx_v_self) {
  bcf_hdr_t *__pyx_v_hdr;
  bcf_idpair_t *__pyx_v_idpair;
  int32_t __pyx_v_i;
  int32_t __pyx_v_n;
  Py_ssize_t __pyx_r;
  __Pyx_TraceDeclarationsFunc
  bcf_hdr_t *__pyx_t_1;
  int32_t __pyx_t_2;
  int32_t __pyx_t_3;
  int32_t __pyx_t_4;
  int __pyx_t_5;
  int __pyx_t_6;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_TraceFrameInit(((PyObject *)__pyx_mstate_global->__pyx_codeobj_tab[80]))
  __Pyx_TraceStartFunc("__len__", __pyx_f[0], 1591, 0, 0, 0, __PYX_ERR(0, 1591, __pyx_L1_error));

  /* "pysam/libcbcf.pyx":1592
 * 
 *     def __len__(self):
 *         cdef bcf_hdr_t *hdr = self.header.ptr             # <<<<<<<<<<<<<<
 *         cdef bcf_idpair_t *idpair
 *         cdef int32_t i, n = 0
*/
  __pyx_t_1 = __pyx_v_self->header->ptr;
  __pyx_v_hdr = __pyx_t_1;

  /* "pysam/libcbcf.pyx":1594
 *         cdef bcf_hdr_t *hdr = self.header.ptr
 *         cdef bcf_idpair_t *idpair
 *         cdef int32_t i, n = 0             # <<<<<<<<<<<<<<
 * 
 *         for i in range(hdr.n[BCF_DT_ID]):
*/
  __pyx_v_n = 0;

  /* "pysam/libcbcf.pyx":1596
 *         cdef int32_t i, n = 0
 * 
 *         for i in range(hdr.n[BCF_DT_ID]):             # <<<<<<<<<<<<<<
 *             idpair = hdr.id[BCF_DT_ID] + i
 *             if idpair.key and idpair.val and idpair.val.info[self.type] & 0xF != 0xF:
*/
  __pyx_t_2 = (__pyx_v_hdr->n[BCF_DT_ID]);
  __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;

    /* "pysam/libcbcf.pyx":1597
 * 
 *         for i in range(hdr.n[BCF_DT_ID]):
 *             idpair = hdr.id[BCF_DT_ID] + i             # <<<<<<<<<<<<<<
 *             if idpair.key and idpair.val and idpair.val.info[self.type] & 0xF != 0xF:
 *                 n += 1
*/
    __pyx_v_idpair = ((__pyx_v_hdr->id[BCF_DT_ID]) + __pyx_v_i);

    /* "pysam/libcbcf.pyx":1598
 *         for i in range(hdr.n[BCF_DT_ID]):
 *             idpair = hdr.id[BCF_DT_ID] + i
 *             if idpair.key and idpair.val and idpair.val.info[self.type] & 0xF != 0xF:             # <<<<<<<<<<<<<<
 *                 n += 1
 *         return n
*/
    __pyx_t_6 = (__pyx_v_idpair->key != 0);
    if (__pyx_t_6) {
    } else {
      __pyx_t_5 = __pyx_t_6;
      goto __pyx_L6_bool_binop_done;
    }
    __pyx_t_6 = (__pyx_v_idpair->val != 0);
    if (__pyx_t_6) {
    } else {
      __pyx_t_5 = __pyx_t_6;
      goto __pyx_L6_bool_binop_done;
    }
    __pyx_t_6 = (((__pyx_v_idpair->val->info[__pyx_v_self->type]) & 0xF) != 0xF);
    __pyx_t_5 = __pyx_t_6;
    __pyx_L6_bool_binop_done:;
    if (__pyx_t_5) {

      /* "pysam/libcbcf.pyx":1599
 *             idpair = hdr.id[BCF_DT_ID] + i
 *             if idpair.key and idpair.val and idpair.val.info[self.type] & 0xF != 0xF:
 *                 n += 1             # <<<<<<<<<<<<<<
 *         return n
 * 
*/
      __pyx_v_n = (__pyx_v_n + 1);

      /* "pysam/libcbcf.pyx":1598
 *         for i in range(hdr.n[BCF_DT_ID]):
 *             idpair = hdr.id[BCF_DT_ID] + i
 *             if idpair.key and idpair.val and idpair.val.info[self.type] & 0xF != 0xF:             # <<<<<<<<<<<<<<
 *                 n += 1
 *         return n
*/
    }
  }

  /* "pysam/libcbcf.pyx":1600
 *             if idpair.key and idpair.val and idpair.val.info[self.type] & 0xF != 0xF:
 *                 n += 1
 *         return n             # <<<<<<<<<<<<<<
 * 
 *     def __bool__(self):
*/
  __pyx_r = __pyx_v_n;
  __Pyx_TraceReturnCValue(__pyx_r, PyLong_FromSsize_t, 41, 0, __PYX_ERR(0, 1600, __pyx_L1_error));
  goto __pyx_L0;

  /* "pysam/libcbcf.pyx":1591
 *         self.header.add_meta(METADATA_TYPES[self.type], items=items)
 * 
 *     def __len__(self):             # <<<<<<<<<<<<<<
 *         cdef bcf_hdr_t *hdr = self.header.ptr
 *         cdef bcf_idpair_t *idpair
*/

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_TraceException(__pyx_lineno, 0, 0);
  #if CYTHON_USE_SYS_MONITORING
  __Pyx_TraceExceptionUnwind(0, 0);
  #else
  __Pyx_TraceReturnValue(NULL, 0, 0, __PYX_ERR(0, 1591, __pyx_L1_error));
  #endif
  __Pyx_AddTraceback("pysam.libcbcf.VariantHeaderMetadata.__len__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = -1;
  __pyx_L0:;
  __Pyx_PyMonitoring_ExitScope(0);
  return __pyx_r;
}

/* "pysam/libcbcf.pyx":1602
 *         return n
 * 
 *     def __bool__(self):             # <<<<<<<<<<<<<<
 *         cdef bcf_hdr_t *hdr = self.header.ptr
 *         cdef bcf_idpair_t *idpair
*/

/* Python wrapper */
static int __pyx_pw_5pysam_7libcbcf_21VariantHeaderMetadata_7__bool__(PyObject *__pyx_v_self); /*proto*/
static int __pyx_pw_5pysam_7libcbcf_21VariantHeaderMetadata_7__bool__(PyObject *__pyx_v_self) {
  CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__bool__ (wrapper)", 0);
  __pyx_kwvalues = __Pyx_KwValues_VARARGS(__pyx_args, __pyx_nargs);
  __pyx_r = __pyx_pf_5pysam_7libcbcf_21VariantHeaderMetadata_6__bool__(((struct __pyx_obj_5pysam_7libcbcf_VariantHeaderMetadata *)__pyx_v_self));

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

static int __pyx_pf_5pysam_7libcbcf_21VariantHeaderMetadata_6__bool__(struct __pyx_obj_5pysam_7libcbcf_VariantHeaderMetadata *__pyx_v_self) {
  bcf_hdr_t *__pyx_v_hdr;
  bcf_idpair_t *__pyx_v_idpair;
  int32_t __pyx_v_i;
  int __pyx_r;
  __Pyx_TraceDeclarationsFunc
  bcf_hdr_t *__pyx_t_1;
  int32_t __pyx_t_2;
  int32_t __pyx_t_3;
  int32_t __pyx_t_4;
  int __pyx_t_5;
  int __pyx_t_6;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_TraceFrameInit(((PyObject *)__pyx_mstate_global->__pyx_codeobj_tab[81]))
  __Pyx_TraceStartFunc("__bool__", __pyx_f[0], 1602, 0, 0, 0, __PYX_ERR(0, 1602, __pyx_L1_error));

  /* "pysam/libcbcf.pyx":1603
 * 
 *     def __bool__(self):
 *         cdef bcf_hdr_t *hdr = self.header.ptr             # <<<<<<<<<<<<<<
 *         cdef bcf_idpair_t *idpair
 *         cdef int32_t i
*/
  __pyx_t_1 = __pyx_v_self->header->ptr;
  __pyx_v_hdr = __pyx_t_1;

  /* "pysam/libcbcf.pyx":1607
 *         cdef int32_t i
 * 
 *         for i in range(hdr.n[BCF_DT_ID]):             # <<<<<<<<<<<<<<
 *             idpair = hdr.id[BCF_DT_ID] + i
 *             if idpair.key and idpair.val and idpair.val.info[self.type] & 0xF != 0xF:
*/
  __pyx_t_2 = (__pyx_v_hdr->n[BCF_DT_ID]);
  __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;

    /* "pysam/libcbcf.pyx":1608
 * 
 *         for i in range(hdr.n[BCF_DT_ID]):
 *             idpair = hdr.id[BCF_DT_ID] + i             # <<<<<<<<<<<<<<
 *             if idpair.key and idpair.val and idpair.val.info[self.type] & 0xF != 0xF:
 *                 return True
*/
    __pyx_v_idpair = ((__pyx_v_hdr->id[BCF_DT_ID]) + __pyx_v_i);

    /* "pysam/libcbcf.pyx":1609
 *         for i in range(hdr.n[BCF_DT_ID]):
 *             idpair = hdr.id[BCF_DT_ID] + i
 *             if idpair.key and idpair.val and idpair.val.info[self.type] & 0xF != 0xF:             # <<<<<<<<<<<<<<
 *                 return True
 *         return False
*/
    __pyx_t_6 = (__pyx_v_idpair->key != 0);
    if (__pyx_t_6) {
    } else {
      __pyx_t_5 = __pyx_t_6;
      goto __pyx_L6_bool_binop_done;
    }
    __pyx_t_6 = (__pyx_v_idpair->val != 0);
    if (__pyx_t_6) {
    } else {
      __pyx_t_5 = __pyx_t_6;
      goto __pyx_L6_bool_binop_done;
    }
    __pyx_t_6 = (((__pyx_v_idpair->val->info[__pyx_v_self->type]) & 0xF) != 0xF);
    __pyx_t_5 = __pyx_t_6;
    __pyx_L6_bool_binop_done:;
    if (__pyx_t_5) {

      /* "pysam/libcbcf.pyx":1610
 *             idpair = hdr.id[BCF_DT_ID] + i
 *             if idpair.key and idpair.val and idpair.val.info[self.type] & 0xF != 0xF:
 *                 return True             # <<<<<<<<<<<<<<
 *         return False
 * 
*/
      __pyx_r = 1;
      __Pyx_TraceReturnCValue(__pyx_r, __Pyx_PyLong_From_int, 37, 0, __PYX_ERR(0, 1610, __pyx_L1_error));
      goto __pyx_L0;

      /* "pysam/libcbcf.pyx":1609
 *         for i in range(hdr.n[BCF_DT_ID]):
 *             idpair = hdr.id[BCF_DT_ID] + i
 *             if idpair.key and idpair.val and idpair.val.info[self.type] & 0xF != 0xF:             # <<<<<<<<<<<<<<
 *                 return True
 *         return False
*/
    }
  }

  /* "pysam/libcbcf.pyx":1611
 *             if idpair.key and idpair.val and idpair.val.info[self.type] & 0xF != 0xF:
 *                 return True
 *         return False             # <<<<<<<<<<<<<<
 * 
 *     def __getitem__(self, key):
*/
  __pyx_r = 0;
  __Pyx_TraceReturnCValue(__pyx_r, __Pyx_PyLong_From_int, 39, 0, __PYX_ERR(0, 1611, __pyx_L1_error));
  goto __pyx_L0;

  /* "pysam/libcbcf.pyx":1602
 *         return n
 * 
 *     def __bool__(self):             # <<<<<<<<<<<<<<
 *         cdef bcf_hdr_t *hdr = self.header.ptr
 *         cdef bcf_idpair_t *idpair
*/

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_TraceException(__pyx_lineno, 0, 0);
  #if CYTHON_USE_SYS_MONITORING
  __Pyx_TraceExceptionUnwind(0, 0);
  #else
  __Pyx_TraceReturnValue(NULL, 0, 0, __PYX_ERR(0, 1602, __pyx_L1_error));
  #endif
  __Pyx_AddTraceback("pysam.libcbcf.VariantHeaderMetadata.__bool__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = -1;
  __pyx_L0:;
  __Pyx_PyMonitoring_ExitScope(0);
  return __pyx_r;
}

/* "pysam/libcbcf.pyx":1613
 *         return False
 * 
 *     def __getitem__(self, key):             # <<<<<<<<<<<<<<
 *         cdef bcf_hdr_t *hdr = self.header.ptr
 *         cdef vdict_t *d = <vdict_t *>hdr.dict[BCF_DT_ID]
*/

/* Python wrapper */
static PyObject *__pyx_pw_5pysam_7libcbcf_21VariantHeaderMetadata_9__getitem__(PyObject *__pyx_v_self, PyObject *__pyx_v_key); /*proto*/
static PyObject *__pyx_pw_5pysam_7libcbcf_21VariantHeaderMetadata_9__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_5pysam_7libcbcf_21VariantHeaderMetadata_8__getitem__(((struct __pyx_obj_5pysam_7libcbcf_VariantHeaderMetadata *)__pyx_v_self), ((PyObject *)__pyx_v_key));

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

static PyObject *__pyx_pf_5pysam_7libcbcf_21VariantHeaderMetadata_8__getitem__(struct __pyx_obj_5pysam_7libcbcf_VariantHeaderMetadata *__pyx_v_self, PyObject *__pyx_v_key) {
  bcf_hdr_t *__pyx_v_hdr;
  vdict_t *__pyx_v_d;
  PyObject *__pyx_v_bkey = 0;
  khiter_t __pyx_v_k;
  PyObject *__pyx_r = NULL;
  __Pyx_TraceDeclarationsFunc
  __Pyx_RefNannyDeclarations
  bcf_hdr_t *__pyx_t_1;
  PyObject *__pyx_t_2 = NULL;
  char const *__pyx_t_3;
  int __pyx_t_4;
  int __pyx_t_5;
  PyObject *__pyx_t_6 = NULL;
  PyObject *__pyx_t_7 = NULL;
  PyObject *__pyx_t_8 = NULL;
  PyObject *__pyx_t_9 = NULL;
  size_t __pyx_t_10;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_TraceFrameInit(((PyObject *)__pyx_mstate_global->__pyx_codeobj_tab[82]))
  __Pyx_RefNannySetupContext("__getitem__", 0);
  __Pyx_TraceStartFunc("__getitem__", __pyx_f[0], 1613, 0, 0, 0, __PYX_ERR(0, 1613, __pyx_L1_error));

  /* "pysam/libcbcf.pyx":1614
 * 
 *     def __getitem__(self, key):
 *         cdef bcf_hdr_t *hdr = self.header.ptr             # <<<<<<<<<<<<<<
 *         cdef vdict_t *d = <vdict_t *>hdr.dict[BCF_DT_ID]
 * 
*/
  __pyx_t_1 = __pyx_v_self->header->ptr;
  __pyx_v_hdr = __pyx_t_1;

  /* "pysam/libcbcf.pyx":1615
 *     def __getitem__(self, key):
 *         cdef bcf_hdr_t *hdr = self.header.ptr
 *         cdef vdict_t *d = <vdict_t *>hdr.dict[BCF_DT_ID]             # <<<<<<<<<<<<<<
 * 
 *         cdef bytes bkey = force_bytes(key)
*/
  __pyx_v_d = ((vdict_t *)(__pyx_v_hdr->dict[BCF_DT_ID]));

  /* "pysam/libcbcf.pyx":1617
 *         cdef vdict_t *d = <vdict_t *>hdr.dict[BCF_DT_ID]
 * 
 *         cdef bytes bkey = force_bytes(key)             # <<<<<<<<<<<<<<
 *         cdef khiter_t k = kh_get_vdict(d, bkey)
 * 
*/
  __pyx_t_2 = __pyx_f_5pysam_9libcutils_force_bytes(__pyx_v_key, NULL); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1617, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_v_bkey = ((PyObject*)__pyx_t_2);
  __pyx_t_2 = 0;

  /* "pysam/libcbcf.pyx":1618
 * 
 *         cdef bytes bkey = force_bytes(key)
 *         cdef khiter_t k = kh_get_vdict(d, bkey)             # <<<<<<<<<<<<<<
 * 
 *         if k == kh_end(d) or kh_val_vdict(d, k).info[self.type] & 0xF == 0xF:
*/
  if (unlikely(__pyx_v_bkey == Py_None)) {
    PyErr_SetString(PyExc_TypeError, "expected bytes, NoneType found");
    __PYX_ERR(0, 1618, __pyx_L1_error)
  }
  __pyx_t_3 = __Pyx_PyBytes_AsString(__pyx_v_bkey); if (unlikely((!__pyx_t_3) && PyErr_Occurred())) __PYX_ERR(0, 1618, __pyx_L1_error)
  __pyx_v_k = kh_get_vdict(__pyx_v_d, __pyx_t_3);

  /* "pysam/libcbcf.pyx":1620
 *         cdef khiter_t k = kh_get_vdict(d, bkey)
 * 
 *         if k == kh_end(d) or kh_val_vdict(d, k).info[self.type] & 0xF == 0xF:             # <<<<<<<<<<<<<<
 *             raise KeyError('invalid key: {}'.format(key))
 * 
*/
  __pyx_t_5 = (__pyx_v_k == kh_end(__pyx_v_d));
  if (!__pyx_t_5) {
  } else {
    __pyx_t_4 = __pyx_t_5;
    goto __pyx_L4_bool_binop_done;
  }
  __pyx_t_5 = (((kh_val(__pyx_v_d, __pyx_v_k).info[__pyx_v_self->type]) & 0xF) == 0xF);
  __pyx_t_4 = __pyx_t_5;
  __pyx_L4_bool_binop_done:;
  if (unlikely(__pyx_t_4)) {

    /* "pysam/libcbcf.pyx":1621
 * 
 *         if k == kh_end(d) or kh_val_vdict(d, k).info[self.type] & 0xF == 0xF:
 *             raise KeyError('invalid key: {}'.format(key))             # <<<<<<<<<<<<<<
 * 
 *         return makeVariantMetadata(self.header, self.type, kh_val_vdict(d, k).id)
*/
    __pyx_t_6 = NULL;
    __Pyx_INCREF(__pyx_builtin_KeyError);
    __pyx_t_7 = __pyx_builtin_KeyError; 
    __pyx_t_9 = __pyx_mstate_global->__pyx_kp_u_invalid_key;
    __Pyx_INCREF(__pyx_t_9);
    __pyx_t_10 = 0;
    {
      PyObject *__pyx_callargs[2] = {__pyx_t_9, __pyx_v_key};
      __pyx_t_8 = __Pyx_PyObject_FastCallMethod(__pyx_mstate_global->__pyx_n_u_format, __pyx_callargs+__pyx_t_10, (2-__pyx_t_10) | (1*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
      __Pyx_XDECREF(__pyx_t_9); __pyx_t_9 = 0;
      if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 1621, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_8);
    }
    __pyx_t_10 = 1;
    {
      PyObject *__pyx_callargs[2] = {__pyx_t_6, __pyx_t_8};
      __pyx_t_2 = __Pyx_PyObject_FastCall(__pyx_t_7, __pyx_callargs+__pyx_t_10, (2-__pyx_t_10) | (__pyx_t_10*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
      __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0;
      __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
      __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
      if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1621, __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, 1621, __pyx_L1_error)

    /* "pysam/libcbcf.pyx":1620
 *         cdef khiter_t k = kh_get_vdict(d, bkey)
 * 
 *         if k == kh_end(d) or kh_val_vdict(d, k).info[self.type] & 0xF == 0xF:             # <<<<<<<<<<<<<<
 *             raise KeyError('invalid key: {}'.format(key))
 * 
*/
  }

  /* "pysam/libcbcf.pyx":1623
 *             raise KeyError('invalid key: {}'.format(key))
 * 
 *         return makeVariantMetadata(self.header, self.type, kh_val_vdict(d, k).id)             # <<<<<<<<<<<<<<
 * 
 *     def remove_header(self, key):
*/
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_2 = ((PyObject *)__pyx_v_self->header);
  __Pyx_INCREF(__pyx_t_2);
  __pyx_t_7 = ((PyObject *)__pyx_f_5pysam_7libcbcf_makeVariantMetadata(((struct __pyx_obj_5pysam_7libcbcf_VariantHeader *)__pyx_t_2), __pyx_v_self->type, kh_val(__pyx_v_d, __pyx_v_k).id)); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 1623, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_7);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __pyx_r = __pyx_t_7;
  __pyx_t_7 = 0;
  __Pyx_TraceReturnValue(__pyx_r, 46, 0, __PYX_ERR(0, 1623, __pyx_L1_error));
  goto __pyx_L0;

  /* "pysam/libcbcf.pyx":1613
 *         return False
 * 
 *     def __getitem__(self, key):             # <<<<<<<<<<<<<<
 *         cdef bcf_hdr_t *hdr = self.header.ptr
 *         cdef vdict_t *d = <vdict_t *>hdr.dict[BCF_DT_ID]
*/

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_6);
  __Pyx_XDECREF(__pyx_t_7);
  __Pyx_XDECREF(__pyx_t_8);
  __Pyx_XDECREF(__pyx_t_9);
  __Pyx_TraceException(__pyx_lineno, 0, 0);
  #if CYTHON_USE_SYS_MONITORING
  __Pyx_TraceExceptionUnwind(0, 0);
  #else
  __Pyx_TraceReturnValue(NULL, 0, 0, __PYX_ERR(0, 1613, __pyx_L1_error));
  #endif
  __Pyx_AddTraceback("pysam.libcbcf.VariantHeaderMetadata.__getitem__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_bkey);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_PyMonitoring_ExitScope(0);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "pysam/libcbcf.pyx":1625
 *         return makeVariantMetadata(self.header, self.type, kh_val_vdict(d, k).id)
 * 
 *     def remove_header(self, key):             # <<<<<<<<<<<<<<
 *         cdef bcf_hdr_t *hdr = self.header.ptr
 *         cdef vdict_t *d = <vdict_t *>hdr.dict[BCF_DT_ID]
*/

/* Python wrapper */
static PyObject *__pyx_pw_5pysam_7libcbcf_21VariantHeaderMetadata_11remove_header(PyObject *__pyx_v_self, 
#if 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_5pysam_7libcbcf_21VariantHeaderMetadata_10remove_header, "VariantHeaderMetadata.remove_header(self, key)");
static PyMethodDef __pyx_mdef_5pysam_7libcbcf_21VariantHeaderMetadata_11remove_header = {"remove_header", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_5pysam_7libcbcf_21VariantHeaderMetadata_11remove_header, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_5pysam_7libcbcf_21VariantHeaderMetadata_10remove_header};
static PyObject *__pyx_pw_5pysam_7libcbcf_21VariantHeaderMetadata_11remove_header(PyObject *__pyx_v_self, 
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
) {
  PyObject *__pyx_v_key = 0;
  #if !CYTHON_METH_FASTCALL
  CYTHON_UNUSED Py_ssize_t __pyx_nargs;
  #endif
  CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
  PyObject* values[1] = {0};
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("remove_header (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,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, 1625, __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, 1625, __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, "remove_header", 0) < 0) __PYX_ERR(0, 1625, __pyx_L3_error)
      for (Py_ssize_t i = __pyx_nargs; i < 1; i++) {
        if (unlikely(!values[i])) { __Pyx_RaiseArgtupleInvalid("remove_header", 1, 1, 1, i); __PYX_ERR(0, 1625, __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, 1625, __pyx_L3_error)
    }
    __pyx_v_key = values[0];
  }
  goto __pyx_L6_skip;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("remove_header", 1, 1, 1, __pyx_nargs); __PYX_ERR(0, 1625, __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("pysam.libcbcf.VariantHeaderMetadata.remove_header", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_5pysam_7libcbcf_21VariantHeaderMetadata_10remove_header(((struct __pyx_obj_5pysam_7libcbcf_VariantHeaderMetadata *)__pyx_v_self), __pyx_v_key);

  /* 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_5pysam_7libcbcf_21VariantHeaderMetadata_10remove_header(struct __pyx_obj_5pysam_7libcbcf_VariantHeaderMetadata *__pyx_v_self, PyObject *__pyx_v_key) {
  bcf_hdr_t *__pyx_v_hdr;
  vdict_t *__pyx_v_d;
  PyObject *__pyx_v_bkey = 0;
  khiter_t __pyx_v_k;
  PyObject *__pyx_r = NULL;
  __Pyx_TraceDeclarationsFunc
  __Pyx_RefNannyDeclarations
  bcf_hdr_t *__pyx_t_1;
  PyObject *__pyx_t_2 = NULL;
  char const *__pyx_t_3;
  int __pyx_t_4;
  int __pyx_t_5;
  PyObject *__pyx_t_6 = NULL;
  PyObject *__pyx_t_7 = NULL;
  PyObject *__pyx_t_8 = NULL;
  PyObject *__pyx_t_9 = NULL;
  size_t __pyx_t_10;
  char const *__pyx_t_11;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_TraceFrameInit(((PyObject *)__pyx_mstate_global->__pyx_codeobj_tab[83]))
  __Pyx_RefNannySetupContext("remove_header", 0);
  __Pyx_TraceStartFunc("remove_header", __pyx_f[0], 1625, 0, 0, 0, __PYX_ERR(0, 1625, __pyx_L1_error));

  /* "pysam/libcbcf.pyx":1626
 * 
 *     def remove_header(self, key):
 *         cdef bcf_hdr_t *hdr = self.header.ptr             # <<<<<<<<<<<<<<
 *         cdef vdict_t *d = <vdict_t *>hdr.dict[BCF_DT_ID]
 * 
*/
  __pyx_t_1 = __pyx_v_self->header->ptr;
  __pyx_v_hdr = __pyx_t_1;

  /* "pysam/libcbcf.pyx":1627
 *     def remove_header(self, key):
 *         cdef bcf_hdr_t *hdr = self.header.ptr
 *         cdef vdict_t *d = <vdict_t *>hdr.dict[BCF_DT_ID]             # <<<<<<<<<<<<<<
 * 
 *         cdef bytes bkey = force_bytes(key)
*/
  __pyx_v_d = ((vdict_t *)(__pyx_v_hdr->dict[BCF_DT_ID]));

  /* "pysam/libcbcf.pyx":1629
 *         cdef vdict_t *d = <vdict_t *>hdr.dict[BCF_DT_ID]
 * 
 *         cdef bytes bkey = force_bytes(key)             # <<<<<<<<<<<<<<
 *         cdef khiter_t k = kh_get_vdict(d, bkey)
 * 
*/
  __pyx_t_2 = __pyx_f_5pysam_9libcutils_force_bytes(__pyx_v_key, NULL); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1629, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_v_bkey = ((PyObject*)__pyx_t_2);
  __pyx_t_2 = 0;

  /* "pysam/libcbcf.pyx":1630
 * 
 *         cdef bytes bkey = force_bytes(key)
 *         cdef khiter_t k = kh_get_vdict(d, bkey)             # <<<<<<<<<<<<<<
 * 
 *         if k == kh_end(d) or kh_val_vdict(d, k).info[self.type] & 0xF == 0xF:
*/
  if (unlikely(__pyx_v_bkey == Py_None)) {
    PyErr_SetString(PyExc_TypeError, "expected bytes, NoneType found");
    __PYX_ERR(0, 1630, __pyx_L1_error)
  }
  __pyx_t_3 = __Pyx_PyBytes_AsString(__pyx_v_bkey); if (unlikely((!__pyx_t_3) && PyErr_Occurred())) __PYX_ERR(0, 1630, __pyx_L1_error)
  __pyx_v_k = kh_get_vdict(__pyx_v_d, __pyx_t_3);

  /* "pysam/libcbcf.pyx":1632
 *         cdef khiter_t k = kh_get_vdict(d, bkey)
 * 
 *         if k == kh_end(d) or kh_val_vdict(d, k).info[self.type] & 0xF == 0xF:             # <<<<<<<<<<<<<<
 *             raise KeyError('invalid key: {}'.format(key))
 * 
*/
  __pyx_t_5 = (__pyx_v_k == kh_end(__pyx_v_d));
  if (!__pyx_t_5) {
  } else {
    __pyx_t_4 = __pyx_t_5;
    goto __pyx_L4_bool_binop_done;
  }
  __pyx_t_5 = (((kh_val(__pyx_v_d, __pyx_v_k).info[__pyx_v_self->type]) & 0xF) == 0xF);
  __pyx_t_4 = __pyx_t_5;
  __pyx_L4_bool_binop_done:;
  if (unlikely(__pyx_t_4)) {

    /* "pysam/libcbcf.pyx":1633
 * 
 *         if k == kh_end(d) or kh_val_vdict(d, k).info[self.type] & 0xF == 0xF:
 *             raise KeyError('invalid key: {}'.format(key))             # <<<<<<<<<<<<<<
 * 
 *         bcf_hdr_remove(hdr, self.type, bkey)
*/
    __pyx_t_6 = NULL;
    __Pyx_INCREF(__pyx_builtin_KeyError);
    __pyx_t_7 = __pyx_builtin_KeyError; 
    __pyx_t_9 = __pyx_mstate_global->__pyx_kp_u_invalid_key;
    __Pyx_INCREF(__pyx_t_9);
    __pyx_t_10 = 0;
    {
      PyObject *__pyx_callargs[2] = {__pyx_t_9, __pyx_v_key};
      __pyx_t_8 = __Pyx_PyObject_FastCallMethod(__pyx_mstate_global->__pyx_n_u_format, __pyx_callargs+__pyx_t_10, (2-__pyx_t_10) | (1*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
      __Pyx_XDECREF(__pyx_t_9); __pyx_t_9 = 0;
      if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 1633, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_8);
    }
    __pyx_t_10 = 1;
    {
      PyObject *__pyx_callargs[2] = {__pyx_t_6, __pyx_t_8};
      __pyx_t_2 = __Pyx_PyObject_FastCall(__pyx_t_7, __pyx_callargs+__pyx_t_10, (2-__pyx_t_10) | (__pyx_t_10*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
      __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0;
      __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
      __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
      if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1633, __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, 1633, __pyx_L1_error)

    /* "pysam/libcbcf.pyx":1632
 *         cdef khiter_t k = kh_get_vdict(d, bkey)
 * 
 *         if k == kh_end(d) or kh_val_vdict(d, k).info[self.type] & 0xF == 0xF:             # <<<<<<<<<<<<<<
 *             raise KeyError('invalid key: {}'.format(key))
 * 
*/
  }

  /* "pysam/libcbcf.pyx":1635
 *             raise KeyError('invalid key: {}'.format(key))
 * 
 *         bcf_hdr_remove(hdr, self.type, bkey)             # <<<<<<<<<<<<<<
 *         #bcf_hdr_sync(hdr)
 * 
*/
  if (unlikely(__pyx_v_bkey == Py_None)) {
    PyErr_SetString(PyExc_TypeError, "expected bytes, NoneType found");
    __PYX_ERR(0, 1635, __pyx_L1_error)
  }
  __pyx_t_11 = __Pyx_PyBytes_AsString(__pyx_v_bkey); if (unlikely((!__pyx_t_11) && PyErr_Occurred())) __PYX_ERR(0, 1635, __pyx_L1_error)
  bcf_hdr_remove(__pyx_v_hdr, __pyx_v_self->type, __pyx_t_11);

  /* "pysam/libcbcf.pyx":1625
 *         return makeVariantMetadata(self.header, self.type, kh_val_vdict(d, k).id)
 * 
 *     def remove_header(self, key):             # <<<<<<<<<<<<<<
 *         cdef bcf_hdr_t *hdr = self.header.ptr
 *         cdef vdict_t *d = <vdict_t *>hdr.dict[BCF_DT_ID]
*/

  /* function exit code */
  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  __Pyx_TraceReturnValue(__pyx_r, 0, 0, __PYX_ERR(0, 1625, __pyx_L1_error));
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_6);
  __Pyx_XDECREF(__pyx_t_7);
  __Pyx_XDECREF(__pyx_t_8);
  __Pyx_XDECREF(__pyx_t_9);
  __Pyx_TraceException(__pyx_lineno, 0, 0);
  #if CYTHON_USE_SYS_MONITORING
  __Pyx_TraceExceptionUnwind(0, 0);
  #else
  __Pyx_TraceReturnValue(NULL, 0, 0, __PYX_ERR(0, 1625, __pyx_L1_error));
  #endif
  __Pyx_AddTraceback("pysam.libcbcf.VariantHeaderMetadata.remove_header", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_bkey);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_PyMonitoring_ExitScope(0);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "pysam/libcbcf.pyx":1638
 *         #bcf_hdr_sync(hdr)
 * 
 *     def clear_header(self):             # <<<<<<<<<<<<<<
 *         cdef bcf_hdr_t *hdr = self.header.ptr
 *         bcf_hdr_remove(hdr, self.type, NULL)
*/

/* Python wrapper */
static PyObject *__pyx_pw_5pysam_7libcbcf_21VariantHeaderMetadata_13clear_header(PyObject *__pyx_v_self, 
#if 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_5pysam_7libcbcf_21VariantHeaderMetadata_12clear_header, "VariantHeaderMetadata.clear_header(self)");
static PyMethodDef __pyx_mdef_5pysam_7libcbcf_21VariantHeaderMetadata_13clear_header = {"clear_header", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_5pysam_7libcbcf_21VariantHeaderMetadata_13clear_header, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_5pysam_7libcbcf_21VariantHeaderMetadata_12clear_header};
static PyObject *__pyx_pw_5pysam_7libcbcf_21VariantHeaderMetadata_13clear_header(PyObject *__pyx_v_self, 
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
) {
  #if !CYTHON_METH_FASTCALL
  CYTHON_UNUSED Py_ssize_t __pyx_nargs;
  #endif
  CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("clear_header (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("clear_header", 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("clear_header", __pyx_kwds); return NULL;}
  __pyx_r = __pyx_pf_5pysam_7libcbcf_21VariantHeaderMetadata_12clear_header(((struct __pyx_obj_5pysam_7libcbcf_VariantHeaderMetadata *)__pyx_v_self));

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

static PyObject *__pyx_pf_5pysam_7libcbcf_21VariantHeaderMetadata_12clear_header(struct __pyx_obj_5pysam_7libcbcf_VariantHeaderMetadata *__pyx_v_self) {
  bcf_hdr_t *__pyx_v_hdr;
  PyObject *__pyx_r = NULL;
  __Pyx_TraceDeclarationsFunc
  __Pyx_RefNannyDeclarations
  bcf_hdr_t *__pyx_t_1;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_TraceFrameInit(((PyObject *)__pyx_mstate_global->__pyx_codeobj_tab[84]))
  __Pyx_RefNannySetupContext("clear_header", 0);
  __Pyx_TraceStartFunc("clear_header", __pyx_f[0], 1638, 0, 0, 0, __PYX_ERR(0, 1638, __pyx_L1_error));

  /* "pysam/libcbcf.pyx":1639
 * 
 *     def clear_header(self):
 *         cdef bcf_hdr_t *hdr = self.header.ptr             # <<<<<<<<<<<<<<
 *         bcf_hdr_remove(hdr, self.type, NULL)
 *         #bcf_hdr_sync(hdr)
*/
  __pyx_t_1 = __pyx_v_self->header->ptr;
  __pyx_v_hdr = __pyx_t_1;

  /* "pysam/libcbcf.pyx":1640
 *     def clear_header(self):
 *         cdef bcf_hdr_t *hdr = self.header.ptr
 *         bcf_hdr_remove(hdr, self.type, NULL)             # <<<<<<<<<<<<<<
 *         #bcf_hdr_sync(hdr)
 * 
*/
  bcf_hdr_remove(__pyx_v_hdr, __pyx_v_self->type, NULL);

  /* "pysam/libcbcf.pyx":1638
 *         #bcf_hdr_sync(hdr)
 * 
 *     def clear_header(self):             # <<<<<<<<<<<<<<
 *         cdef bcf_hdr_t *hdr = self.header.ptr
 *         bcf_hdr_remove(hdr, self.type, NULL)
*/

  /* function exit code */
  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  __Pyx_TraceReturnValue(__pyx_r, 0, 0, __PYX_ERR(0, 1638, __pyx_L1_error));
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_TraceException(__pyx_lineno, 0, 0);
  #if CYTHON_USE_SYS_MONITORING
  __Pyx_TraceExceptionUnwind(0, 0);
  #else
  __Pyx_TraceReturnValue(NULL, 0, 0, __PYX_ERR(0, 1638, __pyx_L1_error));
  #endif
  __Pyx_AddTraceback("pysam.libcbcf.VariantHeaderMetadata.clear_header", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_PyMonitoring_ExitScope(0);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}
static PyObject *__pyx_gb_5pysam_7libcbcf_21VariantHeaderMetadata_16generator4(__pyx_CoroutineObject *__pyx_generator, CYTHON_UNUSED PyThreadState *__pyx_tstate, PyObject *__pyx_sent_value); /* proto */

/* "pysam/libcbcf.pyx":1643
 *         #bcf_hdr_sync(hdr)
 * 
 *     def __iter__(self):             # <<<<<<<<<<<<<<
 *         cdef bcf_hdr_t *hdr = self.header.ptr
 *         cdef bcf_idpair_t *idpair
*/

/* Python wrapper */
static PyObject *__pyx_pw_5pysam_7libcbcf_21VariantHeaderMetadata_15__iter__(PyObject *__pyx_v_self); /*proto*/
static PyObject *__pyx_pw_5pysam_7libcbcf_21VariantHeaderMetadata_15__iter__(PyObject *__pyx_v_self) {
  CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__iter__ (wrapper)", 0);
  __pyx_kwvalues = __Pyx_KwValues_VARARGS(__pyx_args, __pyx_nargs);
  __pyx_r = __pyx_pf_5pysam_7libcbcf_21VariantHeaderMetadata_14__iter__(((struct __pyx_obj_5pysam_7libcbcf_VariantHeaderMetadata *)__pyx_v_self));

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

static PyObject *__pyx_pf_5pysam_7libcbcf_21VariantHeaderMetadata_14__iter__(struct __pyx_obj_5pysam_7libcbcf_VariantHeaderMetadata *__pyx_v_self) {
  struct __pyx_obj_5pysam_7libcbcf___pyx_scope_struct_11___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("__iter__", 0);
  __pyx_cur_scope = (struct __pyx_obj_5pysam_7libcbcf___pyx_scope_struct_11___iter__ *)__pyx_tp_new_5pysam_7libcbcf___pyx_scope_struct_11___iter__(__pyx_mstate_global->__pyx_ptype_5pysam_7libcbcf___pyx_scope_struct_11___iter__, __pyx_mstate_global->__pyx_empty_tuple, NULL);
  if (unlikely(!__pyx_cur_scope)) {
    __pyx_cur_scope = ((struct __pyx_obj_5pysam_7libcbcf___pyx_scope_struct_11___iter__ *)Py_None);
    __Pyx_INCREF(Py_None);
    __PYX_ERR(0, 1643, __pyx_L1_error)
  } else {
    __Pyx_GOTREF((PyObject *)__pyx_cur_scope);
  }
  __pyx_cur_scope->__pyx_v_self = __pyx_v_self;
  __Pyx_INCREF((PyObject *)__pyx_cur_scope->__pyx_v_self);
  __Pyx_GIVEREF((PyObject *)__pyx_cur_scope->__pyx_v_self);
  {
    __pyx_CoroutineObject *gen = __Pyx_Generator_New((__pyx_coroutine_body_t) __pyx_gb_5pysam_7libcbcf_21VariantHeaderMetadata_16generator4, ((PyObject *)__pyx_mstate_global->__pyx_codeobj_tab[85]), (PyObject *) __pyx_cur_scope, __pyx_mstate_global->__pyx_n_u_iter, __pyx_mstate_global->__pyx_n_u_VariantHeaderMetadata___iter, __pyx_mstate_global->__pyx_n_u_pysam_libcbcf); if (unlikely(!gen)) __PYX_ERR(0, 1643, __pyx_L1_error)
    __Pyx_DECREF(__pyx_cur_scope);
    __Pyx_RefNannyFinishContext();
    return (PyObject *) gen;
  }

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_AddTraceback("pysam.libcbcf.VariantHeaderMetadata.__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_5pysam_7libcbcf_21VariantHeaderMetadata_16generator4(__pyx_CoroutineObject *__pyx_generator, CYTHON_UNUSED PyThreadState *__pyx_tstate, PyObject *__pyx_sent_value) /* generator body */
{
  struct __pyx_obj_5pysam_7libcbcf___pyx_scope_struct_11___iter__ *__pyx_cur_scope = ((struct __pyx_obj_5pysam_7libcbcf___pyx_scope_struct_11___iter__ *)__pyx_generator->closure);
  PyObject *__pyx_r = NULL;
  __Pyx_TraceDeclarationsGen
  bcf_hdr_t *__pyx_t_1;
  int32_t __pyx_t_2;
  int32_t __pyx_t_3;
  int32_t __pyx_t_4;
  int __pyx_t_5;
  int __pyx_t_6;
  PyObject *__pyx_t_7 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__iter__", 0);
  switch (__pyx_generator->resume_label) {
    case 0: goto __pyx_L3_first_run;
    case 1: goto __pyx_L10_resume_from_yield;
    default: /* CPython raises the right error here */
    __Pyx_TraceStartGen("__iter__", __pyx_f[0], 1643, 0, 0, 0, __PYX_ERR(0, 1643, __pyx_L1_error));
    __Pyx_TraceReturnValue(Py_None, 0, 0, __PYX_ERR(0, 1643, __pyx_L1_error));
    __Pyx_RefNannyFinishContext();
    return NULL;
  }
  __pyx_L3_first_run:;
  __Pyx_TraceStartGen("__iter__", __pyx_f[0], 1643, 0, 0, 0, __PYX_ERR(0, 1643, __pyx_L1_error));
  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, 1643, __pyx_L1_error)
  }

  /* "pysam/libcbcf.pyx":1644
 * 
 *     def __iter__(self):
 *         cdef bcf_hdr_t *hdr = self.header.ptr             # <<<<<<<<<<<<<<
 *         cdef bcf_idpair_t *idpair
 *         cdef int32_t i
*/
  __pyx_t_1 = __pyx_cur_scope->__pyx_v_self->header->ptr;
  __pyx_cur_scope->__pyx_v_hdr = __pyx_t_1;

  /* "pysam/libcbcf.pyx":1648
 *         cdef int32_t i
 * 
 *         for i in range(hdr.n[BCF_DT_ID]):             # <<<<<<<<<<<<<<
 *             idpair = hdr.id[BCF_DT_ID] + i
 *             if idpair.key and idpair.val and idpair.val.info[self.type] & 0xF != 0xF:
*/
  __pyx_t_2 = (__pyx_cur_scope->__pyx_v_hdr->n[BCF_DT_ID]);
  __pyx_t_3 = __pyx_t_2;
  for (__pyx_t_4 = 0; __pyx_t_4 < __pyx_t_3; __pyx_t_4+=1) {
    __pyx_cur_scope->__pyx_v_i = __pyx_t_4;

    /* "pysam/libcbcf.pyx":1649
 * 
 *         for i in range(hdr.n[BCF_DT_ID]):
 *             idpair = hdr.id[BCF_DT_ID] + i             # <<<<<<<<<<<<<<
 *             if idpair.key and idpair.val and idpair.val.info[self.type] & 0xF != 0xF:
 *                 yield bcf_str_cache_get_charptr(idpair.key)
*/
    __pyx_cur_scope->__pyx_v_idpair = ((__pyx_cur_scope->__pyx_v_hdr->id[BCF_DT_ID]) + __pyx_cur_scope->__pyx_v_i);

    /* "pysam/libcbcf.pyx":1650
 *         for i in range(hdr.n[BCF_DT_ID]):
 *             idpair = hdr.id[BCF_DT_ID] + i
 *             if idpair.key and idpair.val and idpair.val.info[self.type] & 0xF != 0xF:             # <<<<<<<<<<<<<<
 *                 yield bcf_str_cache_get_charptr(idpair.key)
 * 
*/
    __pyx_t_6 = (__pyx_cur_scope->__pyx_v_idpair->key != 0);
    if (__pyx_t_6) {
    } else {
      __pyx_t_5 = __pyx_t_6;
      goto __pyx_L7_bool_binop_done;
    }
    __pyx_t_6 = (__pyx_cur_scope->__pyx_v_idpair->val != 0);
    if (__pyx_t_6) {
    } else {
      __pyx_t_5 = __pyx_t_6;
      goto __pyx_L7_bool_binop_done;
    }
    __pyx_t_6 = (((__pyx_cur_scope->__pyx_v_idpair->val->info[__pyx_cur_scope->__pyx_v_self->type]) & 0xF) != 0xF);
    __pyx_t_5 = __pyx_t_6;
    __pyx_L7_bool_binop_done:;
    if (__pyx_t_5) {

      /* "pysam/libcbcf.pyx":1651
 *             idpair = hdr.id[BCF_DT_ID] + i
 *             if idpair.key and idpair.val and idpair.val.info[self.type] & 0xF != 0xF:
 *                 yield bcf_str_cache_get_charptr(idpair.key)             # <<<<<<<<<<<<<<
 * 
 *     def get(self, key, default=None):
*/
      __pyx_t_7 = __pyx_f_5pysam_7libcbcf_bcf_str_cache_get_charptr(__pyx_cur_scope->__pyx_v_idpair->key); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 1651, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_7);
      __pyx_r = __pyx_t_7;
      __pyx_t_7 = 0;
      __pyx_cur_scope->__pyx_t_0 = __pyx_t_2;
      __pyx_cur_scope->__pyx_t_1 = __pyx_t_3;
      __pyx_cur_scope->__pyx_t_2 = __pyx_t_4;
      __Pyx_TraceYield(__pyx_r, 0, __PYX_ERR(0, 1651, __pyx_L1_error));
      __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_L10_resume_from_yield:;
      __Pyx_TraceResumeGen("__iter__", __pyx_f[0], 1643, 0, __PYX_ERR(0, 1651, __pyx_L1_error));
      __pyx_t_2 = __pyx_cur_scope->__pyx_t_0;
      __pyx_t_3 = __pyx_cur_scope->__pyx_t_1;
      __pyx_t_4 = __pyx_cur_scope->__pyx_t_2;
      if (unlikely(!__pyx_sent_value)) __PYX_ERR(0, 1651, __pyx_L1_error)

      /* "pysam/libcbcf.pyx":1650
 *         for i in range(hdr.n[BCF_DT_ID]):
 *             idpair = hdr.id[BCF_DT_ID] + i
 *             if idpair.key and idpair.val and idpair.val.info[self.type] & 0xF != 0xF:             # <<<<<<<<<<<<<<
 *                 yield bcf_str_cache_get_charptr(idpair.key)
 * 
*/
    }
  }
  CYTHON_MAYBE_UNUSED_VAR(__pyx_cur_scope);
  __Pyx_TraceReturnValue(Py_None, 0, 0, __PYX_ERR(0, 1643, __pyx_L1_error));

  /* "pysam/libcbcf.pyx":1643
 *         #bcf_hdr_sync(hdr)
 * 
 *     def __iter__(self):             # <<<<<<<<<<<<<<
 *         cdef bcf_hdr_t *hdr = self.header.ptr
 *         cdef bcf_idpair_t *idpair
*/

  /* function exit code */
  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_7);
  if (__Pyx_PyErr_Occurred()) {
    __Pyx_TraceException(__pyx_lineno, 0, 0);
    __Pyx_Generator_Replace_StopIteration(0);
    __Pyx_AddTraceback("__iter__", __pyx_clineno, __pyx_lineno, __pyx_filename);
    __Pyx_TraceExceptionUnwind(0, 0);
  }
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_PyMonitoring_ExitScope(0);
  #if !CYTHON_USE_EXC_INFO_STACK
  __Pyx_Coroutine_ResetAndClearException(__pyx_generator);
  #endif
  __pyx_generator->resume_label = -1;
  __Pyx_Coroutine_clear((PyObject*)__pyx_generator);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "pysam/libcbcf.pyx":1653
 *                 yield bcf_str_cache_get_charptr(idpair.key)
 * 
 *     def get(self, key, default=None):             # <<<<<<<<<<<<<<
 *         """D.get(k[,d]) -> D[k] if k in D, else d.  d defaults to None."""
 *         try:
*/

/* Python wrapper */
static PyObject *__pyx_pw_5pysam_7libcbcf_21VariantHeaderMetadata_18get(PyObject *__pyx_v_self, 
#if 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_5pysam_7libcbcf_21VariantHeaderMetadata_17get, "VariantHeaderMetadata.get(self, key, default=None)\n\nD.get(k[,d]) -> D[k] if k in D, else d.  d defaults to None.");
static PyMethodDef __pyx_mdef_5pysam_7libcbcf_21VariantHeaderMetadata_18get = {"get", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_5pysam_7libcbcf_21VariantHeaderMetadata_18get, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_5pysam_7libcbcf_21VariantHeaderMetadata_17get};
static PyObject *__pyx_pw_5pysam_7libcbcf_21VariantHeaderMetadata_18get(PyObject *__pyx_v_self, 
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
) {
  PyObject *__pyx_v_key = 0;
  PyObject *__pyx_v_default = 0;
  #if !CYTHON_METH_FASTCALL
  CYTHON_UNUSED Py_ssize_t __pyx_nargs;
  #endif
  CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
  PyObject* values[2] = {0,0};
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("get (wrapper)", 0);
  #if !CYTHON_METH_FASTCALL
  #if CYTHON_ASSUME_SAFE_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,&__pyx_mstate_global->__pyx_n_u_default,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, 1653, __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, 1653, __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, 1653, __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, 1653, __pyx_L3_error)
      if (!values[1]) values[1] = __Pyx_NewRef(((PyObject *)Py_None));
      for (Py_ssize_t i = __pyx_nargs; i < 1; i++) {
        if (unlikely(!values[i])) { __Pyx_RaiseArgtupleInvalid("get", 0, 1, 2, i); __PYX_ERR(0, 1653, __pyx_L3_error) }
      }
    } 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, 1653, __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, 1653, __pyx_L3_error)
        break;
        default: goto __pyx_L5_argtuple_error;
      }
      if (!values[1]) values[1] = __Pyx_NewRef(((PyObject *)Py_None));
    }
    __pyx_v_key = values[0];
    __pyx_v_default = values[1];
  }
  goto __pyx_L6_skip;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("get", 0, 1, 2, __pyx_nargs); __PYX_ERR(0, 1653, __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("pysam.libcbcf.VariantHeaderMetadata.get", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_5pysam_7libcbcf_21VariantHeaderMetadata_17get(((struct __pyx_obj_5pysam_7libcbcf_VariantHeaderMetadata *)__pyx_v_self), __pyx_v_key, __pyx_v_default);

  /* 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_5pysam_7libcbcf_21VariantHeaderMetadata_17get(struct __pyx_obj_5pysam_7libcbcf_VariantHeaderMetadata *__pyx_v_self, PyObject *__pyx_v_key, PyObject *__pyx_v_default) {
  PyObject *__pyx_r = NULL;
  __Pyx_TraceDeclarationsFunc
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  PyObject *__pyx_t_4 = NULL;
  int __pyx_t_5;
  PyObject *__pyx_t_6 = NULL;
  PyObject *__pyx_t_7 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_TraceFrameInit(((PyObject *)__pyx_mstate_global->__pyx_codeobj_tab[86]))
  __Pyx_RefNannySetupContext("get", 0);
  __Pyx_TraceStartFunc("get", __pyx_f[0], 1653, 0, 0, 0, __PYX_ERR(0, 1653, __pyx_L1_error));

  /* "pysam/libcbcf.pyx":1655
 *     def get(self, key, default=None):
 *         """D.get(k[,d]) -> D[k] if k in D, else d.  d defaults to None."""
 *         try:             # <<<<<<<<<<<<<<
 *             return self[key]
 *         except KeyError:
*/
  {
    __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:*/ {

      /* "pysam/libcbcf.pyx":1656
 *         """D.get(k[,d]) -> D[k] if k in D, else d.  d defaults to None."""
 *         try:
 *             return self[key]             # <<<<<<<<<<<<<<
 *         except KeyError:
 *             return default
*/
      __Pyx_XDECREF(__pyx_r);
      __pyx_t_4 = __Pyx_PyObject_GetItem(((PyObject *)__pyx_v_self), __pyx_v_key); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1656, __pyx_L3_error)
      __Pyx_GOTREF(__pyx_t_4);
      __pyx_r = __pyx_t_4;
      __pyx_t_4 = 0;
      __Pyx_TraceReturnValue(__pyx_r, 3, 0, __PYX_ERR(0, 1656, __pyx_L3_error));
      goto __pyx_L7_try_return;

      /* "pysam/libcbcf.pyx":1655
 *     def get(self, key, default=None):
 *         """D.get(k[,d]) -> D[k] if k in D, else d.  d defaults to None."""
 *         try:             # <<<<<<<<<<<<<<
 *             return self[key]
 *         except KeyError:
*/
    }
    __pyx_L3_error:;
    __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
    __Pyx_TraceException(__pyx_lineno, 0, 0);

    /* "pysam/libcbcf.pyx":1657
 *         try:
 *             return self[key]
 *         except KeyError:             # <<<<<<<<<<<<<<
 *             return default
 * 
*/
    __pyx_t_5 = __Pyx_PyErr_ExceptionMatches(__pyx_builtin_KeyError);
    if (__pyx_t_5) {
      __Pyx_AddTraceback("pysam.libcbcf.VariantHeaderMetadata.get", __pyx_clineno, __pyx_lineno, __pyx_filename);
      __Pyx_TraceExceptionHandled(0);
      if (__Pyx_GetException(&__pyx_t_4, &__pyx_t_6, &__pyx_t_7) < 0) __PYX_ERR(0, 1657, __pyx_L5_except_error)
      __Pyx_XGOTREF(__pyx_t_4);
      __Pyx_XGOTREF(__pyx_t_6);
      __Pyx_XGOTREF(__pyx_t_7);
      __Pyx_TraceExceptionDone();

      /* "pysam/libcbcf.pyx":1658
 *             return self[key]
 *         except KeyError:
 *             return default             # <<<<<<<<<<<<<<
 * 
 *     def __contains__(self, key):
*/
      __Pyx_XDECREF(__pyx_r);
      __Pyx_INCREF(__pyx_v_default);
      __pyx_r = __pyx_v_default;
      __Pyx_TraceReturnValue(__pyx_r, 8, 0, __PYX_ERR(0, 1658, __pyx_L5_except_error));
      __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;

    /* "pysam/libcbcf.pyx":1655
 *     def get(self, key, default=None):
 *         """D.get(k[,d]) -> D[k] if k in D, else d.  d defaults to None."""
 *         try:             # <<<<<<<<<<<<<<
 *             return self[key]
 *         except KeyError:
*/
    __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;
  }

  /* "pysam/libcbcf.pyx":1653
 *                 yield bcf_str_cache_get_charptr(idpair.key)
 * 
 *     def get(self, key, default=None):             # <<<<<<<<<<<<<<
 *         """D.get(k[,d]) -> D[k] if k in D, else d.  d defaults to None."""
 *         try:
*/

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_XDECREF(__pyx_t_6);
  __Pyx_XDECREF(__pyx_t_7);
  __Pyx_TraceException(__pyx_lineno, 0, 0);
  #if CYTHON_USE_SYS_MONITORING
  __Pyx_TraceExceptionUnwind(0, 0);
  #else
  __Pyx_TraceReturnValue(NULL, 0, 0, __PYX_ERR(0, 1653, __pyx_L1_error));
  #endif
  __Pyx_AddTraceback("pysam.libcbcf.VariantHeaderMetadata.get", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_PyMonitoring_ExitScope(0);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "pysam/libcbcf.pyx":1660
 *             return default
 * 
 *     def __contains__(self, key):             # <<<<<<<<<<<<<<
 *         try:
 *             self[key]
*/

/* Python wrapper */
static int __pyx_pw_5pysam_7libcbcf_21VariantHeaderMetadata_20__contains__(PyObject *__pyx_v_self, PyObject *__pyx_v_key); /*proto*/
static int __pyx_pw_5pysam_7libcbcf_21VariantHeaderMetadata_20__contains__(PyObject *__pyx_v_self, PyObject *__pyx_v_key) {
  CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__contains__ (wrapper)", 0);
  __pyx_kwvalues = __Pyx_KwValues_VARARGS(__pyx_args, __pyx_nargs);
  __pyx_r = __pyx_pf_5pysam_7libcbcf_21VariantHeaderMetadata_19__contains__(((struct __pyx_obj_5pysam_7libcbcf_VariantHeaderMetadata *)__pyx_v_self), ((PyObject *)__pyx_v_key));

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

static int __pyx_pf_5pysam_7libcbcf_21VariantHeaderMetadata_19__contains__(struct __pyx_obj_5pysam_7libcbcf_VariantHeaderMetadata *__pyx_v_self, PyObject *__pyx_v_key) {
  int __pyx_r;
  __Pyx_TraceDeclarationsFunc
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  PyObject *__pyx_t_4 = NULL;
  int __pyx_t_5;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_TraceFrameInit(((PyObject *)__pyx_mstate_global->__pyx_codeobj_tab[87]))
  __Pyx_RefNannySetupContext("__contains__", 0);
  __Pyx_TraceStartFunc("__contains__", __pyx_f[0], 1660, 0, 0, 0, __PYX_ERR(0, 1660, __pyx_L1_error));

  /* "pysam/libcbcf.pyx":1661
 * 
 *     def __contains__(self, key):
 *         try:             # <<<<<<<<<<<<<<
 *             self[key]
 *         except KeyError:
*/
  {
    __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:*/ {

      /* "pysam/libcbcf.pyx":1662
 *     def __contains__(self, key):
 *         try:
 *             self[key]             # <<<<<<<<<<<<<<
 *         except KeyError:
 *             return False
*/
      __pyx_t_4 = __Pyx_PyObject_GetItem(((PyObject *)__pyx_v_self), __pyx_v_key); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1662, __pyx_L3_error)
      __Pyx_GOTREF(__pyx_t_4);
      __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;

      /* "pysam/libcbcf.pyx":1661
 * 
 *     def __contains__(self, key):
 *         try:             # <<<<<<<<<<<<<<
 *             self[key]
 *         except KeyError:
*/
    }

    /* "pysam/libcbcf.pyx":1666
 *             return False
 *         else:
 *             return True             # <<<<<<<<<<<<<<
 * 
 *     def iterkeys(self):
*/
    /*else:*/ {
      __pyx_r = 1;
      __Pyx_TraceReturnCValue(__pyx_r, __Pyx_PyLong_From_int, 8, 0, __PYX_ERR(0, 1666, __pyx_L5_except_error));
      goto __pyx_L6_except_return;
    }
    __pyx_L3_error:;
    __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
    __Pyx_TraceException(__pyx_lineno, 0, 0);

    /* "pysam/libcbcf.pyx":1663
 *         try:
 *             self[key]
 *         except KeyError:             # <<<<<<<<<<<<<<
 *             return False
 *         else:
*/
    __pyx_t_5 = __Pyx_PyErr_ExceptionMatches(__pyx_builtin_KeyError);
    if (__pyx_t_5) {
      __Pyx_AddTraceback("pysam.libcbcf.VariantHeaderMetadata.__contains__", __pyx_clineno, __pyx_lineno, __pyx_filename);
      __Pyx_TraceExceptionHandled(0);
      __Pyx_ErrRestore(0,0,0);
      __Pyx_TraceExceptionDone();

      /* "pysam/libcbcf.pyx":1664
 *             self[key]
 *         except KeyError:
 *             return False             # <<<<<<<<<<<<<<
 *         else:
 *             return True
*/
      __pyx_r = 0;
      __Pyx_TraceReturnCValue(__pyx_r, __Pyx_PyLong_From_int, 6, 0, __PYX_ERR(0, 1664, __pyx_L5_except_error));
      goto __pyx_L6_except_return;
    }
    goto __pyx_L5_except_error;

    /* "pysam/libcbcf.pyx":1661
 * 
 *     def __contains__(self, key):
 *         try:             # <<<<<<<<<<<<<<
 *             self[key]
 *         except KeyError:
*/
    __pyx_L5_except_error:;
    __Pyx_XGIVEREF(__pyx_t_1);
    __Pyx_XGIVEREF(__pyx_t_2);
    __Pyx_XGIVEREF(__pyx_t_3);
    __Pyx_ExceptionReset(__pyx_t_1, __pyx_t_2, __pyx_t_3);
    goto __pyx_L1_error;
    __pyx_L6_except_return:;
    __Pyx_XGIVEREF(__pyx_t_1);
    __Pyx_XGIVEREF(__pyx_t_2);
    __Pyx_XGIVEREF(__pyx_t_3);
    __Pyx_ExceptionReset(__pyx_t_1, __pyx_t_2, __pyx_t_3);
    goto __pyx_L0;
  }

  /* "pysam/libcbcf.pyx":1660
 *             return default
 * 
 *     def __contains__(self, key):             # <<<<<<<<<<<<<<
 *         try:
 *             self[key]
*/

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_TraceException(__pyx_lineno, 0, 0);
  #if CYTHON_USE_SYS_MONITORING
  __Pyx_TraceExceptionUnwind(0, 0);
  #else
  __Pyx_TraceReturnValue(NULL, 0, 0, __PYX_ERR(0, 1660, __pyx_L1_error));
  #endif
  __Pyx_AddTraceback("pysam.libcbcf.VariantHeaderMetadata.__contains__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = -1;
  __pyx_L0:;
  __Pyx_PyMonitoring_ExitScope(0);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "pysam/libcbcf.pyx":1668
 *             return True
 * 
 *     def iterkeys(self):             # <<<<<<<<<<<<<<
 *         """D.iterkeys() -> an iterator over the keys of D"""
 *         return iter(self)
*/

/* Python wrapper */
static PyObject *__pyx_pw_5pysam_7libcbcf_21VariantHeaderMetadata_22iterkeys(PyObject *__pyx_v_self, 
#if 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_5pysam_7libcbcf_21VariantHeaderMetadata_21iterkeys, "VariantHeaderMetadata.iterkeys(self)\n\nD.iterkeys() -> an iterator over the keys of D");
static PyMethodDef __pyx_mdef_5pysam_7libcbcf_21VariantHeaderMetadata_22iterkeys = {"iterkeys", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_5pysam_7libcbcf_21VariantHeaderMetadata_22iterkeys, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_5pysam_7libcbcf_21VariantHeaderMetadata_21iterkeys};
static PyObject *__pyx_pw_5pysam_7libcbcf_21VariantHeaderMetadata_22iterkeys(PyObject *__pyx_v_self, 
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
) {
  #if !CYTHON_METH_FASTCALL
  CYTHON_UNUSED Py_ssize_t __pyx_nargs;
  #endif
  CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("iterkeys (wrapper)", 0);
  #if !CYTHON_METH_FASTCALL
  #if CYTHON_ASSUME_SAFE_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("iterkeys", 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("iterkeys", __pyx_kwds); return NULL;}
  __pyx_r = __pyx_pf_5pysam_7libcbcf_21VariantHeaderMetadata_21iterkeys(((struct __pyx_obj_5pysam_7libcbcf_VariantHeaderMetadata *)__pyx_v_self));

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

static PyObject *__pyx_pf_5pysam_7libcbcf_21VariantHeaderMetadata_21iterkeys(struct __pyx_obj_5pysam_7libcbcf_VariantHeaderMetadata *__pyx_v_self) {
  PyObject *__pyx_r = NULL;
  __Pyx_TraceDeclarationsFunc
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_TraceFrameInit(((PyObject *)__pyx_mstate_global->__pyx_codeobj_tab[88]))
  __Pyx_RefNannySetupContext("iterkeys", 0);
  __Pyx_TraceStartFunc("iterkeys", __pyx_f[0], 1668, 0, 0, 0, __PYX_ERR(0, 1668, __pyx_L1_error));

  /* "pysam/libcbcf.pyx":1670
 *     def iterkeys(self):
 *         """D.iterkeys() -> an iterator over the keys of D"""
 *         return iter(self)             # <<<<<<<<<<<<<<
 * 
 *     def itervalues(self):
*/
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = PyObject_GetIter(((PyObject *)__pyx_v_self)); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1670, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  __Pyx_TraceReturnValue(__pyx_r, 1, 0, __PYX_ERR(0, 1670, __pyx_L1_error));
  goto __pyx_L0;

  /* "pysam/libcbcf.pyx":1668
 *             return True
 * 
 *     def iterkeys(self):             # <<<<<<<<<<<<<<
 *         """D.iterkeys() -> an iterator over the keys of D"""
 *         return iter(self)
*/

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_TraceException(__pyx_lineno, 0, 0);
  #if CYTHON_USE_SYS_MONITORING
  __Pyx_TraceExceptionUnwind(0, 0);
  #else
  __Pyx_TraceReturnValue(NULL, 0, 0, __PYX_ERR(0, 1668, __pyx_L1_error));
  #endif
  __Pyx_AddTraceback("pysam.libcbcf.VariantHeaderMetadata.iterkeys", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_PyMonitoring_ExitScope(0);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}
static PyObject *__pyx_gb_5pysam_7libcbcf_21VariantHeaderMetadata_25generator5(__pyx_CoroutineObject *__pyx_generator, CYTHON_UNUSED PyThreadState *__pyx_tstate, PyObject *__pyx_sent_value); /* proto */

/* "pysam/libcbcf.pyx":1672
 *         return iter(self)
 * 
 *     def itervalues(self):             # <<<<<<<<<<<<<<
 *         """D.itervalues() -> an iterator over the values of D"""
 *         for key in self:
*/

/* Python wrapper */
static PyObject *__pyx_pw_5pysam_7libcbcf_21VariantHeaderMetadata_24itervalues(PyObject *__pyx_v_self, 
#if 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_5pysam_7libcbcf_21VariantHeaderMetadata_23itervalues, "VariantHeaderMetadata.itervalues(self)\n\nD.itervalues() -> an iterator over the values of D");
static PyMethodDef __pyx_mdef_5pysam_7libcbcf_21VariantHeaderMetadata_24itervalues = {"itervalues", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_5pysam_7libcbcf_21VariantHeaderMetadata_24itervalues, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_5pysam_7libcbcf_21VariantHeaderMetadata_23itervalues};
static PyObject *__pyx_pw_5pysam_7libcbcf_21VariantHeaderMetadata_24itervalues(PyObject *__pyx_v_self, 
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
) {
  #if !CYTHON_METH_FASTCALL
  CYTHON_UNUSED Py_ssize_t __pyx_nargs;
  #endif
  CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("itervalues (wrapper)", 0);
  #if !CYTHON_METH_FASTCALL
  #if CYTHON_ASSUME_SAFE_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("itervalues", 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("itervalues", __pyx_kwds); return NULL;}
  __pyx_r = __pyx_pf_5pysam_7libcbcf_21VariantHeaderMetadata_23itervalues(((struct __pyx_obj_5pysam_7libcbcf_VariantHeaderMetadata *)__pyx_v_self));

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

static PyObject *__pyx_pf_5pysam_7libcbcf_21VariantHeaderMetadata_23itervalues(struct __pyx_obj_5pysam_7libcbcf_VariantHeaderMetadata *__pyx_v_self) {
  struct __pyx_obj_5pysam_7libcbcf___pyx_scope_struct_12_itervalues *__pyx_cur_scope;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("itervalues", 0);
  __pyx_cur_scope = (struct __pyx_obj_5pysam_7libcbcf___pyx_scope_struct_12_itervalues *)__pyx_tp_new_5pysam_7libcbcf___pyx_scope_struct_12_itervalues(__pyx_mstate_global->__pyx_ptype_5pysam_7libcbcf___pyx_scope_struct_12_itervalues, __pyx_mstate_global->__pyx_empty_tuple, NULL);
  if (unlikely(!__pyx_cur_scope)) {
    __pyx_cur_scope = ((struct __pyx_obj_5pysam_7libcbcf___pyx_scope_struct_12_itervalues *)Py_None);
    __Pyx_INCREF(Py_None);
    __PYX_ERR(0, 1672, __pyx_L1_error)
  } else {
    __Pyx_GOTREF((PyObject *)__pyx_cur_scope);
  }
  __pyx_cur_scope->__pyx_v_self = __pyx_v_self;
  __Pyx_INCREF((PyObject *)__pyx_cur_scope->__pyx_v_self);
  __Pyx_GIVEREF((PyObject *)__pyx_cur_scope->__pyx_v_self);
  {
    __pyx_CoroutineObject *gen = __Pyx_Generator_New((__pyx_coroutine_body_t) __pyx_gb_5pysam_7libcbcf_21VariantHeaderMetadata_25generator5, ((PyObject *)__pyx_mstate_global->__pyx_codeobj_tab[89]), (PyObject *) __pyx_cur_scope, __pyx_mstate_global->__pyx_n_u_itervalues, __pyx_mstate_global->__pyx_n_u_VariantHeaderMetadata_itervalues, __pyx_mstate_global->__pyx_n_u_pysam_libcbcf); if (unlikely(!gen)) __PYX_ERR(0, 1672, __pyx_L1_error)
    __Pyx_DECREF(__pyx_cur_scope);
    __Pyx_RefNannyFinishContext();
    return (PyObject *) gen;
  }

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_AddTraceback("pysam.libcbcf.VariantHeaderMetadata.itervalues", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __Pyx_DECREF((PyObject *)__pyx_cur_scope);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_gb_5pysam_7libcbcf_21VariantHeaderMetadata_25generator5(__pyx_CoroutineObject *__pyx_generator, CYTHON_UNUSED PyThreadState *__pyx_tstate, PyObject *__pyx_sent_value) /* generator body */
{
  struct __pyx_obj_5pysam_7libcbcf___pyx_scope_struct_12_itervalues *__pyx_cur_scope = ((struct __pyx_obj_5pysam_7libcbcf___pyx_scope_struct_12_itervalues *)__pyx_generator->closure);
  PyObject *__pyx_r = NULL;
  __Pyx_TraceDeclarationsGen
  PyObject *__pyx_t_1 = NULL;
  Py_ssize_t __pyx_t_2;
  PyObject *(*__pyx_t_3)(PyObject *);
  PyObject *__pyx_t_4 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("itervalues", 0);
  switch (__pyx_generator->resume_label) {
    case 0: goto __pyx_L3_first_run;
    case 1: goto __pyx_L6_resume_from_yield;
    default: /* CPython raises the right error here */
    __Pyx_TraceStartGen("itervalues", __pyx_f[0], 1672, 0, 0, 0, __PYX_ERR(0, 1672, __pyx_L1_error));
    __Pyx_TraceReturnValue(Py_None, 0, 0, __PYX_ERR(0, 1672, __pyx_L1_error));
    __Pyx_RefNannyFinishContext();
    return NULL;
  }
  __pyx_L3_first_run:;
  __Pyx_TraceStartGen("itervalues", __pyx_f[0], 1672, 0, 0, 0, __PYX_ERR(0, 1672, __pyx_L1_error));
  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, 1672, __pyx_L1_error)
  }

  /* "pysam/libcbcf.pyx":1674
 *     def itervalues(self):
 *         """D.itervalues() -> an iterator over the values of D"""
 *         for key in self:             # <<<<<<<<<<<<<<
 *             yield self[key]
 * 
*/
  if (likely(PyList_CheckExact(((PyObject *)__pyx_cur_scope->__pyx_v_self))) || PyTuple_CheckExact(((PyObject *)__pyx_cur_scope->__pyx_v_self))) {
    __pyx_t_1 = ((PyObject *)__pyx_cur_scope->__pyx_v_self); __Pyx_INCREF(__pyx_t_1);
    __pyx_t_2 = 0;
    __pyx_t_3 = NULL;
  } else {
    __pyx_t_2 = -1; __pyx_t_1 = PyObject_GetIter(((PyObject *)__pyx_cur_scope->__pyx_v_self)); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1674, __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, 1674, __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, 1674, __pyx_L1_error)
          #endif
          if (__pyx_t_2 >= __pyx_temp) break;
        }
        __pyx_t_4 = __Pyx_PyList_GetItemRef(__pyx_t_1, __pyx_t_2);
        ++__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, 1674, __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, 1674, __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, 1674, __pyx_L1_error)
          PyErr_Clear();
        }
        break;
      }
    }
    __Pyx_GOTREF(__pyx_t_4);
    __Pyx_XGOTREF(__pyx_cur_scope->__pyx_v_key);
    __Pyx_XDECREF_SET(__pyx_cur_scope->__pyx_v_key, __pyx_t_4);
    __Pyx_GIVEREF(__pyx_t_4);
    __pyx_t_4 = 0;

    /* "pysam/libcbcf.pyx":1675
 *         """D.itervalues() -> an iterator over the values of D"""
 *         for key in self:
 *             yield self[key]             # <<<<<<<<<<<<<<
 * 
 *     def iteritems(self):
*/
    __pyx_t_4 = __Pyx_PyObject_GetItem(((PyObject *)__pyx_cur_scope->__pyx_v_self), __pyx_cur_scope->__pyx_v_key); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1675, __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_TraceYield(__pyx_r, 0, __PYX_ERR(0, 1675, __pyx_L1_error));
    __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_TraceResumeGen("itervalues", __pyx_f[0], 1672, 0, __PYX_ERR(0, 1675, __pyx_L1_error));
    __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, 1675, __pyx_L1_error)

    /* "pysam/libcbcf.pyx":1674
 *     def itervalues(self):
 *         """D.itervalues() -> an iterator over the values of D"""
 *         for key in self:             # <<<<<<<<<<<<<<
 *             yield self[key]
 * 
*/
  }
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  CYTHON_MAYBE_UNUSED_VAR(__pyx_cur_scope);
  __Pyx_TraceReturnValue(Py_None, 0, 0, __PYX_ERR(0, 1672, __pyx_L1_error));

  /* "pysam/libcbcf.pyx":1672
 *         return iter(self)
 * 
 *     def itervalues(self):             # <<<<<<<<<<<<<<
 *         """D.itervalues() -> an iterator over the values of D"""
 *         for key in self:
*/

  /* 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_TraceException(__pyx_lineno, 0, 0);
    __Pyx_Generator_Replace_StopIteration(0);
    __Pyx_AddTraceback("itervalues", __pyx_clineno, __pyx_lineno, __pyx_filename);
    __Pyx_TraceExceptionUnwind(0, 0);
  }
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_PyMonitoring_ExitScope(0);
  #if !CYTHON_USE_EXC_INFO_STACK
  __Pyx_Coroutine_ResetAndClearException(__pyx_generator);
  #endif
  __pyx_generator->resume_label = -1;
  __Pyx_Coroutine_clear((PyObject*)__pyx_generator);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}
static PyObject *__pyx_gb_5pysam_7libcbcf_21VariantHeaderMetadata_28generator6(__pyx_CoroutineObject *__pyx_generator, CYTHON_UNUSED PyThreadState *__pyx_tstate, PyObject *__pyx_sent_value); /* proto */

/* "pysam/libcbcf.pyx":1677
 *             yield self[key]
 * 
 *     def iteritems(self):             # <<<<<<<<<<<<<<
 *         """D.iteritems() -> an iterator over the (key, value) items of D"""
 *         for key in self:
*/

/* Python wrapper */
static PyObject *__pyx_pw_5pysam_7libcbcf_21VariantHeaderMetadata_27iteritems(PyObject *__pyx_v_self, 
#if 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_5pysam_7libcbcf_21VariantHeaderMetadata_26iteritems, "VariantHeaderMetadata.iteritems(self)\n\nD.iteritems() -> an iterator over the (key, value) items of D");
static PyMethodDef __pyx_mdef_5pysam_7libcbcf_21VariantHeaderMetadata_27iteritems = {"iteritems", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_5pysam_7libcbcf_21VariantHeaderMetadata_27iteritems, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_5pysam_7libcbcf_21VariantHeaderMetadata_26iteritems};
static PyObject *__pyx_pw_5pysam_7libcbcf_21VariantHeaderMetadata_27iteritems(PyObject *__pyx_v_self, 
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
) {
  #if !CYTHON_METH_FASTCALL
  CYTHON_UNUSED Py_ssize_t __pyx_nargs;
  #endif
  CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("iteritems (wrapper)", 0);
  #if !CYTHON_METH_FASTCALL
  #if CYTHON_ASSUME_SAFE_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("iteritems", 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("iteritems", __pyx_kwds); return NULL;}
  __pyx_r = __pyx_pf_5pysam_7libcbcf_21VariantHeaderMetadata_26iteritems(((struct __pyx_obj_5pysam_7libcbcf_VariantHeaderMetadata *)__pyx_v_self));

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

static PyObject *__pyx_pf_5pysam_7libcbcf_21VariantHeaderMetadata_26iteritems(struct __pyx_obj_5pysam_7libcbcf_VariantHeaderMetadata *__pyx_v_self) {
  struct __pyx_obj_5pysam_7libcbcf___pyx_scope_struct_13_iteritems *__pyx_cur_scope;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("iteritems", 0);
  __pyx_cur_scope = (struct __pyx_obj_5pysam_7libcbcf___pyx_scope_struct_13_iteritems *)__pyx_tp_new_5pysam_7libcbcf___pyx_scope_struct_13_iteritems(__pyx_mstate_global->__pyx_ptype_5pysam_7libcbcf___pyx_scope_struct_13_iteritems, __pyx_mstate_global->__pyx_empty_tuple, NULL);
  if (unlikely(!__pyx_cur_scope)) {
    __pyx_cur_scope = ((struct __pyx_obj_5pysam_7libcbcf___pyx_scope_struct_13_iteritems *)Py_None);
    __Pyx_INCREF(Py_None);
    __PYX_ERR(0, 1677, __pyx_L1_error)
  } else {
    __Pyx_GOTREF((PyObject *)__pyx_cur_scope);
  }
  __pyx_cur_scope->__pyx_v_self = __pyx_v_self;
  __Pyx_INCREF((PyObject *)__pyx_cur_scope->__pyx_v_self);
  __Pyx_GIVEREF((PyObject *)__pyx_cur_scope->__pyx_v_self);
  {
    __pyx_CoroutineObject *gen = __Pyx_Generator_New((__pyx_coroutine_body_t) __pyx_gb_5pysam_7libcbcf_21VariantHeaderMetadata_28generator6, ((PyObject *)__pyx_mstate_global->__pyx_codeobj_tab[90]), (PyObject *) __pyx_cur_scope, __pyx_mstate_global->__pyx_n_u_iteritems, __pyx_mstate_global->__pyx_n_u_VariantHeaderMetadata_iteritems, __pyx_mstate_global->__pyx_n_u_pysam_libcbcf); if (unlikely(!gen)) __PYX_ERR(0, 1677, __pyx_L1_error)
    __Pyx_DECREF(__pyx_cur_scope);
    __Pyx_RefNannyFinishContext();
    return (PyObject *) gen;
  }

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_AddTraceback("pysam.libcbcf.VariantHeaderMetadata.iteritems", __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_5pysam_7libcbcf_21VariantHeaderMetadata_28generator6(__pyx_CoroutineObject *__pyx_generator, CYTHON_UNUSED PyThreadState *__pyx_tstate, PyObject *__pyx_sent_value) /* generator body */
{
  struct __pyx_obj_5pysam_7libcbcf___pyx_scope_struct_13_iteritems *__pyx_cur_scope = ((struct __pyx_obj_5pysam_7libcbcf___pyx_scope_struct_13_iteritems *)__pyx_generator->closure);
  PyObject *__pyx_r = NULL;
  __Pyx_TraceDeclarationsGen
  PyObject *__pyx_t_1 = NULL;
  Py_ssize_t __pyx_t_2;
  PyObject *(*__pyx_t_3)(PyObject *);
  PyObject *__pyx_t_4 = NULL;
  PyObject *__pyx_t_5 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("iteritems", 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_TraceStartGen("iteritems", __pyx_f[0], 1677, 0, 0, 0, __PYX_ERR(0, 1677, __pyx_L1_error));
    __Pyx_TraceReturnValue(Py_None, 0, 0, __PYX_ERR(0, 1677, __pyx_L1_error));
    __Pyx_RefNannyFinishContext();
    return NULL;
  }
  __pyx_L3_first_run:;
  __Pyx_TraceStartGen("iteritems", __pyx_f[0], 1677, 0, 0, 0, __PYX_ERR(0, 1677, __pyx_L1_error));
  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, 1677, __pyx_L1_error)
  }

  /* "pysam/libcbcf.pyx":1679
 *     def iteritems(self):
 *         """D.iteritems() -> an iterator over the (key, value) items of D"""
 *         for key in self:             # <<<<<<<<<<<<<<
 *             yield (key, self[key])
 * 
*/
  if (likely(PyList_CheckExact(((PyObject *)__pyx_cur_scope->__pyx_v_self))) || PyTuple_CheckExact(((PyObject *)__pyx_cur_scope->__pyx_v_self))) {
    __pyx_t_1 = ((PyObject *)__pyx_cur_scope->__pyx_v_self); __Pyx_INCREF(__pyx_t_1);
    __pyx_t_2 = 0;
    __pyx_t_3 = NULL;
  } else {
    __pyx_t_2 = -1; __pyx_t_1 = PyObject_GetIter(((PyObject *)__pyx_cur_scope->__pyx_v_self)); 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_GetItemRef(__pyx_t_1, __pyx_t_2);
        ++__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_XGOTREF(__pyx_cur_scope->__pyx_v_key);
    __Pyx_XDECREF_SET(__pyx_cur_scope->__pyx_v_key, __pyx_t_4);
    __Pyx_GIVEREF(__pyx_t_4);
    __pyx_t_4 = 0;

    /* "pysam/libcbcf.pyx":1680
 *         """D.iteritems() -> an iterator over the (key, value) items of D"""
 *         for key in self:
 *             yield (key, self[key])             # <<<<<<<<<<<<<<
 * 
 *     def keys(self):
*/
    __pyx_t_4 = __Pyx_PyObject_GetItem(((PyObject *)__pyx_cur_scope->__pyx_v_self), __pyx_cur_scope->__pyx_v_key); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1680, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
    __pyx_t_5 = PyTuple_New(2); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1680, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_5);
    __Pyx_INCREF(__pyx_cur_scope->__pyx_v_key);
    __Pyx_GIVEREF(__pyx_cur_scope->__pyx_v_key);
    if (__Pyx_PyTuple_SET_ITEM(__pyx_t_5, 0, __pyx_cur_scope->__pyx_v_key) != (0)) __PYX_ERR(0, 1680, __pyx_L1_error);
    __Pyx_GIVEREF(__pyx_t_4);
    if (__Pyx_PyTuple_SET_ITEM(__pyx_t_5, 1, __pyx_t_4) != (0)) __PYX_ERR(0, 1680, __pyx_L1_error);
    __pyx_t_4 = 0;
    __pyx_r = __pyx_t_5;
    __pyx_t_5 = 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_TraceYield(__pyx_r, 0, __PYX_ERR(0, 1680, __pyx_L1_error));
    __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_TraceResumeGen("iteritems", __pyx_f[0], 1677, 0, __PYX_ERR(0, 1680, __pyx_L1_error));
    __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, 1680, __pyx_L1_error)

    /* "pysam/libcbcf.pyx":1679
 *     def iteritems(self):
 *         """D.iteritems() -> an iterator over the (key, value) items of D"""
 *         for key in self:             # <<<<<<<<<<<<<<
 *             yield (key, self[key])
 * 
*/
  }
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  CYTHON_MAYBE_UNUSED_VAR(__pyx_cur_scope);
  __Pyx_TraceReturnValue(Py_None, 0, 0, __PYX_ERR(0, 1677, __pyx_L1_error));

  /* "pysam/libcbcf.pyx":1677
 *             yield self[key]
 * 
 *     def iteritems(self):             # <<<<<<<<<<<<<<
 *         """D.iteritems() -> an iterator over the (key, value) items of D"""
 *         for key in self:
*/

  /* 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);
  if (__Pyx_PyErr_Occurred()) {
    __Pyx_TraceException(__pyx_lineno, 0, 0);
    __Pyx_Generator_Replace_StopIteration(0);
    __Pyx_AddTraceback("iteritems", __pyx_clineno, __pyx_lineno, __pyx_filename);
    __Pyx_TraceExceptionUnwind(0, 0);
  }
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_PyMonitoring_ExitScope(0);
  #if !CYTHON_USE_EXC_INFO_STACK
  __Pyx_Coroutine_ResetAndClearException(__pyx_generator);
  #endif
  __pyx_generator->resume_label = -1;
  __Pyx_Coroutine_clear((PyObject*)__pyx_generator);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "pysam/libcbcf.pyx":1682
 *             yield (key, self[key])
 * 
 *     def keys(self):             # <<<<<<<<<<<<<<
 *         """D.keys() -> list of D's keys"""
 *         return list(self)
*/

/* Python wrapper */
static PyObject *__pyx_pw_5pysam_7libcbcf_21VariantHeaderMetadata_30keys(PyObject *__pyx_v_self, 
#if 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_5pysam_7libcbcf_21VariantHeaderMetadata_29keys, "VariantHeaderMetadata.keys(self)\n\nD.keys() -> list of D's keys");
static PyMethodDef __pyx_mdef_5pysam_7libcbcf_21VariantHeaderMetadata_30keys = {"keys", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_5pysam_7libcbcf_21VariantHeaderMetadata_30keys, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_5pysam_7libcbcf_21VariantHeaderMetadata_29keys};
static PyObject *__pyx_pw_5pysam_7libcbcf_21VariantHeaderMetadata_30keys(PyObject *__pyx_v_self, 
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
) {
  #if !CYTHON_METH_FASTCALL
  CYTHON_UNUSED Py_ssize_t __pyx_nargs;
  #endif
  CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("keys (wrapper)", 0);
  #if !CYTHON_METH_FASTCALL
  #if CYTHON_ASSUME_SAFE_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("keys", 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("keys", __pyx_kwds); return NULL;}
  __pyx_r = __pyx_pf_5pysam_7libcbcf_21VariantHeaderMetadata_29keys(((struct __pyx_obj_5pysam_7libcbcf_VariantHeaderMetadata *)__pyx_v_self));

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

static PyObject *__pyx_pf_5pysam_7libcbcf_21VariantHeaderMetadata_29keys(struct __pyx_obj_5pysam_7libcbcf_VariantHeaderMetadata *__pyx_v_self) {
  PyObject *__pyx_r = NULL;
  __Pyx_TraceDeclarationsFunc
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_TraceFrameInit(((PyObject *)__pyx_mstate_global->__pyx_codeobj_tab[91]))
  __Pyx_RefNannySetupContext("keys", 0);
  __Pyx_TraceStartFunc("keys", __pyx_f[0], 1682, 0, 0, 0, __PYX_ERR(0, 1682, __pyx_L1_error));

  /* "pysam/libcbcf.pyx":1684
 *     def keys(self):
 *         """D.keys() -> list of D's keys"""
 *         return list(self)             # <<<<<<<<<<<<<<
 * 
 *     def items(self):
*/
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = PySequence_List(((PyObject *)__pyx_v_self)); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1684, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  __Pyx_TraceReturnValue(__pyx_r, 1, 0, __PYX_ERR(0, 1684, __pyx_L1_error));
  goto __pyx_L0;

  /* "pysam/libcbcf.pyx":1682
 *             yield (key, self[key])
 * 
 *     def keys(self):             # <<<<<<<<<<<<<<
 *         """D.keys() -> list of D's keys"""
 *         return list(self)
*/

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_TraceException(__pyx_lineno, 0, 0);
  #if CYTHON_USE_SYS_MONITORING
  __Pyx_TraceExceptionUnwind(0, 0);
  #else
  __Pyx_TraceReturnValue(NULL, 0, 0, __PYX_ERR(0, 1682, __pyx_L1_error));
  #endif
  __Pyx_AddTraceback("pysam.libcbcf.VariantHeaderMetadata.keys", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_PyMonitoring_ExitScope(0);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "pysam/libcbcf.pyx":1686
 *         return list(self)
 * 
 *     def items(self):             # <<<<<<<<<<<<<<
 *         """D.items() -> list of D's (key, value) pairs, as 2-tuples"""
 *         return list(self.iteritems())
*/

/* Python wrapper */
static PyObject *__pyx_pw_5pysam_7libcbcf_21VariantHeaderMetadata_32items(PyObject *__pyx_v_self, 
#if 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_5pysam_7libcbcf_21VariantHeaderMetadata_31items, "VariantHeaderMetadata.items(self)\n\nD.items() -> list of D's (key, value) pairs, as 2-tuples");
static PyMethodDef __pyx_mdef_5pysam_7libcbcf_21VariantHeaderMetadata_32items = {"items", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_5pysam_7libcbcf_21VariantHeaderMetadata_32items, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_5pysam_7libcbcf_21VariantHeaderMetadata_31items};
static PyObject *__pyx_pw_5pysam_7libcbcf_21VariantHeaderMetadata_32items(PyObject *__pyx_v_self, 
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
) {
  #if !CYTHON_METH_FASTCALL
  CYTHON_UNUSED Py_ssize_t __pyx_nargs;
  #endif
  CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("items (wrapper)", 0);
  #if !CYTHON_METH_FASTCALL
  #if CYTHON_ASSUME_SAFE_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("items", 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("items", __pyx_kwds); return NULL;}
  __pyx_r = __pyx_pf_5pysam_7libcbcf_21VariantHeaderMetadata_31items(((struct __pyx_obj_5pysam_7libcbcf_VariantHeaderMetadata *)__pyx_v_self));

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

static PyObject *__pyx_pf_5pysam_7libcbcf_21VariantHeaderMetadata_31items(struct __pyx_obj_5pysam_7libcbcf_VariantHeaderMetadata *__pyx_v_self) {
  PyObject *__pyx_r = NULL;
  __Pyx_TraceDeclarationsFunc
  __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_TraceFrameInit(((PyObject *)__pyx_mstate_global->__pyx_codeobj_tab[92]))
  __Pyx_RefNannySetupContext("items", 0);
  __Pyx_TraceStartFunc("items", __pyx_f[0], 1686, 0, 0, 0, __PYX_ERR(0, 1686, __pyx_L1_error));

  /* "pysam/libcbcf.pyx":1688
 *     def items(self):
 *         """D.items() -> list of D's (key, value) pairs, as 2-tuples"""
 *         return list(self.iteritems())             # <<<<<<<<<<<<<<
 * 
 *     def values(self):
*/
  __Pyx_XDECREF(__pyx_r);
  __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(__pyx_mstate_global->__pyx_n_u_iteritems, __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, 1688, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
  }
  __pyx_t_2 = __Pyx_PySequence_ListKeepNew(__pyx_t_1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1688, __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;
  __Pyx_TraceReturnValue(__pyx_r, 1, 0, __PYX_ERR(0, 1688, __pyx_L1_error));
  goto __pyx_L0;

  /* "pysam/libcbcf.pyx":1686
 *         return list(self)
 * 
 *     def items(self):             # <<<<<<<<<<<<<<
 *         """D.items() -> list of D's (key, value) pairs, as 2-tuples"""
 *         return list(self.iteritems())
*/

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_TraceException(__pyx_lineno, 0, 0);
  #if CYTHON_USE_SYS_MONITORING
  __Pyx_TraceExceptionUnwind(0, 0);
  #else
  __Pyx_TraceReturnValue(NULL, 0, 0, __PYX_ERR(0, 1686, __pyx_L1_error));
  #endif
  __Pyx_AddTraceback("pysam.libcbcf.VariantHeaderMetadata.items", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_PyMonitoring_ExitScope(0);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "pysam/libcbcf.pyx":1690
 *         return list(self.iteritems())
 * 
 *     def values(self):             # <<<<<<<<<<<<<<
 *         """D.values() -> list of D's values"""
 *         return list(self.itervalues())
*/

/* Python wrapper */
static PyObject *__pyx_pw_5pysam_7libcbcf_21VariantHeaderMetadata_34values(PyObject *__pyx_v_self, 
#if 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_5pysam_7libcbcf_21VariantHeaderMetadata_33values, "VariantHeaderMetadata.values(self)\n\nD.values() -> list of D's values");
static PyMethodDef __pyx_mdef_5pysam_7libcbcf_21VariantHeaderMetadata_34values = {"values", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_5pysam_7libcbcf_21VariantHeaderMetadata_34values, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_5pysam_7libcbcf_21VariantHeaderMetadata_33values};
static PyObject *__pyx_pw_5pysam_7libcbcf_21VariantHeaderMetadata_34values(PyObject *__pyx_v_self, 
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
) {
  #if !CYTHON_METH_FASTCALL
  CYTHON_UNUSED Py_ssize_t __pyx_nargs;
  #endif
  CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("values (wrapper)", 0);
  #if !CYTHON_METH_FASTCALL
  #if CYTHON_ASSUME_SAFE_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("values", 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("values", __pyx_kwds); return NULL;}
  __pyx_r = __pyx_pf_5pysam_7libcbcf_21VariantHeaderMetadata_33values(((struct __pyx_obj_5pysam_7libcbcf_VariantHeaderMetadata *)__pyx_v_self));

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

static PyObject *__pyx_pf_5pysam_7libcbcf_21VariantHeaderMetadata_33values(struct __pyx_obj_5pysam_7libcbcf_VariantHeaderMetadata *__pyx_v_self) {
  PyObject *__pyx_r = NULL;
  __Pyx_TraceDeclarationsFunc
  __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_TraceFrameInit(((PyObject *)__pyx_mstate_global->__pyx_codeobj_tab[93]))
  __Pyx_RefNannySetupContext("values", 0);
  __Pyx_TraceStartFunc("values", __pyx_f[0], 1690, 0, 0, 0, __PYX_ERR(0, 1690, __pyx_L1_error));

  /* "pysam/libcbcf.pyx":1692
 *     def values(self):
 *         """D.values() -> list of D's values"""
 *         return list(self.itervalues())             # <<<<<<<<<<<<<<
 * 
 *     # Mappings are not hashable by default, but subclasses can change this
*/
  __Pyx_XDECREF(__pyx_r);
  __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(__pyx_mstate_global->__pyx_n_u_itervalues, __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, 1692, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
  }
  __pyx_t_2 = __Pyx_PySequence_ListKeepNew(__pyx_t_1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1692, __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;
  __Pyx_TraceReturnValue(__pyx_r, 1, 0, __PYX_ERR(0, 1692, __pyx_L1_error));
  goto __pyx_L0;

  /* "pysam/libcbcf.pyx":1690
 *         return list(self.iteritems())
 * 
 *     def values(self):             # <<<<<<<<<<<<<<
 *         """D.values() -> list of D's values"""
 *         return list(self.itervalues())
*/

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_TraceException(__pyx_lineno, 0, 0);
  #if CYTHON_USE_SYS_MONITORING
  __Pyx_TraceExceptionUnwind(0, 0);
  #else
  __Pyx_TraceReturnValue(NULL, 0, 0, __PYX_ERR(0, 1690, __pyx_L1_error));
  #endif
  __Pyx_AddTraceback("pysam.libcbcf.VariantHeaderMetadata.values", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_PyMonitoring_ExitScope(0);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "pysam/libcbcf.pxd":76
 * 
 * cdef class VariantHeaderMetadata(object):
 *     cdef readonly VariantHeader header             # <<<<<<<<<<<<<<
 *     cdef int32_t type
 * 
*/

/* Python wrapper */
static PyObject *__pyx_pw_5pysam_7libcbcf_21VariantHeaderMetadata_6header_1__get__(PyObject *__pyx_v_self); /*proto*/
static PyObject *__pyx_pw_5pysam_7libcbcf_21VariantHeaderMetadata_6header_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_5pysam_7libcbcf_21VariantHeaderMetadata_6header___get__(((struct __pyx_obj_5pysam_7libcbcf_VariantHeaderMetadata *)__pyx_v_self));

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

static PyObject *__pyx_pf_5pysam_7libcbcf_21VariantHeaderMetadata_6header___get__(struct __pyx_obj_5pysam_7libcbcf_VariantHeaderMetadata *__pyx_v_self) {
  PyObject *__pyx_r = NULL;
  __Pyx_TraceDeclarationsFunc
  __Pyx_RefNannyDeclarations
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_TraceFrameInit(((PyObject *)__pyx_mstate_global->__pyx_codeobj_tab[94]))
  __Pyx_RefNannySetupContext("__get__", 0);
  __Pyx_TraceStartFunc("__get__", __pyx_f[3], 76, 0, 0, 0, __PYX_ERR(3, 76, __pyx_L1_error));
  __Pyx_XDECREF(__pyx_r);
  __Pyx_INCREF((PyObject *)__pyx_v_self->header);
  __pyx_r = ((PyObject *)__pyx_v_self->header);
  __Pyx_TraceReturnValue(__pyx_r, 0, 0, __PYX_ERR(3, 76, __pyx_L1_error));
  goto __pyx_L0;

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_TraceException(__pyx_lineno, 0, 0);
  #if CYTHON_USE_SYS_MONITORING
  __Pyx_TraceExceptionUnwind(0, 0);
  #else
  __Pyx_TraceReturnValue(NULL, 0, 0, __PYX_ERR(3, 76, __pyx_L1_error));
  #endif
  __Pyx_AddTraceback("pysam.libcbcf.VariantHeaderMetadata.header.__get__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_PyMonitoring_ExitScope(0);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

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

/* Python wrapper */
static PyObject *__pyx_pw_5pysam_7libcbcf_21VariantHeaderMetadata_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*/
PyDoc_STRVAR(__pyx_doc_5pysam_7libcbcf_21VariantHeaderMetadata_35__reduce_cython__, "VariantHeaderMetadata.__reduce_cython__(self)");
static PyMethodDef __pyx_mdef_5pysam_7libcbcf_21VariantHeaderMetadata_36__reduce_cython__ = {"__reduce_cython__", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_5pysam_7libcbcf_21VariantHeaderMetadata_36__reduce_cython__, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_5pysam_7libcbcf_21VariantHeaderMetadata_35__reduce_cython__};
static PyObject *__pyx_pw_5pysam_7libcbcf_21VariantHeaderMetadata_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_5pysam_7libcbcf_21VariantHeaderMetadata_35__reduce_cython__(((struct __pyx_obj_5pysam_7libcbcf_VariantHeaderMetadata *)__pyx_v_self));

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

static PyObject *__pyx_pf_5pysam_7libcbcf_21VariantHeaderMetadata_35__reduce_cython__(struct __pyx_obj_5pysam_7libcbcf_VariantHeaderMetadata *__pyx_v_self) {
  PyObject *__pyx_v_state = 0;
  PyObject *__pyx_v__dict = 0;
  int __pyx_v_use_setstate;
  PyObject *__pyx_r = NULL;
  __Pyx_TraceDeclarationsFunc
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  int __pyx_t_3;
  PyObject *__pyx_t_4 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_TraceFrameInit(((PyObject *)__pyx_mstate_global->__pyx_codeobj_tab[95]))
  __Pyx_RefNannySetupContext("__reduce_cython__", 0);
  __Pyx_TraceStartFunc("__reduce_cython__", __pyx_f[4], 1, 0, 0, 0, __PYX_ERR(4, 1, __pyx_L1_error));

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

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

  /* "(tree fragment)":7
 *     state = (self.header, self.type)
 *     _dict = getattr(self, '__dict__', None)
 *     if _dict is not None:             # <<<<<<<<<<<<<<
 *         state += (_dict,)
 *         use_setstate = True
*/
  __pyx_t_3 = (__pyx_v__dict != Py_None);
  if (__pyx_t_3) {

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

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

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

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

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

    /* "(tree fragment)":13
 *         use_setstate = self.header is not None
 *     if use_setstate:
 *         return __pyx_unpickle_VariantHeaderMetadata, (type(self), 0x816ca43, None), state             # <<<<<<<<<<<<<<
 *     else:
 *         return __pyx_unpickle_VariantHeaderMetadata, (type(self), 0x816ca43, state)
*/
    __Pyx_XDECREF(__pyx_r);
    __Pyx_GetModuleGlobalName(__pyx_t_1, __pyx_mstate_global->__pyx_n_u_pyx_unpickle_VariantHeaderMeta); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 13, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __pyx_t_2 = PyTuple_New(3); if (unlikely(!__pyx_t_2)) __PYX_ERR(4, 13, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __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_2, 0, ((PyObject *)Py_TYPE(((PyObject *)__pyx_v_self)))) != (0)) __PYX_ERR(4, 13, __pyx_L1_error);
    __Pyx_INCREF(__pyx_mstate_global->__pyx_int_135711299);
    __Pyx_GIVEREF(__pyx_mstate_global->__pyx_int_135711299);
    if (__Pyx_PyTuple_SET_ITEM(__pyx_t_2, 1, __pyx_mstate_global->__pyx_int_135711299) != (0)) __PYX_ERR(4, 13, __pyx_L1_error);
    __Pyx_INCREF(Py_None);
    __Pyx_GIVEREF(Py_None);
    if (__Pyx_PyTuple_SET_ITEM(__pyx_t_2, 2, Py_None) != (0)) __PYX_ERR(4, 13, __pyx_L1_error);
    __pyx_t_4 = PyTuple_New(3); if (unlikely(!__pyx_t_4)) __PYX_ERR(4, 13, __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(4, 13, __pyx_L1_error);
    __Pyx_GIVEREF(__pyx_t_2);
    if (__Pyx_PyTuple_SET_ITEM(__pyx_t_4, 1, __pyx_t_2) != (0)) __PYX_ERR(4, 13, __pyx_L1_error);
    __Pyx_INCREF(__pyx_v_state);
    __Pyx_GIVEREF(__pyx_v_state);
    if (__Pyx_PyTuple_SET_ITEM(__pyx_t_4, 2, __pyx_v_state) != (0)) __PYX_ERR(4, 13, __pyx_L1_error);
    __pyx_t_1 = 0;
    __pyx_t_2 = 0;
    __pyx_r = __pyx_t_4;
    __pyx_t_4 = 0;
    __Pyx_TraceReturnValue(__pyx_r, 27, 0, __PYX_ERR(4, 13, __pyx_L1_error));
    goto __pyx_L0;

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

  /* "(tree fragment)":15
 *         return __pyx_unpickle_VariantHeaderMetadata, (type(self), 0x816ca43, None), state
 *     else:
 *         return __pyx_unpickle_VariantHeaderMetadata, (type(self), 0x816ca43, state)             # <<<<<<<<<<<<<<
 * def __setstate_cython__(self, __pyx_state):
 *     __pyx_unpickle_VariantHeaderMetadata__set_state(self, __pyx_state)
*/
  /*else*/ {
    __Pyx_XDECREF(__pyx_r);
    __Pyx_GetModuleGlobalName(__pyx_t_4, __pyx_mstate_global->__pyx_n_u_pyx_unpickle_VariantHeaderMeta); if (unlikely(!__pyx_t_4)) __PYX_ERR(4, 15, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
    __pyx_t_2 = PyTuple_New(3); if (unlikely(!__pyx_t_2)) __PYX_ERR(4, 15, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __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_2, 0, ((PyObject *)Py_TYPE(((PyObject *)__pyx_v_self)))) != (0)) __PYX_ERR(4, 15, __pyx_L1_error);
    __Pyx_INCREF(__pyx_mstate_global->__pyx_int_135711299);
    __Pyx_GIVEREF(__pyx_mstate_global->__pyx_int_135711299);
    if (__Pyx_PyTuple_SET_ITEM(__pyx_t_2, 1, __pyx_mstate_global->__pyx_int_135711299) != (0)) __PYX_ERR(4, 15, __pyx_L1_error);
    __Pyx_INCREF(__pyx_v_state);
    __Pyx_GIVEREF(__pyx_v_state);
    if (__Pyx_PyTuple_SET_ITEM(__pyx_t_2, 2, __pyx_v_state) != (0)) __PYX_ERR(4, 15, __pyx_L1_error);
    __pyx_t_1 = PyTuple_New(2); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 15, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_GIVEREF(__pyx_t_4);
    if (__Pyx_PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_t_4) != (0)) __PYX_ERR(4, 15, __pyx_L1_error);
    __Pyx_GIVEREF(__pyx_t_2);
    if (__Pyx_PyTuple_SET_ITEM(__pyx_t_1, 1, __pyx_t_2) != (0)) __PYX_ERR(4, 15, __pyx_L1_error);
    __pyx_t_4 = 0;
    __pyx_t_2 = 0;
    __pyx_r = __pyx_t_1;
    __pyx_t_1 = 0;
    __Pyx_TraceReturnValue(__pyx_r, 35, 0, __PYX_ERR(4, 15, __pyx_L1_error));
    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_2);
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_TraceException(__pyx_lineno, 0, 0);
  #if CYTHON_USE_SYS_MONITORING
  __Pyx_TraceExceptionUnwind(0, 0);
  #else
  __Pyx_TraceReturnValue(NULL, 0, 0, __PYX_ERR(4, 1, __pyx_L1_error));
  #endif
  __Pyx_AddTraceback("pysam.libcbcf.VariantHeaderMetadata.__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_PyMonitoring_ExitScope(0);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "(tree fragment)":16
 *     else:
 *         return __pyx_unpickle_VariantHeaderMetadata, (type(self), 0x816ca43, state)
 * def __setstate_cython__(self, __pyx_state):             # <<<<<<<<<<<<<<
 *     __pyx_unpickle_VariantHeaderMetadata__set_state(self, __pyx_state)
*/

/* Python wrapper */
static PyObject *__pyx_pw_5pysam_7libcbcf_21VariantHeaderMetadata_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*/
PyDoc_STRVAR(__pyx_doc_5pysam_7libcbcf_21VariantHeaderMetadata_37__setstate_cython__, "VariantHeaderMetadata.__setstate_cython__(self, __pyx_state)");
static PyMethodDef __pyx_mdef_5pysam_7libcbcf_21VariantHeaderMetadata_38__setstate_cython__ = {"__setstate_cython__", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_5pysam_7libcbcf_21VariantHeaderMetadata_38__setstate_cython__, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_5pysam_7libcbcf_21VariantHeaderMetadata_37__setstate_cython__};
static PyObject *__pyx_pw_5pysam_7libcbcf_21VariantHeaderMetadata_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
) {
  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(4, 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(4, 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(4, 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(4, 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(4, 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(4, 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("pysam.libcbcf.VariantHeaderMetadata.__setstate_cython__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_5pysam_7libcbcf_21VariantHeaderMetadata_37__setstate_cython__(((struct __pyx_obj_5pysam_7libcbcf_VariantHeaderMetadata *)__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_5pysam_7libcbcf_21VariantHeaderMetadata_37__setstate_cython__(struct __pyx_obj_5pysam_7libcbcf_VariantHeaderMetadata *__pyx_v_self, PyObject *__pyx_v___pyx_state) {
  PyObject *__pyx_r = NULL;
  __Pyx_TraceDeclarationsFunc
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_TraceFrameInit(((PyObject *)__pyx_mstate_global->__pyx_codeobj_tab[96]))
  __Pyx_RefNannySetupContext("__setstate_cython__", 0);
  __Pyx_TraceStartFunc("__setstate_cython__", __pyx_f[4], 16, 0, 0, 0, __PYX_ERR(4, 16, __pyx_L1_error));

  /* "(tree fragment)":17
 *         return __pyx_unpickle_VariantHeaderMetadata, (type(self), 0x816ca43, state)
 * def __setstate_cython__(self, __pyx_state):
 *     __pyx_unpickle_VariantHeaderMetadata__set_state(self, __pyx_state)             # <<<<<<<<<<<<<<
*/
  if (!(likely(PyTuple_CheckExact(__pyx_v___pyx_state))||((__pyx_v___pyx_state) == Py_None) || __Pyx_RaiseUnexpectedTypeError("tuple", __pyx_v___pyx_state))) __PYX_ERR(4, 17, __pyx_L1_error)
  __pyx_t_1 = __pyx_f_5pysam_7libcbcf___pyx_unpickle_VariantHeaderMetadata__set_state(__pyx_v_self, ((PyObject*)__pyx_v___pyx_state)); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 17, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "(tree fragment)":16
 *     else:
 *         return __pyx_unpickle_VariantHeaderMetadata, (type(self), 0x816ca43, state)
 * def __setstate_cython__(self, __pyx_state):             # <<<<<<<<<<<<<<
 *     __pyx_unpickle_VariantHeaderMetadata__set_state(self, __pyx_state)
*/

  /* function exit code */
  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  __Pyx_TraceReturnValue(__pyx_r, 0, 0, __PYX_ERR(4, 16, __pyx_L1_error));
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_TraceException(__pyx_lineno, 0, 0);
  #if CYTHON_USE_SYS_MONITORING
  __Pyx_TraceExceptionUnwind(0, 0);
  #else
  __Pyx_TraceReturnValue(NULL, 0, 0, __PYX_ERR(4, 16, __pyx_L1_error));
  #endif
  __Pyx_AddTraceback("pysam.libcbcf.VariantHeaderMetadata.__setstate_cython__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_PyMonitoring_ExitScope(0);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "pysam/libcbcf.pyx":1700
 * 
 * 
 * cdef VariantHeaderMetadata makeVariantHeaderMetadata(VariantHeader header, int32_t type):             # <<<<<<<<<<<<<<
 *     if not header:
 *         raise ValueError('invalid VariantHeader')
*/

static struct __pyx_obj_5pysam_7libcbcf_VariantHeaderMetadata *__pyx_f_5pysam_7libcbcf_makeVariantHeaderMetadata(struct __pyx_obj_5pysam_7libcbcf_VariantHeader *__pyx_v_header, int32_t __pyx_v_type) {
  struct __pyx_obj_5pysam_7libcbcf_VariantHeaderMetadata *__pyx_v_meta = 0;
  struct __pyx_obj_5pysam_7libcbcf_VariantHeaderMetadata *__pyx_r = NULL;
  __Pyx_TraceDeclarationsFunc
  __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_TraceFrameInit(((PyObject *)__pyx_mstate_global->__pyx_codeobj_tab[97]))
  __Pyx_RefNannySetupContext("makeVariantHeaderMetadata", 0);
  __Pyx_TraceStartFunc("makeVariantHeaderMetadata", __pyx_f[0], 1700, 0, 0, 0, __PYX_ERR(0, 1700, __pyx_L1_error));

  /* "pysam/libcbcf.pyx":1701
 * 
 * cdef VariantHeaderMetadata makeVariantHeaderMetadata(VariantHeader header, int32_t type):
 *     if not header:             # <<<<<<<<<<<<<<
 *         raise ValueError('invalid VariantHeader')
 * 
*/
  __pyx_t_1 = __Pyx_PyObject_IsTrue(((PyObject *)__pyx_v_header)); if (unlikely((__pyx_t_1 < 0))) __PYX_ERR(0, 1701, __pyx_L1_error)
  __pyx_t_2 = (!__pyx_t_1);
  if (unlikely(__pyx_t_2)) {

    /* "pysam/libcbcf.pyx":1702
 * cdef VariantHeaderMetadata makeVariantHeaderMetadata(VariantHeader header, int32_t type):
 *     if not header:
 *         raise ValueError('invalid VariantHeader')             # <<<<<<<<<<<<<<
 * 
 *     cdef VariantHeaderMetadata meta = VariantHeaderMetadata.__new__(VariantHeaderMetadata)
*/
    __pyx_t_4 = NULL;
    __Pyx_INCREF(__pyx_builtin_ValueError);
    __pyx_t_5 = __pyx_builtin_ValueError; 
    __pyx_t_6 = 1;
    {
      PyObject *__pyx_callargs[2] = {__pyx_t_4, __pyx_mstate_global->__pyx_kp_u_invalid_VariantHeader};
      __pyx_t_3 = __Pyx_PyObject_FastCall(__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, 1702, __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, 1702, __pyx_L1_error)

    /* "pysam/libcbcf.pyx":1701
 * 
 * cdef VariantHeaderMetadata makeVariantHeaderMetadata(VariantHeader header, int32_t type):
 *     if not header:             # <<<<<<<<<<<<<<
 *         raise ValueError('invalid VariantHeader')
 * 
*/
  }

  /* "pysam/libcbcf.pyx":1704
 *         raise ValueError('invalid VariantHeader')
 * 
 *     cdef VariantHeaderMetadata meta = VariantHeaderMetadata.__new__(VariantHeaderMetadata)             # <<<<<<<<<<<<<<
 *     meta.header = header
 *     meta.type = type
*/
  __pyx_t_3 = ((PyObject *)__pyx_tp_new_5pysam_7libcbcf_VariantHeaderMetadata(((PyTypeObject *)__pyx_mstate_global->__pyx_ptype_5pysam_7libcbcf_VariantHeaderMetadata), __pyx_mstate_global->__pyx_empty_tuple, NULL)); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1704, __pyx_L1_error)
  __Pyx_GOTREF((PyObject *)__pyx_t_3);
  __pyx_v_meta = ((struct __pyx_obj_5pysam_7libcbcf_VariantHeaderMetadata *)__pyx_t_3);
  __pyx_t_3 = 0;

  /* "pysam/libcbcf.pyx":1705
 * 
 *     cdef VariantHeaderMetadata meta = VariantHeaderMetadata.__new__(VariantHeaderMetadata)
 *     meta.header = header             # <<<<<<<<<<<<<<
 *     meta.type = type
 * 
*/
  __Pyx_INCREF((PyObject *)__pyx_v_header);
  __Pyx_GIVEREF((PyObject *)__pyx_v_header);
  __Pyx_GOTREF((PyObject *)__pyx_v_meta->header);
  __Pyx_DECREF((PyObject *)__pyx_v_meta->header);
  __pyx_v_meta->header = __pyx_v_header;

  /* "pysam/libcbcf.pyx":1706
 *     cdef VariantHeaderMetadata meta = VariantHeaderMetadata.__new__(VariantHeaderMetadata)
 *     meta.header = header
 *     meta.type = type             # <<<<<<<<<<<<<<
 * 
 *     return meta
*/
  __pyx_v_meta->type = __pyx_v_type;

  /* "pysam/libcbcf.pyx":1708
 *     meta.type = type
 * 
 *     return meta             # <<<<<<<<<<<<<<
 * 
 * 
*/
  __Pyx_XDECREF((PyObject *)__pyx_r);
  __Pyx_INCREF((PyObject *)__pyx_v_meta);
  __pyx_r = __pyx_v_meta;
  __Pyx_TraceReturnValue((PyObject *)__pyx_r, 19, 0, __PYX_ERR(0, 1708, __pyx_L1_error));
  goto __pyx_L0;

  /* "pysam/libcbcf.pyx":1700
 * 
 * 
 * cdef VariantHeaderMetadata makeVariantHeaderMetadata(VariantHeader header, int32_t type):             # <<<<<<<<<<<<<<
 *     if not header:
 *         raise ValueError('invalid VariantHeader')
*/

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_XDECREF(__pyx_t_5);
  __Pyx_TraceException(__pyx_lineno, 0, 0);
  #if CYTHON_USE_SYS_MONITORING
  __Pyx_TraceExceptionUnwind(0, 0);
  #else
  __Pyx_TraceReturnValue(NULL, 0, 0, __PYX_ERR(0, 1700, __pyx_L1_error));
  #endif
  __Pyx_AddTraceback("pysam.libcbcf.makeVariantHeaderMetadata", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_XDECREF((PyObject *)__pyx_v_meta);
  __Pyx_XGIVEREF((PyObject *)__pyx_r);
  __Pyx_PyMonitoring_ExitScope(0);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "pysam/libcbcf.pyx":1713
 * cdef class VariantContig(object):
 *     """contig metadata from a :class:`VariantHeader`"""
 *     def __init__(self, *args, **kwargs):             # <<<<<<<<<<<<<<
 *         raise TypeError('this class cannot be instantiated from Python')
 * 
*/

/* Python wrapper */
static int __pyx_pw_5pysam_7libcbcf_13VariantContig_1__init__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static int __pyx_pw_5pysam_7libcbcf_13VariantContig_1__init__(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("__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);
  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("__init__", __pyx_kwds) == -1)) return -1;
  }
  __Pyx_INCREF(__pyx_args);
  __pyx_v_args = __pyx_args;
  __pyx_r = __pyx_pf_5pysam_7libcbcf_13VariantContig___init__(((struct __pyx_obj_5pysam_7libcbcf_VariantContig *)__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_5pysam_7libcbcf_13VariantContig___init__(CYTHON_UNUSED struct __pyx_obj_5pysam_7libcbcf_VariantContig *__pyx_v_self, CYTHON_UNUSED PyObject *__pyx_v_args, CYTHON_UNUSED PyObject *__pyx_v_kwargs) {
  int __pyx_r;
  __Pyx_TraceDeclarationsFunc
  __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_TraceFrameInit(((PyObject *)__pyx_mstate_global->__pyx_codeobj_tab[98]))
  __Pyx_RefNannySetupContext("__init__", 0);
  __Pyx_TraceStartFunc("__init__", __pyx_f[0], 1713, 0, 0, 0, __PYX_ERR(0, 1713, __pyx_L1_error));

  /* "pysam/libcbcf.pyx":1714
 *     """contig metadata from a :class:`VariantHeader`"""
 *     def __init__(self, *args, **kwargs):
 *         raise TypeError('this class cannot be instantiated from Python')             # <<<<<<<<<<<<<<
 * 
 *     @property
*/
  __pyx_t_2 = NULL;
  __Pyx_INCREF(__pyx_builtin_TypeError);
  __pyx_t_3 = __pyx_builtin_TypeError; 
  __pyx_t_4 = 1;
  {
    PyObject *__pyx_callargs[2] = {__pyx_t_2, __pyx_mstate_global->__pyx_kp_u_this_class_cannot_be_instantiate};
    __pyx_t_1 = __Pyx_PyObject_FastCall(__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, 1714, __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, 1714, __pyx_L1_error)

  /* "pysam/libcbcf.pyx":1713
 * cdef class VariantContig(object):
 *     """contig metadata from a :class:`VariantHeader`"""
 *     def __init__(self, *args, **kwargs):             # <<<<<<<<<<<<<<
 *         raise TypeError('this class cannot be instantiated from Python')
 * 
*/

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_TraceException(__pyx_lineno, 0, 0);
  #if CYTHON_USE_SYS_MONITORING
  __Pyx_TraceExceptionUnwind(0, 0);
  #else
  __Pyx_TraceReturnValue(NULL, 0, 0, __PYX_ERR(0, 1713, __pyx_L1_error));
  #endif
  __Pyx_AddTraceback("pysam.libcbcf.VariantContig.__init__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = -1;
  __Pyx_PyMonitoring_ExitScope(0);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "pysam/libcbcf.pyx":1716
 *         raise TypeError('this class cannot be instantiated from Python')
 * 
 *     @property             # <<<<<<<<<<<<<<
 *     def name(self):
 *         """contig name"""
*/

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

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

static PyObject *__pyx_pf_5pysam_7libcbcf_13VariantContig_4name___get__(struct __pyx_obj_5pysam_7libcbcf_VariantContig *__pyx_v_self) {
  bcf_hdr_t *__pyx_v_hdr;
  PyObject *__pyx_r = NULL;
  __Pyx_TraceDeclarationsFunc
  __Pyx_RefNannyDeclarations
  bcf_hdr_t *__pyx_t_1;
  PyObject *__pyx_t_2 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_TraceFrameInit(((PyObject *)__pyx_mstate_global->__pyx_codeobj_tab[99]))
  __Pyx_RefNannySetupContext("__get__", 0);
  __Pyx_TraceStartFunc("__get__", __pyx_f[0], 1716, 0, 0, 0, __PYX_ERR(0, 1716, __pyx_L1_error));

  /* "pysam/libcbcf.pyx":1719
 *     def name(self):
 *         """contig name"""
 *         cdef bcf_hdr_t *hdr = self.header.ptr             # <<<<<<<<<<<<<<
 *         return bcf_str_cache_get_charptr(hdr.id[BCF_DT_CTG][self.id].key)
 * 
*/
  __pyx_t_1 = __pyx_v_self->header->ptr;
  __pyx_v_hdr = __pyx_t_1;

  /* "pysam/libcbcf.pyx":1720
 *         """contig name"""
 *         cdef bcf_hdr_t *hdr = self.header.ptr
 *         return bcf_str_cache_get_charptr(hdr.id[BCF_DT_CTG][self.id].key)             # <<<<<<<<<<<<<<
 * 
 *     @property
*/
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_2 = __pyx_f_5pysam_7libcbcf_bcf_str_cache_get_charptr(((__pyx_v_hdr->id[BCF_DT_CTG])[__pyx_v_self->id]).key); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1720, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_r = __pyx_t_2;
  __pyx_t_2 = 0;
  __Pyx_TraceReturnValue(__pyx_r, 5, 0, __PYX_ERR(0, 1720, __pyx_L1_error));
  goto __pyx_L0;

  /* "pysam/libcbcf.pyx":1716
 *         raise TypeError('this class cannot be instantiated from Python')
 * 
 *     @property             # <<<<<<<<<<<<<<
 *     def name(self):
 *         """contig name"""
*/

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_TraceException(__pyx_lineno, 0, 0);
  #if CYTHON_USE_SYS_MONITORING
  __Pyx_TraceExceptionUnwind(0, 0);
  #else
  __Pyx_TraceReturnValue(NULL, 0, 0, __PYX_ERR(0, 1716, __pyx_L1_error));
  #endif
  __Pyx_AddTraceback("pysam.libcbcf.VariantContig.name.__get__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_PyMonitoring_ExitScope(0);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "pysam/libcbcf.pyx":1722
 *         return bcf_str_cache_get_charptr(hdr.id[BCF_DT_CTG][self.id].key)
 * 
 *     @property             # <<<<<<<<<<<<<<
 *     def id(self):
 *         """contig internal id number"""
*/

/* Python wrapper */
static PyObject *__pyx_pw_5pysam_7libcbcf_13VariantContig_2id_1__get__(PyObject *__pyx_v_self); /*proto*/
static PyObject *__pyx_pw_5pysam_7libcbcf_13VariantContig_2id_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_5pysam_7libcbcf_13VariantContig_2id___get__(((struct __pyx_obj_5pysam_7libcbcf_VariantContig *)__pyx_v_self));

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

static PyObject *__pyx_pf_5pysam_7libcbcf_13VariantContig_2id___get__(struct __pyx_obj_5pysam_7libcbcf_VariantContig *__pyx_v_self) {
  PyObject *__pyx_r = NULL;
  __Pyx_TraceDeclarationsFunc
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_TraceFrameInit(((PyObject *)__pyx_mstate_global->__pyx_codeobj_tab[100]))
  __Pyx_RefNannySetupContext("__get__", 0);
  __Pyx_TraceStartFunc("__get__", __pyx_f[0], 1722, 0, 0, 0, __PYX_ERR(0, 1722, __pyx_L1_error));

  /* "pysam/libcbcf.pyx":1725
 *     def id(self):
 *         """contig internal id number"""
 *         return self.id             # <<<<<<<<<<<<<<
 * 
 *     @property
*/
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = __Pyx_PyLong_From_int(__pyx_v_self->id); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1725, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  __Pyx_TraceReturnValue(__pyx_r, 1, 0, __PYX_ERR(0, 1725, __pyx_L1_error));
  goto __pyx_L0;

  /* "pysam/libcbcf.pyx":1722
 *         return bcf_str_cache_get_charptr(hdr.id[BCF_DT_CTG][self.id].key)
 * 
 *     @property             # <<<<<<<<<<<<<<
 *     def id(self):
 *         """contig internal id number"""
*/

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_TraceException(__pyx_lineno, 0, 0);
  #if CYTHON_USE_SYS_MONITORING
  __Pyx_TraceExceptionUnwind(0, 0);
  #else
  __Pyx_TraceReturnValue(NULL, 0, 0, __PYX_ERR(0, 1722, __pyx_L1_error));
  #endif
  __Pyx_AddTraceback("pysam.libcbcf.VariantContig.id.__get__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_PyMonitoring_ExitScope(0);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "pysam/libcbcf.pyx":1727
 *         return self.id
 * 
 *     @property             # <<<<<<<<<<<<<<
 *     def length(self):
 *         """contig length or None if not available"""
*/

/* Python wrapper */
static PyObject *__pyx_pw_5pysam_7libcbcf_13VariantContig_6length_1__get__(PyObject *__pyx_v_self); /*proto*/
static PyObject *__pyx_pw_5pysam_7libcbcf_13VariantContig_6length_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_5pysam_7libcbcf_13VariantContig_6length___get__(((struct __pyx_obj_5pysam_7libcbcf_VariantContig *)__pyx_v_self));

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

static PyObject *__pyx_pf_5pysam_7libcbcf_13VariantContig_6length___get__(struct __pyx_obj_5pysam_7libcbcf_VariantContig *__pyx_v_self) {
  bcf_hdr_t *__pyx_v_hdr;
  uint32_t __pyx_v_length;
  PyObject *__pyx_r = NULL;
  __Pyx_TraceDeclarationsFunc
  __Pyx_RefNannyDeclarations
  bcf_hdr_t *__pyx_t_1;
  PyObject *__pyx_t_2 = NULL;
  int __pyx_t_3;
  PyObject *__pyx_t_4 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_TraceFrameInit(((PyObject *)__pyx_mstate_global->__pyx_codeobj_tab[101]))
  __Pyx_RefNannySetupContext("__get__", 0);
  __Pyx_TraceStartFunc("__get__", __pyx_f[0], 1727, 0, 0, 0, __PYX_ERR(0, 1727, __pyx_L1_error));

  /* "pysam/libcbcf.pyx":1730
 *     def length(self):
 *         """contig length or None if not available"""
 *         cdef bcf_hdr_t *hdr = self.header.ptr             # <<<<<<<<<<<<<<
 *         cdef uint32_t length = hdr.id[BCF_DT_CTG][self.id].val.info[0]
 *         return length if length else None
*/
  __pyx_t_1 = __pyx_v_self->header->ptr;
  __pyx_v_hdr = __pyx_t_1;

  /* "pysam/libcbcf.pyx":1731
 *         """contig length or None if not available"""
 *         cdef bcf_hdr_t *hdr = self.header.ptr
 *         cdef uint32_t length = hdr.id[BCF_DT_CTG][self.id].val.info[0]             # <<<<<<<<<<<<<<
 *         return length if length else None
 * 
*/
  __pyx_v_length = (((__pyx_v_hdr->id[BCF_DT_CTG])[__pyx_v_self->id]).val->info[0]);

  /* "pysam/libcbcf.pyx":1732
 *         cdef bcf_hdr_t *hdr = self.header.ptr
 *         cdef uint32_t length = hdr.id[BCF_DT_CTG][self.id].val.info[0]
 *         return length if length else None             # <<<<<<<<<<<<<<
 * 
 *     @property
*/
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_3 = (__pyx_v_length != 0);
  if (__pyx_t_3) {
    __pyx_t_4 = __Pyx_PyLong_From_uint32_t(__pyx_v_length); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1732, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
    __pyx_t_2 = __pyx_t_4;
    __pyx_t_4 = 0;
  } else {
    __Pyx_INCREF(Py_None);
    __pyx_t_2 = Py_None;
  }
  __pyx_r = __pyx_t_2;
  __pyx_t_2 = 0;
  __Pyx_TraceReturnValue(__pyx_r, 17, 0, __PYX_ERR(0, 1732, __pyx_L1_error));
  goto __pyx_L0;

  /* "pysam/libcbcf.pyx":1727
 *         return self.id
 * 
 *     @property             # <<<<<<<<<<<<<<
 *     def length(self):
 *         """contig length or None if not available"""
*/

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_TraceException(__pyx_lineno, 0, 0);
  #if CYTHON_USE_SYS_MONITORING
  __Pyx_TraceExceptionUnwind(0, 0);
  #else
  __Pyx_TraceReturnValue(NULL, 0, 0, __PYX_ERR(0, 1727, __pyx_L1_error));
  #endif
  __Pyx_AddTraceback("pysam.libcbcf.VariantContig.length.__get__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_PyMonitoring_ExitScope(0);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "pysam/libcbcf.pyx":1734
 *         return length if length else None
 * 
 *     @property             # <<<<<<<<<<<<<<
 *     def header_record(self):
 *         """:class:`VariantHeaderRecord` associated with this :class:`VariantContig` object"""
*/

/* Python wrapper */
static PyObject *__pyx_pw_5pysam_7libcbcf_13VariantContig_13header_record_1__get__(PyObject *__pyx_v_self); /*proto*/
static PyObject *__pyx_pw_5pysam_7libcbcf_13VariantContig_13header_record_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_5pysam_7libcbcf_13VariantContig_13header_record___get__(((struct __pyx_obj_5pysam_7libcbcf_VariantContig *)__pyx_v_self));

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

static PyObject *__pyx_pf_5pysam_7libcbcf_13VariantContig_13header_record___get__(struct __pyx_obj_5pysam_7libcbcf_VariantContig *__pyx_v_self) {
  bcf_hdr_t *__pyx_v_hdr;
  bcf_hrec_t *__pyx_v_hrec;
  PyObject *__pyx_r = NULL;
  __Pyx_TraceDeclarationsFunc
  __Pyx_RefNannyDeclarations
  bcf_hdr_t *__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_TraceFrameInit(((PyObject *)__pyx_mstate_global->__pyx_codeobj_tab[102]))
  __Pyx_RefNannySetupContext("__get__", 0);
  __Pyx_TraceStartFunc("__get__", __pyx_f[0], 1734, 0, 0, 0, __PYX_ERR(0, 1734, __pyx_L1_error));

  /* "pysam/libcbcf.pyx":1737
 *     def header_record(self):
 *         """:class:`VariantHeaderRecord` associated with this :class:`VariantContig` object"""
 *         cdef bcf_hdr_t *hdr = self.header.ptr             # <<<<<<<<<<<<<<
 *         cdef bcf_hrec_t *hrec = hdr.id[BCF_DT_CTG][self.id].val.hrec[0]
 *         return makeVariantHeaderRecord(self.header, hrec)
*/
  __pyx_t_1 = __pyx_v_self->header->ptr;
  __pyx_v_hdr = __pyx_t_1;

  /* "pysam/libcbcf.pyx":1738
 *         """:class:`VariantHeaderRecord` associated with this :class:`VariantContig` object"""
 *         cdef bcf_hdr_t *hdr = self.header.ptr
 *         cdef bcf_hrec_t *hrec = hdr.id[BCF_DT_CTG][self.id].val.hrec[0]             # <<<<<<<<<<<<<<
 *         return makeVariantHeaderRecord(self.header, hrec)
 * 
*/
  __pyx_v_hrec = (((__pyx_v_hdr->id[BCF_DT_CTG])[__pyx_v_self->id]).val->hrec[0]);

  /* "pysam/libcbcf.pyx":1739
 *         cdef bcf_hdr_t *hdr = self.header.ptr
 *         cdef bcf_hrec_t *hrec = hdr.id[BCF_DT_CTG][self.id].val.hrec[0]
 *         return makeVariantHeaderRecord(self.header, hrec)             # <<<<<<<<<<<<<<
 * 
 *     def remove_header(self):
*/
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_2 = ((PyObject *)__pyx_v_self->header);
  __Pyx_INCREF(__pyx_t_2);
  __pyx_t_3 = ((PyObject *)__pyx_f_5pysam_7libcbcf_makeVariantHeaderRecord(((struct __pyx_obj_5pysam_7libcbcf_VariantHeader *)__pyx_t_2), __pyx_v_hrec)); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1739, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __pyx_r = __pyx_t_3;
  __pyx_t_3 = 0;
  __Pyx_TraceReturnValue(__pyx_r, 17, 0, __PYX_ERR(0, 1739, __pyx_L1_error));
  goto __pyx_L0;

  /* "pysam/libcbcf.pyx":1734
 *         return length if length else None
 * 
 *     @property             # <<<<<<<<<<<<<<
 *     def header_record(self):
 *         """:class:`VariantHeaderRecord` associated with this :class:`VariantContig` object"""
*/

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_TraceException(__pyx_lineno, 0, 0);
  #if CYTHON_USE_SYS_MONITORING
  __Pyx_TraceExceptionUnwind(0, 0);
  #else
  __Pyx_TraceReturnValue(NULL, 0, 0, __PYX_ERR(0, 1734, __pyx_L1_error));
  #endif
  __Pyx_AddTraceback("pysam.libcbcf.VariantContig.header_record.__get__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_PyMonitoring_ExitScope(0);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "pysam/libcbcf.pyx":1741
 *         return makeVariantHeaderRecord(self.header, hrec)
 * 
 *     def remove_header(self):             # <<<<<<<<<<<<<<
 *         cdef bcf_hdr_t *hdr = self.header.ptr
 *         cdef const char *key = hdr.id[BCF_DT_CTG][self.id].key
*/

/* Python wrapper */
static PyObject *__pyx_pw_5pysam_7libcbcf_13VariantContig_3remove_header(PyObject *__pyx_v_self, 
#if 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_5pysam_7libcbcf_13VariantContig_2remove_header, "VariantContig.remove_header(self)");
static PyMethodDef __pyx_mdef_5pysam_7libcbcf_13VariantContig_3remove_header = {"remove_header", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_5pysam_7libcbcf_13VariantContig_3remove_header, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_5pysam_7libcbcf_13VariantContig_2remove_header};
static PyObject *__pyx_pw_5pysam_7libcbcf_13VariantContig_3remove_header(PyObject *__pyx_v_self, 
#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("remove_header (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("remove_header", 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("remove_header", __pyx_kwds); return NULL;}
  __pyx_r = __pyx_pf_5pysam_7libcbcf_13VariantContig_2remove_header(((struct __pyx_obj_5pysam_7libcbcf_VariantContig *)__pyx_v_self));

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

static PyObject *__pyx_pf_5pysam_7libcbcf_13VariantContig_2remove_header(struct __pyx_obj_5pysam_7libcbcf_VariantContig *__pyx_v_self) {
  bcf_hdr_t *__pyx_v_hdr;
  char const *__pyx_v_key;
  PyObject *__pyx_r = NULL;
  __Pyx_TraceDeclarationsFunc
  __Pyx_RefNannyDeclarations
  bcf_hdr_t *__pyx_t_1;
  char const *__pyx_t_2;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_TraceFrameInit(((PyObject *)__pyx_mstate_global->__pyx_codeobj_tab[103]))
  __Pyx_RefNannySetupContext("remove_header", 0);
  __Pyx_TraceStartFunc("remove_header", __pyx_f[0], 1741, 0, 0, 0, __PYX_ERR(0, 1741, __pyx_L1_error));

  /* "pysam/libcbcf.pyx":1742
 * 
 *     def remove_header(self):
 *         cdef bcf_hdr_t *hdr = self.header.ptr             # <<<<<<<<<<<<<<
 *         cdef const char *key = hdr.id[BCF_DT_CTG][self.id].key
 *         bcf_hdr_remove(hdr, BCF_HL_CTG, key)
*/
  __pyx_t_1 = __pyx_v_self->header->ptr;
  __pyx_v_hdr = __pyx_t_1;

  /* "pysam/libcbcf.pyx":1743
 *     def remove_header(self):
 *         cdef bcf_hdr_t *hdr = self.header.ptr
 *         cdef const char *key = hdr.id[BCF_DT_CTG][self.id].key             # <<<<<<<<<<<<<<
 *         bcf_hdr_remove(hdr, BCF_HL_CTG, key)
 * 
*/
  __pyx_t_2 = ((__pyx_v_hdr->id[BCF_DT_CTG])[__pyx_v_self->id]).key;
  __pyx_v_key = __pyx_t_2;

  /* "pysam/libcbcf.pyx":1744
 *         cdef bcf_hdr_t *hdr = self.header.ptr
 *         cdef const char *key = hdr.id[BCF_DT_CTG][self.id].key
 *         bcf_hdr_remove(hdr, BCF_HL_CTG, key)             # <<<<<<<<<<<<<<
 * 
 * 
*/
  bcf_hdr_remove(__pyx_v_hdr, BCF_HL_CTG, __pyx_v_key);

  /* "pysam/libcbcf.pyx":1741
 *         return makeVariantHeaderRecord(self.header, hrec)
 * 
 *     def remove_header(self):             # <<<<<<<<<<<<<<
 *         cdef bcf_hdr_t *hdr = self.header.ptr
 *         cdef const char *key = hdr.id[BCF_DT_CTG][self.id].key
*/

  /* function exit code */
  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  __Pyx_TraceReturnValue(__pyx_r, 0, 0, __PYX_ERR(0, 1741, __pyx_L1_error));
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_TraceException(__pyx_lineno, 0, 0);
  #if CYTHON_USE_SYS_MONITORING
  __Pyx_TraceExceptionUnwind(0, 0);
  #else
  __Pyx_TraceReturnValue(NULL, 0, 0, __PYX_ERR(0, 1741, __pyx_L1_error));
  #endif
  __Pyx_AddTraceback("pysam.libcbcf.VariantContig.remove_header", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_PyMonitoring_ExitScope(0);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "pysam/libcbcf.pxd":65
 * 
 * cdef class VariantContig(object):
 *     cdef readonly VariantHeader header             # <<<<<<<<<<<<<<
 *     cdef int id
 * 
*/

/* Python wrapper */
static PyObject *__pyx_pw_5pysam_7libcbcf_13VariantContig_6header_1__get__(PyObject *__pyx_v_self); /*proto*/
static PyObject *__pyx_pw_5pysam_7libcbcf_13VariantContig_6header_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_5pysam_7libcbcf_13VariantContig_6header___get__(((struct __pyx_obj_5pysam_7libcbcf_VariantContig *)__pyx_v_self));

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

static PyObject *__pyx_pf_5pysam_7libcbcf_13VariantContig_6header___get__(struct __pyx_obj_5pysam_7libcbcf_VariantContig *__pyx_v_self) {
  PyObject *__pyx_r = NULL;
  __Pyx_TraceDeclarationsFunc
  __Pyx_RefNannyDeclarations
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_TraceFrameInit(((PyObject *)__pyx_mstate_global->__pyx_codeobj_tab[104]))
  __Pyx_RefNannySetupContext("__get__", 0);
  __Pyx_TraceStartFunc("__get__", __pyx_f[3], 65, 0, 0, 0, __PYX_ERR(3, 65, __pyx_L1_error));
  __Pyx_XDECREF(__pyx_r);
  __Pyx_INCREF((PyObject *)__pyx_v_self->header);
  __pyx_r = ((PyObject *)__pyx_v_self->header);
  __Pyx_TraceReturnValue(__pyx_r, 0, 0, __PYX_ERR(3, 65, __pyx_L1_error));
  goto __pyx_L0;

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_TraceException(__pyx_lineno, 0, 0);
  #if CYTHON_USE_SYS_MONITORING
  __Pyx_TraceExceptionUnwind(0, 0);
  #else
  __Pyx_TraceReturnValue(NULL, 0, 0, __PYX_ERR(3, 65, __pyx_L1_error));
  #endif
  __Pyx_AddTraceback("pysam.libcbcf.VariantContig.header.__get__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_PyMonitoring_ExitScope(0);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

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

/* Python wrapper */
static PyObject *__pyx_pw_5pysam_7libcbcf_13VariantContig_5__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*/
PyDoc_STRVAR(__pyx_doc_5pysam_7libcbcf_13VariantContig_4__reduce_cython__, "VariantContig.__reduce_cython__(self)");
static PyMethodDef __pyx_mdef_5pysam_7libcbcf_13VariantContig_5__reduce_cython__ = {"__reduce_cython__", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_5pysam_7libcbcf_13VariantContig_5__reduce_cython__, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_5pysam_7libcbcf_13VariantContig_4__reduce_cython__};
static PyObject *__pyx_pw_5pysam_7libcbcf_13VariantContig_5__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_5pysam_7libcbcf_13VariantContig_4__reduce_cython__(((struct __pyx_obj_5pysam_7libcbcf_VariantContig *)__pyx_v_self));

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

static PyObject *__pyx_pf_5pysam_7libcbcf_13VariantContig_4__reduce_cython__(struct __pyx_obj_5pysam_7libcbcf_VariantContig *__pyx_v_self) {
  PyObject *__pyx_v_state = 0;
  PyObject *__pyx_v__dict = 0;
  int __pyx_v_use_setstate;
  PyObject *__pyx_r = NULL;
  __Pyx_TraceDeclarationsFunc
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  int __pyx_t_3;
  PyObject *__pyx_t_4 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_TraceFrameInit(((PyObject *)__pyx_mstate_global->__pyx_codeobj_tab[105]))
  __Pyx_RefNannySetupContext("__reduce_cython__", 0);
  __Pyx_TraceStartFunc("__reduce_cython__", __pyx_f[4], 1, 0, 0, 0, __PYX_ERR(4, 1, __pyx_L1_error));

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

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

  /* "(tree fragment)":7
 *     state = (self.header, self.id)
 *     _dict = getattr(self, '__dict__', None)
 *     if _dict is not None:             # <<<<<<<<<<<<<<
 *         state += (_dict,)
 *         use_setstate = True
*/
  __pyx_t_3 = (__pyx_v__dict != Py_None);
  if (__pyx_t_3) {

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

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

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

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

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

    /* "(tree fragment)":13
 *         use_setstate = self.header is not None
 *     if use_setstate:
 *         return __pyx_unpickle_VariantContig, (type(self), 0x2572060, None), state             # <<<<<<<<<<<<<<
 *     else:
 *         return __pyx_unpickle_VariantContig, (type(self), 0x2572060, state)
*/
    __Pyx_XDECREF(__pyx_r);
    __Pyx_GetModuleGlobalName(__pyx_t_1, __pyx_mstate_global->__pyx_n_u_pyx_unpickle_VariantContig); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 13, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __pyx_t_2 = PyTuple_New(3); if (unlikely(!__pyx_t_2)) __PYX_ERR(4, 13, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __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_2, 0, ((PyObject *)Py_TYPE(((PyObject *)__pyx_v_self)))) != (0)) __PYX_ERR(4, 13, __pyx_L1_error);
    __Pyx_INCREF(__pyx_mstate_global->__pyx_int_39264352);
    __Pyx_GIVEREF(__pyx_mstate_global->__pyx_int_39264352);
    if (__Pyx_PyTuple_SET_ITEM(__pyx_t_2, 1, __pyx_mstate_global->__pyx_int_39264352) != (0)) __PYX_ERR(4, 13, __pyx_L1_error);
    __Pyx_INCREF(Py_None);
    __Pyx_GIVEREF(Py_None);
    if (__Pyx_PyTuple_SET_ITEM(__pyx_t_2, 2, Py_None) != (0)) __PYX_ERR(4, 13, __pyx_L1_error);
    __pyx_t_4 = PyTuple_New(3); if (unlikely(!__pyx_t_4)) __PYX_ERR(4, 13, __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(4, 13, __pyx_L1_error);
    __Pyx_GIVEREF(__pyx_t_2);
    if (__Pyx_PyTuple_SET_ITEM(__pyx_t_4, 1, __pyx_t_2) != (0)) __PYX_ERR(4, 13, __pyx_L1_error);
    __Pyx_INCREF(__pyx_v_state);
    __Pyx_GIVEREF(__pyx_v_state);
    if (__Pyx_PyTuple_SET_ITEM(__pyx_t_4, 2, __pyx_v_state) != (0)) __PYX_ERR(4, 13, __pyx_L1_error);
    __pyx_t_1 = 0;
    __pyx_t_2 = 0;
    __pyx_r = __pyx_t_4;
    __pyx_t_4 = 0;
    __Pyx_TraceReturnValue(__pyx_r, 27, 0, __PYX_ERR(4, 13, __pyx_L1_error));
    goto __pyx_L0;

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

  /* "(tree fragment)":15
 *         return __pyx_unpickle_VariantContig, (type(self), 0x2572060, None), state
 *     else:
 *         return __pyx_unpickle_VariantContig, (type(self), 0x2572060, state)             # <<<<<<<<<<<<<<
 * def __setstate_cython__(self, __pyx_state):
 *     __pyx_unpickle_VariantContig__set_state(self, __pyx_state)
*/
  /*else*/ {
    __Pyx_XDECREF(__pyx_r);
    __Pyx_GetModuleGlobalName(__pyx_t_4, __pyx_mstate_global->__pyx_n_u_pyx_unpickle_VariantContig); if (unlikely(!__pyx_t_4)) __PYX_ERR(4, 15, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
    __pyx_t_2 = PyTuple_New(3); if (unlikely(!__pyx_t_2)) __PYX_ERR(4, 15, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __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_2, 0, ((PyObject *)Py_TYPE(((PyObject *)__pyx_v_self)))) != (0)) __PYX_ERR(4, 15, __pyx_L1_error);
    __Pyx_INCREF(__pyx_mstate_global->__pyx_int_39264352);
    __Pyx_GIVEREF(__pyx_mstate_global->__pyx_int_39264352);
    if (__Pyx_PyTuple_SET_ITEM(__pyx_t_2, 1, __pyx_mstate_global->__pyx_int_39264352) != (0)) __PYX_ERR(4, 15, __pyx_L1_error);
    __Pyx_INCREF(__pyx_v_state);
    __Pyx_GIVEREF(__pyx_v_state);
    if (__Pyx_PyTuple_SET_ITEM(__pyx_t_2, 2, __pyx_v_state) != (0)) __PYX_ERR(4, 15, __pyx_L1_error);
    __pyx_t_1 = PyTuple_New(2); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 15, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_GIVEREF(__pyx_t_4);
    if (__Pyx_PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_t_4) != (0)) __PYX_ERR(4, 15, __pyx_L1_error);
    __Pyx_GIVEREF(__pyx_t_2);
    if (__Pyx_PyTuple_SET_ITEM(__pyx_t_1, 1, __pyx_t_2) != (0)) __PYX_ERR(4, 15, __pyx_L1_error);
    __pyx_t_4 = 0;
    __pyx_t_2 = 0;
    __pyx_r = __pyx_t_1;
    __pyx_t_1 = 0;
    __Pyx_TraceReturnValue(__pyx_r, 35, 0, __PYX_ERR(4, 15, __pyx_L1_error));
    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_2);
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_TraceException(__pyx_lineno, 0, 0);
  #if CYTHON_USE_SYS_MONITORING
  __Pyx_TraceExceptionUnwind(0, 0);
  #else
  __Pyx_TraceReturnValue(NULL, 0, 0, __PYX_ERR(4, 1, __pyx_L1_error));
  #endif
  __Pyx_AddTraceback("pysam.libcbcf.VariantContig.__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_PyMonitoring_ExitScope(0);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "(tree fragment)":16
 *     else:
 *         return __pyx_unpickle_VariantContig, (type(self), 0x2572060, state)
 * def __setstate_cython__(self, __pyx_state):             # <<<<<<<<<<<<<<
 *     __pyx_unpickle_VariantContig__set_state(self, __pyx_state)
*/

/* Python wrapper */
static PyObject *__pyx_pw_5pysam_7libcbcf_13VariantContig_7__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*/
PyDoc_STRVAR(__pyx_doc_5pysam_7libcbcf_13VariantContig_6__setstate_cython__, "VariantContig.__setstate_cython__(self, __pyx_state)");
static PyMethodDef __pyx_mdef_5pysam_7libcbcf_13VariantContig_7__setstate_cython__ = {"__setstate_cython__", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_5pysam_7libcbcf_13VariantContig_7__setstate_cython__, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_5pysam_7libcbcf_13VariantContig_6__setstate_cython__};
static PyObject *__pyx_pw_5pysam_7libcbcf_13VariantContig_7__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(4, 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(4, 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(4, 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(4, 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(4, 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(4, 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("pysam.libcbcf.VariantContig.__setstate_cython__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_5pysam_7libcbcf_13VariantContig_6__setstate_cython__(((struct __pyx_obj_5pysam_7libcbcf_VariantContig *)__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_5pysam_7libcbcf_13VariantContig_6__setstate_cython__(struct __pyx_obj_5pysam_7libcbcf_VariantContig *__pyx_v_self, PyObject *__pyx_v___pyx_state) {
  PyObject *__pyx_r = NULL;
  __Pyx_TraceDeclarationsFunc
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_TraceFrameInit(((PyObject *)__pyx_mstate_global->__pyx_codeobj_tab[106]))
  __Pyx_RefNannySetupContext("__setstate_cython__", 0);
  __Pyx_TraceStartFunc("__setstate_cython__", __pyx_f[4], 16, 0, 0, 0, __PYX_ERR(4, 16, __pyx_L1_error));

  /* "(tree fragment)":17
 *         return __pyx_unpickle_VariantContig, (type(self), 0x2572060, state)
 * def __setstate_cython__(self, __pyx_state):
 *     __pyx_unpickle_VariantContig__set_state(self, __pyx_state)             # <<<<<<<<<<<<<<
*/
  if (!(likely(PyTuple_CheckExact(__pyx_v___pyx_state))||((__pyx_v___pyx_state) == Py_None) || __Pyx_RaiseUnexpectedTypeError("tuple", __pyx_v___pyx_state))) __PYX_ERR(4, 17, __pyx_L1_error)
  __pyx_t_1 = __pyx_f_5pysam_7libcbcf___pyx_unpickle_VariantContig__set_state(__pyx_v_self, ((PyObject*)__pyx_v___pyx_state)); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 17, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "(tree fragment)":16
 *     else:
 *         return __pyx_unpickle_VariantContig, (type(self), 0x2572060, state)
 * def __setstate_cython__(self, __pyx_state):             # <<<<<<<<<<<<<<
 *     __pyx_unpickle_VariantContig__set_state(self, __pyx_state)
*/

  /* function exit code */
  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  __Pyx_TraceReturnValue(__pyx_r, 0, 0, __PYX_ERR(4, 16, __pyx_L1_error));
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_TraceException(__pyx_lineno, 0, 0);
  #if CYTHON_USE_SYS_MONITORING
  __Pyx_TraceExceptionUnwind(0, 0);
  #else
  __Pyx_TraceReturnValue(NULL, 0, 0, __PYX_ERR(4, 16, __pyx_L1_error));
  #endif
  __Pyx_AddTraceback("pysam.libcbcf.VariantContig.__setstate_cython__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_PyMonitoring_ExitScope(0);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "pysam/libcbcf.pyx":1747
 * 
 * 
 * cdef VariantContig makeVariantContig(VariantHeader header, int id):             # <<<<<<<<<<<<<<
 *     if not header:
 *         raise ValueError('invalid VariantHeader')
*/

static struct __pyx_obj_5pysam_7libcbcf_VariantContig *__pyx_f_5pysam_7libcbcf_makeVariantContig(struct __pyx_obj_5pysam_7libcbcf_VariantHeader *__pyx_v_header, int __pyx_v_id) {
  struct __pyx_obj_5pysam_7libcbcf_VariantContig *__pyx_v_contig = 0;
  struct __pyx_obj_5pysam_7libcbcf_VariantContig *__pyx_r = NULL;
  __Pyx_TraceDeclarationsFunc
  __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_TraceFrameInit(((PyObject *)__pyx_mstate_global->__pyx_codeobj_tab[107]))
  __Pyx_RefNannySetupContext("makeVariantContig", 0);
  __Pyx_TraceStartFunc("makeVariantContig", __pyx_f[0], 1747, 0, 0, 0, __PYX_ERR(0, 1747, __pyx_L1_error));

  /* "pysam/libcbcf.pyx":1748
 * 
 * cdef VariantContig makeVariantContig(VariantHeader header, int id):
 *     if not header:             # <<<<<<<<<<<<<<
 *         raise ValueError('invalid VariantHeader')
 * 
*/
  __pyx_t_1 = __Pyx_PyObject_IsTrue(((PyObject *)__pyx_v_header)); if (unlikely((__pyx_t_1 < 0))) __PYX_ERR(0, 1748, __pyx_L1_error)
  __pyx_t_2 = (!__pyx_t_1);
  if (unlikely(__pyx_t_2)) {

    /* "pysam/libcbcf.pyx":1749
 * cdef VariantContig makeVariantContig(VariantHeader header, int id):
 *     if not header:
 *         raise ValueError('invalid VariantHeader')             # <<<<<<<<<<<<<<
 * 
 *     if id < 0 or id >= header.ptr.n[BCF_DT_CTG]:
*/
    __pyx_t_4 = NULL;
    __Pyx_INCREF(__pyx_builtin_ValueError);
    __pyx_t_5 = __pyx_builtin_ValueError; 
    __pyx_t_6 = 1;
    {
      PyObject *__pyx_callargs[2] = {__pyx_t_4, __pyx_mstate_global->__pyx_kp_u_invalid_VariantHeader};
      __pyx_t_3 = __Pyx_PyObject_FastCall(__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, 1749, __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, 1749, __pyx_L1_error)

    /* "pysam/libcbcf.pyx":1748
 * 
 * cdef VariantContig makeVariantContig(VariantHeader header, int id):
 *     if not header:             # <<<<<<<<<<<<<<
 *         raise ValueError('invalid VariantHeader')
 * 
*/
  }

  /* "pysam/libcbcf.pyx":1751
 *         raise ValueError('invalid VariantHeader')
 * 
 *     if id < 0 or id >= header.ptr.n[BCF_DT_CTG]:             # <<<<<<<<<<<<<<
 *         raise ValueError('invalid contig id')
 * 
*/
  __pyx_t_1 = (__pyx_v_id < 0);
  if (!__pyx_t_1) {
  } else {
    __pyx_t_2 = __pyx_t_1;
    goto __pyx_L5_bool_binop_done;
  }
  __pyx_t_1 = (__pyx_v_id >= (__pyx_v_header->ptr->n[BCF_DT_CTG]));
  __pyx_t_2 = __pyx_t_1;
  __pyx_L5_bool_binop_done:;
  if (unlikely(__pyx_t_2)) {

    /* "pysam/libcbcf.pyx":1752
 * 
 *     if id < 0 or id >= header.ptr.n[BCF_DT_CTG]:
 *         raise ValueError('invalid contig id')             # <<<<<<<<<<<<<<
 * 
 *     cdef VariantContig contig = VariantContig.__new__(VariantContig)
*/
    __pyx_t_5 = NULL;
    __Pyx_INCREF(__pyx_builtin_ValueError);
    __pyx_t_4 = __pyx_builtin_ValueError; 
    __pyx_t_6 = 1;
    {
      PyObject *__pyx_callargs[2] = {__pyx_t_5, __pyx_mstate_global->__pyx_kp_u_invalid_contig_id};
      __pyx_t_3 = __Pyx_PyObject_FastCall(__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_3)) __PYX_ERR(0, 1752, __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, 1752, __pyx_L1_error)

    /* "pysam/libcbcf.pyx":1751
 *         raise ValueError('invalid VariantHeader')
 * 
 *     if id < 0 or id >= header.ptr.n[BCF_DT_CTG]:             # <<<<<<<<<<<<<<
 *         raise ValueError('invalid contig id')
 * 
*/
  }

  /* "pysam/libcbcf.pyx":1754
 *         raise ValueError('invalid contig id')
 * 
 *     cdef VariantContig contig = VariantContig.__new__(VariantContig)             # <<<<<<<<<<<<<<
 *     contig.header = header
 *     contig.id = id
*/
  __pyx_t_3 = ((PyObject *)__pyx_tp_new_5pysam_7libcbcf_VariantContig(((PyTypeObject *)__pyx_mstate_global->__pyx_ptype_5pysam_7libcbcf_VariantContig), __pyx_mstate_global->__pyx_empty_tuple, NULL)); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1754, __pyx_L1_error)
  __Pyx_GOTREF((PyObject *)__pyx_t_3);
  __pyx_v_contig = ((struct __pyx_obj_5pysam_7libcbcf_VariantContig *)__pyx_t_3);
  __pyx_t_3 = 0;

  /* "pysam/libcbcf.pyx":1755
 * 
 *     cdef VariantContig contig = VariantContig.__new__(VariantContig)
 *     contig.header = header             # <<<<<<<<<<<<<<
 *     contig.id = id
 * 
*/
  __Pyx_INCREF((PyObject *)__pyx_v_header);
  __Pyx_GIVEREF((PyObject *)__pyx_v_header);
  __Pyx_GOTREF((PyObject *)__pyx_v_contig->header);
  __Pyx_DECREF((PyObject *)__pyx_v_contig->header);
  __pyx_v_contig->header = __pyx_v_header;

  /* "pysam/libcbcf.pyx":1756
 *     cdef VariantContig contig = VariantContig.__new__(VariantContig)
 *     contig.header = header
 *     contig.id = id             # <<<<<<<<<<<<<<
 * 
 *     return contig
*/
  __pyx_v_contig->id = __pyx_v_id;

  /* "pysam/libcbcf.pyx":1758
 *     contig.id = id
 * 
 *     return contig             # <<<<<<<<<<<<<<
 * 
 * 
*/
  __Pyx_XDECREF((PyObject *)__pyx_r);
  __Pyx_INCREF((PyObject *)__pyx_v_contig);
  __pyx_r = __pyx_v_contig;
  __Pyx_TraceReturnValue((PyObject *)__pyx_r, 35, 0, __PYX_ERR(0, 1758, __pyx_L1_error));
  goto __pyx_L0;

  /* "pysam/libcbcf.pyx":1747
 * 
 * 
 * cdef VariantContig makeVariantContig(VariantHeader header, int id):             # <<<<<<<<<<<<<<
 *     if not header:
 *         raise ValueError('invalid VariantHeader')
*/

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_XDECREF(__pyx_t_5);
  __Pyx_TraceException(__pyx_lineno, 0, 0);
  #if CYTHON_USE_SYS_MONITORING
  __Pyx_TraceExceptionUnwind(0, 0);
  #else
  __Pyx_TraceReturnValue(NULL, 0, 0, __PYX_ERR(0, 1747, __pyx_L1_error));
  #endif
  __Pyx_AddTraceback("pysam.libcbcf.makeVariantContig", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_XDECREF((PyObject *)__pyx_v_contig);
  __Pyx_XGIVEREF((PyObject *)__pyx_r);
  __Pyx_PyMonitoring_ExitScope(0);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "pysam/libcbcf.pyx":1763
 * cdef class VariantHeaderContigs(object):
 *     """mapping from contig name or index to :class:`VariantContig` object."""
 *     def __init__(self, *args, **kwargs):             # <<<<<<<<<<<<<<
 *         raise TypeError('this class cannot be instantiated from Python')
 * 
*/

/* Python wrapper */
static int __pyx_pw_5pysam_7libcbcf_20VariantHeaderContigs_1__init__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static int __pyx_pw_5pysam_7libcbcf_20VariantHeaderContigs_1__init__(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("__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);
  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("__init__", __pyx_kwds) == -1)) return -1;
  }
  __Pyx_INCREF(__pyx_args);
  __pyx_v_args = __pyx_args;
  __pyx_r = __pyx_pf_5pysam_7libcbcf_20VariantHeaderContigs___init__(((struct __pyx_obj_5pysam_7libcbcf_VariantHeaderContigs *)__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_5pysam_7libcbcf_20VariantHeaderContigs___init__(CYTHON_UNUSED struct __pyx_obj_5pysam_7libcbcf_VariantHeaderContigs *__pyx_v_self, CYTHON_UNUSED PyObject *__pyx_v_args, CYTHON_UNUSED PyObject *__pyx_v_kwargs) {
  int __pyx_r;
  __Pyx_TraceDeclarationsFunc
  __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_TraceFrameInit(((PyObject *)__pyx_mstate_global->__pyx_codeobj_tab[108]))
  __Pyx_RefNannySetupContext("__init__", 0);
  __Pyx_TraceStartFunc("__init__", __pyx_f[0], 1763, 0, 0, 0, __PYX_ERR(0, 1763, __pyx_L1_error));

  /* "pysam/libcbcf.pyx":1764
 *     """mapping from contig name or index to :class:`VariantContig` object."""
 *     def __init__(self, *args, **kwargs):
 *         raise TypeError('this class cannot be instantiated from Python')             # <<<<<<<<<<<<<<
 * 
 *     def __len__(self):
*/
  __pyx_t_2 = NULL;
  __Pyx_INCREF(__pyx_builtin_TypeError);
  __pyx_t_3 = __pyx_builtin_TypeError; 
  __pyx_t_4 = 1;
  {
    PyObject *__pyx_callargs[2] = {__pyx_t_2, __pyx_mstate_global->__pyx_kp_u_this_class_cannot_be_instantiate};
    __pyx_t_1 = __Pyx_PyObject_FastCall(__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, 1764, __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, 1764, __pyx_L1_error)

  /* "pysam/libcbcf.pyx":1763
 * cdef class VariantHeaderContigs(object):
 *     """mapping from contig name or index to :class:`VariantContig` object."""
 *     def __init__(self, *args, **kwargs):             # <<<<<<<<<<<<<<
 *         raise TypeError('this class cannot be instantiated from Python')
 * 
*/

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_TraceException(__pyx_lineno, 0, 0);
  #if CYTHON_USE_SYS_MONITORING
  __Pyx_TraceExceptionUnwind(0, 0);
  #else
  __Pyx_TraceReturnValue(NULL, 0, 0, __PYX_ERR(0, 1763, __pyx_L1_error));
  #endif
  __Pyx_AddTraceback("pysam.libcbcf.VariantHeaderContigs.__init__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = -1;
  __Pyx_PyMonitoring_ExitScope(0);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "pysam/libcbcf.pyx":1766
 *         raise TypeError('this class cannot be instantiated from Python')
 * 
 *     def __len__(self):             # <<<<<<<<<<<<<<
 *         cdef bcf_hdr_t *hdr = self.header.ptr
 *         assert kh_size(<vdict_t *>hdr.dict[BCF_DT_CTG]) == hdr.n[BCF_DT_CTG]
*/

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

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

static Py_ssize_t __pyx_pf_5pysam_7libcbcf_20VariantHeaderContigs_2__len__(struct __pyx_obj_5pysam_7libcbcf_VariantHeaderContigs *__pyx_v_self) {
  bcf_hdr_t *__pyx_v_hdr;
  Py_ssize_t __pyx_r;
  __Pyx_TraceDeclarationsFunc
  bcf_hdr_t *__pyx_t_1;
  int __pyx_t_2;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_TraceFrameInit(((PyObject *)__pyx_mstate_global->__pyx_codeobj_tab[109]))
  __Pyx_TraceStartFunc("__len__", __pyx_f[0], 1766, 0, 0, 0, __PYX_ERR(0, 1766, __pyx_L1_error));

  /* "pysam/libcbcf.pyx":1767
 * 
 *     def __len__(self):
 *         cdef bcf_hdr_t *hdr = self.header.ptr             # <<<<<<<<<<<<<<
 *         assert kh_size(<vdict_t *>hdr.dict[BCF_DT_CTG]) == hdr.n[BCF_DT_CTG]
 *         return hdr.n[BCF_DT_CTG]
*/
  __pyx_t_1 = __pyx_v_self->header->ptr;
  __pyx_v_hdr = __pyx_t_1;

  /* "pysam/libcbcf.pyx":1768
 *     def __len__(self):
 *         cdef bcf_hdr_t *hdr = self.header.ptr
 *         assert kh_size(<vdict_t *>hdr.dict[BCF_DT_CTG]) == hdr.n[BCF_DT_CTG]             # <<<<<<<<<<<<<<
 *         return hdr.n[BCF_DT_CTG]
 * 
*/
  #ifndef CYTHON_WITHOUT_ASSERTIONS
  if (unlikely(__pyx_assertions_enabled())) {
    __pyx_t_2 = (kh_size(((vdict_t *)(__pyx_v_hdr->dict[BCF_DT_CTG]))) == (__pyx_v_hdr->n[BCF_DT_CTG]));
    if (unlikely(!__pyx_t_2)) {
      __Pyx_Raise(__pyx_builtin_AssertionError, 0, 0, 0);
      __PYX_ERR(0, 1768, __pyx_L1_error)
    }
  }
  #else
  if ((1)); else __PYX_ERR(0, 1768, __pyx_L1_error)
  #endif

  /* "pysam/libcbcf.pyx":1769
 *         cdef bcf_hdr_t *hdr = self.header.ptr
 *         assert kh_size(<vdict_t *>hdr.dict[BCF_DT_CTG]) == hdr.n[BCF_DT_CTG]
 *         return hdr.n[BCF_DT_CTG]             # <<<<<<<<<<<<<<
 * 
 *     def __bool__(self):
*/
  __pyx_r = (__pyx_v_hdr->n[BCF_DT_CTG]);
  __Pyx_TraceReturnCValue(__pyx_r, PyLong_FromSsize_t, 18, 0, __PYX_ERR(0, 1769, __pyx_L1_error));
  goto __pyx_L0;

  /* "pysam/libcbcf.pyx":1766
 *         raise TypeError('this class cannot be instantiated from Python')
 * 
 *     def __len__(self):             # <<<<<<<<<<<<<<
 *         cdef bcf_hdr_t *hdr = self.header.ptr
 *         assert kh_size(<vdict_t *>hdr.dict[BCF_DT_CTG]) == hdr.n[BCF_DT_CTG]
*/

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_TraceException(__pyx_lineno, 0, 0);
  #if CYTHON_USE_SYS_MONITORING
  __Pyx_TraceExceptionUnwind(0, 0);
  #else
  __Pyx_TraceReturnValue(NULL, 0, 0, __PYX_ERR(0, 1766, __pyx_L1_error));
  #endif
  __Pyx_AddTraceback("pysam.libcbcf.VariantHeaderContigs.__len__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = -1;
  __pyx_L0:;
  __Pyx_PyMonitoring_ExitScope(0);
  return __pyx_r;
}

/* "pysam/libcbcf.pyx":1771
 *         return hdr.n[BCF_DT_CTG]
 * 
 *     def __bool__(self):             # <<<<<<<<<<<<<<
 *         cdef bcf_hdr_t *hdr = self.header.ptr
 *         assert kh_size(<vdict_t *>hdr.dict[BCF_DT_CTG]) == hdr.n[BCF_DT_CTG]
*/

/* Python wrapper */
static int __pyx_pw_5pysam_7libcbcf_20VariantHeaderContigs_5__bool__(PyObject *__pyx_v_self); /*proto*/
static int __pyx_pw_5pysam_7libcbcf_20VariantHeaderContigs_5__bool__(PyObject *__pyx_v_self) {
  CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__bool__ (wrapper)", 0);
  __pyx_kwvalues = __Pyx_KwValues_VARARGS(__pyx_args, __pyx_nargs);
  __pyx_r = __pyx_pf_5pysam_7libcbcf_20VariantHeaderContigs_4__bool__(((struct __pyx_obj_5pysam_7libcbcf_VariantHeaderContigs *)__pyx_v_self));

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

static int __pyx_pf_5pysam_7libcbcf_20VariantHeaderContigs_4__bool__(struct __pyx_obj_5pysam_7libcbcf_VariantHeaderContigs *__pyx_v_self) {
  bcf_hdr_t *__pyx_v_hdr;
  int __pyx_r;
  __Pyx_TraceDeclarationsFunc
  bcf_hdr_t *__pyx_t_1;
  int __pyx_t_2;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_TraceFrameInit(((PyObject *)__pyx_mstate_global->__pyx_codeobj_tab[110]))
  __Pyx_TraceStartFunc("__bool__", __pyx_f[0], 1771, 0, 0, 0, __PYX_ERR(0, 1771, __pyx_L1_error));

  /* "pysam/libcbcf.pyx":1772
 * 
 *     def __bool__(self):
 *         cdef bcf_hdr_t *hdr = self.header.ptr             # <<<<<<<<<<<<<<
 *         assert kh_size(<vdict_t *>hdr.dict[BCF_DT_CTG]) == hdr.n[BCF_DT_CTG]
 *         return hdr.n[BCF_DT_CTG] != 0
*/
  __pyx_t_1 = __pyx_v_self->header->ptr;
  __pyx_v_hdr = __pyx_t_1;

  /* "pysam/libcbcf.pyx":1773
 *     def __bool__(self):
 *         cdef bcf_hdr_t *hdr = self.header.ptr
 *         assert kh_size(<vdict_t *>hdr.dict[BCF_DT_CTG]) == hdr.n[BCF_DT_CTG]             # <<<<<<<<<<<<<<
 *         return hdr.n[BCF_DT_CTG] != 0
 * 
*/
  #ifndef CYTHON_WITHOUT_ASSERTIONS
  if (unlikely(__pyx_assertions_enabled())) {
    __pyx_t_2 = (kh_size(((vdict_t *)(__pyx_v_hdr->dict[BCF_DT_CTG]))) == (__pyx_v_hdr->n[BCF_DT_CTG]));
    if (unlikely(!__pyx_t_2)) {
      __Pyx_Raise(__pyx_builtin_AssertionError, 0, 0, 0);
      __PYX_ERR(0, 1773, __pyx_L1_error)
    }
  }
  #else
  if ((1)); else __PYX_ERR(0, 1773, __pyx_L1_error)
  #endif

  /* "pysam/libcbcf.pyx":1774
 *         cdef bcf_hdr_t *hdr = self.header.ptr
 *         assert kh_size(<vdict_t *>hdr.dict[BCF_DT_CTG]) == hdr.n[BCF_DT_CTG]
 *         return hdr.n[BCF_DT_CTG] != 0             # <<<<<<<<<<<<<<
 * 
 *     def __getitem__(self, key):
*/
  __pyx_r = ((__pyx_v_hdr->n[BCF_DT_CTG]) != 0);
  __Pyx_TraceReturnCValue(__pyx_r, __Pyx_PyLong_From_int, 18, 0, __PYX_ERR(0, 1774, __pyx_L1_error));
  goto __pyx_L0;

  /* "pysam/libcbcf.pyx":1771
 *         return hdr.n[BCF_DT_CTG]
 * 
 *     def __bool__(self):             # <<<<<<<<<<<<<<
 *         cdef bcf_hdr_t *hdr = self.header.ptr
 *         assert kh_size(<vdict_t *>hdr.dict[BCF_DT_CTG]) == hdr.n[BCF_DT_CTG]
*/

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_TraceException(__pyx_lineno, 0, 0);
  #if CYTHON_USE_SYS_MONITORING
  __Pyx_TraceExceptionUnwind(0, 0);
  #else
  __Pyx_TraceReturnValue(NULL, 0, 0, __PYX_ERR(0, 1771, __pyx_L1_error));
  #endif
  __Pyx_AddTraceback("pysam.libcbcf.VariantHeaderContigs.__bool__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = -1;
  __pyx_L0:;
  __Pyx_PyMonitoring_ExitScope(0);
  return __pyx_r;
}

/* "pysam/libcbcf.pyx":1776
 *         return hdr.n[BCF_DT_CTG] != 0
 * 
 *     def __getitem__(self, key):             # <<<<<<<<<<<<<<
 *         cdef bcf_hdr_t *hdr = self.header.ptr
 *         cdef int index
*/

/* Python wrapper */
static PyObject *__pyx_pw_5pysam_7libcbcf_20VariantHeaderContigs_7__getitem__(PyObject *__pyx_v_self, PyObject *__pyx_v_key); /*proto*/
static PyObject *__pyx_pw_5pysam_7libcbcf_20VariantHeaderContigs_7__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_5pysam_7libcbcf_20VariantHeaderContigs_6__getitem__(((struct __pyx_obj_5pysam_7libcbcf_VariantHeaderContigs *)__pyx_v_self), ((PyObject *)__pyx_v_key));

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

static PyObject *__pyx_pf_5pysam_7libcbcf_20VariantHeaderContigs_6__getitem__(struct __pyx_obj_5pysam_7libcbcf_VariantHeaderContigs *__pyx_v_self, PyObject *__pyx_v_key) {
  bcf_hdr_t *__pyx_v_hdr;
  int __pyx_v_index;
  vdict_t *__pyx_v_d;
  PyObject *__pyx_v_bkey = 0;
  khiter_t __pyx_v_k;
  int __pyx_v_id;
  PyObject *__pyx_r = NULL;
  __Pyx_TraceDeclarationsFunc
  __Pyx_RefNannyDeclarations
  bcf_hdr_t *__pyx_t_1;
  int __pyx_t_2;
  int __pyx_t_3;
  int __pyx_t_4;
  PyObject *__pyx_t_5 = NULL;
  PyObject *__pyx_t_6 = NULL;
  PyObject *__pyx_t_7 = NULL;
  size_t __pyx_t_8;
  char const *__pyx_t_9;
  PyObject *__pyx_t_10 = NULL;
  PyObject *__pyx_t_11 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_TraceFrameInit(((PyObject *)__pyx_mstate_global->__pyx_codeobj_tab[111]))
  __Pyx_RefNannySetupContext("__getitem__", 0);
  __Pyx_TraceStartFunc("__getitem__", __pyx_f[0], 1776, 0, 0, 0, __PYX_ERR(0, 1776, __pyx_L1_error));

  /* "pysam/libcbcf.pyx":1777
 * 
 *     def __getitem__(self, key):
 *         cdef bcf_hdr_t *hdr = self.header.ptr             # <<<<<<<<<<<<<<
 *         cdef int index
 * 
*/
  __pyx_t_1 = __pyx_v_self->header->ptr;
  __pyx_v_hdr = __pyx_t_1;

  /* "pysam/libcbcf.pyx":1780
 *         cdef int index
 * 
 *         if isinstance(key, int):             # <<<<<<<<<<<<<<
 *             index = key
 *             if index < 0 or index >= hdr.n[BCF_DT_CTG]:
*/
  __pyx_t_2 = PyLong_Check(__pyx_v_key); 
  if (__pyx_t_2) {

    /* "pysam/libcbcf.pyx":1781
 * 
 *         if isinstance(key, int):
 *             index = key             # <<<<<<<<<<<<<<
 *             if index < 0 or index >= hdr.n[BCF_DT_CTG]:
 *                 raise IndexError('invalid contig index')
*/
    __pyx_t_3 = __Pyx_PyLong_As_int(__pyx_v_key); if (unlikely((__pyx_t_3 == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 1781, __pyx_L1_error)
    __pyx_v_index = __pyx_t_3;

    /* "pysam/libcbcf.pyx":1782
 *         if isinstance(key, int):
 *             index = key
 *             if index < 0 or index >= hdr.n[BCF_DT_CTG]:             # <<<<<<<<<<<<<<
 *                 raise IndexError('invalid contig index')
 *             return makeVariantContig(self.header, index)
*/
    __pyx_t_4 = (__pyx_v_index < 0);
    if (!__pyx_t_4) {
    } else {
      __pyx_t_2 = __pyx_t_4;
      goto __pyx_L5_bool_binop_done;
    }
    __pyx_t_4 = (__pyx_v_index >= (__pyx_v_hdr->n[BCF_DT_CTG]));
    __pyx_t_2 = __pyx_t_4;
    __pyx_L5_bool_binop_done:;
    if (unlikely(__pyx_t_2)) {

      /* "pysam/libcbcf.pyx":1783
 *             index = key
 *             if index < 0 or index >= hdr.n[BCF_DT_CTG]:
 *                 raise IndexError('invalid contig index')             # <<<<<<<<<<<<<<
 *             return makeVariantContig(self.header, index)
 * 
*/
      __pyx_t_6 = NULL;
      __Pyx_INCREF(__pyx_builtin_IndexError);
      __pyx_t_7 = __pyx_builtin_IndexError; 
      __pyx_t_8 = 1;
      {
        PyObject *__pyx_callargs[2] = {__pyx_t_6, __pyx_mstate_global->__pyx_kp_u_invalid_contig_index};
        __pyx_t_5 = __Pyx_PyObject_FastCall(__pyx_t_7, __pyx_callargs+__pyx_t_8, (2-__pyx_t_8) | (__pyx_t_8*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
        __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0;
        __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
        if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1783, __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, 1783, __pyx_L1_error)

      /* "pysam/libcbcf.pyx":1782
 *         if isinstance(key, int):
 *             index = key
 *             if index < 0 or index >= hdr.n[BCF_DT_CTG]:             # <<<<<<<<<<<<<<
 *                 raise IndexError('invalid contig index')
 *             return makeVariantContig(self.header, index)
*/
    }

    /* "pysam/libcbcf.pyx":1784
 *             if index < 0 or index >= hdr.n[BCF_DT_CTG]:
 *                 raise IndexError('invalid contig index')
 *             return makeVariantContig(self.header, index)             # <<<<<<<<<<<<<<
 * 
 *         cdef vdict_t *d = <vdict_t *>hdr.dict[BCF_DT_CTG]
*/
    __Pyx_XDECREF(__pyx_r);
    __pyx_t_5 = ((PyObject *)__pyx_v_self->header);
    __Pyx_INCREF(__pyx_t_5);
    __pyx_t_7 = ((PyObject *)__pyx_f_5pysam_7libcbcf_makeVariantContig(((struct __pyx_obj_5pysam_7libcbcf_VariantHeader *)__pyx_t_5), __pyx_v_index)); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 1784, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_7);
    __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
    __pyx_r = __pyx_t_7;
    __pyx_t_7 = 0;
    __Pyx_TraceReturnValue(__pyx_r, 27, 0, __PYX_ERR(0, 1784, __pyx_L1_error));
    goto __pyx_L0;

    /* "pysam/libcbcf.pyx":1780
 *         cdef int index
 * 
 *         if isinstance(key, int):             # <<<<<<<<<<<<<<
 *             index = key
 *             if index < 0 or index >= hdr.n[BCF_DT_CTG]:
*/
  }

  /* "pysam/libcbcf.pyx":1786
 *             return makeVariantContig(self.header, index)
 * 
 *         cdef vdict_t *d = <vdict_t *>hdr.dict[BCF_DT_CTG]             # <<<<<<<<<<<<<<
 *         cdef bytes bkey = force_bytes(key)
 *         cdef khiter_t k = kh_get_vdict(d, bkey)
*/
  __pyx_v_d = ((vdict_t *)(__pyx_v_hdr->dict[BCF_DT_CTG]));

  /* "pysam/libcbcf.pyx":1787
 * 
 *         cdef vdict_t *d = <vdict_t *>hdr.dict[BCF_DT_CTG]
 *         cdef bytes bkey = force_bytes(key)             # <<<<<<<<<<<<<<
 *         cdef khiter_t k = kh_get_vdict(d, bkey)
 * 
*/
  __pyx_t_7 = __pyx_f_5pysam_9libcutils_force_bytes(__pyx_v_key, NULL); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 1787, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_7);
  __pyx_v_bkey = ((PyObject*)__pyx_t_7);
  __pyx_t_7 = 0;

  /* "pysam/libcbcf.pyx":1788
 *         cdef vdict_t *d = <vdict_t *>hdr.dict[BCF_DT_CTG]
 *         cdef bytes bkey = force_bytes(key)
 *         cdef khiter_t k = kh_get_vdict(d, bkey)             # <<<<<<<<<<<<<<
 * 
 *         if k == kh_end(d):
*/
  if (unlikely(__pyx_v_bkey == Py_None)) {
    PyErr_SetString(PyExc_TypeError, "expected bytes, NoneType found");
    __PYX_ERR(0, 1788, __pyx_L1_error)
  }
  __pyx_t_9 = __Pyx_PyBytes_AsString(__pyx_v_bkey); if (unlikely((!__pyx_t_9) && PyErr_Occurred())) __PYX_ERR(0, 1788, __pyx_L1_error)
  __pyx_v_k = kh_get_vdict(__pyx_v_d, __pyx_t_9);

  /* "pysam/libcbcf.pyx":1790
 *         cdef khiter_t k = kh_get_vdict(d, bkey)
 * 
 *         if k == kh_end(d):             # <<<<<<<<<<<<<<
 *             raise KeyError('invalid contig: {}'.format(key))
 * 
*/
  __pyx_t_2 = (__pyx_v_k == kh_end(__pyx_v_d));
  if (unlikely(__pyx_t_2)) {

    /* "pysam/libcbcf.pyx":1791
 * 
 *         if k == kh_end(d):
 *             raise KeyError('invalid contig: {}'.format(key))             # <<<<<<<<<<<<<<
 * 
 *         cdef int id = kh_val_vdict(d, k).id
*/
    __pyx_t_5 = NULL;
    __Pyx_INCREF(__pyx_builtin_KeyError);
    __pyx_t_6 = __pyx_builtin_KeyError; 
    __pyx_t_11 = __pyx_mstate_global->__pyx_kp_u_invalid_contig;
    __Pyx_INCREF(__pyx_t_11);
    __pyx_t_8 = 0;
    {
      PyObject *__pyx_callargs[2] = {__pyx_t_11, __pyx_v_key};
      __pyx_t_10 = __Pyx_PyObject_FastCallMethod(__pyx_mstate_global->__pyx_n_u_format, __pyx_callargs+__pyx_t_8, (2-__pyx_t_8) | (1*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
      __Pyx_XDECREF(__pyx_t_11); __pyx_t_11 = 0;
      if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 1791, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_10);
    }
    __pyx_t_8 = 1;
    {
      PyObject *__pyx_callargs[2] = {__pyx_t_5, __pyx_t_10};
      __pyx_t_7 = __Pyx_PyObject_FastCall(__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_10); __pyx_t_10 = 0;
      __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
      if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 1791, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_7);
    }
    __Pyx_Raise(__pyx_t_7, 0, 0, 0);
    __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
    __PYX_ERR(0, 1791, __pyx_L1_error)

    /* "pysam/libcbcf.pyx":1790
 *         cdef khiter_t k = kh_get_vdict(d, bkey)
 * 
 *         if k == kh_end(d):             # <<<<<<<<<<<<<<
 *             raise KeyError('invalid contig: {}'.format(key))
 * 
*/
  }

  /* "pysam/libcbcf.pyx":1793
 *             raise KeyError('invalid contig: {}'.format(key))
 * 
 *         cdef int id = kh_val_vdict(d, k).id             # <<<<<<<<<<<<<<
 * 
 *         return makeVariantContig(self.header, id)
*/
  __pyx_t_3 = kh_val(__pyx_v_d, __pyx_v_k).id;
  __pyx_v_id = __pyx_t_3;

  /* "pysam/libcbcf.pyx":1795
 *         cdef int id = kh_val_vdict(d, k).id
 * 
 *         return makeVariantContig(self.header, id)             # <<<<<<<<<<<<<<
 * 
 *     def remove_header(self, key):
*/
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_7 = ((PyObject *)__pyx_v_self->header);
  __Pyx_INCREF(__pyx_t_7);
  __pyx_t_6 = ((PyObject *)__pyx_f_5pysam_7libcbcf_makeVariantContig(((struct __pyx_obj_5pysam_7libcbcf_VariantHeader *)__pyx_t_7), __pyx_v_id)); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 1795, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_6);
  __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
  __pyx_r = __pyx_t_6;
  __pyx_t_6 = 0;
  __Pyx_TraceReturnValue(__pyx_r, 67, 0, __PYX_ERR(0, 1795, __pyx_L1_error));
  goto __pyx_L0;

  /* "pysam/libcbcf.pyx":1776
 *         return hdr.n[BCF_DT_CTG] != 0
 * 
 *     def __getitem__(self, key):             # <<<<<<<<<<<<<<
 *         cdef bcf_hdr_t *hdr = self.header.ptr
 *         cdef int index
*/

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_5);
  __Pyx_XDECREF(__pyx_t_6);
  __Pyx_XDECREF(__pyx_t_7);
  __Pyx_XDECREF(__pyx_t_10);
  __Pyx_XDECREF(__pyx_t_11);
  __Pyx_TraceException(__pyx_lineno, 0, 0);
  #if CYTHON_USE_SYS_MONITORING
  __Pyx_TraceExceptionUnwind(0, 0);
  #else
  __Pyx_TraceReturnValue(NULL, 0, 0, __PYX_ERR(0, 1776, __pyx_L1_error));
  #endif
  __Pyx_AddTraceback("pysam.libcbcf.VariantHeaderContigs.__getitem__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_bkey);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_PyMonitoring_ExitScope(0);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "pysam/libcbcf.pyx":1797
 *         return makeVariantContig(self.header, id)
 * 
 *     def remove_header(self, key):             # <<<<<<<<<<<<<<
 *         cdef bcf_hdr_t *hdr = self.header.ptr
 *         cdef int index
*/

/* Python wrapper */
static PyObject *__pyx_pw_5pysam_7libcbcf_20VariantHeaderContigs_9remove_header(PyObject *__pyx_v_self, 
#if 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_5pysam_7libcbcf_20VariantHeaderContigs_8remove_header, "VariantHeaderContigs.remove_header(self, key)");
static PyMethodDef __pyx_mdef_5pysam_7libcbcf_20VariantHeaderContigs_9remove_header = {"remove_header", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_5pysam_7libcbcf_20VariantHeaderContigs_9remove_header, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_5pysam_7libcbcf_20VariantHeaderContigs_8remove_header};
static PyObject *__pyx_pw_5pysam_7libcbcf_20VariantHeaderContigs_9remove_header(PyObject *__pyx_v_self, 
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
) {
  PyObject *__pyx_v_key = 0;
  #if !CYTHON_METH_FASTCALL
  CYTHON_UNUSED Py_ssize_t __pyx_nargs;
  #endif
  CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
  PyObject* values[1] = {0};
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("remove_header (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,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, 1797, __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, 1797, __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, "remove_header", 0) < 0) __PYX_ERR(0, 1797, __pyx_L3_error)
      for (Py_ssize_t i = __pyx_nargs; i < 1; i++) {
        if (unlikely(!values[i])) { __Pyx_RaiseArgtupleInvalid("remove_header", 1, 1, 1, i); __PYX_ERR(0, 1797, __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, 1797, __pyx_L3_error)
    }
    __pyx_v_key = values[0];
  }
  goto __pyx_L6_skip;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("remove_header", 1, 1, 1, __pyx_nargs); __PYX_ERR(0, 1797, __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("pysam.libcbcf.VariantHeaderContigs.remove_header", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_5pysam_7libcbcf_20VariantHeaderContigs_8remove_header(((struct __pyx_obj_5pysam_7libcbcf_VariantHeaderContigs *)__pyx_v_self), __pyx_v_key);

  /* 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_5pysam_7libcbcf_20VariantHeaderContigs_8remove_header(struct __pyx_obj_5pysam_7libcbcf_VariantHeaderContigs *__pyx_v_self, PyObject *__pyx_v_key) {
  bcf_hdr_t *__pyx_v_hdr;
  int __pyx_v_index;
  char const *__pyx_v_ckey;
  vdict_t *__pyx_v_d;
  PyObject *__pyx_r = NULL;
  __Pyx_TraceDeclarationsFunc
  __Pyx_RefNannyDeclarations
  bcf_hdr_t *__pyx_t_1;
  int __pyx_t_2;
  int __pyx_t_3;
  int __pyx_t_4;
  PyObject *__pyx_t_5 = NULL;
  PyObject *__pyx_t_6 = NULL;
  PyObject *__pyx_t_7 = NULL;
  size_t __pyx_t_8;
  Py_ssize_t __pyx_t_9;
  char const *__pyx_t_10;
  char const *__pyx_t_11;
  PyObject *__pyx_t_12 = NULL;
  PyObject *__pyx_t_13 = NULL;
  char const *__pyx_t_14;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_TraceFrameInit(((PyObject *)__pyx_mstate_global->__pyx_codeobj_tab[112]))
  __Pyx_RefNannySetupContext("remove_header", 0);
  __Pyx_TraceStartFunc("remove_header", __pyx_f[0], 1797, 0, 0, 0, __PYX_ERR(0, 1797, __pyx_L1_error));
  __Pyx_INCREF(__pyx_v_key);

  /* "pysam/libcbcf.pyx":1798
 * 
 *     def remove_header(self, key):
 *         cdef bcf_hdr_t *hdr = self.header.ptr             # <<<<<<<<<<<<<<
 *         cdef int index
 *         cdef const char *ckey
*/
  __pyx_t_1 = __pyx_v_self->header->ptr;
  __pyx_v_hdr = __pyx_t_1;

  /* "pysam/libcbcf.pyx":1804
 *         cdef khiter_t k
 * 
 *         if isinstance(key, int):             # <<<<<<<<<<<<<<
 *             index = key
 *             if index < 0 or index >= hdr.n[BCF_DT_CTG]:
*/
  __pyx_t_2 = PyLong_Check(__pyx_v_key); 
  if (__pyx_t_2) {

    /* "pysam/libcbcf.pyx":1805
 * 
 *         if isinstance(key, int):
 *             index = key             # <<<<<<<<<<<<<<
 *             if index < 0 or index >= hdr.n[BCF_DT_CTG]:
 *                 raise IndexError('invalid contig index')
*/
    __pyx_t_3 = __Pyx_PyLong_As_int(__pyx_v_key); if (unlikely((__pyx_t_3 == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 1805, __pyx_L1_error)
    __pyx_v_index = __pyx_t_3;

    /* "pysam/libcbcf.pyx":1806
 *         if isinstance(key, int):
 *             index = key
 *             if index < 0 or index >= hdr.n[BCF_DT_CTG]:             # <<<<<<<<<<<<<<
 *                 raise IndexError('invalid contig index')
 *             ckey = hdr.id[BCF_DT_CTG][self.id].key
*/
    __pyx_t_4 = (__pyx_v_index < 0);
    if (!__pyx_t_4) {
    } else {
      __pyx_t_2 = __pyx_t_4;
      goto __pyx_L5_bool_binop_done;
    }
    __pyx_t_4 = (__pyx_v_index >= (__pyx_v_hdr->n[BCF_DT_CTG]));
    __pyx_t_2 = __pyx_t_4;
    __pyx_L5_bool_binop_done:;
    if (unlikely(__pyx_t_2)) {

      /* "pysam/libcbcf.pyx":1807
 *             index = key
 *             if index < 0 or index >= hdr.n[BCF_DT_CTG]:
 *                 raise IndexError('invalid contig index')             # <<<<<<<<<<<<<<
 *             ckey = hdr.id[BCF_DT_CTG][self.id].key
 *         else:
*/
      __pyx_t_6 = NULL;
      __Pyx_INCREF(__pyx_builtin_IndexError);
      __pyx_t_7 = __pyx_builtin_IndexError; 
      __pyx_t_8 = 1;
      {
        PyObject *__pyx_callargs[2] = {__pyx_t_6, __pyx_mstate_global->__pyx_kp_u_invalid_contig_index};
        __pyx_t_5 = __Pyx_PyObject_FastCall(__pyx_t_7, __pyx_callargs+__pyx_t_8, (2-__pyx_t_8) | (__pyx_t_8*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
        __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0;
        __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
        if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1807, __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, 1807, __pyx_L1_error)

      /* "pysam/libcbcf.pyx":1806
 *         if isinstance(key, int):
 *             index = key
 *             if index < 0 or index >= hdr.n[BCF_DT_CTG]:             # <<<<<<<<<<<<<<
 *                 raise IndexError('invalid contig index')
 *             ckey = hdr.id[BCF_DT_CTG][self.id].key
*/
    }

    /* "pysam/libcbcf.pyx":1808
 *             if index < 0 or index >= hdr.n[BCF_DT_CTG]:
 *                 raise IndexError('invalid contig index')
 *             ckey = hdr.id[BCF_DT_CTG][self.id].key             # <<<<<<<<<<<<<<
 *         else:
 *             d = <vdict_t *>hdr.dict[BCF_DT_CTG]
*/
    __pyx_t_5 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_mstate_global->__pyx_n_u_id); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1808, __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(0, 1808, __pyx_L1_error)
    __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
    __pyx_t_10 = ((__pyx_v_hdr->id[BCF_DT_CTG])[__pyx_t_9]).key;
    __pyx_v_ckey = __pyx_t_10;

    /* "pysam/libcbcf.pyx":1804
 *         cdef khiter_t k
 * 
 *         if isinstance(key, int):             # <<<<<<<<<<<<<<
 *             index = key
 *             if index < 0 or index >= hdr.n[BCF_DT_CTG]:
*/
    goto __pyx_L3;
  }

  /* "pysam/libcbcf.pyx":1810
 *             ckey = hdr.id[BCF_DT_CTG][self.id].key
 *         else:
 *             d = <vdict_t *>hdr.dict[BCF_DT_CTG]             # <<<<<<<<<<<<<<
 *             key = force_bytes(key)
 *             if kh_get_vdict(d, key) == kh_end(d):
*/
  /*else*/ {
    __pyx_v_d = ((vdict_t *)(__pyx_v_hdr->dict[BCF_DT_CTG]));

    /* "pysam/libcbcf.pyx":1811
 *         else:
 *             d = <vdict_t *>hdr.dict[BCF_DT_CTG]
 *             key = force_bytes(key)             # <<<<<<<<<<<<<<
 *             if kh_get_vdict(d, key) == kh_end(d):
 *                 raise KeyError('invalid contig: {}'.format(key))
*/
    __pyx_t_5 = __pyx_f_5pysam_9libcutils_force_bytes(__pyx_v_key, NULL); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1811, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_5);
    __Pyx_DECREF_SET(__pyx_v_key, __pyx_t_5);
    __pyx_t_5 = 0;

    /* "pysam/libcbcf.pyx":1812
 *             d = <vdict_t *>hdr.dict[BCF_DT_CTG]
 *             key = force_bytes(key)
 *             if kh_get_vdict(d, key) == kh_end(d):             # <<<<<<<<<<<<<<
 *                 raise KeyError('invalid contig: {}'.format(key))
 *             ckey = key
*/
    __pyx_t_11 = __Pyx_PyObject_AsString(__pyx_v_key); if (unlikely((!__pyx_t_11) && PyErr_Occurred())) __PYX_ERR(0, 1812, __pyx_L1_error)
    __pyx_t_2 = (kh_get_vdict(__pyx_v_d, __pyx_t_11) == kh_end(__pyx_v_d));
    if (unlikely(__pyx_t_2)) {

      /* "pysam/libcbcf.pyx":1813
 *             key = force_bytes(key)
 *             if kh_get_vdict(d, key) == kh_end(d):
 *                 raise KeyError('invalid contig: {}'.format(key))             # <<<<<<<<<<<<<<
 *             ckey = key
 * 
*/
      __pyx_t_7 = NULL;
      __Pyx_INCREF(__pyx_builtin_KeyError);
      __pyx_t_6 = __pyx_builtin_KeyError; 
      __pyx_t_13 = __pyx_mstate_global->__pyx_kp_u_invalid_contig;
      __Pyx_INCREF(__pyx_t_13);
      __pyx_t_8 = 0;
      {
        PyObject *__pyx_callargs[2] = {__pyx_t_13, __pyx_v_key};
        __pyx_t_12 = __Pyx_PyObject_FastCallMethod(__pyx_mstate_global->__pyx_n_u_format, __pyx_callargs+__pyx_t_8, (2-__pyx_t_8) | (1*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
        __Pyx_XDECREF(__pyx_t_13); __pyx_t_13 = 0;
        if (unlikely(!__pyx_t_12)) __PYX_ERR(0, 1813, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_12);
      }
      __pyx_t_8 = 1;
      {
        PyObject *__pyx_callargs[2] = {__pyx_t_7, __pyx_t_12};
        __pyx_t_5 = __Pyx_PyObject_FastCall(__pyx_t_6, __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;
        __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0;
        __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
        if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1813, __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, 1813, __pyx_L1_error)

      /* "pysam/libcbcf.pyx":1812
 *             d = <vdict_t *>hdr.dict[BCF_DT_CTG]
 *             key = force_bytes(key)
 *             if kh_get_vdict(d, key) == kh_end(d):             # <<<<<<<<<<<<<<
 *                 raise KeyError('invalid contig: {}'.format(key))
 *             ckey = key
*/
    }

    /* "pysam/libcbcf.pyx":1814
 *             if kh_get_vdict(d, key) == kh_end(d):
 *                 raise KeyError('invalid contig: {}'.format(key))
 *             ckey = key             # <<<<<<<<<<<<<<
 * 
 *         bcf_hdr_remove(hdr, BCF_HL_CTG, ckey)
*/
    __pyx_t_14 = __Pyx_PyObject_AsString(__pyx_v_key); if (unlikely((!__pyx_t_14) && PyErr_Occurred())) __PYX_ERR(0, 1814, __pyx_L1_error)
    __pyx_v_ckey = __pyx_t_14;
  }
  __pyx_L3:;

  /* "pysam/libcbcf.pyx":1816
 *             ckey = key
 * 
 *         bcf_hdr_remove(hdr, BCF_HL_CTG, ckey)             # <<<<<<<<<<<<<<
 * 
 *     def clear_header(self):
*/
  bcf_hdr_remove(__pyx_v_hdr, BCF_HL_CTG, __pyx_v_ckey);

  /* "pysam/libcbcf.pyx":1797
 *         return makeVariantContig(self.header, id)
 * 
 *     def remove_header(self, key):             # <<<<<<<<<<<<<<
 *         cdef bcf_hdr_t *hdr = self.header.ptr
 *         cdef int index
*/

  /* function exit code */
  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  __Pyx_TraceReturnValue(__pyx_r, 0, 0, __PYX_ERR(0, 1797, __pyx_L1_error));
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_5);
  __Pyx_XDECREF(__pyx_t_6);
  __Pyx_XDECREF(__pyx_t_7);
  __Pyx_XDECREF(__pyx_t_12);
  __Pyx_XDECREF(__pyx_t_13);
  __Pyx_TraceException(__pyx_lineno, 0, 0);
  #if CYTHON_USE_SYS_MONITORING
  __Pyx_TraceExceptionUnwind(0, 0);
  #else
  __Pyx_TraceReturnValue(NULL, 0, 0, __PYX_ERR(0, 1797, __pyx_L1_error));
  #endif
  __Pyx_AddTraceback("pysam.libcbcf.VariantHeaderContigs.remove_header", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_key);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_PyMonitoring_ExitScope(0);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "pysam/libcbcf.pyx":1818
 *         bcf_hdr_remove(hdr, BCF_HL_CTG, ckey)
 * 
 *     def clear_header(self):             # <<<<<<<<<<<<<<
 *         cdef bcf_hdr_t *hdr = self.header.ptr
 *         bcf_hdr_remove(hdr, BCF_HL_CTG, NULL)
*/

/* Python wrapper */
static PyObject *__pyx_pw_5pysam_7libcbcf_20VariantHeaderContigs_11clear_header(PyObject *__pyx_v_self, 
#if 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_5pysam_7libcbcf_20VariantHeaderContigs_10clear_header, "VariantHeaderContigs.clear_header(self)");
static PyMethodDef __pyx_mdef_5pysam_7libcbcf_20VariantHeaderContigs_11clear_header = {"clear_header", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_5pysam_7libcbcf_20VariantHeaderContigs_11clear_header, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_5pysam_7libcbcf_20VariantHeaderContigs_10clear_header};
static PyObject *__pyx_pw_5pysam_7libcbcf_20VariantHeaderContigs_11clear_header(PyObject *__pyx_v_self, 
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
) {
  #if !CYTHON_METH_FASTCALL
  CYTHON_UNUSED Py_ssize_t __pyx_nargs;
  #endif
  CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("clear_header (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("clear_header", 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("clear_header", __pyx_kwds); return NULL;}
  __pyx_r = __pyx_pf_5pysam_7libcbcf_20VariantHeaderContigs_10clear_header(((struct __pyx_obj_5pysam_7libcbcf_VariantHeaderContigs *)__pyx_v_self));

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

static PyObject *__pyx_pf_5pysam_7libcbcf_20VariantHeaderContigs_10clear_header(struct __pyx_obj_5pysam_7libcbcf_VariantHeaderContigs *__pyx_v_self) {
  bcf_hdr_t *__pyx_v_hdr;
  PyObject *__pyx_r = NULL;
  __Pyx_TraceDeclarationsFunc
  __Pyx_RefNannyDeclarations
  bcf_hdr_t *__pyx_t_1;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_TraceFrameInit(((PyObject *)__pyx_mstate_global->__pyx_codeobj_tab[113]))
  __Pyx_RefNannySetupContext("clear_header", 0);
  __Pyx_TraceStartFunc("clear_header", __pyx_f[0], 1818, 0, 0, 0, __PYX_ERR(0, 1818, __pyx_L1_error));

  /* "pysam/libcbcf.pyx":1819
 * 
 *     def clear_header(self):
 *         cdef bcf_hdr_t *hdr = self.header.ptr             # <<<<<<<<<<<<<<
 *         bcf_hdr_remove(hdr, BCF_HL_CTG, NULL)
 *         #bcf_hdr_sync(hdr)
*/
  __pyx_t_1 = __pyx_v_self->header->ptr;
  __pyx_v_hdr = __pyx_t_1;

  /* "pysam/libcbcf.pyx":1820
 *     def clear_header(self):
 *         cdef bcf_hdr_t *hdr = self.header.ptr
 *         bcf_hdr_remove(hdr, BCF_HL_CTG, NULL)             # <<<<<<<<<<<<<<
 *         #bcf_hdr_sync(hdr)
 * 
*/
  bcf_hdr_remove(__pyx_v_hdr, BCF_HL_CTG, NULL);

  /* "pysam/libcbcf.pyx":1818
 *         bcf_hdr_remove(hdr, BCF_HL_CTG, ckey)
 * 
 *     def clear_header(self):             # <<<<<<<<<<<<<<
 *         cdef bcf_hdr_t *hdr = self.header.ptr
 *         bcf_hdr_remove(hdr, BCF_HL_CTG, NULL)
*/

  /* function exit code */
  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  __Pyx_TraceReturnValue(__pyx_r, 0, 0, __PYX_ERR(0, 1818, __pyx_L1_error));
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_TraceException(__pyx_lineno, 0, 0);
  #if CYTHON_USE_SYS_MONITORING
  __Pyx_TraceExceptionUnwind(0, 0);
  #else
  __Pyx_TraceReturnValue(NULL, 0, 0, __PYX_ERR(0, 1818, __pyx_L1_error));
  #endif
  __Pyx_AddTraceback("pysam.libcbcf.VariantHeaderContigs.clear_header", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_PyMonitoring_ExitScope(0);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}
static PyObject *__pyx_gb_5pysam_7libcbcf_20VariantHeaderContigs_14generator7(__pyx_CoroutineObject *__pyx_generator, CYTHON_UNUSED PyThreadState *__pyx_tstate, PyObject *__pyx_sent_value); /* proto */

/* "pysam/libcbcf.pyx":1823
 *         #bcf_hdr_sync(hdr)
 * 
 *     def __iter__(self):             # <<<<<<<<<<<<<<
 *         cdef bcf_hdr_t *hdr = self.header.ptr
 *         cdef vdict_t *d = <vdict_t *>hdr.dict[BCF_DT_CTG]
*/

/* Python wrapper */
static PyObject *__pyx_pw_5pysam_7libcbcf_20VariantHeaderContigs_13__iter__(PyObject *__pyx_v_self); /*proto*/
static PyObject *__pyx_pw_5pysam_7libcbcf_20VariantHeaderContigs_13__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_5pysam_7libcbcf_20VariantHeaderContigs_12__iter__(((struct __pyx_obj_5pysam_7libcbcf_VariantHeaderContigs *)__pyx_v_self));

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

static PyObject *__pyx_pf_5pysam_7libcbcf_20VariantHeaderContigs_12__iter__(struct __pyx_obj_5pysam_7libcbcf_VariantHeaderContigs *__pyx_v_self) {
  struct __pyx_obj_5pysam_7libcbcf___pyx_scope_struct_14___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("__iter__", 0);
  __pyx_cur_scope = (struct __pyx_obj_5pysam_7libcbcf___pyx_scope_struct_14___iter__ *)__pyx_tp_new_5pysam_7libcbcf___pyx_scope_struct_14___iter__(__pyx_mstate_global->__pyx_ptype_5pysam_7libcbcf___pyx_scope_struct_14___iter__, __pyx_mstate_global->__pyx_empty_tuple, NULL);
  if (unlikely(!__pyx_cur_scope)) {
    __pyx_cur_scope = ((struct __pyx_obj_5pysam_7libcbcf___pyx_scope_struct_14___iter__ *)Py_None);
    __Pyx_INCREF(Py_None);
    __PYX_ERR(0, 1823, __pyx_L1_error)
  } else {
    __Pyx_GOTREF((PyObject *)__pyx_cur_scope);
  }
  __pyx_cur_scope->__pyx_v_self = __pyx_v_self;
  __Pyx_INCREF((PyObject *)__pyx_cur_scope->__pyx_v_self);
  __Pyx_GIVEREF((PyObject *)__pyx_cur_scope->__pyx_v_self);
  {
    __pyx_CoroutineObject *gen = __Pyx_Generator_New((__pyx_coroutine_body_t) __pyx_gb_5pysam_7libcbcf_20VariantHeaderContigs_14generator7, ((PyObject *)__pyx_mstate_global->__pyx_codeobj_tab[114]), (PyObject *) __pyx_cur_scope, __pyx_mstate_global->__pyx_n_u_iter, __pyx_mstate_global->__pyx_n_u_VariantHeaderContigs___iter, __pyx_mstate_global->__pyx_n_u_pysam_libcbcf); if (unlikely(!gen)) __PYX_ERR(0, 1823, __pyx_L1_error)
    __Pyx_DECREF(__pyx_cur_scope);
    __Pyx_RefNannyFinishContext();
    return (PyObject *) gen;
  }

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_AddTraceback("pysam.libcbcf.VariantHeaderContigs.__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_5pysam_7libcbcf_20VariantHeaderContigs_14generator7(__pyx_CoroutineObject *__pyx_generator, CYTHON_UNUSED PyThreadState *__pyx_tstate, PyObject *__pyx_sent_value) /* generator body */
{
  struct __pyx_obj_5pysam_7libcbcf___pyx_scope_struct_14___iter__ *__pyx_cur_scope = ((struct __pyx_obj_5pysam_7libcbcf___pyx_scope_struct_14___iter__ *)__pyx_generator->closure);
  PyObject *__pyx_r = NULL;
  __Pyx_TraceDeclarationsGen
  bcf_hdr_t *__pyx_t_1;
  int __pyx_t_2;
  uint32_t __pyx_t_3;
  uint32_t __pyx_t_4;
  uint32_t __pyx_t_5;
  PyObject *__pyx_t_6 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__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_TraceStartGen("__iter__", __pyx_f[0], 1823, 0, 0, 0, __PYX_ERR(0, 1823, __pyx_L1_error));
    __Pyx_TraceReturnValue(Py_None, 0, 0, __PYX_ERR(0, 1823, __pyx_L1_error));
    __Pyx_RefNannyFinishContext();
    return NULL;
  }
  __pyx_L3_first_run:;
  __Pyx_TraceStartGen("__iter__", __pyx_f[0], 1823, 0, 0, 0, __PYX_ERR(0, 1823, __pyx_L1_error));
  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, 1823, __pyx_L1_error)
  }

  /* "pysam/libcbcf.pyx":1824
 * 
 *     def __iter__(self):
 *         cdef bcf_hdr_t *hdr = self.header.ptr             # <<<<<<<<<<<<<<
 *         cdef vdict_t *d = <vdict_t *>hdr.dict[BCF_DT_CTG]
 *         cdef uint32_t n = kh_size(d)
*/
  __pyx_t_1 = __pyx_cur_scope->__pyx_v_self->header->ptr;
  __pyx_cur_scope->__pyx_v_hdr = __pyx_t_1;

  /* "pysam/libcbcf.pyx":1825
 *     def __iter__(self):
 *         cdef bcf_hdr_t *hdr = self.header.ptr
 *         cdef vdict_t *d = <vdict_t *>hdr.dict[BCF_DT_CTG]             # <<<<<<<<<<<<<<
 *         cdef uint32_t n = kh_size(d)
 * 
*/
  __pyx_cur_scope->__pyx_v_d = ((vdict_t *)(__pyx_cur_scope->__pyx_v_hdr->dict[BCF_DT_CTG]));

  /* "pysam/libcbcf.pyx":1826
 *         cdef bcf_hdr_t *hdr = self.header.ptr
 *         cdef vdict_t *d = <vdict_t *>hdr.dict[BCF_DT_CTG]
 *         cdef uint32_t n = kh_size(d)             # <<<<<<<<<<<<<<
 * 
 *         assert n == hdr.n[BCF_DT_CTG]
*/
  __pyx_cur_scope->__pyx_v_n = kh_size(__pyx_cur_scope->__pyx_v_d);

  /* "pysam/libcbcf.pyx":1828
 *         cdef uint32_t n = kh_size(d)
 * 
 *         assert n == hdr.n[BCF_DT_CTG]             # <<<<<<<<<<<<<<
 * 
 *         for i in range(n):
*/
  #ifndef CYTHON_WITHOUT_ASSERTIONS
  if (unlikely(__pyx_assertions_enabled())) {
    __pyx_t_2 = (__pyx_cur_scope->__pyx_v_n == (__pyx_cur_scope->__pyx_v_hdr->n[BCF_DT_CTG]));
    if (unlikely(!__pyx_t_2)) {
      __Pyx_Raise(__pyx_builtin_AssertionError, 0, 0, 0);
      __PYX_ERR(0, 1828, __pyx_L1_error)
    }
  }
  #else
  if ((1)); else __PYX_ERR(0, 1828, __pyx_L1_error)
  #endif

  /* "pysam/libcbcf.pyx":1830
 *         assert n == hdr.n[BCF_DT_CTG]
 * 
 *         for i in range(n):             # <<<<<<<<<<<<<<
 *             yield bcf_str_cache_get_charptr(bcf_hdr_id2name(hdr, i))
 * 
*/
  __pyx_t_3 = __pyx_cur_scope->__pyx_v_n;
  __pyx_t_4 = __pyx_t_3;
  for (__pyx_t_5 = 0; __pyx_t_5 < __pyx_t_4; __pyx_t_5+=1) {
    __pyx_cur_scope->__pyx_v_i = __pyx_t_5;

    /* "pysam/libcbcf.pyx":1831
 * 
 *         for i in range(n):
 *             yield bcf_str_cache_get_charptr(bcf_hdr_id2name(hdr, i))             # <<<<<<<<<<<<<<
 * 
 *     def get(self, key, default=None):
*/
    __pyx_t_6 = __pyx_f_5pysam_7libcbcf_bcf_str_cache_get_charptr(bcf_hdr_id2name(__pyx_cur_scope->__pyx_v_hdr, __pyx_cur_scope->__pyx_v_i)); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 1831, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_6);
    __pyx_r = __pyx_t_6;
    __pyx_t_6 = 0;
    __pyx_cur_scope->__pyx_t_0 = __pyx_t_3;
    __pyx_cur_scope->__pyx_t_1 = __pyx_t_4;
    __pyx_cur_scope->__pyx_t_2 = __pyx_t_5;
    __Pyx_TraceYield(__pyx_r, 0, __PYX_ERR(0, 1831, __pyx_L1_error));
    __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_TraceResumeGen("__iter__", __pyx_f[0], 1823, 0, __PYX_ERR(0, 1831, __pyx_L1_error));
    __pyx_t_3 = __pyx_cur_scope->__pyx_t_0;
    __pyx_t_4 = __pyx_cur_scope->__pyx_t_1;
    __pyx_t_5 = __pyx_cur_scope->__pyx_t_2;
    if (unlikely(!__pyx_sent_value)) __PYX_ERR(0, 1831, __pyx_L1_error)
  }
  CYTHON_MAYBE_UNUSED_VAR(__pyx_cur_scope);
  __Pyx_TraceReturnValue(Py_None, 0, 0, __PYX_ERR(0, 1823, __pyx_L1_error));

  /* "pysam/libcbcf.pyx":1823
 *         #bcf_hdr_sync(hdr)
 * 
 *     def __iter__(self):             # <<<<<<<<<<<<<<
 *         cdef bcf_hdr_t *hdr = self.header.ptr
 *         cdef vdict_t *d = <vdict_t *>hdr.dict[BCF_DT_CTG]
*/

  /* function exit code */
  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_6);
  if (__Pyx_PyErr_Occurred()) {
    __Pyx_TraceException(__pyx_lineno, 0, 0);
    __Pyx_Generator_Replace_StopIteration(0);
    __Pyx_AddTraceback("__iter__", __pyx_clineno, __pyx_lineno, __pyx_filename);
    __Pyx_TraceExceptionUnwind(0, 0);
  }
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_PyMonitoring_ExitScope(0);
  #if !CYTHON_USE_EXC_INFO_STACK
  __Pyx_Coroutine_ResetAndClearException(__pyx_generator);
  #endif
  __pyx_generator->resume_label = -1;
  __Pyx_Coroutine_clear((PyObject*)__pyx_generator);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "pysam/libcbcf.pyx":1833
 *             yield bcf_str_cache_get_charptr(bcf_hdr_id2name(hdr, i))
 * 
 *     def get(self, key, default=None):             # <<<<<<<<<<<<<<
 *         """D.get(k[,d]) -> D[k] if k in D, else d.  d defaults to None."""
 *         try:
*/

/* Python wrapper */
static PyObject *__pyx_pw_5pysam_7libcbcf_20VariantHeaderContigs_16get(PyObject *__pyx_v_self, 
#if 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_5pysam_7libcbcf_20VariantHeaderContigs_15get, "VariantHeaderContigs.get(self, key, default=None)\n\nD.get(k[,d]) -> D[k] if k in D, else d.  d defaults to None.");
static PyMethodDef __pyx_mdef_5pysam_7libcbcf_20VariantHeaderContigs_16get = {"get", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_5pysam_7libcbcf_20VariantHeaderContigs_16get, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_5pysam_7libcbcf_20VariantHeaderContigs_15get};
static PyObject *__pyx_pw_5pysam_7libcbcf_20VariantHeaderContigs_16get(PyObject *__pyx_v_self, 
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
) {
  PyObject *__pyx_v_key = 0;
  PyObject *__pyx_v_default = 0;
  #if !CYTHON_METH_FASTCALL
  CYTHON_UNUSED Py_ssize_t __pyx_nargs;
  #endif
  CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
  PyObject* values[2] = {0,0};
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("get (wrapper)", 0);
  #if !CYTHON_METH_FASTCALL
  #if CYTHON_ASSUME_SAFE_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,&__pyx_mstate_global->__pyx_n_u_default,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, 1833, __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, 1833, __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, 1833, __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, 1833, __pyx_L3_error)
      if (!values[1]) values[1] = __Pyx_NewRef(((PyObject *)Py_None));
      for (Py_ssize_t i = __pyx_nargs; i < 1; i++) {
        if (unlikely(!values[i])) { __Pyx_RaiseArgtupleInvalid("get", 0, 1, 2, i); __PYX_ERR(0, 1833, __pyx_L3_error) }
      }
    } 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, 1833, __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, 1833, __pyx_L3_error)
        break;
        default: goto __pyx_L5_argtuple_error;
      }
      if (!values[1]) values[1] = __Pyx_NewRef(((PyObject *)Py_None));
    }
    __pyx_v_key = values[0];
    __pyx_v_default = values[1];
  }
  goto __pyx_L6_skip;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("get", 0, 1, 2, __pyx_nargs); __PYX_ERR(0, 1833, __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("pysam.libcbcf.VariantHeaderContigs.get", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_5pysam_7libcbcf_20VariantHeaderContigs_15get(((struct __pyx_obj_5pysam_7libcbcf_VariantHeaderContigs *)__pyx_v_self), __pyx_v_key, __pyx_v_default);

  /* 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_5pysam_7libcbcf_20VariantHeaderContigs_15get(struct __pyx_obj_5pysam_7libcbcf_VariantHeaderContigs *__pyx_v_self, PyObject *__pyx_v_key, PyObject *__pyx_v_default) {
  PyObject *__pyx_r = NULL;
  __Pyx_TraceDeclarationsFunc
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  PyObject *__pyx_t_4 = NULL;
  int __pyx_t_5;
  PyObject *__pyx_t_6 = NULL;
  PyObject *__pyx_t_7 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_TraceFrameInit(((PyObject *)__pyx_mstate_global->__pyx_codeobj_tab[115]))
  __Pyx_RefNannySetupContext("get", 0);
  __Pyx_TraceStartFunc("get", __pyx_f[0], 1833, 0, 0, 0, __PYX_ERR(0, 1833, __pyx_L1_error));

  /* "pysam/libcbcf.pyx":1835
 *     def get(self, key, default=None):
 *         """D.get(k[,d]) -> D[k] if k in D, else d.  d defaults to None."""
 *         try:             # <<<<<<<<<<<<<<
 *             return self[key]
 *         except KeyError:
*/
  {
    __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:*/ {

      /* "pysam/libcbcf.pyx":1836
 *         """D.get(k[,d]) -> D[k] if k in D, else d.  d defaults to None."""
 *         try:
 *             return self[key]             # <<<<<<<<<<<<<<
 *         except KeyError:
 *             return default
*/
      __Pyx_XDECREF(__pyx_r);
      __pyx_t_4 = __Pyx_PyObject_GetItem(((PyObject *)__pyx_v_self), __pyx_v_key); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1836, __pyx_L3_error)
      __Pyx_GOTREF(__pyx_t_4);
      __pyx_r = __pyx_t_4;
      __pyx_t_4 = 0;
      __Pyx_TraceReturnValue(__pyx_r, 3, 0, __PYX_ERR(0, 1836, __pyx_L3_error));
      goto __pyx_L7_try_return;

      /* "pysam/libcbcf.pyx":1835
 *     def get(self, key, default=None):
 *         """D.get(k[,d]) -> D[k] if k in D, else d.  d defaults to None."""
 *         try:             # <<<<<<<<<<<<<<
 *             return self[key]
 *         except KeyError:
*/
    }
    __pyx_L3_error:;
    __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
    __Pyx_TraceException(__pyx_lineno, 0, 0);

    /* "pysam/libcbcf.pyx":1837
 *         try:
 *             return self[key]
 *         except KeyError:             # <<<<<<<<<<<<<<
 *             return default
 * 
*/
    __pyx_t_5 = __Pyx_PyErr_ExceptionMatches(__pyx_builtin_KeyError);
    if (__pyx_t_5) {
      __Pyx_AddTraceback("pysam.libcbcf.VariantHeaderContigs.get", __pyx_clineno, __pyx_lineno, __pyx_filename);
      __Pyx_TraceExceptionHandled(0);
      if (__Pyx_GetException(&__pyx_t_4, &__pyx_t_6, &__pyx_t_7) < 0) __PYX_ERR(0, 1837, __pyx_L5_except_error)
      __Pyx_XGOTREF(__pyx_t_4);
      __Pyx_XGOTREF(__pyx_t_6);
      __Pyx_XGOTREF(__pyx_t_7);
      __Pyx_TraceExceptionDone();

      /* "pysam/libcbcf.pyx":1838
 *             return self[key]
 *         except KeyError:
 *             return default             # <<<<<<<<<<<<<<
 * 
 *     def __contains__(self, key):
*/
      __Pyx_XDECREF(__pyx_r);
      __Pyx_INCREF(__pyx_v_default);
      __pyx_r = __pyx_v_default;
      __Pyx_TraceReturnValue(__pyx_r, 8, 0, __PYX_ERR(0, 1838, __pyx_L5_except_error));
      __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;

    /* "pysam/libcbcf.pyx":1835
 *     def get(self, key, default=None):
 *         """D.get(k[,d]) -> D[k] if k in D, else d.  d defaults to None."""
 *         try:             # <<<<<<<<<<<<<<
 *             return self[key]
 *         except KeyError:
*/
    __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;
  }

  /* "pysam/libcbcf.pyx":1833
 *             yield bcf_str_cache_get_charptr(bcf_hdr_id2name(hdr, i))
 * 
 *     def get(self, key, default=None):             # <<<<<<<<<<<<<<
 *         """D.get(k[,d]) -> D[k] if k in D, else d.  d defaults to None."""
 *         try:
*/

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_XDECREF(__pyx_t_6);
  __Pyx_XDECREF(__pyx_t_7);
  __Pyx_TraceException(__pyx_lineno, 0, 0);
  #if CYTHON_USE_SYS_MONITORING
  __Pyx_TraceExceptionUnwind(0, 0);
  #else
  __Pyx_TraceReturnValue(NULL, 0, 0, __PYX_ERR(0, 1833, __pyx_L1_error));
  #endif
  __Pyx_AddTraceback("pysam.libcbcf.VariantHeaderContigs.get", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_PyMonitoring_ExitScope(0);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "pysam/libcbcf.pyx":1840
 *             return default
 * 
 *     def __contains__(self, key):             # <<<<<<<<<<<<<<
 *         try:
 *             self[key]
*/

/* Python wrapper */
static int __pyx_pw_5pysam_7libcbcf_20VariantHeaderContigs_18__contains__(PyObject *__pyx_v_self, PyObject *__pyx_v_key); /*proto*/
static int __pyx_pw_5pysam_7libcbcf_20VariantHeaderContigs_18__contains__(PyObject *__pyx_v_self, PyObject *__pyx_v_key) {
  CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__contains__ (wrapper)", 0);
  __pyx_kwvalues = __Pyx_KwValues_VARARGS(__pyx_args, __pyx_nargs);
  __pyx_r = __pyx_pf_5pysam_7libcbcf_20VariantHeaderContigs_17__contains__(((struct __pyx_obj_5pysam_7libcbcf_VariantHeaderContigs *)__pyx_v_self), ((PyObject *)__pyx_v_key));

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

static int __pyx_pf_5pysam_7libcbcf_20VariantHeaderContigs_17__contains__(struct __pyx_obj_5pysam_7libcbcf_VariantHeaderContigs *__pyx_v_self, PyObject *__pyx_v_key) {
  int __pyx_r;
  __Pyx_TraceDeclarationsFunc
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  PyObject *__pyx_t_4 = NULL;
  int __pyx_t_5;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_TraceFrameInit(((PyObject *)__pyx_mstate_global->__pyx_codeobj_tab[116]))
  __Pyx_RefNannySetupContext("__contains__", 0);
  __Pyx_TraceStartFunc("__contains__", __pyx_f[0], 1840, 0, 0, 0, __PYX_ERR(0, 1840, __pyx_L1_error));

  /* "pysam/libcbcf.pyx":1841
 * 
 *     def __contains__(self, key):
 *         try:             # <<<<<<<<<<<<<<
 *             self[key]
 *         except KeyError:
*/
  {
    __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:*/ {

      /* "pysam/libcbcf.pyx":1842
 *     def __contains__(self, key):
 *         try:
 *             self[key]             # <<<<<<<<<<<<<<
 *         except KeyError:
 *             return False
*/
      __pyx_t_4 = __Pyx_PyObject_GetItem(((PyObject *)__pyx_v_self), __pyx_v_key); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1842, __pyx_L3_error)
      __Pyx_GOTREF(__pyx_t_4);
      __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;

      /* "pysam/libcbcf.pyx":1841
 * 
 *     def __contains__(self, key):
 *         try:             # <<<<<<<<<<<<<<
 *             self[key]
 *         except KeyError:
*/
    }

    /* "pysam/libcbcf.pyx":1846
 *             return False
 *         else:
 *             return True             # <<<<<<<<<<<<<<
 * 
 *     def iterkeys(self):
*/
    /*else:*/ {
      __pyx_r = 1;
      __Pyx_TraceReturnCValue(__pyx_r, __Pyx_PyLong_From_int, 8, 0, __PYX_ERR(0, 1846, __pyx_L5_except_error));
      goto __pyx_L6_except_return;
    }
    __pyx_L3_error:;
    __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
    __Pyx_TraceException(__pyx_lineno, 0, 0);

    /* "pysam/libcbcf.pyx":1843
 *         try:
 *             self[key]
 *         except KeyError:             # <<<<<<<<<<<<<<
 *             return False
 *         else:
*/
    __pyx_t_5 = __Pyx_PyErr_ExceptionMatches(__pyx_builtin_KeyError);
    if (__pyx_t_5) {
      __Pyx_AddTraceback("pysam.libcbcf.VariantHeaderContigs.__contains__", __pyx_clineno, __pyx_lineno, __pyx_filename);
      __Pyx_TraceExceptionHandled(0);
      __Pyx_ErrRestore(0,0,0);
      __Pyx_TraceExceptionDone();

      /* "pysam/libcbcf.pyx":1844
 *             self[key]
 *         except KeyError:
 *             return False             # <<<<<<<<<<<<<<
 *         else:
 *             return True
*/
      __pyx_r = 0;
      __Pyx_TraceReturnCValue(__pyx_r, __Pyx_PyLong_From_int, 6, 0, __PYX_ERR(0, 1844, __pyx_L5_except_error));
      goto __pyx_L6_except_return;
    }
    goto __pyx_L5_except_error;

    /* "pysam/libcbcf.pyx":1841
 * 
 *     def __contains__(self, key):
 *         try:             # <<<<<<<<<<<<<<
 *             self[key]
 *         except KeyError:
*/
    __pyx_L5_except_error:;
    __Pyx_XGIVEREF(__pyx_t_1);
    __Pyx_XGIVEREF(__pyx_t_2);
    __Pyx_XGIVEREF(__pyx_t_3);
    __Pyx_ExceptionReset(__pyx_t_1, __pyx_t_2, __pyx_t_3);
    goto __pyx_L1_error;
    __pyx_L6_except_return:;
    __Pyx_XGIVEREF(__pyx_t_1);
    __Pyx_XGIVEREF(__pyx_t_2);
    __Pyx_XGIVEREF(__pyx_t_3);
    __Pyx_ExceptionReset(__pyx_t_1, __pyx_t_2, __pyx_t_3);
    goto __pyx_L0;
  }

  /* "pysam/libcbcf.pyx":1840
 *             return default
 * 
 *     def __contains__(self, key):             # <<<<<<<<<<<<<<
 *         try:
 *             self[key]
*/

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_TraceException(__pyx_lineno, 0, 0);
  #if CYTHON_USE_SYS_MONITORING
  __Pyx_TraceExceptionUnwind(0, 0);
  #else
  __Pyx_TraceReturnValue(NULL, 0, 0, __PYX_ERR(0, 1840, __pyx_L1_error));
  #endif
  __Pyx_AddTraceback("pysam.libcbcf.VariantHeaderContigs.__contains__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = -1;
  __pyx_L0:;
  __Pyx_PyMonitoring_ExitScope(0);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "pysam/libcbcf.pyx":1848
 *             return True
 * 
 *     def iterkeys(self):             # <<<<<<<<<<<<<<
 *         """D.iterkeys() -> an iterator over the keys of D"""
 *         return iter(self)
*/

/* Python wrapper */
static PyObject *__pyx_pw_5pysam_7libcbcf_20VariantHeaderContigs_20iterkeys(PyObject *__pyx_v_self, 
#if 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_5pysam_7libcbcf_20VariantHeaderContigs_19iterkeys, "VariantHeaderContigs.iterkeys(self)\n\nD.iterkeys() -> an iterator over the keys of D");
static PyMethodDef __pyx_mdef_5pysam_7libcbcf_20VariantHeaderContigs_20iterkeys = {"iterkeys", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_5pysam_7libcbcf_20VariantHeaderContigs_20iterkeys, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_5pysam_7libcbcf_20VariantHeaderContigs_19iterkeys};
static PyObject *__pyx_pw_5pysam_7libcbcf_20VariantHeaderContigs_20iterkeys(PyObject *__pyx_v_self, 
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
) {
  #if !CYTHON_METH_FASTCALL
  CYTHON_UNUSED Py_ssize_t __pyx_nargs;
  #endif
  CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("iterkeys (wrapper)", 0);
  #if !CYTHON_METH_FASTCALL
  #if CYTHON_ASSUME_SAFE_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("iterkeys", 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("iterkeys", __pyx_kwds); return NULL;}
  __pyx_r = __pyx_pf_5pysam_7libcbcf_20VariantHeaderContigs_19iterkeys(((struct __pyx_obj_5pysam_7libcbcf_VariantHeaderContigs *)__pyx_v_self));

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

static PyObject *__pyx_pf_5pysam_7libcbcf_20VariantHeaderContigs_19iterkeys(struct __pyx_obj_5pysam_7libcbcf_VariantHeaderContigs *__pyx_v_self) {
  PyObject *__pyx_r = NULL;
  __Pyx_TraceDeclarationsFunc
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_TraceFrameInit(((PyObject *)__pyx_mstate_global->__pyx_codeobj_tab[117]))
  __Pyx_RefNannySetupContext("iterkeys", 0);
  __Pyx_TraceStartFunc("iterkeys", __pyx_f[0], 1848, 0, 0, 0, __PYX_ERR(0, 1848, __pyx_L1_error));

  /* "pysam/libcbcf.pyx":1850
 *     def iterkeys(self):
 *         """D.iterkeys() -> an iterator over the keys of D"""
 *         return iter(self)             # <<<<<<<<<<<<<<
 * 
 *     def itervalues(self):
*/
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = PyObject_GetIter(((PyObject *)__pyx_v_self)); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1850, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  __Pyx_TraceReturnValue(__pyx_r, 1, 0, __PYX_ERR(0, 1850, __pyx_L1_error));
  goto __pyx_L0;

  /* "pysam/libcbcf.pyx":1848
 *             return True
 * 
 *     def iterkeys(self):             # <<<<<<<<<<<<<<
 *         """D.iterkeys() -> an iterator over the keys of D"""
 *         return iter(self)
*/

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_TraceException(__pyx_lineno, 0, 0);
  #if CYTHON_USE_SYS_MONITORING
  __Pyx_TraceExceptionUnwind(0, 0);
  #else
  __Pyx_TraceReturnValue(NULL, 0, 0, __PYX_ERR(0, 1848, __pyx_L1_error));
  #endif
  __Pyx_AddTraceback("pysam.libcbcf.VariantHeaderContigs.iterkeys", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_PyMonitoring_ExitScope(0);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}
static PyObject *__pyx_gb_5pysam_7libcbcf_20VariantHeaderContigs_23generator8(__pyx_CoroutineObject *__pyx_generator, CYTHON_UNUSED PyThreadState *__pyx_tstate, PyObject *__pyx_sent_value); /* proto */

/* "pysam/libcbcf.pyx":1852
 *         return iter(self)
 * 
 *     def itervalues(self):             # <<<<<<<<<<<<<<
 *         """D.itervalues() -> an iterator over the values of D"""
 *         for key in self:
*/

/* Python wrapper */
static PyObject *__pyx_pw_5pysam_7libcbcf_20VariantHeaderContigs_22itervalues(PyObject *__pyx_v_self, 
#if 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_5pysam_7libcbcf_20VariantHeaderContigs_21itervalues, "VariantHeaderContigs.itervalues(self)\n\nD.itervalues() -> an iterator over the values of D");
static PyMethodDef __pyx_mdef_5pysam_7libcbcf_20VariantHeaderContigs_22itervalues = {"itervalues", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_5pysam_7libcbcf_20VariantHeaderContigs_22itervalues, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_5pysam_7libcbcf_20VariantHeaderContigs_21itervalues};
static PyObject *__pyx_pw_5pysam_7libcbcf_20VariantHeaderContigs_22itervalues(PyObject *__pyx_v_self, 
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
) {
  #if !CYTHON_METH_FASTCALL
  CYTHON_UNUSED Py_ssize_t __pyx_nargs;
  #endif
  CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("itervalues (wrapper)", 0);
  #if !CYTHON_METH_FASTCALL
  #if CYTHON_ASSUME_SAFE_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("itervalues", 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("itervalues", __pyx_kwds); return NULL;}
  __pyx_r = __pyx_pf_5pysam_7libcbcf_20VariantHeaderContigs_21itervalues(((struct __pyx_obj_5pysam_7libcbcf_VariantHeaderContigs *)__pyx_v_self));

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

static PyObject *__pyx_pf_5pysam_7libcbcf_20VariantHeaderContigs_21itervalues(struct __pyx_obj_5pysam_7libcbcf_VariantHeaderContigs *__pyx_v_self) {
  struct __pyx_obj_5pysam_7libcbcf___pyx_scope_struct_15_itervalues *__pyx_cur_scope;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("itervalues", 0);
  __pyx_cur_scope = (struct __pyx_obj_5pysam_7libcbcf___pyx_scope_struct_15_itervalues *)__pyx_tp_new_5pysam_7libcbcf___pyx_scope_struct_15_itervalues(__pyx_mstate_global->__pyx_ptype_5pysam_7libcbcf___pyx_scope_struct_15_itervalues, __pyx_mstate_global->__pyx_empty_tuple, NULL);
  if (unlikely(!__pyx_cur_scope)) {
    __pyx_cur_scope = ((struct __pyx_obj_5pysam_7libcbcf___pyx_scope_struct_15_itervalues *)Py_None);
    __Pyx_INCREF(Py_None);
    __PYX_ERR(0, 1852, __pyx_L1_error)
  } else {
    __Pyx_GOTREF((PyObject *)__pyx_cur_scope);
  }
  __pyx_cur_scope->__pyx_v_self = __pyx_v_self;
  __Pyx_INCREF((PyObject *)__pyx_cur_scope->__pyx_v_self);
  __Pyx_GIVEREF((PyObject *)__pyx_cur_scope->__pyx_v_self);
  {
    __pyx_CoroutineObject *gen = __Pyx_Generator_New((__pyx_coroutine_body_t) __pyx_gb_5pysam_7libcbcf_20VariantHeaderContigs_23generator8, ((PyObject *)__pyx_mstate_global->__pyx_codeobj_tab[118]), (PyObject *) __pyx_cur_scope, __pyx_mstate_global->__pyx_n_u_itervalues, __pyx_mstate_global->__pyx_n_u_VariantHeaderContigs_itervalues, __pyx_mstate_global->__pyx_n_u_pysam_libcbcf); if (unlikely(!gen)) __PYX_ERR(0, 1852, __pyx_L1_error)
    __Pyx_DECREF(__pyx_cur_scope);
    __Pyx_RefNannyFinishContext();
    return (PyObject *) gen;
  }

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_AddTraceback("pysam.libcbcf.VariantHeaderContigs.itervalues", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __Pyx_DECREF((PyObject *)__pyx_cur_scope);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_gb_5pysam_7libcbcf_20VariantHeaderContigs_23generator8(__pyx_CoroutineObject *__pyx_generator, CYTHON_UNUSED PyThreadState *__pyx_tstate, PyObject *__pyx_sent_value) /* generator body */
{
  struct __pyx_obj_5pysam_7libcbcf___pyx_scope_struct_15_itervalues *__pyx_cur_scope = ((struct __pyx_obj_5pysam_7libcbcf___pyx_scope_struct_15_itervalues *)__pyx_generator->closure);
  PyObject *__pyx_r = NULL;
  __Pyx_TraceDeclarationsGen
  PyObject *__pyx_t_1 = NULL;
  Py_ssize_t __pyx_t_2;
  PyObject *(*__pyx_t_3)(PyObject *);
  PyObject *__pyx_t_4 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("itervalues", 0);
  switch (__pyx_generator->resume_label) {
    case 0: goto __pyx_L3_first_run;
    case 1: goto __pyx_L6_resume_from_yield;
    default: /* CPython raises the right error here */
    __Pyx_TraceStartGen("itervalues", __pyx_f[0], 1852, 0, 0, 0, __PYX_ERR(0, 1852, __pyx_L1_error));
    __Pyx_TraceReturnValue(Py_None, 0, 0, __PYX_ERR(0, 1852, __pyx_L1_error));
    __Pyx_RefNannyFinishContext();
    return NULL;
  }
  __pyx_L3_first_run:;
  __Pyx_TraceStartGen("itervalues", __pyx_f[0], 1852, 0, 0, 0, __PYX_ERR(0, 1852, __pyx_L1_error));
  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, 1852, __pyx_L1_error)
  }

  /* "pysam/libcbcf.pyx":1854
 *     def itervalues(self):
 *         """D.itervalues() -> an iterator over the values of D"""
 *         for key in self:             # <<<<<<<<<<<<<<
 *             yield self[key]
 * 
*/
  if (likely(PyList_CheckExact(((PyObject *)__pyx_cur_scope->__pyx_v_self))) || PyTuple_CheckExact(((PyObject *)__pyx_cur_scope->__pyx_v_self))) {
    __pyx_t_1 = ((PyObject *)__pyx_cur_scope->__pyx_v_self); __Pyx_INCREF(__pyx_t_1);
    __pyx_t_2 = 0;
    __pyx_t_3 = NULL;
  } else {
    __pyx_t_2 = -1; __pyx_t_1 = PyObject_GetIter(((PyObject *)__pyx_cur_scope->__pyx_v_self)); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1854, __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, 1854, __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, 1854, __pyx_L1_error)
          #endif
          if (__pyx_t_2 >= __pyx_temp) break;
        }
        __pyx_t_4 = __Pyx_PyList_GetItemRef(__pyx_t_1, __pyx_t_2);
        ++__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, 1854, __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, 1854, __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, 1854, __pyx_L1_error)
          PyErr_Clear();
        }
        break;
      }
    }
    __Pyx_GOTREF(__pyx_t_4);
    __Pyx_XGOTREF(__pyx_cur_scope->__pyx_v_key);
    __Pyx_XDECREF_SET(__pyx_cur_scope->__pyx_v_key, __pyx_t_4);
    __Pyx_GIVEREF(__pyx_t_4);
    __pyx_t_4 = 0;

    /* "pysam/libcbcf.pyx":1855
 *         """D.itervalues() -> an iterator over the values of D"""
 *         for key in self:
 *             yield self[key]             # <<<<<<<<<<<<<<
 * 
 *     def iteritems(self):
*/
    __pyx_t_4 = __Pyx_PyObject_GetItem(((PyObject *)__pyx_cur_scope->__pyx_v_self), __pyx_cur_scope->__pyx_v_key); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1855, __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_TraceYield(__pyx_r, 0, __PYX_ERR(0, 1855, __pyx_L1_error));
    __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_TraceResumeGen("itervalues", __pyx_f[0], 1852, 0, __PYX_ERR(0, 1855, __pyx_L1_error));
    __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, 1855, __pyx_L1_error)

    /* "pysam/libcbcf.pyx":1854
 *     def itervalues(self):
 *         """D.itervalues() -> an iterator over the values of D"""
 *         for key in self:             # <<<<<<<<<<<<<<
 *             yield self[key]
 * 
*/
  }
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  CYTHON_MAYBE_UNUSED_VAR(__pyx_cur_scope);
  __Pyx_TraceReturnValue(Py_None, 0, 0, __PYX_ERR(0, 1852, __pyx_L1_error));

  /* "pysam/libcbcf.pyx":1852
 *         return iter(self)
 * 
 *     def itervalues(self):             # <<<<<<<<<<<<<<
 *         """D.itervalues() -> an iterator over the values of D"""
 *         for key in self:
*/

  /* 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_TraceException(__pyx_lineno, 0, 0);
    __Pyx_Generator_Replace_StopIteration(0);
    __Pyx_AddTraceback("itervalues", __pyx_clineno, __pyx_lineno, __pyx_filename);
    __Pyx_TraceExceptionUnwind(0, 0);
  }
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_PyMonitoring_ExitScope(0);
  #if !CYTHON_USE_EXC_INFO_STACK
  __Pyx_Coroutine_ResetAndClearException(__pyx_generator);
  #endif
  __pyx_generator->resume_label = -1;
  __Pyx_Coroutine_clear((PyObject*)__pyx_generator);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}
static PyObject *__pyx_gb_5pysam_7libcbcf_20VariantHeaderContigs_26generator9(__pyx_CoroutineObject *__pyx_generator, CYTHON_UNUSED PyThreadState *__pyx_tstate, PyObject *__pyx_sent_value); /* proto */

/* "pysam/libcbcf.pyx":1857
 *             yield self[key]
 * 
 *     def iteritems(self):             # <<<<<<<<<<<<<<
 *         """D.iteritems() -> an iterator over the (key, value) items of D"""
 *         for key in self:
*/

/* Python wrapper */
static PyObject *__pyx_pw_5pysam_7libcbcf_20VariantHeaderContigs_25iteritems(PyObject *__pyx_v_self, 
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
); /*proto*/
PyDoc_STRVAR(__pyx_doc_5pysam_7libcbcf_20VariantHeaderContigs_24iteritems, "VariantHeaderContigs.iteritems(self)\n\nD.iteritems() -> an iterator over the (key, value) items of D");
static PyMethodDef __pyx_mdef_5pysam_7libcbcf_20VariantHeaderContigs_25iteritems = {"iteritems", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_5pysam_7libcbcf_20VariantHeaderContigs_25iteritems, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_5pysam_7libcbcf_20VariantHeaderContigs_24iteritems};
static PyObject *__pyx_pw_5pysam_7libcbcf_20VariantHeaderContigs_25iteritems(PyObject *__pyx_v_self, 
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
) {
  #if !CYTHON_METH_FASTCALL
  CYTHON_UNUSED Py_ssize_t __pyx_nargs;
  #endif
  CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("iteritems (wrapper)", 0);
  #if !CYTHON_METH_FASTCALL
  #if CYTHON_ASSUME_SAFE_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("iteritems", 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("iteritems", __pyx_kwds); return NULL;}
  __pyx_r = __pyx_pf_5pysam_7libcbcf_20VariantHeaderContigs_24iteritems(((struct __pyx_obj_5pysam_7libcbcf_VariantHeaderContigs *)__pyx_v_self));

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

static PyObject *__pyx_pf_5pysam_7libcbcf_20VariantHeaderContigs_24iteritems(struct __pyx_obj_5pysam_7libcbcf_VariantHeaderContigs *__pyx_v_self) {
  struct __pyx_obj_5pysam_7libcbcf___pyx_scope_struct_16_iteritems *__pyx_cur_scope;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("iteritems", 0);
  __pyx_cur_scope = (struct __pyx_obj_5pysam_7libcbcf___pyx_scope_struct_16_iteritems *)__pyx_tp_new_5pysam_7libcbcf___pyx_scope_struct_16_iteritems(__pyx_mstate_global->__pyx_ptype_5pysam_7libcbcf___pyx_scope_struct_16_iteritems, __pyx_mstate_global->__pyx_empty_tuple, NULL);
  if (unlikely(!__pyx_cur_scope)) {
    __pyx_cur_scope = ((struct __pyx_obj_5pysam_7libcbcf___pyx_scope_struct_16_iteritems *)Py_None);
    __Pyx_INCREF(Py_None);
    __PYX_ERR(0, 1857, __pyx_L1_error)
  } else {
    __Pyx_GOTREF((PyObject *)__pyx_cur_scope);
  }
  __pyx_cur_scope->__pyx_v_self = __pyx_v_self;
  __Pyx_INCREF((PyObject *)__pyx_cur_scope->__pyx_v_self);
  __Pyx_GIVEREF((PyObject *)__pyx_cur_scope->__pyx_v_self);
  {
    __pyx_CoroutineObject *gen = __Pyx_Generator_New((__pyx_coroutine_body_t) __pyx_gb_5pysam_7libcbcf_20VariantHeaderContigs_26generator9, ((PyObject *)__pyx_mstate_global->__pyx_codeobj_tab[119]), (PyObject *) __pyx_cur_scope, __pyx_mstate_global->__pyx_n_u_iteritems, __pyx_mstate_global->__pyx_n_u_VariantHeaderContigs_iteritems, __pyx_mstate_global->__pyx_n_u_pysam_libcbcf); if (unlikely(!gen)) __PYX_ERR(0, 1857, __pyx_L1_error)
    __Pyx_DECREF(__pyx_cur_scope);
    __Pyx_RefNannyFinishContext();
    return (PyObject *) gen;
  }

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_AddTraceback("pysam.libcbcf.VariantHeaderContigs.iteritems", __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_5pysam_7libcbcf_20VariantHeaderContigs_26generator9(__pyx_CoroutineObject *__pyx_generator, CYTHON_UNUSED PyThreadState *__pyx_tstate, PyObject *__pyx_sent_value) /* generator body */
{
  struct __pyx_obj_5pysam_7libcbcf___pyx_scope_struct_16_iteritems *__pyx_cur_scope = ((struct __pyx_obj_5pysam_7libcbcf___pyx_scope_struct_16_iteritems *)__pyx_generator->closure);
  PyObject *__pyx_r = NULL;
  __Pyx_TraceDeclarationsGen
  PyObject *__pyx_t_1 = NULL;
  Py_ssize_t __pyx_t_2;
  PyObject *(*__pyx_t_3)(PyObject *);
  PyObject *__pyx_t_4 = NULL;
  PyObject *__pyx_t_5 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("iteritems", 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_TraceStartGen("iteritems", __pyx_f[0], 1857, 0, 0, 0, __PYX_ERR(0, 1857, __pyx_L1_error));
    __Pyx_TraceReturnValue(Py_None, 0, 0, __PYX_ERR(0, 1857, __pyx_L1_error));
    __Pyx_RefNannyFinishContext();
    return NULL;
  }
  __pyx_L3_first_run:;
  __Pyx_TraceStartGen("iteritems", __pyx_f[0], 1857, 0, 0, 0, __PYX_ERR(0, 1857, __pyx_L1_error));
  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, 1857, __pyx_L1_error)
  }

  /* "pysam/libcbcf.pyx":1859
 *     def iteritems(self):
 *         """D.iteritems() -> an iterator over the (key, value) items of D"""
 *         for key in self:             # <<<<<<<<<<<<<<
 *             yield (key, self[key])
 * 
*/
  if (likely(PyList_CheckExact(((PyObject *)__pyx_cur_scope->__pyx_v_self))) || PyTuple_CheckExact(((PyObject *)__pyx_cur_scope->__pyx_v_self))) {
    __pyx_t_1 = ((PyObject *)__pyx_cur_scope->__pyx_v_self); __Pyx_INCREF(__pyx_t_1);
    __pyx_t_2 = 0;
    __pyx_t_3 = NULL;
  } else {
    __pyx_t_2 = -1; __pyx_t_1 = PyObject_GetIter(((PyObject *)__pyx_cur_scope->__pyx_v_self)); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1859, __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, 1859, __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, 1859, __pyx_L1_error)
          #endif
          if (__pyx_t_2 >= __pyx_temp) break;
        }
        __pyx_t_4 = __Pyx_PyList_GetItemRef(__pyx_t_1, __pyx_t_2);
        ++__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, 1859, __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, 1859, __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, 1859, __pyx_L1_error)
          PyErr_Clear();
        }
        break;
      }
    }
    __Pyx_GOTREF(__pyx_t_4);
    __Pyx_XGOTREF(__pyx_cur_scope->__pyx_v_key);
    __Pyx_XDECREF_SET(__pyx_cur_scope->__pyx_v_key, __pyx_t_4);
    __Pyx_GIVEREF(__pyx_t_4);
    __pyx_t_4 = 0;

    /* "pysam/libcbcf.pyx":1860
 *         """D.iteritems() -> an iterator over the (key, value) items of D"""
 *         for key in self:
 *             yield (key, self[key])             # <<<<<<<<<<<<<<
 * 
 *     def keys(self):
*/
    __pyx_t_4 = __Pyx_PyObject_GetItem(((PyObject *)__pyx_cur_scope->__pyx_v_self), __pyx_cur_scope->__pyx_v_key); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1860, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
    __pyx_t_5 = PyTuple_New(2); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1860, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_5);
    __Pyx_INCREF(__pyx_cur_scope->__pyx_v_key);
    __Pyx_GIVEREF(__pyx_cur_scope->__pyx_v_key);
    if (__Pyx_PyTuple_SET_ITEM(__pyx_t_5, 0, __pyx_cur_scope->__pyx_v_key) != (0)) __PYX_ERR(0, 1860, __pyx_L1_error);
    __Pyx_GIVEREF(__pyx_t_4);
    if (__Pyx_PyTuple_SET_ITEM(__pyx_t_5, 1, __pyx_t_4) != (0)) __PYX_ERR(0, 1860, __pyx_L1_error);
    __pyx_t_4 = 0;
    __pyx_r = __pyx_t_5;
    __pyx_t_5 = 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_TraceYield(__pyx_r, 0, __PYX_ERR(0, 1860, __pyx_L1_error));
    __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_TraceResumeGen("iteritems", __pyx_f[0], 1857, 0, __PYX_ERR(0, 1860, __pyx_L1_error));
    __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, 1860, __pyx_L1_error)

    /* "pysam/libcbcf.pyx":1859
 *     def iteritems(self):
 *         """D.iteritems() -> an iterator over the (key, value) items of D"""
 *         for key in self:             # <<<<<<<<<<<<<<
 *             yield (key, self[key])
 * 
*/
  }
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  CYTHON_MAYBE_UNUSED_VAR(__pyx_cur_scope);
  __Pyx_TraceReturnValue(Py_None, 0, 0, __PYX_ERR(0, 1857, __pyx_L1_error));

  /* "pysam/libcbcf.pyx":1857
 *             yield self[key]
 * 
 *     def iteritems(self):             # <<<<<<<<<<<<<<
 *         """D.iteritems() -> an iterator over the (key, value) items of D"""
 *         for key in self:
*/

  /* 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);
  if (__Pyx_PyErr_Occurred()) {
    __Pyx_TraceException(__pyx_lineno, 0, 0);
    __Pyx_Generator_Replace_StopIteration(0);
    __Pyx_AddTraceback("iteritems", __pyx_clineno, __pyx_lineno, __pyx_filename);
    __Pyx_TraceExceptionUnwind(0, 0);
  }
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_PyMonitoring_ExitScope(0);
  #if !CYTHON_USE_EXC_INFO_STACK
  __Pyx_Coroutine_ResetAndClearException(__pyx_generator);
  #endif
  __pyx_generator->resume_label = -1;
  __Pyx_Coroutine_clear((PyObject*)__pyx_generator);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "pysam/libcbcf.pyx":1862
 *             yield (key, self[key])
 * 
 *     def keys(self):             # <<<<<<<<<<<<<<
 *         """D.keys() -> list of D's keys"""
 *         return list(self)
*/

/* Python wrapper */
static PyObject *__pyx_pw_5pysam_7libcbcf_20VariantHeaderContigs_28keys(PyObject *__pyx_v_self, 
#if 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_5pysam_7libcbcf_20VariantHeaderContigs_27keys, "VariantHeaderContigs.keys(self)\n\nD.keys() -> list of D's keys");
static PyMethodDef __pyx_mdef_5pysam_7libcbcf_20VariantHeaderContigs_28keys = {"keys", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_5pysam_7libcbcf_20VariantHeaderContigs_28keys, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_5pysam_7libcbcf_20VariantHeaderContigs_27keys};
static PyObject *__pyx_pw_5pysam_7libcbcf_20VariantHeaderContigs_28keys(PyObject *__pyx_v_self, 
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
) {
  #if !CYTHON_METH_FASTCALL
  CYTHON_UNUSED Py_ssize_t __pyx_nargs;
  #endif
  CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("keys (wrapper)", 0);
  #if !CYTHON_METH_FASTCALL
  #if CYTHON_ASSUME_SAFE_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("keys", 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("keys", __pyx_kwds); return NULL;}
  __pyx_r = __pyx_pf_5pysam_7libcbcf_20VariantHeaderContigs_27keys(((struct __pyx_obj_5pysam_7libcbcf_VariantHeaderContigs *)__pyx_v_self));

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

static PyObject *__pyx_pf_5pysam_7libcbcf_20VariantHeaderContigs_27keys(struct __pyx_obj_5pysam_7libcbcf_VariantHeaderContigs *__pyx_v_self) {
  PyObject *__pyx_r = NULL;
  __Pyx_TraceDeclarationsFunc
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_TraceFrameInit(((PyObject *)__pyx_mstate_global->__pyx_codeobj_tab[120]))
  __Pyx_RefNannySetupContext("keys", 0);
  __Pyx_TraceStartFunc("keys", __pyx_f[0], 1862, 0, 0, 0, __PYX_ERR(0, 1862, __pyx_L1_error));

  /* "pysam/libcbcf.pyx":1864
 *     def keys(self):
 *         """D.keys() -> list of D's keys"""
 *         return list(self)             # <<<<<<<<<<<<<<
 * 
 *     def items(self):
*/
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = PySequence_List(((PyObject *)__pyx_v_self)); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1864, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  __Pyx_TraceReturnValue(__pyx_r, 1, 0, __PYX_ERR(0, 1864, __pyx_L1_error));
  goto __pyx_L0;

  /* "pysam/libcbcf.pyx":1862
 *             yield (key, self[key])
 * 
 *     def keys(self):             # <<<<<<<<<<<<<<
 *         """D.keys() -> list of D's keys"""
 *         return list(self)
*/

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_TraceException(__pyx_lineno, 0, 0);
  #if CYTHON_USE_SYS_MONITORING
  __Pyx_TraceExceptionUnwind(0, 0);
  #else
  __Pyx_TraceReturnValue(NULL, 0, 0, __PYX_ERR(0, 1862, __pyx_L1_error));
  #endif
  __Pyx_AddTraceback("pysam.libcbcf.VariantHeaderContigs.keys", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_PyMonitoring_ExitScope(0);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "pysam/libcbcf.pyx":1866
 *         return list(self)
 * 
 *     def items(self):             # <<<<<<<<<<<<<<
 *         """D.items() -> list of D's (key, value) pairs, as 2-tuples"""
 *         return list(self.iteritems())
*/

/* Python wrapper */
static PyObject *__pyx_pw_5pysam_7libcbcf_20VariantHeaderContigs_30items(PyObject *__pyx_v_self, 
#if 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_5pysam_7libcbcf_20VariantHeaderContigs_29items, "VariantHeaderContigs.items(self)\n\nD.items() -> list of D's (key, value) pairs, as 2-tuples");
static PyMethodDef __pyx_mdef_5pysam_7libcbcf_20VariantHeaderContigs_30items = {"items", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_5pysam_7libcbcf_20VariantHeaderContigs_30items, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_5pysam_7libcbcf_20VariantHeaderContigs_29items};
static PyObject *__pyx_pw_5pysam_7libcbcf_20VariantHeaderContigs_30items(PyObject *__pyx_v_self, 
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
) {
  #if !CYTHON_METH_FASTCALL
  CYTHON_UNUSED Py_ssize_t __pyx_nargs;
  #endif
  CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("items (wrapper)", 0);
  #if !CYTHON_METH_FASTCALL
  #if CYTHON_ASSUME_SAFE_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("items", 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("items", __pyx_kwds); return NULL;}
  __pyx_r = __pyx_pf_5pysam_7libcbcf_20VariantHeaderContigs_29items(((struct __pyx_obj_5pysam_7libcbcf_VariantHeaderContigs *)__pyx_v_self));

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

static PyObject *__pyx_pf_5pysam_7libcbcf_20VariantHeaderContigs_29items(struct __pyx_obj_5pysam_7libcbcf_VariantHeaderContigs *__pyx_v_self) {
  PyObject *__pyx_r = NULL;
  __Pyx_TraceDeclarationsFunc
  __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_TraceFrameInit(((PyObject *)__pyx_mstate_global->__pyx_codeobj_tab[121]))
  __Pyx_RefNannySetupContext("items", 0);
  __Pyx_TraceStartFunc("items", __pyx_f[0], 1866, 0, 0, 0, __PYX_ERR(0, 1866, __pyx_L1_error));

  /* "pysam/libcbcf.pyx":1868
 *     def items(self):
 *         """D.items() -> list of D's (key, value) pairs, as 2-tuples"""
 *         return list(self.iteritems())             # <<<<<<<<<<<<<<
 * 
 *     def values(self):
*/
  __Pyx_XDECREF(__pyx_r);
  __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(__pyx_mstate_global->__pyx_n_u_iteritems, __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, 1868, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
  }
  __pyx_t_2 = __Pyx_PySequence_ListKeepNew(__pyx_t_1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1868, __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;
  __Pyx_TraceReturnValue(__pyx_r, 1, 0, __PYX_ERR(0, 1868, __pyx_L1_error));
  goto __pyx_L0;

  /* "pysam/libcbcf.pyx":1866
 *         return list(self)
 * 
 *     def items(self):             # <<<<<<<<<<<<<<
 *         """D.items() -> list of D's (key, value) pairs, as 2-tuples"""
 *         return list(self.iteritems())
*/

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_TraceException(__pyx_lineno, 0, 0);
  #if CYTHON_USE_SYS_MONITORING
  __Pyx_TraceExceptionUnwind(0, 0);
  #else
  __Pyx_TraceReturnValue(NULL, 0, 0, __PYX_ERR(0, 1866, __pyx_L1_error));
  #endif
  __Pyx_AddTraceback("pysam.libcbcf.VariantHeaderContigs.items", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_PyMonitoring_ExitScope(0);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "pysam/libcbcf.pyx":1870
 *         return list(self.iteritems())
 * 
 *     def values(self):             # <<<<<<<<<<<<<<
 *         """D.values() -> list of D's values"""
 *         return list(self.itervalues())
*/

/* Python wrapper */
static PyObject *__pyx_pw_5pysam_7libcbcf_20VariantHeaderContigs_32values(PyObject *__pyx_v_self, 
#if 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_5pysam_7libcbcf_20VariantHeaderContigs_31values, "VariantHeaderContigs.values(self)\n\nD.values() -> list of D's values");
static PyMethodDef __pyx_mdef_5pysam_7libcbcf_20VariantHeaderContigs_32values = {"values", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_5pysam_7libcbcf_20VariantHeaderContigs_32values, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_5pysam_7libcbcf_20VariantHeaderContigs_31values};
static PyObject *__pyx_pw_5pysam_7libcbcf_20VariantHeaderContigs_32values(PyObject *__pyx_v_self, 
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
) {
  #if !CYTHON_METH_FASTCALL
  CYTHON_UNUSED Py_ssize_t __pyx_nargs;
  #endif
  CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("values (wrapper)", 0);
  #if !CYTHON_METH_FASTCALL
  #if CYTHON_ASSUME_SAFE_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("values", 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("values", __pyx_kwds); return NULL;}
  __pyx_r = __pyx_pf_5pysam_7libcbcf_20VariantHeaderContigs_31values(((struct __pyx_obj_5pysam_7libcbcf_VariantHeaderContigs *)__pyx_v_self));

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

static PyObject *__pyx_pf_5pysam_7libcbcf_20VariantHeaderContigs_31values(struct __pyx_obj_5pysam_7libcbcf_VariantHeaderContigs *__pyx_v_self) {
  PyObject *__pyx_r = NULL;
  __Pyx_TraceDeclarationsFunc
  __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_TraceFrameInit(((PyObject *)__pyx_mstate_global->__pyx_codeobj_tab[122]))
  __Pyx_RefNannySetupContext("values", 0);
  __Pyx_TraceStartFunc("values", __pyx_f[0], 1870, 0, 0, 0, __PYX_ERR(0, 1870, __pyx_L1_error));

  /* "pysam/libcbcf.pyx":1872
 *     def values(self):
 *         """D.values() -> list of D's values"""
 *         return list(self.itervalues())             # <<<<<<<<<<<<<<
 * 
 *     # Mappings are not hashable by default, but subclasses can change this
*/
  __Pyx_XDECREF(__pyx_r);
  __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(__pyx_mstate_global->__pyx_n_u_itervalues, __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, 1872, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
  }
  __pyx_t_2 = __Pyx_PySequence_ListKeepNew(__pyx_t_1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1872, __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;
  __Pyx_TraceReturnValue(__pyx_r, 1, 0, __PYX_ERR(0, 1872, __pyx_L1_error));
  goto __pyx_L0;

  /* "pysam/libcbcf.pyx":1870
 *         return list(self.iteritems())
 * 
 *     def values(self):             # <<<<<<<<<<<<<<
 *         """D.values() -> list of D's values"""
 *         return list(self.itervalues())
*/

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_TraceException(__pyx_lineno, 0, 0);
  #if CYTHON_USE_SYS_MONITORING
  __Pyx_TraceExceptionUnwind(0, 0);
  #else
  __Pyx_TraceReturnValue(NULL, 0, 0, __PYX_ERR(0, 1870, __pyx_L1_error));
  #endif
  __Pyx_AddTraceback("pysam.libcbcf.VariantHeaderContigs.values", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_PyMonitoring_ExitScope(0);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "pysam/libcbcf.pyx":1879
 *     #TODO: implement __richcmp__
 * 
 *     def add(self, id, length=None, **kwargs):             # <<<<<<<<<<<<<<
 *         """Add a new contig record"""
 *         if id in self:
*/

/* Python wrapper */
static PyObject *__pyx_pw_5pysam_7libcbcf_20VariantHeaderContigs_34add(PyObject *__pyx_v_self, 
#if 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_5pysam_7libcbcf_20VariantHeaderContigs_33add, "VariantHeaderContigs.add(self, id, length=None, **kwargs)\n\nAdd a new contig record");
static PyMethodDef __pyx_mdef_5pysam_7libcbcf_20VariantHeaderContigs_34add = {"add", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_5pysam_7libcbcf_20VariantHeaderContigs_34add, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_5pysam_7libcbcf_20VariantHeaderContigs_33add};
static PyObject *__pyx_pw_5pysam_7libcbcf_20VariantHeaderContigs_34add(PyObject *__pyx_v_self, 
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
) {
  PyObject *__pyx_v_id = 0;
  PyObject *__pyx_v_length = 0;
  PyObject *__pyx_v_kwargs = 0;
  #if !CYTHON_METH_FASTCALL
  CYTHON_UNUSED Py_ssize_t __pyx_nargs;
  #endif
  CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
  PyObject* values[2] = {0,0};
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("add (wrapper)", 0);
  #if !CYTHON_METH_FASTCALL
  #if CYTHON_ASSUME_SAFE_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_kwargs = PyDict_New(); if (unlikely(!__pyx_v_kwargs)) return NULL;
  __Pyx_GOTREF(__pyx_v_kwargs);
  {
    PyObject ** const __pyx_pyargnames[] = {&__pyx_mstate_global->__pyx_n_u_id,&__pyx_mstate_global->__pyx_n_u_length,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, 1879, __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, 1879, __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, 1879, __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, __pyx_v_kwargs, values, kwd_pos_args, __pyx_kwds_len, "add", 1) < 0) __PYX_ERR(0, 1879, __pyx_L3_error)
      if (!values[1]) values[1] = __Pyx_NewRef(((PyObject *)Py_None));
      for (Py_ssize_t i = __pyx_nargs; i < 1; i++) {
        if (unlikely(!values[i])) { __Pyx_RaiseArgtupleInvalid("add", 0, 1, 2, i); __PYX_ERR(0, 1879, __pyx_L3_error) }
      }
    } 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, 1879, __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, 1879, __pyx_L3_error)
        break;
        default: goto __pyx_L5_argtuple_error;
      }
      if (!values[1]) values[1] = __Pyx_NewRef(((PyObject *)Py_None));
    }
    __pyx_v_id = values[0];
    __pyx_v_length = values[1];
  }
  goto __pyx_L6_skip;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("add", 0, 1, 2, __pyx_nargs); __PYX_ERR(0, 1879, __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_kwargs); __pyx_v_kwargs = 0;
  __Pyx_AddTraceback("pysam.libcbcf.VariantHeaderContigs.add", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_5pysam_7libcbcf_20VariantHeaderContigs_33add(((struct __pyx_obj_5pysam_7libcbcf_VariantHeaderContigs *)__pyx_v_self), __pyx_v_id, __pyx_v_length, __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_kwargs);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_5pysam_7libcbcf_20VariantHeaderContigs_33add(struct __pyx_obj_5pysam_7libcbcf_VariantHeaderContigs *__pyx_v_self, PyObject *__pyx_v_id, PyObject *__pyx_v_length, PyObject *__pyx_v_kwargs) {
  PyObject *__pyx_v_items = NULL;
  PyObject *__pyx_r = NULL;
  __Pyx_TraceDeclarationsFunc
  __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;
  size_t __pyx_t_7;
  int __pyx_t_8;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_TraceFrameInit(((PyObject *)__pyx_mstate_global->__pyx_codeobj_tab[123]))
  __Pyx_RefNannySetupContext("add", 0);
  __Pyx_TraceStartFunc("add", __pyx_f[0], 1879, 0, 0, 0, __PYX_ERR(0, 1879, __pyx_L1_error));

  /* "pysam/libcbcf.pyx":1881
 *     def add(self, id, length=None, **kwargs):
 *         """Add a new contig record"""
 *         if id in self:             # <<<<<<<<<<<<<<
 *             raise ValueError('Header already exists for contig {}'.format(id))
 * 
*/
  __pyx_t_1 = (__Pyx_PySequence_ContainsTF(__pyx_v_id, ((PyObject *)__pyx_v_self), Py_EQ)); if (unlikely((__pyx_t_1 < 0))) __PYX_ERR(0, 1881, __pyx_L1_error)
  if (unlikely(__pyx_t_1)) {

    /* "pysam/libcbcf.pyx":1882
 *         """Add a new contig record"""
 *         if id in self:
 *             raise ValueError('Header already exists for contig {}'.format(id))             # <<<<<<<<<<<<<<
 * 
 *         items = [('ID', unquoted_str(id))]
*/
    __pyx_t_3 = NULL;
    __Pyx_INCREF(__pyx_builtin_ValueError);
    __pyx_t_4 = __pyx_builtin_ValueError; 
    __pyx_t_6 = __pyx_mstate_global->__pyx_kp_u_Header_already_exists_for_contig;
    __Pyx_INCREF(__pyx_t_6);
    __pyx_t_7 = 0;
    {
      PyObject *__pyx_callargs[2] = {__pyx_t_6, __pyx_v_id};
      __pyx_t_5 = __Pyx_PyObject_FastCallMethod(__pyx_mstate_global->__pyx_n_u_format, __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_5)) __PYX_ERR(0, 1882, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_5);
    }
    __pyx_t_7 = 1;
    {
      PyObject *__pyx_callargs[2] = {__pyx_t_3, __pyx_t_5};
      __pyx_t_2 = __Pyx_PyObject_FastCall(__pyx_t_4, __pyx_callargs+__pyx_t_7, (2-__pyx_t_7) | (__pyx_t_7*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
      __Pyx_XDECREF(__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_2)) __PYX_ERR(0, 1882, __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, 1882, __pyx_L1_error)

    /* "pysam/libcbcf.pyx":1881
 *     def add(self, id, length=None, **kwargs):
 *         """Add a new contig record"""
 *         if id in self:             # <<<<<<<<<<<<<<
 *             raise ValueError('Header already exists for contig {}'.format(id))
 * 
*/
  }

  /* "pysam/libcbcf.pyx":1884
 *             raise ValueError('Header already exists for contig {}'.format(id))
 * 
 *         items = [('ID', unquoted_str(id))]             # <<<<<<<<<<<<<<
 *         if length is not None:
 *             items.append(("length", unquoted_str(length)))
*/
  __pyx_t_4 = NULL;
  __Pyx_GetModuleGlobalName(__pyx_t_5, __pyx_mstate_global->__pyx_n_u_unquoted_str); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1884, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_5);
  __pyx_t_7 = 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_7 = 0;
  }
  #endif
  {
    PyObject *__pyx_callargs[2] = {__pyx_t_4, __pyx_v_id};
    __pyx_t_2 = __Pyx_PyObject_FastCall(__pyx_t_5, __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_5); __pyx_t_5 = 0;
    if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1884, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
  }
  __pyx_t_5 = PyTuple_New(2); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1884, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_5);
  __Pyx_INCREF(__pyx_mstate_global->__pyx_n_u_ID);
  __Pyx_GIVEREF(__pyx_mstate_global->__pyx_n_u_ID);
  if (__Pyx_PyTuple_SET_ITEM(__pyx_t_5, 0, __pyx_mstate_global->__pyx_n_u_ID) != (0)) __PYX_ERR(0, 1884, __pyx_L1_error);
  __Pyx_GIVEREF(__pyx_t_2);
  if (__Pyx_PyTuple_SET_ITEM(__pyx_t_5, 1, __pyx_t_2) != (0)) __PYX_ERR(0, 1884, __pyx_L1_error);
  __pyx_t_2 = 0;
  __pyx_t_2 = PyList_New(1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1884, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_GIVEREF(__pyx_t_5);
  if (__Pyx_PyList_SET_ITEM(__pyx_t_2, 0, __pyx_t_5) != (0)) __PYX_ERR(0, 1884, __pyx_L1_error);
  __pyx_t_5 = 0;
  __pyx_v_items = __pyx_t_2;
  __pyx_t_2 = 0;

  /* "pysam/libcbcf.pyx":1885
 * 
 *         items = [('ID', unquoted_str(id))]
 *         if length is not None:             # <<<<<<<<<<<<<<
 *             items.append(("length", unquoted_str(length)))
 *         items += kwargs.items()
*/
  __pyx_t_1 = (__pyx_v_length != Py_None);
  if (__pyx_t_1) {

    /* "pysam/libcbcf.pyx":1886
 *         items = [('ID', unquoted_str(id))]
 *         if length is not None:
 *             items.append(("length", unquoted_str(length)))             # <<<<<<<<<<<<<<
 *         items += kwargs.items()
 *         self.header.add_meta('contig', items=items)
*/
    __pyx_t_5 = NULL;
    __Pyx_GetModuleGlobalName(__pyx_t_4, __pyx_mstate_global->__pyx_n_u_unquoted_str); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1886, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
    __pyx_t_7 = 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_7 = 0;
    }
    #endif
    {
      PyObject *__pyx_callargs[2] = {__pyx_t_5, __pyx_v_length};
      __pyx_t_2 = __Pyx_PyObject_FastCall(__pyx_t_4, __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_4); __pyx_t_4 = 0;
      if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1886, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_2);
    }
    __pyx_t_4 = PyTuple_New(2); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1886, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
    __Pyx_INCREF(__pyx_mstate_global->__pyx_n_u_length);
    __Pyx_GIVEREF(__pyx_mstate_global->__pyx_n_u_length);
    if (__Pyx_PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_mstate_global->__pyx_n_u_length) != (0)) __PYX_ERR(0, 1886, __pyx_L1_error);
    __Pyx_GIVEREF(__pyx_t_2);
    if (__Pyx_PyTuple_SET_ITEM(__pyx_t_4, 1, __pyx_t_2) != (0)) __PYX_ERR(0, 1886, __pyx_L1_error);
    __pyx_t_2 = 0;
    __pyx_t_8 = __Pyx_PyObject_Append(__pyx_v_items, __pyx_t_4); if (unlikely(__pyx_t_8 == ((int)-1))) __PYX_ERR(0, 1886, __pyx_L1_error)
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;

    /* "pysam/libcbcf.pyx":1885
 * 
 *         items = [('ID', unquoted_str(id))]
 *         if length is not None:             # <<<<<<<<<<<<<<
 *             items.append(("length", unquoted_str(length)))
 *         items += kwargs.items()
*/
  }

  /* "pysam/libcbcf.pyx":1887
 *         if length is not None:
 *             items.append(("length", unquoted_str(length)))
 *         items += kwargs.items()             # <<<<<<<<<<<<<<
 *         self.header.add_meta('contig', items=items)
 * 
*/
  __pyx_t_4 = __Pyx_PyDict_Items(__pyx_v_kwargs); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1887, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  __pyx_t_2 = PyNumber_InPlaceAdd(__pyx_v_items, __pyx_t_4); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1887, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  __Pyx_DECREF_SET(__pyx_v_items, __pyx_t_2);
  __pyx_t_2 = 0;

  /* "pysam/libcbcf.pyx":1888
 *             items.append(("length", unquoted_str(length)))
 *         items += kwargs.items()
 *         self.header.add_meta('contig', items=items)             # <<<<<<<<<<<<<<
 * 
 * 
*/
  __pyx_t_4 = ((PyObject *)__pyx_v_self->header);
  __Pyx_INCREF(__pyx_t_4);
  __pyx_t_7 = 0;
  {
    PyObject *__pyx_callargs[2 + ((CYTHON_VECTORCALL) ? 1 : 0)] = {__pyx_t_4, __pyx_mstate_global->__pyx_n_u_contig};
    __pyx_t_5 = __Pyx_MakeVectorcallBuilderKwds(1); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1888, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_5);
    if (__Pyx_VectorcallBuilder_AddArg(__pyx_mstate_global->__pyx_n_u_items, __pyx_v_items, __pyx_t_5, __pyx_callargs+2, 0) < 0) __PYX_ERR(0, 1888, __pyx_L1_error)
    __pyx_t_2 = __Pyx_Object_VectorcallMethod_CallFromBuilder(__pyx_mstate_global->__pyx_n_u_add_meta, __pyx_callargs+__pyx_t_7, (2-__pyx_t_7) | (1*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET), __pyx_t_5);
    __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
    __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
    if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1888, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
  }
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

  /* "pysam/libcbcf.pyx":1879
 *     #TODO: implement __richcmp__
 * 
 *     def add(self, id, length=None, **kwargs):             # <<<<<<<<<<<<<<
 *         """Add a new contig record"""
 *         if id in self:
*/

  /* function exit code */
  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  __Pyx_TraceReturnValue(__pyx_r, 0, 0, __PYX_ERR(0, 1879, __pyx_L1_error));
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_XDECREF(__pyx_t_5);
  __Pyx_XDECREF(__pyx_t_6);
  __Pyx_TraceException(__pyx_lineno, 0, 0);
  #if CYTHON_USE_SYS_MONITORING
  __Pyx_TraceExceptionUnwind(0, 0);
  #else
  __Pyx_TraceReturnValue(NULL, 0, 0, __PYX_ERR(0, 1879, __pyx_L1_error));
  #endif
  __Pyx_AddTraceback("pysam.libcbcf.VariantHeaderContigs.add", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_items);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_PyMonitoring_ExitScope(0);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "pysam/libcbcf.pxd":57
 * 
 * cdef class VariantHeaderContigs(object):
 *     cdef readonly VariantHeader header             # <<<<<<<<<<<<<<
 * 
 * 
*/

/* Python wrapper */
static PyObject *__pyx_pw_5pysam_7libcbcf_20VariantHeaderContigs_6header_1__get__(PyObject *__pyx_v_self); /*proto*/
static PyObject *__pyx_pw_5pysam_7libcbcf_20VariantHeaderContigs_6header_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_5pysam_7libcbcf_20VariantHeaderContigs_6header___get__(((struct __pyx_obj_5pysam_7libcbcf_VariantHeaderContigs *)__pyx_v_self));

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

static PyObject *__pyx_pf_5pysam_7libcbcf_20VariantHeaderContigs_6header___get__(struct __pyx_obj_5pysam_7libcbcf_VariantHeaderContigs *__pyx_v_self) {
  PyObject *__pyx_r = NULL;
  __Pyx_TraceDeclarationsFunc
  __Pyx_RefNannyDeclarations
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_TraceFrameInit(((PyObject *)__pyx_mstate_global->__pyx_codeobj_tab[124]))
  __Pyx_RefNannySetupContext("__get__", 0);
  __Pyx_TraceStartFunc("__get__", __pyx_f[3], 57, 0, 0, 0, __PYX_ERR(3, 57, __pyx_L1_error));
  __Pyx_XDECREF(__pyx_r);
  __Pyx_INCREF((PyObject *)__pyx_v_self->header);
  __pyx_r = ((PyObject *)__pyx_v_self->header);
  __Pyx_TraceReturnValue(__pyx_r, 0, 0, __PYX_ERR(3, 57, __pyx_L1_error));
  goto __pyx_L0;

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_TraceException(__pyx_lineno, 0, 0);
  #if CYTHON_USE_SYS_MONITORING
  __Pyx_TraceExceptionUnwind(0, 0);
  #else
  __Pyx_TraceReturnValue(NULL, 0, 0, __PYX_ERR(3, 57, __pyx_L1_error));
  #endif
  __Pyx_AddTraceback("pysam.libcbcf.VariantHeaderContigs.header.__get__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_PyMonitoring_ExitScope(0);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

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

/* Python wrapper */
static PyObject *__pyx_pw_5pysam_7libcbcf_20VariantHeaderContigs_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*/
PyDoc_STRVAR(__pyx_doc_5pysam_7libcbcf_20VariantHeaderContigs_35__reduce_cython__, "VariantHeaderContigs.__reduce_cython__(self)");
static PyMethodDef __pyx_mdef_5pysam_7libcbcf_20VariantHeaderContigs_36__reduce_cython__ = {"__reduce_cython__", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_5pysam_7libcbcf_20VariantHeaderContigs_36__reduce_cython__, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_5pysam_7libcbcf_20VariantHeaderContigs_35__reduce_cython__};
static PyObject *__pyx_pw_5pysam_7libcbcf_20VariantHeaderContigs_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_5pysam_7libcbcf_20VariantHeaderContigs_35__reduce_cython__(((struct __pyx_obj_5pysam_7libcbcf_VariantHeaderContigs *)__pyx_v_self));

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

static PyObject *__pyx_pf_5pysam_7libcbcf_20VariantHeaderContigs_35__reduce_cython__(struct __pyx_obj_5pysam_7libcbcf_VariantHeaderContigs *__pyx_v_self) {
  PyObject *__pyx_v_state = 0;
  PyObject *__pyx_v__dict = 0;
  int __pyx_v_use_setstate;
  PyObject *__pyx_r = NULL;
  __Pyx_TraceDeclarationsFunc
  __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_TraceFrameInit(((PyObject *)__pyx_mstate_global->__pyx_codeobj_tab[125]))
  __Pyx_RefNannySetupContext("__reduce_cython__", 0);
  __Pyx_TraceStartFunc("__reduce_cython__", __pyx_f[4], 1, 0, 0, 0, __PYX_ERR(4, 1, __pyx_L1_error));

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

  /* "(tree fragment)":6
 *     cdef bint use_setstate
 *     state = (self.header,)
 *     _dict = getattr(self, '__dict__', None)             # <<<<<<<<<<<<<<
 *     if _dict is not None:
 *         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(4, 6, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_v__dict = __pyx_t_1;
  __pyx_t_1 = 0;

  /* "(tree fragment)":7
 *     state = (self.header,)
 *     _dict = getattr(self, '__dict__', None)
 *     if _dict is not None:             # <<<<<<<<<<<<<<
 *         state += (_dict,)
 *         use_setstate = True
*/
  __pyx_t_2 = (__pyx_v__dict != Py_None);
  if (__pyx_t_2) {

    /* "(tree fragment)":8
 *     _dict = getattr(self, '__dict__', None)
 *     if _dict is not None:
 *         state += (_dict,)             # <<<<<<<<<<<<<<
 *         use_setstate = True
 *     else:
*/
    __pyx_t_1 = PyTuple_New(1); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 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(4, 8, __pyx_L1_error);
    __pyx_t_3 = PyNumber_InPlaceAdd(__pyx_v_state, __pyx_t_1); if (unlikely(!__pyx_t_3)) __PYX_ERR(4, 8, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    __Pyx_DECREF_SET(__pyx_v_state, ((PyObject*)__pyx_t_3));
    __pyx_t_3 = 0;

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

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

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

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

    /* "(tree fragment)":13
 *         use_setstate = self.header is not None
 *     if use_setstate:
 *         return __pyx_unpickle_VariantHeaderContigs, (type(self), 0x1e0584a, None), state             # <<<<<<<<<<<<<<
 *     else:
 *         return __pyx_unpickle_VariantHeaderContigs, (type(self), 0x1e0584a, state)
*/
    __Pyx_XDECREF(__pyx_r);
    __Pyx_GetModuleGlobalName(__pyx_t_3, __pyx_mstate_global->__pyx_n_u_pyx_unpickle_VariantHeaderCont); if (unlikely(!__pyx_t_3)) __PYX_ERR(4, 13, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __pyx_t_1 = PyTuple_New(3); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 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(4, 13, __pyx_L1_error);
    __Pyx_INCREF(__pyx_mstate_global->__pyx_int_31479882);
    __Pyx_GIVEREF(__pyx_mstate_global->__pyx_int_31479882);
    if (__Pyx_PyTuple_SET_ITEM(__pyx_t_1, 1, __pyx_mstate_global->__pyx_int_31479882) != (0)) __PYX_ERR(4, 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(4, 13, __pyx_L1_error);
    __pyx_t_4 = PyTuple_New(3); if (unlikely(!__pyx_t_4)) __PYX_ERR(4, 13, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
    __Pyx_GIVEREF(__pyx_t_3);
    if (__Pyx_PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_t_3) != (0)) __PYX_ERR(4, 13, __pyx_L1_error);
    __Pyx_GIVEREF(__pyx_t_1);
    if (__Pyx_PyTuple_SET_ITEM(__pyx_t_4, 1, __pyx_t_1) != (0)) __PYX_ERR(4, 13, __pyx_L1_error);
    __Pyx_INCREF(__pyx_v_state);
    __Pyx_GIVEREF(__pyx_v_state);
    if (__Pyx_PyTuple_SET_ITEM(__pyx_t_4, 2, __pyx_v_state) != (0)) __PYX_ERR(4, 13, __pyx_L1_error);
    __pyx_t_3 = 0;
    __pyx_t_1 = 0;
    __pyx_r = __pyx_t_4;
    __pyx_t_4 = 0;
    __Pyx_TraceReturnValue(__pyx_r, 25, 0, __PYX_ERR(4, 13, __pyx_L1_error));
    goto __pyx_L0;

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

  /* "(tree fragment)":15
 *         return __pyx_unpickle_VariantHeaderContigs, (type(self), 0x1e0584a, None), state
 *     else:
 *         return __pyx_unpickle_VariantHeaderContigs, (type(self), 0x1e0584a, state)             # <<<<<<<<<<<<<<
 * def __setstate_cython__(self, __pyx_state):
 *     __pyx_unpickle_VariantHeaderContigs__set_state(self, __pyx_state)
*/
  /*else*/ {
    __Pyx_XDECREF(__pyx_r);
    __Pyx_GetModuleGlobalName(__pyx_t_4, __pyx_mstate_global->__pyx_n_u_pyx_unpickle_VariantHeaderCont); if (unlikely(!__pyx_t_4)) __PYX_ERR(4, 15, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
    __pyx_t_1 = PyTuple_New(3); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 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(4, 15, __pyx_L1_error);
    __Pyx_INCREF(__pyx_mstate_global->__pyx_int_31479882);
    __Pyx_GIVEREF(__pyx_mstate_global->__pyx_int_31479882);
    if (__Pyx_PyTuple_SET_ITEM(__pyx_t_1, 1, __pyx_mstate_global->__pyx_int_31479882) != (0)) __PYX_ERR(4, 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(4, 15, __pyx_L1_error);
    __pyx_t_3 = PyTuple_New(2); if (unlikely(!__pyx_t_3)) __PYX_ERR(4, 15, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __Pyx_GIVEREF(__pyx_t_4);
    if (__Pyx_PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_t_4) != (0)) __PYX_ERR(4, 15, __pyx_L1_error);
    __Pyx_GIVEREF(__pyx_t_1);
    if (__Pyx_PyTuple_SET_ITEM(__pyx_t_3, 1, __pyx_t_1) != (0)) __PYX_ERR(4, 15, __pyx_L1_error);
    __pyx_t_4 = 0;
    __pyx_t_1 = 0;
    __pyx_r = __pyx_t_3;
    __pyx_t_3 = 0;
    __Pyx_TraceReturnValue(__pyx_r, 33, 0, __PYX_ERR(4, 15, __pyx_L1_error));
    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_3);
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_TraceException(__pyx_lineno, 0, 0);
  #if CYTHON_USE_SYS_MONITORING
  __Pyx_TraceExceptionUnwind(0, 0);
  #else
  __Pyx_TraceReturnValue(NULL, 0, 0, __PYX_ERR(4, 1, __pyx_L1_error));
  #endif
  __Pyx_AddTraceback("pysam.libcbcf.VariantHeaderContigs.__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_PyMonitoring_ExitScope(0);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "(tree fragment)":16
 *     else:
 *         return __pyx_unpickle_VariantHeaderContigs, (type(self), 0x1e0584a, state)
 * def __setstate_cython__(self, __pyx_state):             # <<<<<<<<<<<<<<
 *     __pyx_unpickle_VariantHeaderContigs__set_state(self, __pyx_state)
*/

/* Python wrapper */
static PyObject *__pyx_pw_5pysam_7libcbcf_20VariantHeaderContigs_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*/
PyDoc_STRVAR(__pyx_doc_5pysam_7libcbcf_20VariantHeaderContigs_37__setstate_cython__, "VariantHeaderContigs.__setstate_cython__(self, __pyx_state)");
static PyMethodDef __pyx_mdef_5pysam_7libcbcf_20VariantHeaderContigs_38__setstate_cython__ = {"__setstate_cython__", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_5pysam_7libcbcf_20VariantHeaderContigs_38__setstate_cython__, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_5pysam_7libcbcf_20VariantHeaderContigs_37__setstate_cython__};
static PyObject *__pyx_pw_5pysam_7libcbcf_20VariantHeaderContigs_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
) {
  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(4, 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(4, 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(4, 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(4, 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(4, 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(4, 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("pysam.libcbcf.VariantHeaderContigs.__setstate_cython__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_5pysam_7libcbcf_20VariantHeaderContigs_37__setstate_cython__(((struct __pyx_obj_5pysam_7libcbcf_VariantHeaderContigs *)__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_5pysam_7libcbcf_20VariantHeaderContigs_37__setstate_cython__(struct __pyx_obj_5pysam_7libcbcf_VariantHeaderContigs *__pyx_v_self, PyObject *__pyx_v___pyx_state) {
  PyObject *__pyx_r = NULL;
  __Pyx_TraceDeclarationsFunc
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_TraceFrameInit(((PyObject *)__pyx_mstate_global->__pyx_codeobj_tab[126]))
  __Pyx_RefNannySetupContext("__setstate_cython__", 0);
  __Pyx_TraceStartFunc("__setstate_cython__", __pyx_f[4], 16, 0, 0, 0, __PYX_ERR(4, 16, __pyx_L1_error));

  /* "(tree fragment)":17
 *         return __pyx_unpickle_VariantHeaderContigs, (type(self), 0x1e0584a, state)
 * def __setstate_cython__(self, __pyx_state):
 *     __pyx_unpickle_VariantHeaderContigs__set_state(self, __pyx_state)             # <<<<<<<<<<<<<<
*/
  if (!(likely(PyTuple_CheckExact(__pyx_v___pyx_state))||((__pyx_v___pyx_state) == Py_None) || __Pyx_RaiseUnexpectedTypeError("tuple", __pyx_v___pyx_state))) __PYX_ERR(4, 17, __pyx_L1_error)
  __pyx_t_1 = __pyx_f_5pysam_7libcbcf___pyx_unpickle_VariantHeaderContigs__set_state(__pyx_v_self, ((PyObject*)__pyx_v___pyx_state)); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 17, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "(tree fragment)":16
 *     else:
 *         return __pyx_unpickle_VariantHeaderContigs, (type(self), 0x1e0584a, state)
 * def __setstate_cython__(self, __pyx_state):             # <<<<<<<<<<<<<<
 *     __pyx_unpickle_VariantHeaderContigs__set_state(self, __pyx_state)
*/

  /* function exit code */
  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  __Pyx_TraceReturnValue(__pyx_r, 0, 0, __PYX_ERR(4, 16, __pyx_L1_error));
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_TraceException(__pyx_lineno, 0, 0);
  #if CYTHON_USE_SYS_MONITORING
  __Pyx_TraceExceptionUnwind(0, 0);
  #else
  __Pyx_TraceReturnValue(NULL, 0, 0, __PYX_ERR(4, 16, __pyx_L1_error));
  #endif
  __Pyx_AddTraceback("pysam.libcbcf.VariantHeaderContigs.__setstate_cython__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_PyMonitoring_ExitScope(0);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "pysam/libcbcf.pyx":1891
 * 
 * 
 * cdef VariantHeaderContigs makeVariantHeaderContigs(VariantHeader header):             # <<<<<<<<<<<<<<
 *     if not header:
 *         raise ValueError('invalid VariantHeader')
*/

static struct __pyx_obj_5pysam_7libcbcf_VariantHeaderContigs *__pyx_f_5pysam_7libcbcf_makeVariantHeaderContigs(struct __pyx_obj_5pysam_7libcbcf_VariantHeader *__pyx_v_header) {
  struct __pyx_obj_5pysam_7libcbcf_VariantHeaderContigs *__pyx_v_contigs = 0;
  struct __pyx_obj_5pysam_7libcbcf_VariantHeaderContigs *__pyx_r = NULL;
  __Pyx_TraceDeclarationsFunc
  __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_TraceFrameInit(((PyObject *)__pyx_mstate_global->__pyx_codeobj_tab[127]))
  __Pyx_RefNannySetupContext("makeVariantHeaderContigs", 0);
  __Pyx_TraceStartFunc("makeVariantHeaderContigs", __pyx_f[0], 1891, 0, 0, 0, __PYX_ERR(0, 1891, __pyx_L1_error));

  /* "pysam/libcbcf.pyx":1892
 * 
 * cdef VariantHeaderContigs makeVariantHeaderContigs(VariantHeader header):
 *     if not header:             # <<<<<<<<<<<<<<
 *         raise ValueError('invalid VariantHeader')
 * 
*/
  __pyx_t_1 = __Pyx_PyObject_IsTrue(((PyObject *)__pyx_v_header)); if (unlikely((__pyx_t_1 < 0))) __PYX_ERR(0, 1892, __pyx_L1_error)
  __pyx_t_2 = (!__pyx_t_1);
  if (unlikely(__pyx_t_2)) {

    /* "pysam/libcbcf.pyx":1893
 * cdef VariantHeaderContigs makeVariantHeaderContigs(VariantHeader header):
 *     if not header:
 *         raise ValueError('invalid VariantHeader')             # <<<<<<<<<<<<<<
 * 
 *     cdef VariantHeaderContigs contigs = VariantHeaderContigs.__new__(VariantHeaderContigs)
*/
    __pyx_t_4 = NULL;
    __Pyx_INCREF(__pyx_builtin_ValueError);
    __pyx_t_5 = __pyx_builtin_ValueError; 
    __pyx_t_6 = 1;
    {
      PyObject *__pyx_callargs[2] = {__pyx_t_4, __pyx_mstate_global->__pyx_kp_u_invalid_VariantHeader};
      __pyx_t_3 = __Pyx_PyObject_FastCall(__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, 1893, __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, 1893, __pyx_L1_error)

    /* "pysam/libcbcf.pyx":1892
 * 
 * cdef VariantHeaderContigs makeVariantHeaderContigs(VariantHeader header):
 *     if not header:             # <<<<<<<<<<<<<<
 *         raise ValueError('invalid VariantHeader')
 * 
*/
  }

  /* "pysam/libcbcf.pyx":1895
 *         raise ValueError('invalid VariantHeader')
 * 
 *     cdef VariantHeaderContigs contigs = VariantHeaderContigs.__new__(VariantHeaderContigs)             # <<<<<<<<<<<<<<
 *     contigs.header = header
 * 
*/
  __pyx_t_3 = ((PyObject *)__pyx_tp_new_5pysam_7libcbcf_VariantHeaderContigs(((PyTypeObject *)__pyx_mstate_global->__pyx_ptype_5pysam_7libcbcf_VariantHeaderContigs), __pyx_mstate_global->__pyx_empty_tuple, NULL)); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1895, __pyx_L1_error)
  __Pyx_GOTREF((PyObject *)__pyx_t_3);
  __pyx_v_contigs = ((struct __pyx_obj_5pysam_7libcbcf_VariantHeaderContigs *)__pyx_t_3);
  __pyx_t_3 = 0;

  /* "pysam/libcbcf.pyx":1896
 * 
 *     cdef VariantHeaderContigs contigs = VariantHeaderContigs.__new__(VariantHeaderContigs)
 *     contigs.header = header             # <<<<<<<<<<<<<<
 * 
 *     return contigs
*/
  __Pyx_INCREF((PyObject *)__pyx_v_header);
  __Pyx_GIVEREF((PyObject *)__pyx_v_header);
  __Pyx_GOTREF((PyObject *)__pyx_v_contigs->header);
  __Pyx_DECREF((PyObject *)__pyx_v_contigs->header);
  __pyx_v_contigs->header = __pyx_v_header;

  /* "pysam/libcbcf.pyx":1898
 *     contigs.header = header
 * 
 *     return contigs             # <<<<<<<<<<<<<<
 * 
 * 
*/
  __Pyx_XDECREF((PyObject *)__pyx_r);
  __Pyx_INCREF((PyObject *)__pyx_v_contigs);
  __pyx_r = __pyx_v_contigs;
  __Pyx_TraceReturnValue((PyObject *)__pyx_r, 16, 0, __PYX_ERR(0, 1898, __pyx_L1_error));
  goto __pyx_L0;

  /* "pysam/libcbcf.pyx":1891
 * 
 * 
 * cdef VariantHeaderContigs makeVariantHeaderContigs(VariantHeader header):             # <<<<<<<<<<<<<<
 *     if not header:
 *         raise ValueError('invalid VariantHeader')
*/

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_XDECREF(__pyx_t_5);
  __Pyx_TraceException(__pyx_lineno, 0, 0);
  #if CYTHON_USE_SYS_MONITORING
  __Pyx_TraceExceptionUnwind(0, 0);
  #else
  __Pyx_TraceReturnValue(NULL, 0, 0, __PYX_ERR(0, 1891, __pyx_L1_error));
  #endif
  __Pyx_AddTraceback("pysam.libcbcf.makeVariantHeaderContigs", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_XDECREF((PyObject *)__pyx_v_contigs);
  __Pyx_XGIVEREF((PyObject *)__pyx_r);
  __Pyx_PyMonitoring_ExitScope(0);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "pysam/libcbcf.pyx":1903
 * cdef class VariantHeaderSamples(object):
 *     """sequence of sample names from a :class:`VariantHeader` object"""
 *     def __init__(self, *args, **kwargs):             # <<<<<<<<<<<<<<
 *         raise TypeError('this class cannot be instantiated from Python')
 * 
*/

/* Python wrapper */
static int __pyx_pw_5pysam_7libcbcf_20VariantHeaderSamples_1__init__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static int __pyx_pw_5pysam_7libcbcf_20VariantHeaderSamples_1__init__(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("__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);
  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("__init__", __pyx_kwds) == -1)) return -1;
  }
  __Pyx_INCREF(__pyx_args);
  __pyx_v_args = __pyx_args;
  __pyx_r = __pyx_pf_5pysam_7libcbcf_20VariantHeaderSamples___init__(((struct __pyx_obj_5pysam_7libcbcf_VariantHeaderSamples *)__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_5pysam_7libcbcf_20VariantHeaderSamples___init__(CYTHON_UNUSED struct __pyx_obj_5pysam_7libcbcf_VariantHeaderSamples *__pyx_v_self, CYTHON_UNUSED PyObject *__pyx_v_args, CYTHON_UNUSED PyObject *__pyx_v_kwargs) {
  int __pyx_r;
  __Pyx_TraceDeclarationsFunc
  __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_TraceFrameInit(((PyObject *)__pyx_mstate_global->__pyx_codeobj_tab[128]))
  __Pyx_RefNannySetupContext("__init__", 0);
  __Pyx_TraceStartFunc("__init__", __pyx_f[0], 1903, 0, 0, 0, __PYX_ERR(0, 1903, __pyx_L1_error));

  /* "pysam/libcbcf.pyx":1904
 *     """sequence of sample names from a :class:`VariantHeader` object"""
 *     def __init__(self, *args, **kwargs):
 *         raise TypeError('this class cannot be instantiated from Python')             # <<<<<<<<<<<<<<
 * 
 *     def __len__(self):
*/
  __pyx_t_2 = NULL;
  __Pyx_INCREF(__pyx_builtin_TypeError);
  __pyx_t_3 = __pyx_builtin_TypeError; 
  __pyx_t_4 = 1;
  {
    PyObject *__pyx_callargs[2] = {__pyx_t_2, __pyx_mstate_global->__pyx_kp_u_this_class_cannot_be_instantiate};
    __pyx_t_1 = __Pyx_PyObject_FastCall(__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, 1904, __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, 1904, __pyx_L1_error)

  /* "pysam/libcbcf.pyx":1903
 * cdef class VariantHeaderSamples(object):
 *     """sequence of sample names from a :class:`VariantHeader` object"""
 *     def __init__(self, *args, **kwargs):             # <<<<<<<<<<<<<<
 *         raise TypeError('this class cannot be instantiated from Python')
 * 
*/

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_TraceException(__pyx_lineno, 0, 0);
  #if CYTHON_USE_SYS_MONITORING
  __Pyx_TraceExceptionUnwind(0, 0);
  #else
  __Pyx_TraceReturnValue(NULL, 0, 0, __PYX_ERR(0, 1903, __pyx_L1_error));
  #endif
  __Pyx_AddTraceback("pysam.libcbcf.VariantHeaderSamples.__init__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = -1;
  __Pyx_PyMonitoring_ExitScope(0);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "pysam/libcbcf.pyx":1906
 *         raise TypeError('this class cannot be instantiated from Python')
 * 
 *     def __len__(self):             # <<<<<<<<<<<<<<
 *         return bcf_hdr_nsamples(self.header.ptr)
 * 
*/

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

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

static Py_ssize_t __pyx_pf_5pysam_7libcbcf_20VariantHeaderSamples_2__len__(struct __pyx_obj_5pysam_7libcbcf_VariantHeaderSamples *__pyx_v_self) {
  Py_ssize_t __pyx_r;
  __Pyx_TraceDeclarationsFunc
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_TraceFrameInit(((PyObject *)__pyx_mstate_global->__pyx_codeobj_tab[129]))
  __Pyx_TraceStartFunc("__len__", __pyx_f[0], 1906, 0, 0, 0, __PYX_ERR(0, 1906, __pyx_L1_error));

  /* "pysam/libcbcf.pyx":1907
 * 
 *     def __len__(self):
 *         return bcf_hdr_nsamples(self.header.ptr)             # <<<<<<<<<<<<<<
 * 
 *     def __bool__(self):
*/
  __pyx_r = bcf_hdr_nsamples(__pyx_v_self->header->ptr);
  __Pyx_TraceReturnCValue(__pyx_r, PyLong_FromSsize_t, 1, 0, __PYX_ERR(0, 1907, __pyx_L1_error));
  goto __pyx_L0;

  /* "pysam/libcbcf.pyx":1906
 *         raise TypeError('this class cannot be instantiated from Python')
 * 
 *     def __len__(self):             # <<<<<<<<<<<<<<
 *         return bcf_hdr_nsamples(self.header.ptr)
 * 
*/

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_TraceException(__pyx_lineno, 0, 0);
  #if CYTHON_USE_SYS_MONITORING
  __Pyx_TraceExceptionUnwind(0, 0);
  #else
  __Pyx_TraceReturnValue(NULL, 0, 0, __PYX_ERR(0, 1906, __pyx_L1_error));
  #endif
  __Pyx_AddTraceback("pysam.libcbcf.VariantHeaderSamples.__len__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = -1;
  __pyx_L0:;
  __Pyx_PyMonitoring_ExitScope(0);
  return __pyx_r;
}

/* "pysam/libcbcf.pyx":1909
 *         return bcf_hdr_nsamples(self.header.ptr)
 * 
 *     def __bool__(self):             # <<<<<<<<<<<<<<
 *         return bcf_hdr_nsamples(self.header.ptr) != 0
 * 
*/

/* Python wrapper */
static int __pyx_pw_5pysam_7libcbcf_20VariantHeaderSamples_5__bool__(PyObject *__pyx_v_self); /*proto*/
static int __pyx_pw_5pysam_7libcbcf_20VariantHeaderSamples_5__bool__(PyObject *__pyx_v_self) {
  CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__bool__ (wrapper)", 0);
  __pyx_kwvalues = __Pyx_KwValues_VARARGS(__pyx_args, __pyx_nargs);
  __pyx_r = __pyx_pf_5pysam_7libcbcf_20VariantHeaderSamples_4__bool__(((struct __pyx_obj_5pysam_7libcbcf_VariantHeaderSamples *)__pyx_v_self));

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

static int __pyx_pf_5pysam_7libcbcf_20VariantHeaderSamples_4__bool__(struct __pyx_obj_5pysam_7libcbcf_VariantHeaderSamples *__pyx_v_self) {
  int __pyx_r;
  __Pyx_TraceDeclarationsFunc
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_TraceFrameInit(((PyObject *)__pyx_mstate_global->__pyx_codeobj_tab[130]))
  __Pyx_TraceStartFunc("__bool__", __pyx_f[0], 1909, 0, 0, 0, __PYX_ERR(0, 1909, __pyx_L1_error));

  /* "pysam/libcbcf.pyx":1910
 * 
 *     def __bool__(self):
 *         return bcf_hdr_nsamples(self.header.ptr) != 0             # <<<<<<<<<<<<<<
 * 
 *     def __getitem__(self, index):
*/
  __pyx_r = (bcf_hdr_nsamples(__pyx_v_self->header->ptr) != 0);
  __Pyx_TraceReturnCValue(__pyx_r, __Pyx_PyLong_From_int, 1, 0, __PYX_ERR(0, 1910, __pyx_L1_error));
  goto __pyx_L0;

  /* "pysam/libcbcf.pyx":1909
 *         return bcf_hdr_nsamples(self.header.ptr)
 * 
 *     def __bool__(self):             # <<<<<<<<<<<<<<
 *         return bcf_hdr_nsamples(self.header.ptr) != 0
 * 
*/

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_TraceException(__pyx_lineno, 0, 0);
  #if CYTHON_USE_SYS_MONITORING
  __Pyx_TraceExceptionUnwind(0, 0);
  #else
  __Pyx_TraceReturnValue(NULL, 0, 0, __PYX_ERR(0, 1909, __pyx_L1_error));
  #endif
  __Pyx_AddTraceback("pysam.libcbcf.VariantHeaderSamples.__bool__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = -1;
  __pyx_L0:;
  __Pyx_PyMonitoring_ExitScope(0);
  return __pyx_r;
}

/* "pysam/libcbcf.pyx":1912
 *         return bcf_hdr_nsamples(self.header.ptr) != 0
 * 
 *     def __getitem__(self, index):             # <<<<<<<<<<<<<<
 *         cdef bcf_hdr_t *hdr = self.header.ptr
 *         cdef int32_t n = bcf_hdr_nsamples(hdr)
*/

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

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

static PyObject *__pyx_pf_5pysam_7libcbcf_20VariantHeaderSamples_6__getitem__(struct __pyx_obj_5pysam_7libcbcf_VariantHeaderSamples *__pyx_v_self, PyObject *__pyx_v_index) {
  bcf_hdr_t *__pyx_v_hdr;
  int32_t __pyx_v_n;
  int32_t __pyx_v_i;
  PyObject *__pyx_r = NULL;
  __Pyx_TraceDeclarationsFunc
  __Pyx_RefNannyDeclarations
  bcf_hdr_t *__pyx_t_1;
  int32_t __pyx_t_2;
  int __pyx_t_3;
  int __pyx_t_4;
  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_TraceFrameInit(((PyObject *)__pyx_mstate_global->__pyx_codeobj_tab[131]))
  __Pyx_RefNannySetupContext("__getitem__", 0);
  __Pyx_TraceStartFunc("__getitem__", __pyx_f[0], 1912, 0, 0, 0, __PYX_ERR(0, 1912, __pyx_L1_error));

  /* "pysam/libcbcf.pyx":1913
 * 
 *     def __getitem__(self, index):
 *         cdef bcf_hdr_t *hdr = self.header.ptr             # <<<<<<<<<<<<<<
 *         cdef int32_t n = bcf_hdr_nsamples(hdr)
 *         cdef int32_t i = index
*/
  __pyx_t_1 = __pyx_v_self->header->ptr;
  __pyx_v_hdr = __pyx_t_1;

  /* "pysam/libcbcf.pyx":1914
 *     def __getitem__(self, index):
 *         cdef bcf_hdr_t *hdr = self.header.ptr
 *         cdef int32_t n = bcf_hdr_nsamples(hdr)             # <<<<<<<<<<<<<<
 *         cdef int32_t i = index
 * 
*/
  __pyx_v_n = bcf_hdr_nsamples(__pyx_v_hdr);

  /* "pysam/libcbcf.pyx":1915
 *         cdef bcf_hdr_t *hdr = self.header.ptr
 *         cdef int32_t n = bcf_hdr_nsamples(hdr)
 *         cdef int32_t i = index             # <<<<<<<<<<<<<<
 * 
 *         if i < 0 or i >= n:
*/
  __pyx_t_2 = __Pyx_PyLong_As_int32_t(__pyx_v_index); if (unlikely((__pyx_t_2 == ((int32_t)-1)) && PyErr_Occurred())) __PYX_ERR(0, 1915, __pyx_L1_error)
  __pyx_v_i = __pyx_t_2;

  /* "pysam/libcbcf.pyx":1917
 *         cdef int32_t i = index
 * 
 *         if i < 0 or i >= n:             # <<<<<<<<<<<<<<
 *             raise IndexError('invalid sample index')
 * 
*/
  __pyx_t_4 = (__pyx_v_i < 0);
  if (!__pyx_t_4) {
  } else {
    __pyx_t_3 = __pyx_t_4;
    goto __pyx_L4_bool_binop_done;
  }
  __pyx_t_4 = (__pyx_v_i >= __pyx_v_n);
  __pyx_t_3 = __pyx_t_4;
  __pyx_L4_bool_binop_done:;
  if (unlikely(__pyx_t_3)) {

    /* "pysam/libcbcf.pyx":1918
 * 
 *         if i < 0 or i >= n:
 *             raise IndexError('invalid sample index')             # <<<<<<<<<<<<<<
 * 
 *         return charptr_to_str(hdr.samples[i])
*/
    __pyx_t_6 = NULL;
    __Pyx_INCREF(__pyx_builtin_IndexError);
    __pyx_t_7 = __pyx_builtin_IndexError; 
    __pyx_t_8 = 1;
    {
      PyObject *__pyx_callargs[2] = {__pyx_t_6, __pyx_mstate_global->__pyx_kp_u_invalid_sample_index};
      __pyx_t_5 = __Pyx_PyObject_FastCall(__pyx_t_7, __pyx_callargs+__pyx_t_8, (2-__pyx_t_8) | (__pyx_t_8*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
      __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0;
      __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
      if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1918, __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, 1918, __pyx_L1_error)

    /* "pysam/libcbcf.pyx":1917
 *         cdef int32_t i = index
 * 
 *         if i < 0 or i >= n:             # <<<<<<<<<<<<<<
 *             raise IndexError('invalid sample index')
 * 
*/
  }

  /* "pysam/libcbcf.pyx":1920
 *             raise IndexError('invalid sample index')
 * 
 *         return charptr_to_str(hdr.samples[i])             # <<<<<<<<<<<<<<
 * 
 *     def __iter__(self):
*/
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_5 = __pyx_f_5pysam_9libcutils_charptr_to_str((__pyx_v_hdr->samples[__pyx_v_i]), NULL); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1920, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_5);
  __pyx_r = __pyx_t_5;
  __pyx_t_5 = 0;
  __Pyx_TraceReturnValue(__pyx_r, 23, 0, __PYX_ERR(0, 1920, __pyx_L1_error));
  goto __pyx_L0;

  /* "pysam/libcbcf.pyx":1912
 *         return bcf_hdr_nsamples(self.header.ptr) != 0
 * 
 *     def __getitem__(self, index):             # <<<<<<<<<<<<<<
 *         cdef bcf_hdr_t *hdr = self.header.ptr
 *         cdef int32_t n = bcf_hdr_nsamples(hdr)
*/

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_5);
  __Pyx_XDECREF(__pyx_t_6);
  __Pyx_XDECREF(__pyx_t_7);
  __Pyx_TraceException(__pyx_lineno, 0, 0);
  #if CYTHON_USE_SYS_MONITORING
  __Pyx_TraceExceptionUnwind(0, 0);
  #else
  __Pyx_TraceReturnValue(NULL, 0, 0, __PYX_ERR(0, 1912, __pyx_L1_error));
  #endif
  __Pyx_AddTraceback("pysam.libcbcf.VariantHeaderSamples.__getitem__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_PyMonitoring_ExitScope(0);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}
static PyObject *__pyx_gb_5pysam_7libcbcf_20VariantHeaderSamples_10generator10(__pyx_CoroutineObject *__pyx_generator, CYTHON_UNUSED PyThreadState *__pyx_tstate, PyObject *__pyx_sent_value); /* proto */

/* "pysam/libcbcf.pyx":1922
 *         return charptr_to_str(hdr.samples[i])
 * 
 *     def __iter__(self):             # <<<<<<<<<<<<<<
 *         cdef bcf_hdr_t *hdr = self.header.ptr
 *         cdef int32_t i, n = bcf_hdr_nsamples(hdr)
*/

/* Python wrapper */
static PyObject *__pyx_pw_5pysam_7libcbcf_20VariantHeaderSamples_9__iter__(PyObject *__pyx_v_self); /*proto*/
static PyObject *__pyx_pw_5pysam_7libcbcf_20VariantHeaderSamples_9__iter__(PyObject *__pyx_v_self) {
  CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__iter__ (wrapper)", 0);
  __pyx_kwvalues = __Pyx_KwValues_VARARGS(__pyx_args, __pyx_nargs);
  __pyx_r = __pyx_pf_5pysam_7libcbcf_20VariantHeaderSamples_8__iter__(((struct __pyx_obj_5pysam_7libcbcf_VariantHeaderSamples *)__pyx_v_self));

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

static PyObject *__pyx_pf_5pysam_7libcbcf_20VariantHeaderSamples_8__iter__(struct __pyx_obj_5pysam_7libcbcf_VariantHeaderSamples *__pyx_v_self) {
  struct __pyx_obj_5pysam_7libcbcf___pyx_scope_struct_17___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("__iter__", 0);
  __pyx_cur_scope = (struct __pyx_obj_5pysam_7libcbcf___pyx_scope_struct_17___iter__ *)__pyx_tp_new_5pysam_7libcbcf___pyx_scope_struct_17___iter__(__pyx_mstate_global->__pyx_ptype_5pysam_7libcbcf___pyx_scope_struct_17___iter__, __pyx_mstate_global->__pyx_empty_tuple, NULL);
  if (unlikely(!__pyx_cur_scope)) {
    __pyx_cur_scope = ((struct __pyx_obj_5pysam_7libcbcf___pyx_scope_struct_17___iter__ *)Py_None);
    __Pyx_INCREF(Py_None);
    __PYX_ERR(0, 1922, __pyx_L1_error)
  } else {
    __Pyx_GOTREF((PyObject *)__pyx_cur_scope);
  }
  __pyx_cur_scope->__pyx_v_self = __pyx_v_self;
  __Pyx_INCREF((PyObject *)__pyx_cur_scope->__pyx_v_self);
  __Pyx_GIVEREF((PyObject *)__pyx_cur_scope->__pyx_v_self);
  {
    __pyx_CoroutineObject *gen = __Pyx_Generator_New((__pyx_coroutine_body_t) __pyx_gb_5pysam_7libcbcf_20VariantHeaderSamples_10generator10, ((PyObject *)__pyx_mstate_global->__pyx_codeobj_tab[132]), (PyObject *) __pyx_cur_scope, __pyx_mstate_global->__pyx_n_u_iter, __pyx_mstate_global->__pyx_n_u_VariantHeaderSamples___iter, __pyx_mstate_global->__pyx_n_u_pysam_libcbcf); if (unlikely(!gen)) __PYX_ERR(0, 1922, __pyx_L1_error)
    __Pyx_DECREF(__pyx_cur_scope);
    __Pyx_RefNannyFinishContext();
    return (PyObject *) gen;
  }

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_AddTraceback("pysam.libcbcf.VariantHeaderSamples.__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_5pysam_7libcbcf_20VariantHeaderSamples_10generator10(__pyx_CoroutineObject *__pyx_generator, CYTHON_UNUSED PyThreadState *__pyx_tstate, PyObject *__pyx_sent_value) /* generator body */
{
  struct __pyx_obj_5pysam_7libcbcf___pyx_scope_struct_17___iter__ *__pyx_cur_scope = ((struct __pyx_obj_5pysam_7libcbcf___pyx_scope_struct_17___iter__ *)__pyx_generator->closure);
  PyObject *__pyx_r = NULL;
  __Pyx_TraceDeclarationsGen
  bcf_hdr_t *__pyx_t_1;
  int32_t __pyx_t_2;
  int32_t __pyx_t_3;
  int32_t __pyx_t_4;
  PyObject *__pyx_t_5 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__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_TraceStartGen("__iter__", __pyx_f[0], 1922, 0, 0, 0, __PYX_ERR(0, 1922, __pyx_L1_error));
    __Pyx_TraceReturnValue(Py_None, 0, 0, __PYX_ERR(0, 1922, __pyx_L1_error));
    __Pyx_RefNannyFinishContext();
    return NULL;
  }
  __pyx_L3_first_run:;
  __Pyx_TraceStartGen("__iter__", __pyx_f[0], 1922, 0, 0, 0, __PYX_ERR(0, 1922, __pyx_L1_error));
  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, 1922, __pyx_L1_error)
  }

  /* "pysam/libcbcf.pyx":1923
 * 
 *     def __iter__(self):
 *         cdef bcf_hdr_t *hdr = self.header.ptr             # <<<<<<<<<<<<<<
 *         cdef int32_t i, n = bcf_hdr_nsamples(hdr)
 * 
*/
  __pyx_t_1 = __pyx_cur_scope->__pyx_v_self->header->ptr;
  __pyx_cur_scope->__pyx_v_hdr = __pyx_t_1;

  /* "pysam/libcbcf.pyx":1924
 *     def __iter__(self):
 *         cdef bcf_hdr_t *hdr = self.header.ptr
 *         cdef int32_t i, n = bcf_hdr_nsamples(hdr)             # <<<<<<<<<<<<<<
 * 
 *         for i in range(n):
*/
  __pyx_cur_scope->__pyx_v_n = bcf_hdr_nsamples(__pyx_cur_scope->__pyx_v_hdr);

  /* "pysam/libcbcf.pyx":1926
 *         cdef int32_t i, n = bcf_hdr_nsamples(hdr)
 * 
 *         for i in range(n):             # <<<<<<<<<<<<<<
 *             yield charptr_to_str(hdr.samples[i])
 * 
*/
  __pyx_t_2 = __pyx_cur_scope->__pyx_v_n;
  __pyx_t_3 = __pyx_t_2;
  for (__pyx_t_4 = 0; __pyx_t_4 < __pyx_t_3; __pyx_t_4+=1) {
    __pyx_cur_scope->__pyx_v_i = __pyx_t_4;

    /* "pysam/libcbcf.pyx":1927
 * 
 *         for i in range(n):
 *             yield charptr_to_str(hdr.samples[i])             # <<<<<<<<<<<<<<
 * 
 *     def __contains__(self, key):
*/
    __pyx_t_5 = __pyx_f_5pysam_9libcutils_charptr_to_str((__pyx_cur_scope->__pyx_v_hdr->samples[__pyx_cur_scope->__pyx_v_i]), NULL); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1927, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_5);
    __pyx_r = __pyx_t_5;
    __pyx_t_5 = 0;
    __pyx_cur_scope->__pyx_t_0 = __pyx_t_2;
    __pyx_cur_scope->__pyx_t_1 = __pyx_t_3;
    __pyx_cur_scope->__pyx_t_2 = __pyx_t_4;
    __Pyx_TraceYield(__pyx_r, 0, __PYX_ERR(0, 1927, __pyx_L1_error));
    __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_TraceResumeGen("__iter__", __pyx_f[0], 1922, 0, __PYX_ERR(0, 1927, __pyx_L1_error));
    __pyx_t_2 = __pyx_cur_scope->__pyx_t_0;
    __pyx_t_3 = __pyx_cur_scope->__pyx_t_1;
    __pyx_t_4 = __pyx_cur_scope->__pyx_t_2;
    if (unlikely(!__pyx_sent_value)) __PYX_ERR(0, 1927, __pyx_L1_error)
  }
  CYTHON_MAYBE_UNUSED_VAR(__pyx_cur_scope);
  __Pyx_TraceReturnValue(Py_None, 0, 0, __PYX_ERR(0, 1922, __pyx_L1_error));

  /* "pysam/libcbcf.pyx":1922
 *         return charptr_to_str(hdr.samples[i])
 * 
 *     def __iter__(self):             # <<<<<<<<<<<<<<
 *         cdef bcf_hdr_t *hdr = self.header.ptr
 *         cdef int32_t i, n = bcf_hdr_nsamples(hdr)
*/

  /* function exit code */
  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_5);
  if (__Pyx_PyErr_Occurred()) {
    __Pyx_TraceException(__pyx_lineno, 0, 0);
    __Pyx_Generator_Replace_StopIteration(0);
    __Pyx_AddTraceback("__iter__", __pyx_clineno, __pyx_lineno, __pyx_filename);
    __Pyx_TraceExceptionUnwind(0, 0);
  }
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_PyMonitoring_ExitScope(0);
  #if !CYTHON_USE_EXC_INFO_STACK
  __Pyx_Coroutine_ResetAndClearException(__pyx_generator);
  #endif
  __pyx_generator->resume_label = -1;
  __Pyx_Coroutine_clear((PyObject*)__pyx_generator);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "pysam/libcbcf.pyx":1929
 *             yield charptr_to_str(hdr.samples[i])
 * 
 *     def __contains__(self, key):             # <<<<<<<<<<<<<<
 *         cdef bcf_hdr_t *hdr = self.header.ptr
 *         cdef vdict_t *d = <vdict_t *>hdr.dict[BCF_DT_SAMPLE]
*/

/* Python wrapper */
static int __pyx_pw_5pysam_7libcbcf_20VariantHeaderSamples_12__contains__(PyObject *__pyx_v_self, PyObject *__pyx_v_key); /*proto*/
static int __pyx_pw_5pysam_7libcbcf_20VariantHeaderSamples_12__contains__(PyObject *__pyx_v_self, PyObject *__pyx_v_key) {
  CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__contains__ (wrapper)", 0);
  __pyx_kwvalues = __Pyx_KwValues_VARARGS(__pyx_args, __pyx_nargs);
  __pyx_r = __pyx_pf_5pysam_7libcbcf_20VariantHeaderSamples_11__contains__(((struct __pyx_obj_5pysam_7libcbcf_VariantHeaderSamples *)__pyx_v_self), ((PyObject *)__pyx_v_key));

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

static int __pyx_pf_5pysam_7libcbcf_20VariantHeaderSamples_11__contains__(struct __pyx_obj_5pysam_7libcbcf_VariantHeaderSamples *__pyx_v_self, PyObject *__pyx_v_key) {
  bcf_hdr_t *__pyx_v_hdr;
  vdict_t *__pyx_v_d;
  PyObject *__pyx_v_bkey = 0;
  khiter_t __pyx_v_k;
  int __pyx_r;
  __Pyx_TraceDeclarationsFunc
  __Pyx_RefNannyDeclarations
  bcf_hdr_t *__pyx_t_1;
  PyObject *__pyx_t_2 = NULL;
  char const *__pyx_t_3;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_TraceFrameInit(((PyObject *)__pyx_mstate_global->__pyx_codeobj_tab[133]))
  __Pyx_RefNannySetupContext("__contains__", 0);
  __Pyx_TraceStartFunc("__contains__", __pyx_f[0], 1929, 0, 0, 0, __PYX_ERR(0, 1929, __pyx_L1_error));

  /* "pysam/libcbcf.pyx":1930
 * 
 *     def __contains__(self, key):
 *         cdef bcf_hdr_t *hdr = self.header.ptr             # <<<<<<<<<<<<<<
 *         cdef vdict_t *d = <vdict_t *>hdr.dict[BCF_DT_SAMPLE]
 *         cdef bytes bkey = force_bytes(key)
*/
  __pyx_t_1 = __pyx_v_self->header->ptr;
  __pyx_v_hdr = __pyx_t_1;

  /* "pysam/libcbcf.pyx":1931
 *     def __contains__(self, key):
 *         cdef bcf_hdr_t *hdr = self.header.ptr
 *         cdef vdict_t *d = <vdict_t *>hdr.dict[BCF_DT_SAMPLE]             # <<<<<<<<<<<<<<
 *         cdef bytes bkey = force_bytes(key)
 *         cdef khiter_t k = kh_get_vdict(d, bkey)
*/
  __pyx_v_d = ((vdict_t *)(__pyx_v_hdr->dict[BCF_DT_SAMPLE]));

  /* "pysam/libcbcf.pyx":1932
 *         cdef bcf_hdr_t *hdr = self.header.ptr
 *         cdef vdict_t *d = <vdict_t *>hdr.dict[BCF_DT_SAMPLE]
 *         cdef bytes bkey = force_bytes(key)             # <<<<<<<<<<<<<<
 *         cdef khiter_t k = kh_get_vdict(d, bkey)
 * 
*/
  __pyx_t_2 = __pyx_f_5pysam_9libcutils_force_bytes(__pyx_v_key, NULL); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1932, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_v_bkey = ((PyObject*)__pyx_t_2);
  __pyx_t_2 = 0;

  /* "pysam/libcbcf.pyx":1933
 *         cdef vdict_t *d = <vdict_t *>hdr.dict[BCF_DT_SAMPLE]
 *         cdef bytes bkey = force_bytes(key)
 *         cdef khiter_t k = kh_get_vdict(d, bkey)             # <<<<<<<<<<<<<<
 * 
 *         return k != kh_end(d)
*/
  if (unlikely(__pyx_v_bkey == Py_None)) {
    PyErr_SetString(PyExc_TypeError, "expected bytes, NoneType found");
    __PYX_ERR(0, 1933, __pyx_L1_error)
  }
  __pyx_t_3 = __Pyx_PyBytes_AsString(__pyx_v_bkey); if (unlikely((!__pyx_t_3) && PyErr_Occurred())) __PYX_ERR(0, 1933, __pyx_L1_error)
  __pyx_v_k = kh_get_vdict(__pyx_v_d, __pyx_t_3);

  /* "pysam/libcbcf.pyx":1935
 *         cdef khiter_t k = kh_get_vdict(d, bkey)
 * 
 *         return k != kh_end(d)             # <<<<<<<<<<<<<<
 * 
 *     # Mappings are not hashable by default, but subclasses can change this
*/
  __pyx_r = (__pyx_v_k != kh_end(__pyx_v_d));
  __Pyx_TraceReturnCValue(__pyx_r, __Pyx_PyLong_From_int, 20, 0, __PYX_ERR(0, 1935, __pyx_L1_error));
  goto __pyx_L0;

  /* "pysam/libcbcf.pyx":1929
 *             yield charptr_to_str(hdr.samples[i])
 * 
 *     def __contains__(self, key):             # <<<<<<<<<<<<<<
 *         cdef bcf_hdr_t *hdr = self.header.ptr
 *         cdef vdict_t *d = <vdict_t *>hdr.dict[BCF_DT_SAMPLE]
*/

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_TraceException(__pyx_lineno, 0, 0);
  #if CYTHON_USE_SYS_MONITORING
  __Pyx_TraceExceptionUnwind(0, 0);
  #else
  __Pyx_TraceReturnValue(NULL, 0, 0, __PYX_ERR(0, 1929, __pyx_L1_error));
  #endif
  __Pyx_AddTraceback("pysam.libcbcf.VariantHeaderSamples.__contains__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = -1;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_bkey);
  __Pyx_PyMonitoring_ExitScope(0);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "pysam/libcbcf.pyx":1942
 *     #TODO: implement __richcmp__
 * 
 *     def add(self, name):             # <<<<<<<<<<<<<<
 *         """Add a new sample"""
 *         self.header.add_sample(name)
*/

/* Python wrapper */
static PyObject *__pyx_pw_5pysam_7libcbcf_20VariantHeaderSamples_14add(PyObject *__pyx_v_self, 
#if 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_5pysam_7libcbcf_20VariantHeaderSamples_13add, "VariantHeaderSamples.add(self, name)\n\nAdd a new sample");
static PyMethodDef __pyx_mdef_5pysam_7libcbcf_20VariantHeaderSamples_14add = {"add", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_5pysam_7libcbcf_20VariantHeaderSamples_14add, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_5pysam_7libcbcf_20VariantHeaderSamples_13add};
static PyObject *__pyx_pw_5pysam_7libcbcf_20VariantHeaderSamples_14add(PyObject *__pyx_v_self, 
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
) {
  PyObject *__pyx_v_name = 0;
  #if !CYTHON_METH_FASTCALL
  CYTHON_UNUSED Py_ssize_t __pyx_nargs;
  #endif
  CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
  PyObject* values[1] = {0};
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("add (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_name,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, 1942, __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, 1942, __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, "add", 0) < 0) __PYX_ERR(0, 1942, __pyx_L3_error)
      for (Py_ssize_t i = __pyx_nargs; i < 1; i++) {
        if (unlikely(!values[i])) { __Pyx_RaiseArgtupleInvalid("add", 1, 1, 1, i); __PYX_ERR(0, 1942, __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, 1942, __pyx_L3_error)
    }
    __pyx_v_name = values[0];
  }
  goto __pyx_L6_skip;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("add", 1, 1, 1, __pyx_nargs); __PYX_ERR(0, 1942, __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("pysam.libcbcf.VariantHeaderSamples.add", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_5pysam_7libcbcf_20VariantHeaderSamples_13add(((struct __pyx_obj_5pysam_7libcbcf_VariantHeaderSamples *)__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 PyObject *__pyx_pf_5pysam_7libcbcf_20VariantHeaderSamples_13add(struct __pyx_obj_5pysam_7libcbcf_VariantHeaderSamples *__pyx_v_self, PyObject *__pyx_v_name) {
  PyObject *__pyx_r = NULL;
  __Pyx_TraceDeclarationsFunc
  __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_TraceFrameInit(((PyObject *)__pyx_mstate_global->__pyx_codeobj_tab[134]))
  __Pyx_RefNannySetupContext("add", 0);
  __Pyx_TraceStartFunc("add", __pyx_f[0], 1942, 0, 0, 0, __PYX_ERR(0, 1942, __pyx_L1_error));

  /* "pysam/libcbcf.pyx":1944
 *     def add(self, name):
 *         """Add a new sample"""
 *         self.header.add_sample(name)             # <<<<<<<<<<<<<<
 * 
 * 
*/
  __pyx_t_2 = ((PyObject *)__pyx_v_self->header);
  __Pyx_INCREF(__pyx_t_2);
  __pyx_t_3 = 0;
  {
    PyObject *__pyx_callargs[2] = {__pyx_t_2, __pyx_v_name};
    __pyx_t_1 = __Pyx_PyObject_FastCallMethod(__pyx_mstate_global->__pyx_n_u_add_sample, __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, 1944, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
  }
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "pysam/libcbcf.pyx":1942
 *     #TODO: implement __richcmp__
 * 
 *     def add(self, name):             # <<<<<<<<<<<<<<
 *         """Add a new sample"""
 *         self.header.add_sample(name)
*/

  /* function exit code */
  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  __Pyx_TraceReturnValue(__pyx_r, 0, 0, __PYX_ERR(0, 1942, __pyx_L1_error));
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_TraceException(__pyx_lineno, 0, 0);
  #if CYTHON_USE_SYS_MONITORING
  __Pyx_TraceExceptionUnwind(0, 0);
  #else
  __Pyx_TraceReturnValue(NULL, 0, 0, __PYX_ERR(0, 1942, __pyx_L1_error));
  #endif
  __Pyx_AddTraceback("pysam.libcbcf.VariantHeaderSamples.add", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_PyMonitoring_ExitScope(0);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "pysam/libcbcf.pxd":61
 * 
 * cdef class VariantHeaderSamples(object):
 *     cdef readonly VariantHeader header             # <<<<<<<<<<<<<<
 * 
 * 
*/

/* Python wrapper */
static PyObject *__pyx_pw_5pysam_7libcbcf_20VariantHeaderSamples_6header_1__get__(PyObject *__pyx_v_self); /*proto*/
static PyObject *__pyx_pw_5pysam_7libcbcf_20VariantHeaderSamples_6header_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_5pysam_7libcbcf_20VariantHeaderSamples_6header___get__(((struct __pyx_obj_5pysam_7libcbcf_VariantHeaderSamples *)__pyx_v_self));

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

static PyObject *__pyx_pf_5pysam_7libcbcf_20VariantHeaderSamples_6header___get__(struct __pyx_obj_5pysam_7libcbcf_VariantHeaderSamples *__pyx_v_self) {
  PyObject *__pyx_r = NULL;
  __Pyx_TraceDeclarationsFunc
  __Pyx_RefNannyDeclarations
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_TraceFrameInit(((PyObject *)__pyx_mstate_global->__pyx_codeobj_tab[135]))
  __Pyx_RefNannySetupContext("__get__", 0);
  __Pyx_TraceStartFunc("__get__", __pyx_f[3], 61, 0, 0, 0, __PYX_ERR(3, 61, __pyx_L1_error));
  __Pyx_XDECREF(__pyx_r);
  __Pyx_INCREF((PyObject *)__pyx_v_self->header);
  __pyx_r = ((PyObject *)__pyx_v_self->header);
  __Pyx_TraceReturnValue(__pyx_r, 0, 0, __PYX_ERR(3, 61, __pyx_L1_error));
  goto __pyx_L0;

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_TraceException(__pyx_lineno, 0, 0);
  #if CYTHON_USE_SYS_MONITORING
  __Pyx_TraceExceptionUnwind(0, 0);
  #else
  __Pyx_TraceReturnValue(NULL, 0, 0, __PYX_ERR(3, 61, __pyx_L1_error));
  #endif
  __Pyx_AddTraceback("pysam.libcbcf.VariantHeaderSamples.header.__get__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_PyMonitoring_ExitScope(0);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

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

/* Python wrapper */
static PyObject *__pyx_pw_5pysam_7libcbcf_20VariantHeaderSamples_16__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*/
PyDoc_STRVAR(__pyx_doc_5pysam_7libcbcf_20VariantHeaderSamples_15__reduce_cython__, "VariantHeaderSamples.__reduce_cython__(self)");
static PyMethodDef __pyx_mdef_5pysam_7libcbcf_20VariantHeaderSamples_16__reduce_cython__ = {"__reduce_cython__", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_5pysam_7libcbcf_20VariantHeaderSamples_16__reduce_cython__, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_5pysam_7libcbcf_20VariantHeaderSamples_15__reduce_cython__};
static PyObject *__pyx_pw_5pysam_7libcbcf_20VariantHeaderSamples_16__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_5pysam_7libcbcf_20VariantHeaderSamples_15__reduce_cython__(((struct __pyx_obj_5pysam_7libcbcf_VariantHeaderSamples *)__pyx_v_self));

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

static PyObject *__pyx_pf_5pysam_7libcbcf_20VariantHeaderSamples_15__reduce_cython__(struct __pyx_obj_5pysam_7libcbcf_VariantHeaderSamples *__pyx_v_self) {
  PyObject *__pyx_v_state = 0;
  PyObject *__pyx_v__dict = 0;
  int __pyx_v_use_setstate;
  PyObject *__pyx_r = NULL;
  __Pyx_TraceDeclarationsFunc
  __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_TraceFrameInit(((PyObject *)__pyx_mstate_global->__pyx_codeobj_tab[136]))
  __Pyx_RefNannySetupContext("__reduce_cython__", 0);
  __Pyx_TraceStartFunc("__reduce_cython__", __pyx_f[4], 1, 0, 0, 0, __PYX_ERR(4, 1, __pyx_L1_error));

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

  /* "(tree fragment)":6
 *     cdef bint use_setstate
 *     state = (self.header,)
 *     _dict = getattr(self, '__dict__', None)             # <<<<<<<<<<<<<<
 *     if _dict is not None:
 *         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(4, 6, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_v__dict = __pyx_t_1;
  __pyx_t_1 = 0;

  /* "(tree fragment)":7
 *     state = (self.header,)
 *     _dict = getattr(self, '__dict__', None)
 *     if _dict is not None:             # <<<<<<<<<<<<<<
 *         state += (_dict,)
 *         use_setstate = True
*/
  __pyx_t_2 = (__pyx_v__dict != Py_None);
  if (__pyx_t_2) {

    /* "(tree fragment)":8
 *     _dict = getattr(self, '__dict__', None)
 *     if _dict is not None:
 *         state += (_dict,)             # <<<<<<<<<<<<<<
 *         use_setstate = True
 *     else:
*/
    __pyx_t_1 = PyTuple_New(1); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 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(4, 8, __pyx_L1_error);
    __pyx_t_3 = PyNumber_InPlaceAdd(__pyx_v_state, __pyx_t_1); if (unlikely(!__pyx_t_3)) __PYX_ERR(4, 8, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    __Pyx_DECREF_SET(__pyx_v_state, ((PyObject*)__pyx_t_3));
    __pyx_t_3 = 0;

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

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

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

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

    /* "(tree fragment)":13
 *         use_setstate = self.header is not None
 *     if use_setstate:
 *         return __pyx_unpickle_VariantHeaderSamples, (type(self), 0x1e0584a, None), state             # <<<<<<<<<<<<<<
 *     else:
 *         return __pyx_unpickle_VariantHeaderSamples, (type(self), 0x1e0584a, state)
*/
    __Pyx_XDECREF(__pyx_r);
    __Pyx_GetModuleGlobalName(__pyx_t_3, __pyx_mstate_global->__pyx_n_u_pyx_unpickle_VariantHeaderSamp); if (unlikely(!__pyx_t_3)) __PYX_ERR(4, 13, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __pyx_t_1 = PyTuple_New(3); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 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(4, 13, __pyx_L1_error);
    __Pyx_INCREF(__pyx_mstate_global->__pyx_int_31479882);
    __Pyx_GIVEREF(__pyx_mstate_global->__pyx_int_31479882);
    if (__Pyx_PyTuple_SET_ITEM(__pyx_t_1, 1, __pyx_mstate_global->__pyx_int_31479882) != (0)) __PYX_ERR(4, 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(4, 13, __pyx_L1_error);
    __pyx_t_4 = PyTuple_New(3); if (unlikely(!__pyx_t_4)) __PYX_ERR(4, 13, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
    __Pyx_GIVEREF(__pyx_t_3);
    if (__Pyx_PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_t_3) != (0)) __PYX_ERR(4, 13, __pyx_L1_error);
    __Pyx_GIVEREF(__pyx_t_1);
    if (__Pyx_PyTuple_SET_ITEM(__pyx_t_4, 1, __pyx_t_1) != (0)) __PYX_ERR(4, 13, __pyx_L1_error);
    __Pyx_INCREF(__pyx_v_state);
    __Pyx_GIVEREF(__pyx_v_state);
    if (__Pyx_PyTuple_SET_ITEM(__pyx_t_4, 2, __pyx_v_state) != (0)) __PYX_ERR(4, 13, __pyx_L1_error);
    __pyx_t_3 = 0;
    __pyx_t_1 = 0;
    __pyx_r = __pyx_t_4;
    __pyx_t_4 = 0;
    __Pyx_TraceReturnValue(__pyx_r, 25, 0, __PYX_ERR(4, 13, __pyx_L1_error));
    goto __pyx_L0;

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

  /* "(tree fragment)":15
 *         return __pyx_unpickle_VariantHeaderSamples, (type(self), 0x1e0584a, None), state
 *     else:
 *         return __pyx_unpickle_VariantHeaderSamples, (type(self), 0x1e0584a, state)             # <<<<<<<<<<<<<<
 * def __setstate_cython__(self, __pyx_state):
 *     __pyx_unpickle_VariantHeaderSamples__set_state(self, __pyx_state)
*/
  /*else*/ {
    __Pyx_XDECREF(__pyx_r);
    __Pyx_GetModuleGlobalName(__pyx_t_4, __pyx_mstate_global->__pyx_n_u_pyx_unpickle_VariantHeaderSamp); if (unlikely(!__pyx_t_4)) __PYX_ERR(4, 15, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
    __pyx_t_1 = PyTuple_New(3); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 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(4, 15, __pyx_L1_error);
    __Pyx_INCREF(__pyx_mstate_global->__pyx_int_31479882);
    __Pyx_GIVEREF(__pyx_mstate_global->__pyx_int_31479882);
    if (__Pyx_PyTuple_SET_ITEM(__pyx_t_1, 1, __pyx_mstate_global->__pyx_int_31479882) != (0)) __PYX_ERR(4, 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(4, 15, __pyx_L1_error);
    __pyx_t_3 = PyTuple_New(2); if (unlikely(!__pyx_t_3)) __PYX_ERR(4, 15, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __Pyx_GIVEREF(__pyx_t_4);
    if (__Pyx_PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_t_4) != (0)) __PYX_ERR(4, 15, __pyx_L1_error);
    __Pyx_GIVEREF(__pyx_t_1);
    if (__Pyx_PyTuple_SET_ITEM(__pyx_t_3, 1, __pyx_t_1) != (0)) __PYX_ERR(4, 15, __pyx_L1_error);
    __pyx_t_4 = 0;
    __pyx_t_1 = 0;
    __pyx_r = __pyx_t_3;
    __pyx_t_3 = 0;
    __Pyx_TraceReturnValue(__pyx_r, 33, 0, __PYX_ERR(4, 15, __pyx_L1_error));
    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_3);
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_TraceException(__pyx_lineno, 0, 0);
  #if CYTHON_USE_SYS_MONITORING
  __Pyx_TraceExceptionUnwind(0, 0);
  #else
  __Pyx_TraceReturnValue(NULL, 0, 0, __PYX_ERR(4, 1, __pyx_L1_error));
  #endif
  __Pyx_AddTraceback("pysam.libcbcf.VariantHeaderSamples.__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_PyMonitoring_ExitScope(0);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "(tree fragment)":16
 *     else:
 *         return __pyx_unpickle_VariantHeaderSamples, (type(self), 0x1e0584a, state)
 * def __setstate_cython__(self, __pyx_state):             # <<<<<<<<<<<<<<
 *     __pyx_unpickle_VariantHeaderSamples__set_state(self, __pyx_state)
*/

/* Python wrapper */
static PyObject *__pyx_pw_5pysam_7libcbcf_20VariantHeaderSamples_18__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*/
PyDoc_STRVAR(__pyx_doc_5pysam_7libcbcf_20VariantHeaderSamples_17__setstate_cython__, "VariantHeaderSamples.__setstate_cython__(self, __pyx_state)");
static PyMethodDef __pyx_mdef_5pysam_7libcbcf_20VariantHeaderSamples_18__setstate_cython__ = {"__setstate_cython__", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_5pysam_7libcbcf_20VariantHeaderSamples_18__setstate_cython__, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_5pysam_7libcbcf_20VariantHeaderSamples_17__setstate_cython__};
static PyObject *__pyx_pw_5pysam_7libcbcf_20VariantHeaderSamples_18__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(4, 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(4, 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(4, 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(4, 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(4, 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(4, 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("pysam.libcbcf.VariantHeaderSamples.__setstate_cython__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_5pysam_7libcbcf_20VariantHeaderSamples_17__setstate_cython__(((struct __pyx_obj_5pysam_7libcbcf_VariantHeaderSamples *)__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_5pysam_7libcbcf_20VariantHeaderSamples_17__setstate_cython__(struct __pyx_obj_5pysam_7libcbcf_VariantHeaderSamples *__pyx_v_self, PyObject *__pyx_v___pyx_state) {
  PyObject *__pyx_r = NULL;
  __Pyx_TraceDeclarationsFunc
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_TraceFrameInit(((PyObject *)__pyx_mstate_global->__pyx_codeobj_tab[137]))
  __Pyx_RefNannySetupContext("__setstate_cython__", 0);
  __Pyx_TraceStartFunc("__setstate_cython__", __pyx_f[4], 16, 0, 0, 0, __PYX_ERR(4, 16, __pyx_L1_error));

  /* "(tree fragment)":17
 *         return __pyx_unpickle_VariantHeaderSamples, (type(self), 0x1e0584a, state)
 * def __setstate_cython__(self, __pyx_state):
 *     __pyx_unpickle_VariantHeaderSamples__set_state(self, __pyx_state)             # <<<<<<<<<<<<<<
*/
  if (!(likely(PyTuple_CheckExact(__pyx_v___pyx_state))||((__pyx_v___pyx_state) == Py_None) || __Pyx_RaiseUnexpectedTypeError("tuple", __pyx_v___pyx_state))) __PYX_ERR(4, 17, __pyx_L1_error)
  __pyx_t_1 = __pyx_f_5pysam_7libcbcf___pyx_unpickle_VariantHeaderSamples__set_state(__pyx_v_self, ((PyObject*)__pyx_v___pyx_state)); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 17, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "(tree fragment)":16
 *     else:
 *         return __pyx_unpickle_VariantHeaderSamples, (type(self), 0x1e0584a, state)
 * def __setstate_cython__(self, __pyx_state):             # <<<<<<<<<<<<<<
 *     __pyx_unpickle_VariantHeaderSamples__set_state(self, __pyx_state)
*/

  /* function exit code */
  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  __Pyx_TraceReturnValue(__pyx_r, 0, 0, __PYX_ERR(4, 16, __pyx_L1_error));
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_TraceException(__pyx_lineno, 0, 0);
  #if CYTHON_USE_SYS_MONITORING
  __Pyx_TraceExceptionUnwind(0, 0);
  #else
  __Pyx_TraceReturnValue(NULL, 0, 0, __PYX_ERR(4, 16, __pyx_L1_error));
  #endif
  __Pyx_AddTraceback("pysam.libcbcf.VariantHeaderSamples.__setstate_cython__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_PyMonitoring_ExitScope(0);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "pysam/libcbcf.pyx":1947
 * 
 * 
 * cdef VariantHeaderSamples makeVariantHeaderSamples(VariantHeader header):             # <<<<<<<<<<<<<<
 *     if not header:
 *         raise ValueError('invalid VariantHeader')
*/

static struct __pyx_obj_5pysam_7libcbcf_VariantHeaderSamples *__pyx_f_5pysam_7libcbcf_makeVariantHeaderSamples(struct __pyx_obj_5pysam_7libcbcf_VariantHeader *__pyx_v_header) {
  struct __pyx_obj_5pysam_7libcbcf_VariantHeaderSamples *__pyx_v_samples = 0;
  struct __pyx_obj_5pysam_7libcbcf_VariantHeaderSamples *__pyx_r = NULL;
  __Pyx_TraceDeclarationsFunc
  __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_TraceFrameInit(((PyObject *)__pyx_mstate_global->__pyx_codeobj_tab[138]))
  __Pyx_RefNannySetupContext("makeVariantHeaderSamples", 0);
  __Pyx_TraceStartFunc("makeVariantHeaderSamples", __pyx_f[0], 1947, 0, 0, 0, __PYX_ERR(0, 1947, __pyx_L1_error));

  /* "pysam/libcbcf.pyx":1948
 * 
 * cdef VariantHeaderSamples makeVariantHeaderSamples(VariantHeader header):
 *     if not header:             # <<<<<<<<<<<<<<
 *         raise ValueError('invalid VariantHeader')
 * 
*/
  __pyx_t_1 = __Pyx_PyObject_IsTrue(((PyObject *)__pyx_v_header)); if (unlikely((__pyx_t_1 < 0))) __PYX_ERR(0, 1948, __pyx_L1_error)
  __pyx_t_2 = (!__pyx_t_1);
  if (unlikely(__pyx_t_2)) {

    /* "pysam/libcbcf.pyx":1949
 * cdef VariantHeaderSamples makeVariantHeaderSamples(VariantHeader header):
 *     if not header:
 *         raise ValueError('invalid VariantHeader')             # <<<<<<<<<<<<<<
 * 
 *     cdef VariantHeaderSamples samples = VariantHeaderSamples.__new__(VariantHeaderSamples)
*/
    __pyx_t_4 = NULL;
    __Pyx_INCREF(__pyx_builtin_ValueError);
    __pyx_t_5 = __pyx_builtin_ValueError; 
    __pyx_t_6 = 1;
    {
      PyObject *__pyx_callargs[2] = {__pyx_t_4, __pyx_mstate_global->__pyx_kp_u_invalid_VariantHeader};
      __pyx_t_3 = __Pyx_PyObject_FastCall(__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, 1949, __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, 1949, __pyx_L1_error)

    /* "pysam/libcbcf.pyx":1948
 * 
 * cdef VariantHeaderSamples makeVariantHeaderSamples(VariantHeader header):
 *     if not header:             # <<<<<<<<<<<<<<
 *         raise ValueError('invalid VariantHeader')
 * 
*/
  }

  /* "pysam/libcbcf.pyx":1951
 *         raise ValueError('invalid VariantHeader')
 * 
 *     cdef VariantHeaderSamples samples = VariantHeaderSamples.__new__(VariantHeaderSamples)             # <<<<<<<<<<<<<<
 *     samples.header = header
 * 
*/
  __pyx_t_3 = ((PyObject *)__pyx_tp_new_5pysam_7libcbcf_VariantHeaderSamples(((PyTypeObject *)__pyx_mstate_global->__pyx_ptype_5pysam_7libcbcf_VariantHeaderSamples), __pyx_mstate_global->__pyx_empty_tuple, NULL)); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1951, __pyx_L1_error)
  __Pyx_GOTREF((PyObject *)__pyx_t_3);
  __pyx_v_samples = ((struct __pyx_obj_5pysam_7libcbcf_VariantHeaderSamples *)__pyx_t_3);
  __pyx_t_3 = 0;

  /* "pysam/libcbcf.pyx":1952
 * 
 *     cdef VariantHeaderSamples samples = VariantHeaderSamples.__new__(VariantHeaderSamples)
 *     samples.header = header             # <<<<<<<<<<<<<<
 * 
 *     return samples
*/
  __Pyx_INCREF((PyObject *)__pyx_v_header);
  __Pyx_GIVEREF((PyObject *)__pyx_v_header);
  __Pyx_GOTREF((PyObject *)__pyx_v_samples->header);
  __Pyx_DECREF((PyObject *)__pyx_v_samples->header);
  __pyx_v_samples->header = __pyx_v_header;

  /* "pysam/libcbcf.pyx":1954
 *     samples.header = header
 * 
 *     return samples             # <<<<<<<<<<<<<<
 * 
 * 
*/
  __Pyx_XDECREF((PyObject *)__pyx_r);
  __Pyx_INCREF((PyObject *)__pyx_v_samples);
  __pyx_r = __pyx_v_samples;
  __Pyx_TraceReturnValue((PyObject *)__pyx_r, 16, 0, __PYX_ERR(0, 1954, __pyx_L1_error));
  goto __pyx_L0;

  /* "pysam/libcbcf.pyx":1947
 * 
 * 
 * cdef VariantHeaderSamples makeVariantHeaderSamples(VariantHeader header):             # <<<<<<<<<<<<<<
 *     if not header:
 *         raise ValueError('invalid VariantHeader')
*/

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_XDECREF(__pyx_t_5);
  __Pyx_TraceException(__pyx_lineno, 0, 0);
  #if CYTHON_USE_SYS_MONITORING
  __Pyx_TraceExceptionUnwind(0, 0);
  #else
  __Pyx_TraceReturnValue(NULL, 0, 0, __PYX_ERR(0, 1947, __pyx_L1_error));
  #endif
  __Pyx_AddTraceback("pysam.libcbcf.makeVariantHeaderSamples", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_XDECREF((PyObject *)__pyx_v_samples);
  __Pyx_XGIVEREF((PyObject *)__pyx_r);
  __Pyx_PyMonitoring_ExitScope(0);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "pysam/libcbcf.pyx":1964
 * 
 *     # See makeVariantHeader for C constructor
 *     def __cinit__(self):             # <<<<<<<<<<<<<<
 *         self.ptr = NULL
 * 
*/

/* Python wrapper */
static int __pyx_pw_5pysam_7libcbcf_13VariantHeader_1__cinit__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static int __pyx_pw_5pysam_7libcbcf_13VariantHeader_1__cinit__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  CYTHON_UNUSED Py_ssize_t __pyx_nargs;
  CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__cinit__ (wrapper)", 0);
  #if CYTHON_ASSUME_SAFE_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("__cinit__", 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("__cinit__", __pyx_kwds); return -1;}
  __pyx_r = __pyx_pf_5pysam_7libcbcf_13VariantHeader___cinit__(((struct __pyx_obj_5pysam_7libcbcf_VariantHeader *)__pyx_v_self));

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

static int __pyx_pf_5pysam_7libcbcf_13VariantHeader___cinit__(struct __pyx_obj_5pysam_7libcbcf_VariantHeader *__pyx_v_self) {
  int __pyx_r;
  __Pyx_TraceDeclarationsFunc
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_TraceFrameInit(((PyObject *)__pyx_mstate_global->__pyx_codeobj_tab[139]))
  __Pyx_TraceStartFunc("__cinit__", __pyx_f[0], 1964, 0, 0, 0, __PYX_ERR(0, 1964, __pyx_L1_error));

  /* "pysam/libcbcf.pyx":1965
 *     # See makeVariantHeader for C constructor
 *     def __cinit__(self):
 *         self.ptr = NULL             # <<<<<<<<<<<<<<
 * 
 *     # Python constructor
*/
  __pyx_v_self->ptr = NULL;

  /* "pysam/libcbcf.pyx":1964
 * 
 *     # See makeVariantHeader for C constructor
 *     def __cinit__(self):             # <<<<<<<<<<<<<<
 *         self.ptr = NULL
 * 
*/

  /* function exit code */
  __pyx_r = 0;
  __Pyx_TraceReturnCValue(__pyx_r, __Pyx_Owned_Py_None, 0, 0, __PYX_ERR(0, 1964, __pyx_L1_error));
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_TraceException(__pyx_lineno, 0, 0);
  #if CYTHON_USE_SYS_MONITORING
  __Pyx_TraceExceptionUnwind(0, 0);
  #else
  __Pyx_TraceReturnValue(NULL, 0, 0, __PYX_ERR(0, 1964, __pyx_L1_error));
  #endif
  __Pyx_AddTraceback("pysam.libcbcf.VariantHeader.__cinit__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = -1;
  __pyx_L0:;
  __Pyx_PyMonitoring_ExitScope(0);
  return __pyx_r;
}

/* "pysam/libcbcf.pyx":1968
 * 
 *     # Python constructor
 *     def __init__(self):             # <<<<<<<<<<<<<<
 *         self.ptr = bcf_hdr_init(b'w')
 *         if not self.ptr:
*/

/* Python wrapper */
static int __pyx_pw_5pysam_7libcbcf_13VariantHeader_3__init__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static int __pyx_pw_5pysam_7libcbcf_13VariantHeader_3__init__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  CYTHON_UNUSED Py_ssize_t __pyx_nargs;
  CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__init__ (wrapper)", 0);
  #if CYTHON_ASSUME_SAFE_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_5pysam_7libcbcf_13VariantHeader_2__init__(((struct __pyx_obj_5pysam_7libcbcf_VariantHeader *)__pyx_v_self));

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

static int __pyx_pf_5pysam_7libcbcf_13VariantHeader_2__init__(struct __pyx_obj_5pysam_7libcbcf_VariantHeader *__pyx_v_self) {
  int __pyx_r;
  __Pyx_TraceDeclarationsFunc
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  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_TraceFrameInit(((PyObject *)__pyx_mstate_global->__pyx_codeobj_tab[140]))
  __Pyx_RefNannySetupContext("__init__", 0);
  __Pyx_TraceStartFunc("__init__", __pyx_f[0], 1968, 0, 0, 0, __PYX_ERR(0, 1968, __pyx_L1_error));

  /* "pysam/libcbcf.pyx":1969
 *     # Python constructor
 *     def __init__(self):
 *         self.ptr = bcf_hdr_init(b'w')             # <<<<<<<<<<<<<<
 *         if not self.ptr:
 *             raise ValueError('cannot create VariantHeader')
*/
  __pyx_v_self->ptr = bcf_hdr_init(((char const *)"w"));

  /* "pysam/libcbcf.pyx":1970
 *     def __init__(self):
 *         self.ptr = bcf_hdr_init(b'w')
 *         if not self.ptr:             # <<<<<<<<<<<<<<
 *             raise ValueError('cannot create VariantHeader')
 * 
*/
  __pyx_t_1 = (!(__pyx_v_self->ptr != 0));
  if (unlikely(__pyx_t_1)) {

    /* "pysam/libcbcf.pyx":1971
 *         self.ptr = bcf_hdr_init(b'w')
 *         if not self.ptr:
 *             raise ValueError('cannot create VariantHeader')             # <<<<<<<<<<<<<<
 * 
 *     def __dealloc__(self):
*/
    __pyx_t_3 = NULL;
    __Pyx_INCREF(__pyx_builtin_ValueError);
    __pyx_t_4 = __pyx_builtin_ValueError; 
    __pyx_t_5 = 1;
    {
      PyObject *__pyx_callargs[2] = {__pyx_t_3, __pyx_mstate_global->__pyx_kp_u_cannot_create_VariantHeader};
      __pyx_t_2 = __Pyx_PyObject_FastCall(__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_2)) __PYX_ERR(0, 1971, __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, 1971, __pyx_L1_error)

    /* "pysam/libcbcf.pyx":1970
 *     def __init__(self):
 *         self.ptr = bcf_hdr_init(b'w')
 *         if not self.ptr:             # <<<<<<<<<<<<<<
 *             raise ValueError('cannot create VariantHeader')
 * 
*/
  }

  /* "pysam/libcbcf.pyx":1968
 * 
 *     # Python constructor
 *     def __init__(self):             # <<<<<<<<<<<<<<
 *         self.ptr = bcf_hdr_init(b'w')
 *         if not self.ptr:
*/

  /* function exit code */
  __pyx_r = 0;
  __Pyx_TraceReturnCValue(__pyx_r, __Pyx_Owned_Py_None, 0, 0, __PYX_ERR(0, 1968, __pyx_L1_error));
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_TraceException(__pyx_lineno, 0, 0);
  #if CYTHON_USE_SYS_MONITORING
  __Pyx_TraceExceptionUnwind(0, 0);
  #else
  __Pyx_TraceReturnValue(NULL, 0, 0, __PYX_ERR(0, 1968, __pyx_L1_error));
  #endif
  __Pyx_AddTraceback("pysam.libcbcf.VariantHeader.__init__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = -1;
  __pyx_L0:;
  __Pyx_PyMonitoring_ExitScope(0);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "pysam/libcbcf.pyx":1973
 *             raise ValueError('cannot create VariantHeader')
 * 
 *     def __dealloc__(self):             # <<<<<<<<<<<<<<
 *         if self.ptr:
 *             bcf_hdr_destroy(self.ptr)
*/

/* Python wrapper */
static void __pyx_pw_5pysam_7libcbcf_13VariantHeader_5__dealloc__(PyObject *__pyx_v_self); /*proto*/
static void __pyx_pw_5pysam_7libcbcf_13VariantHeader_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_5pysam_7libcbcf_13VariantHeader_4__dealloc__(((struct __pyx_obj_5pysam_7libcbcf_VariantHeader *)__pyx_v_self));

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

static void __pyx_pf_5pysam_7libcbcf_13VariantHeader_4__dealloc__(struct __pyx_obj_5pysam_7libcbcf_VariantHeader *__pyx_v_self) {
  __Pyx_TraceDeclarationsFunc
  int __pyx_t_1;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_TraceFrameInit(((PyObject *)__pyx_mstate_global->__pyx_codeobj_tab[141]))
  __Pyx_TraceStartFunc("__dealloc__", __pyx_f[0], 1973, 0, 0, 0, __PYX_ERR(0, 1973, __pyx_L1_error));

  /* "pysam/libcbcf.pyx":1974
 * 
 *     def __dealloc__(self):
 *         if self.ptr:             # <<<<<<<<<<<<<<
 *             bcf_hdr_destroy(self.ptr)
 *             self.ptr = NULL
*/
  __pyx_t_1 = (__pyx_v_self->ptr != 0);
  if (__pyx_t_1) {

    /* "pysam/libcbcf.pyx":1975
 *     def __dealloc__(self):
 *         if self.ptr:
 *             bcf_hdr_destroy(self.ptr)             # <<<<<<<<<<<<<<
 *             self.ptr = NULL
 * 
*/
    bcf_hdr_destroy(__pyx_v_self->ptr);

    /* "pysam/libcbcf.pyx":1976
 *         if self.ptr:
 *             bcf_hdr_destroy(self.ptr)
 *             self.ptr = NULL             # <<<<<<<<<<<<<<
 * 
 *     def __bool__(self):
*/
    __pyx_v_self->ptr = NULL;

    /* "pysam/libcbcf.pyx":1974
 * 
 *     def __dealloc__(self):
 *         if self.ptr:             # <<<<<<<<<<<<<<
 *             bcf_hdr_destroy(self.ptr)
 *             self.ptr = NULL
*/
  }

  /* "pysam/libcbcf.pyx":1973
 *             raise ValueError('cannot create VariantHeader')
 * 
 *     def __dealloc__(self):             # <<<<<<<<<<<<<<
 *         if self.ptr:
 *             bcf_hdr_destroy(self.ptr)
*/

  /* function exit code */
  __Pyx_TraceReturnValue(Py_None, 0, 0, __PYX_ERR(0, 1973, __pyx_L1_error));
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_TraceException(__pyx_lineno, 0, 0);
  #if CYTHON_USE_SYS_MONITORING
  __Pyx_TraceExceptionUnwind(0, 0);
  #else
  __Pyx_TraceReturnValue(NULL, 0, 0, __PYX_ERR(0, 1973, __pyx_L1_error));
  #endif
  __Pyx_WriteUnraisable("pysam.libcbcf.VariantHeader.__dealloc__", __pyx_clineno, __pyx_lineno, __pyx_filename, 1, 0);
  __pyx_L0:;
  __Pyx_PyMonitoring_ExitScope(0);
}

/* "pysam/libcbcf.pyx":1978
 *             self.ptr = NULL
 * 
 *     def __bool__(self):             # <<<<<<<<<<<<<<
 *         return self.ptr != NULL
 * 
*/

/* Python wrapper */
static int __pyx_pw_5pysam_7libcbcf_13VariantHeader_7__bool__(PyObject *__pyx_v_self); /*proto*/
static int __pyx_pw_5pysam_7libcbcf_13VariantHeader_7__bool__(PyObject *__pyx_v_self) {
  CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__bool__ (wrapper)", 0);
  __pyx_kwvalues = __Pyx_KwValues_VARARGS(__pyx_args, __pyx_nargs);
  __pyx_r = __pyx_pf_5pysam_7libcbcf_13VariantHeader_6__bool__(((struct __pyx_obj_5pysam_7libcbcf_VariantHeader *)__pyx_v_self));

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

static int __pyx_pf_5pysam_7libcbcf_13VariantHeader_6__bool__(struct __pyx_obj_5pysam_7libcbcf_VariantHeader *__pyx_v_self) {
  int __pyx_r;
  __Pyx_TraceDeclarationsFunc
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_TraceFrameInit(((PyObject *)__pyx_mstate_global->__pyx_codeobj_tab[142]))
  __Pyx_TraceStartFunc("__bool__", __pyx_f[0], 1978, 0, 0, 0, __PYX_ERR(0, 1978, __pyx_L1_error));

  /* "pysam/libcbcf.pyx":1979
 * 
 *     def __bool__(self):
 *         return self.ptr != NULL             # <<<<<<<<<<<<<<
 * 
 *     def copy(self):
*/
  __pyx_r = (__pyx_v_self->ptr != NULL);
  __Pyx_TraceReturnCValue(__pyx_r, __Pyx_PyLong_From_int, 1, 0, __PYX_ERR(0, 1979, __pyx_L1_error));
  goto __pyx_L0;

  /* "pysam/libcbcf.pyx":1978
 *             self.ptr = NULL
 * 
 *     def __bool__(self):             # <<<<<<<<<<<<<<
 *         return self.ptr != NULL
 * 
*/

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_TraceException(__pyx_lineno, 0, 0);
  #if CYTHON_USE_SYS_MONITORING
  __Pyx_TraceExceptionUnwind(0, 0);
  #else
  __Pyx_TraceReturnValue(NULL, 0, 0, __PYX_ERR(0, 1978, __pyx_L1_error));
  #endif
  __Pyx_AddTraceback("pysam.libcbcf.VariantHeader.__bool__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = -1;
  __pyx_L0:;
  __Pyx_PyMonitoring_ExitScope(0);
  return __pyx_r;
}

/* "pysam/libcbcf.pyx":1981
 *         return self.ptr != NULL
 * 
 *     def copy(self):             # <<<<<<<<<<<<<<
 *         return makeVariantHeader(bcf_hdr_dup(self.ptr))
 * 
*/

/* Python wrapper */
static PyObject *__pyx_pw_5pysam_7libcbcf_13VariantHeader_9copy(PyObject *__pyx_v_self, 
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
); /*proto*/
PyDoc_STRVAR(__pyx_doc_5pysam_7libcbcf_13VariantHeader_8copy, "VariantHeader.copy(self)");
static PyMethodDef __pyx_mdef_5pysam_7libcbcf_13VariantHeader_9copy = {"copy", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_5pysam_7libcbcf_13VariantHeader_9copy, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_5pysam_7libcbcf_13VariantHeader_8copy};
static PyObject *__pyx_pw_5pysam_7libcbcf_13VariantHeader_9copy(PyObject *__pyx_v_self, 
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
) {
  #if !CYTHON_METH_FASTCALL
  CYTHON_UNUSED Py_ssize_t __pyx_nargs;
  #endif
  CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("copy (wrapper)", 0);
  #if !CYTHON_METH_FASTCALL
  #if CYTHON_ASSUME_SAFE_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_pf_5pysam_7libcbcf_13VariantHeader_8copy(((struct __pyx_obj_5pysam_7libcbcf_VariantHeader *)__pyx_v_self));

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

static PyObject *__pyx_pf_5pysam_7libcbcf_13VariantHeader_8copy(struct __pyx_obj_5pysam_7libcbcf_VariantHeader *__pyx_v_self) {
  PyObject *__pyx_r = NULL;
  __Pyx_TraceDeclarationsFunc
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_TraceFrameInit(((PyObject *)__pyx_mstate_global->__pyx_codeobj_tab[143]))
  __Pyx_RefNannySetupContext("copy", 0);
  __Pyx_TraceStartFunc("copy", __pyx_f[0], 1981, 0, 0, 0, __PYX_ERR(0, 1981, __pyx_L1_error));

  /* "pysam/libcbcf.pyx":1982
 * 
 *     def copy(self):
 *         return makeVariantHeader(bcf_hdr_dup(self.ptr))             # <<<<<<<<<<<<<<
 * 
 *     def merge(self, VariantHeader header):
*/
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = ((PyObject *)__pyx_f_5pysam_7libcbcf_makeVariantHeader(bcf_hdr_dup(__pyx_v_self->ptr))); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1982, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  __Pyx_TraceReturnValue(__pyx_r, 1, 0, __PYX_ERR(0, 1982, __pyx_L1_error));
  goto __pyx_L0;

  /* "pysam/libcbcf.pyx":1981
 *         return self.ptr != NULL
 * 
 *     def copy(self):             # <<<<<<<<<<<<<<
 *         return makeVariantHeader(bcf_hdr_dup(self.ptr))
 * 
*/

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_TraceException(__pyx_lineno, 0, 0);
  #if CYTHON_USE_SYS_MONITORING
  __Pyx_TraceExceptionUnwind(0, 0);
  #else
  __Pyx_TraceReturnValue(NULL, 0, 0, __PYX_ERR(0, 1981, __pyx_L1_error));
  #endif
  __Pyx_AddTraceback("pysam.libcbcf.VariantHeader.copy", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_PyMonitoring_ExitScope(0);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "pysam/libcbcf.pyx":1984
 *         return makeVariantHeader(bcf_hdr_dup(self.ptr))
 * 
 *     def merge(self, VariantHeader header):             # <<<<<<<<<<<<<<
 *         if header is None:
 *             raise ValueError('header must not be None')
*/

/* Python wrapper */
static PyObject *__pyx_pw_5pysam_7libcbcf_13VariantHeader_11merge(PyObject *__pyx_v_self, 
#if 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_5pysam_7libcbcf_13VariantHeader_10merge, "VariantHeader.merge(self, VariantHeader header)");
static PyMethodDef __pyx_mdef_5pysam_7libcbcf_13VariantHeader_11merge = {"merge", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_5pysam_7libcbcf_13VariantHeader_11merge, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_5pysam_7libcbcf_13VariantHeader_10merge};
static PyObject *__pyx_pw_5pysam_7libcbcf_13VariantHeader_11merge(PyObject *__pyx_v_self, 
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
) {
  struct __pyx_obj_5pysam_7libcbcf_VariantHeader *__pyx_v_header = 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 (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_header,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, 1984, __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, 1984, __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, "merge", 0) < 0) __PYX_ERR(0, 1984, __pyx_L3_error)
      for (Py_ssize_t i = __pyx_nargs; i < 1; i++) {
        if (unlikely(!values[i])) { __Pyx_RaiseArgtupleInvalid("merge", 1, 1, 1, i); __PYX_ERR(0, 1984, __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, 1984, __pyx_L3_error)
    }
    __pyx_v_header = ((struct __pyx_obj_5pysam_7libcbcf_VariantHeader *)values[0]);
  }
  goto __pyx_L6_skip;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("merge", 1, 1, 1, __pyx_nargs); __PYX_ERR(0, 1984, __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("pysam.libcbcf.VariantHeader.merge", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_header), __pyx_mstate_global->__pyx_ptype_5pysam_7libcbcf_VariantHeader, 1, "header", 0))) __PYX_ERR(0, 1984, __pyx_L1_error)
  __pyx_r = __pyx_pf_5pysam_7libcbcf_13VariantHeader_10merge(((struct __pyx_obj_5pysam_7libcbcf_VariantHeader *)__pyx_v_self), __pyx_v_header);

  /* 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_5pysam_7libcbcf_13VariantHeader_10merge(struct __pyx_obj_5pysam_7libcbcf_VariantHeader *__pyx_v_self, struct __pyx_obj_5pysam_7libcbcf_VariantHeader *__pyx_v_header) {
  PyObject *__pyx_r = NULL;
  __Pyx_TraceDeclarationsFunc
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  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_TraceFrameInit(((PyObject *)__pyx_mstate_global->__pyx_codeobj_tab[144]))
  __Pyx_RefNannySetupContext("merge", 0);
  __Pyx_TraceStartFunc("merge", __pyx_f[0], 1984, 0, 0, 0, __PYX_ERR(0, 1984, __pyx_L1_error));

  /* "pysam/libcbcf.pyx":1985
 * 
 *     def merge(self, VariantHeader header):
 *         if header is None:             # <<<<<<<<<<<<<<
 *             raise ValueError('header must not be None')
 *         bcf_hdr_merge(self.ptr, header.ptr)
*/
  __pyx_t_1 = (((PyObject *)__pyx_v_header) == Py_None);
  if (unlikely(__pyx_t_1)) {

    /* "pysam/libcbcf.pyx":1986
 *     def merge(self, VariantHeader header):
 *         if header is None:
 *             raise ValueError('header must not be None')             # <<<<<<<<<<<<<<
 *         bcf_hdr_merge(self.ptr, header.ptr)
 * 
*/
    __pyx_t_3 = NULL;
    __Pyx_INCREF(__pyx_builtin_ValueError);
    __pyx_t_4 = __pyx_builtin_ValueError; 
    __pyx_t_5 = 1;
    {
      PyObject *__pyx_callargs[2] = {__pyx_t_3, __pyx_mstate_global->__pyx_kp_u_header_must_not_be_None};
      __pyx_t_2 = __Pyx_PyObject_FastCall(__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_2)) __PYX_ERR(0, 1986, __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, 1986, __pyx_L1_error)

    /* "pysam/libcbcf.pyx":1985
 * 
 *     def merge(self, VariantHeader header):
 *         if header is None:             # <<<<<<<<<<<<<<
 *             raise ValueError('header must not be None')
 *         bcf_hdr_merge(self.ptr, header.ptr)
*/
  }

  /* "pysam/libcbcf.pyx":1987
 *         if header is None:
 *             raise ValueError('header must not be None')
 *         bcf_hdr_merge(self.ptr, header.ptr)             # <<<<<<<<<<<<<<
 * 
 *     @property
*/
  (void)(bcf_hdr_merge(__pyx_v_self->ptr, __pyx_v_header->ptr));

  /* "pysam/libcbcf.pyx":1984
 *         return makeVariantHeader(bcf_hdr_dup(self.ptr))
 * 
 *     def merge(self, VariantHeader header):             # <<<<<<<<<<<<<<
 *         if header is None:
 *             raise ValueError('header must not be None')
*/

  /* function exit code */
  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  __Pyx_TraceReturnValue(__pyx_r, 0, 0, __PYX_ERR(0, 1984, __pyx_L1_error));
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_TraceException(__pyx_lineno, 0, 0);
  #if CYTHON_USE_SYS_MONITORING
  __Pyx_TraceExceptionUnwind(0, 0);
  #else
  __Pyx_TraceReturnValue(NULL, 0, 0, __PYX_ERR(0, 1984, __pyx_L1_error));
  #endif
  __Pyx_AddTraceback("pysam.libcbcf.VariantHeader.merge", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_PyMonitoring_ExitScope(0);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "pysam/libcbcf.pyx":1989
 *         bcf_hdr_merge(self.ptr, header.ptr)
 * 
 *     @property             # <<<<<<<<<<<<<<
 *     def version(self):
 *         """VCF version"""
*/

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

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

static PyObject *__pyx_pf_5pysam_7libcbcf_13VariantHeader_7version___get__(struct __pyx_obj_5pysam_7libcbcf_VariantHeader *__pyx_v_self) {
  PyObject *__pyx_r = NULL;
  __Pyx_TraceDeclarationsFunc
  __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_TraceFrameInit(((PyObject *)__pyx_mstate_global->__pyx_codeobj_tab[145]))
  __Pyx_RefNannySetupContext("__get__", 0);
  __Pyx_TraceStartFunc("__get__", __pyx_f[0], 1989, 0, 0, 0, __PYX_ERR(0, 1989, __pyx_L1_error));

  /* "pysam/libcbcf.pyx":1992
 *     def version(self):
 *         """VCF version"""
 *         return force_str(bcf_hdr_get_version(self.ptr))             # <<<<<<<<<<<<<<
 * 
 *     @property
*/
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = __Pyx_PyBytes_FromString(bcf_hdr_get_version(__pyx_v_self->ptr)); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1992, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_2 = __pyx_f_5pysam_9libcutils_force_str(__pyx_t_1, NULL); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1992, __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;
  __Pyx_TraceReturnValue(__pyx_r, 1, 0, __PYX_ERR(0, 1992, __pyx_L1_error));
  goto __pyx_L0;

  /* "pysam/libcbcf.pyx":1989
 *         bcf_hdr_merge(self.ptr, header.ptr)
 * 
 *     @property             # <<<<<<<<<<<<<<
 *     def version(self):
 *         """VCF version"""
*/

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_TraceException(__pyx_lineno, 0, 0);
  #if CYTHON_USE_SYS_MONITORING
  __Pyx_TraceExceptionUnwind(0, 0);
  #else
  __Pyx_TraceReturnValue(NULL, 0, 0, __PYX_ERR(0, 1989, __pyx_L1_error));
  #endif
  __Pyx_AddTraceback("pysam.libcbcf.VariantHeader.version.__get__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_PyMonitoring_ExitScope(0);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "pysam/libcbcf.pyx":1994
 *         return force_str(bcf_hdr_get_version(self.ptr))
 * 
 *     @property             # <<<<<<<<<<<<<<
 *     def samples(self):
 *         """samples (:class:`VariantHeaderSamples`)"""
*/

/* Python wrapper */
static PyObject *__pyx_pw_5pysam_7libcbcf_13VariantHeader_7samples_1__get__(PyObject *__pyx_v_self); /*proto*/
static PyObject *__pyx_pw_5pysam_7libcbcf_13VariantHeader_7samples_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_5pysam_7libcbcf_13VariantHeader_7samples___get__(((struct __pyx_obj_5pysam_7libcbcf_VariantHeader *)__pyx_v_self));

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

static PyObject *__pyx_pf_5pysam_7libcbcf_13VariantHeader_7samples___get__(struct __pyx_obj_5pysam_7libcbcf_VariantHeader *__pyx_v_self) {
  PyObject *__pyx_r = NULL;
  __Pyx_TraceDeclarationsFunc
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_TraceFrameInit(((PyObject *)__pyx_mstate_global->__pyx_codeobj_tab[146]))
  __Pyx_RefNannySetupContext("__get__", 0);
  __Pyx_TraceStartFunc("__get__", __pyx_f[0], 1994, 0, 0, 0, __PYX_ERR(0, 1994, __pyx_L1_error));

  /* "pysam/libcbcf.pyx":1997
 *     def samples(self):
 *         """samples (:class:`VariantHeaderSamples`)"""
 *         return makeVariantHeaderSamples(self)             # <<<<<<<<<<<<<<
 * 
 *     @property
*/
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = ((PyObject *)__pyx_f_5pysam_7libcbcf_makeVariantHeaderSamples(__pyx_v_self)); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1997, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  __Pyx_TraceReturnValue(__pyx_r, 1, 0, __PYX_ERR(0, 1997, __pyx_L1_error));
  goto __pyx_L0;

  /* "pysam/libcbcf.pyx":1994
 *         return force_str(bcf_hdr_get_version(self.ptr))
 * 
 *     @property             # <<<<<<<<<<<<<<
 *     def samples(self):
 *         """samples (:class:`VariantHeaderSamples`)"""
*/

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_TraceException(__pyx_lineno, 0, 0);
  #if CYTHON_USE_SYS_MONITORING
  __Pyx_TraceExceptionUnwind(0, 0);
  #else
  __Pyx_TraceReturnValue(NULL, 0, 0, __PYX_ERR(0, 1994, __pyx_L1_error));
  #endif
  __Pyx_AddTraceback("pysam.libcbcf.VariantHeader.samples.__get__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_PyMonitoring_ExitScope(0);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "pysam/libcbcf.pyx":1999
 *         return makeVariantHeaderSamples(self)
 * 
 *     @property             # <<<<<<<<<<<<<<
 *     def records(self):
 *         """header records (:class:`VariantHeaderRecords`)"""
*/

/* Python wrapper */
static PyObject *__pyx_pw_5pysam_7libcbcf_13VariantHeader_7records_1__get__(PyObject *__pyx_v_self); /*proto*/
static PyObject *__pyx_pw_5pysam_7libcbcf_13VariantHeader_7records_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_5pysam_7libcbcf_13VariantHeader_7records___get__(((struct __pyx_obj_5pysam_7libcbcf_VariantHeader *)__pyx_v_self));

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

static PyObject *__pyx_pf_5pysam_7libcbcf_13VariantHeader_7records___get__(struct __pyx_obj_5pysam_7libcbcf_VariantHeader *__pyx_v_self) {
  PyObject *__pyx_r = NULL;
  __Pyx_TraceDeclarationsFunc
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_TraceFrameInit(((PyObject *)__pyx_mstate_global->__pyx_codeobj_tab[147]))
  __Pyx_RefNannySetupContext("__get__", 0);
  __Pyx_TraceStartFunc("__get__", __pyx_f[0], 1999, 0, 0, 0, __PYX_ERR(0, 1999, __pyx_L1_error));

  /* "pysam/libcbcf.pyx":2002
 *     def records(self):
 *         """header records (:class:`VariantHeaderRecords`)"""
 *         return makeVariantHeaderRecords(self)             # <<<<<<<<<<<<<<
 * 
 *     @property
*/
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = ((PyObject *)__pyx_f_5pysam_7libcbcf_makeVariantHeaderRecords(__pyx_v_self)); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 2002, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  __Pyx_TraceReturnValue(__pyx_r, 1, 0, __PYX_ERR(0, 2002, __pyx_L1_error));
  goto __pyx_L0;

  /* "pysam/libcbcf.pyx":1999
 *         return makeVariantHeaderSamples(self)
 * 
 *     @property             # <<<<<<<<<<<<<<
 *     def records(self):
 *         """header records (:class:`VariantHeaderRecords`)"""
*/

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_TraceException(__pyx_lineno, 0, 0);
  #if CYTHON_USE_SYS_MONITORING
  __Pyx_TraceExceptionUnwind(0, 0);
  #else
  __Pyx_TraceReturnValue(NULL, 0, 0, __PYX_ERR(0, 1999, __pyx_L1_error));
  #endif
  __Pyx_AddTraceback("pysam.libcbcf.VariantHeader.records.__get__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_PyMonitoring_ExitScope(0);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "pysam/libcbcf.pyx":2004
 *         return makeVariantHeaderRecords(self)
 * 
 *     @property             # <<<<<<<<<<<<<<
 *     def contigs(self):
 *         """contig information (:class:`VariantHeaderContigs`)"""
*/

/* Python wrapper */
static PyObject *__pyx_pw_5pysam_7libcbcf_13VariantHeader_7contigs_1__get__(PyObject *__pyx_v_self); /*proto*/
static PyObject *__pyx_pw_5pysam_7libcbcf_13VariantHeader_7contigs_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_5pysam_7libcbcf_13VariantHeader_7contigs___get__(((struct __pyx_obj_5pysam_7libcbcf_VariantHeader *)__pyx_v_self));

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

static PyObject *__pyx_pf_5pysam_7libcbcf_13VariantHeader_7contigs___get__(struct __pyx_obj_5pysam_7libcbcf_VariantHeader *__pyx_v_self) {
  PyObject *__pyx_r = NULL;
  __Pyx_TraceDeclarationsFunc
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_TraceFrameInit(((PyObject *)__pyx_mstate_global->__pyx_codeobj_tab[148]))
  __Pyx_RefNannySetupContext("__get__", 0);
  __Pyx_TraceStartFunc("__get__", __pyx_f[0], 2004, 0, 0, 0, __PYX_ERR(0, 2004, __pyx_L1_error));

  /* "pysam/libcbcf.pyx":2007
 *     def contigs(self):
 *         """contig information (:class:`VariantHeaderContigs`)"""
 *         return makeVariantHeaderContigs(self)             # <<<<<<<<<<<<<<
 * 
 *     @property
*/
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = ((PyObject *)__pyx_f_5pysam_7libcbcf_makeVariantHeaderContigs(__pyx_v_self)); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 2007, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  __Pyx_TraceReturnValue(__pyx_r, 1, 0, __PYX_ERR(0, 2007, __pyx_L1_error));
  goto __pyx_L0;

  /* "pysam/libcbcf.pyx":2004
 *         return makeVariantHeaderRecords(self)
 * 
 *     @property             # <<<<<<<<<<<<<<
 *     def contigs(self):
 *         """contig information (:class:`VariantHeaderContigs`)"""
*/

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_TraceException(__pyx_lineno, 0, 0);
  #if CYTHON_USE_SYS_MONITORING
  __Pyx_TraceExceptionUnwind(0, 0);
  #else
  __Pyx_TraceReturnValue(NULL, 0, 0, __PYX_ERR(0, 2004, __pyx_L1_error));
  #endif
  __Pyx_AddTraceback("pysam.libcbcf.VariantHeader.contigs.__get__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_PyMonitoring_ExitScope(0);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "pysam/libcbcf.pyx":2009
 *         return makeVariantHeaderContigs(self)
 * 
 *     @property             # <<<<<<<<<<<<<<
 *     def filters(self):
 *         """filter metadata (:class:`VariantHeaderMetadata`)"""
*/

/* Python wrapper */
static PyObject *__pyx_pw_5pysam_7libcbcf_13VariantHeader_7filters_1__get__(PyObject *__pyx_v_self); /*proto*/
static PyObject *__pyx_pw_5pysam_7libcbcf_13VariantHeader_7filters_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_5pysam_7libcbcf_13VariantHeader_7filters___get__(((struct __pyx_obj_5pysam_7libcbcf_VariantHeader *)__pyx_v_self));

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

static PyObject *__pyx_pf_5pysam_7libcbcf_13VariantHeader_7filters___get__(struct __pyx_obj_5pysam_7libcbcf_VariantHeader *__pyx_v_self) {
  PyObject *__pyx_r = NULL;
  __Pyx_TraceDeclarationsFunc
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_TraceFrameInit(((PyObject *)__pyx_mstate_global->__pyx_codeobj_tab[149]))
  __Pyx_RefNannySetupContext("__get__", 0);
  __Pyx_TraceStartFunc("__get__", __pyx_f[0], 2009, 0, 0, 0, __PYX_ERR(0, 2009, __pyx_L1_error));

  /* "pysam/libcbcf.pyx":2012
 *     def filters(self):
 *         """filter metadata (:class:`VariantHeaderMetadata`)"""
 *         return makeVariantHeaderMetadata(self, BCF_HL_FLT)             # <<<<<<<<<<<<<<
 * 
 *     @property
*/
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = ((PyObject *)__pyx_f_5pysam_7libcbcf_makeVariantHeaderMetadata(__pyx_v_self, BCF_HL_FLT)); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 2012, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  __Pyx_TraceReturnValue(__pyx_r, 1, 0, __PYX_ERR(0, 2012, __pyx_L1_error));
  goto __pyx_L0;

  /* "pysam/libcbcf.pyx":2009
 *         return makeVariantHeaderContigs(self)
 * 
 *     @property             # <<<<<<<<<<<<<<
 *     def filters(self):
 *         """filter metadata (:class:`VariantHeaderMetadata`)"""
*/

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_TraceException(__pyx_lineno, 0, 0);
  #if CYTHON_USE_SYS_MONITORING
  __Pyx_TraceExceptionUnwind(0, 0);
  #else
  __Pyx_TraceReturnValue(NULL, 0, 0, __PYX_ERR(0, 2009, __pyx_L1_error));
  #endif
  __Pyx_AddTraceback("pysam.libcbcf.VariantHeader.filters.__get__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_PyMonitoring_ExitScope(0);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "pysam/libcbcf.pyx":2014
 *         return makeVariantHeaderMetadata(self, BCF_HL_FLT)
 * 
 *     @property             # <<<<<<<<<<<<<<
 *     def info(self):
 *         """info metadata (:class:`VariantHeaderMetadata`)"""
*/

/* Python wrapper */
static PyObject *__pyx_pw_5pysam_7libcbcf_13VariantHeader_4info_1__get__(PyObject *__pyx_v_self); /*proto*/
static PyObject *__pyx_pw_5pysam_7libcbcf_13VariantHeader_4info_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_5pysam_7libcbcf_13VariantHeader_4info___get__(((struct __pyx_obj_5pysam_7libcbcf_VariantHeader *)__pyx_v_self));

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

static PyObject *__pyx_pf_5pysam_7libcbcf_13VariantHeader_4info___get__(struct __pyx_obj_5pysam_7libcbcf_VariantHeader *__pyx_v_self) {
  PyObject *__pyx_r = NULL;
  __Pyx_TraceDeclarationsFunc
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_TraceFrameInit(((PyObject *)__pyx_mstate_global->__pyx_codeobj_tab[150]))
  __Pyx_RefNannySetupContext("__get__", 0);
  __Pyx_TraceStartFunc("__get__", __pyx_f[0], 2014, 0, 0, 0, __PYX_ERR(0, 2014, __pyx_L1_error));

  /* "pysam/libcbcf.pyx":2017
 *     def info(self):
 *         """info metadata (:class:`VariantHeaderMetadata`)"""
 *         return makeVariantHeaderMetadata(self, BCF_HL_INFO)             # <<<<<<<<<<<<<<
 * 
 *     @property
*/
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = ((PyObject *)__pyx_f_5pysam_7libcbcf_makeVariantHeaderMetadata(__pyx_v_self, BCF_HL_INFO)); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 2017, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  __Pyx_TraceReturnValue(__pyx_r, 1, 0, __PYX_ERR(0, 2017, __pyx_L1_error));
  goto __pyx_L0;

  /* "pysam/libcbcf.pyx":2014
 *         return makeVariantHeaderMetadata(self, BCF_HL_FLT)
 * 
 *     @property             # <<<<<<<<<<<<<<
 *     def info(self):
 *         """info metadata (:class:`VariantHeaderMetadata`)"""
*/

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_TraceException(__pyx_lineno, 0, 0);
  #if CYTHON_USE_SYS_MONITORING
  __Pyx_TraceExceptionUnwind(0, 0);
  #else
  __Pyx_TraceReturnValue(NULL, 0, 0, __PYX_ERR(0, 2014, __pyx_L1_error));
  #endif
  __Pyx_AddTraceback("pysam.libcbcf.VariantHeader.info.__get__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_PyMonitoring_ExitScope(0);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "pysam/libcbcf.pyx":2019
 *         return makeVariantHeaderMetadata(self, BCF_HL_INFO)
 * 
 *     @property             # <<<<<<<<<<<<<<
 *     def formats(self):
 *         """format metadata (:class:`VariantHeaderMetadata`)"""
*/

/* Python wrapper */
static PyObject *__pyx_pw_5pysam_7libcbcf_13VariantHeader_7formats_1__get__(PyObject *__pyx_v_self); /*proto*/
static PyObject *__pyx_pw_5pysam_7libcbcf_13VariantHeader_7formats_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_5pysam_7libcbcf_13VariantHeader_7formats___get__(((struct __pyx_obj_5pysam_7libcbcf_VariantHeader *)__pyx_v_self));

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

static PyObject *__pyx_pf_5pysam_7libcbcf_13VariantHeader_7formats___get__(struct __pyx_obj_5pysam_7libcbcf_VariantHeader *__pyx_v_self) {
  PyObject *__pyx_r = NULL;
  __Pyx_TraceDeclarationsFunc
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_TraceFrameInit(((PyObject *)__pyx_mstate_global->__pyx_codeobj_tab[151]))
  __Pyx_RefNannySetupContext("__get__", 0);
  __Pyx_TraceStartFunc("__get__", __pyx_f[0], 2019, 0, 0, 0, __PYX_ERR(0, 2019, __pyx_L1_error));

  /* "pysam/libcbcf.pyx":2022
 *     def formats(self):
 *         """format metadata (:class:`VariantHeaderMetadata`)"""
 *         return makeVariantHeaderMetadata(self, BCF_HL_FMT)             # <<<<<<<<<<<<<<
 * 
 *     @property
*/
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = ((PyObject *)__pyx_f_5pysam_7libcbcf_makeVariantHeaderMetadata(__pyx_v_self, BCF_HL_FMT)); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 2022, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  __Pyx_TraceReturnValue(__pyx_r, 1, 0, __PYX_ERR(0, 2022, __pyx_L1_error));
  goto __pyx_L0;

  /* "pysam/libcbcf.pyx":2019
 *         return makeVariantHeaderMetadata(self, BCF_HL_INFO)
 * 
 *     @property             # <<<<<<<<<<<<<<
 *     def formats(self):
 *         """format metadata (:class:`VariantHeaderMetadata`)"""
*/

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_TraceException(__pyx_lineno, 0, 0);
  #if CYTHON_USE_SYS_MONITORING
  __Pyx_TraceExceptionUnwind(0, 0);
  #else
  __Pyx_TraceReturnValue(NULL, 0, 0, __PYX_ERR(0, 2019, __pyx_L1_error));
  #endif
  __Pyx_AddTraceback("pysam.libcbcf.VariantHeader.formats.__get__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_PyMonitoring_ExitScope(0);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "pysam/libcbcf.pyx":2024
 *         return makeVariantHeaderMetadata(self, BCF_HL_FMT)
 * 
 *     @property             # <<<<<<<<<<<<<<
 *     def alts(self):
 *         """alt metadata (:class:`dict` ID->record).
*/

/* Python wrapper */
static PyObject *__pyx_pw_5pysam_7libcbcf_13VariantHeader_4alts_1__get__(PyObject *__pyx_v_self); /*proto*/
static PyObject *__pyx_pw_5pysam_7libcbcf_13VariantHeader_4alts_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_5pysam_7libcbcf_13VariantHeader_4alts___get__(((struct __pyx_obj_5pysam_7libcbcf_VariantHeader *)__pyx_v_self));

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

static PyObject *__pyx_pf_5pysam_7libcbcf_13VariantHeader_4alts___get__(struct __pyx_obj_5pysam_7libcbcf_VariantHeader *__pyx_v_self) {
  PyObject *__pyx_8genexpr5__pyx_v_record = NULL;
  PyObject *__pyx_r = NULL;
  __Pyx_TraceDeclarationsFunc
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  Py_ssize_t __pyx_t_4;
  PyObject *(*__pyx_t_5)(PyObject *);
  PyObject *__pyx_t_6 = NULL;
  PyObject *__pyx_t_7 = NULL;
  size_t __pyx_t_8;
  int __pyx_t_9;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_TraceFrameInit(((PyObject *)__pyx_mstate_global->__pyx_codeobj_tab[152]))
  __Pyx_RefNannySetupContext("__get__", 0);
  __Pyx_TraceStartFunc("__get__", __pyx_f[0], 2024, 0, 0, 0, __PYX_ERR(0, 2024, __pyx_L1_error));

  /* "pysam/libcbcf.pyx":2035
 *         at the time it is created.
 *         """
 *         return {record['ID']:record for record in self.records             # <<<<<<<<<<<<<<
 *                 if record.key.upper() == 'ALT' }
 * 
*/
  __Pyx_XDECREF(__pyx_r);
  { /* enter inner scope */
    __pyx_t_1 = PyDict_New(); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 2035, __pyx_L5_error)
    __Pyx_GOTREF(__pyx_t_1);
    __pyx_t_2 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_mstate_global->__pyx_n_u_records); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 2035, __pyx_L5_error)
    __Pyx_GOTREF(__pyx_t_2);
    if (likely(PyList_CheckExact(__pyx_t_2)) || PyTuple_CheckExact(__pyx_t_2)) {
      __pyx_t_3 = __pyx_t_2; __Pyx_INCREF(__pyx_t_3);
      __pyx_t_4 = 0;
      __pyx_t_5 = NULL;
    } else {
      __pyx_t_4 = -1; __pyx_t_3 = PyObject_GetIter(__pyx_t_2); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 2035, __pyx_L5_error)
      __Pyx_GOTREF(__pyx_t_3);
      __pyx_t_5 = (CYTHON_COMPILING_IN_LIMITED_API) ? PyIter_Next : __Pyx_PyObject_GetIterNextFunc(__pyx_t_3); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 2035, __pyx_L5_error)
    }
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    for (;;) {
      if (likely(!__pyx_t_5)) {
        if (likely(PyList_CheckExact(__pyx_t_3))) {
          {
            Py_ssize_t __pyx_temp = __Pyx_PyList_GET_SIZE(__pyx_t_3);
            #if !CYTHON_ASSUME_SAFE_SIZE
            if (unlikely((__pyx_temp < 0))) __PYX_ERR(0, 2035, __pyx_L5_error)
            #endif
            if (__pyx_t_4 >= __pyx_temp) break;
          }
          __pyx_t_2 = __Pyx_PyList_GetItemRef(__pyx_t_3, __pyx_t_4);
          ++__pyx_t_4;
        } else {
          {
            Py_ssize_t __pyx_temp = __Pyx_PyTuple_GET_SIZE(__pyx_t_3);
            #if !CYTHON_ASSUME_SAFE_SIZE
            if (unlikely((__pyx_temp < 0))) __PYX_ERR(0, 2035, __pyx_L5_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_3, __pyx_t_4));
          #else
          __pyx_t_2 = __Pyx_PySequence_ITEM(__pyx_t_3, __pyx_t_4);
          #endif
          ++__pyx_t_4;
        }
        if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 2035, __pyx_L5_error)
      } else {
        __pyx_t_2 = __pyx_t_5(__pyx_t_3);
        if (unlikely(!__pyx_t_2)) {
          PyObject* exc_type = PyErr_Occurred();
          if (exc_type) {
            if (unlikely(!__Pyx_PyErr_GivenExceptionMatches(exc_type, PyExc_StopIteration))) __PYX_ERR(0, 2035, __pyx_L5_error)
            PyErr_Clear();
          }
          break;
        }
      }
      __Pyx_GOTREF(__pyx_t_2);
      __Pyx_XDECREF_SET(__pyx_8genexpr5__pyx_v_record, __pyx_t_2);
      __pyx_t_2 = 0;

      /* "pysam/libcbcf.pyx":2036
 *         """
 *         return {record['ID']:record for record in self.records
 *                 if record.key.upper() == 'ALT' }             # <<<<<<<<<<<<<<
 * 
 *     # only safe to do when opening an htsfile
*/
      __pyx_t_7 = __Pyx_PyObject_GetAttrStr(__pyx_8genexpr5__pyx_v_record, __pyx_mstate_global->__pyx_n_u_key); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 2036, __pyx_L5_error)
      __Pyx_GOTREF(__pyx_t_7);
      __pyx_t_6 = __pyx_t_7;
      __Pyx_INCREF(__pyx_t_6);
      __pyx_t_8 = 0;
      {
        PyObject *__pyx_callargs[2] = {__pyx_t_6, NULL};
        __pyx_t_2 = __Pyx_PyObject_FastCallMethod(__pyx_mstate_global->__pyx_n_u_upper, __pyx_callargs+__pyx_t_8, (1-__pyx_t_8) | (1*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
        __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0;
        __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
        if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 2036, __pyx_L5_error)
        __Pyx_GOTREF(__pyx_t_2);
      }
      __pyx_t_9 = (__Pyx_PyUnicode_Equals(__pyx_t_2, __pyx_mstate_global->__pyx_n_u_ALT, Py_EQ)); if (unlikely((__pyx_t_9 < 0))) __PYX_ERR(0, 2036, __pyx_L5_error)
      __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
      if (__pyx_t_9) {

        /* "pysam/libcbcf.pyx":2035
 *         at the time it is created.
 *         """
 *         return {record['ID']:record for record in self.records             # <<<<<<<<<<<<<<
 *                 if record.key.upper() == 'ALT' }
 * 
*/
        __pyx_t_2 = __Pyx_PyObject_Dict_GetItem(__pyx_8genexpr5__pyx_v_record, __pyx_mstate_global->__pyx_n_u_ID); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 2035, __pyx_L5_error)
        __Pyx_GOTREF(__pyx_t_2);
        if (unlikely(PyDict_SetItem(__pyx_t_1, (PyObject*)__pyx_t_2, (PyObject*)__pyx_8genexpr5__pyx_v_record))) __PYX_ERR(0, 2035, __pyx_L5_error)
        __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

        /* "pysam/libcbcf.pyx":2036
 *         """
 *         return {record['ID']:record for record in self.records
 *                 if record.key.upper() == 'ALT' }             # <<<<<<<<<<<<<<
 * 
 *     # only safe to do when opening an htsfile
*/
      }

      /* "pysam/libcbcf.pyx":2035
 *         at the time it is created.
 *         """
 *         return {record['ID']:record for record in self.records             # <<<<<<<<<<<<<<
 *                 if record.key.upper() == 'ALT' }
 * 
*/
    }
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    __Pyx_XDECREF(__pyx_8genexpr5__pyx_v_record); __pyx_8genexpr5__pyx_v_record = 0;
    goto __pyx_L10_exit_scope;
    __pyx_L5_error:;
    __Pyx_XDECREF(__pyx_8genexpr5__pyx_v_record); __pyx_8genexpr5__pyx_v_record = 0;
    goto __pyx_L1_error;
    __pyx_L10_exit_scope:;
  } /* exit inner scope */
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  __Pyx_TraceReturnValue(__pyx_r, 1, 0, __PYX_ERR(0, 2035, __pyx_L1_error));
  goto __pyx_L0;

  /* "pysam/libcbcf.pyx":2024
 *         return makeVariantHeaderMetadata(self, BCF_HL_FMT)
 * 
 *     @property             # <<<<<<<<<<<<<<
 *     def alts(self):
 *         """alt metadata (:class:`dict` ID->record).
*/

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_6);
  __Pyx_XDECREF(__pyx_t_7);
  __Pyx_TraceException(__pyx_lineno, 0, 0);
  #if CYTHON_USE_SYS_MONITORING
  __Pyx_TraceExceptionUnwind(0, 0);
  #else
  __Pyx_TraceReturnValue(NULL, 0, 0, __PYX_ERR(0, 2024, __pyx_L1_error));
  #endif
  __Pyx_AddTraceback("pysam.libcbcf.VariantHeader.alts.__get__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_8genexpr5__pyx_v_record);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_PyMonitoring_ExitScope(0);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "pysam/libcbcf.pyx":2039
 * 
 *     # only safe to do when opening an htsfile
 *     cdef _subset_samples(self, include_samples):             # <<<<<<<<<<<<<<
 *         keep_samples    = set(self.samples)
 *         include_samples = set(include_samples)
*/

static PyObject *__pyx_f_5pysam_7libcbcf_13VariantHeader__subset_samples(struct __pyx_obj_5pysam_7libcbcf_VariantHeader *__pyx_v_self, PyObject *__pyx_v_include_samples) {
  PyObject *__pyx_v_keep_samples = NULL;
  PyObject *__pyx_v_missing_samples = NULL;
  char *__pyx_v_keep;
  PyObject *__pyx_v_ret = 0;
  PyObject *__pyx_r = NULL;
  __Pyx_TraceDeclarationsFunc
  __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;
  Py_ssize_t __pyx_t_7;
  PyObject *__pyx_t_8 = NULL;
  size_t __pyx_t_9;
  char *__pyx_t_10;
  char *__pyx_t_11;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_TraceFrameInit(((PyObject *)__pyx_mstate_global->__pyx_codeobj_tab[153]))
  __Pyx_RefNannySetupContext("_subset_samples", 0);
  __Pyx_TraceStartFunc("_subset_samples", __pyx_f[0], 2039, 0, 0, 0, __PYX_ERR(0, 2039, __pyx_L1_error));
  __Pyx_INCREF(__pyx_v_include_samples);

  /* "pysam/libcbcf.pyx":2040
 *     # only safe to do when opening an htsfile
 *     cdef _subset_samples(self, include_samples):
 *         keep_samples    = set(self.samples)             # <<<<<<<<<<<<<<
 *         include_samples = set(include_samples)
 *         missing_samples = include_samples - keep_samples
*/
  __pyx_t_1 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_mstate_global->__pyx_n_u_samples); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 2040, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_2 = PySet_New(__pyx_t_1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 2040, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_v_keep_samples = __pyx_t_2;
  __pyx_t_2 = 0;

  /* "pysam/libcbcf.pyx":2041
 *     cdef _subset_samples(self, include_samples):
 *         keep_samples    = set(self.samples)
 *         include_samples = set(include_samples)             # <<<<<<<<<<<<<<
 *         missing_samples = include_samples - keep_samples
 *         keep_samples   &= include_samples
*/
  __pyx_t_2 = PySet_New(__pyx_v_include_samples); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 2041, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF_SET(__pyx_v_include_samples, __pyx_t_2);
  __pyx_t_2 = 0;

  /* "pysam/libcbcf.pyx":2042
 *         keep_samples    = set(self.samples)
 *         include_samples = set(include_samples)
 *         missing_samples = include_samples - keep_samples             # <<<<<<<<<<<<<<
 *         keep_samples   &= include_samples
 * 
*/
  __pyx_t_2 = PyNumber_Subtract(__pyx_v_include_samples, __pyx_v_keep_samples); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 2042, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_v_missing_samples = __pyx_t_2;
  __pyx_t_2 = 0;

  /* "pysam/libcbcf.pyx":2043
 *         include_samples = set(include_samples)
 *         missing_samples = include_samples - keep_samples
 *         keep_samples   &= include_samples             # <<<<<<<<<<<<<<
 * 
 *         if missing_samples:
*/
  __pyx_t_2 = PyNumber_InPlaceAnd(__pyx_v_keep_samples, __pyx_v_include_samples); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 2043, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF_SET(__pyx_v_keep_samples, __pyx_t_2);
  __pyx_t_2 = 0;

  /* "pysam/libcbcf.pyx":2045
 *         keep_samples   &= include_samples
 * 
 *         if missing_samples:             # <<<<<<<<<<<<<<
 *             # FIXME: add specialized exception with payload
 *             raise ValueError(
*/
  __pyx_t_3 = __Pyx_PyObject_IsTrue(__pyx_v_missing_samples); if (unlikely((__pyx_t_3 < 0))) __PYX_ERR(0, 2045, __pyx_L1_error)
  if (unlikely(__pyx_t_3)) {

    /* "pysam/libcbcf.pyx":2047
 *         if missing_samples:
 *             # FIXME: add specialized exception with payload
 *             raise ValueError(             # <<<<<<<<<<<<<<
 *                 'missing {:d} requested samples'.format(
 *                     len(missing_samples)))
*/
    __pyx_t_1 = NULL;
    __Pyx_INCREF(__pyx_builtin_ValueError);
    __pyx_t_4 = __pyx_builtin_ValueError; 

    /* "pysam/libcbcf.pyx":2048
 *             # FIXME: add specialized exception with payload
 *             raise ValueError(
 *                 'missing {:d} requested samples'.format(             # <<<<<<<<<<<<<<
 *                     len(missing_samples)))
 * 
*/
    __pyx_t_6 = __pyx_mstate_global->__pyx_kp_u_missing_d_requested_samples;
    __Pyx_INCREF(__pyx_t_6);

    /* "pysam/libcbcf.pyx":2049
 *             raise ValueError(
 *                 'missing {:d} requested samples'.format(
 *                     len(missing_samples)))             # <<<<<<<<<<<<<<
 * 
 *         keep_samples = force_bytes(','.join(keep_samples))
*/
    __pyx_t_7 = PyObject_Length(__pyx_v_missing_samples); if (unlikely(__pyx_t_7 == ((Py_ssize_t)-1))) __PYX_ERR(0, 2049, __pyx_L1_error)
    __pyx_t_8 = PyLong_FromSsize_t(__pyx_t_7); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 2049, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_8);
    __pyx_t_9 = 0;
    {
      PyObject *__pyx_callargs[2] = {__pyx_t_6, __pyx_t_8};
      __pyx_t_5 = __Pyx_PyObject_FastCallMethod(__pyx_mstate_global->__pyx_n_u_format, __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_5)) __PYX_ERR(0, 2048, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_5);
    }
    __pyx_t_9 = 1;
    {
      PyObject *__pyx_callargs[2] = {__pyx_t_1, __pyx_t_5};
      __pyx_t_2 = __Pyx_PyObject_FastCall(__pyx_t_4, __pyx_callargs+__pyx_t_9, (2-__pyx_t_9) | (__pyx_t_9*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
      __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0;
      __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
      __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
      if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 2047, __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, 2047, __pyx_L1_error)

    /* "pysam/libcbcf.pyx":2045
 *         keep_samples   &= include_samples
 * 
 *         if missing_samples:             # <<<<<<<<<<<<<<
 *             # FIXME: add specialized exception with payload
 *             raise ValueError(
*/
  }

  /* "pysam/libcbcf.pyx":2051
 *                     len(missing_samples)))
 * 
 *         keep_samples = force_bytes(','.join(keep_samples))             # <<<<<<<<<<<<<<
 *         cdef char *keep = <char *>keep_samples if keep_samples else NULL
 *         cdef ret = bcf_hdr_set_samples(self.ptr, keep, 0)
*/
  __pyx_t_2 = PyUnicode_Join(__pyx_mstate_global->__pyx_kp_u_, __pyx_v_keep_samples); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 2051, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_4 = __pyx_f_5pysam_9libcutils_force_bytes(__pyx_t_2, NULL); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 2051, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __Pyx_DECREF_SET(__pyx_v_keep_samples, __pyx_t_4);
  __pyx_t_4 = 0;

  /* "pysam/libcbcf.pyx":2052
 * 
 *         keep_samples = force_bytes(','.join(keep_samples))
 *         cdef char *keep = <char *>keep_samples if keep_samples else NULL             # <<<<<<<<<<<<<<
 *         cdef ret = bcf_hdr_set_samples(self.ptr, keep, 0)
 * 
*/
  __pyx_t_3 = __Pyx_PyObject_IsTrue(__pyx_v_keep_samples); if (unlikely((__pyx_t_3 < 0))) __PYX_ERR(0, 2052, __pyx_L1_error)
  if (__pyx_t_3) {
    __pyx_t_11 = __Pyx_PyObject_AsWritableString(__pyx_v_keep_samples); if (unlikely((!__pyx_t_11) && PyErr_Occurred())) __PYX_ERR(0, 2052, __pyx_L1_error)
    __pyx_t_10 = ((char *)__pyx_t_11);
  } else {
    __pyx_t_10 = NULL;
  }
  __pyx_v_keep = __pyx_t_10;

  /* "pysam/libcbcf.pyx":2053
 *         keep_samples = force_bytes(','.join(keep_samples))
 *         cdef char *keep = <char *>keep_samples if keep_samples else NULL
 *         cdef ret = bcf_hdr_set_samples(self.ptr, keep, 0)             # <<<<<<<<<<<<<<
 * 
 *         if ret != 0:
*/
  __pyx_t_4 = __Pyx_PyLong_From_int(bcf_hdr_set_samples(__pyx_v_self->ptr, __pyx_v_keep, 0)); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 2053, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  __pyx_v_ret = __pyx_t_4;
  __pyx_t_4 = 0;

  /* "pysam/libcbcf.pyx":2055
 *         cdef ret = bcf_hdr_set_samples(self.ptr, keep, 0)
 * 
 *         if ret != 0:             # <<<<<<<<<<<<<<
 *             raise ValueError(
 *                 'bcf_hdr_set_samples failed: ret = {}'.format(ret))
*/
  __pyx_t_3 = (__Pyx_PyLong_BoolNeObjC(__pyx_v_ret, __pyx_mstate_global->__pyx_int_0, 0, 0)); if (unlikely((__pyx_t_3 < 0))) __PYX_ERR(0, 2055, __pyx_L1_error)
  if (unlikely(__pyx_t_3)) {

    /* "pysam/libcbcf.pyx":2056
 * 
 *         if ret != 0:
 *             raise ValueError(             # <<<<<<<<<<<<<<
 *                 'bcf_hdr_set_samples failed: ret = {}'.format(ret))
 * 
*/
    __pyx_t_2 = NULL;
    __Pyx_INCREF(__pyx_builtin_ValueError);
    __pyx_t_5 = __pyx_builtin_ValueError; 

    /* "pysam/libcbcf.pyx":2057
 *         if ret != 0:
 *             raise ValueError(
 *                 'bcf_hdr_set_samples failed: ret = {}'.format(ret))             # <<<<<<<<<<<<<<
 * 
 *     def __str__(self):
*/
    __pyx_t_8 = __pyx_mstate_global->__pyx_kp_u_bcf_hdr_set_samples_failed_ret;
    __Pyx_INCREF(__pyx_t_8);
    __pyx_t_9 = 0;
    {
      PyObject *__pyx_callargs[2] = {__pyx_t_8, __pyx_v_ret};
      __pyx_t_1 = __Pyx_PyObject_FastCallMethod(__pyx_mstate_global->__pyx_n_u_format, __pyx_callargs+__pyx_t_9, (2-__pyx_t_9) | (1*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
      __Pyx_XDECREF(__pyx_t_8); __pyx_t_8 = 0;
      if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 2057, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_1);
    }
    __pyx_t_9 = 1;
    {
      PyObject *__pyx_callargs[2] = {__pyx_t_2, __pyx_t_1};
      __pyx_t_4 = __Pyx_PyObject_FastCall(__pyx_t_5, __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_1); __pyx_t_1 = 0;
      __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
      if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 2056, __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, 2056, __pyx_L1_error)

    /* "pysam/libcbcf.pyx":2055
 *         cdef ret = bcf_hdr_set_samples(self.ptr, keep, 0)
 * 
 *         if ret != 0:             # <<<<<<<<<<<<<<
 *             raise ValueError(
 *                 'bcf_hdr_set_samples failed: ret = {}'.format(ret))
*/
  }

  /* "pysam/libcbcf.pyx":2039
 * 
 *     # only safe to do when opening an htsfile
 *     cdef _subset_samples(self, include_samples):             # <<<<<<<<<<<<<<
 *         keep_samples    = set(self.samples)
 *         include_samples = set(include_samples)
*/

  /* function exit code */
  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  __Pyx_TraceReturnValue(__pyx_r, 0, 0, __PYX_ERR(0, 2039, __pyx_L1_error));
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_XDECREF(__pyx_t_5);
  __Pyx_XDECREF(__pyx_t_6);
  __Pyx_XDECREF(__pyx_t_8);
  __Pyx_TraceException(__pyx_lineno, 0, 0);
  #if CYTHON_USE_SYS_MONITORING
  __Pyx_TraceExceptionUnwind(0, 0);
  #else
  __Pyx_TraceReturnValue(NULL, 0, 0, __PYX_ERR(0, 2039, __pyx_L1_error));
  #endif
  __Pyx_AddTraceback("pysam.libcbcf.VariantHeader._subset_samples", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_keep_samples);
  __Pyx_XDECREF(__pyx_v_missing_samples);
  __Pyx_XDECREF(__pyx_v_ret);
  __Pyx_XDECREF(__pyx_v_include_samples);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_PyMonitoring_ExitScope(0);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "pysam/libcbcf.pyx":2059
 *                 'bcf_hdr_set_samples failed: ret = {}'.format(ret))
 * 
 *     def __str__(self):             # <<<<<<<<<<<<<<
 *         cdef int hlen
 *         cdef kstring_t line
*/

/* Python wrapper */
static PyObject *__pyx_pw_5pysam_7libcbcf_13VariantHeader_13__str__(PyObject *__pyx_v_self); /*proto*/
static PyObject *__pyx_pw_5pysam_7libcbcf_13VariantHeader_13__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_5pysam_7libcbcf_13VariantHeader_12__str__(((struct __pyx_obj_5pysam_7libcbcf_VariantHeader *)__pyx_v_self));

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

static PyObject *__pyx_pf_5pysam_7libcbcf_13VariantHeader_12__str__(struct __pyx_obj_5pysam_7libcbcf_VariantHeader *__pyx_v_self) {
  kstring_t __pyx_v_line;
  PyObject *__pyx_v_ret = NULL;
  PyObject *__pyx_r = NULL;
  __Pyx_TraceDeclarationsFunc
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  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_TraceFrameInit(((PyObject *)__pyx_mstate_global->__pyx_codeobj_tab[154]))
  __Pyx_RefNannySetupContext("__str__", 0);
  __Pyx_TraceStartFunc("__str__", __pyx_f[0], 2059, 0, 0, 0, __PYX_ERR(0, 2059, __pyx_L1_error));

  /* "pysam/libcbcf.pyx":2062
 *         cdef int hlen
 *         cdef kstring_t line
 *         line.l = line.m = 0             # <<<<<<<<<<<<<<
 *         line.s = NULL
 * 
*/
  __pyx_v_line.l = 0;
  __pyx_v_line.m = 0;

  /* "pysam/libcbcf.pyx":2063
 *         cdef kstring_t line
 *         line.l = line.m = 0
 *         line.s = NULL             # <<<<<<<<<<<<<<
 * 
 *         if bcf_hdr_format(self.ptr, 0, &line) < 0:
*/
  __pyx_v_line.s = NULL;

  /* "pysam/libcbcf.pyx":2065
 *         line.s = NULL
 * 
 *         if bcf_hdr_format(self.ptr, 0, &line) < 0:             # <<<<<<<<<<<<<<
 *             if line.m:
 *                 free(line.s)
*/
  __pyx_t_1 = (bcf_hdr_format(__pyx_v_self->ptr, 0, (&__pyx_v_line)) < 0);
  if (__pyx_t_1) {

    /* "pysam/libcbcf.pyx":2066
 * 
 *         if bcf_hdr_format(self.ptr, 0, &line) < 0:
 *             if line.m:             # <<<<<<<<<<<<<<
 *                 free(line.s)
 *             raise ValueError('bcf_hdr_format failed')
*/
    __pyx_t_1 = (__pyx_v_line.m != 0);
    if (__pyx_t_1) {

      /* "pysam/libcbcf.pyx":2067
 *         if bcf_hdr_format(self.ptr, 0, &line) < 0:
 *             if line.m:
 *                 free(line.s)             # <<<<<<<<<<<<<<
 *             raise ValueError('bcf_hdr_format failed')
 * 
*/
      free(__pyx_v_line.s);

      /* "pysam/libcbcf.pyx":2066
 * 
 *         if bcf_hdr_format(self.ptr, 0, &line) < 0:
 *             if line.m:             # <<<<<<<<<<<<<<
 *                 free(line.s)
 *             raise ValueError('bcf_hdr_format failed')
*/
    }

    /* "pysam/libcbcf.pyx":2068
 *             if line.m:
 *                 free(line.s)
 *             raise ValueError('bcf_hdr_format failed')             # <<<<<<<<<<<<<<
 * 
 *         ret = charptr_to_str_w_len(line.s, line.l)
*/
    __pyx_t_3 = NULL;
    __Pyx_INCREF(__pyx_builtin_ValueError);
    __pyx_t_4 = __pyx_builtin_ValueError; 
    __pyx_t_5 = 1;
    {
      PyObject *__pyx_callargs[2] = {__pyx_t_3, __pyx_mstate_global->__pyx_kp_u_bcf_hdr_format_failed};
      __pyx_t_2 = __Pyx_PyObject_FastCall(__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_2)) __PYX_ERR(0, 2068, __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, 2068, __pyx_L1_error)

    /* "pysam/libcbcf.pyx":2065
 *         line.s = NULL
 * 
 *         if bcf_hdr_format(self.ptr, 0, &line) < 0:             # <<<<<<<<<<<<<<
 *             if line.m:
 *                 free(line.s)
*/
  }

  /* "pysam/libcbcf.pyx":2070
 *             raise ValueError('bcf_hdr_format failed')
 * 
 *         ret = charptr_to_str_w_len(line.s, line.l)             # <<<<<<<<<<<<<<
 * 
 *         if line.m:
*/
  __pyx_t_2 = __pyx_f_5pysam_9libcutils_charptr_to_str_w_len(__pyx_v_line.s, __pyx_v_line.l, NULL); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 2070, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_v_ret = __pyx_t_2;
  __pyx_t_2 = 0;

  /* "pysam/libcbcf.pyx":2072
 *         ret = charptr_to_str_w_len(line.s, line.l)
 * 
 *         if line.m:             # <<<<<<<<<<<<<<
 *             free(line.s)
 *         return ret
*/
  __pyx_t_1 = (__pyx_v_line.m != 0);
  if (__pyx_t_1) {

    /* "pysam/libcbcf.pyx":2073
 * 
 *         if line.m:
 *             free(line.s)             # <<<<<<<<<<<<<<
 *         return ret
 * 
*/
    free(__pyx_v_line.s);

    /* "pysam/libcbcf.pyx":2072
 *         ret = charptr_to_str_w_len(line.s, line.l)
 * 
 *         if line.m:             # <<<<<<<<<<<<<<
 *             free(line.s)
 *         return ret
*/
  }

  /* "pysam/libcbcf.pyx":2074
 *         if line.m:
 *             free(line.s)
 *         return ret             # <<<<<<<<<<<<<<
 * 
 *     def new_record(self, contig=None, start=0, stop=0, alleles=None,
*/
  __Pyx_XDECREF(__pyx_r);
  __Pyx_INCREF(__pyx_v_ret);
  __pyx_r = __pyx_v_ret;
  __Pyx_TraceReturnValue(__pyx_r, 44, 0, __PYX_ERR(0, 2074, __pyx_L1_error));
  goto __pyx_L0;

  /* "pysam/libcbcf.pyx":2059
 *                 'bcf_hdr_set_samples failed: ret = {}'.format(ret))
 * 
 *     def __str__(self):             # <<<<<<<<<<<<<<
 *         cdef int hlen
 *         cdef kstring_t line
*/

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_TraceException(__pyx_lineno, 0, 0);
  #if CYTHON_USE_SYS_MONITORING
  __Pyx_TraceExceptionUnwind(0, 0);
  #else
  __Pyx_TraceReturnValue(NULL, 0, 0, __PYX_ERR(0, 2059, __pyx_L1_error));
  #endif
  __Pyx_AddTraceback("pysam.libcbcf.VariantHeader.__str__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_ret);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_PyMonitoring_ExitScope(0);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "pysam/libcbcf.pyx":2076
 *         return ret
 * 
 *     def new_record(self, contig=None, start=0, stop=0, alleles=None,             # <<<<<<<<<<<<<<
 *                          id=None, qual=None, filter=None, info=None, samples=None,
 *                          **kwargs):
*/

/* Python wrapper */
static PyObject *__pyx_pw_5pysam_7libcbcf_13VariantHeader_15new_record(PyObject *__pyx_v_self, 
#if 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_5pysam_7libcbcf_13VariantHeader_14new_record, "VariantHeader.new_record(self, contig=None, start=0, stop=0, alleles=None, id=None, qual=None, filter=None, info=None, samples=None, **kwargs)\n\nCreate a new empty VariantRecord.\n\nArguments are currently experimental.  Use with caution and expect\nchanges in upcoming releases.");
static PyMethodDef __pyx_mdef_5pysam_7libcbcf_13VariantHeader_15new_record = {"new_record", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_5pysam_7libcbcf_13VariantHeader_15new_record, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_5pysam_7libcbcf_13VariantHeader_14new_record};
static PyObject *__pyx_pw_5pysam_7libcbcf_13VariantHeader_15new_record(PyObject *__pyx_v_self, 
#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_contig = 0;
  PyObject *__pyx_v_start = 0;
  PyObject *__pyx_v_stop = 0;
  PyObject *__pyx_v_alleles = 0;
  PyObject *__pyx_v_id = 0;
  PyObject *__pyx_v_qual = 0;
  PyObject *__pyx_v_filter = 0;
  PyObject *__pyx_v_info = 0;
  PyObject *__pyx_v_samples = 0;
  PyObject *__pyx_v_kwargs = 0;
  #if !CYTHON_METH_FASTCALL
  CYTHON_UNUSED Py_ssize_t __pyx_nargs;
  #endif
  CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
  PyObject* values[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("new_record (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_kwargs = PyDict_New(); if (unlikely(!__pyx_v_kwargs)) return NULL;
  __Pyx_GOTREF(__pyx_v_kwargs);
  {
    PyObject ** const __pyx_pyargnames[] = {&__pyx_mstate_global->__pyx_n_u_contig,&__pyx_mstate_global->__pyx_n_u_start,&__pyx_mstate_global->__pyx_n_u_stop,&__pyx_mstate_global->__pyx_n_u_alleles,&__pyx_mstate_global->__pyx_n_u_id,&__pyx_mstate_global->__pyx_n_u_qual,&__pyx_mstate_global->__pyx_n_u_filter,&__pyx_mstate_global->__pyx_n_u_info,&__pyx_mstate_global->__pyx_n_u_samples,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, 2076, __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, 2076, __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, 2076, __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, 2076, __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, 2076, __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, 2076, __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, 2076, __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, 2076, __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, 2076, __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, 2076, __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, __pyx_v_kwargs, values, kwd_pos_args, __pyx_kwds_len, "new_record", 1) < 0) __PYX_ERR(0, 2076, __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_0));
      if (!values[2]) values[2] = __Pyx_NewRef(((PyObject *)__pyx_mstate_global->__pyx_int_0));
      if (!values[3]) values[3] = __Pyx_NewRef(((PyObject *)Py_None));

      /* "pysam/libcbcf.pyx":2077
 * 
 *     def new_record(self, contig=None, start=0, stop=0, alleles=None,
 *                          id=None, qual=None, filter=None, info=None, samples=None,             # <<<<<<<<<<<<<<
 *                          **kwargs):
 *         """Create a new empty VariantRecord.
*/
      if (!values[4]) values[4] = __Pyx_NewRef(((PyObject *)Py_None));
      if (!values[5]) values[5] = __Pyx_NewRef(((PyObject *)Py_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 *)Py_None));
    } 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, 2076, __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, 2076, __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, 2076, __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, 2076, __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, 2076, __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, 2076, __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, 2076, __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, 2076, __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, 2076, __pyx_L3_error)
        CYTHON_FALLTHROUGH;
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }

      /* "pysam/libcbcf.pyx":2076
 *         return ret
 * 
 *     def new_record(self, contig=None, start=0, stop=0, alleles=None,             # <<<<<<<<<<<<<<
 *                          id=None, qual=None, filter=None, info=None, samples=None,
 *                          **kwargs):
*/
      if (!values[0]) values[0] = __Pyx_NewRef(((PyObject *)Py_None));
      if (!values[1]) values[1] = __Pyx_NewRef(((PyObject *)__pyx_mstate_global->__pyx_int_0));
      if (!values[2]) values[2] = __Pyx_NewRef(((PyObject *)__pyx_mstate_global->__pyx_int_0));
      if (!values[3]) values[3] = __Pyx_NewRef(((PyObject *)Py_None));

      /* "pysam/libcbcf.pyx":2077
 * 
 *     def new_record(self, contig=None, start=0, stop=0, alleles=None,
 *                          id=None, qual=None, filter=None, info=None, samples=None,             # <<<<<<<<<<<<<<
 *                          **kwargs):
 *         """Create a new empty VariantRecord.
*/
      if (!values[4]) values[4] = __Pyx_NewRef(((PyObject *)Py_None));
      if (!values[5]) values[5] = __Pyx_NewRef(((PyObject *)Py_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 *)Py_None));
    }
    __pyx_v_contig = values[0];
    __pyx_v_start = values[1];
    __pyx_v_stop = values[2];
    __pyx_v_alleles = values[3];
    __pyx_v_id = values[4];
    __pyx_v_qual = values[5];
    __pyx_v_filter = values[6];
    __pyx_v_info = values[7];
    __pyx_v_samples = values[8];
  }
  goto __pyx_L6_skip;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("new_record", 0, 0, 9, __pyx_nargs); __PYX_ERR(0, 2076, __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_kwargs); __pyx_v_kwargs = 0;
  __Pyx_AddTraceback("pysam.libcbcf.VariantHeader.new_record", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_5pysam_7libcbcf_13VariantHeader_14new_record(((struct __pyx_obj_5pysam_7libcbcf_VariantHeader *)__pyx_v_self), __pyx_v_contig, __pyx_v_start, __pyx_v_stop, __pyx_v_alleles, __pyx_v_id, __pyx_v_qual, __pyx_v_filter, __pyx_v_info, __pyx_v_samples, __pyx_v_kwargs);

  /* "pysam/libcbcf.pyx":2076
 *         return ret
 * 
 *     def new_record(self, contig=None, start=0, stop=0, alleles=None,             # <<<<<<<<<<<<<<
 *                          id=None, qual=None, filter=None, info=None, samples=None,
 *                          **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_kwargs);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_5pysam_7libcbcf_13VariantHeader_14new_record(struct __pyx_obj_5pysam_7libcbcf_VariantHeader *__pyx_v_self, PyObject *__pyx_v_contig, PyObject *__pyx_v_start, PyObject *__pyx_v_stop, PyObject *__pyx_v_alleles, PyObject *__pyx_v_id, PyObject *__pyx_v_qual, PyObject *__pyx_v_filter, PyObject *__pyx_v_info, PyObject *__pyx_v_samples, PyObject *__pyx_v_kwargs) {
  struct __pyx_obj_5pysam_7libcbcf_VariantRecord *__pyx_v_rec = NULL;
  PyObject *__pyx_v_f = NULL;
  PyObject *__pyx_v_i = NULL;
  PyObject *__pyx_v_sample = NULL;
  PyObject *__pyx_r = NULL;
  __Pyx_TraceDeclarationsFunc
  __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;
  Py_ssize_t __pyx_t_7;
  PyObject *(*__pyx_t_8)(PyObject *);
  PyObject *__pyx_t_9 = NULL;
  PyObject *__pyx_t_10 = NULL;
  PyObject *__pyx_t_11 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_TraceFrameInit(((PyObject *)__pyx_mstate_global->__pyx_codeobj_tab[155]))
  __Pyx_RefNannySetupContext("new_record", 0);
  __Pyx_TraceStartFunc("new_record", __pyx_f[0], 2076, 0, 0, 0, __PYX_ERR(0, 2076, __pyx_L1_error));

  /* "pysam/libcbcf.pyx":2085
 * 
 *         """
 *         rec = makeVariantRecord(self, bcf_init())             # <<<<<<<<<<<<<<
 * 
 *         if not rec:
*/
  __pyx_t_1 = ((PyObject *)__pyx_f_5pysam_7libcbcf_makeVariantRecord(__pyx_v_self, bcf_init())); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 2085, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_v_rec = ((struct __pyx_obj_5pysam_7libcbcf_VariantRecord *)__pyx_t_1);
  __pyx_t_1 = 0;

  /* "pysam/libcbcf.pyx":2087
 *         rec = makeVariantRecord(self, bcf_init())
 * 
 *         if not rec:             # <<<<<<<<<<<<<<
 *             raise MemoryError('unable to allocate BCF record')
 * 
*/
  __pyx_t_2 = __Pyx_PyObject_IsTrue(((PyObject *)__pyx_v_rec)); if (unlikely((__pyx_t_2 < 0))) __PYX_ERR(0, 2087, __pyx_L1_error)
  __pyx_t_3 = (!__pyx_t_2);
  if (unlikely(__pyx_t_3)) {

    /* "pysam/libcbcf.pyx":2088
 * 
 *         if not rec:
 *             raise MemoryError('unable to allocate BCF record')             # <<<<<<<<<<<<<<
 * 
 *         rec.ptr.n_sample = bcf_hdr_nsamples(self.ptr)
*/
    __pyx_t_4 = NULL;
    __Pyx_INCREF(__pyx_builtin_MemoryError);
    __pyx_t_5 = __pyx_builtin_MemoryError; 
    __pyx_t_6 = 1;
    {
      PyObject *__pyx_callargs[2] = {__pyx_t_4, __pyx_mstate_global->__pyx_kp_u_unable_to_allocate_BCF_record};
      __pyx_t_1 = __Pyx_PyObject_FastCall(__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, 2088, __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, 2088, __pyx_L1_error)

    /* "pysam/libcbcf.pyx":2087
 *         rec = makeVariantRecord(self, bcf_init())
 * 
 *         if not rec:             # <<<<<<<<<<<<<<
 *             raise MemoryError('unable to allocate BCF record')
 * 
*/
  }

  /* "pysam/libcbcf.pyx":2090
 *             raise MemoryError('unable to allocate BCF record')
 * 
 *         rec.ptr.n_sample = bcf_hdr_nsamples(self.ptr)             # <<<<<<<<<<<<<<
 * 
 *         if contig is not None:
*/
  __pyx_v_rec->ptr->n_sample = bcf_hdr_nsamples(__pyx_v_self->ptr);

  /* "pysam/libcbcf.pyx":2092
 *         rec.ptr.n_sample = bcf_hdr_nsamples(self.ptr)
 * 
 *         if contig is not None:             # <<<<<<<<<<<<<<
 *             rec.contig  = contig
 * 
*/
  __pyx_t_3 = (__pyx_v_contig != Py_None);
  if (__pyx_t_3) {

    /* "pysam/libcbcf.pyx":2093
 * 
 *         if contig is not None:
 *             rec.contig  = contig             # <<<<<<<<<<<<<<
 * 
 *         rec.start = start
*/
    if (__Pyx_PyObject_SetAttrStr(((PyObject *)__pyx_v_rec), __pyx_mstate_global->__pyx_n_u_contig, __pyx_v_contig) < 0) __PYX_ERR(0, 2093, __pyx_L1_error)

    /* "pysam/libcbcf.pyx":2092
 *         rec.ptr.n_sample = bcf_hdr_nsamples(self.ptr)
 * 
 *         if contig is not None:             # <<<<<<<<<<<<<<
 *             rec.contig  = contig
 * 
*/
  }

  /* "pysam/libcbcf.pyx":2095
 *             rec.contig  = contig
 * 
 *         rec.start = start             # <<<<<<<<<<<<<<
 *         rec.stop  = stop
 *         rec.id    = id
*/
  if (__Pyx_PyObject_SetAttrStr(((PyObject *)__pyx_v_rec), __pyx_mstate_global->__pyx_n_u_start, __pyx_v_start) < 0) __PYX_ERR(0, 2095, __pyx_L1_error)

  /* "pysam/libcbcf.pyx":2096
 * 
 *         rec.start = start
 *         rec.stop  = stop             # <<<<<<<<<<<<<<
 *         rec.id    = id
 *         rec.qual  = qual
*/
  if (__Pyx_PyObject_SetAttrStr(((PyObject *)__pyx_v_rec), __pyx_mstate_global->__pyx_n_u_stop, __pyx_v_stop) < 0) __PYX_ERR(0, 2096, __pyx_L1_error)

  /* "pysam/libcbcf.pyx":2097
 *         rec.start = start
 *         rec.stop  = stop
 *         rec.id    = id             # <<<<<<<<<<<<<<
 *         rec.qual  = qual
 * 
*/
  if (__Pyx_PyObject_SetAttrStr(((PyObject *)__pyx_v_rec), __pyx_mstate_global->__pyx_n_u_id, __pyx_v_id) < 0) __PYX_ERR(0, 2097, __pyx_L1_error)

  /* "pysam/libcbcf.pyx":2098
 *         rec.stop  = stop
 *         rec.id    = id
 *         rec.qual  = qual             # <<<<<<<<<<<<<<
 * 
 *         if alleles is not None:
*/
  if (__Pyx_PyObject_SetAttrStr(((PyObject *)__pyx_v_rec), __pyx_mstate_global->__pyx_n_u_qual, __pyx_v_qual) < 0) __PYX_ERR(0, 2098, __pyx_L1_error)

  /* "pysam/libcbcf.pyx":2100
 *         rec.qual  = qual
 * 
 *         if alleles is not None:             # <<<<<<<<<<<<<<
 *             rec.alleles = alleles
 * 
*/
  __pyx_t_3 = (__pyx_v_alleles != Py_None);
  if (__pyx_t_3) {

    /* "pysam/libcbcf.pyx":2101
 * 
 *         if alleles is not None:
 *             rec.alleles = alleles             # <<<<<<<<<<<<<<
 * 
 *         if filter is not None:
*/
    if (__Pyx_PyObject_SetAttrStr(((PyObject *)__pyx_v_rec), __pyx_mstate_global->__pyx_n_u_alleles, __pyx_v_alleles) < 0) __PYX_ERR(0, 2101, __pyx_L1_error)

    /* "pysam/libcbcf.pyx":2100
 *         rec.qual  = qual
 * 
 *         if alleles is not None:             # <<<<<<<<<<<<<<
 *             rec.alleles = alleles
 * 
*/
  }

  /* "pysam/libcbcf.pyx":2103
 *             rec.alleles = alleles
 * 
 *         if filter is not None:             # <<<<<<<<<<<<<<
 *             if isinstance(filter, (list, tuple, VariantRecordFilter)):
 *                 for f in filter:
*/
  __pyx_t_3 = (__pyx_v_filter != Py_None);
  if (__pyx_t_3) {

    /* "pysam/libcbcf.pyx":2104
 * 
 *         if filter is not None:
 *             if isinstance(filter, (list, tuple, VariantRecordFilter)):             # <<<<<<<<<<<<<<
 *                 for f in filter:
 *                     rec.filter.add(f)
*/
    __pyx_t_2 = PyList_Check(__pyx_v_filter); 
    if (!__pyx_t_2) {
    } else {
      __pyx_t_3 = __pyx_t_2;
      goto __pyx_L8_bool_binop_done;
    }
    __pyx_t_2 = PyTuple_Check(__pyx_v_filter); 
    if (!__pyx_t_2) {
    } else {
      __pyx_t_3 = __pyx_t_2;
      goto __pyx_L8_bool_binop_done;
    }
    __pyx_t_2 = __Pyx_TypeCheck(__pyx_v_filter, __pyx_mstate_global->__pyx_ptype_5pysam_7libcbcf_VariantRecordFilter); 
    __pyx_t_3 = __pyx_t_2;
    __pyx_L8_bool_binop_done:;
    if (__pyx_t_3) {

      /* "pysam/libcbcf.pyx":2105
 *         if filter is not None:
 *             if isinstance(filter, (list, tuple, VariantRecordFilter)):
 *                 for f in filter:             # <<<<<<<<<<<<<<
 *                     rec.filter.add(f)
 *             else:
*/
      if (likely(PyList_CheckExact(__pyx_v_filter)) || PyTuple_CheckExact(__pyx_v_filter)) {
        __pyx_t_1 = __pyx_v_filter; __Pyx_INCREF(__pyx_t_1);
        __pyx_t_7 = 0;
        __pyx_t_8 = NULL;
      } else {
        __pyx_t_7 = -1; __pyx_t_1 = PyObject_GetIter(__pyx_v_filter); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 2105, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_1);
        __pyx_t_8 = (CYTHON_COMPILING_IN_LIMITED_API) ? PyIter_Next : __Pyx_PyObject_GetIterNextFunc(__pyx_t_1); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 2105, __pyx_L1_error)
      }
      for (;;) {
        if (likely(!__pyx_t_8)) {
          if (likely(PyList_CheckExact(__pyx_t_1))) {
            {
              Py_ssize_t __pyx_temp = __Pyx_PyList_GET_SIZE(__pyx_t_1);
              #if !CYTHON_ASSUME_SAFE_SIZE
              if (unlikely((__pyx_temp < 0))) __PYX_ERR(0, 2105, __pyx_L1_error)
              #endif
              if (__pyx_t_7 >= __pyx_temp) break;
            }
            __pyx_t_5 = __Pyx_PyList_GetItemRef(__pyx_t_1, __pyx_t_7);
            ++__pyx_t_7;
          } 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, 2105, __pyx_L1_error)
              #endif
              if (__pyx_t_7 >= __pyx_temp) break;
            }
            #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
            __pyx_t_5 = __Pyx_NewRef(PyTuple_GET_ITEM(__pyx_t_1, __pyx_t_7));
            #else
            __pyx_t_5 = __Pyx_PySequence_ITEM(__pyx_t_1, __pyx_t_7);
            #endif
            ++__pyx_t_7;
          }
          if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 2105, __pyx_L1_error)
        } else {
          __pyx_t_5 = __pyx_t_8(__pyx_t_1);
          if (unlikely(!__pyx_t_5)) {
            PyObject* exc_type = PyErr_Occurred();
            if (exc_type) {
              if (unlikely(!__Pyx_PyErr_GivenExceptionMatches(exc_type, PyExc_StopIteration))) __PYX_ERR(0, 2105, __pyx_L1_error)
              PyErr_Clear();
            }
            break;
          }
        }
        __Pyx_GOTREF(__pyx_t_5);
        __Pyx_XDECREF_SET(__pyx_v_f, __pyx_t_5);
        __pyx_t_5 = 0;

        /* "pysam/libcbcf.pyx":2106
 *             if isinstance(filter, (list, tuple, VariantRecordFilter)):
 *                 for f in filter:
 *                     rec.filter.add(f)             # <<<<<<<<<<<<<<
 *             else:
 *                 rec.filter.add(filter)
*/
        __pyx_t_9 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_rec), __pyx_mstate_global->__pyx_n_u_filter); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 2106, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_9);
        __pyx_t_4 = __pyx_t_9;
        __Pyx_INCREF(__pyx_t_4);
        __pyx_t_6 = 0;
        {
          PyObject *__pyx_callargs[2] = {__pyx_t_4, __pyx_v_f};
          __pyx_t_5 = __Pyx_PyObject_FastCallMethod(__pyx_mstate_global->__pyx_n_u_add, __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_9); __pyx_t_9 = 0;
          if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 2106, __pyx_L1_error)
          __Pyx_GOTREF(__pyx_t_5);
        }
        __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;

        /* "pysam/libcbcf.pyx":2105
 *         if filter is not None:
 *             if isinstance(filter, (list, tuple, VariantRecordFilter)):
 *                 for f in filter:             # <<<<<<<<<<<<<<
 *                     rec.filter.add(f)
 *             else:
*/
      }
      __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

      /* "pysam/libcbcf.pyx":2104
 * 
 *         if filter is not None:
 *             if isinstance(filter, (list, tuple, VariantRecordFilter)):             # <<<<<<<<<<<<<<
 *                 for f in filter:
 *                     rec.filter.add(f)
*/
      goto __pyx_L7;
    }

    /* "pysam/libcbcf.pyx":2108
 *                     rec.filter.add(f)
 *             else:
 *                 rec.filter.add(filter)             # <<<<<<<<<<<<<<
 * 
 *         if info:
*/
    /*else*/ {
      __pyx_t_9 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_rec), __pyx_mstate_global->__pyx_n_u_filter); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 2108, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_9);
      __pyx_t_5 = __pyx_t_9;
      __Pyx_INCREF(__pyx_t_5);
      __pyx_t_6 = 0;
      {
        PyObject *__pyx_callargs[2] = {__pyx_t_5, __pyx_v_filter};
        __pyx_t_1 = __Pyx_PyObject_FastCallMethod(__pyx_mstate_global->__pyx_n_u_add, __pyx_callargs+__pyx_t_6, (2-__pyx_t_6) | (1*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
        __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
        __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
        if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 2108, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_1);
      }
      __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    }
    __pyx_L7:;

    /* "pysam/libcbcf.pyx":2103
 *             rec.alleles = alleles
 * 
 *         if filter is not None:             # <<<<<<<<<<<<<<
 *             if isinstance(filter, (list, tuple, VariantRecordFilter)):
 *                 for f in filter:
*/
  }

  /* "pysam/libcbcf.pyx":2110
 *                 rec.filter.add(filter)
 * 
 *         if info:             # <<<<<<<<<<<<<<
 *             rec.info.update(info)
 * 
*/
  __pyx_t_3 = __Pyx_PyObject_IsTrue(__pyx_v_info); if (unlikely((__pyx_t_3 < 0))) __PYX_ERR(0, 2110, __pyx_L1_error)
  if (__pyx_t_3) {

    /* "pysam/libcbcf.pyx":2111
 * 
 *         if info:
 *             rec.info.update(info)             # <<<<<<<<<<<<<<
 * 
 *         if kwargs:
*/
    __pyx_t_5 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_rec), __pyx_mstate_global->__pyx_n_u_info); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 2111, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_5);
    __pyx_t_9 = __pyx_t_5;
    __Pyx_INCREF(__pyx_t_9);
    __pyx_t_6 = 0;
    {
      PyObject *__pyx_callargs[2] = {__pyx_t_9, __pyx_v_info};
      __pyx_t_1 = __Pyx_PyObject_FastCallMethod(__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_9); __pyx_t_9 = 0;
      __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
      if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 2111, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_1);
    }
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

    /* "pysam/libcbcf.pyx":2110
 *                 rec.filter.add(filter)
 * 
 *         if info:             # <<<<<<<<<<<<<<
 *             rec.info.update(info)
 * 
*/
  }

  /* "pysam/libcbcf.pyx":2113
 *             rec.info.update(info)
 * 
 *         if kwargs:             # <<<<<<<<<<<<<<
 *             rec.samples[0].update(kwargs)
 * 
*/
  __pyx_t_3 = __Pyx_PyObject_IsTrue(__pyx_v_kwargs); if (unlikely((__pyx_t_3 < 0))) __PYX_ERR(0, 2113, __pyx_L1_error)
  if (__pyx_t_3) {

    /* "pysam/libcbcf.pyx":2114
 * 
 *         if kwargs:
 *             rec.samples[0].update(kwargs)             # <<<<<<<<<<<<<<
 * 
 *         if samples:
*/
    __pyx_t_9 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_rec), __pyx_mstate_global->__pyx_n_u_samples); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 2114, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_9);
    __pyx_t_4 = __Pyx_GetItemInt(__pyx_t_9, 0, long, 1, __Pyx_PyLong_From_long, 0, 0, 1, 1); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 2114, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
    __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
    __pyx_t_5 = __pyx_t_4;
    __Pyx_INCREF(__pyx_t_5);
    __pyx_t_6 = 0;
    {
      PyObject *__pyx_callargs[2] = {__pyx_t_5, __pyx_v_kwargs};
      __pyx_t_1 = __Pyx_PyObject_FastCallMethod(__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_5); __pyx_t_5 = 0;
      __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
      if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 2114, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_1);
    }
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

    /* "pysam/libcbcf.pyx":2113
 *             rec.info.update(info)
 * 
 *         if kwargs:             # <<<<<<<<<<<<<<
 *             rec.samples[0].update(kwargs)
 * 
*/
  }

  /* "pysam/libcbcf.pyx":2116
 *             rec.samples[0].update(kwargs)
 * 
 *         if samples:             # <<<<<<<<<<<<<<
 *             for i, sample in enumerate(samples):
 *                 rec.samples[i].update(sample)
*/
  __pyx_t_3 = __Pyx_PyObject_IsTrue(__pyx_v_samples); if (unlikely((__pyx_t_3 < 0))) __PYX_ERR(0, 2116, __pyx_L1_error)
  if (__pyx_t_3) {

    /* "pysam/libcbcf.pyx":2117
 * 
 *         if samples:
 *             for i, sample in enumerate(samples):             # <<<<<<<<<<<<<<
 *                 rec.samples[i].update(sample)
 * 
*/
    __Pyx_INCREF(__pyx_mstate_global->__pyx_int_0);
    __pyx_t_1 = __pyx_mstate_global->__pyx_int_0;
    if (likely(PyList_CheckExact(__pyx_v_samples)) || PyTuple_CheckExact(__pyx_v_samples)) {
      __pyx_t_4 = __pyx_v_samples; __Pyx_INCREF(__pyx_t_4);
      __pyx_t_7 = 0;
      __pyx_t_8 = NULL;
    } else {
      __pyx_t_7 = -1; __pyx_t_4 = PyObject_GetIter(__pyx_v_samples); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 2117, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_4);
      __pyx_t_8 = (CYTHON_COMPILING_IN_LIMITED_API) ? PyIter_Next : __Pyx_PyObject_GetIterNextFunc(__pyx_t_4); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 2117, __pyx_L1_error)
    }
    for (;;) {
      if (likely(!__pyx_t_8)) {
        if (likely(PyList_CheckExact(__pyx_t_4))) {
          {
            Py_ssize_t __pyx_temp = __Pyx_PyList_GET_SIZE(__pyx_t_4);
            #if !CYTHON_ASSUME_SAFE_SIZE
            if (unlikely((__pyx_temp < 0))) __PYX_ERR(0, 2117, __pyx_L1_error)
            #endif
            if (__pyx_t_7 >= __pyx_temp) break;
          }
          __pyx_t_5 = __Pyx_PyList_GetItemRef(__pyx_t_4, __pyx_t_7);
          ++__pyx_t_7;
        } else {
          {
            Py_ssize_t __pyx_temp = __Pyx_PyTuple_GET_SIZE(__pyx_t_4);
            #if !CYTHON_ASSUME_SAFE_SIZE
            if (unlikely((__pyx_temp < 0))) __PYX_ERR(0, 2117, __pyx_L1_error)
            #endif
            if (__pyx_t_7 >= __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_7));
          #else
          __pyx_t_5 = __Pyx_PySequence_ITEM(__pyx_t_4, __pyx_t_7);
          #endif
          ++__pyx_t_7;
        }
        if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 2117, __pyx_L1_error)
      } else {
        __pyx_t_5 = __pyx_t_8(__pyx_t_4);
        if (unlikely(!__pyx_t_5)) {
          PyObject* exc_type = PyErr_Occurred();
          if (exc_type) {
            if (unlikely(!__Pyx_PyErr_GivenExceptionMatches(exc_type, PyExc_StopIteration))) __PYX_ERR(0, 2117, __pyx_L1_error)
            PyErr_Clear();
          }
          break;
        }
      }
      __Pyx_GOTREF(__pyx_t_5);
      __Pyx_XDECREF_SET(__pyx_v_sample, __pyx_t_5);
      __pyx_t_5 = 0;
      __Pyx_INCREF(__pyx_t_1);
      __Pyx_XDECREF_SET(__pyx_v_i, __pyx_t_1);
      __pyx_t_5 = __Pyx_PyLong_AddObjC(__pyx_t_1, __pyx_mstate_global->__pyx_int_1, 1, 0, 0); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 2117, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_5);
      __Pyx_DECREF(__pyx_t_1);
      __pyx_t_1 = __pyx_t_5;
      __pyx_t_5 = 0;

      /* "pysam/libcbcf.pyx":2118
 *         if samples:
 *             for i, sample in enumerate(samples):
 *                 rec.samples[i].update(sample)             # <<<<<<<<<<<<<<
 * 
 *         return rec
*/
      __pyx_t_10 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_rec), __pyx_mstate_global->__pyx_n_u_samples); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 2118, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_10);
      __pyx_t_11 = __Pyx_PyObject_GetItem(__pyx_t_10, __pyx_v_i); if (unlikely(!__pyx_t_11)) __PYX_ERR(0, 2118, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_11);
      __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
      __pyx_t_9 = __pyx_t_11;
      __Pyx_INCREF(__pyx_t_9);
      __pyx_t_6 = 0;
      {
        PyObject *__pyx_callargs[2] = {__pyx_t_9, __pyx_v_sample};
        __pyx_t_5 = __Pyx_PyObject_FastCallMethod(__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_9); __pyx_t_9 = 0;
        __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0;
        if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 2118, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_5);
      }
      __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;

      /* "pysam/libcbcf.pyx":2117
 * 
 *         if samples:
 *             for i, sample in enumerate(samples):             # <<<<<<<<<<<<<<
 *                 rec.samples[i].update(sample)
 * 
*/
    }
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

    /* "pysam/libcbcf.pyx":2116
 *             rec.samples[0].update(kwargs)
 * 
 *         if samples:             # <<<<<<<<<<<<<<
 *             for i, sample in enumerate(samples):
 *                 rec.samples[i].update(sample)
*/
  }

  /* "pysam/libcbcf.pyx":2120
 *                 rec.samples[i].update(sample)
 * 
 *         return rec             # <<<<<<<<<<<<<<
 * 
 *     def add_record(self, VariantHeaderRecord record):
*/
  __Pyx_XDECREF(__pyx_r);
  __Pyx_INCREF((PyObject *)__pyx_v_rec);
  __pyx_r = ((PyObject *)__pyx_v_rec);
  __Pyx_TraceReturnValue(__pyx_r, 111, 0, __PYX_ERR(0, 2120, __pyx_L1_error));
  goto __pyx_L0;

  /* "pysam/libcbcf.pyx":2076
 *         return ret
 * 
 *     def new_record(self, contig=None, start=0, stop=0, alleles=None,             # <<<<<<<<<<<<<<
 *                          id=None, qual=None, filter=None, info=None, samples=None,
 *                          **kwargs):
*/

  /* 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_9);
  __Pyx_XDECREF(__pyx_t_10);
  __Pyx_XDECREF(__pyx_t_11);
  __Pyx_TraceException(__pyx_lineno, 0, 0);
  #if CYTHON_USE_SYS_MONITORING
  __Pyx_TraceExceptionUnwind(0, 0);
  #else
  __Pyx_TraceReturnValue(NULL, 0, 0, __PYX_ERR(0, 2076, __pyx_L1_error));
  #endif
  __Pyx_AddTraceback("pysam.libcbcf.VariantHeader.new_record", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF((PyObject *)__pyx_v_rec);
  __Pyx_XDECREF(__pyx_v_f);
  __Pyx_XDECREF(__pyx_v_i);
  __Pyx_XDECREF(__pyx_v_sample);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_PyMonitoring_ExitScope(0);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "pysam/libcbcf.pyx":2122
 *         return rec
 * 
 *     def add_record(self, VariantHeaderRecord record):             # <<<<<<<<<<<<<<
 *         """Add an existing :class:`VariantHeaderRecord` to this header"""
 *         if record is None:
*/

/* Python wrapper */
static PyObject *__pyx_pw_5pysam_7libcbcf_13VariantHeader_17add_record(PyObject *__pyx_v_self, 
#if 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_5pysam_7libcbcf_13VariantHeader_16add_record, "VariantHeader.add_record(self, VariantHeaderRecord record)\n\nAdd an existing :class:`VariantHeaderRecord` to this header");
static PyMethodDef __pyx_mdef_5pysam_7libcbcf_13VariantHeader_17add_record = {"add_record", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_5pysam_7libcbcf_13VariantHeader_17add_record, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_5pysam_7libcbcf_13VariantHeader_16add_record};
static PyObject *__pyx_pw_5pysam_7libcbcf_13VariantHeader_17add_record(PyObject *__pyx_v_self, 
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
) {
  struct __pyx_obj_5pysam_7libcbcf_VariantHeaderRecord *__pyx_v_record = 0;
  #if !CYTHON_METH_FASTCALL
  CYTHON_UNUSED Py_ssize_t __pyx_nargs;
  #endif
  CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
  PyObject* values[1] = {0};
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("add_record (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_record,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, 2122, __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, 2122, __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, "add_record", 0) < 0) __PYX_ERR(0, 2122, __pyx_L3_error)
      for (Py_ssize_t i = __pyx_nargs; i < 1; i++) {
        if (unlikely(!values[i])) { __Pyx_RaiseArgtupleInvalid("add_record", 1, 1, 1, i); __PYX_ERR(0, 2122, __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, 2122, __pyx_L3_error)
    }
    __pyx_v_record = ((struct __pyx_obj_5pysam_7libcbcf_VariantHeaderRecord *)values[0]);
  }
  goto __pyx_L6_skip;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("add_record", 1, 1, 1, __pyx_nargs); __PYX_ERR(0, 2122, __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("pysam.libcbcf.VariantHeader.add_record", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_record), __pyx_mstate_global->__pyx_ptype_5pysam_7libcbcf_VariantHeaderRecord, 1, "record", 0))) __PYX_ERR(0, 2122, __pyx_L1_error)
  __pyx_r = __pyx_pf_5pysam_7libcbcf_13VariantHeader_16add_record(((struct __pyx_obj_5pysam_7libcbcf_VariantHeader *)__pyx_v_self), __pyx_v_record);

  /* 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_5pysam_7libcbcf_13VariantHeader_16add_record(struct __pyx_obj_5pysam_7libcbcf_VariantHeader *__pyx_v_self, struct __pyx_obj_5pysam_7libcbcf_VariantHeaderRecord *__pyx_v_record) {
  bcf_hrec_t *__pyx_v_hrec;
  PyObject *__pyx_r = NULL;
  __Pyx_TraceDeclarationsFunc
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  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_TraceFrameInit(((PyObject *)__pyx_mstate_global->__pyx_codeobj_tab[156]))
  __Pyx_RefNannySetupContext("add_record", 0);
  __Pyx_TraceStartFunc("add_record", __pyx_f[0], 2122, 0, 0, 0, __PYX_ERR(0, 2122, __pyx_L1_error));

  /* "pysam/libcbcf.pyx":2124
 *     def add_record(self, VariantHeaderRecord record):
 *         """Add an existing :class:`VariantHeaderRecord` to this header"""
 *         if record is None:             # <<<<<<<<<<<<<<
 *             raise ValueError('record must not be None')
 * 
*/
  __pyx_t_1 = (((PyObject *)__pyx_v_record) == Py_None);
  if (unlikely(__pyx_t_1)) {

    /* "pysam/libcbcf.pyx":2125
 *         """Add an existing :class:`VariantHeaderRecord` to this header"""
 *         if record is None:
 *             raise ValueError('record must not be None')             # <<<<<<<<<<<<<<
 * 
 *         cdef bcf_hrec_t *hrec = bcf_hrec_dup(record.ptr)
*/
    __pyx_t_3 = NULL;
    __Pyx_INCREF(__pyx_builtin_ValueError);
    __pyx_t_4 = __pyx_builtin_ValueError; 
    __pyx_t_5 = 1;
    {
      PyObject *__pyx_callargs[2] = {__pyx_t_3, __pyx_mstate_global->__pyx_kp_u_record_must_not_be_None};
      __pyx_t_2 = __Pyx_PyObject_FastCall(__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_2)) __PYX_ERR(0, 2125, __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, 2125, __pyx_L1_error)

    /* "pysam/libcbcf.pyx":2124
 *     def add_record(self, VariantHeaderRecord record):
 *         """Add an existing :class:`VariantHeaderRecord` to this header"""
 *         if record is None:             # <<<<<<<<<<<<<<
 *             raise ValueError('record must not be None')
 * 
*/
  }

  /* "pysam/libcbcf.pyx":2127
 *             raise ValueError('record must not be None')
 * 
 *         cdef bcf_hrec_t *hrec = bcf_hrec_dup(record.ptr)             # <<<<<<<<<<<<<<
 * 
 *         bcf_hdr_add_hrec(self.ptr, hrec)
*/
  __pyx_v_hrec = bcf_hrec_dup(__pyx_v_record->ptr);

  /* "pysam/libcbcf.pyx":2129
 *         cdef bcf_hrec_t *hrec = bcf_hrec_dup(record.ptr)
 * 
 *         bcf_hdr_add_hrec(self.ptr, hrec)             # <<<<<<<<<<<<<<
 * 
 *         self._hdr_sync()
*/
  (void)(bcf_hdr_add_hrec(__pyx_v_self->ptr, __pyx_v_hrec));

  /* "pysam/libcbcf.pyx":2131
 *         bcf_hdr_add_hrec(self.ptr, hrec)
 * 
 *         self._hdr_sync()             # <<<<<<<<<<<<<<
 * 
 *     def add_line(self, line):
*/
  __pyx_t_2 = ((struct __pyx_vtabstruct_5pysam_7libcbcf_VariantHeader *)__pyx_v_self->__pyx_vtab)->_hdr_sync(__pyx_v_self); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 2131, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

  /* "pysam/libcbcf.pyx":2122
 *         return rec
 * 
 *     def add_record(self, VariantHeaderRecord record):             # <<<<<<<<<<<<<<
 *         """Add an existing :class:`VariantHeaderRecord` to this header"""
 *         if record is None:
*/

  /* function exit code */
  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  __Pyx_TraceReturnValue(__pyx_r, 0, 0, __PYX_ERR(0, 2122, __pyx_L1_error));
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_TraceException(__pyx_lineno, 0, 0);
  #if CYTHON_USE_SYS_MONITORING
  __Pyx_TraceExceptionUnwind(0, 0);
  #else
  __Pyx_TraceReturnValue(NULL, 0, 0, __PYX_ERR(0, 2122, __pyx_L1_error));
  #endif
  __Pyx_AddTraceback("pysam.libcbcf.VariantHeader.add_record", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_PyMonitoring_ExitScope(0);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "pysam/libcbcf.pyx":2133
 *         self._hdr_sync()
 * 
 *     def add_line(self, line):             # <<<<<<<<<<<<<<
 *         """Add a metadata line to this header"""
 *         bline = force_bytes(line)
*/

/* Python wrapper */
static PyObject *__pyx_pw_5pysam_7libcbcf_13VariantHeader_19add_line(PyObject *__pyx_v_self, 
#if 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_5pysam_7libcbcf_13VariantHeader_18add_line, "VariantHeader.add_line(self, line)\n\nAdd a metadata line to this header");
static PyMethodDef __pyx_mdef_5pysam_7libcbcf_13VariantHeader_19add_line = {"add_line", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_5pysam_7libcbcf_13VariantHeader_19add_line, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_5pysam_7libcbcf_13VariantHeader_18add_line};
static PyObject *__pyx_pw_5pysam_7libcbcf_13VariantHeader_19add_line(PyObject *__pyx_v_self, 
#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_line = 0;
  #if !CYTHON_METH_FASTCALL
  CYTHON_UNUSED Py_ssize_t __pyx_nargs;
  #endif
  CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
  PyObject* values[1] = {0};
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("add_line (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_line,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, 2133, __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, 2133, __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, "add_line", 0) < 0) __PYX_ERR(0, 2133, __pyx_L3_error)
      for (Py_ssize_t i = __pyx_nargs; i < 1; i++) {
        if (unlikely(!values[i])) { __Pyx_RaiseArgtupleInvalid("add_line", 1, 1, 1, i); __PYX_ERR(0, 2133, __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, 2133, __pyx_L3_error)
    }
    __pyx_v_line = values[0];
  }
  goto __pyx_L6_skip;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("add_line", 1, 1, 1, __pyx_nargs); __PYX_ERR(0, 2133, __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("pysam.libcbcf.VariantHeader.add_line", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_5pysam_7libcbcf_13VariantHeader_18add_line(((struct __pyx_obj_5pysam_7libcbcf_VariantHeader *)__pyx_v_self), __pyx_v_line);

  /* 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_5pysam_7libcbcf_13VariantHeader_18add_line(struct __pyx_obj_5pysam_7libcbcf_VariantHeader *__pyx_v_self, PyObject *__pyx_v_line) {
  PyObject *__pyx_v_bline = NULL;
  PyObject *__pyx_r = NULL;
  __Pyx_TraceDeclarationsFunc
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  char const *__pyx_t_2;
  int __pyx_t_3;
  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_TraceFrameInit(((PyObject *)__pyx_mstate_global->__pyx_codeobj_tab[157]))
  __Pyx_RefNannySetupContext("add_line", 0);
  __Pyx_TraceStartFunc("add_line", __pyx_f[0], 2133, 0, 0, 0, __PYX_ERR(0, 2133, __pyx_L1_error));

  /* "pysam/libcbcf.pyx":2135
 *     def add_line(self, line):
 *         """Add a metadata line to this header"""
 *         bline = force_bytes(line)             # <<<<<<<<<<<<<<
 *         if bcf_hdr_append(self.ptr, bline) < 0:
 *             raise ValueError('invalid header line')
*/
  __pyx_t_1 = __pyx_f_5pysam_9libcutils_force_bytes(__pyx_v_line, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 2135, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_v_bline = ((PyObject*)__pyx_t_1);
  __pyx_t_1 = 0;

  /* "pysam/libcbcf.pyx":2136
 *         """Add a metadata line to this header"""
 *         bline = force_bytes(line)
 *         if bcf_hdr_append(self.ptr, bline) < 0:             # <<<<<<<<<<<<<<
 *             raise ValueError('invalid header line')
 * 
*/
  if (unlikely(__pyx_v_bline == Py_None)) {
    PyErr_SetString(PyExc_TypeError, "expected bytes, NoneType found");
    __PYX_ERR(0, 2136, __pyx_L1_error)
  }
  __pyx_t_2 = __Pyx_PyBytes_AsString(__pyx_v_bline); if (unlikely((!__pyx_t_2) && PyErr_Occurred())) __PYX_ERR(0, 2136, __pyx_L1_error)
  __pyx_t_3 = (bcf_hdr_append(__pyx_v_self->ptr, __pyx_t_2) < 0);
  if (unlikely(__pyx_t_3)) {

    /* "pysam/libcbcf.pyx":2137
 *         bline = force_bytes(line)
 *         if bcf_hdr_append(self.ptr, bline) < 0:
 *             raise ValueError('invalid header line')             # <<<<<<<<<<<<<<
 * 
 *         self._hdr_sync()
*/
    __pyx_t_4 = NULL;
    __Pyx_INCREF(__pyx_builtin_ValueError);
    __pyx_t_5 = __pyx_builtin_ValueError; 
    __pyx_t_6 = 1;
    {
      PyObject *__pyx_callargs[2] = {__pyx_t_4, __pyx_mstate_global->__pyx_kp_u_invalid_header_line};
      __pyx_t_1 = __Pyx_PyObject_FastCall(__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, 2137, __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, 2137, __pyx_L1_error)

    /* "pysam/libcbcf.pyx":2136
 *         """Add a metadata line to this header"""
 *         bline = force_bytes(line)
 *         if bcf_hdr_append(self.ptr, bline) < 0:             # <<<<<<<<<<<<<<
 *             raise ValueError('invalid header line')
 * 
*/
  }

  /* "pysam/libcbcf.pyx":2139
 *             raise ValueError('invalid header line')
 * 
 *         self._hdr_sync()             # <<<<<<<<<<<<<<
 * 
 * 
*/
  __pyx_t_1 = ((struct __pyx_vtabstruct_5pysam_7libcbcf_VariantHeader *)__pyx_v_self->__pyx_vtab)->_hdr_sync(__pyx_v_self); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 2139, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "pysam/libcbcf.pyx":2133
 *         self._hdr_sync()
 * 
 *     def add_line(self, line):             # <<<<<<<<<<<<<<
 *         """Add a metadata line to this header"""
 *         bline = force_bytes(line)
*/

  /* function exit code */
  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  __Pyx_TraceReturnValue(__pyx_r, 0, 0, __PYX_ERR(0, 2133, __pyx_L1_error));
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_XDECREF(__pyx_t_5);
  __Pyx_TraceException(__pyx_lineno, 0, 0);
  #if CYTHON_USE_SYS_MONITORING
  __Pyx_TraceExceptionUnwind(0, 0);
  #else
  __Pyx_TraceReturnValue(NULL, 0, 0, __PYX_ERR(0, 2133, __pyx_L1_error));
  #endif
  __Pyx_AddTraceback("pysam.libcbcf.VariantHeader.add_line", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_bline);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_PyMonitoring_ExitScope(0);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "pysam/libcbcf.pyx":2142
 * 
 * 
 *     def add_meta(self, key, value=None, items=None):             # <<<<<<<<<<<<<<
 *         """Add metadata to this header"""
 *         if not ((value is not None) ^ (items is not None)):
*/

/* Python wrapper */
static PyObject *__pyx_pw_5pysam_7libcbcf_13VariantHeader_21add_meta(PyObject *__pyx_v_self, 
#if 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_5pysam_7libcbcf_13VariantHeader_20add_meta, "VariantHeader.add_meta(self, key, value=None, items=None)\n\nAdd metadata to this header");
static PyMethodDef __pyx_mdef_5pysam_7libcbcf_13VariantHeader_21add_meta = {"add_meta", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_5pysam_7libcbcf_13VariantHeader_21add_meta, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_5pysam_7libcbcf_13VariantHeader_20add_meta};
static PyObject *__pyx_pw_5pysam_7libcbcf_13VariantHeader_21add_meta(PyObject *__pyx_v_self, 
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
) {
  PyObject *__pyx_v_key = 0;
  PyObject *__pyx_v_value = 0;
  PyObject *__pyx_v_items = 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("add_meta (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,&__pyx_mstate_global->__pyx_n_u_value,&__pyx_mstate_global->__pyx_n_u_items,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, 2142, __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, 2142, __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, 2142, __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, 2142, __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, "add_meta", 0) < 0) __PYX_ERR(0, 2142, __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("add_meta", 0, 1, 3, i); __PYX_ERR(0, 2142, __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, 2142, __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, 2142, __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, 2142, __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_key = values[0];
    __pyx_v_value = values[1];
    __pyx_v_items = values[2];
  }
  goto __pyx_L6_skip;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("add_meta", 0, 1, 3, __pyx_nargs); __PYX_ERR(0, 2142, __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("pysam.libcbcf.VariantHeader.add_meta", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_5pysam_7libcbcf_13VariantHeader_20add_meta(((struct __pyx_obj_5pysam_7libcbcf_VariantHeader *)__pyx_v_self), __pyx_v_key, __pyx_v_value, __pyx_v_items);

  /* 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_5pysam_7libcbcf_13VariantHeader_20add_meta(struct __pyx_obj_5pysam_7libcbcf_VariantHeader *__pyx_v_self, PyObject *__pyx_v_key, PyObject *__pyx_v_value, PyObject *__pyx_v_items) {
  bcf_hrec_t *__pyx_v_hrec;
  int __pyx_v_quoted;
  PyObject *__pyx_r = NULL;
  __Pyx_TraceDeclarationsFunc
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  int __pyx_t_2;
  int __pyx_t_3;
  PyObject *__pyx_t_4 = NULL;
  PyObject *__pyx_t_5 = NULL;
  PyObject *__pyx_t_6 = NULL;
  size_t __pyx_t_7;
  PyObject *__pyx_t_8 = NULL;
  PyObject *__pyx_t_9 = NULL;
  PyObject *__pyx_t_10 = NULL;
  char const *__pyx_t_11;
  Py_ssize_t __pyx_t_12;
  PyObject *(*__pyx_t_13)(PyObject *);
  PyObject *__pyx_t_14 = NULL;
  PyObject *__pyx_t_15 = NULL;
  PyObject *(*__pyx_t_16)(PyObject *);
  int __pyx_t_17;
  char const *__pyx_t_18;
  Py_ssize_t __pyx_t_19;
  char const *__pyx_t_20;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_TraceFrameInit(((PyObject *)__pyx_mstate_global->__pyx_codeobj_tab[158]))
  __Pyx_RefNannySetupContext("add_meta", 0);
  __Pyx_TraceStartFunc("add_meta", __pyx_f[0], 2142, 0, 0, 0, __PYX_ERR(0, 2142, __pyx_L1_error));
  __Pyx_INCREF(__pyx_v_key);
  __Pyx_INCREF(__pyx_v_value);

  /* "pysam/libcbcf.pyx":2144
 *     def add_meta(self, key, value=None, items=None):
 *         """Add metadata to this header"""
 *         if not ((value is not None) ^ (items is not None)):             # <<<<<<<<<<<<<<
 *             raise ValueError('either value or items must be specified')
 * 
*/
  __pyx_t_1 = (__pyx_v_value != Py_None);
  __pyx_t_2 = (__pyx_v_items != Py_None);
  __pyx_t_3 = (!(__pyx_t_1 ^ __pyx_t_2));
  if (unlikely(__pyx_t_3)) {

    /* "pysam/libcbcf.pyx":2145
 *         """Add metadata to this header"""
 *         if not ((value is not None) ^ (items is not None)):
 *             raise ValueError('either value or items must be specified')             # <<<<<<<<<<<<<<
 * 
 *         cdef bcf_hrec_t *hrec = <bcf_hrec_t*>calloc(1, sizeof(bcf_hrec_t))
*/
    __pyx_t_5 = NULL;
    __Pyx_INCREF(__pyx_builtin_ValueError);
    __pyx_t_6 = __pyx_builtin_ValueError; 
    __pyx_t_7 = 1;
    {
      PyObject *__pyx_callargs[2] = {__pyx_t_5, __pyx_mstate_global->__pyx_kp_u_either_value_or_items_must_be_sp};
      __pyx_t_4 = __Pyx_PyObject_FastCall(__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, 2145, __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, 2145, __pyx_L1_error)

    /* "pysam/libcbcf.pyx":2144
 *     def add_meta(self, key, value=None, items=None):
 *         """Add metadata to this header"""
 *         if not ((value is not None) ^ (items is not None)):             # <<<<<<<<<<<<<<
 *             raise ValueError('either value or items must be specified')
 * 
*/
  }

  /* "pysam/libcbcf.pyx":2147
 *             raise ValueError('either value or items must be specified')
 * 
 *         cdef bcf_hrec_t *hrec = <bcf_hrec_t*>calloc(1, sizeof(bcf_hrec_t))             # <<<<<<<<<<<<<<
 *         cdef int quoted
 * 
*/
  __pyx_v_hrec = ((bcf_hrec_t *)calloc(1, (sizeof(bcf_hrec_t))));

  /* "pysam/libcbcf.pyx":2150
 *         cdef int quoted
 * 
 *         try:             # <<<<<<<<<<<<<<
 *             key = force_bytes(key)
 *             hrec.key = strdup(key)
*/
  {
    __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:*/ {

      /* "pysam/libcbcf.pyx":2151
 * 
 *         try:
 *             key = force_bytes(key)             # <<<<<<<<<<<<<<
 *             hrec.key = strdup(key)
 * 
*/
      __pyx_t_4 = __pyx_f_5pysam_9libcutils_force_bytes(__pyx_v_key, NULL); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 2151, __pyx_L4_error)
      __Pyx_GOTREF(__pyx_t_4);
      __Pyx_DECREF_SET(__pyx_v_key, __pyx_t_4);
      __pyx_t_4 = 0;

      /* "pysam/libcbcf.pyx":2152
 *         try:
 *             key = force_bytes(key)
 *             hrec.key = strdup(key)             # <<<<<<<<<<<<<<
 * 
 *             if value is not None:
*/
      __pyx_t_11 = __Pyx_PyObject_AsString(__pyx_v_key); if (unlikely((!__pyx_t_11) && PyErr_Occurred())) __PYX_ERR(0, 2152, __pyx_L4_error)
      __pyx_v_hrec->key = strdup(__pyx_t_11);

      /* "pysam/libcbcf.pyx":2154
 *             hrec.key = strdup(key)
 * 
 *             if value is not None:             # <<<<<<<<<<<<<<
 *                 hrec.value = strdup(force_bytes(value))
 *             else:
*/
      __pyx_t_3 = (__pyx_v_value != Py_None);
      if (__pyx_t_3) {

        /* "pysam/libcbcf.pyx":2155
 * 
 *             if value is not None:
 *                 hrec.value = strdup(force_bytes(value))             # <<<<<<<<<<<<<<
 *             else:
 *                 for key, value in items:
*/
        __pyx_t_4 = __pyx_f_5pysam_9libcutils_force_bytes(__pyx_v_value, NULL); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 2155, __pyx_L4_error)
        __Pyx_GOTREF(__pyx_t_4);
        if (unlikely(__pyx_t_4 == Py_None)) {
          PyErr_SetString(PyExc_TypeError, "expected bytes, NoneType found");
          __PYX_ERR(0, 2155, __pyx_L4_error)
        }
        __pyx_t_11 = __Pyx_PyBytes_AsString(__pyx_t_4); if (unlikely((!__pyx_t_11) && PyErr_Occurred())) __PYX_ERR(0, 2155, __pyx_L4_error)
        __pyx_v_hrec->value = strdup(__pyx_t_11);
        __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;

        /* "pysam/libcbcf.pyx":2154
 *             hrec.key = strdup(key)
 * 
 *             if value is not None:             # <<<<<<<<<<<<<<
 *                 hrec.value = strdup(force_bytes(value))
 *             else:
*/
        goto __pyx_L10;
      }

      /* "pysam/libcbcf.pyx":2157
 *                 hrec.value = strdup(force_bytes(value))
 *             else:
 *                 for key, value in items:             # <<<<<<<<<<<<<<
 *                     quoted = not isinstance(value, unquoted_str) and key not in ("ID", "Number", "Type")
 * 
*/
      /*else*/ {
        if (likely(PyList_CheckExact(__pyx_v_items)) || PyTuple_CheckExact(__pyx_v_items)) {
          __pyx_t_4 = __pyx_v_items; __Pyx_INCREF(__pyx_t_4);
          __pyx_t_12 = 0;
          __pyx_t_13 = NULL;
        } else {
          __pyx_t_12 = -1; __pyx_t_4 = PyObject_GetIter(__pyx_v_items); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 2157, __pyx_L4_error)
          __Pyx_GOTREF(__pyx_t_4);
          __pyx_t_13 = (CYTHON_COMPILING_IN_LIMITED_API) ? PyIter_Next : __Pyx_PyObject_GetIterNextFunc(__pyx_t_4); if (unlikely(!__pyx_t_13)) __PYX_ERR(0, 2157, __pyx_L4_error)
        }
        for (;;) {
          if (likely(!__pyx_t_13)) {
            if (likely(PyList_CheckExact(__pyx_t_4))) {
              {
                Py_ssize_t __pyx_temp = __Pyx_PyList_GET_SIZE(__pyx_t_4);
                #if !CYTHON_ASSUME_SAFE_SIZE
                if (unlikely((__pyx_temp < 0))) __PYX_ERR(0, 2157, __pyx_L4_error)
                #endif
                if (__pyx_t_12 >= __pyx_temp) break;
              }
              __pyx_t_6 = __Pyx_PyList_GetItemRef(__pyx_t_4, __pyx_t_12);
              ++__pyx_t_12;
            } else {
              {
                Py_ssize_t __pyx_temp = __Pyx_PyTuple_GET_SIZE(__pyx_t_4);
                #if !CYTHON_ASSUME_SAFE_SIZE
                if (unlikely((__pyx_temp < 0))) __PYX_ERR(0, 2157, __pyx_L4_error)
                #endif
                if (__pyx_t_12 >= __pyx_temp) break;
              }
              #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
              __pyx_t_6 = __Pyx_NewRef(PyTuple_GET_ITEM(__pyx_t_4, __pyx_t_12));
              #else
              __pyx_t_6 = __Pyx_PySequence_ITEM(__pyx_t_4, __pyx_t_12);
              #endif
              ++__pyx_t_12;
            }
            if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 2157, __pyx_L4_error)
          } else {
            __pyx_t_6 = __pyx_t_13(__pyx_t_4);
            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, 2157, __pyx_L4_error)
                PyErr_Clear();
              }
              break;
            }
          }
          __Pyx_GOTREF(__pyx_t_6);
          if ((likely(PyTuple_CheckExact(__pyx_t_6))) || (PyList_CheckExact(__pyx_t_6))) {
            PyObject* sequence = __pyx_t_6;
            Py_ssize_t size = __Pyx_PySequence_SIZE(sequence);
            if (unlikely(size != 2)) {
              if (size > 2) __Pyx_RaiseTooManyValuesError(2);
              else if (size >= 0) __Pyx_RaiseNeedMoreValuesError(size);
              __PYX_ERR(0, 2157, __pyx_L4_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_14 = PyTuple_GET_ITEM(sequence, 1);
              __Pyx_INCREF(__pyx_t_14);
            } else {
              __pyx_t_5 = __Pyx_PyList_GetItemRef(sequence, 0);
              if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 2157, __pyx_L4_error)
              __Pyx_XGOTREF(__pyx_t_5);
              __pyx_t_14 = __Pyx_PyList_GetItemRef(sequence, 1);
              if (unlikely(!__pyx_t_14)) __PYX_ERR(0, 2157, __pyx_L4_error)
              __Pyx_XGOTREF(__pyx_t_14);
            }
            #else
            __pyx_t_5 = __Pyx_PySequence_ITEM(sequence, 0); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 2157, __pyx_L4_error)
            __Pyx_GOTREF(__pyx_t_5);
            __pyx_t_14 = __Pyx_PySequence_ITEM(sequence, 1); if (unlikely(!__pyx_t_14)) __PYX_ERR(0, 2157, __pyx_L4_error)
            __Pyx_GOTREF(__pyx_t_14);
            #endif
            __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
          } else {
            Py_ssize_t index = -1;
            __pyx_t_15 = PyObject_GetIter(__pyx_t_6); if (unlikely(!__pyx_t_15)) __PYX_ERR(0, 2157, __pyx_L4_error)
            __Pyx_GOTREF(__pyx_t_15);
            __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
            __pyx_t_16 = (CYTHON_COMPILING_IN_LIMITED_API) ? PyIter_Next : __Pyx_PyObject_GetIterNextFunc(__pyx_t_15);
            index = 0; __pyx_t_5 = __pyx_t_16(__pyx_t_15); if (unlikely(!__pyx_t_5)) goto __pyx_L13_unpacking_failed;
            __Pyx_GOTREF(__pyx_t_5);
            index = 1; __pyx_t_14 = __pyx_t_16(__pyx_t_15); if (unlikely(!__pyx_t_14)) goto __pyx_L13_unpacking_failed;
            __Pyx_GOTREF(__pyx_t_14);
            if (__Pyx_IternextUnpackEndCheck(__pyx_t_16(__pyx_t_15), 2) < 0) __PYX_ERR(0, 2157, __pyx_L4_error)
            __pyx_t_16 = NULL;
            __Pyx_DECREF(__pyx_t_15); __pyx_t_15 = 0;
            goto __pyx_L14_unpacking_done;
            __pyx_L13_unpacking_failed:;
            __Pyx_DECREF(__pyx_t_15); __pyx_t_15 = 0;
            __pyx_t_16 = NULL;
            if (__Pyx_IterFinish() == 0) __Pyx_RaiseNeedMoreValuesError(index);
            __PYX_ERR(0, 2157, __pyx_L4_error)
            __pyx_L14_unpacking_done:;
          }
          __Pyx_DECREF_SET(__pyx_v_key, __pyx_t_5);
          __pyx_t_5 = 0;
          __Pyx_DECREF_SET(__pyx_v_value, __pyx_t_14);
          __pyx_t_14 = 0;

          /* "pysam/libcbcf.pyx":2158
 *             else:
 *                 for key, value in items:
 *                     quoted = not isinstance(value, unquoted_str) and key not in ("ID", "Number", "Type")             # <<<<<<<<<<<<<<
 * 
 *                     key = force_bytes(key)
*/
          __Pyx_GetModuleGlobalName(__pyx_t_6, __pyx_mstate_global->__pyx_n_u_unquoted_str); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 2158, __pyx_L4_error)
          __Pyx_GOTREF(__pyx_t_6);
          __pyx_t_3 = PyObject_IsInstance(__pyx_v_value, __pyx_t_6); if (unlikely(__pyx_t_3 == ((int)-1))) __PYX_ERR(0, 2158, __pyx_L4_error)
          __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
          __pyx_t_2 = (!__pyx_t_3);
          if (__pyx_t_2) {
          } else {
            __pyx_t_17 = __pyx_t_2;
            goto __pyx_L15_bool_binop_done;
          }
          __Pyx_INCREF(__pyx_v_key);
          __pyx_t_6 = __pyx_v_key;
          __pyx_t_3 = (__Pyx_PyUnicode_Equals(__pyx_t_6, __pyx_mstate_global->__pyx_n_u_ID, Py_NE)); if (unlikely((__pyx_t_3 < 0))) __PYX_ERR(0, 2158, __pyx_L4_error)
          if (__pyx_t_3) {
          } else {
            __pyx_t_2 = __pyx_t_3;
            goto __pyx_L17_bool_binop_done;
          }
          __pyx_t_3 = (__Pyx_PyUnicode_Equals(__pyx_t_6, __pyx_mstate_global->__pyx_n_u_Number, Py_NE)); if (unlikely((__pyx_t_3 < 0))) __PYX_ERR(0, 2158, __pyx_L4_error)
          if (__pyx_t_3) {
          } else {
            __pyx_t_2 = __pyx_t_3;
            goto __pyx_L17_bool_binop_done;
          }
          __pyx_t_3 = (__Pyx_PyUnicode_Equals(__pyx_t_6, __pyx_mstate_global->__pyx_n_u_Type, Py_NE)); if (unlikely((__pyx_t_3 < 0))) __PYX_ERR(0, 2158, __pyx_L4_error)
          __pyx_t_2 = __pyx_t_3;
          __pyx_L17_bool_binop_done:;
          __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
          __pyx_t_3 = __pyx_t_2;
          __pyx_t_17 = __pyx_t_3;
          __pyx_L15_bool_binop_done:;
          __pyx_v_quoted = __pyx_t_17;

          /* "pysam/libcbcf.pyx":2160
 *                     quoted = not isinstance(value, unquoted_str) and key not in ("ID", "Number", "Type")
 * 
 *                     key = force_bytes(key)             # <<<<<<<<<<<<<<
 *                     if bcf_hrec_add_key(hrec, key, <int>len(key)) < 0:
 *                         raise MemoryError("Could not allocate VCF header record")
*/
          __pyx_t_6 = __pyx_f_5pysam_9libcutils_force_bytes(__pyx_v_key, NULL); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 2160, __pyx_L4_error)
          __Pyx_GOTREF(__pyx_t_6);
          __Pyx_DECREF_SET(__pyx_v_key, __pyx_t_6);
          __pyx_t_6 = 0;

          /* "pysam/libcbcf.pyx":2161
 * 
 *                     key = force_bytes(key)
 *                     if bcf_hrec_add_key(hrec, key, <int>len(key)) < 0:             # <<<<<<<<<<<<<<
 *                         raise MemoryError("Could not allocate VCF header record")
 * 
*/
          __pyx_t_18 = __Pyx_PyObject_AsString(__pyx_v_key); if (unlikely((!__pyx_t_18) && PyErr_Occurred())) __PYX_ERR(0, 2161, __pyx_L4_error)
          __pyx_t_19 = PyObject_Length(__pyx_v_key); if (unlikely(__pyx_t_19 == ((Py_ssize_t)-1))) __PYX_ERR(0, 2161, __pyx_L4_error)
          __pyx_t_3 = (bcf_hrec_add_key(__pyx_v_hrec, __pyx_t_18, ((int)__pyx_t_19)) < 0);
          if (unlikely(__pyx_t_3)) {

            /* "pysam/libcbcf.pyx":2162
 *                     key = force_bytes(key)
 *                     if bcf_hrec_add_key(hrec, key, <int>len(key)) < 0:
 *                         raise MemoryError("Could not allocate VCF header record")             # <<<<<<<<<<<<<<
 * 
 *                     value = force_bytes(str(value))
*/
            __pyx_t_14 = NULL;
            __Pyx_INCREF(__pyx_builtin_MemoryError);
            __pyx_t_5 = __pyx_builtin_MemoryError; 
            __pyx_t_7 = 1;
            {
              PyObject *__pyx_callargs[2] = {__pyx_t_14, __pyx_mstate_global->__pyx_kp_u_Could_not_allocate_VCF_header_re};
              __pyx_t_6 = __Pyx_PyObject_FastCall(__pyx_t_5, __pyx_callargs+__pyx_t_7, (2-__pyx_t_7) | (__pyx_t_7*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
              __Pyx_XDECREF(__pyx_t_14); __pyx_t_14 = 0;
              __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
              if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 2162, __pyx_L4_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, 2162, __pyx_L4_error)

            /* "pysam/libcbcf.pyx":2161
 * 
 *                     key = force_bytes(key)
 *                     if bcf_hrec_add_key(hrec, key, <int>len(key)) < 0:             # <<<<<<<<<<<<<<
 *                         raise MemoryError("Could not allocate VCF header record")
 * 
*/
          }

          /* "pysam/libcbcf.pyx":2164
 *                         raise MemoryError("Could not allocate VCF header record")
 * 
 *                     value = force_bytes(str(value))             # <<<<<<<<<<<<<<
 *                     if bcf_hrec_set_val(hrec, hrec.nkeys-1, value, <int>len(value), quoted) < 0:
 *                         raise MemoryError("Could not allocate VCF header record")
*/
          __pyx_t_6 = __Pyx_PyObject_Unicode(__pyx_v_value); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 2164, __pyx_L4_error)
          __Pyx_GOTREF(__pyx_t_6);
          __pyx_t_5 = __pyx_f_5pysam_9libcutils_force_bytes(__pyx_t_6, NULL); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 2164, __pyx_L4_error)
          __Pyx_GOTREF(__pyx_t_5);
          __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
          __Pyx_DECREF_SET(__pyx_v_value, __pyx_t_5);
          __pyx_t_5 = 0;

          /* "pysam/libcbcf.pyx":2165
 * 
 *                     value = force_bytes(str(value))
 *                     if bcf_hrec_set_val(hrec, hrec.nkeys-1, value, <int>len(value), quoted) < 0:             # <<<<<<<<<<<<<<
 *                         raise MemoryError("Could not allocate VCF header record")
 *         except:
*/
          __pyx_t_20 = __Pyx_PyObject_AsString(__pyx_v_value); if (unlikely((!__pyx_t_20) && PyErr_Occurred())) __PYX_ERR(0, 2165, __pyx_L4_error)
          __pyx_t_19 = PyObject_Length(__pyx_v_value); if (unlikely(__pyx_t_19 == ((Py_ssize_t)-1))) __PYX_ERR(0, 2165, __pyx_L4_error)
          __pyx_t_3 = (bcf_hrec_set_val(__pyx_v_hrec, (__pyx_v_hrec->nkeys - 1), __pyx_t_20, ((int)__pyx_t_19), __pyx_v_quoted) < 0);
          if (unlikely(__pyx_t_3)) {

            /* "pysam/libcbcf.pyx":2166
 *                     value = force_bytes(str(value))
 *                     if bcf_hrec_set_val(hrec, hrec.nkeys-1, value, <int>len(value), quoted) < 0:
 *                         raise MemoryError("Could not allocate VCF header record")             # <<<<<<<<<<<<<<
 *         except:
 *             bcf_hrec_destroy(hrec)
*/
            __pyx_t_6 = NULL;
            __Pyx_INCREF(__pyx_builtin_MemoryError);
            __pyx_t_14 = __pyx_builtin_MemoryError; 
            __pyx_t_7 = 1;
            {
              PyObject *__pyx_callargs[2] = {__pyx_t_6, __pyx_mstate_global->__pyx_kp_u_Could_not_allocate_VCF_header_re};
              __pyx_t_5 = __Pyx_PyObject_FastCall(__pyx_t_14, __pyx_callargs+__pyx_t_7, (2-__pyx_t_7) | (__pyx_t_7*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
              __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0;
              __Pyx_DECREF(__pyx_t_14); __pyx_t_14 = 0;
              if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 2166, __pyx_L4_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, 2166, __pyx_L4_error)

            /* "pysam/libcbcf.pyx":2165
 * 
 *                     value = force_bytes(str(value))
 *                     if bcf_hrec_set_val(hrec, hrec.nkeys-1, value, <int>len(value), quoted) < 0:             # <<<<<<<<<<<<<<
 *                         raise MemoryError("Could not allocate VCF header record")
 *         except:
*/
          }

          /* "pysam/libcbcf.pyx":2157
 *                 hrec.value = strdup(force_bytes(value))
 *             else:
 *                 for key, value in items:             # <<<<<<<<<<<<<<
 *                     quoted = not isinstance(value, unquoted_str) and key not in ("ID", "Number", "Type")
 * 
*/
        }
        __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
      }
      __pyx_L10:;

      /* "pysam/libcbcf.pyx":2150
 *         cdef int quoted
 * 
 *         try:             # <<<<<<<<<<<<<<
 *             key = force_bytes(key)
 *             hrec.key = strdup(key)
*/
    }
    __Pyx_XDECREF(__pyx_t_8); __pyx_t_8 = 0;
    __Pyx_XDECREF(__pyx_t_9); __pyx_t_9 = 0;
    __Pyx_XDECREF(__pyx_t_10); __pyx_t_10 = 0;
    goto __pyx_L9_try_end;
    __pyx_L4_error:;
    __Pyx_XDECREF(__pyx_t_14); __pyx_t_14 = 0;
    __Pyx_XDECREF(__pyx_t_15); __pyx_t_15 = 0;
    __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
    __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
    __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0;
    __Pyx_TraceException(__pyx_lineno, 0, 0);

    /* "pysam/libcbcf.pyx":2167
 *                     if bcf_hrec_set_val(hrec, hrec.nkeys-1, value, <int>len(value), quoted) < 0:
 *                         raise MemoryError("Could not allocate VCF header record")
 *         except:             # <<<<<<<<<<<<<<
 *             bcf_hrec_destroy(hrec)
 *             raise
*/
    /*except:*/ {
      __Pyx_AddTraceback("pysam.libcbcf.VariantHeader.add_meta", __pyx_clineno, __pyx_lineno, __pyx_filename);
      __Pyx_TraceExceptionHandled(0);
      if (__Pyx_GetException(&__pyx_t_4, &__pyx_t_5, &__pyx_t_14) < 0) __PYX_ERR(0, 2167, __pyx_L6_except_error)
      __Pyx_XGOTREF(__pyx_t_4);
      __Pyx_XGOTREF(__pyx_t_5);
      __Pyx_XGOTREF(__pyx_t_14);
      __Pyx_TraceExceptionDone();

      /* "pysam/libcbcf.pyx":2168
 *                         raise MemoryError("Could not allocate VCF header record")
 *         except:
 *             bcf_hrec_destroy(hrec)             # <<<<<<<<<<<<<<
 *             raise
 * 
*/
      bcf_hrec_destroy(__pyx_v_hrec);

      /* "pysam/libcbcf.pyx":2169
 *         except:
 *             bcf_hrec_destroy(hrec)
 *             raise             # <<<<<<<<<<<<<<
 * 
 *         bcf_hdr_add_hrec(self.ptr, hrec)
*/
      __Pyx_GIVEREF(__pyx_t_4);
      __Pyx_GIVEREF(__pyx_t_5);
      __Pyx_XGIVEREF(__pyx_t_14);
      __Pyx_ErrRestoreWithState(__pyx_t_4, __pyx_t_5, __pyx_t_14);
      __pyx_t_4 = 0;  __pyx_t_5 = 0;  __pyx_t_14 = 0; 
      __Pyx_TraceException(107, 1, 0);
      __PYX_ERR(0, 2169, __pyx_L6_except_error)
    }

    /* "pysam/libcbcf.pyx":2150
 *         cdef int quoted
 * 
 *         try:             # <<<<<<<<<<<<<<
 *             key = force_bytes(key)
 *             hrec.key = strdup(key)
*/
    __pyx_L6_except_error:;
    __Pyx_XGIVEREF(__pyx_t_8);
    __Pyx_XGIVEREF(__pyx_t_9);
    __Pyx_XGIVEREF(__pyx_t_10);
    __Pyx_ExceptionReset(__pyx_t_8, __pyx_t_9, __pyx_t_10);
    goto __pyx_L1_error;
    __pyx_L9_try_end:;
  }

  /* "pysam/libcbcf.pyx":2171
 *             raise
 * 
 *         bcf_hdr_add_hrec(self.ptr, hrec)             # <<<<<<<<<<<<<<
 * 
 *         self._hdr_sync()
*/
  (void)(bcf_hdr_add_hrec(__pyx_v_self->ptr, __pyx_v_hrec));

  /* "pysam/libcbcf.pyx":2173
 *         bcf_hdr_add_hrec(self.ptr, hrec)
 * 
 *         self._hdr_sync()             # <<<<<<<<<<<<<<
 * 
 *     cdef _add_sample(self, name):
*/
  __pyx_t_14 = ((struct __pyx_vtabstruct_5pysam_7libcbcf_VariantHeader *)__pyx_v_self->__pyx_vtab)->_hdr_sync(__pyx_v_self); if (unlikely(!__pyx_t_14)) __PYX_ERR(0, 2173, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_14);
  __Pyx_DECREF(__pyx_t_14); __pyx_t_14 = 0;

  /* "pysam/libcbcf.pyx":2142
 * 
 * 
 *     def add_meta(self, key, value=None, items=None):             # <<<<<<<<<<<<<<
 *         """Add metadata to this header"""
 *         if not ((value is not None) ^ (items is not None)):
*/

  /* function exit code */
  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  __Pyx_TraceReturnValue(__pyx_r, 0, 0, __PYX_ERR(0, 2142, __pyx_L1_error));
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_XDECREF(__pyx_t_5);
  __Pyx_XDECREF(__pyx_t_6);
  __Pyx_XDECREF(__pyx_t_14);
  __Pyx_XDECREF(__pyx_t_15);
  __Pyx_TraceException(__pyx_lineno, 0, 0);
  #if CYTHON_USE_SYS_MONITORING
  __Pyx_TraceExceptionUnwind(0, 0);
  #else
  __Pyx_TraceReturnValue(NULL, 0, 0, __PYX_ERR(0, 2142, __pyx_L1_error));
  #endif
  __Pyx_AddTraceback("pysam.libcbcf.VariantHeader.add_meta", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_key);
  __Pyx_XDECREF(__pyx_v_value);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_PyMonitoring_ExitScope(0);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "pysam/libcbcf.pyx":2175
 *         self._hdr_sync()
 * 
 *     cdef _add_sample(self, name):             # <<<<<<<<<<<<<<
 *         bname = force_bytes(name)
 *         if bcf_hdr_add_sample(self.ptr, bname) < 0:
*/

static PyObject *__pyx_f_5pysam_7libcbcf_13VariantHeader__add_sample(struct __pyx_obj_5pysam_7libcbcf_VariantHeader *__pyx_v_self, PyObject *__pyx_v_name) {
  PyObject *__pyx_v_bname = NULL;
  PyObject *__pyx_r = NULL;
  __Pyx_TraceDeclarationsFunc
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  char const *__pyx_t_2;
  int __pyx_t_3;
  PyObject *__pyx_t_4 = NULL;
  PyObject *__pyx_t_5 = NULL;
  PyObject *__pyx_t_6 = NULL;
  PyObject *__pyx_t_7 = NULL;
  size_t __pyx_t_8;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_TraceFrameInit(((PyObject *)__pyx_mstate_global->__pyx_codeobj_tab[159]))
  __Pyx_RefNannySetupContext("_add_sample", 0);
  __Pyx_TraceStartFunc("_add_sample", __pyx_f[0], 2175, 0, 0, 0, __PYX_ERR(0, 2175, __pyx_L1_error));

  /* "pysam/libcbcf.pyx":2176
 * 
 *     cdef _add_sample(self, name):
 *         bname = force_bytes(name)             # <<<<<<<<<<<<<<
 *         if bcf_hdr_add_sample(self.ptr, bname) < 0:
 *             raise ValueError('Duplicated sample name: {}'.format(name))
*/
  __pyx_t_1 = __pyx_f_5pysam_9libcutils_force_bytes(__pyx_v_name, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 2176, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_v_bname = ((PyObject*)__pyx_t_1);
  __pyx_t_1 = 0;

  /* "pysam/libcbcf.pyx":2177
 *     cdef _add_sample(self, name):
 *         bname = force_bytes(name)
 *         if bcf_hdr_add_sample(self.ptr, bname) < 0:             # <<<<<<<<<<<<<<
 *             raise ValueError('Duplicated sample name: {}'.format(name))
 * 
*/
  if (unlikely(__pyx_v_bname == Py_None)) {
    PyErr_SetString(PyExc_TypeError, "expected bytes, NoneType found");
    __PYX_ERR(0, 2177, __pyx_L1_error)
  }
  __pyx_t_2 = __Pyx_PyBytes_AsString(__pyx_v_bname); if (unlikely((!__pyx_t_2) && PyErr_Occurred())) __PYX_ERR(0, 2177, __pyx_L1_error)
  __pyx_t_3 = (bcf_hdr_add_sample(__pyx_v_self->ptr, __pyx_t_2) < 0);
  if (unlikely(__pyx_t_3)) {

    /* "pysam/libcbcf.pyx":2178
 *         bname = force_bytes(name)
 *         if bcf_hdr_add_sample(self.ptr, bname) < 0:
 *             raise ValueError('Duplicated sample name: {}'.format(name))             # <<<<<<<<<<<<<<
 * 
 *     cdef _hdr_sync(self):
*/
    __pyx_t_4 = NULL;
    __Pyx_INCREF(__pyx_builtin_ValueError);
    __pyx_t_5 = __pyx_builtin_ValueError; 
    __pyx_t_7 = __pyx_mstate_global->__pyx_kp_u_Duplicated_sample_name;
    __Pyx_INCREF(__pyx_t_7);
    __pyx_t_8 = 0;
    {
      PyObject *__pyx_callargs[2] = {__pyx_t_7, __pyx_v_name};
      __pyx_t_6 = __Pyx_PyObject_FastCallMethod(__pyx_mstate_global->__pyx_n_u_format, __pyx_callargs+__pyx_t_8, (2-__pyx_t_8) | (1*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
      __Pyx_XDECREF(__pyx_t_7); __pyx_t_7 = 0;
      if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 2178, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_6);
    }
    __pyx_t_8 = 1;
    {
      PyObject *__pyx_callargs[2] = {__pyx_t_4, __pyx_t_6};
      __pyx_t_1 = __Pyx_PyObject_FastCall(__pyx_t_5, __pyx_callargs+__pyx_t_8, (2-__pyx_t_8) | (__pyx_t_8*__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_5); __pyx_t_5 = 0;
      if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 2178, __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, 2178, __pyx_L1_error)

    /* "pysam/libcbcf.pyx":2177
 *     cdef _add_sample(self, name):
 *         bname = force_bytes(name)
 *         if bcf_hdr_add_sample(self.ptr, bname) < 0:             # <<<<<<<<<<<<<<
 *             raise ValueError('Duplicated sample name: {}'.format(name))
 * 
*/
  }

  /* "pysam/libcbcf.pyx":2175
 *         self._hdr_sync()
 * 
 *     cdef _add_sample(self, name):             # <<<<<<<<<<<<<<
 *         bname = force_bytes(name)
 *         if bcf_hdr_add_sample(self.ptr, bname) < 0:
*/

  /* function exit code */
  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  __Pyx_TraceReturnValue(__pyx_r, 0, 0, __PYX_ERR(0, 2175, __pyx_L1_error));
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_XDECREF(__pyx_t_5);
  __Pyx_XDECREF(__pyx_t_6);
  __Pyx_XDECREF(__pyx_t_7);
  __Pyx_TraceException(__pyx_lineno, 0, 0);
  #if CYTHON_USE_SYS_MONITORING
  __Pyx_TraceExceptionUnwind(0, 0);
  #else
  __Pyx_TraceReturnValue(NULL, 0, 0, __PYX_ERR(0, 2175, __pyx_L1_error));
  #endif
  __Pyx_AddTraceback("pysam.libcbcf.VariantHeader._add_sample", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_bname);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_PyMonitoring_ExitScope(0);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "pysam/libcbcf.pyx":2180
 *             raise ValueError('Duplicated sample name: {}'.format(name))
 * 
 *     cdef _hdr_sync(self):             # <<<<<<<<<<<<<<
 *         cdef bcf_hdr_t *hdr = self.ptr
 *         if hdr.dirty:
*/

static PyObject *__pyx_f_5pysam_7libcbcf_13VariantHeader__hdr_sync(struct __pyx_obj_5pysam_7libcbcf_VariantHeader *__pyx_v_self) {
  bcf_hdr_t *__pyx_v_hdr;
  PyObject *__pyx_r = NULL;
  __Pyx_TraceDeclarationsFunc
  __Pyx_RefNannyDeclarations
  bcf_hdr_t *__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_TraceFrameInit(((PyObject *)__pyx_mstate_global->__pyx_codeobj_tab[160]))
  __Pyx_RefNannySetupContext("_hdr_sync", 0);
  __Pyx_TraceStartFunc("_hdr_sync", __pyx_f[0], 2180, 0, 0, 0, __PYX_ERR(0, 2180, __pyx_L1_error));

  /* "pysam/libcbcf.pyx":2181
 * 
 *     cdef _hdr_sync(self):
 *         cdef bcf_hdr_t *hdr = self.ptr             # <<<<<<<<<<<<<<
 *         if hdr.dirty:
 *             if bcf_hdr_sync(hdr) < 0:
*/
  __pyx_t_1 = __pyx_v_self->ptr;
  __pyx_v_hdr = __pyx_t_1;

  /* "pysam/libcbcf.pyx":2182
 *     cdef _hdr_sync(self):
 *         cdef bcf_hdr_t *hdr = self.ptr
 *         if hdr.dirty:             # <<<<<<<<<<<<<<
 *             if bcf_hdr_sync(hdr) < 0:
 *                 raise MemoryError('unable to reallocate VariantHeader')
*/
  __pyx_t_2 = (__pyx_v_hdr->dirty != 0);
  if (__pyx_t_2) {

    /* "pysam/libcbcf.pyx":2183
 *         cdef bcf_hdr_t *hdr = self.ptr
 *         if hdr.dirty:
 *             if bcf_hdr_sync(hdr) < 0:             # <<<<<<<<<<<<<<
 *                 raise MemoryError('unable to reallocate VariantHeader')
 * 
*/
    __pyx_t_2 = (bcf_hdr_sync(__pyx_v_hdr) < 0);
    if (unlikely(__pyx_t_2)) {

      /* "pysam/libcbcf.pyx":2184
 *         if hdr.dirty:
 *             if bcf_hdr_sync(hdr) < 0:
 *                 raise MemoryError('unable to reallocate VariantHeader')             # <<<<<<<<<<<<<<
 * 
 *     def add_sample(self, name):
*/
      __pyx_t_4 = NULL;
      __Pyx_INCREF(__pyx_builtin_MemoryError);
      __pyx_t_5 = __pyx_builtin_MemoryError; 
      __pyx_t_6 = 1;
      {
        PyObject *__pyx_callargs[2] = {__pyx_t_4, __pyx_mstate_global->__pyx_kp_u_unable_to_reallocate_VariantHead};
        __pyx_t_3 = __Pyx_PyObject_FastCall(__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, 2184, __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, 2184, __pyx_L1_error)

      /* "pysam/libcbcf.pyx":2183
 *         cdef bcf_hdr_t *hdr = self.ptr
 *         if hdr.dirty:
 *             if bcf_hdr_sync(hdr) < 0:             # <<<<<<<<<<<<<<
 *                 raise MemoryError('unable to reallocate VariantHeader')
 * 
*/
    }

    /* "pysam/libcbcf.pyx":2182
 *     cdef _hdr_sync(self):
 *         cdef bcf_hdr_t *hdr = self.ptr
 *         if hdr.dirty:             # <<<<<<<<<<<<<<
 *             if bcf_hdr_sync(hdr) < 0:
 *                 raise MemoryError('unable to reallocate VariantHeader')
*/
  }

  /* "pysam/libcbcf.pyx":2180
 *             raise ValueError('Duplicated sample name: {}'.format(name))
 * 
 *     cdef _hdr_sync(self):             # <<<<<<<<<<<<<<
 *         cdef bcf_hdr_t *hdr = self.ptr
 *         if hdr.dirty:
*/

  /* function exit code */
  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  __Pyx_TraceReturnValue(__pyx_r, 0, 0, __PYX_ERR(0, 2180, __pyx_L1_error));
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_XDECREF(__pyx_t_5);
  __Pyx_TraceException(__pyx_lineno, 0, 0);
  #if CYTHON_USE_SYS_MONITORING
  __Pyx_TraceExceptionUnwind(0, 0);
  #else
  __Pyx_TraceReturnValue(NULL, 0, 0, __PYX_ERR(0, 2180, __pyx_L1_error));
  #endif
  __Pyx_AddTraceback("pysam.libcbcf.VariantHeader._hdr_sync", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_PyMonitoring_ExitScope(0);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "pysam/libcbcf.pyx":2186
 *                 raise MemoryError('unable to reallocate VariantHeader')
 * 
 *     def add_sample(self, name):             # <<<<<<<<<<<<<<
 *         """Add a new sample to this header"""
 *         self._add_sample(name)
*/

/* Python wrapper */
static PyObject *__pyx_pw_5pysam_7libcbcf_13VariantHeader_23add_sample(PyObject *__pyx_v_self, 
#if 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_5pysam_7libcbcf_13VariantHeader_22add_sample, "VariantHeader.add_sample(self, name)\n\nAdd a new sample to this header");
static PyMethodDef __pyx_mdef_5pysam_7libcbcf_13VariantHeader_23add_sample = {"add_sample", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_5pysam_7libcbcf_13VariantHeader_23add_sample, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_5pysam_7libcbcf_13VariantHeader_22add_sample};
static PyObject *__pyx_pw_5pysam_7libcbcf_13VariantHeader_23add_sample(PyObject *__pyx_v_self, 
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
) {
  PyObject *__pyx_v_name = 0;
  #if !CYTHON_METH_FASTCALL
  CYTHON_UNUSED Py_ssize_t __pyx_nargs;
  #endif
  CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
  PyObject* values[1] = {0};
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("add_sample (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_name,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, 2186, __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, 2186, __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, "add_sample", 0) < 0) __PYX_ERR(0, 2186, __pyx_L3_error)
      for (Py_ssize_t i = __pyx_nargs; i < 1; i++) {
        if (unlikely(!values[i])) { __Pyx_RaiseArgtupleInvalid("add_sample", 1, 1, 1, i); __PYX_ERR(0, 2186, __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, 2186, __pyx_L3_error)
    }
    __pyx_v_name = values[0];
  }
  goto __pyx_L6_skip;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("add_sample", 1, 1, 1, __pyx_nargs); __PYX_ERR(0, 2186, __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("pysam.libcbcf.VariantHeader.add_sample", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_5pysam_7libcbcf_13VariantHeader_22add_sample(((struct __pyx_obj_5pysam_7libcbcf_VariantHeader *)__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 PyObject *__pyx_pf_5pysam_7libcbcf_13VariantHeader_22add_sample(struct __pyx_obj_5pysam_7libcbcf_VariantHeader *__pyx_v_self, PyObject *__pyx_v_name) {
  PyObject *__pyx_r = NULL;
  __Pyx_TraceDeclarationsFunc
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_TraceFrameInit(((PyObject *)__pyx_mstate_global->__pyx_codeobj_tab[161]))
  __Pyx_RefNannySetupContext("add_sample", 0);
  __Pyx_TraceStartFunc("add_sample", __pyx_f[0], 2186, 0, 0, 0, __PYX_ERR(0, 2186, __pyx_L1_error));

  /* "pysam/libcbcf.pyx":2188
 *     def add_sample(self, name):
 *         """Add a new sample to this header"""
 *         self._add_sample(name)             # <<<<<<<<<<<<<<
 *         self._hdr_sync()
 * 
*/
  __pyx_t_1 = ((struct __pyx_vtabstruct_5pysam_7libcbcf_VariantHeader *)__pyx_v_self->__pyx_vtab)->_add_sample(__pyx_v_self, __pyx_v_name); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 2188, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "pysam/libcbcf.pyx":2189
 *         """Add a new sample to this header"""
 *         self._add_sample(name)
 *         self._hdr_sync()             # <<<<<<<<<<<<<<
 * 
 *     def add_samples(self, *args):
*/
  __pyx_t_1 = ((struct __pyx_vtabstruct_5pysam_7libcbcf_VariantHeader *)__pyx_v_self->__pyx_vtab)->_hdr_sync(__pyx_v_self); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 2189, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "pysam/libcbcf.pyx":2186
 *                 raise MemoryError('unable to reallocate VariantHeader')
 * 
 *     def add_sample(self, name):             # <<<<<<<<<<<<<<
 *         """Add a new sample to this header"""
 *         self._add_sample(name)
*/

  /* function exit code */
  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  __Pyx_TraceReturnValue(__pyx_r, 0, 0, __PYX_ERR(0, 2186, __pyx_L1_error));
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_TraceException(__pyx_lineno, 0, 0);
  #if CYTHON_USE_SYS_MONITORING
  __Pyx_TraceExceptionUnwind(0, 0);
  #else
  __Pyx_TraceReturnValue(NULL, 0, 0, __PYX_ERR(0, 2186, __pyx_L1_error));
  #endif
  __Pyx_AddTraceback("pysam.libcbcf.VariantHeader.add_sample", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_PyMonitoring_ExitScope(0);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "pysam/libcbcf.pyx":2191
 *         self._hdr_sync()
 * 
 *     def add_samples(self, *args):             # <<<<<<<<<<<<<<
 *         """Add several new samples to this header.
 *         This function takes multiple arguments, each of which may
*/

/* Python wrapper */
static PyObject *__pyx_pw_5pysam_7libcbcf_13VariantHeader_25add_samples(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
PyDoc_STRVAR(__pyx_doc_5pysam_7libcbcf_13VariantHeader_24add_samples, "VariantHeader.add_samples(self, *args)\n\nAdd several new samples to this header.\nThis function takes multiple arguments, each of which may\nbe either a sample name or an iterable returning sample names\n(e.g., a list of sample names).");
static PyMethodDef __pyx_mdef_5pysam_7libcbcf_13VariantHeader_25add_samples = {"add_samples", (PyCFunction)(void(*)(void))(PyCFunctionWithKeywords)__pyx_pw_5pysam_7libcbcf_13VariantHeader_25add_samples, METH_VARARGS|METH_KEYWORDS, __pyx_doc_5pysam_7libcbcf_13VariantHeader_24add_samples};
static PyObject *__pyx_pw_5pysam_7libcbcf_13VariantHeader_25add_samples(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_args = 0;
  CYTHON_UNUSED Py_ssize_t __pyx_nargs;
  CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("add_samples (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 NULL;
  #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 NULL;
  if (unlikely(__pyx_kwds_len > 0)) {__Pyx_RejectKeywords("add_samples", __pyx_kwds); return NULL;}
  __Pyx_INCREF(__pyx_args);
  __pyx_v_args = __pyx_args;
  __pyx_r = __pyx_pf_5pysam_7libcbcf_13VariantHeader_24add_samples(((struct __pyx_obj_5pysam_7libcbcf_VariantHeader *)__pyx_v_self), __pyx_v_args);

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

static PyObject *__pyx_pf_5pysam_7libcbcf_13VariantHeader_24add_samples(struct __pyx_obj_5pysam_7libcbcf_VariantHeader *__pyx_v_self, PyObject *__pyx_v_args) {
  PyObject *__pyx_v_arg = NULL;
  PyObject *__pyx_v_name = NULL;
  PyObject *__pyx_r = NULL;
  __Pyx_TraceDeclarationsFunc
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  Py_ssize_t __pyx_t_2;
  PyObject *__pyx_t_3 = NULL;
  int __pyx_t_4;
  Py_ssize_t __pyx_t_5;
  PyObject *(*__pyx_t_6)(PyObject *);
  PyObject *__pyx_t_7 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_TraceFrameInit(((PyObject *)__pyx_mstate_global->__pyx_codeobj_tab[162]))
  __Pyx_RefNannySetupContext("add_samples", 0);
  __Pyx_TraceStartFunc("add_samples", __pyx_f[0], 2191, 0, 0, 0, __PYX_ERR(0, 2191, __pyx_L1_error));

  /* "pysam/libcbcf.pyx":2197
 *         (e.g., a list of sample names).
 *         """
 *         for arg in args:             # <<<<<<<<<<<<<<
 *             if isinstance(arg, str):
 *                 self._add_sample(arg)
*/
  __pyx_t_1 = __pyx_v_args; __Pyx_INCREF(__pyx_t_1);
  __pyx_t_2 = 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, 2197, __pyx_L1_error)
      #endif
      if (__pyx_t_2 >= __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_2));
    #else
    __pyx_t_3 = __Pyx_PySequence_ITEM(__pyx_t_1, __pyx_t_2);
    #endif
    ++__pyx_t_2;
    if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 2197, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __Pyx_XDECREF_SET(__pyx_v_arg, __pyx_t_3);
    __pyx_t_3 = 0;

    /* "pysam/libcbcf.pyx":2198
 *         """
 *         for arg in args:
 *             if isinstance(arg, str):             # <<<<<<<<<<<<<<
 *                 self._add_sample(arg)
 *             else:
*/
    __pyx_t_4 = PyUnicode_Check(__pyx_v_arg); 
    if (__pyx_t_4) {

      /* "pysam/libcbcf.pyx":2199
 *         for arg in args:
 *             if isinstance(arg, str):
 *                 self._add_sample(arg)             # <<<<<<<<<<<<<<
 *             else:
 *                 for name in arg:
*/
      __pyx_t_3 = ((struct __pyx_vtabstruct_5pysam_7libcbcf_VariantHeader *)__pyx_v_self->__pyx_vtab)->_add_sample(__pyx_v_self, __pyx_v_arg); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 2199, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_3);
      __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;

      /* "pysam/libcbcf.pyx":2198
 *         """
 *         for arg in args:
 *             if isinstance(arg, str):             # <<<<<<<<<<<<<<
 *                 self._add_sample(arg)
 *             else:
*/
      goto __pyx_L5;
    }

    /* "pysam/libcbcf.pyx":2201
 *                 self._add_sample(arg)
 *             else:
 *                 for name in arg:             # <<<<<<<<<<<<<<
 *                     self._add_sample(name)
 *         self._hdr_sync()
*/
    /*else*/ {
      if (likely(PyList_CheckExact(__pyx_v_arg)) || PyTuple_CheckExact(__pyx_v_arg)) {
        __pyx_t_3 = __pyx_v_arg; __Pyx_INCREF(__pyx_t_3);
        __pyx_t_5 = 0;
        __pyx_t_6 = NULL;
      } else {
        __pyx_t_5 = -1; __pyx_t_3 = PyObject_GetIter(__pyx_v_arg); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 2201, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_3);
        __pyx_t_6 = (CYTHON_COMPILING_IN_LIMITED_API) ? PyIter_Next : __Pyx_PyObject_GetIterNextFunc(__pyx_t_3); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 2201, __pyx_L1_error)
      }
      for (;;) {
        if (likely(!__pyx_t_6)) {
          if (likely(PyList_CheckExact(__pyx_t_3))) {
            {
              Py_ssize_t __pyx_temp = __Pyx_PyList_GET_SIZE(__pyx_t_3);
              #if !CYTHON_ASSUME_SAFE_SIZE
              if (unlikely((__pyx_temp < 0))) __PYX_ERR(0, 2201, __pyx_L1_error)
              #endif
              if (__pyx_t_5 >= __pyx_temp) break;
            }
            __pyx_t_7 = __Pyx_PyList_GetItemRef(__pyx_t_3, __pyx_t_5);
            ++__pyx_t_5;
          } else {
            {
              Py_ssize_t __pyx_temp = __Pyx_PyTuple_GET_SIZE(__pyx_t_3);
              #if !CYTHON_ASSUME_SAFE_SIZE
              if (unlikely((__pyx_temp < 0))) __PYX_ERR(0, 2201, __pyx_L1_error)
              #endif
              if (__pyx_t_5 >= __pyx_temp) break;
            }
            #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
            __pyx_t_7 = __Pyx_NewRef(PyTuple_GET_ITEM(__pyx_t_3, __pyx_t_5));
            #else
            __pyx_t_7 = __Pyx_PySequence_ITEM(__pyx_t_3, __pyx_t_5);
            #endif
            ++__pyx_t_5;
          }
          if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 2201, __pyx_L1_error)
        } else {
          __pyx_t_7 = __pyx_t_6(__pyx_t_3);
          if (unlikely(!__pyx_t_7)) {
            PyObject* exc_type = PyErr_Occurred();
            if (exc_type) {
              if (unlikely(!__Pyx_PyErr_GivenExceptionMatches(exc_type, PyExc_StopIteration))) __PYX_ERR(0, 2201, __pyx_L1_error)
              PyErr_Clear();
            }
            break;
          }
        }
        __Pyx_GOTREF(__pyx_t_7);
        __Pyx_XDECREF_SET(__pyx_v_name, __pyx_t_7);
        __pyx_t_7 = 0;

        /* "pysam/libcbcf.pyx":2202
 *             else:
 *                 for name in arg:
 *                     self._add_sample(name)             # <<<<<<<<<<<<<<
 *         self._hdr_sync()
 * 
*/
        __pyx_t_7 = ((struct __pyx_vtabstruct_5pysam_7libcbcf_VariantHeader *)__pyx_v_self->__pyx_vtab)->_add_sample(__pyx_v_self, __pyx_v_name); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 2202, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_7);
        __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;

        /* "pysam/libcbcf.pyx":2201
 *                 self._add_sample(arg)
 *             else:
 *                 for name in arg:             # <<<<<<<<<<<<<<
 *                     self._add_sample(name)
 *         self._hdr_sync()
*/
      }
      __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    }
    __pyx_L5:;

    /* "pysam/libcbcf.pyx":2197
 *         (e.g., a list of sample names).
 *         """
 *         for arg in args:             # <<<<<<<<<<<<<<
 *             if isinstance(arg, str):
 *                 self._add_sample(arg)
*/
  }
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "pysam/libcbcf.pyx":2203
 *                 for name in arg:
 *                     self._add_sample(name)
 *         self._hdr_sync()             # <<<<<<<<<<<<<<
 * 
 * 
*/
  __pyx_t_1 = ((struct __pyx_vtabstruct_5pysam_7libcbcf_VariantHeader *)__pyx_v_self->__pyx_vtab)->_hdr_sync(__pyx_v_self); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 2203, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "pysam/libcbcf.pyx":2191
 *         self._hdr_sync()
 * 
 *     def add_samples(self, *args):             # <<<<<<<<<<<<<<
 *         """Add several new samples to this header.
 *         This function takes multiple arguments, each of which may
*/

  /* function exit code */
  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  __Pyx_TraceReturnValue(__pyx_r, 0, 0, __PYX_ERR(0, 2191, __pyx_L1_error));
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_7);
  __Pyx_TraceException(__pyx_lineno, 0, 0);
  #if CYTHON_USE_SYS_MONITORING
  __Pyx_TraceExceptionUnwind(0, 0);
  #else
  __Pyx_TraceReturnValue(NULL, 0, 0, __PYX_ERR(0, 2191, __pyx_L1_error));
  #endif
  __Pyx_AddTraceback("pysam.libcbcf.VariantHeader.add_samples", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_arg);
  __Pyx_XDECREF(__pyx_v_name);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_PyMonitoring_ExitScope(0);
  __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_5pysam_7libcbcf_13VariantHeader_27__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*/
PyDoc_STRVAR(__pyx_doc_5pysam_7libcbcf_13VariantHeader_26__reduce_cython__, "VariantHeader.__reduce_cython__(self)");
static PyMethodDef __pyx_mdef_5pysam_7libcbcf_13VariantHeader_27__reduce_cython__ = {"__reduce_cython__", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_5pysam_7libcbcf_13VariantHeader_27__reduce_cython__, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_5pysam_7libcbcf_13VariantHeader_26__reduce_cython__};
static PyObject *__pyx_pw_5pysam_7libcbcf_13VariantHeader_27__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_5pysam_7libcbcf_13VariantHeader_26__reduce_cython__(((struct __pyx_obj_5pysam_7libcbcf_VariantHeader *)__pyx_v_self));

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

static PyObject *__pyx_pf_5pysam_7libcbcf_13VariantHeader_26__reduce_cython__(CYTHON_UNUSED struct __pyx_obj_5pysam_7libcbcf_VariantHeader *__pyx_v_self) {
  PyObject *__pyx_r = NULL;
  __Pyx_TraceDeclarationsFunc
  __Pyx_RefNannyDeclarations
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_TraceFrameInit(((PyObject *)__pyx_mstate_global->__pyx_codeobj_tab[163]))
  __Pyx_RefNannySetupContext("__reduce_cython__", 0);
  __Pyx_TraceStartFunc("__reduce_cython__", __pyx_f[4], 1, 0, 0, 0, __PYX_ERR(4, 1, __pyx_L1_error));

  /* "(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(__pyx_builtin_TypeError, __pyx_mstate_global->__pyx_kp_u_no_default___reduce___due_to_non, 0, 0);
  __PYX_ERR(4, 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_TraceException(__pyx_lineno, 0, 0);
  #if CYTHON_USE_SYS_MONITORING
  __Pyx_TraceExceptionUnwind(0, 0);
  #else
  __Pyx_TraceReturnValue(NULL, 0, 0, __PYX_ERR(4, 1, __pyx_L1_error));
  #endif
  __Pyx_AddTraceback("pysam.libcbcf.VariantHeader.__reduce_cython__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_PyMonitoring_ExitScope(0);
  __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_5pysam_7libcbcf_13VariantHeader_29__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*/
PyDoc_STRVAR(__pyx_doc_5pysam_7libcbcf_13VariantHeader_28__setstate_cython__, "VariantHeader.__setstate_cython__(self, __pyx_state)");
static PyMethodDef __pyx_mdef_5pysam_7libcbcf_13VariantHeader_29__setstate_cython__ = {"__setstate_cython__", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_5pysam_7libcbcf_13VariantHeader_29__setstate_cython__, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_5pysam_7libcbcf_13VariantHeader_28__setstate_cython__};
static PyObject *__pyx_pw_5pysam_7libcbcf_13VariantHeader_29__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(4, 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(4, 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(4, 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(4, 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(4, 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(4, 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("pysam.libcbcf.VariantHeader.__setstate_cython__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_5pysam_7libcbcf_13VariantHeader_28__setstate_cython__(((struct __pyx_obj_5pysam_7libcbcf_VariantHeader *)__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_5pysam_7libcbcf_13VariantHeader_28__setstate_cython__(CYTHON_UNUSED struct __pyx_obj_5pysam_7libcbcf_VariantHeader *__pyx_v_self, CYTHON_UNUSED PyObject *__pyx_v___pyx_state) {
  PyObject *__pyx_r = NULL;
  __Pyx_TraceDeclarationsFunc
  __Pyx_RefNannyDeclarations
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_TraceFrameInit(((PyObject *)__pyx_mstate_global->__pyx_codeobj_tab[164]))
  __Pyx_RefNannySetupContext("__setstate_cython__", 0);
  __Pyx_TraceStartFunc("__setstate_cython__", __pyx_f[4], 3, 0, 0, 0, __PYX_ERR(4, 3, __pyx_L1_error));

  /* "(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(__pyx_builtin_TypeError, __pyx_mstate_global->__pyx_kp_u_no_default___reduce___due_to_non, 0, 0);
  __PYX_ERR(4, 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_TraceException(__pyx_lineno, 0, 0);
  #if CYTHON_USE_SYS_MONITORING
  __Pyx_TraceExceptionUnwind(0, 0);
  #else
  __Pyx_TraceReturnValue(NULL, 0, 0, __PYX_ERR(4, 3, __pyx_L1_error));
  #endif
  __Pyx_AddTraceback("pysam.libcbcf.VariantHeader.__setstate_cython__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_PyMonitoring_ExitScope(0);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "pysam/libcbcf.pyx":2206
 * 
 * 
 * cdef VariantHeader makeVariantHeader(bcf_hdr_t *hdr):             # <<<<<<<<<<<<<<
 *     if not hdr:
 *         raise ValueError('cannot create VariantHeader')
*/

static struct __pyx_obj_5pysam_7libcbcf_VariantHeader *__pyx_f_5pysam_7libcbcf_makeVariantHeader(bcf_hdr_t *__pyx_v_hdr) {
  struct __pyx_obj_5pysam_7libcbcf_VariantHeader *__pyx_v_header = 0;
  struct __pyx_obj_5pysam_7libcbcf_VariantHeader *__pyx_r = NULL;
  __Pyx_TraceDeclarationsFunc
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  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_TraceFrameInit(((PyObject *)__pyx_mstate_global->__pyx_codeobj_tab[165]))
  __Pyx_RefNannySetupContext("makeVariantHeader", 0);
  __Pyx_TraceStartFunc("makeVariantHeader", __pyx_f[0], 2206, 0, 0, 0, __PYX_ERR(0, 2206, __pyx_L1_error));

  /* "pysam/libcbcf.pyx":2207
 * 
 * cdef VariantHeader makeVariantHeader(bcf_hdr_t *hdr):
 *     if not hdr:             # <<<<<<<<<<<<<<
 *         raise ValueError('cannot create VariantHeader')
 * 
*/
  __pyx_t_1 = (!(__pyx_v_hdr != 0));
  if (unlikely(__pyx_t_1)) {

    /* "pysam/libcbcf.pyx":2208
 * cdef VariantHeader makeVariantHeader(bcf_hdr_t *hdr):
 *     if not hdr:
 *         raise ValueError('cannot create VariantHeader')             # <<<<<<<<<<<<<<
 * 
 *     cdef VariantHeader header = VariantHeader.__new__(VariantHeader)
*/
    __pyx_t_3 = NULL;
    __Pyx_INCREF(__pyx_builtin_ValueError);
    __pyx_t_4 = __pyx_builtin_ValueError; 
    __pyx_t_5 = 1;
    {
      PyObject *__pyx_callargs[2] = {__pyx_t_3, __pyx_mstate_global->__pyx_kp_u_cannot_create_VariantHeader};
      __pyx_t_2 = __Pyx_PyObject_FastCall(__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_2)) __PYX_ERR(0, 2208, __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, 2208, __pyx_L1_error)

    /* "pysam/libcbcf.pyx":2207
 * 
 * cdef VariantHeader makeVariantHeader(bcf_hdr_t *hdr):
 *     if not hdr:             # <<<<<<<<<<<<<<
 *         raise ValueError('cannot create VariantHeader')
 * 
*/
  }

  /* "pysam/libcbcf.pyx":2210
 *         raise ValueError('cannot create VariantHeader')
 * 
 *     cdef VariantHeader header = VariantHeader.__new__(VariantHeader)             # <<<<<<<<<<<<<<
 *     header.ptr = hdr
 * 
*/
  __pyx_t_2 = ((PyObject *)__pyx_tp_new_5pysam_7libcbcf_VariantHeader(((PyTypeObject *)__pyx_mstate_global->__pyx_ptype_5pysam_7libcbcf_VariantHeader), __pyx_mstate_global->__pyx_empty_tuple, NULL)); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 2210, __pyx_L1_error)
  __Pyx_GOTREF((PyObject *)__pyx_t_2);
  __pyx_v_header = ((struct __pyx_obj_5pysam_7libcbcf_VariantHeader *)__pyx_t_2);
  __pyx_t_2 = 0;

  /* "pysam/libcbcf.pyx":2211
 * 
 *     cdef VariantHeader header = VariantHeader.__new__(VariantHeader)
 *     header.ptr = hdr             # <<<<<<<<<<<<<<
 * 
 *     return header
*/
  __pyx_v_header->ptr = __pyx_v_hdr;

  /* "pysam/libcbcf.pyx":2213
 *     header.ptr = hdr
 * 
 *     return header             # <<<<<<<<<<<<<<
 * 
 * 
*/
  __Pyx_XDECREF((PyObject *)__pyx_r);
  __Pyx_INCREF((PyObject *)__pyx_v_header);
  __pyx_r = __pyx_v_header;
  __Pyx_TraceReturnValue((PyObject *)__pyx_r, 16, 0, __PYX_ERR(0, 2213, __pyx_L1_error));
  goto __pyx_L0;

  /* "pysam/libcbcf.pyx":2206
 * 
 * 
 * cdef VariantHeader makeVariantHeader(bcf_hdr_t *hdr):             # <<<<<<<<<<<<<<
 *     if not hdr:
 *         raise ValueError('cannot create VariantHeader')
*/

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_TraceException(__pyx_lineno, 0, 0);
  #if CYTHON_USE_SYS_MONITORING
  __Pyx_TraceExceptionUnwind(0, 0);
  #else
  __Pyx_TraceReturnValue(NULL, 0, 0, __PYX_ERR(0, 2206, __pyx_L1_error));
  #endif
  __Pyx_AddTraceback("pysam.libcbcf.makeVariantHeader", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_XDECREF((PyObject *)__pyx_v_header);
  __Pyx_XGIVEREF((PyObject *)__pyx_r);
  __Pyx_PyMonitoring_ExitScope(0);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "pysam/libcbcf.pyx":2216
 * 
 * 
 * cdef inline int bcf_header_get_info_id(bcf_hdr_t *hdr, key) except? -2:             # <<<<<<<<<<<<<<
 *     cdef vdict_t *d
 *     cdef khiter_t k
*/

static CYTHON_INLINE int __pyx_f_5pysam_7libcbcf_bcf_header_get_info_id(bcf_hdr_t *__pyx_v_hdr, PyObject *__pyx_v_key) {
  vdict_t *__pyx_v_d;
  khiter_t __pyx_v_k;
  int __pyx_r;
  __Pyx_TraceDeclarationsFunc
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  PyObject *__pyx_t_2 = NULL;
  char const *__pyx_t_3;
  int __pyx_t_4;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_TraceFrameInit(((PyObject *)__pyx_mstate_global->__pyx_codeobj_tab[166]))
  __Pyx_RefNannySetupContext("bcf_header_get_info_id", 0);
  __Pyx_TraceStartFunc("bcf_header_get_info_id", __pyx_f[0], 2216, 0, 0, 0, __PYX_ERR(0, 2216, __pyx_L1_error));
  __Pyx_INCREF(__pyx_v_key);

  /* "pysam/libcbcf.pyx":2221
 *     cdef int info_id
 * 
 *     if isinstance(key, str):             # <<<<<<<<<<<<<<
 *         key = force_bytes(key)
 * 
*/
  __pyx_t_1 = PyUnicode_Check(__pyx_v_key); 
  if (__pyx_t_1) {

    /* "pysam/libcbcf.pyx":2222
 * 
 *     if isinstance(key, str):
 *         key = force_bytes(key)             # <<<<<<<<<<<<<<
 * 
 *     d = <vdict_t *>hdr.dict[BCF_DT_ID]
*/
    __pyx_t_2 = __pyx_f_5pysam_9libcutils_force_bytes(__pyx_v_key, NULL); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 2222, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __Pyx_DECREF_SET(__pyx_v_key, __pyx_t_2);
    __pyx_t_2 = 0;

    /* "pysam/libcbcf.pyx":2221
 *     cdef int info_id
 * 
 *     if isinstance(key, str):             # <<<<<<<<<<<<<<
 *         key = force_bytes(key)
 * 
*/
  }

  /* "pysam/libcbcf.pyx":2224
 *         key = force_bytes(key)
 * 
 *     d = <vdict_t *>hdr.dict[BCF_DT_ID]             # <<<<<<<<<<<<<<
 *     k = kh_get_vdict(d, key)
 * 
*/
  __pyx_v_d = ((vdict_t *)(__pyx_v_hdr->dict[BCF_DT_ID]));

  /* "pysam/libcbcf.pyx":2225
 * 
 *     d = <vdict_t *>hdr.dict[BCF_DT_ID]
 *     k = kh_get_vdict(d, key)             # <<<<<<<<<<<<<<
 * 
 *     if k == kh_end(d) or kh_val_vdict(d, k).info[BCF_HL_INFO] & 0xF == 0xF:
*/
  __pyx_t_3 = __Pyx_PyObject_AsString(__pyx_v_key); if (unlikely((!__pyx_t_3) && PyErr_Occurred())) __PYX_ERR(0, 2225, __pyx_L1_error)
  __pyx_v_k = kh_get_vdict(__pyx_v_d, __pyx_t_3);

  /* "pysam/libcbcf.pyx":2227
 *     k = kh_get_vdict(d, key)
 * 
 *     if k == kh_end(d) or kh_val_vdict(d, k).info[BCF_HL_INFO] & 0xF == 0xF:             # <<<<<<<<<<<<<<
 *         return -1
 * 
*/
  __pyx_t_4 = (__pyx_v_k == kh_end(__pyx_v_d));
  if (!__pyx_t_4) {
  } else {
    __pyx_t_1 = __pyx_t_4;
    goto __pyx_L5_bool_binop_done;
  }
  __pyx_t_4 = (((kh_val(__pyx_v_d, __pyx_v_k).info[BCF_HL_INFO]) & 0xF) == 0xF);
  __pyx_t_1 = __pyx_t_4;
  __pyx_L5_bool_binop_done:;
  if (__pyx_t_1) {

    /* "pysam/libcbcf.pyx":2228
 * 
 *     if k == kh_end(d) or kh_val_vdict(d, k).info[BCF_HL_INFO] & 0xF == 0xF:
 *         return -1             # <<<<<<<<<<<<<<
 * 
 *     return kh_val_vdict(d, k).id
*/
    __pyx_r = -1;
    __Pyx_TraceReturnCValue(__pyx_r, __Pyx_PyLong_From_int, 40, 0, __PYX_ERR(0, 2228, __pyx_L1_error));
    goto __pyx_L0;

    /* "pysam/libcbcf.pyx":2227
 *     k = kh_get_vdict(d, key)
 * 
 *     if k == kh_end(d) or kh_val_vdict(d, k).info[BCF_HL_INFO] & 0xF == 0xF:             # <<<<<<<<<<<<<<
 *         return -1
 * 
*/
  }

  /* "pysam/libcbcf.pyx":2230
 *         return -1
 * 
 *     return kh_val_vdict(d, k).id             # <<<<<<<<<<<<<<
 * 
 * 
*/
  __pyx_r = kh_val(__pyx_v_d, __pyx_v_k).id;
  __Pyx_TraceReturnCValue(__pyx_r, __Pyx_PyLong_From_int, 42, 0, __PYX_ERR(0, 2230, __pyx_L1_error));
  goto __pyx_L0;

  /* "pysam/libcbcf.pyx":2216
 * 
 * 
 * cdef inline int bcf_header_get_info_id(bcf_hdr_t *hdr, key) except? -2:             # <<<<<<<<<<<<<<
 *     cdef vdict_t *d
 *     cdef khiter_t k
*/

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_TraceException(__pyx_lineno, 0, 0);
  #if CYTHON_USE_SYS_MONITORING
  __Pyx_TraceExceptionUnwind(0, 0);
  #else
  __Pyx_TraceReturnValue(NULL, 0, 0, __PYX_ERR(0, 2216, __pyx_L1_error));
  #endif
  __Pyx_AddTraceback("pysam.libcbcf.bcf_header_get_info_id", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = -2;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_key);
  __Pyx_PyMonitoring_ExitScope(0);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "pysam/libcbcf.pyx":2241
 *     """Filters set on a :class:`VariantRecord` object, presented as a mapping from
 *        filter index or name to :class:`VariantMetadata` object"""
 *     def __init__(self, *args, **kwargs):             # <<<<<<<<<<<<<<
 *         raise TypeError('this class cannot be instantiated from Python')
 * 
*/

/* Python wrapper */
static int __pyx_pw_5pysam_7libcbcf_19VariantRecordFilter_1__init__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static int __pyx_pw_5pysam_7libcbcf_19VariantRecordFilter_1__init__(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("__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);
  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("__init__", __pyx_kwds) == -1)) return -1;
  }
  __Pyx_INCREF(__pyx_args);
  __pyx_v_args = __pyx_args;
  __pyx_r = __pyx_pf_5pysam_7libcbcf_19VariantRecordFilter___init__(((struct __pyx_obj_5pysam_7libcbcf_VariantRecordFilter *)__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_5pysam_7libcbcf_19VariantRecordFilter___init__(CYTHON_UNUSED struct __pyx_obj_5pysam_7libcbcf_VariantRecordFilter *__pyx_v_self, CYTHON_UNUSED PyObject *__pyx_v_args, CYTHON_UNUSED PyObject *__pyx_v_kwargs) {
  int __pyx_r;
  __Pyx_TraceDeclarationsFunc
  __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_TraceFrameInit(((PyObject *)__pyx_mstate_global->__pyx_codeobj_tab[167]))
  __Pyx_RefNannySetupContext("__init__", 0);
  __Pyx_TraceStartFunc("__init__", __pyx_f[0], 2241, 0, 0, 0, __PYX_ERR(0, 2241, __pyx_L1_error));

  /* "pysam/libcbcf.pyx":2242
 *        filter index or name to :class:`VariantMetadata` object"""
 *     def __init__(self, *args, **kwargs):
 *         raise TypeError('this class cannot be instantiated from Python')             # <<<<<<<<<<<<<<
 * 
 *     def __len__(self):
*/
  __pyx_t_2 = NULL;
  __Pyx_INCREF(__pyx_builtin_TypeError);
  __pyx_t_3 = __pyx_builtin_TypeError; 
  __pyx_t_4 = 1;
  {
    PyObject *__pyx_callargs[2] = {__pyx_t_2, __pyx_mstate_global->__pyx_kp_u_this_class_cannot_be_instantiate};
    __pyx_t_1 = __Pyx_PyObject_FastCall(__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, 2242, __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, 2242, __pyx_L1_error)

  /* "pysam/libcbcf.pyx":2241
 *     """Filters set on a :class:`VariantRecord` object, presented as a mapping from
 *        filter index or name to :class:`VariantMetadata` object"""
 *     def __init__(self, *args, **kwargs):             # <<<<<<<<<<<<<<
 *         raise TypeError('this class cannot be instantiated from Python')
 * 
*/

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_TraceException(__pyx_lineno, 0, 0);
  #if CYTHON_USE_SYS_MONITORING
  __Pyx_TraceExceptionUnwind(0, 0);
  #else
  __Pyx_TraceReturnValue(NULL, 0, 0, __PYX_ERR(0, 2241, __pyx_L1_error));
  #endif
  __Pyx_AddTraceback("pysam.libcbcf.VariantRecordFilter.__init__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = -1;
  __Pyx_PyMonitoring_ExitScope(0);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "pysam/libcbcf.pyx":2244
 *         raise TypeError('this class cannot be instantiated from Python')
 * 
 *     def __len__(self):             # <<<<<<<<<<<<<<
 *         return self.record.ptr.d.n_flt
 * 
*/

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

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

static Py_ssize_t __pyx_pf_5pysam_7libcbcf_19VariantRecordFilter_2__len__(struct __pyx_obj_5pysam_7libcbcf_VariantRecordFilter *__pyx_v_self) {
  Py_ssize_t __pyx_r;
  __Pyx_TraceDeclarationsFunc
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_TraceFrameInit(((PyObject *)__pyx_mstate_global->__pyx_codeobj_tab[168]))
  __Pyx_TraceStartFunc("__len__", __pyx_f[0], 2244, 0, 0, 0, __PYX_ERR(0, 2244, __pyx_L1_error));

  /* "pysam/libcbcf.pyx":2245
 * 
 *     def __len__(self):
 *         return self.record.ptr.d.n_flt             # <<<<<<<<<<<<<<
 * 
 *     def __bool__(self):
*/
  __pyx_r = __pyx_v_self->record->ptr->d.n_flt;
  __Pyx_TraceReturnCValue(__pyx_r, PyLong_FromSsize_t, 1, 0, __PYX_ERR(0, 2245, __pyx_L1_error));
  goto __pyx_L0;

  /* "pysam/libcbcf.pyx":2244
 *         raise TypeError('this class cannot be instantiated from Python')
 * 
 *     def __len__(self):             # <<<<<<<<<<<<<<
 *         return self.record.ptr.d.n_flt
 * 
*/

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_TraceException(__pyx_lineno, 0, 0);
  #if CYTHON_USE_SYS_MONITORING
  __Pyx_TraceExceptionUnwind(0, 0);
  #else
  __Pyx_TraceReturnValue(NULL, 0, 0, __PYX_ERR(0, 2244, __pyx_L1_error));
  #endif
  __Pyx_AddTraceback("pysam.libcbcf.VariantRecordFilter.__len__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = -1;
  __pyx_L0:;
  __Pyx_PyMonitoring_ExitScope(0);
  return __pyx_r;
}

/* "pysam/libcbcf.pyx":2247
 *         return self.record.ptr.d.n_flt
 * 
 *     def __bool__(self):             # <<<<<<<<<<<<<<
 *         return self.record.ptr.d.n_flt != 0
 * 
*/

/* Python wrapper */
static int __pyx_pw_5pysam_7libcbcf_19VariantRecordFilter_5__bool__(PyObject *__pyx_v_self); /*proto*/
static int __pyx_pw_5pysam_7libcbcf_19VariantRecordFilter_5__bool__(PyObject *__pyx_v_self) {
  CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__bool__ (wrapper)", 0);
  __pyx_kwvalues = __Pyx_KwValues_VARARGS(__pyx_args, __pyx_nargs);
  __pyx_r = __pyx_pf_5pysam_7libcbcf_19VariantRecordFilter_4__bool__(((struct __pyx_obj_5pysam_7libcbcf_VariantRecordFilter *)__pyx_v_self));

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

static int __pyx_pf_5pysam_7libcbcf_19VariantRecordFilter_4__bool__(struct __pyx_obj_5pysam_7libcbcf_VariantRecordFilter *__pyx_v_self) {
  int __pyx_r;
  __Pyx_TraceDeclarationsFunc
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_TraceFrameInit(((PyObject *)__pyx_mstate_global->__pyx_codeobj_tab[169]))
  __Pyx_TraceStartFunc("__bool__", __pyx_f[0], 2247, 0, 0, 0, __PYX_ERR(0, 2247, __pyx_L1_error));

  /* "pysam/libcbcf.pyx":2248
 * 
 *     def __bool__(self):
 *         return self.record.ptr.d.n_flt != 0             # <<<<<<<<<<<<<<
 * 
 *     def __getitem__(self, key):
*/
  __pyx_r = (__pyx_v_self->record->ptr->d.n_flt != 0);
  __Pyx_TraceReturnCValue(__pyx_r, __Pyx_PyLong_From_int, 1, 0, __PYX_ERR(0, 2248, __pyx_L1_error));
  goto __pyx_L0;

  /* "pysam/libcbcf.pyx":2247
 *         return self.record.ptr.d.n_flt
 * 
 *     def __bool__(self):             # <<<<<<<<<<<<<<
 *         return self.record.ptr.d.n_flt != 0
 * 
*/

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_TraceException(__pyx_lineno, 0, 0);
  #if CYTHON_USE_SYS_MONITORING
  __Pyx_TraceExceptionUnwind(0, 0);
  #else
  __Pyx_TraceReturnValue(NULL, 0, 0, __PYX_ERR(0, 2247, __pyx_L1_error));
  #endif
  __Pyx_AddTraceback("pysam.libcbcf.VariantRecordFilter.__bool__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = -1;
  __pyx_L0:;
  __Pyx_PyMonitoring_ExitScope(0);
  return __pyx_r;
}

/* "pysam/libcbcf.pyx":2250
 *         return self.record.ptr.d.n_flt != 0
 * 
 *     def __getitem__(self, key):             # <<<<<<<<<<<<<<
 *         cdef bcf_hdr_t *hdr = self.record.header.ptr
 *         cdef bcf1_t *r = self.record.ptr
*/

/* Python wrapper */
static PyObject *__pyx_pw_5pysam_7libcbcf_19VariantRecordFilter_7__getitem__(PyObject *__pyx_v_self, PyObject *__pyx_v_key); /*proto*/
static PyObject *__pyx_pw_5pysam_7libcbcf_19VariantRecordFilter_7__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_5pysam_7libcbcf_19VariantRecordFilter_6__getitem__(((struct __pyx_obj_5pysam_7libcbcf_VariantRecordFilter *)__pyx_v_self), ((PyObject *)__pyx_v_key));

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

static PyObject *__pyx_pf_5pysam_7libcbcf_19VariantRecordFilter_6__getitem__(struct __pyx_obj_5pysam_7libcbcf_VariantRecordFilter *__pyx_v_self, PyObject *__pyx_v_key) {
  bcf_hdr_t *__pyx_v_hdr;
  bcf1_t *__pyx_v_r;
  int __pyx_v_index;
  int __pyx_v_id;
  int __pyx_v_n;
  PyObject *__pyx_v_bkey = NULL;
  PyObject *__pyx_r = NULL;
  __Pyx_TraceDeclarationsFunc
  __Pyx_RefNannyDeclarations
  bcf_hdr_t *__pyx_t_1;
  bcf1_t *__pyx_t_2;
  int __pyx_t_3;
  int __pyx_t_4;
  int __pyx_t_5;
  PyObject *__pyx_t_6 = NULL;
  PyObject *__pyx_t_7 = NULL;
  PyObject *__pyx_t_8 = NULL;
  size_t __pyx_t_9;
  char const *__pyx_t_10;
  int __pyx_t_11;
  char *__pyx_t_12;
  PyObject *__pyx_t_13 = NULL;
  PyObject *__pyx_t_14 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_TraceFrameInit(((PyObject *)__pyx_mstate_global->__pyx_codeobj_tab[170]))
  __Pyx_RefNannySetupContext("__getitem__", 0);
  __Pyx_TraceStartFunc("__getitem__", __pyx_f[0], 2250, 0, 0, 0, __PYX_ERR(0, 2250, __pyx_L1_error));
  __Pyx_INCREF(__pyx_v_key);

  /* "pysam/libcbcf.pyx":2251
 * 
 *     def __getitem__(self, key):
 *         cdef bcf_hdr_t *hdr = self.record.header.ptr             # <<<<<<<<<<<<<<
 *         cdef bcf1_t *r = self.record.ptr
 *         cdef int index, id
*/
  __pyx_t_1 = __pyx_v_self->record->header->ptr;
  __pyx_v_hdr = __pyx_t_1;

  /* "pysam/libcbcf.pyx":2252
 *     def __getitem__(self, key):
 *         cdef bcf_hdr_t *hdr = self.record.header.ptr
 *         cdef bcf1_t *r = self.record.ptr             # <<<<<<<<<<<<<<
 *         cdef int index, id
 *         cdef int n = r.d.n_flt
*/
  __pyx_t_2 = __pyx_v_self->record->ptr;
  __pyx_v_r = __pyx_t_2;

  /* "pysam/libcbcf.pyx":2254
 *         cdef bcf1_t *r = self.record.ptr
 *         cdef int index, id
 *         cdef int n = r.d.n_flt             # <<<<<<<<<<<<<<
 * 
 *         if isinstance(key, int):
*/
  __pyx_t_3 = __pyx_v_r->d.n_flt;
  __pyx_v_n = __pyx_t_3;

  /* "pysam/libcbcf.pyx":2256
 *         cdef int n = r.d.n_flt
 * 
 *         if isinstance(key, int):             # <<<<<<<<<<<<<<
 *             index = key
 * 
*/
  __pyx_t_4 = PyLong_Check(__pyx_v_key); 
  if (__pyx_t_4) {

    /* "pysam/libcbcf.pyx":2257
 * 
 *         if isinstance(key, int):
 *             index = key             # <<<<<<<<<<<<<<
 * 
 *             if index < 0 or index >= n:
*/
    __pyx_t_3 = __Pyx_PyLong_As_int(__pyx_v_key); if (unlikely((__pyx_t_3 == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 2257, __pyx_L1_error)
    __pyx_v_index = __pyx_t_3;

    /* "pysam/libcbcf.pyx":2259
 *             index = key
 * 
 *             if index < 0 or index >= n:             # <<<<<<<<<<<<<<
 *                 raise IndexError('invalid filter index')
 * 
*/
    __pyx_t_5 = (__pyx_v_index < 0);
    if (!__pyx_t_5) {
    } else {
      __pyx_t_4 = __pyx_t_5;
      goto __pyx_L5_bool_binop_done;
    }
    __pyx_t_5 = (__pyx_v_index >= __pyx_v_n);
    __pyx_t_4 = __pyx_t_5;
    __pyx_L5_bool_binop_done:;
    if (unlikely(__pyx_t_4)) {

      /* "pysam/libcbcf.pyx":2260
 * 
 *             if index < 0 or index >= n:
 *                 raise IndexError('invalid filter index')             # <<<<<<<<<<<<<<
 * 
 *             id = r.d.flt[index]
*/
      __pyx_t_7 = NULL;
      __Pyx_INCREF(__pyx_builtin_IndexError);
      __pyx_t_8 = __pyx_builtin_IndexError; 
      __pyx_t_9 = 1;
      {
        PyObject *__pyx_callargs[2] = {__pyx_t_7, __pyx_mstate_global->__pyx_kp_u_invalid_filter_index};
        __pyx_t_6 = __Pyx_PyObject_FastCall(__pyx_t_8, __pyx_callargs+__pyx_t_9, (2-__pyx_t_9) | (__pyx_t_9*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
        __Pyx_XDECREF(__pyx_t_7); __pyx_t_7 = 0;
        __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
        if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 2260, __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, 2260, __pyx_L1_error)

      /* "pysam/libcbcf.pyx":2259
 *             index = key
 * 
 *             if index < 0 or index >= n:             # <<<<<<<<<<<<<<
 *                 raise IndexError('invalid filter index')
 * 
*/
    }

    /* "pysam/libcbcf.pyx":2262
 *                 raise IndexError('invalid filter index')
 * 
 *             id = r.d.flt[index]             # <<<<<<<<<<<<<<
 *         else:
 *             if key == '.':
*/
    __pyx_v_id = (__pyx_v_r->d.flt[__pyx_v_index]);

    /* "pysam/libcbcf.pyx":2256
 *         cdef int n = r.d.n_flt
 * 
 *         if isinstance(key, int):             # <<<<<<<<<<<<<<
 *             index = key
 * 
*/
    goto __pyx_L3;
  }

  /* "pysam/libcbcf.pyx":2264
 *             id = r.d.flt[index]
 *         else:
 *             if key == '.':             # <<<<<<<<<<<<<<
 *                 key = 'PASS'
 * 
*/
  /*else*/ {
    __pyx_t_4 = (__Pyx_PyUnicode_Equals(__pyx_v_key, __pyx_mstate_global->__pyx_kp_u__4, Py_EQ)); if (unlikely((__pyx_t_4 < 0))) __PYX_ERR(0, 2264, __pyx_L1_error)
    if (__pyx_t_4) {

      /* "pysam/libcbcf.pyx":2265
 *         else:
 *             if key == '.':
 *                 key = 'PASS'             # <<<<<<<<<<<<<<
 * 
 *             bkey = force_bytes(key)
*/
      __Pyx_INCREF(__pyx_mstate_global->__pyx_n_u_PASS);
      __Pyx_DECREF_SET(__pyx_v_key, __pyx_mstate_global->__pyx_n_u_PASS);

      /* "pysam/libcbcf.pyx":2264
 *             id = r.d.flt[index]
 *         else:
 *             if key == '.':             # <<<<<<<<<<<<<<
 *                 key = 'PASS'
 * 
*/
    }

    /* "pysam/libcbcf.pyx":2267
 *                 key = 'PASS'
 * 
 *             bkey = force_bytes(key)             # <<<<<<<<<<<<<<
 *             id = bcf_hdr_id2int(hdr, BCF_DT_ID, bkey)
 * 
*/
    __pyx_t_6 = __pyx_f_5pysam_9libcutils_force_bytes(__pyx_v_key, NULL); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 2267, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_6);
    __pyx_v_bkey = ((PyObject*)__pyx_t_6);
    __pyx_t_6 = 0;

    /* "pysam/libcbcf.pyx":2268
 * 
 *             bkey = force_bytes(key)
 *             id = bcf_hdr_id2int(hdr, BCF_DT_ID, bkey)             # <<<<<<<<<<<<<<
 * 
 *             if not check_header_id(hdr, BCF_HL_FLT, id) or not bcf_has_filter(hdr, r, bkey):
*/
    if (unlikely(__pyx_v_bkey == Py_None)) {
      PyErr_SetString(PyExc_TypeError, "expected bytes, NoneType found");
      __PYX_ERR(0, 2268, __pyx_L1_error)
    }
    __pyx_t_10 = __Pyx_PyBytes_AsString(__pyx_v_bkey); if (unlikely((!__pyx_t_10) && PyErr_Occurred())) __PYX_ERR(0, 2268, __pyx_L1_error)
    __pyx_v_id = bcf_hdr_id2int(__pyx_v_hdr, BCF_DT_ID, __pyx_t_10);

    /* "pysam/libcbcf.pyx":2270
 *             id = bcf_hdr_id2int(hdr, BCF_DT_ID, bkey)
 * 
 *             if not check_header_id(hdr, BCF_HL_FLT, id) or not bcf_has_filter(hdr, r, bkey):             # <<<<<<<<<<<<<<
 *                 raise KeyError('Invalid filter: {}'.format(key))
 * 
*/
    __pyx_t_5 = __pyx_f_5pysam_7libcbcf_check_header_id(__pyx_v_hdr, BCF_HL_FLT, __pyx_v_id); if (unlikely(__pyx_t_5 == ((int)-1) && PyErr_Occurred())) __PYX_ERR(0, 2270, __pyx_L1_error)
    __pyx_t_11 = (!__pyx_t_5);
    if (!__pyx_t_11) {
    } else {
      __pyx_t_4 = __pyx_t_11;
      goto __pyx_L9_bool_binop_done;
    }
    if (unlikely(__pyx_v_bkey == Py_None)) {
      PyErr_SetString(PyExc_TypeError, "expected bytes, NoneType found");
      __PYX_ERR(0, 2270, __pyx_L1_error)
    }
    __pyx_t_12 = __Pyx_PyBytes_AsWritableString(__pyx_v_bkey); if (unlikely((!__pyx_t_12) && PyErr_Occurred())) __PYX_ERR(0, 2270, __pyx_L1_error)
    __pyx_t_11 = (!(bcf_has_filter(__pyx_v_hdr, __pyx_v_r, __pyx_t_12) != 0));
    __pyx_t_4 = __pyx_t_11;
    __pyx_L9_bool_binop_done:;
    if (unlikely(__pyx_t_4)) {

      /* "pysam/libcbcf.pyx":2271
 * 
 *             if not check_header_id(hdr, BCF_HL_FLT, id) or not bcf_has_filter(hdr, r, bkey):
 *                 raise KeyError('Invalid filter: {}'.format(key))             # <<<<<<<<<<<<<<
 * 
 *         return makeVariantMetadata(self.record.header, BCF_HL_FLT, id)
*/
      __pyx_t_8 = NULL;
      __Pyx_INCREF(__pyx_builtin_KeyError);
      __pyx_t_7 = __pyx_builtin_KeyError; 
      __pyx_t_14 = __pyx_mstate_global->__pyx_kp_u_Invalid_filter;
      __Pyx_INCREF(__pyx_t_14);
      __pyx_t_9 = 0;
      {
        PyObject *__pyx_callargs[2] = {__pyx_t_14, __pyx_v_key};
        __pyx_t_13 = __Pyx_PyObject_FastCallMethod(__pyx_mstate_global->__pyx_n_u_format, __pyx_callargs+__pyx_t_9, (2-__pyx_t_9) | (1*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
        __Pyx_XDECREF(__pyx_t_14); __pyx_t_14 = 0;
        if (unlikely(!__pyx_t_13)) __PYX_ERR(0, 2271, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_13);
      }
      __pyx_t_9 = 1;
      {
        PyObject *__pyx_callargs[2] = {__pyx_t_8, __pyx_t_13};
        __pyx_t_6 = __Pyx_PyObject_FastCall(__pyx_t_7, __pyx_callargs+__pyx_t_9, (2-__pyx_t_9) | (__pyx_t_9*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
        __Pyx_XDECREF(__pyx_t_8); __pyx_t_8 = 0;
        __Pyx_DECREF(__pyx_t_13); __pyx_t_13 = 0;
        __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
        if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 2271, __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, 2271, __pyx_L1_error)

      /* "pysam/libcbcf.pyx":2270
 *             id = bcf_hdr_id2int(hdr, BCF_DT_ID, bkey)
 * 
 *             if not check_header_id(hdr, BCF_HL_FLT, id) or not bcf_has_filter(hdr, r, bkey):             # <<<<<<<<<<<<<<
 *                 raise KeyError('Invalid filter: {}'.format(key))
 * 
*/
    }
  }
  __pyx_L3:;

  /* "pysam/libcbcf.pyx":2273
 *                 raise KeyError('Invalid filter: {}'.format(key))
 * 
 *         return makeVariantMetadata(self.record.header, BCF_HL_FLT, id)             # <<<<<<<<<<<<<<
 * 
 *     def add(self, key):
*/
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_6 = ((PyObject *)__pyx_v_self->record->header);
  __Pyx_INCREF(__pyx_t_6);
  __pyx_t_7 = ((PyObject *)__pyx_f_5pysam_7libcbcf_makeVariantMetadata(((struct __pyx_obj_5pysam_7libcbcf_VariantHeader *)__pyx_t_6), BCF_HL_FLT, __pyx_v_id)); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 2273, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_7);
  __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
  __pyx_r = __pyx_t_7;
  __pyx_t_7 = 0;
  __Pyx_TraceReturnValue(__pyx_r, 76, 0, __PYX_ERR(0, 2273, __pyx_L1_error));
  goto __pyx_L0;

  /* "pysam/libcbcf.pyx":2250
 *         return self.record.ptr.d.n_flt != 0
 * 
 *     def __getitem__(self, key):             # <<<<<<<<<<<<<<
 *         cdef bcf_hdr_t *hdr = self.record.header.ptr
 *         cdef bcf1_t *r = self.record.ptr
*/

  /* 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_13);
  __Pyx_XDECREF(__pyx_t_14);
  __Pyx_TraceException(__pyx_lineno, 0, 0);
  #if CYTHON_USE_SYS_MONITORING
  __Pyx_TraceExceptionUnwind(0, 0);
  #else
  __Pyx_TraceReturnValue(NULL, 0, 0, __PYX_ERR(0, 2250, __pyx_L1_error));
  #endif
  __Pyx_AddTraceback("pysam.libcbcf.VariantRecordFilter.__getitem__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_bkey);
  __Pyx_XDECREF(__pyx_v_key);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_PyMonitoring_ExitScope(0);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "pysam/libcbcf.pyx":2275
 *         return makeVariantMetadata(self.record.header, BCF_HL_FLT, id)
 * 
 *     def add(self, key):             # <<<<<<<<<<<<<<
 *         """Add a new filter"""
 *         cdef bcf_hdr_t *hdr = self.record.header.ptr
*/

/* Python wrapper */
static PyObject *__pyx_pw_5pysam_7libcbcf_19VariantRecordFilter_9add(PyObject *__pyx_v_self, 
#if 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_5pysam_7libcbcf_19VariantRecordFilter_8add, "VariantRecordFilter.add(self, key)\n\nAdd a new filter");
static PyMethodDef __pyx_mdef_5pysam_7libcbcf_19VariantRecordFilter_9add = {"add", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_5pysam_7libcbcf_19VariantRecordFilter_9add, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_5pysam_7libcbcf_19VariantRecordFilter_8add};
static PyObject *__pyx_pw_5pysam_7libcbcf_19VariantRecordFilter_9add(PyObject *__pyx_v_self, 
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
) {
  PyObject *__pyx_v_key = 0;
  #if !CYTHON_METH_FASTCALL
  CYTHON_UNUSED Py_ssize_t __pyx_nargs;
  #endif
  CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
  PyObject* values[1] = {0};
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("add (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,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, 2275, __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, 2275, __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, "add", 0) < 0) __PYX_ERR(0, 2275, __pyx_L3_error)
      for (Py_ssize_t i = __pyx_nargs; i < 1; i++) {
        if (unlikely(!values[i])) { __Pyx_RaiseArgtupleInvalid("add", 1, 1, 1, i); __PYX_ERR(0, 2275, __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, 2275, __pyx_L3_error)
    }
    __pyx_v_key = values[0];
  }
  goto __pyx_L6_skip;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("add", 1, 1, 1, __pyx_nargs); __PYX_ERR(0, 2275, __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("pysam.libcbcf.VariantRecordFilter.add", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_5pysam_7libcbcf_19VariantRecordFilter_8add(((struct __pyx_obj_5pysam_7libcbcf_VariantRecordFilter *)__pyx_v_self), __pyx_v_key);

  /* 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_5pysam_7libcbcf_19VariantRecordFilter_8add(struct __pyx_obj_5pysam_7libcbcf_VariantRecordFilter *__pyx_v_self, PyObject *__pyx_v_key) {
  bcf_hdr_t *__pyx_v_hdr;
  bcf1_t *__pyx_v_r;
  int __pyx_v_id;
  PyObject *__pyx_v_bkey = 0;
  PyObject *__pyx_r = NULL;
  __Pyx_TraceDeclarationsFunc
  __Pyx_RefNannyDeclarations
  bcf_hdr_t *__pyx_t_1;
  bcf1_t *__pyx_t_2;
  int __pyx_t_3;
  PyObject *__pyx_t_4 = NULL;
  char const *__pyx_t_5;
  int __pyx_t_6;
  PyObject *__pyx_t_7 = NULL;
  PyObject *__pyx_t_8 = NULL;
  PyObject *__pyx_t_9 = NULL;
  PyObject *__pyx_t_10 = NULL;
  size_t __pyx_t_11;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_TraceFrameInit(((PyObject *)__pyx_mstate_global->__pyx_codeobj_tab[171]))
  __Pyx_RefNannySetupContext("add", 0);
  __Pyx_TraceStartFunc("add", __pyx_f[0], 2275, 0, 0, 0, __PYX_ERR(0, 2275, __pyx_L1_error));
  __Pyx_INCREF(__pyx_v_key);

  /* "pysam/libcbcf.pyx":2277
 *     def add(self, key):
 *         """Add a new filter"""
 *         cdef bcf_hdr_t *hdr = self.record.header.ptr             # <<<<<<<<<<<<<<
 *         cdef bcf1_t *r = self.record.ptr
 *         cdef int id
*/
  __pyx_t_1 = __pyx_v_self->record->header->ptr;
  __pyx_v_hdr = __pyx_t_1;

  /* "pysam/libcbcf.pyx":2278
 *         """Add a new filter"""
 *         cdef bcf_hdr_t *hdr = self.record.header.ptr
 *         cdef bcf1_t *r = self.record.ptr             # <<<<<<<<<<<<<<
 *         cdef int id
 * 
*/
  __pyx_t_2 = __pyx_v_self->record->ptr;
  __pyx_v_r = __pyx_t_2;

  /* "pysam/libcbcf.pyx":2281
 *         cdef int id
 * 
 *         if key == '.':             # <<<<<<<<<<<<<<
 *             key = 'PASS'
 * 
*/
  __pyx_t_3 = (__Pyx_PyUnicode_Equals(__pyx_v_key, __pyx_mstate_global->__pyx_kp_u__4, Py_EQ)); if (unlikely((__pyx_t_3 < 0))) __PYX_ERR(0, 2281, __pyx_L1_error)
  if (__pyx_t_3) {

    /* "pysam/libcbcf.pyx":2282
 * 
 *         if key == '.':
 *             key = 'PASS'             # <<<<<<<<<<<<<<
 * 
 *         cdef bytes bkey = force_bytes(key)
*/
    __Pyx_INCREF(__pyx_mstate_global->__pyx_n_u_PASS);
    __Pyx_DECREF_SET(__pyx_v_key, __pyx_mstate_global->__pyx_n_u_PASS);

    /* "pysam/libcbcf.pyx":2281
 *         cdef int id
 * 
 *         if key == '.':             # <<<<<<<<<<<<<<
 *             key = 'PASS'
 * 
*/
  }

  /* "pysam/libcbcf.pyx":2284
 *             key = 'PASS'
 * 
 *         cdef bytes bkey = force_bytes(key)             # <<<<<<<<<<<<<<
 *         id = bcf_hdr_id2int(hdr, BCF_DT_ID, bkey)
 * 
*/
  __pyx_t_4 = __pyx_f_5pysam_9libcutils_force_bytes(__pyx_v_key, NULL); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 2284, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  __pyx_v_bkey = ((PyObject*)__pyx_t_4);
  __pyx_t_4 = 0;

  /* "pysam/libcbcf.pyx":2285
 * 
 *         cdef bytes bkey = force_bytes(key)
 *         id = bcf_hdr_id2int(hdr, BCF_DT_ID, bkey)             # <<<<<<<<<<<<<<
 * 
 *         if not check_header_id(hdr, BCF_HL_FLT, id):
*/
  if (unlikely(__pyx_v_bkey == Py_None)) {
    PyErr_SetString(PyExc_TypeError, "expected bytes, NoneType found");
    __PYX_ERR(0, 2285, __pyx_L1_error)
  }
  __pyx_t_5 = __Pyx_PyBytes_AsString(__pyx_v_bkey); if (unlikely((!__pyx_t_5) && PyErr_Occurred())) __PYX_ERR(0, 2285, __pyx_L1_error)
  __pyx_v_id = bcf_hdr_id2int(__pyx_v_hdr, BCF_DT_ID, __pyx_t_5);

  /* "pysam/libcbcf.pyx":2287
 *         id = bcf_hdr_id2int(hdr, BCF_DT_ID, bkey)
 * 
 *         if not check_header_id(hdr, BCF_HL_FLT, id):             # <<<<<<<<<<<<<<
 *             raise KeyError('Invalid filter: {}'.format(key))
 * 
*/
  __pyx_t_3 = __pyx_f_5pysam_7libcbcf_check_header_id(__pyx_v_hdr, BCF_HL_FLT, __pyx_v_id); if (unlikely(__pyx_t_3 == ((int)-1) && PyErr_Occurred())) __PYX_ERR(0, 2287, __pyx_L1_error)
  __pyx_t_6 = (!__pyx_t_3);
  if (unlikely(__pyx_t_6)) {

    /* "pysam/libcbcf.pyx":2288
 * 
 *         if not check_header_id(hdr, BCF_HL_FLT, id):
 *             raise KeyError('Invalid filter: {}'.format(key))             # <<<<<<<<<<<<<<
 * 
 *         bcf_add_filter(hdr, r, id)
*/
    __pyx_t_7 = NULL;
    __Pyx_INCREF(__pyx_builtin_KeyError);
    __pyx_t_8 = __pyx_builtin_KeyError; 
    __pyx_t_10 = __pyx_mstate_global->__pyx_kp_u_Invalid_filter;
    __Pyx_INCREF(__pyx_t_10);
    __pyx_t_11 = 0;
    {
      PyObject *__pyx_callargs[2] = {__pyx_t_10, __pyx_v_key};
      __pyx_t_9 = __Pyx_PyObject_FastCallMethod(__pyx_mstate_global->__pyx_n_u_format, __pyx_callargs+__pyx_t_11, (2-__pyx_t_11) | (1*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
      __Pyx_XDECREF(__pyx_t_10); __pyx_t_10 = 0;
      if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 2288, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_9);
    }
    __pyx_t_11 = 1;
    {
      PyObject *__pyx_callargs[2] = {__pyx_t_7, __pyx_t_9};
      __pyx_t_4 = __Pyx_PyObject_FastCall(__pyx_t_8, __pyx_callargs+__pyx_t_11, (2-__pyx_t_11) | (__pyx_t_11*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
      __Pyx_XDECREF(__pyx_t_7); __pyx_t_7 = 0;
      __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
      __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
      if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 2288, __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, 2288, __pyx_L1_error)

    /* "pysam/libcbcf.pyx":2287
 *         id = bcf_hdr_id2int(hdr, BCF_DT_ID, bkey)
 * 
 *         if not check_header_id(hdr, BCF_HL_FLT, id):             # <<<<<<<<<<<<<<
 *             raise KeyError('Invalid filter: {}'.format(key))
 * 
*/
  }

  /* "pysam/libcbcf.pyx":2290
 *             raise KeyError('Invalid filter: {}'.format(key))
 * 
 *         bcf_add_filter(hdr, r, id)             # <<<<<<<<<<<<<<
 * 
 *     def __delitem__(self, key):
*/
  (void)(bcf_add_filter(__pyx_v_hdr, __pyx_v_r, __pyx_v_id));

  /* "pysam/libcbcf.pyx":2275
 *         return makeVariantMetadata(self.record.header, BCF_HL_FLT, id)
 * 
 *     def add(self, key):             # <<<<<<<<<<<<<<
 *         """Add a new filter"""
 *         cdef bcf_hdr_t *hdr = self.record.header.ptr
*/

  /* function exit code */
  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  __Pyx_TraceReturnValue(__pyx_r, 0, 0, __PYX_ERR(0, 2275, __pyx_L1_error));
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_XDECREF(__pyx_t_7);
  __Pyx_XDECREF(__pyx_t_8);
  __Pyx_XDECREF(__pyx_t_9);
  __Pyx_XDECREF(__pyx_t_10);
  __Pyx_TraceException(__pyx_lineno, 0, 0);
  #if CYTHON_USE_SYS_MONITORING
  __Pyx_TraceExceptionUnwind(0, 0);
  #else
  __Pyx_TraceReturnValue(NULL, 0, 0, __PYX_ERR(0, 2275, __pyx_L1_error));
  #endif
  __Pyx_AddTraceback("pysam.libcbcf.VariantRecordFilter.add", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_bkey);
  __Pyx_XDECREF(__pyx_v_key);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_PyMonitoring_ExitScope(0);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "pysam/libcbcf.pyx":2292
 *         bcf_add_filter(hdr, r, id)
 * 
 *     def __delitem__(self, key):             # <<<<<<<<<<<<<<
 *         cdef bcf_hdr_t *hdr = self.record.header.ptr
 *         cdef bcf1_t *r = self.record.ptr
*/

/* Python wrapper */
static int __pyx_pw_5pysam_7libcbcf_19VariantRecordFilter_11__delitem__(PyObject *__pyx_v_self, PyObject *__pyx_v_key); /*proto*/
static int __pyx_pw_5pysam_7libcbcf_19VariantRecordFilter_11__delitem__(PyObject *__pyx_v_self, PyObject *__pyx_v_key) {
  CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__delitem__ (wrapper)", 0);
  __pyx_kwvalues = __Pyx_KwValues_VARARGS(__pyx_args, __pyx_nargs);
  __pyx_r = __pyx_pf_5pysam_7libcbcf_19VariantRecordFilter_10__delitem__(((struct __pyx_obj_5pysam_7libcbcf_VariantRecordFilter *)__pyx_v_self), ((PyObject *)__pyx_v_key));

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

static int __pyx_pf_5pysam_7libcbcf_19VariantRecordFilter_10__delitem__(struct __pyx_obj_5pysam_7libcbcf_VariantRecordFilter *__pyx_v_self, PyObject *__pyx_v_key) {
  bcf_hdr_t *__pyx_v_hdr;
  bcf1_t *__pyx_v_r;
  int __pyx_v_index;
  int __pyx_v_id;
  int __pyx_v_n;
  PyObject *__pyx_v_bkey = NULL;
  int __pyx_r;
  __Pyx_TraceDeclarationsFunc
  __Pyx_RefNannyDeclarations
  bcf_hdr_t *__pyx_t_1;
  bcf1_t *__pyx_t_2;
  int __pyx_t_3;
  int __pyx_t_4;
  int __pyx_t_5;
  PyObject *__pyx_t_6 = NULL;
  PyObject *__pyx_t_7 = NULL;
  PyObject *__pyx_t_8 = NULL;
  size_t __pyx_t_9;
  char const *__pyx_t_10;
  int __pyx_t_11;
  char *__pyx_t_12;
  PyObject *__pyx_t_13 = NULL;
  PyObject *__pyx_t_14 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_TraceFrameInit(((PyObject *)__pyx_mstate_global->__pyx_codeobj_tab[172]))
  __Pyx_RefNannySetupContext("__delitem__", 0);
  __Pyx_TraceStartFunc("__delitem__", __pyx_f[0], 2292, 0, 0, 0, __PYX_ERR(0, 2292, __pyx_L1_error));
  __Pyx_INCREF(__pyx_v_key);

  /* "pysam/libcbcf.pyx":2293
 * 
 *     def __delitem__(self, key):
 *         cdef bcf_hdr_t *hdr = self.record.header.ptr             # <<<<<<<<<<<<<<
 *         cdef bcf1_t *r = self.record.ptr
 *         cdef int index, id
*/
  __pyx_t_1 = __pyx_v_self->record->header->ptr;
  __pyx_v_hdr = __pyx_t_1;

  /* "pysam/libcbcf.pyx":2294
 *     def __delitem__(self, key):
 *         cdef bcf_hdr_t *hdr = self.record.header.ptr
 *         cdef bcf1_t *r = self.record.ptr             # <<<<<<<<<<<<<<
 *         cdef int index, id
 *         cdef int n = r.d.n_flt
*/
  __pyx_t_2 = __pyx_v_self->record->ptr;
  __pyx_v_r = __pyx_t_2;

  /* "pysam/libcbcf.pyx":2296
 *         cdef bcf1_t *r = self.record.ptr
 *         cdef int index, id
 *         cdef int n = r.d.n_flt             # <<<<<<<<<<<<<<
 * 
 *         if isinstance(key, int):
*/
  __pyx_t_3 = __pyx_v_r->d.n_flt;
  __pyx_v_n = __pyx_t_3;

  /* "pysam/libcbcf.pyx":2298
 *         cdef int n = r.d.n_flt
 * 
 *         if isinstance(key, int):             # <<<<<<<<<<<<<<
 *             index = key
 * 
*/
  __pyx_t_4 = PyLong_Check(__pyx_v_key); 
  if (__pyx_t_4) {

    /* "pysam/libcbcf.pyx":2299
 * 
 *         if isinstance(key, int):
 *             index = key             # <<<<<<<<<<<<<<
 * 
 *             if index < 0 or index >= n:
*/
    __pyx_t_3 = __Pyx_PyLong_As_int(__pyx_v_key); if (unlikely((__pyx_t_3 == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 2299, __pyx_L1_error)
    __pyx_v_index = __pyx_t_3;

    /* "pysam/libcbcf.pyx":2301
 *             index = key
 * 
 *             if index < 0 or index >= n:             # <<<<<<<<<<<<<<
 *                 raise IndexError('invalid filter index')
 * 
*/
    __pyx_t_5 = (__pyx_v_index < 0);
    if (!__pyx_t_5) {
    } else {
      __pyx_t_4 = __pyx_t_5;
      goto __pyx_L5_bool_binop_done;
    }
    __pyx_t_5 = (__pyx_v_index >= __pyx_v_n);
    __pyx_t_4 = __pyx_t_5;
    __pyx_L5_bool_binop_done:;
    if (unlikely(__pyx_t_4)) {

      /* "pysam/libcbcf.pyx":2302
 * 
 *             if index < 0 or index >= n:
 *                 raise IndexError('invalid filter index')             # <<<<<<<<<<<<<<
 * 
 *             id = r.d.flt[index]
*/
      __pyx_t_7 = NULL;
      __Pyx_INCREF(__pyx_builtin_IndexError);
      __pyx_t_8 = __pyx_builtin_IndexError; 
      __pyx_t_9 = 1;
      {
        PyObject *__pyx_callargs[2] = {__pyx_t_7, __pyx_mstate_global->__pyx_kp_u_invalid_filter_index};
        __pyx_t_6 = __Pyx_PyObject_FastCall(__pyx_t_8, __pyx_callargs+__pyx_t_9, (2-__pyx_t_9) | (__pyx_t_9*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
        __Pyx_XDECREF(__pyx_t_7); __pyx_t_7 = 0;
        __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
        if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 2302, __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, 2302, __pyx_L1_error)

      /* "pysam/libcbcf.pyx":2301
 *             index = key
 * 
 *             if index < 0 or index >= n:             # <<<<<<<<<<<<<<
 *                 raise IndexError('invalid filter index')
 * 
*/
    }

    /* "pysam/libcbcf.pyx":2304
 *                 raise IndexError('invalid filter index')
 * 
 *             id = r.d.flt[index]             # <<<<<<<<<<<<<<
 *         else:
 *             if key == '.':
*/
    __pyx_v_id = (__pyx_v_r->d.flt[__pyx_v_index]);

    /* "pysam/libcbcf.pyx":2298
 *         cdef int n = r.d.n_flt
 * 
 *         if isinstance(key, int):             # <<<<<<<<<<<<<<
 *             index = key
 * 
*/
    goto __pyx_L3;
  }

  /* "pysam/libcbcf.pyx":2306
 *             id = r.d.flt[index]
 *         else:
 *             if key == '.':             # <<<<<<<<<<<<<<
 *                 key = 'PASS'
 * 
*/
  /*else*/ {
    __pyx_t_4 = (__Pyx_PyUnicode_Equals(__pyx_v_key, __pyx_mstate_global->__pyx_kp_u__4, Py_EQ)); if (unlikely((__pyx_t_4 < 0))) __PYX_ERR(0, 2306, __pyx_L1_error)
    if (__pyx_t_4) {

      /* "pysam/libcbcf.pyx":2307
 *         else:
 *             if key == '.':
 *                 key = 'PASS'             # <<<<<<<<<<<<<<
 * 
 *             bkey = force_bytes(key)
*/
      __Pyx_INCREF(__pyx_mstate_global->__pyx_n_u_PASS);
      __Pyx_DECREF_SET(__pyx_v_key, __pyx_mstate_global->__pyx_n_u_PASS);

      /* "pysam/libcbcf.pyx":2306
 *             id = r.d.flt[index]
 *         else:
 *             if key == '.':             # <<<<<<<<<<<<<<
 *                 key = 'PASS'
 * 
*/
    }

    /* "pysam/libcbcf.pyx":2309
 *                 key = 'PASS'
 * 
 *             bkey = force_bytes(key)             # <<<<<<<<<<<<<<
 *             id = bcf_hdr_id2int(hdr, BCF_DT_ID, bkey)
 * 
*/
    __pyx_t_6 = __pyx_f_5pysam_9libcutils_force_bytes(__pyx_v_key, NULL); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 2309, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_6);
    __pyx_v_bkey = ((PyObject*)__pyx_t_6);
    __pyx_t_6 = 0;

    /* "pysam/libcbcf.pyx":2310
 * 
 *             bkey = force_bytes(key)
 *             id = bcf_hdr_id2int(hdr, BCF_DT_ID, bkey)             # <<<<<<<<<<<<<<
 * 
 *             if not check_header_id(hdr, BCF_HL_FLT, id) or not bcf_has_filter(hdr, r, bkey):
*/
    if (unlikely(__pyx_v_bkey == Py_None)) {
      PyErr_SetString(PyExc_TypeError, "expected bytes, NoneType found");
      __PYX_ERR(0, 2310, __pyx_L1_error)
    }
    __pyx_t_10 = __Pyx_PyBytes_AsString(__pyx_v_bkey); if (unlikely((!__pyx_t_10) && PyErr_Occurred())) __PYX_ERR(0, 2310, __pyx_L1_error)
    __pyx_v_id = bcf_hdr_id2int(__pyx_v_hdr, BCF_DT_ID, __pyx_t_10);

    /* "pysam/libcbcf.pyx":2312
 *             id = bcf_hdr_id2int(hdr, BCF_DT_ID, bkey)
 * 
 *             if not check_header_id(hdr, BCF_HL_FLT, id) or not bcf_has_filter(hdr, r, bkey):             # <<<<<<<<<<<<<<
 *                 raise KeyError('Invalid filter: {}'.format(key))
 * 
*/
    __pyx_t_5 = __pyx_f_5pysam_7libcbcf_check_header_id(__pyx_v_hdr, BCF_HL_FLT, __pyx_v_id); if (unlikely(__pyx_t_5 == ((int)-1) && PyErr_Occurred())) __PYX_ERR(0, 2312, __pyx_L1_error)
    __pyx_t_11 = (!__pyx_t_5);
    if (!__pyx_t_11) {
    } else {
      __pyx_t_4 = __pyx_t_11;
      goto __pyx_L9_bool_binop_done;
    }
    if (unlikely(__pyx_v_bkey == Py_None)) {
      PyErr_SetString(PyExc_TypeError, "expected bytes, NoneType found");
      __PYX_ERR(0, 2312, __pyx_L1_error)
    }
    __pyx_t_12 = __Pyx_PyBytes_AsWritableString(__pyx_v_bkey); if (unlikely((!__pyx_t_12) && PyErr_Occurred())) __PYX_ERR(0, 2312, __pyx_L1_error)
    __pyx_t_11 = (!(bcf_has_filter(__pyx_v_hdr, __pyx_v_r, __pyx_t_12) != 0));
    __pyx_t_4 = __pyx_t_11;
    __pyx_L9_bool_binop_done:;
    if (unlikely(__pyx_t_4)) {

      /* "pysam/libcbcf.pyx":2313
 * 
 *             if not check_header_id(hdr, BCF_HL_FLT, id) or not bcf_has_filter(hdr, r, bkey):
 *                 raise KeyError('Invalid filter: {}'.format(key))             # <<<<<<<<<<<<<<
 * 
 *         bcf_remove_filter(hdr, r, id, 0)
*/
      __pyx_t_8 = NULL;
      __Pyx_INCREF(__pyx_builtin_KeyError);
      __pyx_t_7 = __pyx_builtin_KeyError; 
      __pyx_t_14 = __pyx_mstate_global->__pyx_kp_u_Invalid_filter;
      __Pyx_INCREF(__pyx_t_14);
      __pyx_t_9 = 0;
      {
        PyObject *__pyx_callargs[2] = {__pyx_t_14, __pyx_v_key};
        __pyx_t_13 = __Pyx_PyObject_FastCallMethod(__pyx_mstate_global->__pyx_n_u_format, __pyx_callargs+__pyx_t_9, (2-__pyx_t_9) | (1*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
        __Pyx_XDECREF(__pyx_t_14); __pyx_t_14 = 0;
        if (unlikely(!__pyx_t_13)) __PYX_ERR(0, 2313, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_13);
      }
      __pyx_t_9 = 1;
      {
        PyObject *__pyx_callargs[2] = {__pyx_t_8, __pyx_t_13};
        __pyx_t_6 = __Pyx_PyObject_FastCall(__pyx_t_7, __pyx_callargs+__pyx_t_9, (2-__pyx_t_9) | (__pyx_t_9*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
        __Pyx_XDECREF(__pyx_t_8); __pyx_t_8 = 0;
        __Pyx_DECREF(__pyx_t_13); __pyx_t_13 = 0;
        __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
        if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 2313, __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, 2313, __pyx_L1_error)

      /* "pysam/libcbcf.pyx":2312
 *             id = bcf_hdr_id2int(hdr, BCF_DT_ID, bkey)
 * 
 *             if not check_header_id(hdr, BCF_HL_FLT, id) or not bcf_has_filter(hdr, r, bkey):             # <<<<<<<<<<<<<<
 *                 raise KeyError('Invalid filter: {}'.format(key))
 * 
*/
    }
  }
  __pyx_L3:;

  /* "pysam/libcbcf.pyx":2315
 *                 raise KeyError('Invalid filter: {}'.format(key))
 * 
 *         bcf_remove_filter(hdr, r, id, 0)             # <<<<<<<<<<<<<<
 * 
 *     def clear(self):
*/
  (void)(bcf_remove_filter(__pyx_v_hdr, __pyx_v_r, __pyx_v_id, 0));

  /* "pysam/libcbcf.pyx":2292
 *         bcf_add_filter(hdr, r, id)
 * 
 *     def __delitem__(self, key):             # <<<<<<<<<<<<<<
 *         cdef bcf_hdr_t *hdr = self.record.header.ptr
 *         cdef bcf1_t *r = self.record.ptr
*/

  /* function exit code */
  __pyx_r = 0;
  __Pyx_TraceReturnCValue(__pyx_r, __Pyx_Owned_Py_None, 0, 0, __PYX_ERR(0, 2292, __pyx_L1_error));
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_6);
  __Pyx_XDECREF(__pyx_t_7);
  __Pyx_XDECREF(__pyx_t_8);
  __Pyx_XDECREF(__pyx_t_13);
  __Pyx_XDECREF(__pyx_t_14);
  __Pyx_TraceException(__pyx_lineno, 0, 0);
  #if CYTHON_USE_SYS_MONITORING
  __Pyx_TraceExceptionUnwind(0, 0);
  #else
  __Pyx_TraceReturnValue(NULL, 0, 0, __PYX_ERR(0, 2292, __pyx_L1_error));
  #endif
  __Pyx_AddTraceback("pysam.libcbcf.VariantRecordFilter.__delitem__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = -1;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_bkey);
  __Pyx_XDECREF(__pyx_v_key);
  __Pyx_PyMonitoring_ExitScope(0);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "pysam/libcbcf.pyx":2317
 *         bcf_remove_filter(hdr, r, id, 0)
 * 
 *     def clear(self):             # <<<<<<<<<<<<<<
 *         """Clear all filters"""
 *         cdef bcf1_t *r = self.record.ptr
*/

/* Python wrapper */
static PyObject *__pyx_pw_5pysam_7libcbcf_19VariantRecordFilter_13clear(PyObject *__pyx_v_self, 
#if 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_5pysam_7libcbcf_19VariantRecordFilter_12clear, "VariantRecordFilter.clear(self)\n\nClear all filters");
static PyMethodDef __pyx_mdef_5pysam_7libcbcf_19VariantRecordFilter_13clear = {"clear", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_5pysam_7libcbcf_19VariantRecordFilter_13clear, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_5pysam_7libcbcf_19VariantRecordFilter_12clear};
static PyObject *__pyx_pw_5pysam_7libcbcf_19VariantRecordFilter_13clear(PyObject *__pyx_v_self, 
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
) {
  #if !CYTHON_METH_FASTCALL
  CYTHON_UNUSED Py_ssize_t __pyx_nargs;
  #endif
  CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("clear (wrapper)", 0);
  #if !CYTHON_METH_FASTCALL
  #if CYTHON_ASSUME_SAFE_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("clear", 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("clear", __pyx_kwds); return NULL;}
  __pyx_r = __pyx_pf_5pysam_7libcbcf_19VariantRecordFilter_12clear(((struct __pyx_obj_5pysam_7libcbcf_VariantRecordFilter *)__pyx_v_self));

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

static PyObject *__pyx_pf_5pysam_7libcbcf_19VariantRecordFilter_12clear(struct __pyx_obj_5pysam_7libcbcf_VariantRecordFilter *__pyx_v_self) {
  bcf1_t *__pyx_v_r;
  PyObject *__pyx_r = NULL;
  __Pyx_TraceDeclarationsFunc
  __Pyx_RefNannyDeclarations
  bcf1_t *__pyx_t_1;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_TraceFrameInit(((PyObject *)__pyx_mstate_global->__pyx_codeobj_tab[173]))
  __Pyx_RefNannySetupContext("clear", 0);
  __Pyx_TraceStartFunc("clear", __pyx_f[0], 2317, 0, 0, 0, __PYX_ERR(0, 2317, __pyx_L1_error));

  /* "pysam/libcbcf.pyx":2319
 *     def clear(self):
 *         """Clear all filters"""
 *         cdef bcf1_t *r = self.record.ptr             # <<<<<<<<<<<<<<
 *         r.d.shared_dirty |= BCF1_DIRTY_FLT
 *         r.d.n_flt = 0
*/
  __pyx_t_1 = __pyx_v_self->record->ptr;
  __pyx_v_r = __pyx_t_1;

  /* "pysam/libcbcf.pyx":2320
 *         """Clear all filters"""
 *         cdef bcf1_t *r = self.record.ptr
 *         r.d.shared_dirty |= BCF1_DIRTY_FLT             # <<<<<<<<<<<<<<
 *         r.d.n_flt = 0
 * 
*/
  __pyx_v_r->d.shared_dirty = (__pyx_v_r->d.shared_dirty | BCF1_DIRTY_FLT);

  /* "pysam/libcbcf.pyx":2321
 *         cdef bcf1_t *r = self.record.ptr
 *         r.d.shared_dirty |= BCF1_DIRTY_FLT
 *         r.d.n_flt = 0             # <<<<<<<<<<<<<<
 * 
 *     def __iter__(self):
*/
  __pyx_v_r->d.n_flt = 0;

  /* "pysam/libcbcf.pyx":2317
 *         bcf_remove_filter(hdr, r, id, 0)
 * 
 *     def clear(self):             # <<<<<<<<<<<<<<
 *         """Clear all filters"""
 *         cdef bcf1_t *r = self.record.ptr
*/

  /* function exit code */
  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  __Pyx_TraceReturnValue(__pyx_r, 0, 0, __PYX_ERR(0, 2317, __pyx_L1_error));
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_TraceException(__pyx_lineno, 0, 0);
  #if CYTHON_USE_SYS_MONITORING
  __Pyx_TraceExceptionUnwind(0, 0);
  #else
  __Pyx_TraceReturnValue(NULL, 0, 0, __PYX_ERR(0, 2317, __pyx_L1_error));
  #endif
  __Pyx_AddTraceback("pysam.libcbcf.VariantRecordFilter.clear", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_PyMonitoring_ExitScope(0);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}
static PyObject *__pyx_gb_5pysam_7libcbcf_19VariantRecordFilter_16generator11(__pyx_CoroutineObject *__pyx_generator, CYTHON_UNUSED PyThreadState *__pyx_tstate, PyObject *__pyx_sent_value); /* proto */

/* "pysam/libcbcf.pyx":2323
 *         r.d.n_flt = 0
 * 
 *     def __iter__(self):             # <<<<<<<<<<<<<<
 *         cdef bcf_hdr_t *hdr = self.record.header.ptr
 *         cdef bcf1_t *r = self.record.ptr
*/

/* Python wrapper */
static PyObject *__pyx_pw_5pysam_7libcbcf_19VariantRecordFilter_15__iter__(PyObject *__pyx_v_self); /*proto*/
static PyObject *__pyx_pw_5pysam_7libcbcf_19VariantRecordFilter_15__iter__(PyObject *__pyx_v_self) {
  CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__iter__ (wrapper)", 0);
  __pyx_kwvalues = __Pyx_KwValues_VARARGS(__pyx_args, __pyx_nargs);
  __pyx_r = __pyx_pf_5pysam_7libcbcf_19VariantRecordFilter_14__iter__(((struct __pyx_obj_5pysam_7libcbcf_VariantRecordFilter *)__pyx_v_self));

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

static PyObject *__pyx_pf_5pysam_7libcbcf_19VariantRecordFilter_14__iter__(struct __pyx_obj_5pysam_7libcbcf_VariantRecordFilter *__pyx_v_self) {
  struct __pyx_obj_5pysam_7libcbcf___pyx_scope_struct_18___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("__iter__", 0);
  __pyx_cur_scope = (struct __pyx_obj_5pysam_7libcbcf___pyx_scope_struct_18___iter__ *)__pyx_tp_new_5pysam_7libcbcf___pyx_scope_struct_18___iter__(__pyx_mstate_global->__pyx_ptype_5pysam_7libcbcf___pyx_scope_struct_18___iter__, __pyx_mstate_global->__pyx_empty_tuple, NULL);
  if (unlikely(!__pyx_cur_scope)) {
    __pyx_cur_scope = ((struct __pyx_obj_5pysam_7libcbcf___pyx_scope_struct_18___iter__ *)Py_None);
    __Pyx_INCREF(Py_None);
    __PYX_ERR(0, 2323, __pyx_L1_error)
  } else {
    __Pyx_GOTREF((PyObject *)__pyx_cur_scope);
  }
  __pyx_cur_scope->__pyx_v_self = __pyx_v_self;
  __Pyx_INCREF((PyObject *)__pyx_cur_scope->__pyx_v_self);
  __Pyx_GIVEREF((PyObject *)__pyx_cur_scope->__pyx_v_self);
  {
    __pyx_CoroutineObject *gen = __Pyx_Generator_New((__pyx_coroutine_body_t) __pyx_gb_5pysam_7libcbcf_19VariantRecordFilter_16generator11, ((PyObject *)__pyx_mstate_global->__pyx_codeobj_tab[174]), (PyObject *) __pyx_cur_scope, __pyx_mstate_global->__pyx_n_u_iter, __pyx_mstate_global->__pyx_n_u_VariantRecordFilter___iter, __pyx_mstate_global->__pyx_n_u_pysam_libcbcf); if (unlikely(!gen)) __PYX_ERR(0, 2323, __pyx_L1_error)
    __Pyx_DECREF(__pyx_cur_scope);
    __Pyx_RefNannyFinishContext();
    return (PyObject *) gen;
  }

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_AddTraceback("pysam.libcbcf.VariantRecordFilter.__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_5pysam_7libcbcf_19VariantRecordFilter_16generator11(__pyx_CoroutineObject *__pyx_generator, CYTHON_UNUSED PyThreadState *__pyx_tstate, PyObject *__pyx_sent_value) /* generator body */
{
  struct __pyx_obj_5pysam_7libcbcf___pyx_scope_struct_18___iter__ *__pyx_cur_scope = ((struct __pyx_obj_5pysam_7libcbcf___pyx_scope_struct_18___iter__ *)__pyx_generator->closure);
  PyObject *__pyx_r = NULL;
  __Pyx_TraceDeclarationsGen
  bcf_hdr_t *__pyx_t_1;
  bcf1_t *__pyx_t_2;
  int __pyx_t_3;
  int __pyx_t_4;
  int __pyx_t_5;
  PyObject *__pyx_t_6 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__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_TraceStartGen("__iter__", __pyx_f[0], 2323, 0, 0, 0, __PYX_ERR(0, 2323, __pyx_L1_error));
    __Pyx_TraceReturnValue(Py_None, 0, 0, __PYX_ERR(0, 2323, __pyx_L1_error));
    __Pyx_RefNannyFinishContext();
    return NULL;
  }
  __pyx_L3_first_run:;
  __Pyx_TraceStartGen("__iter__", __pyx_f[0], 2323, 0, 0, 0, __PYX_ERR(0, 2323, __pyx_L1_error));
  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, 2323, __pyx_L1_error)
  }

  /* "pysam/libcbcf.pyx":2324
 * 
 *     def __iter__(self):
 *         cdef bcf_hdr_t *hdr = self.record.header.ptr             # <<<<<<<<<<<<<<
 *         cdef bcf1_t *r = self.record.ptr
 *         cdef int i
*/
  __pyx_t_1 = __pyx_cur_scope->__pyx_v_self->record->header->ptr;
  __pyx_cur_scope->__pyx_v_hdr = __pyx_t_1;

  /* "pysam/libcbcf.pyx":2325
 *     def __iter__(self):
 *         cdef bcf_hdr_t *hdr = self.record.header.ptr
 *         cdef bcf1_t *r = self.record.ptr             # <<<<<<<<<<<<<<
 *         cdef int i
 * 
*/
  __pyx_t_2 = __pyx_cur_scope->__pyx_v_self->record->ptr;
  __pyx_cur_scope->__pyx_v_r = __pyx_t_2;

  /* "pysam/libcbcf.pyx":2328
 *         cdef int i
 * 
 *         for i in range(r.d.n_flt):             # <<<<<<<<<<<<<<
 *             yield bcf_str_cache_get_charptr(bcf_hdr_int2id(hdr, BCF_DT_ID, r.d.flt[i]))
 * 
*/
  __pyx_t_3 = __pyx_cur_scope->__pyx_v_r->d.n_flt;
  __pyx_t_4 = __pyx_t_3;
  for (__pyx_t_5 = 0; __pyx_t_5 < __pyx_t_4; __pyx_t_5+=1) {
    __pyx_cur_scope->__pyx_v_i = __pyx_t_5;

    /* "pysam/libcbcf.pyx":2329
 * 
 *         for i in range(r.d.n_flt):
 *             yield bcf_str_cache_get_charptr(bcf_hdr_int2id(hdr, BCF_DT_ID, r.d.flt[i]))             # <<<<<<<<<<<<<<
 * 
 *     def get(self, key, default=None):
*/
    __pyx_t_6 = __pyx_f_5pysam_7libcbcf_bcf_str_cache_get_charptr(bcf_hdr_int2id(__pyx_cur_scope->__pyx_v_hdr, BCF_DT_ID, (__pyx_cur_scope->__pyx_v_r->d.flt[__pyx_cur_scope->__pyx_v_i]))); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 2329, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_6);
    __pyx_r = __pyx_t_6;
    __pyx_t_6 = 0;
    __pyx_cur_scope->__pyx_t_0 = __pyx_t_3;
    __pyx_cur_scope->__pyx_t_1 = __pyx_t_4;
    __pyx_cur_scope->__pyx_t_2 = __pyx_t_5;
    __Pyx_TraceYield(__pyx_r, 0, __PYX_ERR(0, 2329, __pyx_L1_error));
    __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_TraceResumeGen("__iter__", __pyx_f[0], 2323, 0, __PYX_ERR(0, 2329, __pyx_L1_error));
    __pyx_t_3 = __pyx_cur_scope->__pyx_t_0;
    __pyx_t_4 = __pyx_cur_scope->__pyx_t_1;
    __pyx_t_5 = __pyx_cur_scope->__pyx_t_2;
    if (unlikely(!__pyx_sent_value)) __PYX_ERR(0, 2329, __pyx_L1_error)
  }
  CYTHON_MAYBE_UNUSED_VAR(__pyx_cur_scope);
  __Pyx_TraceReturnValue(Py_None, 0, 0, __PYX_ERR(0, 2323, __pyx_L1_error));

  /* "pysam/libcbcf.pyx":2323
 *         r.d.n_flt = 0
 * 
 *     def __iter__(self):             # <<<<<<<<<<<<<<
 *         cdef bcf_hdr_t *hdr = self.record.header.ptr
 *         cdef bcf1_t *r = self.record.ptr
*/

  /* function exit code */
  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_6);
  if (__Pyx_PyErr_Occurred()) {
    __Pyx_TraceException(__pyx_lineno, 0, 0);
    __Pyx_Generator_Replace_StopIteration(0);
    __Pyx_AddTraceback("__iter__", __pyx_clineno, __pyx_lineno, __pyx_filename);
    __Pyx_TraceExceptionUnwind(0, 0);
  }
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_PyMonitoring_ExitScope(0);
  #if !CYTHON_USE_EXC_INFO_STACK
  __Pyx_Coroutine_ResetAndClearException(__pyx_generator);
  #endif
  __pyx_generator->resume_label = -1;
  __Pyx_Coroutine_clear((PyObject*)__pyx_generator);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "pysam/libcbcf.pyx":2331
 *             yield bcf_str_cache_get_charptr(bcf_hdr_int2id(hdr, BCF_DT_ID, r.d.flt[i]))
 * 
 *     def get(self, key, default=None):             # <<<<<<<<<<<<<<
 *         """D.get(k[,d]) -> D[k] if k in D, else d.  d defaults to None."""
 *         try:
*/

/* Python wrapper */
static PyObject *__pyx_pw_5pysam_7libcbcf_19VariantRecordFilter_18get(PyObject *__pyx_v_self, 
#if 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_5pysam_7libcbcf_19VariantRecordFilter_17get, "VariantRecordFilter.get(self, key, default=None)\n\nD.get(k[,d]) -> D[k] if k in D, else d.  d defaults to None.");
static PyMethodDef __pyx_mdef_5pysam_7libcbcf_19VariantRecordFilter_18get = {"get", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_5pysam_7libcbcf_19VariantRecordFilter_18get, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_5pysam_7libcbcf_19VariantRecordFilter_17get};
static PyObject *__pyx_pw_5pysam_7libcbcf_19VariantRecordFilter_18get(PyObject *__pyx_v_self, 
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
) {
  PyObject *__pyx_v_key = 0;
  PyObject *__pyx_v_default = 0;
  #if !CYTHON_METH_FASTCALL
  CYTHON_UNUSED Py_ssize_t __pyx_nargs;
  #endif
  CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
  PyObject* values[2] = {0,0};
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("get (wrapper)", 0);
  #if !CYTHON_METH_FASTCALL
  #if CYTHON_ASSUME_SAFE_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,&__pyx_mstate_global->__pyx_n_u_default,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, 2331, __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, 2331, __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, 2331, __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, 2331, __pyx_L3_error)
      if (!values[1]) values[1] = __Pyx_NewRef(((PyObject *)Py_None));
      for (Py_ssize_t i = __pyx_nargs; i < 1; i++) {
        if (unlikely(!values[i])) { __Pyx_RaiseArgtupleInvalid("get", 0, 1, 2, i); __PYX_ERR(0, 2331, __pyx_L3_error) }
      }
    } 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, 2331, __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, 2331, __pyx_L3_error)
        break;
        default: goto __pyx_L5_argtuple_error;
      }
      if (!values[1]) values[1] = __Pyx_NewRef(((PyObject *)Py_None));
    }
    __pyx_v_key = values[0];
    __pyx_v_default = values[1];
  }
  goto __pyx_L6_skip;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("get", 0, 1, 2, __pyx_nargs); __PYX_ERR(0, 2331, __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("pysam.libcbcf.VariantRecordFilter.get", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_5pysam_7libcbcf_19VariantRecordFilter_17get(((struct __pyx_obj_5pysam_7libcbcf_VariantRecordFilter *)__pyx_v_self), __pyx_v_key, __pyx_v_default);

  /* 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_5pysam_7libcbcf_19VariantRecordFilter_17get(struct __pyx_obj_5pysam_7libcbcf_VariantRecordFilter *__pyx_v_self, PyObject *__pyx_v_key, PyObject *__pyx_v_default) {
  PyObject *__pyx_r = NULL;
  __Pyx_TraceDeclarationsFunc
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  PyObject *__pyx_t_4 = NULL;
  int __pyx_t_5;
  PyObject *__pyx_t_6 = NULL;
  PyObject *__pyx_t_7 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_TraceFrameInit(((PyObject *)__pyx_mstate_global->__pyx_codeobj_tab[175]))
  __Pyx_RefNannySetupContext("get", 0);
  __Pyx_TraceStartFunc("get", __pyx_f[0], 2331, 0, 0, 0, __PYX_ERR(0, 2331, __pyx_L1_error));

  /* "pysam/libcbcf.pyx":2333
 *     def get(self, key, default=None):
 *         """D.get(k[,d]) -> D[k] if k in D, else d.  d defaults to None."""
 *         try:             # <<<<<<<<<<<<<<
 *             return self[key]
 *         except KeyError:
*/
  {
    __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:*/ {

      /* "pysam/libcbcf.pyx":2334
 *         """D.get(k[,d]) -> D[k] if k in D, else d.  d defaults to None."""
 *         try:
 *             return self[key]             # <<<<<<<<<<<<<<
 *         except KeyError:
 *             return default
*/
      __Pyx_XDECREF(__pyx_r);
      __pyx_t_4 = __Pyx_PyObject_GetItem(((PyObject *)__pyx_v_self), __pyx_v_key); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 2334, __pyx_L3_error)
      __Pyx_GOTREF(__pyx_t_4);
      __pyx_r = __pyx_t_4;
      __pyx_t_4 = 0;
      __Pyx_TraceReturnValue(__pyx_r, 3, 0, __PYX_ERR(0, 2334, __pyx_L3_error));
      goto __pyx_L7_try_return;

      /* "pysam/libcbcf.pyx":2333
 *     def get(self, key, default=None):
 *         """D.get(k[,d]) -> D[k] if k in D, else d.  d defaults to None."""
 *         try:             # <<<<<<<<<<<<<<
 *             return self[key]
 *         except KeyError:
*/
    }
    __pyx_L3_error:;
    __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
    __Pyx_TraceException(__pyx_lineno, 0, 0);

    /* "pysam/libcbcf.pyx":2335
 *         try:
 *             return self[key]
 *         except KeyError:             # <<<<<<<<<<<<<<
 *             return default
 * 
*/
    __pyx_t_5 = __Pyx_PyErr_ExceptionMatches(__pyx_builtin_KeyError);
    if (__pyx_t_5) {
      __Pyx_AddTraceback("pysam.libcbcf.VariantRecordFilter.get", __pyx_clineno, __pyx_lineno, __pyx_filename);
      __Pyx_TraceExceptionHandled(0);
      if (__Pyx_GetException(&__pyx_t_4, &__pyx_t_6, &__pyx_t_7) < 0) __PYX_ERR(0, 2335, __pyx_L5_except_error)
      __Pyx_XGOTREF(__pyx_t_4);
      __Pyx_XGOTREF(__pyx_t_6);
      __Pyx_XGOTREF(__pyx_t_7);
      __Pyx_TraceExceptionDone();

      /* "pysam/libcbcf.pyx":2336
 *             return self[key]
 *         except KeyError:
 *             return default             # <<<<<<<<<<<<<<
 * 
 *     def __contains__(self, key):
*/
      __Pyx_XDECREF(__pyx_r);
      __Pyx_INCREF(__pyx_v_default);
      __pyx_r = __pyx_v_default;
      __Pyx_TraceReturnValue(__pyx_r, 8, 0, __PYX_ERR(0, 2336, __pyx_L5_except_error));
      __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;

    /* "pysam/libcbcf.pyx":2333
 *     def get(self, key, default=None):
 *         """D.get(k[,d]) -> D[k] if k in D, else d.  d defaults to None."""
 *         try:             # <<<<<<<<<<<<<<
 *             return self[key]
 *         except KeyError:
*/
    __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;
  }

  /* "pysam/libcbcf.pyx":2331
 *             yield bcf_str_cache_get_charptr(bcf_hdr_int2id(hdr, BCF_DT_ID, r.d.flt[i]))
 * 
 *     def get(self, key, default=None):             # <<<<<<<<<<<<<<
 *         """D.get(k[,d]) -> D[k] if k in D, else d.  d defaults to None."""
 *         try:
*/

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_XDECREF(__pyx_t_6);
  __Pyx_XDECREF(__pyx_t_7);
  __Pyx_TraceException(__pyx_lineno, 0, 0);
  #if CYTHON_USE_SYS_MONITORING
  __Pyx_TraceExceptionUnwind(0, 0);
  #else
  __Pyx_TraceReturnValue(NULL, 0, 0, __PYX_ERR(0, 2331, __pyx_L1_error));
  #endif
  __Pyx_AddTraceback("pysam.libcbcf.VariantRecordFilter.get", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_PyMonitoring_ExitScope(0);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "pysam/libcbcf.pyx":2338
 *             return default
 * 
 *     def __contains__(self, key):             # <<<<<<<<<<<<<<
 *         cdef bcf_hdr_t *hdr = self.record.header.ptr
 *         cdef bcf1_t *r = self.record.ptr
*/

/* Python wrapper */
static int __pyx_pw_5pysam_7libcbcf_19VariantRecordFilter_20__contains__(PyObject *__pyx_v_self, PyObject *__pyx_v_key); /*proto*/
static int __pyx_pw_5pysam_7libcbcf_19VariantRecordFilter_20__contains__(PyObject *__pyx_v_self, PyObject *__pyx_v_key) {
  CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__contains__ (wrapper)", 0);
  __pyx_kwvalues = __Pyx_KwValues_VARARGS(__pyx_args, __pyx_nargs);
  __pyx_r = __pyx_pf_5pysam_7libcbcf_19VariantRecordFilter_19__contains__(((struct __pyx_obj_5pysam_7libcbcf_VariantRecordFilter *)__pyx_v_self), ((PyObject *)__pyx_v_key));

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

static int __pyx_pf_5pysam_7libcbcf_19VariantRecordFilter_19__contains__(struct __pyx_obj_5pysam_7libcbcf_VariantRecordFilter *__pyx_v_self, PyObject *__pyx_v_key) {
  bcf_hdr_t *__pyx_v_hdr;
  bcf1_t *__pyx_v_r;
  PyObject *__pyx_v_bkey = 0;
  int __pyx_r;
  __Pyx_TraceDeclarationsFunc
  __Pyx_RefNannyDeclarations
  bcf_hdr_t *__pyx_t_1;
  bcf1_t *__pyx_t_2;
  PyObject *__pyx_t_3 = NULL;
  char *__pyx_t_4;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_TraceFrameInit(((PyObject *)__pyx_mstate_global->__pyx_codeobj_tab[176]))
  __Pyx_RefNannySetupContext("__contains__", 0);
  __Pyx_TraceStartFunc("__contains__", __pyx_f[0], 2338, 0, 0, 0, __PYX_ERR(0, 2338, __pyx_L1_error));

  /* "pysam/libcbcf.pyx":2339
 * 
 *     def __contains__(self, key):
 *         cdef bcf_hdr_t *hdr = self.record.header.ptr             # <<<<<<<<<<<<<<
 *         cdef bcf1_t *r = self.record.ptr
 *         cdef bytes bkey = force_bytes(key)
*/
  __pyx_t_1 = __pyx_v_self->record->header->ptr;
  __pyx_v_hdr = __pyx_t_1;

  /* "pysam/libcbcf.pyx":2340
 *     def __contains__(self, key):
 *         cdef bcf_hdr_t *hdr = self.record.header.ptr
 *         cdef bcf1_t *r = self.record.ptr             # <<<<<<<<<<<<<<
 *         cdef bytes bkey = force_bytes(key)
 *         return bcf_has_filter(hdr, r, bkey) == 1
*/
  __pyx_t_2 = __pyx_v_self->record->ptr;
  __pyx_v_r = __pyx_t_2;

  /* "pysam/libcbcf.pyx":2341
 *         cdef bcf_hdr_t *hdr = self.record.header.ptr
 *         cdef bcf1_t *r = self.record.ptr
 *         cdef bytes bkey = force_bytes(key)             # <<<<<<<<<<<<<<
 *         return bcf_has_filter(hdr, r, bkey) == 1
 * 
*/
  __pyx_t_3 = __pyx_f_5pysam_9libcutils_force_bytes(__pyx_v_key, NULL); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 2341, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __pyx_v_bkey = ((PyObject*)__pyx_t_3);
  __pyx_t_3 = 0;

  /* "pysam/libcbcf.pyx":2342
 *         cdef bcf1_t *r = self.record.ptr
 *         cdef bytes bkey = force_bytes(key)
 *         return bcf_has_filter(hdr, r, bkey) == 1             # <<<<<<<<<<<<<<
 * 
 *     def iterkeys(self):
*/
  if (unlikely(__pyx_v_bkey == Py_None)) {
    PyErr_SetString(PyExc_TypeError, "expected bytes, NoneType found");
    __PYX_ERR(0, 2342, __pyx_L1_error)
  }
  __pyx_t_4 = __Pyx_PyBytes_AsWritableString(__pyx_v_bkey); if (unlikely((!__pyx_t_4) && PyErr_Occurred())) __PYX_ERR(0, 2342, __pyx_L1_error)
  __pyx_r = (bcf_has_filter(__pyx_v_hdr, __pyx_v_r, __pyx_t_4) == 1);
  __Pyx_TraceReturnCValue(__pyx_r, __Pyx_PyLong_From_int, 14, 0, __PYX_ERR(0, 2342, __pyx_L1_error));
  goto __pyx_L0;

  /* "pysam/libcbcf.pyx":2338
 *             return default
 * 
 *     def __contains__(self, key):             # <<<<<<<<<<<<<<
 *         cdef bcf_hdr_t *hdr = self.record.header.ptr
 *         cdef bcf1_t *r = self.record.ptr
*/

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_TraceException(__pyx_lineno, 0, 0);
  #if CYTHON_USE_SYS_MONITORING
  __Pyx_TraceExceptionUnwind(0, 0);
  #else
  __Pyx_TraceReturnValue(NULL, 0, 0, __PYX_ERR(0, 2338, __pyx_L1_error));
  #endif
  __Pyx_AddTraceback("pysam.libcbcf.VariantRecordFilter.__contains__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = -1;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_bkey);
  __Pyx_PyMonitoring_ExitScope(0);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "pysam/libcbcf.pyx":2344
 *         return bcf_has_filter(hdr, r, bkey) == 1
 * 
 *     def iterkeys(self):             # <<<<<<<<<<<<<<
 *         """D.iterkeys() -> an iterator over the keys of D"""
 *         return iter(self)
*/

/* Python wrapper */
static PyObject *__pyx_pw_5pysam_7libcbcf_19VariantRecordFilter_22iterkeys(PyObject *__pyx_v_self, 
#if 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_5pysam_7libcbcf_19VariantRecordFilter_21iterkeys, "VariantRecordFilter.iterkeys(self)\n\nD.iterkeys() -> an iterator over the keys of D");
static PyMethodDef __pyx_mdef_5pysam_7libcbcf_19VariantRecordFilter_22iterkeys = {"iterkeys", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_5pysam_7libcbcf_19VariantRecordFilter_22iterkeys, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_5pysam_7libcbcf_19VariantRecordFilter_21iterkeys};
static PyObject *__pyx_pw_5pysam_7libcbcf_19VariantRecordFilter_22iterkeys(PyObject *__pyx_v_self, 
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
) {
  #if !CYTHON_METH_FASTCALL
  CYTHON_UNUSED Py_ssize_t __pyx_nargs;
  #endif
  CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("iterkeys (wrapper)", 0);
  #if !CYTHON_METH_FASTCALL
  #if CYTHON_ASSUME_SAFE_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("iterkeys", 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("iterkeys", __pyx_kwds); return NULL;}
  __pyx_r = __pyx_pf_5pysam_7libcbcf_19VariantRecordFilter_21iterkeys(((struct __pyx_obj_5pysam_7libcbcf_VariantRecordFilter *)__pyx_v_self));

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

static PyObject *__pyx_pf_5pysam_7libcbcf_19VariantRecordFilter_21iterkeys(struct __pyx_obj_5pysam_7libcbcf_VariantRecordFilter *__pyx_v_self) {
  PyObject *__pyx_r = NULL;
  __Pyx_TraceDeclarationsFunc
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_TraceFrameInit(((PyObject *)__pyx_mstate_global->__pyx_codeobj_tab[177]))
  __Pyx_RefNannySetupContext("iterkeys", 0);
  __Pyx_TraceStartFunc("iterkeys", __pyx_f[0], 2344, 0, 0, 0, __PYX_ERR(0, 2344, __pyx_L1_error));

  /* "pysam/libcbcf.pyx":2346
 *     def iterkeys(self):
 *         """D.iterkeys() -> an iterator over the keys of D"""
 *         return iter(self)             # <<<<<<<<<<<<<<
 * 
 *     def itervalues(self):
*/
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = PyObject_GetIter(((PyObject *)__pyx_v_self)); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 2346, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  __Pyx_TraceReturnValue(__pyx_r, 1, 0, __PYX_ERR(0, 2346, __pyx_L1_error));
  goto __pyx_L0;

  /* "pysam/libcbcf.pyx":2344
 *         return bcf_has_filter(hdr, r, bkey) == 1
 * 
 *     def iterkeys(self):             # <<<<<<<<<<<<<<
 *         """D.iterkeys() -> an iterator over the keys of D"""
 *         return iter(self)
*/

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_TraceException(__pyx_lineno, 0, 0);
  #if CYTHON_USE_SYS_MONITORING
  __Pyx_TraceExceptionUnwind(0, 0);
  #else
  __Pyx_TraceReturnValue(NULL, 0, 0, __PYX_ERR(0, 2344, __pyx_L1_error));
  #endif
  __Pyx_AddTraceback("pysam.libcbcf.VariantRecordFilter.iterkeys", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_PyMonitoring_ExitScope(0);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}
static PyObject *__pyx_gb_5pysam_7libcbcf_19VariantRecordFilter_25generator12(__pyx_CoroutineObject *__pyx_generator, CYTHON_UNUSED PyThreadState *__pyx_tstate, PyObject *__pyx_sent_value); /* proto */

/* "pysam/libcbcf.pyx":2348
 *         return iter(self)
 * 
 *     def itervalues(self):             # <<<<<<<<<<<<<<
 *         """D.itervalues() -> an iterator over the values of D"""
 *         for key in self:
*/

/* Python wrapper */
static PyObject *__pyx_pw_5pysam_7libcbcf_19VariantRecordFilter_24itervalues(PyObject *__pyx_v_self, 
#if 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_5pysam_7libcbcf_19VariantRecordFilter_23itervalues, "VariantRecordFilter.itervalues(self)\n\nD.itervalues() -> an iterator over the values of D");
static PyMethodDef __pyx_mdef_5pysam_7libcbcf_19VariantRecordFilter_24itervalues = {"itervalues", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_5pysam_7libcbcf_19VariantRecordFilter_24itervalues, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_5pysam_7libcbcf_19VariantRecordFilter_23itervalues};
static PyObject *__pyx_pw_5pysam_7libcbcf_19VariantRecordFilter_24itervalues(PyObject *__pyx_v_self, 
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
) {
  #if !CYTHON_METH_FASTCALL
  CYTHON_UNUSED Py_ssize_t __pyx_nargs;
  #endif
  CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("itervalues (wrapper)", 0);
  #if !CYTHON_METH_FASTCALL
  #if CYTHON_ASSUME_SAFE_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("itervalues", 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("itervalues", __pyx_kwds); return NULL;}
  __pyx_r = __pyx_pf_5pysam_7libcbcf_19VariantRecordFilter_23itervalues(((struct __pyx_obj_5pysam_7libcbcf_VariantRecordFilter *)__pyx_v_self));

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

static PyObject *__pyx_pf_5pysam_7libcbcf_19VariantRecordFilter_23itervalues(struct __pyx_obj_5pysam_7libcbcf_VariantRecordFilter *__pyx_v_self) {
  struct __pyx_obj_5pysam_7libcbcf___pyx_scope_struct_19_itervalues *__pyx_cur_scope;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("itervalues", 0);
  __pyx_cur_scope = (struct __pyx_obj_5pysam_7libcbcf___pyx_scope_struct_19_itervalues *)__pyx_tp_new_5pysam_7libcbcf___pyx_scope_struct_19_itervalues(__pyx_mstate_global->__pyx_ptype_5pysam_7libcbcf___pyx_scope_struct_19_itervalues, __pyx_mstate_global->__pyx_empty_tuple, NULL);
  if (unlikely(!__pyx_cur_scope)) {
    __pyx_cur_scope = ((struct __pyx_obj_5pysam_7libcbcf___pyx_scope_struct_19_itervalues *)Py_None);
    __Pyx_INCREF(Py_None);
    __PYX_ERR(0, 2348, __pyx_L1_error)
  } else {
    __Pyx_GOTREF((PyObject *)__pyx_cur_scope);
  }
  __pyx_cur_scope->__pyx_v_self = __pyx_v_self;
  __Pyx_INCREF((PyObject *)__pyx_cur_scope->__pyx_v_self);
  __Pyx_GIVEREF((PyObject *)__pyx_cur_scope->__pyx_v_self);
  {
    __pyx_CoroutineObject *gen = __Pyx_Generator_New((__pyx_coroutine_body_t) __pyx_gb_5pysam_7libcbcf_19VariantRecordFilter_25generator12, ((PyObject *)__pyx_mstate_global->__pyx_codeobj_tab[178]), (PyObject *) __pyx_cur_scope, __pyx_mstate_global->__pyx_n_u_itervalues, __pyx_mstate_global->__pyx_n_u_VariantRecordFilter_itervalues, __pyx_mstate_global->__pyx_n_u_pysam_libcbcf); if (unlikely(!gen)) __PYX_ERR(0, 2348, __pyx_L1_error)
    __Pyx_DECREF(__pyx_cur_scope);
    __Pyx_RefNannyFinishContext();
    return (PyObject *) gen;
  }

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_AddTraceback("pysam.libcbcf.VariantRecordFilter.itervalues", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __Pyx_DECREF((PyObject *)__pyx_cur_scope);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_gb_5pysam_7libcbcf_19VariantRecordFilter_25generator12(__pyx_CoroutineObject *__pyx_generator, CYTHON_UNUSED PyThreadState *__pyx_tstate, PyObject *__pyx_sent_value) /* generator body */
{
  struct __pyx_obj_5pysam_7libcbcf___pyx_scope_struct_19_itervalues *__pyx_cur_scope = ((struct __pyx_obj_5pysam_7libcbcf___pyx_scope_struct_19_itervalues *)__pyx_generator->closure);
  PyObject *__pyx_r = NULL;
  __Pyx_TraceDeclarationsGen
  PyObject *__pyx_t_1 = NULL;
  Py_ssize_t __pyx_t_2;
  PyObject *(*__pyx_t_3)(PyObject *);
  PyObject *__pyx_t_4 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("itervalues", 0);
  switch (__pyx_generator->resume_label) {
    case 0: goto __pyx_L3_first_run;
    case 1: goto __pyx_L6_resume_from_yield;
    default: /* CPython raises the right error here */
    __Pyx_TraceStartGen("itervalues", __pyx_f[0], 2348, 0, 0, 0, __PYX_ERR(0, 2348, __pyx_L1_error));
    __Pyx_TraceReturnValue(Py_None, 0, 0, __PYX_ERR(0, 2348, __pyx_L1_error));
    __Pyx_RefNannyFinishContext();
    return NULL;
  }
  __pyx_L3_first_run:;
  __Pyx_TraceStartGen("itervalues", __pyx_f[0], 2348, 0, 0, 0, __PYX_ERR(0, 2348, __pyx_L1_error));
  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, 2348, __pyx_L1_error)
  }

  /* "pysam/libcbcf.pyx":2350
 *     def itervalues(self):
 *         """D.itervalues() -> an iterator over the values of D"""
 *         for key in self:             # <<<<<<<<<<<<<<
 *             yield self[key]
 * 
*/
  if (likely(PyList_CheckExact(((PyObject *)__pyx_cur_scope->__pyx_v_self))) || PyTuple_CheckExact(((PyObject *)__pyx_cur_scope->__pyx_v_self))) {
    __pyx_t_1 = ((PyObject *)__pyx_cur_scope->__pyx_v_self); __Pyx_INCREF(__pyx_t_1);
    __pyx_t_2 = 0;
    __pyx_t_3 = NULL;
  } else {
    __pyx_t_2 = -1; __pyx_t_1 = PyObject_GetIter(((PyObject *)__pyx_cur_scope->__pyx_v_self)); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 2350, __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, 2350, __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, 2350, __pyx_L1_error)
          #endif
          if (__pyx_t_2 >= __pyx_temp) break;
        }
        __pyx_t_4 = __Pyx_PyList_GetItemRef(__pyx_t_1, __pyx_t_2);
        ++__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, 2350, __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, 2350, __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, 2350, __pyx_L1_error)
          PyErr_Clear();
        }
        break;
      }
    }
    __Pyx_GOTREF(__pyx_t_4);
    __Pyx_XGOTREF(__pyx_cur_scope->__pyx_v_key);
    __Pyx_XDECREF_SET(__pyx_cur_scope->__pyx_v_key, __pyx_t_4);
    __Pyx_GIVEREF(__pyx_t_4);
    __pyx_t_4 = 0;

    /* "pysam/libcbcf.pyx":2351
 *         """D.itervalues() -> an iterator over the values of D"""
 *         for key in self:
 *             yield self[key]             # <<<<<<<<<<<<<<
 * 
 *     def iteritems(self):
*/
    __pyx_t_4 = __Pyx_PyObject_GetItem(((PyObject *)__pyx_cur_scope->__pyx_v_self), __pyx_cur_scope->__pyx_v_key); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 2351, __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_TraceYield(__pyx_r, 0, __PYX_ERR(0, 2351, __pyx_L1_error));
    __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_TraceResumeGen("itervalues", __pyx_f[0], 2348, 0, __PYX_ERR(0, 2351, __pyx_L1_error));
    __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, 2351, __pyx_L1_error)

    /* "pysam/libcbcf.pyx":2350
 *     def itervalues(self):
 *         """D.itervalues() -> an iterator over the values of D"""
 *         for key in self:             # <<<<<<<<<<<<<<
 *             yield self[key]
 * 
*/
  }
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  CYTHON_MAYBE_UNUSED_VAR(__pyx_cur_scope);
  __Pyx_TraceReturnValue(Py_None, 0, 0, __PYX_ERR(0, 2348, __pyx_L1_error));

  /* "pysam/libcbcf.pyx":2348
 *         return iter(self)
 * 
 *     def itervalues(self):             # <<<<<<<<<<<<<<
 *         """D.itervalues() -> an iterator over the values of D"""
 *         for key in self:
*/

  /* 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_TraceException(__pyx_lineno, 0, 0);
    __Pyx_Generator_Replace_StopIteration(0);
    __Pyx_AddTraceback("itervalues", __pyx_clineno, __pyx_lineno, __pyx_filename);
    __Pyx_TraceExceptionUnwind(0, 0);
  }
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_PyMonitoring_ExitScope(0);
  #if !CYTHON_USE_EXC_INFO_STACK
  __Pyx_Coroutine_ResetAndClearException(__pyx_generator);
  #endif
  __pyx_generator->resume_label = -1;
  __Pyx_Coroutine_clear((PyObject*)__pyx_generator);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}
static PyObject *__pyx_gb_5pysam_7libcbcf_19VariantRecordFilter_28generator13(__pyx_CoroutineObject *__pyx_generator, CYTHON_UNUSED PyThreadState *__pyx_tstate, PyObject *__pyx_sent_value); /* proto */

/* "pysam/libcbcf.pyx":2353
 *             yield self[key]
 * 
 *     def iteritems(self):             # <<<<<<<<<<<<<<
 *         """D.iteritems() -> an iterator over the (key, value) items of D"""
 *         for key in self:
*/

/* Python wrapper */
static PyObject *__pyx_pw_5pysam_7libcbcf_19VariantRecordFilter_27iteritems(PyObject *__pyx_v_self, 
#if 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_5pysam_7libcbcf_19VariantRecordFilter_26iteritems, "VariantRecordFilter.iteritems(self)\n\nD.iteritems() -> an iterator over the (key, value) items of D");
static PyMethodDef __pyx_mdef_5pysam_7libcbcf_19VariantRecordFilter_27iteritems = {"iteritems", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_5pysam_7libcbcf_19VariantRecordFilter_27iteritems, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_5pysam_7libcbcf_19VariantRecordFilter_26iteritems};
static PyObject *__pyx_pw_5pysam_7libcbcf_19VariantRecordFilter_27iteritems(PyObject *__pyx_v_self, 
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
) {
  #if !CYTHON_METH_FASTCALL
  CYTHON_UNUSED Py_ssize_t __pyx_nargs;
  #endif
  CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("iteritems (wrapper)", 0);
  #if !CYTHON_METH_FASTCALL
  #if CYTHON_ASSUME_SAFE_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("iteritems", 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("iteritems", __pyx_kwds); return NULL;}
  __pyx_r = __pyx_pf_5pysam_7libcbcf_19VariantRecordFilter_26iteritems(((struct __pyx_obj_5pysam_7libcbcf_VariantRecordFilter *)__pyx_v_self));

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

static PyObject *__pyx_pf_5pysam_7libcbcf_19VariantRecordFilter_26iteritems(struct __pyx_obj_5pysam_7libcbcf_VariantRecordFilter *__pyx_v_self) {
  struct __pyx_obj_5pysam_7libcbcf___pyx_scope_struct_20_iteritems *__pyx_cur_scope;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("iteritems", 0);
  __pyx_cur_scope = (struct __pyx_obj_5pysam_7libcbcf___pyx_scope_struct_20_iteritems *)__pyx_tp_new_5pysam_7libcbcf___pyx_scope_struct_20_iteritems(__pyx_mstate_global->__pyx_ptype_5pysam_7libcbcf___pyx_scope_struct_20_iteritems, __pyx_mstate_global->__pyx_empty_tuple, NULL);
  if (unlikely(!__pyx_cur_scope)) {
    __pyx_cur_scope = ((struct __pyx_obj_5pysam_7libcbcf___pyx_scope_struct_20_iteritems *)Py_None);
    __Pyx_INCREF(Py_None);
    __PYX_ERR(0, 2353, __pyx_L1_error)
  } else {
    __Pyx_GOTREF((PyObject *)__pyx_cur_scope);
  }
  __pyx_cur_scope->__pyx_v_self = __pyx_v_self;
  __Pyx_INCREF((PyObject *)__pyx_cur_scope->__pyx_v_self);
  __Pyx_GIVEREF((PyObject *)__pyx_cur_scope->__pyx_v_self);
  {
    __pyx_CoroutineObject *gen = __Pyx_Generator_New((__pyx_coroutine_body_t) __pyx_gb_5pysam_7libcbcf_19VariantRecordFilter_28generator13, ((PyObject *)__pyx_mstate_global->__pyx_codeobj_tab[179]), (PyObject *) __pyx_cur_scope, __pyx_mstate_global->__pyx_n_u_iteritems, __pyx_mstate_global->__pyx_n_u_VariantRecordFilter_iteritems, __pyx_mstate_global->__pyx_n_u_pysam_libcbcf); if (unlikely(!gen)) __PYX_ERR(0, 2353, __pyx_L1_error)
    __Pyx_DECREF(__pyx_cur_scope);
    __Pyx_RefNannyFinishContext();
    return (PyObject *) gen;
  }

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_AddTraceback("pysam.libcbcf.VariantRecordFilter.iteritems", __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_5pysam_7libcbcf_19VariantRecordFilter_28generator13(__pyx_CoroutineObject *__pyx_generator, CYTHON_UNUSED PyThreadState *__pyx_tstate, PyObject *__pyx_sent_value) /* generator body */
{
  struct __pyx_obj_5pysam_7libcbcf___pyx_scope_struct_20_iteritems *__pyx_cur_scope = ((struct __pyx_obj_5pysam_7libcbcf___pyx_scope_struct_20_iteritems *)__pyx_generator->closure);
  PyObject *__pyx_r = NULL;
  __Pyx_TraceDeclarationsGen
  PyObject *__pyx_t_1 = NULL;
  Py_ssize_t __pyx_t_2;
  PyObject *(*__pyx_t_3)(PyObject *);
  PyObject *__pyx_t_4 = NULL;
  PyObject *__pyx_t_5 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("iteritems", 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_TraceStartGen("iteritems", __pyx_f[0], 2353, 0, 0, 0, __PYX_ERR(0, 2353, __pyx_L1_error));
    __Pyx_TraceReturnValue(Py_None, 0, 0, __PYX_ERR(0, 2353, __pyx_L1_error));
    __Pyx_RefNannyFinishContext();
    return NULL;
  }
  __pyx_L3_first_run:;
  __Pyx_TraceStartGen("iteritems", __pyx_f[0], 2353, 0, 0, 0, __PYX_ERR(0, 2353, __pyx_L1_error));
  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, 2353, __pyx_L1_error)
  }

  /* "pysam/libcbcf.pyx":2355
 *     def iteritems(self):
 *         """D.iteritems() -> an iterator over the (key, value) items of D"""
 *         for key in self:             # <<<<<<<<<<<<<<
 *             yield (key, self[key])
 * 
*/
  if (likely(PyList_CheckExact(((PyObject *)__pyx_cur_scope->__pyx_v_self))) || PyTuple_CheckExact(((PyObject *)__pyx_cur_scope->__pyx_v_self))) {
    __pyx_t_1 = ((PyObject *)__pyx_cur_scope->__pyx_v_self); __Pyx_INCREF(__pyx_t_1);
    __pyx_t_2 = 0;
    __pyx_t_3 = NULL;
  } else {
    __pyx_t_2 = -1; __pyx_t_1 = PyObject_GetIter(((PyObject *)__pyx_cur_scope->__pyx_v_self)); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 2355, __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, 2355, __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, 2355, __pyx_L1_error)
          #endif
          if (__pyx_t_2 >= __pyx_temp) break;
        }
        __pyx_t_4 = __Pyx_PyList_GetItemRef(__pyx_t_1, __pyx_t_2);
        ++__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, 2355, __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, 2355, __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, 2355, __pyx_L1_error)
          PyErr_Clear();
        }
        break;
      }
    }
    __Pyx_GOTREF(__pyx_t_4);
    __Pyx_XGOTREF(__pyx_cur_scope->__pyx_v_key);
    __Pyx_XDECREF_SET(__pyx_cur_scope->__pyx_v_key, __pyx_t_4);
    __Pyx_GIVEREF(__pyx_t_4);
    __pyx_t_4 = 0;

    /* "pysam/libcbcf.pyx":2356
 *         """D.iteritems() -> an iterator over the (key, value) items of D"""
 *         for key in self:
 *             yield (key, self[key])             # <<<<<<<<<<<<<<
 * 
 *     def keys(self):
*/
    __pyx_t_4 = __Pyx_PyObject_GetItem(((PyObject *)__pyx_cur_scope->__pyx_v_self), __pyx_cur_scope->__pyx_v_key); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 2356, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
    __pyx_t_5 = PyTuple_New(2); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 2356, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_5);
    __Pyx_INCREF(__pyx_cur_scope->__pyx_v_key);
    __Pyx_GIVEREF(__pyx_cur_scope->__pyx_v_key);
    if (__Pyx_PyTuple_SET_ITEM(__pyx_t_5, 0, __pyx_cur_scope->__pyx_v_key) != (0)) __PYX_ERR(0, 2356, __pyx_L1_error);
    __Pyx_GIVEREF(__pyx_t_4);
    if (__Pyx_PyTuple_SET_ITEM(__pyx_t_5, 1, __pyx_t_4) != (0)) __PYX_ERR(0, 2356, __pyx_L1_error);
    __pyx_t_4 = 0;
    __pyx_r = __pyx_t_5;
    __pyx_t_5 = 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_TraceYield(__pyx_r, 0, __PYX_ERR(0, 2356, __pyx_L1_error));
    __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_TraceResumeGen("iteritems", __pyx_f[0], 2353, 0, __PYX_ERR(0, 2356, __pyx_L1_error));
    __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, 2356, __pyx_L1_error)

    /* "pysam/libcbcf.pyx":2355
 *     def iteritems(self):
 *         """D.iteritems() -> an iterator over the (key, value) items of D"""
 *         for key in self:             # <<<<<<<<<<<<<<
 *             yield (key, self[key])
 * 
*/
  }
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  CYTHON_MAYBE_UNUSED_VAR(__pyx_cur_scope);
  __Pyx_TraceReturnValue(Py_None, 0, 0, __PYX_ERR(0, 2353, __pyx_L1_error));

  /* "pysam/libcbcf.pyx":2353
 *             yield self[key]
 * 
 *     def iteritems(self):             # <<<<<<<<<<<<<<
 *         """D.iteritems() -> an iterator over the (key, value) items of D"""
 *         for key in self:
*/

  /* 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);
  if (__Pyx_PyErr_Occurred()) {
    __Pyx_TraceException(__pyx_lineno, 0, 0);
    __Pyx_Generator_Replace_StopIteration(0);
    __Pyx_AddTraceback("iteritems", __pyx_clineno, __pyx_lineno, __pyx_filename);
    __Pyx_TraceExceptionUnwind(0, 0);
  }
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_PyMonitoring_ExitScope(0);
  #if !CYTHON_USE_EXC_INFO_STACK
  __Pyx_Coroutine_ResetAndClearException(__pyx_generator);
  #endif
  __pyx_generator->resume_label = -1;
  __Pyx_Coroutine_clear((PyObject*)__pyx_generator);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "pysam/libcbcf.pyx":2358
 *             yield (key, self[key])
 * 
 *     def keys(self):             # <<<<<<<<<<<<<<
 *         """D.keys() -> list of D's keys"""
 *         return list(self)
*/

/* Python wrapper */
static PyObject *__pyx_pw_5pysam_7libcbcf_19VariantRecordFilter_30keys(PyObject *__pyx_v_self, 
#if 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_5pysam_7libcbcf_19VariantRecordFilter_29keys, "VariantRecordFilter.keys(self)\n\nD.keys() -> list of D's keys");
static PyMethodDef __pyx_mdef_5pysam_7libcbcf_19VariantRecordFilter_30keys = {"keys", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_5pysam_7libcbcf_19VariantRecordFilter_30keys, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_5pysam_7libcbcf_19VariantRecordFilter_29keys};
static PyObject *__pyx_pw_5pysam_7libcbcf_19VariantRecordFilter_30keys(PyObject *__pyx_v_self, 
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
) {
  #if !CYTHON_METH_FASTCALL
  CYTHON_UNUSED Py_ssize_t __pyx_nargs;
  #endif
  CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("keys (wrapper)", 0);
  #if !CYTHON_METH_FASTCALL
  #if CYTHON_ASSUME_SAFE_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("keys", 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("keys", __pyx_kwds); return NULL;}
  __pyx_r = __pyx_pf_5pysam_7libcbcf_19VariantRecordFilter_29keys(((struct __pyx_obj_5pysam_7libcbcf_VariantRecordFilter *)__pyx_v_self));

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

static PyObject *__pyx_pf_5pysam_7libcbcf_19VariantRecordFilter_29keys(struct __pyx_obj_5pysam_7libcbcf_VariantRecordFilter *__pyx_v_self) {
  PyObject *__pyx_r = NULL;
  __Pyx_TraceDeclarationsFunc
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_TraceFrameInit(((PyObject *)__pyx_mstate_global->__pyx_codeobj_tab[180]))
  __Pyx_RefNannySetupContext("keys", 0);
  __Pyx_TraceStartFunc("keys", __pyx_f[0], 2358, 0, 0, 0, __PYX_ERR(0, 2358, __pyx_L1_error));

  /* "pysam/libcbcf.pyx":2360
 *     def keys(self):
 *         """D.keys() -> list of D's keys"""
 *         return list(self)             # <<<<<<<<<<<<<<
 * 
 *     def items(self):
*/
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = PySequence_List(((PyObject *)__pyx_v_self)); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 2360, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  __Pyx_TraceReturnValue(__pyx_r, 1, 0, __PYX_ERR(0, 2360, __pyx_L1_error));
  goto __pyx_L0;

  /* "pysam/libcbcf.pyx":2358
 *             yield (key, self[key])
 * 
 *     def keys(self):             # <<<<<<<<<<<<<<
 *         """D.keys() -> list of D's keys"""
 *         return list(self)
*/

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_TraceException(__pyx_lineno, 0, 0);
  #if CYTHON_USE_SYS_MONITORING
  __Pyx_TraceExceptionUnwind(0, 0);
  #else
  __Pyx_TraceReturnValue(NULL, 0, 0, __PYX_ERR(0, 2358, __pyx_L1_error));
  #endif
  __Pyx_AddTraceback("pysam.libcbcf.VariantRecordFilter.keys", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_PyMonitoring_ExitScope(0);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "pysam/libcbcf.pyx":2362
 *         return list(self)
 * 
 *     def items(self):             # <<<<<<<<<<<<<<
 *         """D.items() -> list of D's (key, value) pairs, as 2-tuples"""
 *         return list(self.iteritems())
*/

/* Python wrapper */
static PyObject *__pyx_pw_5pysam_7libcbcf_19VariantRecordFilter_32items(PyObject *__pyx_v_self, 
#if 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_5pysam_7libcbcf_19VariantRecordFilter_31items, "VariantRecordFilter.items(self)\n\nD.items() -> list of D's (key, value) pairs, as 2-tuples");
static PyMethodDef __pyx_mdef_5pysam_7libcbcf_19VariantRecordFilter_32items = {"items", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_5pysam_7libcbcf_19VariantRecordFilter_32items, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_5pysam_7libcbcf_19VariantRecordFilter_31items};
static PyObject *__pyx_pw_5pysam_7libcbcf_19VariantRecordFilter_32items(PyObject *__pyx_v_self, 
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
) {
  #if !CYTHON_METH_FASTCALL
  CYTHON_UNUSED Py_ssize_t __pyx_nargs;
  #endif
  CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("items (wrapper)", 0);
  #if !CYTHON_METH_FASTCALL
  #if CYTHON_ASSUME_SAFE_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("items", 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("items", __pyx_kwds); return NULL;}
  __pyx_r = __pyx_pf_5pysam_7libcbcf_19VariantRecordFilter_31items(((struct __pyx_obj_5pysam_7libcbcf_VariantRecordFilter *)__pyx_v_self));

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

static PyObject *__pyx_pf_5pysam_7libcbcf_19VariantRecordFilter_31items(struct __pyx_obj_5pysam_7libcbcf_VariantRecordFilter *__pyx_v_self) {
  PyObject *__pyx_r = NULL;
  __Pyx_TraceDeclarationsFunc
  __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_TraceFrameInit(((PyObject *)__pyx_mstate_global->__pyx_codeobj_tab[181]))
  __Pyx_RefNannySetupContext("items", 0);
  __Pyx_TraceStartFunc("items", __pyx_f[0], 2362, 0, 0, 0, __PYX_ERR(0, 2362, __pyx_L1_error));

  /* "pysam/libcbcf.pyx":2364
 *     def items(self):
 *         """D.items() -> list of D's (key, value) pairs, as 2-tuples"""
 *         return list(self.iteritems())             # <<<<<<<<<<<<<<
 * 
 *     def values(self):
*/
  __Pyx_XDECREF(__pyx_r);
  __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(__pyx_mstate_global->__pyx_n_u_iteritems, __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, 2364, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
  }
  __pyx_t_2 = __Pyx_PySequence_ListKeepNew(__pyx_t_1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 2364, __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;
  __Pyx_TraceReturnValue(__pyx_r, 1, 0, __PYX_ERR(0, 2364, __pyx_L1_error));
  goto __pyx_L0;

  /* "pysam/libcbcf.pyx":2362
 *         return list(self)
 * 
 *     def items(self):             # <<<<<<<<<<<<<<
 *         """D.items() -> list of D's (key, value) pairs, as 2-tuples"""
 *         return list(self.iteritems())
*/

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_TraceException(__pyx_lineno, 0, 0);
  #if CYTHON_USE_SYS_MONITORING
  __Pyx_TraceExceptionUnwind(0, 0);
  #else
  __Pyx_TraceReturnValue(NULL, 0, 0, __PYX_ERR(0, 2362, __pyx_L1_error));
  #endif
  __Pyx_AddTraceback("pysam.libcbcf.VariantRecordFilter.items", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_PyMonitoring_ExitScope(0);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "pysam/libcbcf.pyx":2366
 *         return list(self.iteritems())
 * 
 *     def values(self):             # <<<<<<<<<<<<<<
 *         """D.values() -> list of D's values"""
 *         return list(self.itervalues())
*/

/* Python wrapper */
static PyObject *__pyx_pw_5pysam_7libcbcf_19VariantRecordFilter_34values(PyObject *__pyx_v_self, 
#if 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_5pysam_7libcbcf_19VariantRecordFilter_33values, "VariantRecordFilter.values(self)\n\nD.values() -> list of D's values");
static PyMethodDef __pyx_mdef_5pysam_7libcbcf_19VariantRecordFilter_34values = {"values", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_5pysam_7libcbcf_19VariantRecordFilter_34values, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_5pysam_7libcbcf_19VariantRecordFilter_33values};
static PyObject *__pyx_pw_5pysam_7libcbcf_19VariantRecordFilter_34values(PyObject *__pyx_v_self, 
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
) {
  #if !CYTHON_METH_FASTCALL
  CYTHON_UNUSED Py_ssize_t __pyx_nargs;
  #endif
  CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("values (wrapper)", 0);
  #if !CYTHON_METH_FASTCALL
  #if CYTHON_ASSUME_SAFE_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("values", 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("values", __pyx_kwds); return NULL;}
  __pyx_r = __pyx_pf_5pysam_7libcbcf_19VariantRecordFilter_33values(((struct __pyx_obj_5pysam_7libcbcf_VariantRecordFilter *)__pyx_v_self));

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

static PyObject *__pyx_pf_5pysam_7libcbcf_19VariantRecordFilter_33values(struct __pyx_obj_5pysam_7libcbcf_VariantRecordFilter *__pyx_v_self) {
  PyObject *__pyx_r = NULL;
  __Pyx_TraceDeclarationsFunc
  __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_TraceFrameInit(((PyObject *)__pyx_mstate_global->__pyx_codeobj_tab[182]))
  __Pyx_RefNannySetupContext("values", 0);
  __Pyx_TraceStartFunc("values", __pyx_f[0], 2366, 0, 0, 0, __PYX_ERR(0, 2366, __pyx_L1_error));

  /* "pysam/libcbcf.pyx":2368
 *     def values(self):
 *         """D.values() -> list of D's values"""
 *         return list(self.itervalues())             # <<<<<<<<<<<<<<
 * 
 *     def __richcmp__(VariantRecordFilter self not None, VariantRecordFilter other not None, int op):
*/
  __Pyx_XDECREF(__pyx_r);
  __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(__pyx_mstate_global->__pyx_n_u_itervalues, __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, 2368, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
  }
  __pyx_t_2 = __Pyx_PySequence_ListKeepNew(__pyx_t_1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 2368, __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;
  __Pyx_TraceReturnValue(__pyx_r, 1, 0, __PYX_ERR(0, 2368, __pyx_L1_error));
  goto __pyx_L0;

  /* "pysam/libcbcf.pyx":2366
 *         return list(self.iteritems())
 * 
 *     def values(self):             # <<<<<<<<<<<<<<
 *         """D.values() -> list of D's values"""
 *         return list(self.itervalues())
*/

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_TraceException(__pyx_lineno, 0, 0);
  #if CYTHON_USE_SYS_MONITORING
  __Pyx_TraceExceptionUnwind(0, 0);
  #else
  __Pyx_TraceReturnValue(NULL, 0, 0, __PYX_ERR(0, 2366, __pyx_L1_error));
  #endif
  __Pyx_AddTraceback("pysam.libcbcf.VariantRecordFilter.values", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_PyMonitoring_ExitScope(0);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "pysam/libcbcf.pyx":2370
 *         return list(self.itervalues())
 * 
 *     def __richcmp__(VariantRecordFilter self not None, VariantRecordFilter other not None, int op):             # <<<<<<<<<<<<<<
 *         if op != 2 and op != 3:
 *             return NotImplemented
*/

/* Python wrapper */
static PyObject *__pyx_pw_5pysam_7libcbcf_19VariantRecordFilter_36__richcmp__(PyObject *__pyx_v_self, PyObject *__pyx_v_other, int __pyx_v_op); /*proto*/
static PyObject *__pyx_pw_5pysam_7libcbcf_19VariantRecordFilter_36__richcmp__(PyObject *__pyx_v_self, PyObject *__pyx_v_other, int __pyx_v_op) {
  CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__richcmp__ (wrapper)", 0);
  __pyx_kwvalues = __Pyx_KwValues_VARARGS(__pyx_args, __pyx_nargs);
  if (unlikely(((PyObject *)__pyx_v_self) == Py_None)) {
    PyErr_Format(PyExc_TypeError, "Argument '%.200s' must not be None", "self"); __PYX_ERR(0, 2370, __pyx_L1_error)
  }
  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_other), __pyx_mstate_global->__pyx_ptype_5pysam_7libcbcf_VariantRecordFilter, 0, "other", 0))) __PYX_ERR(0, 2370, __pyx_L1_error)
  __pyx_r = __pyx_pf_5pysam_7libcbcf_19VariantRecordFilter_35__richcmp__(((struct __pyx_obj_5pysam_7libcbcf_VariantRecordFilter *)__pyx_v_self), ((struct __pyx_obj_5pysam_7libcbcf_VariantRecordFilter *)__pyx_v_other), ((int)__pyx_v_op));

  /* function exit code */
  goto __pyx_L0;
  __pyx_L1_error:;
  __pyx_r = NULL;
  goto __pyx_L5_cleaned_up;
  __pyx_L0:;
  __pyx_L5_cleaned_up:;
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_5pysam_7libcbcf_19VariantRecordFilter_35__richcmp__(struct __pyx_obj_5pysam_7libcbcf_VariantRecordFilter *__pyx_v_self, struct __pyx_obj_5pysam_7libcbcf_VariantRecordFilter *__pyx_v_other, int __pyx_v_op) {
  bcf1_t *__pyx_v_s;
  bcf1_t *__pyx_v_o;
  int __pyx_v_cmp;
  PyObject *__pyx_r = NULL;
  __Pyx_TraceDeclarationsFunc
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  bcf1_t *__pyx_t_2;
  int __pyx_t_3;
  PyObject *__pyx_t_4 = NULL;
  PyObject *__pyx_t_5 = NULL;
  PyObject *__pyx_t_6 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_TraceFrameInit(((PyObject *)__pyx_mstate_global->__pyx_codeobj_tab[183]))
  __Pyx_RefNannySetupContext("__richcmp__", 0);
  __Pyx_TraceStartFunc("__richcmp__", __pyx_f[0], 2370, 0, 0, 0, __PYX_ERR(0, 2370, __pyx_L1_error));

  /* "pysam/libcbcf.pyx":2371
 * 
 *     def __richcmp__(VariantRecordFilter self not None, VariantRecordFilter other not None, int op):
 *         if op != 2 and op != 3:             # <<<<<<<<<<<<<<
 *             return NotImplemented
 * 
*/
  switch (__pyx_v_op) {
    case 2:
    case 3:
    __pyx_t_1 = 0;
    break;
    default:
    __pyx_t_1 = 1;
    break;
  }
  if (__pyx_t_1) {

    /* "pysam/libcbcf.pyx":2372
 *     def __richcmp__(VariantRecordFilter self not None, VariantRecordFilter other not None, int op):
 *         if op != 2 and op != 3:
 *             return NotImplemented             # <<<<<<<<<<<<<<
 * 
 *         cdef bcf1_t *s = self.record.ptr
*/
    __Pyx_XDECREF(__pyx_r);
    __Pyx_INCREF(__pyx_builtin_NotImplemented);
    __pyx_r = __pyx_builtin_NotImplemented;
    __Pyx_TraceReturnValue(__pyx_r, 9, 0, __PYX_ERR(0, 2372, __pyx_L1_error));
    goto __pyx_L0;

    /* "pysam/libcbcf.pyx":2371
 * 
 *     def __richcmp__(VariantRecordFilter self not None, VariantRecordFilter other not None, int op):
 *         if op != 2 and op != 3:             # <<<<<<<<<<<<<<
 *             return NotImplemented
 * 
*/
  }

  /* "pysam/libcbcf.pyx":2374
 *             return NotImplemented
 * 
 *         cdef bcf1_t *s = self.record.ptr             # <<<<<<<<<<<<<<
 *         cdef bcf1_t *o = other.record.ptr
 * 
*/
  __pyx_t_2 = __pyx_v_self->record->ptr;
  __pyx_v_s = __pyx_t_2;

  /* "pysam/libcbcf.pyx":2375
 * 
 *         cdef bcf1_t *s = self.record.ptr
 *         cdef bcf1_t *o = other.record.ptr             # <<<<<<<<<<<<<<
 * 
 *         cdef bint cmp = (s.d.n_flt == o.d.n_flt and list(self) == list(other))
*/
  __pyx_t_2 = __pyx_v_other->record->ptr;
  __pyx_v_o = __pyx_t_2;

  /* "pysam/libcbcf.pyx":2377
 *         cdef bcf1_t *o = other.record.ptr
 * 
 *         cdef bint cmp = (s.d.n_flt == o.d.n_flt and list(self) == list(other))             # <<<<<<<<<<<<<<
 * 
 *         if op == 3:
*/
  __pyx_t_3 = (__pyx_v_s->d.n_flt == __pyx_v_o->d.n_flt);
  if (__pyx_t_3) {
  } else {
    __pyx_t_1 = __pyx_t_3;
    goto __pyx_L4_bool_binop_done;
  }
  __pyx_t_4 = PySequence_List(((PyObject *)__pyx_v_self)); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 2377, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  __pyx_t_5 = PySequence_List(((PyObject *)__pyx_v_other)); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 2377, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_5);
  __pyx_t_6 = PyObject_RichCompare(__pyx_t_4, __pyx_t_5, Py_EQ); __Pyx_XGOTREF(__pyx_t_6); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 2377, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  __pyx_t_3 = __Pyx_PyObject_IsTrue(__pyx_t_6); if (unlikely((__pyx_t_3 < 0))) __PYX_ERR(0, 2377, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
  __pyx_t_1 = __pyx_t_3;
  __pyx_L4_bool_binop_done:;
  __pyx_v_cmp = __pyx_t_1;

  /* "pysam/libcbcf.pyx":2379
 *         cdef bint cmp = (s.d.n_flt == o.d.n_flt and list(self) == list(other))
 * 
 *         if op == 3:             # <<<<<<<<<<<<<<
 *             cmp = not cmp
 * 
*/
  __pyx_t_1 = (__pyx_v_op == 3);
  if (__pyx_t_1) {

    /* "pysam/libcbcf.pyx":2380
 * 
 *         if op == 3:
 *             cmp = not cmp             # <<<<<<<<<<<<<<
 * 
 *         return cmp
*/
    __pyx_v_cmp = (!__pyx_v_cmp);

    /* "pysam/libcbcf.pyx":2379
 *         cdef bint cmp = (s.d.n_flt == o.d.n_flt and list(self) == list(other))
 * 
 *         if op == 3:             # <<<<<<<<<<<<<<
 *             cmp = not cmp
 * 
*/
  }

  /* "pysam/libcbcf.pyx":2382
 *             cmp = not cmp
 * 
 *         return cmp             # <<<<<<<<<<<<<<
 * 
 *     # Mappings are not hashable by default, but subclasses can change this
*/
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_6 = __Pyx_PyBool_FromLong(__pyx_v_cmp); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 2382, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_6);
  __pyx_r = __pyx_t_6;
  __pyx_t_6 = 0;
  __Pyx_TraceReturnValue(__pyx_r, 42, 0, __PYX_ERR(0, 2382, __pyx_L1_error));
  goto __pyx_L0;

  /* "pysam/libcbcf.pyx":2370
 *         return list(self.itervalues())
 * 
 *     def __richcmp__(VariantRecordFilter self not None, VariantRecordFilter other not None, int op):             # <<<<<<<<<<<<<<
 *         if op != 2 and op != 3:
 *             return NotImplemented
*/

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_XDECREF(__pyx_t_5);
  __Pyx_XDECREF(__pyx_t_6);
  __Pyx_TraceException(__pyx_lineno, 0, 0);
  #if CYTHON_USE_SYS_MONITORING
  __Pyx_TraceExceptionUnwind(0, 0);
  #else
  __Pyx_TraceReturnValue(NULL, 0, 0, __PYX_ERR(0, 2370, __pyx_L1_error));
  #endif
  __Pyx_AddTraceback("pysam.libcbcf.VariantRecordFilter.__richcmp__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_PyMonitoring_ExitScope(0);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

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

/* Python wrapper */
static PyObject *__pyx_pw_5pysam_7libcbcf_19VariantRecordFilter_38__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*/
PyDoc_STRVAR(__pyx_doc_5pysam_7libcbcf_19VariantRecordFilter_37__reduce_cython__, "VariantRecordFilter.__reduce_cython__(self)");
static PyMethodDef __pyx_mdef_5pysam_7libcbcf_19VariantRecordFilter_38__reduce_cython__ = {"__reduce_cython__", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_5pysam_7libcbcf_19VariantRecordFilter_38__reduce_cython__, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_5pysam_7libcbcf_19VariantRecordFilter_37__reduce_cython__};
static PyObject *__pyx_pw_5pysam_7libcbcf_19VariantRecordFilter_38__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_5pysam_7libcbcf_19VariantRecordFilter_37__reduce_cython__(((struct __pyx_obj_5pysam_7libcbcf_VariantRecordFilter *)__pyx_v_self));

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

static PyObject *__pyx_pf_5pysam_7libcbcf_19VariantRecordFilter_37__reduce_cython__(struct __pyx_obj_5pysam_7libcbcf_VariantRecordFilter *__pyx_v_self) {
  PyObject *__pyx_v_state = 0;
  PyObject *__pyx_v__dict = 0;
  int __pyx_v_use_setstate;
  PyObject *__pyx_r = NULL;
  __Pyx_TraceDeclarationsFunc
  __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_TraceFrameInit(((PyObject *)__pyx_mstate_global->__pyx_codeobj_tab[184]))
  __Pyx_RefNannySetupContext("__reduce_cython__", 0);
  __Pyx_TraceStartFunc("__reduce_cython__", __pyx_f[4], 1, 0, 0, 0, __PYX_ERR(4, 1, __pyx_L1_error));

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

  /* "(tree fragment)":6
 *     cdef bint use_setstate
 *     state = (self.record,)
 *     _dict = getattr(self, '__dict__', None)             # <<<<<<<<<<<<<<
 *     if _dict is not None:
 *         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(4, 6, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_v__dict = __pyx_t_1;
  __pyx_t_1 = 0;

  /* "(tree fragment)":7
 *     state = (self.record,)
 *     _dict = getattr(self, '__dict__', None)
 *     if _dict is not None:             # <<<<<<<<<<<<<<
 *         state += (_dict,)
 *         use_setstate = True
*/
  __pyx_t_2 = (__pyx_v__dict != Py_None);
  if (__pyx_t_2) {

    /* "(tree fragment)":8
 *     _dict = getattr(self, '__dict__', None)
 *     if _dict is not None:
 *         state += (_dict,)             # <<<<<<<<<<<<<<
 *         use_setstate = True
 *     else:
*/
    __pyx_t_1 = PyTuple_New(1); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 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(4, 8, __pyx_L1_error);
    __pyx_t_3 = PyNumber_InPlaceAdd(__pyx_v_state, __pyx_t_1); if (unlikely(!__pyx_t_3)) __PYX_ERR(4, 8, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    __Pyx_DECREF_SET(__pyx_v_state, ((PyObject*)__pyx_t_3));
    __pyx_t_3 = 0;

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

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

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

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

    /* "(tree fragment)":13
 *         use_setstate = self.record is not None
 *     if use_setstate:
 *         return __pyx_unpickle_VariantRecordFilter, (type(self), 0x70ce871, None), state             # <<<<<<<<<<<<<<
 *     else:
 *         return __pyx_unpickle_VariantRecordFilter, (type(self), 0x70ce871, state)
*/
    __Pyx_XDECREF(__pyx_r);
    __Pyx_GetModuleGlobalName(__pyx_t_3, __pyx_mstate_global->__pyx_n_u_pyx_unpickle_VariantRecordFilt); if (unlikely(!__pyx_t_3)) __PYX_ERR(4, 13, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __pyx_t_1 = PyTuple_New(3); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 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(4, 13, __pyx_L1_error);
    __Pyx_INCREF(__pyx_mstate_global->__pyx_int_118286449);
    __Pyx_GIVEREF(__pyx_mstate_global->__pyx_int_118286449);
    if (__Pyx_PyTuple_SET_ITEM(__pyx_t_1, 1, __pyx_mstate_global->__pyx_int_118286449) != (0)) __PYX_ERR(4, 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(4, 13, __pyx_L1_error);
    __pyx_t_4 = PyTuple_New(3); if (unlikely(!__pyx_t_4)) __PYX_ERR(4, 13, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
    __Pyx_GIVEREF(__pyx_t_3);
    if (__Pyx_PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_t_3) != (0)) __PYX_ERR(4, 13, __pyx_L1_error);
    __Pyx_GIVEREF(__pyx_t_1);
    if (__Pyx_PyTuple_SET_ITEM(__pyx_t_4, 1, __pyx_t_1) != (0)) __PYX_ERR(4, 13, __pyx_L1_error);
    __Pyx_INCREF(__pyx_v_state);
    __Pyx_GIVEREF(__pyx_v_state);
    if (__Pyx_PyTuple_SET_ITEM(__pyx_t_4, 2, __pyx_v_state) != (0)) __PYX_ERR(4, 13, __pyx_L1_error);
    __pyx_t_3 = 0;
    __pyx_t_1 = 0;
    __pyx_r = __pyx_t_4;
    __pyx_t_4 = 0;
    __Pyx_TraceReturnValue(__pyx_r, 25, 0, __PYX_ERR(4, 13, __pyx_L1_error));
    goto __pyx_L0;

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

  /* "(tree fragment)":15
 *         return __pyx_unpickle_VariantRecordFilter, (type(self), 0x70ce871, None), state
 *     else:
 *         return __pyx_unpickle_VariantRecordFilter, (type(self), 0x70ce871, state)             # <<<<<<<<<<<<<<
 * def __setstate_cython__(self, __pyx_state):
 *     __pyx_unpickle_VariantRecordFilter__set_state(self, __pyx_state)
*/
  /*else*/ {
    __Pyx_XDECREF(__pyx_r);
    __Pyx_GetModuleGlobalName(__pyx_t_4, __pyx_mstate_global->__pyx_n_u_pyx_unpickle_VariantRecordFilt); if (unlikely(!__pyx_t_4)) __PYX_ERR(4, 15, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
    __pyx_t_1 = PyTuple_New(3); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 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(4, 15, __pyx_L1_error);
    __Pyx_INCREF(__pyx_mstate_global->__pyx_int_118286449);
    __Pyx_GIVEREF(__pyx_mstate_global->__pyx_int_118286449);
    if (__Pyx_PyTuple_SET_ITEM(__pyx_t_1, 1, __pyx_mstate_global->__pyx_int_118286449) != (0)) __PYX_ERR(4, 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(4, 15, __pyx_L1_error);
    __pyx_t_3 = PyTuple_New(2); if (unlikely(!__pyx_t_3)) __PYX_ERR(4, 15, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __Pyx_GIVEREF(__pyx_t_4);
    if (__Pyx_PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_t_4) != (0)) __PYX_ERR(4, 15, __pyx_L1_error);
    __Pyx_GIVEREF(__pyx_t_1);
    if (__Pyx_PyTuple_SET_ITEM(__pyx_t_3, 1, __pyx_t_1) != (0)) __PYX_ERR(4, 15, __pyx_L1_error);
    __pyx_t_4 = 0;
    __pyx_t_1 = 0;
    __pyx_r = __pyx_t_3;
    __pyx_t_3 = 0;
    __Pyx_TraceReturnValue(__pyx_r, 33, 0, __PYX_ERR(4, 15, __pyx_L1_error));
    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_3);
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_TraceException(__pyx_lineno, 0, 0);
  #if CYTHON_USE_SYS_MONITORING
  __Pyx_TraceExceptionUnwind(0, 0);
  #else
  __Pyx_TraceReturnValue(NULL, 0, 0, __PYX_ERR(4, 1, __pyx_L1_error));
  #endif
  __Pyx_AddTraceback("pysam.libcbcf.VariantRecordFilter.__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_PyMonitoring_ExitScope(0);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "(tree fragment)":16
 *     else:
 *         return __pyx_unpickle_VariantRecordFilter, (type(self), 0x70ce871, state)
 * def __setstate_cython__(self, __pyx_state):             # <<<<<<<<<<<<<<
 *     __pyx_unpickle_VariantRecordFilter__set_state(self, __pyx_state)
*/

/* Python wrapper */
static PyObject *__pyx_pw_5pysam_7libcbcf_19VariantRecordFilter_40__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*/
PyDoc_STRVAR(__pyx_doc_5pysam_7libcbcf_19VariantRecordFilter_39__setstate_cython__, "VariantRecordFilter.__setstate_cython__(self, __pyx_state)");
static PyMethodDef __pyx_mdef_5pysam_7libcbcf_19VariantRecordFilter_40__setstate_cython__ = {"__setstate_cython__", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_5pysam_7libcbcf_19VariantRecordFilter_40__setstate_cython__, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_5pysam_7libcbcf_19VariantRecordFilter_39__setstate_cython__};
static PyObject *__pyx_pw_5pysam_7libcbcf_19VariantRecordFilter_40__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(4, 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(4, 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(4, 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(4, 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(4, 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(4, 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("pysam.libcbcf.VariantRecordFilter.__setstate_cython__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_5pysam_7libcbcf_19VariantRecordFilter_39__setstate_cython__(((struct __pyx_obj_5pysam_7libcbcf_VariantRecordFilter *)__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_5pysam_7libcbcf_19VariantRecordFilter_39__setstate_cython__(struct __pyx_obj_5pysam_7libcbcf_VariantRecordFilter *__pyx_v_self, PyObject *__pyx_v___pyx_state) {
  PyObject *__pyx_r = NULL;
  __Pyx_TraceDeclarationsFunc
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_TraceFrameInit(((PyObject *)__pyx_mstate_global->__pyx_codeobj_tab[185]))
  __Pyx_RefNannySetupContext("__setstate_cython__", 0);
  __Pyx_TraceStartFunc("__setstate_cython__", __pyx_f[4], 16, 0, 0, 0, __PYX_ERR(4, 16, __pyx_L1_error));

  /* "(tree fragment)":17
 *         return __pyx_unpickle_VariantRecordFilter, (type(self), 0x70ce871, state)
 * def __setstate_cython__(self, __pyx_state):
 *     __pyx_unpickle_VariantRecordFilter__set_state(self, __pyx_state)             # <<<<<<<<<<<<<<
*/
  if (!(likely(PyTuple_CheckExact(__pyx_v___pyx_state))||((__pyx_v___pyx_state) == Py_None) || __Pyx_RaiseUnexpectedTypeError("tuple", __pyx_v___pyx_state))) __PYX_ERR(4, 17, __pyx_L1_error)
  __pyx_t_1 = __pyx_f_5pysam_7libcbcf___pyx_unpickle_VariantRecordFilter__set_state(__pyx_v_self, ((PyObject*)__pyx_v___pyx_state)); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 17, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "(tree fragment)":16
 *     else:
 *         return __pyx_unpickle_VariantRecordFilter, (type(self), 0x70ce871, state)
 * def __setstate_cython__(self, __pyx_state):             # <<<<<<<<<<<<<<
 *     __pyx_unpickle_VariantRecordFilter__set_state(self, __pyx_state)
*/

  /* function exit code */
  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  __Pyx_TraceReturnValue(__pyx_r, 0, 0, __PYX_ERR(4, 16, __pyx_L1_error));
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_TraceException(__pyx_lineno, 0, 0);
  #if CYTHON_USE_SYS_MONITORING
  __Pyx_TraceExceptionUnwind(0, 0);
  #else
  __Pyx_TraceReturnValue(NULL, 0, 0, __PYX_ERR(4, 16, __pyx_L1_error));
  #endif
  __Pyx_AddTraceback("pysam.libcbcf.VariantRecordFilter.__setstate_cython__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_PyMonitoring_ExitScope(0);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "pysam/libcbcf.pyx":2390
 * 
 * 
 * cdef VariantRecordFilter makeVariantRecordFilter(VariantRecord record):             # <<<<<<<<<<<<<<
 *     if not record:
 *         raise ValueError('invalid VariantRecord')
*/

static struct __pyx_obj_5pysam_7libcbcf_VariantRecordFilter *__pyx_f_5pysam_7libcbcf_makeVariantRecordFilter(struct __pyx_obj_5pysam_7libcbcf_VariantRecord *__pyx_v_record) {
  struct __pyx_obj_5pysam_7libcbcf_VariantRecordFilter *__pyx_v_filter = 0;
  struct __pyx_obj_5pysam_7libcbcf_VariantRecordFilter *__pyx_r = NULL;
  __Pyx_TraceDeclarationsFunc
  __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_TraceFrameInit(((PyObject *)__pyx_mstate_global->__pyx_codeobj_tab[186]))
  __Pyx_RefNannySetupContext("makeVariantRecordFilter", 0);
  __Pyx_TraceStartFunc("makeVariantRecordFilter", __pyx_f[0], 2390, 0, 0, 0, __PYX_ERR(0, 2390, __pyx_L1_error));

  /* "pysam/libcbcf.pyx":2391
 * 
 * cdef VariantRecordFilter makeVariantRecordFilter(VariantRecord record):
 *     if not record:             # <<<<<<<<<<<<<<
 *         raise ValueError('invalid VariantRecord')
 * 
*/
  __pyx_t_1 = __Pyx_PyObject_IsTrue(((PyObject *)__pyx_v_record)); if (unlikely((__pyx_t_1 < 0))) __PYX_ERR(0, 2391, __pyx_L1_error)
  __pyx_t_2 = (!__pyx_t_1);
  if (unlikely(__pyx_t_2)) {

    /* "pysam/libcbcf.pyx":2392
 * cdef VariantRecordFilter makeVariantRecordFilter(VariantRecord record):
 *     if not record:
 *         raise ValueError('invalid VariantRecord')             # <<<<<<<<<<<<<<
 * 
 *     cdef VariantRecordFilter filter = VariantRecordFilter.__new__(VariantRecordFilter)
*/
    __pyx_t_4 = NULL;
    __Pyx_INCREF(__pyx_builtin_ValueError);
    __pyx_t_5 = __pyx_builtin_ValueError; 
    __pyx_t_6 = 1;
    {
      PyObject *__pyx_callargs[2] = {__pyx_t_4, __pyx_mstate_global->__pyx_kp_u_invalid_VariantRecord};
      __pyx_t_3 = __Pyx_PyObject_FastCall(__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, 2392, __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, 2392, __pyx_L1_error)

    /* "pysam/libcbcf.pyx":2391
 * 
 * cdef VariantRecordFilter makeVariantRecordFilter(VariantRecord record):
 *     if not record:             # <<<<<<<<<<<<<<
 *         raise ValueError('invalid VariantRecord')
 * 
*/
  }

  /* "pysam/libcbcf.pyx":2394
 *         raise ValueError('invalid VariantRecord')
 * 
 *     cdef VariantRecordFilter filter = VariantRecordFilter.__new__(VariantRecordFilter)             # <<<<<<<<<<<<<<
 *     filter.record = record
 * 
*/
  __pyx_t_3 = ((PyObject *)__pyx_tp_new_5pysam_7libcbcf_VariantRecordFilter(((PyTypeObject *)__pyx_mstate_global->__pyx_ptype_5pysam_7libcbcf_VariantRecordFilter), __pyx_mstate_global->__pyx_empty_tuple, NULL)); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 2394, __pyx_L1_error)
  __Pyx_GOTREF((PyObject *)__pyx_t_3);
  __pyx_v_filter = ((struct __pyx_obj_5pysam_7libcbcf_VariantRecordFilter *)__pyx_t_3);
  __pyx_t_3 = 0;

  /* "pysam/libcbcf.pyx":2395
 * 
 *     cdef VariantRecordFilter filter = VariantRecordFilter.__new__(VariantRecordFilter)
 *     filter.record = record             # <<<<<<<<<<<<<<
 * 
 *     return filter
*/
  __Pyx_INCREF((PyObject *)__pyx_v_record);
  __Pyx_GIVEREF((PyObject *)__pyx_v_record);
  __Pyx_GOTREF((PyObject *)__pyx_v_filter->record);
  __Pyx_DECREF((PyObject *)__pyx_v_filter->record);
  __pyx_v_filter->record = __pyx_v_record;

  /* "pysam/libcbcf.pyx":2397
 *     filter.record = record
 * 
 *     return filter             # <<<<<<<<<<<<<<
 * 
 * 
*/
  __Pyx_XDECREF((PyObject *)__pyx_r);
  __Pyx_INCREF((PyObject *)__pyx_v_filter);
  __pyx_r = __pyx_v_filter;
  __Pyx_TraceReturnValue((PyObject *)__pyx_r, 16, 0, __PYX_ERR(0, 2397, __pyx_L1_error));
  goto __pyx_L0;

  /* "pysam/libcbcf.pyx":2390
 * 
 * 
 * cdef VariantRecordFilter makeVariantRecordFilter(VariantRecord record):             # <<<<<<<<<<<<<<
 *     if not record:
 *         raise ValueError('invalid VariantRecord')
*/

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_XDECREF(__pyx_t_5);
  __Pyx_TraceException(__pyx_lineno, 0, 0);
  #if CYTHON_USE_SYS_MONITORING
  __Pyx_TraceExceptionUnwind(0, 0);
  #else
  __Pyx_TraceReturnValue(NULL, 0, 0, __PYX_ERR(0, 2390, __pyx_L1_error));
  #endif
  __Pyx_AddTraceback("pysam.libcbcf.makeVariantRecordFilter", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_XDECREF((PyObject *)__pyx_v_filter);
  __Pyx_XGIVEREF((PyObject *)__pyx_r);
  __Pyx_PyMonitoring_ExitScope(0);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "pysam/libcbcf.pyx":2403
 *     """Format data present for each sample in a :class:`VariantRecord` object,
 *        presented as mapping from format name to :class:`VariantMetadata` object."""
 *     def __init__(self, *args, **kwargs):             # <<<<<<<<<<<<<<
 *         raise TypeError('this class cannot be instantiated from Python')
 * 
*/

/* Python wrapper */
static int __pyx_pw_5pysam_7libcbcf_19VariantRecordFormat_1__init__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static int __pyx_pw_5pysam_7libcbcf_19VariantRecordFormat_1__init__(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("__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);
  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("__init__", __pyx_kwds) == -1)) return -1;
  }
  __Pyx_INCREF(__pyx_args);
  __pyx_v_args = __pyx_args;
  __pyx_r = __pyx_pf_5pysam_7libcbcf_19VariantRecordFormat___init__(((struct __pyx_obj_5pysam_7libcbcf_VariantRecordFormat *)__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_5pysam_7libcbcf_19VariantRecordFormat___init__(CYTHON_UNUSED struct __pyx_obj_5pysam_7libcbcf_VariantRecordFormat *__pyx_v_self, CYTHON_UNUSED PyObject *__pyx_v_args, CYTHON_UNUSED PyObject *__pyx_v_kwargs) {
  int __pyx_r;
  __Pyx_TraceDeclarationsFunc
  __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_TraceFrameInit(((PyObject *)__pyx_mstate_global->__pyx_codeobj_tab[187]))
  __Pyx_RefNannySetupContext("__init__", 0);
  __Pyx_TraceStartFunc("__init__", __pyx_f[0], 2403, 0, 0, 0, __PYX_ERR(0, 2403, __pyx_L1_error));

  /* "pysam/libcbcf.pyx":2404
 *        presented as mapping from format name to :class:`VariantMetadata` object."""
 *     def __init__(self, *args, **kwargs):
 *         raise TypeError('this class cannot be instantiated from Python')             # <<<<<<<<<<<<<<
 * 
 *     def __len__(self):
*/
  __pyx_t_2 = NULL;
  __Pyx_INCREF(__pyx_builtin_TypeError);
  __pyx_t_3 = __pyx_builtin_TypeError; 
  __pyx_t_4 = 1;
  {
    PyObject *__pyx_callargs[2] = {__pyx_t_2, __pyx_mstate_global->__pyx_kp_u_this_class_cannot_be_instantiate};
    __pyx_t_1 = __Pyx_PyObject_FastCall(__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, 2404, __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, 2404, __pyx_L1_error)

  /* "pysam/libcbcf.pyx":2403
 *     """Format data present for each sample in a :class:`VariantRecord` object,
 *        presented as mapping from format name to :class:`VariantMetadata` object."""
 *     def __init__(self, *args, **kwargs):             # <<<<<<<<<<<<<<
 *         raise TypeError('this class cannot be instantiated from Python')
 * 
*/

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_TraceException(__pyx_lineno, 0, 0);
  #if CYTHON_USE_SYS_MONITORING
  __Pyx_TraceExceptionUnwind(0, 0);
  #else
  __Pyx_TraceReturnValue(NULL, 0, 0, __PYX_ERR(0, 2403, __pyx_L1_error));
  #endif
  __Pyx_AddTraceback("pysam.libcbcf.VariantRecordFormat.__init__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = -1;
  __Pyx_PyMonitoring_ExitScope(0);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "pysam/libcbcf.pyx":2406
 *         raise TypeError('this class cannot be instantiated from Python')
 * 
 *     def __len__(self):             # <<<<<<<<<<<<<<
 *         cdef bcf_hdr_t *hdr = self.record.header.ptr
 *         cdef bcf1_t *r = self.record.ptr
*/

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

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

static Py_ssize_t __pyx_pf_5pysam_7libcbcf_19VariantRecordFormat_2__len__(struct __pyx_obj_5pysam_7libcbcf_VariantRecordFormat *__pyx_v_self) {
  CYTHON_UNUSED bcf_hdr_t *__pyx_v_hdr;
  bcf1_t *__pyx_v_r;
  int __pyx_v_i;
  int __pyx_v_n;
  Py_ssize_t __pyx_r;
  __Pyx_TraceDeclarationsFunc
  bcf_hdr_t *__pyx_t_1;
  bcf1_t *__pyx_t_2;
  uint32_t __pyx_t_3;
  uint32_t __pyx_t_4;
  int __pyx_t_5;
  int __pyx_t_6;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_TraceFrameInit(((PyObject *)__pyx_mstate_global->__pyx_codeobj_tab[188]))
  __Pyx_TraceStartFunc("__len__", __pyx_f[0], 2406, 0, 0, 0, __PYX_ERR(0, 2406, __pyx_L1_error));

  /* "pysam/libcbcf.pyx":2407
 * 
 *     def __len__(self):
 *         cdef bcf_hdr_t *hdr = self.record.header.ptr             # <<<<<<<<<<<<<<
 *         cdef bcf1_t *r = self.record.ptr
 *         cdef int i, n = 0
*/
  __pyx_t_1 = __pyx_v_self->record->header->ptr;
  __pyx_v_hdr = __pyx_t_1;

  /* "pysam/libcbcf.pyx":2408
 *     def __len__(self):
 *         cdef bcf_hdr_t *hdr = self.record.header.ptr
 *         cdef bcf1_t *r = self.record.ptr             # <<<<<<<<<<<<<<
 *         cdef int i, n = 0
 * 
*/
  __pyx_t_2 = __pyx_v_self->record->ptr;
  __pyx_v_r = __pyx_t_2;

  /* "pysam/libcbcf.pyx":2409
 *         cdef bcf_hdr_t *hdr = self.record.header.ptr
 *         cdef bcf1_t *r = self.record.ptr
 *         cdef int i, n = 0             # <<<<<<<<<<<<<<
 * 
 *         for i in range(r.n_fmt):
*/
  __pyx_v_n = 0;

  /* "pysam/libcbcf.pyx":2411
 *         cdef int i, n = 0
 * 
 *         for i in range(r.n_fmt):             # <<<<<<<<<<<<<<
 *             if r.d.fmt[i].p:
 *                 n += 1
*/
  __pyx_t_3 = __pyx_v_r->n_fmt;
  __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;

    /* "pysam/libcbcf.pyx":2412
 * 
 *         for i in range(r.n_fmt):
 *             if r.d.fmt[i].p:             # <<<<<<<<<<<<<<
 *                 n += 1
 *         return n
*/
    __pyx_t_6 = ((__pyx_v_r->d.fmt[__pyx_v_i]).p != 0);
    if (__pyx_t_6) {

      /* "pysam/libcbcf.pyx":2413
 *         for i in range(r.n_fmt):
 *             if r.d.fmt[i].p:
 *                 n += 1             # <<<<<<<<<<<<<<
 *         return n
 * 
*/
      __pyx_v_n = (__pyx_v_n + 1);

      /* "pysam/libcbcf.pyx":2412
 * 
 *         for i in range(r.n_fmt):
 *             if r.d.fmt[i].p:             # <<<<<<<<<<<<<<
 *                 n += 1
 *         return n
*/
    }
  }

  /* "pysam/libcbcf.pyx":2414
 *             if r.d.fmt[i].p:
 *                 n += 1
 *         return n             # <<<<<<<<<<<<<<
 * 
 *     def __bool__(self):
*/
  __pyx_r = __pyx_v_n;
  __Pyx_TraceReturnCValue(__pyx_r, PyLong_FromSsize_t, 27, 0, __PYX_ERR(0, 2414, __pyx_L1_error));
  goto __pyx_L0;

  /* "pysam/libcbcf.pyx":2406
 *         raise TypeError('this class cannot be instantiated from Python')
 * 
 *     def __len__(self):             # <<<<<<<<<<<<<<
 *         cdef bcf_hdr_t *hdr = self.record.header.ptr
 *         cdef bcf1_t *r = self.record.ptr
*/

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_TraceException(__pyx_lineno, 0, 0);
  #if CYTHON_USE_SYS_MONITORING
  __Pyx_TraceExceptionUnwind(0, 0);
  #else
  __Pyx_TraceReturnValue(NULL, 0, 0, __PYX_ERR(0, 2406, __pyx_L1_error));
  #endif
  __Pyx_AddTraceback("pysam.libcbcf.VariantRecordFormat.__len__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = -1;
  __pyx_L0:;
  __Pyx_PyMonitoring_ExitScope(0);
  return __pyx_r;
}

/* "pysam/libcbcf.pyx":2416
 *         return n
 * 
 *     def __bool__(self):             # <<<<<<<<<<<<<<
 *         cdef bcf_hdr_t *hdr = self.record.header.ptr
 *         cdef bcf1_t *r = self.record.ptr
*/

/* Python wrapper */
static int __pyx_pw_5pysam_7libcbcf_19VariantRecordFormat_5__bool__(PyObject *__pyx_v_self); /*proto*/
static int __pyx_pw_5pysam_7libcbcf_19VariantRecordFormat_5__bool__(PyObject *__pyx_v_self) {
  CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__bool__ (wrapper)", 0);
  __pyx_kwvalues = __Pyx_KwValues_VARARGS(__pyx_args, __pyx_nargs);
  __pyx_r = __pyx_pf_5pysam_7libcbcf_19VariantRecordFormat_4__bool__(((struct __pyx_obj_5pysam_7libcbcf_VariantRecordFormat *)__pyx_v_self));

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

static int __pyx_pf_5pysam_7libcbcf_19VariantRecordFormat_4__bool__(struct __pyx_obj_5pysam_7libcbcf_VariantRecordFormat *__pyx_v_self) {
  CYTHON_UNUSED bcf_hdr_t *__pyx_v_hdr;
  bcf1_t *__pyx_v_r;
  int __pyx_v_i;
  int __pyx_r;
  __Pyx_TraceDeclarationsFunc
  bcf_hdr_t *__pyx_t_1;
  bcf1_t *__pyx_t_2;
  uint32_t __pyx_t_3;
  uint32_t __pyx_t_4;
  int __pyx_t_5;
  int __pyx_t_6;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_TraceFrameInit(((PyObject *)__pyx_mstate_global->__pyx_codeobj_tab[189]))
  __Pyx_TraceStartFunc("__bool__", __pyx_f[0], 2416, 0, 0, 0, __PYX_ERR(0, 2416, __pyx_L1_error));

  /* "pysam/libcbcf.pyx":2417
 * 
 *     def __bool__(self):
 *         cdef bcf_hdr_t *hdr = self.record.header.ptr             # <<<<<<<<<<<<<<
 *         cdef bcf1_t *r = self.record.ptr
 *         cdef int i
*/
  __pyx_t_1 = __pyx_v_self->record->header->ptr;
  __pyx_v_hdr = __pyx_t_1;

  /* "pysam/libcbcf.pyx":2418
 *     def __bool__(self):
 *         cdef bcf_hdr_t *hdr = self.record.header.ptr
 *         cdef bcf1_t *r = self.record.ptr             # <<<<<<<<<<<<<<
 *         cdef int i
 * 
*/
  __pyx_t_2 = __pyx_v_self->record->ptr;
  __pyx_v_r = __pyx_t_2;

  /* "pysam/libcbcf.pyx":2421
 *         cdef int i
 * 
 *         for i in range(r.n_fmt):             # <<<<<<<<<<<<<<
 *             if r.d.fmt[i].p:
 *                 return True
*/
  __pyx_t_3 = __pyx_v_r->n_fmt;
  __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;

    /* "pysam/libcbcf.pyx":2422
 * 
 *         for i in range(r.n_fmt):
 *             if r.d.fmt[i].p:             # <<<<<<<<<<<<<<
 *                 return True
 *         return False
*/
    __pyx_t_6 = ((__pyx_v_r->d.fmt[__pyx_v_i]).p != 0);
    if (__pyx_t_6) {

      /* "pysam/libcbcf.pyx":2423
 *         for i in range(r.n_fmt):
 *             if r.d.fmt[i].p:
 *                 return True             # <<<<<<<<<<<<<<
 *         return False
 * 
*/
      __pyx_r = 1;
      __Pyx_TraceReturnCValue(__pyx_r, __Pyx_PyLong_From_int, 23, 0, __PYX_ERR(0, 2423, __pyx_L1_error));
      goto __pyx_L0;

      /* "pysam/libcbcf.pyx":2422
 * 
 *         for i in range(r.n_fmt):
 *             if r.d.fmt[i].p:             # <<<<<<<<<<<<<<
 *                 return True
 *         return False
*/
    }
  }

  /* "pysam/libcbcf.pyx":2424
 *             if r.d.fmt[i].p:
 *                 return True
 *         return False             # <<<<<<<<<<<<<<
 * 
 *     def __getitem__(self, key):
*/
  __pyx_r = 0;
  __Pyx_TraceReturnCValue(__pyx_r, __Pyx_PyLong_From_int, 25, 0, __PYX_ERR(0, 2424, __pyx_L1_error));
  goto __pyx_L0;

  /* "pysam/libcbcf.pyx":2416
 *         return n
 * 
 *     def __bool__(self):             # <<<<<<<<<<<<<<
 *         cdef bcf_hdr_t *hdr = self.record.header.ptr
 *         cdef bcf1_t *r = self.record.ptr
*/

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_TraceException(__pyx_lineno, 0, 0);
  #if CYTHON_USE_SYS_MONITORING
  __Pyx_TraceExceptionUnwind(0, 0);
  #else
  __Pyx_TraceReturnValue(NULL, 0, 0, __PYX_ERR(0, 2416, __pyx_L1_error));
  #endif
  __Pyx_AddTraceback("pysam.libcbcf.VariantRecordFormat.__bool__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = -1;
  __pyx_L0:;
  __Pyx_PyMonitoring_ExitScope(0);
  return __pyx_r;
}

/* "pysam/libcbcf.pyx":2426
 *         return False
 * 
 *     def __getitem__(self, key):             # <<<<<<<<<<<<<<
 *         cdef bcf_hdr_t *hdr = self.record.header.ptr
 *         cdef bcf1_t *r = self.record.ptr
*/

/* Python wrapper */
static PyObject *__pyx_pw_5pysam_7libcbcf_19VariantRecordFormat_7__getitem__(PyObject *__pyx_v_self, PyObject *__pyx_v_key); /*proto*/
static PyObject *__pyx_pw_5pysam_7libcbcf_19VariantRecordFormat_7__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_5pysam_7libcbcf_19VariantRecordFormat_6__getitem__(((struct __pyx_obj_5pysam_7libcbcf_VariantRecordFormat *)__pyx_v_self), ((PyObject *)__pyx_v_key));

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

static PyObject *__pyx_pf_5pysam_7libcbcf_19VariantRecordFormat_6__getitem__(struct __pyx_obj_5pysam_7libcbcf_VariantRecordFormat *__pyx_v_self, PyObject *__pyx_v_key) {
  bcf_hdr_t *__pyx_v_hdr;
  bcf1_t *__pyx_v_r;
  PyObject *__pyx_v_bkey = 0;
  bcf_fmt_t *__pyx_v_fmt;
  PyObject *__pyx_r = NULL;
  __Pyx_TraceDeclarationsFunc
  __Pyx_RefNannyDeclarations
  bcf_hdr_t *__pyx_t_1;
  bcf1_t *__pyx_t_2;
  PyObject *__pyx_t_3 = NULL;
  char const *__pyx_t_4;
  int __pyx_t_5;
  int __pyx_t_6;
  PyObject *__pyx_t_7 = NULL;
  PyObject *__pyx_t_8 = NULL;
  PyObject *__pyx_t_9 = NULL;
  PyObject *__pyx_t_10 = NULL;
  size_t __pyx_t_11;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_TraceFrameInit(((PyObject *)__pyx_mstate_global->__pyx_codeobj_tab[190]))
  __Pyx_RefNannySetupContext("__getitem__", 0);
  __Pyx_TraceStartFunc("__getitem__", __pyx_f[0], 2426, 0, 0, 0, __PYX_ERR(0, 2426, __pyx_L1_error));

  /* "pysam/libcbcf.pyx":2427
 * 
 *     def __getitem__(self, key):
 *         cdef bcf_hdr_t *hdr = self.record.header.ptr             # <<<<<<<<<<<<<<
 *         cdef bcf1_t *r = self.record.ptr
 * 
*/
  __pyx_t_1 = __pyx_v_self->record->header->ptr;
  __pyx_v_hdr = __pyx_t_1;

  /* "pysam/libcbcf.pyx":2428
 *     def __getitem__(self, key):
 *         cdef bcf_hdr_t *hdr = self.record.header.ptr
 *         cdef bcf1_t *r = self.record.ptr             # <<<<<<<<<<<<<<
 * 
 *         cdef bytes bkey = force_bytes(key)
*/
  __pyx_t_2 = __pyx_v_self->record->ptr;
  __pyx_v_r = __pyx_t_2;

  /* "pysam/libcbcf.pyx":2430
 *         cdef bcf1_t *r = self.record.ptr
 * 
 *         cdef bytes bkey = force_bytes(key)             # <<<<<<<<<<<<<<
 *         cdef bcf_fmt_t *fmt = bcf_get_fmt(hdr, r, bkey)
 * 
*/
  __pyx_t_3 = __pyx_f_5pysam_9libcutils_force_bytes(__pyx_v_key, NULL); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 2430, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __pyx_v_bkey = ((PyObject*)__pyx_t_3);
  __pyx_t_3 = 0;

  /* "pysam/libcbcf.pyx":2431
 * 
 *         cdef bytes bkey = force_bytes(key)
 *         cdef bcf_fmt_t *fmt = bcf_get_fmt(hdr, r, bkey)             # <<<<<<<<<<<<<<
 * 
 *         if not fmt or not fmt.p:
*/
  if (unlikely(__pyx_v_bkey == Py_None)) {
    PyErr_SetString(PyExc_TypeError, "expected bytes, NoneType found");
    __PYX_ERR(0, 2431, __pyx_L1_error)
  }
  __pyx_t_4 = __Pyx_PyBytes_AsString(__pyx_v_bkey); if (unlikely((!__pyx_t_4) && PyErr_Occurred())) __PYX_ERR(0, 2431, __pyx_L1_error)
  __pyx_v_fmt = bcf_get_fmt(__pyx_v_hdr, __pyx_v_r, __pyx_t_4);

  /* "pysam/libcbcf.pyx":2433
 *         cdef bcf_fmt_t *fmt = bcf_get_fmt(hdr, r, bkey)
 * 
 *         if not fmt or not fmt.p:             # <<<<<<<<<<<<<<
 *             raise KeyError('unknown format: {}'.format(key))
 * 
*/
  __pyx_t_6 = (!(__pyx_v_fmt != 0));
  if (!__pyx_t_6) {
  } else {
    __pyx_t_5 = __pyx_t_6;
    goto __pyx_L4_bool_binop_done;
  }
  __pyx_t_6 = (!(__pyx_v_fmt->p != 0));
  __pyx_t_5 = __pyx_t_6;
  __pyx_L4_bool_binop_done:;
  if (unlikely(__pyx_t_5)) {

    /* "pysam/libcbcf.pyx":2434
 * 
 *         if not fmt or not fmt.p:
 *             raise KeyError('unknown format: {}'.format(key))             # <<<<<<<<<<<<<<
 * 
 *         return makeVariantMetadata(self.record.header, BCF_HL_FMT, fmt.id)
*/
    __pyx_t_7 = NULL;
    __Pyx_INCREF(__pyx_builtin_KeyError);
    __pyx_t_8 = __pyx_builtin_KeyError; 
    __pyx_t_10 = __pyx_mstate_global->__pyx_kp_u_unknown_format;
    __Pyx_INCREF(__pyx_t_10);
    __pyx_t_11 = 0;
    {
      PyObject *__pyx_callargs[2] = {__pyx_t_10, __pyx_v_key};
      __pyx_t_9 = __Pyx_PyObject_FastCallMethod(__pyx_mstate_global->__pyx_n_u_format, __pyx_callargs+__pyx_t_11, (2-__pyx_t_11) | (1*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
      __Pyx_XDECREF(__pyx_t_10); __pyx_t_10 = 0;
      if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 2434, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_9);
    }
    __pyx_t_11 = 1;
    {
      PyObject *__pyx_callargs[2] = {__pyx_t_7, __pyx_t_9};
      __pyx_t_3 = __Pyx_PyObject_FastCall(__pyx_t_8, __pyx_callargs+__pyx_t_11, (2-__pyx_t_11) | (__pyx_t_11*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
      __Pyx_XDECREF(__pyx_t_7); __pyx_t_7 = 0;
      __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
      __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
      if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 2434, __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, 2434, __pyx_L1_error)

    /* "pysam/libcbcf.pyx":2433
 *         cdef bcf_fmt_t *fmt = bcf_get_fmt(hdr, r, bkey)
 * 
 *         if not fmt or not fmt.p:             # <<<<<<<<<<<<<<
 *             raise KeyError('unknown format: {}'.format(key))
 * 
*/
  }

  /* "pysam/libcbcf.pyx":2436
 *             raise KeyError('unknown format: {}'.format(key))
 * 
 *         return makeVariantMetadata(self.record.header, BCF_HL_FMT, fmt.id)             # <<<<<<<<<<<<<<
 * 
 *     def __delitem__(self, key):
*/
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_3 = ((PyObject *)__pyx_v_self->record->header);
  __Pyx_INCREF(__pyx_t_3);
  __pyx_t_8 = ((PyObject *)__pyx_f_5pysam_7libcbcf_makeVariantMetadata(((struct __pyx_obj_5pysam_7libcbcf_VariantHeader *)__pyx_t_3), BCF_HL_FMT, __pyx_v_fmt->id)); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 2436, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_8);
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  __pyx_r = __pyx_t_8;
  __pyx_t_8 = 0;
  __Pyx_TraceReturnValue(__pyx_r, 34, 0, __PYX_ERR(0, 2436, __pyx_L1_error));
  goto __pyx_L0;

  /* "pysam/libcbcf.pyx":2426
 *         return False
 * 
 *     def __getitem__(self, key):             # <<<<<<<<<<<<<<
 *         cdef bcf_hdr_t *hdr = self.record.header.ptr
 *         cdef bcf1_t *r = self.record.ptr
*/

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_7);
  __Pyx_XDECREF(__pyx_t_8);
  __Pyx_XDECREF(__pyx_t_9);
  __Pyx_XDECREF(__pyx_t_10);
  __Pyx_TraceException(__pyx_lineno, 0, 0);
  #if CYTHON_USE_SYS_MONITORING
  __Pyx_TraceExceptionUnwind(0, 0);
  #else
  __Pyx_TraceReturnValue(NULL, 0, 0, __PYX_ERR(0, 2426, __pyx_L1_error));
  #endif
  __Pyx_AddTraceback("pysam.libcbcf.VariantRecordFormat.__getitem__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_bkey);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_PyMonitoring_ExitScope(0);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "pysam/libcbcf.pyx":2438
 *         return makeVariantMetadata(self.record.header, BCF_HL_FMT, fmt.id)
 * 
 *     def __delitem__(self, key):             # <<<<<<<<<<<<<<
 *         cdef bcf_hdr_t *hdr = self.record.header.ptr
 *         cdef bcf1_t *r = self.record.ptr
*/

/* Python wrapper */
static int __pyx_pw_5pysam_7libcbcf_19VariantRecordFormat_9__delitem__(PyObject *__pyx_v_self, PyObject *__pyx_v_key); /*proto*/
static int __pyx_pw_5pysam_7libcbcf_19VariantRecordFormat_9__delitem__(PyObject *__pyx_v_self, PyObject *__pyx_v_key) {
  CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__delitem__ (wrapper)", 0);
  __pyx_kwvalues = __Pyx_KwValues_VARARGS(__pyx_args, __pyx_nargs);
  __pyx_r = __pyx_pf_5pysam_7libcbcf_19VariantRecordFormat_8__delitem__(((struct __pyx_obj_5pysam_7libcbcf_VariantRecordFormat *)__pyx_v_self), ((PyObject *)__pyx_v_key));

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

static int __pyx_pf_5pysam_7libcbcf_19VariantRecordFormat_8__delitem__(struct __pyx_obj_5pysam_7libcbcf_VariantRecordFormat *__pyx_v_self, PyObject *__pyx_v_key) {
  bcf_hdr_t *__pyx_v_hdr;
  bcf1_t *__pyx_v_r;
  PyObject *__pyx_v_bkey = 0;
  bcf_fmt_t *__pyx_v_fmt;
  int __pyx_r;
  __Pyx_TraceDeclarationsFunc
  __Pyx_RefNannyDeclarations
  bcf_hdr_t *__pyx_t_1;
  bcf1_t *__pyx_t_2;
  PyObject *__pyx_t_3 = NULL;
  char const *__pyx_t_4;
  int __pyx_t_5;
  int __pyx_t_6;
  PyObject *__pyx_t_7 = NULL;
  PyObject *__pyx_t_8 = NULL;
  PyObject *__pyx_t_9 = NULL;
  PyObject *__pyx_t_10 = NULL;
  size_t __pyx_t_11;
  char const *__pyx_t_12;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_TraceFrameInit(((PyObject *)__pyx_mstate_global->__pyx_codeobj_tab[191]))
  __Pyx_RefNannySetupContext("__delitem__", 0);
  __Pyx_TraceStartFunc("__delitem__", __pyx_f[0], 2438, 0, 0, 0, __PYX_ERR(0, 2438, __pyx_L1_error));

  /* "pysam/libcbcf.pyx":2439
 * 
 *     def __delitem__(self, key):
 *         cdef bcf_hdr_t *hdr = self.record.header.ptr             # <<<<<<<<<<<<<<
 *         cdef bcf1_t *r = self.record.ptr
 * 
*/
  __pyx_t_1 = __pyx_v_self->record->header->ptr;
  __pyx_v_hdr = __pyx_t_1;

  /* "pysam/libcbcf.pyx":2440
 *     def __delitem__(self, key):
 *         cdef bcf_hdr_t *hdr = self.record.header.ptr
 *         cdef bcf1_t *r = self.record.ptr             # <<<<<<<<<<<<<<
 * 
 *         cdef bytes bkey = force_bytes(key)
*/
  __pyx_t_2 = __pyx_v_self->record->ptr;
  __pyx_v_r = __pyx_t_2;

  /* "pysam/libcbcf.pyx":2442
 *         cdef bcf1_t *r = self.record.ptr
 * 
 *         cdef bytes bkey = force_bytes(key)             # <<<<<<<<<<<<<<
 *         cdef bcf_fmt_t *fmt = bcf_get_fmt(hdr, r, bkey)
 * 
*/
  __pyx_t_3 = __pyx_f_5pysam_9libcutils_force_bytes(__pyx_v_key, NULL); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 2442, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __pyx_v_bkey = ((PyObject*)__pyx_t_3);
  __pyx_t_3 = 0;

  /* "pysam/libcbcf.pyx":2443
 * 
 *         cdef bytes bkey = force_bytes(key)
 *         cdef bcf_fmt_t *fmt = bcf_get_fmt(hdr, r, bkey)             # <<<<<<<<<<<<<<
 * 
 *         if not fmt or not fmt.p:
*/
  if (unlikely(__pyx_v_bkey == Py_None)) {
    PyErr_SetString(PyExc_TypeError, "expected bytes, NoneType found");
    __PYX_ERR(0, 2443, __pyx_L1_error)
  }
  __pyx_t_4 = __Pyx_PyBytes_AsString(__pyx_v_bkey); if (unlikely((!__pyx_t_4) && PyErr_Occurred())) __PYX_ERR(0, 2443, __pyx_L1_error)
  __pyx_v_fmt = bcf_get_fmt(__pyx_v_hdr, __pyx_v_r, __pyx_t_4);

  /* "pysam/libcbcf.pyx":2445
 *         cdef bcf_fmt_t *fmt = bcf_get_fmt(hdr, r, bkey)
 * 
 *         if not fmt or not fmt.p:             # <<<<<<<<<<<<<<
 *             raise KeyError('unknown format: {}'.format(key))
 * 
*/
  __pyx_t_6 = (!(__pyx_v_fmt != 0));
  if (!__pyx_t_6) {
  } else {
    __pyx_t_5 = __pyx_t_6;
    goto __pyx_L4_bool_binop_done;
  }
  __pyx_t_6 = (!(__pyx_v_fmt->p != 0));
  __pyx_t_5 = __pyx_t_6;
  __pyx_L4_bool_binop_done:;
  if (unlikely(__pyx_t_5)) {

    /* "pysam/libcbcf.pyx":2446
 * 
 *         if not fmt or not fmt.p:
 *             raise KeyError('unknown format: {}'.format(key))             # <<<<<<<<<<<<<<
 * 
 *         if bcf_update_format(hdr, r, bkey, fmt.p, 0, fmt.type) < 0:
*/
    __pyx_t_7 = NULL;
    __Pyx_INCREF(__pyx_builtin_KeyError);
    __pyx_t_8 = __pyx_builtin_KeyError; 
    __pyx_t_10 = __pyx_mstate_global->__pyx_kp_u_unknown_format;
    __Pyx_INCREF(__pyx_t_10);
    __pyx_t_11 = 0;
    {
      PyObject *__pyx_callargs[2] = {__pyx_t_10, __pyx_v_key};
      __pyx_t_9 = __Pyx_PyObject_FastCallMethod(__pyx_mstate_global->__pyx_n_u_format, __pyx_callargs+__pyx_t_11, (2-__pyx_t_11) | (1*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
      __Pyx_XDECREF(__pyx_t_10); __pyx_t_10 = 0;
      if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 2446, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_9);
    }
    __pyx_t_11 = 1;
    {
      PyObject *__pyx_callargs[2] = {__pyx_t_7, __pyx_t_9};
      __pyx_t_3 = __Pyx_PyObject_FastCall(__pyx_t_8, __pyx_callargs+__pyx_t_11, (2-__pyx_t_11) | (__pyx_t_11*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
      __Pyx_XDECREF(__pyx_t_7); __pyx_t_7 = 0;
      __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
      __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
      if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 2446, __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, 2446, __pyx_L1_error)

    /* "pysam/libcbcf.pyx":2445
 *         cdef bcf_fmt_t *fmt = bcf_get_fmt(hdr, r, bkey)
 * 
 *         if not fmt or not fmt.p:             # <<<<<<<<<<<<<<
 *             raise KeyError('unknown format: {}'.format(key))
 * 
*/
  }

  /* "pysam/libcbcf.pyx":2448
 *             raise KeyError('unknown format: {}'.format(key))
 * 
 *         if bcf_update_format(hdr, r, bkey, fmt.p, 0, fmt.type) < 0:             # <<<<<<<<<<<<<<
 *             raise ValueError('Unable to delete FORMAT')
 * 
*/
  if (unlikely(__pyx_v_bkey == Py_None)) {
    PyErr_SetString(PyExc_TypeError, "expected bytes, NoneType found");
    __PYX_ERR(0, 2448, __pyx_L1_error)
  }
  __pyx_t_12 = __Pyx_PyBytes_AsString(__pyx_v_bkey); if (unlikely((!__pyx_t_12) && PyErr_Occurred())) __PYX_ERR(0, 2448, __pyx_L1_error)
  __pyx_t_5 = (bcf_update_format(__pyx_v_hdr, __pyx_v_r, __pyx_t_12, __pyx_v_fmt->p, 0, __pyx_v_fmt->type) < 0);
  if (unlikely(__pyx_t_5)) {

    /* "pysam/libcbcf.pyx":2449
 * 
 *         if bcf_update_format(hdr, r, bkey, fmt.p, 0, fmt.type) < 0:
 *             raise ValueError('Unable to delete FORMAT')             # <<<<<<<<<<<<<<
 * 
 *     def clear(self):
*/
    __pyx_t_8 = NULL;
    __Pyx_INCREF(__pyx_builtin_ValueError);
    __pyx_t_9 = __pyx_builtin_ValueError; 
    __pyx_t_11 = 1;
    {
      PyObject *__pyx_callargs[2] = {__pyx_t_8, __pyx_mstate_global->__pyx_kp_u_Unable_to_delete_FORMAT};
      __pyx_t_3 = __Pyx_PyObject_FastCall(__pyx_t_9, __pyx_callargs+__pyx_t_11, (2-__pyx_t_11) | (__pyx_t_11*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
      __Pyx_XDECREF(__pyx_t_8); __pyx_t_8 = 0;
      __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
      if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 2449, __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, 2449, __pyx_L1_error)

    /* "pysam/libcbcf.pyx":2448
 *             raise KeyError('unknown format: {}'.format(key))
 * 
 *         if bcf_update_format(hdr, r, bkey, fmt.p, 0, fmt.type) < 0:             # <<<<<<<<<<<<<<
 *             raise ValueError('Unable to delete FORMAT')
 * 
*/
  }

  /* "pysam/libcbcf.pyx":2438
 *         return makeVariantMetadata(self.record.header, BCF_HL_FMT, fmt.id)
 * 
 *     def __delitem__(self, key):             # <<<<<<<<<<<<<<
 *         cdef bcf_hdr_t *hdr = self.record.header.ptr
 *         cdef bcf1_t *r = self.record.ptr
*/

  /* function exit code */
  __pyx_r = 0;
  __Pyx_TraceReturnCValue(__pyx_r, __Pyx_Owned_Py_None, 0, 0, __PYX_ERR(0, 2438, __pyx_L1_error));
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_7);
  __Pyx_XDECREF(__pyx_t_8);
  __Pyx_XDECREF(__pyx_t_9);
  __Pyx_XDECREF(__pyx_t_10);
  __Pyx_TraceException(__pyx_lineno, 0, 0);
  #if CYTHON_USE_SYS_MONITORING
  __Pyx_TraceExceptionUnwind(0, 0);
  #else
  __Pyx_TraceReturnValue(NULL, 0, 0, __PYX_ERR(0, 2438, __pyx_L1_error));
  #endif
  __Pyx_AddTraceback("pysam.libcbcf.VariantRecordFormat.__delitem__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = -1;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_bkey);
  __Pyx_PyMonitoring_ExitScope(0);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "pysam/libcbcf.pyx":2451
 *             raise ValueError('Unable to delete FORMAT')
 * 
 *     def clear(self):             # <<<<<<<<<<<<<<
 *         """Clear all formats for all samples within the associated
 *            :class:`VariantRecord` instance"""
*/

/* Python wrapper */
static PyObject *__pyx_pw_5pysam_7libcbcf_19VariantRecordFormat_11clear(PyObject *__pyx_v_self, 
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
); /*proto*/
PyDoc_STRVAR(__pyx_doc_5pysam_7libcbcf_19VariantRecordFormat_10clear, "VariantRecordFormat.clear(self)\n\nClear all formats for all samples within the associated\n:class:`VariantRecord` instance");
static PyMethodDef __pyx_mdef_5pysam_7libcbcf_19VariantRecordFormat_11clear = {"clear", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_5pysam_7libcbcf_19VariantRecordFormat_11clear, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_5pysam_7libcbcf_19VariantRecordFormat_10clear};
static PyObject *__pyx_pw_5pysam_7libcbcf_19VariantRecordFormat_11clear(PyObject *__pyx_v_self, 
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
) {
  #if !CYTHON_METH_FASTCALL
  CYTHON_UNUSED Py_ssize_t __pyx_nargs;
  #endif
  CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("clear (wrapper)", 0);
  #if !CYTHON_METH_FASTCALL
  #if CYTHON_ASSUME_SAFE_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("clear", 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("clear", __pyx_kwds); return NULL;}
  __pyx_r = __pyx_pf_5pysam_7libcbcf_19VariantRecordFormat_10clear(((struct __pyx_obj_5pysam_7libcbcf_VariantRecordFormat *)__pyx_v_self));

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

static PyObject *__pyx_pf_5pysam_7libcbcf_19VariantRecordFormat_10clear(struct __pyx_obj_5pysam_7libcbcf_VariantRecordFormat *__pyx_v_self) {
  bcf_hdr_t *__pyx_v_hdr;
  bcf1_t *__pyx_v_r;
  bcf_fmt_t *__pyx_v_fmt;
  char const *__pyx_v_key;
  int __pyx_v_i;
  PyObject *__pyx_r = NULL;
  __Pyx_TraceDeclarationsFunc
  __Pyx_RefNannyDeclarations
  bcf_hdr_t *__pyx_t_1;
  bcf1_t *__pyx_t_2;
  int __pyx_t_3;
  int __pyx_t_4;
  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_TraceFrameInit(((PyObject *)__pyx_mstate_global->__pyx_codeobj_tab[192]))
  __Pyx_RefNannySetupContext("clear", 0);
  __Pyx_TraceStartFunc("clear", __pyx_f[0], 2451, 0, 0, 0, __PYX_ERR(0, 2451, __pyx_L1_error));

  /* "pysam/libcbcf.pyx":2454
 *         """Clear all formats for all samples within the associated
 *            :class:`VariantRecord` instance"""
 *         cdef bcf_hdr_t *hdr = self.record.header.ptr             # <<<<<<<<<<<<<<
 *         cdef bcf1_t *r = self.record.ptr
 *         cdef bcf_fmt_t *fmt
*/
  __pyx_t_1 = __pyx_v_self->record->header->ptr;
  __pyx_v_hdr = __pyx_t_1;

  /* "pysam/libcbcf.pyx":2455
 *            :class:`VariantRecord` instance"""
 *         cdef bcf_hdr_t *hdr = self.record.header.ptr
 *         cdef bcf1_t *r = self.record.ptr             # <<<<<<<<<<<<<<
 *         cdef bcf_fmt_t *fmt
 *         cdef const char *key
*/
  __pyx_t_2 = __pyx_v_self->record->ptr;
  __pyx_v_r = __pyx_t_2;

  /* "pysam/libcbcf.pyx":2460
 *         cdef int i
 * 
 *         for i in reversed(range(r.n_fmt)):             # <<<<<<<<<<<<<<
 *             fmt = &r.d.fmt[i]
 *             if fmt.p:
*/
  for (__pyx_t_3 = __pyx_v_r->n_fmt-1; __pyx_t_3 >= 0; __pyx_t_3-=1) {
    __pyx_v_i = __pyx_t_3;

    /* "pysam/libcbcf.pyx":2461
 * 
 *         for i in reversed(range(r.n_fmt)):
 *             fmt = &r.d.fmt[i]             # <<<<<<<<<<<<<<
 *             if fmt.p:
 *                 key = bcf_hdr_int2id(hdr, BCF_DT_ID, fmt.id)
*/
    __pyx_v_fmt = (&(__pyx_v_r->d.fmt[__pyx_v_i]));

    /* "pysam/libcbcf.pyx":2462
 *         for i in reversed(range(r.n_fmt)):
 *             fmt = &r.d.fmt[i]
 *             if fmt.p:             # <<<<<<<<<<<<<<
 *                 key = bcf_hdr_int2id(hdr, BCF_DT_ID, fmt.id)
 *                 if bcf_update_format(hdr, r, key, fmt.p, 0, fmt.type) < 0:
*/
    __pyx_t_4 = (__pyx_v_fmt->p != 0);
    if (__pyx_t_4) {

      /* "pysam/libcbcf.pyx":2463
 *             fmt = &r.d.fmt[i]
 *             if fmt.p:
 *                 key = bcf_hdr_int2id(hdr, BCF_DT_ID, fmt.id)             # <<<<<<<<<<<<<<
 *                 if bcf_update_format(hdr, r, key, fmt.p, 0, fmt.type) < 0:
 *                     raise ValueError('Unable to delete FORMAT')
*/
      __pyx_v_key = bcf_hdr_int2id(__pyx_v_hdr, BCF_DT_ID, __pyx_v_fmt->id);

      /* "pysam/libcbcf.pyx":2464
 *             if fmt.p:
 *                 key = bcf_hdr_int2id(hdr, BCF_DT_ID, fmt.id)
 *                 if bcf_update_format(hdr, r, key, fmt.p, 0, fmt.type) < 0:             # <<<<<<<<<<<<<<
 *                     raise ValueError('Unable to delete FORMAT')
 * 
*/
      __pyx_t_4 = (bcf_update_format(__pyx_v_hdr, __pyx_v_r, __pyx_v_key, __pyx_v_fmt->p, 0, __pyx_v_fmt->type) < 0);
      if (unlikely(__pyx_t_4)) {

        /* "pysam/libcbcf.pyx":2465
 *                 key = bcf_hdr_int2id(hdr, BCF_DT_ID, fmt.id)
 *                 if bcf_update_format(hdr, r, key, fmt.p, 0, fmt.type) < 0:
 *                     raise ValueError('Unable to delete FORMAT')             # <<<<<<<<<<<<<<
 * 
 *     def __iter__(self):
*/
        __pyx_t_6 = NULL;
        __Pyx_INCREF(__pyx_builtin_ValueError);
        __pyx_t_7 = __pyx_builtin_ValueError; 
        __pyx_t_8 = 1;
        {
          PyObject *__pyx_callargs[2] = {__pyx_t_6, __pyx_mstate_global->__pyx_kp_u_Unable_to_delete_FORMAT};
          __pyx_t_5 = __Pyx_PyObject_FastCall(__pyx_t_7, __pyx_callargs+__pyx_t_8, (2-__pyx_t_8) | (__pyx_t_8*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
          __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0;
          __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
          if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 2465, __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, 2465, __pyx_L1_error)

        /* "pysam/libcbcf.pyx":2464
 *             if fmt.p:
 *                 key = bcf_hdr_int2id(hdr, BCF_DT_ID, fmt.id)
 *                 if bcf_update_format(hdr, r, key, fmt.p, 0, fmt.type) < 0:             # <<<<<<<<<<<<<<
 *                     raise ValueError('Unable to delete FORMAT')
 * 
*/
      }

      /* "pysam/libcbcf.pyx":2462
 *         for i in reversed(range(r.n_fmt)):
 *             fmt = &r.d.fmt[i]
 *             if fmt.p:             # <<<<<<<<<<<<<<
 *                 key = bcf_hdr_int2id(hdr, BCF_DT_ID, fmt.id)
 *                 if bcf_update_format(hdr, r, key, fmt.p, 0, fmt.type) < 0:
*/
    }
  }

  /* "pysam/libcbcf.pyx":2451
 *             raise ValueError('Unable to delete FORMAT')
 * 
 *     def clear(self):             # <<<<<<<<<<<<<<
 *         """Clear all formats for all samples within the associated
 *            :class:`VariantRecord` instance"""
*/

  /* function exit code */
  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  __Pyx_TraceReturnValue(__pyx_r, 0, 0, __PYX_ERR(0, 2451, __pyx_L1_error));
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_5);
  __Pyx_XDECREF(__pyx_t_6);
  __Pyx_XDECREF(__pyx_t_7);
  __Pyx_TraceException(__pyx_lineno, 0, 0);
  #if CYTHON_USE_SYS_MONITORING
  __Pyx_TraceExceptionUnwind(0, 0);
  #else
  __Pyx_TraceReturnValue(NULL, 0, 0, __PYX_ERR(0, 2451, __pyx_L1_error));
  #endif
  __Pyx_AddTraceback("pysam.libcbcf.VariantRecordFormat.clear", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_PyMonitoring_ExitScope(0);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}
static PyObject *__pyx_gb_5pysam_7libcbcf_19VariantRecordFormat_14generator14(__pyx_CoroutineObject *__pyx_generator, CYTHON_UNUSED PyThreadState *__pyx_tstate, PyObject *__pyx_sent_value); /* proto */

/* "pysam/libcbcf.pyx":2467
 *                     raise ValueError('Unable to delete FORMAT')
 * 
 *     def __iter__(self):             # <<<<<<<<<<<<<<
 *         cdef bcf_hdr_t *hdr = self.record.header.ptr
 *         cdef bcf1_t *r = self.record.ptr
*/

/* Python wrapper */
static PyObject *__pyx_pw_5pysam_7libcbcf_19VariantRecordFormat_13__iter__(PyObject *__pyx_v_self); /*proto*/
static PyObject *__pyx_pw_5pysam_7libcbcf_19VariantRecordFormat_13__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_5pysam_7libcbcf_19VariantRecordFormat_12__iter__(((struct __pyx_obj_5pysam_7libcbcf_VariantRecordFormat *)__pyx_v_self));

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

static PyObject *__pyx_pf_5pysam_7libcbcf_19VariantRecordFormat_12__iter__(struct __pyx_obj_5pysam_7libcbcf_VariantRecordFormat *__pyx_v_self) {
  struct __pyx_obj_5pysam_7libcbcf___pyx_scope_struct_21___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("__iter__", 0);
  __pyx_cur_scope = (struct __pyx_obj_5pysam_7libcbcf___pyx_scope_struct_21___iter__ *)__pyx_tp_new_5pysam_7libcbcf___pyx_scope_struct_21___iter__(__pyx_mstate_global->__pyx_ptype_5pysam_7libcbcf___pyx_scope_struct_21___iter__, __pyx_mstate_global->__pyx_empty_tuple, NULL);
  if (unlikely(!__pyx_cur_scope)) {
    __pyx_cur_scope = ((struct __pyx_obj_5pysam_7libcbcf___pyx_scope_struct_21___iter__ *)Py_None);
    __Pyx_INCREF(Py_None);
    __PYX_ERR(0, 2467, __pyx_L1_error)
  } else {
    __Pyx_GOTREF((PyObject *)__pyx_cur_scope);
  }
  __pyx_cur_scope->__pyx_v_self = __pyx_v_self;
  __Pyx_INCREF((PyObject *)__pyx_cur_scope->__pyx_v_self);
  __Pyx_GIVEREF((PyObject *)__pyx_cur_scope->__pyx_v_self);
  {
    __pyx_CoroutineObject *gen = __Pyx_Generator_New((__pyx_coroutine_body_t) __pyx_gb_5pysam_7libcbcf_19VariantRecordFormat_14generator14, ((PyObject *)__pyx_mstate_global->__pyx_codeobj_tab[193]), (PyObject *) __pyx_cur_scope, __pyx_mstate_global->__pyx_n_u_iter, __pyx_mstate_global->__pyx_n_u_VariantRecordFormat___iter, __pyx_mstate_global->__pyx_n_u_pysam_libcbcf); if (unlikely(!gen)) __PYX_ERR(0, 2467, __pyx_L1_error)
    __Pyx_DECREF(__pyx_cur_scope);
    __Pyx_RefNannyFinishContext();
    return (PyObject *) gen;
  }

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_AddTraceback("pysam.libcbcf.VariantRecordFormat.__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_5pysam_7libcbcf_19VariantRecordFormat_14generator14(__pyx_CoroutineObject *__pyx_generator, CYTHON_UNUSED PyThreadState *__pyx_tstate, PyObject *__pyx_sent_value) /* generator body */
{
  struct __pyx_obj_5pysam_7libcbcf___pyx_scope_struct_21___iter__ *__pyx_cur_scope = ((struct __pyx_obj_5pysam_7libcbcf___pyx_scope_struct_21___iter__ *)__pyx_generator->closure);
  PyObject *__pyx_r = NULL;
  __Pyx_TraceDeclarationsGen
  bcf_hdr_t *__pyx_t_1;
  bcf1_t *__pyx_t_2;
  uint32_t __pyx_t_3;
  uint32_t __pyx_t_4;
  int __pyx_t_5;
  int __pyx_t_6;
  PyObject *__pyx_t_7 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__iter__", 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_TraceStartGen("__iter__", __pyx_f[0], 2467, 0, 0, 0, __PYX_ERR(0, 2467, __pyx_L1_error));
    __Pyx_TraceReturnValue(Py_None, 0, 0, __PYX_ERR(0, 2467, __pyx_L1_error));
    __Pyx_RefNannyFinishContext();
    return NULL;
  }
  __pyx_L3_first_run:;
  __Pyx_TraceStartGen("__iter__", __pyx_f[0], 2467, 0, 0, 0, __PYX_ERR(0, 2467, __pyx_L1_error));
  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, 2467, __pyx_L1_error)
  }

  /* "pysam/libcbcf.pyx":2468
 * 
 *     def __iter__(self):
 *         cdef bcf_hdr_t *hdr = self.record.header.ptr             # <<<<<<<<<<<<<<
 *         cdef bcf1_t *r = self.record.ptr
 *         cdef bcf_fmt_t *fmt
*/
  __pyx_t_1 = __pyx_cur_scope->__pyx_v_self->record->header->ptr;
  __pyx_cur_scope->__pyx_v_hdr = __pyx_t_1;

  /* "pysam/libcbcf.pyx":2469
 *     def __iter__(self):
 *         cdef bcf_hdr_t *hdr = self.record.header.ptr
 *         cdef bcf1_t *r = self.record.ptr             # <<<<<<<<<<<<<<
 *         cdef bcf_fmt_t *fmt
 *         cdef int i
*/
  __pyx_t_2 = __pyx_cur_scope->__pyx_v_self->record->ptr;
  __pyx_cur_scope->__pyx_v_r = __pyx_t_2;

  /* "pysam/libcbcf.pyx":2473
 *         cdef int i
 * 
 *         for i in range(r.n_fmt):             # <<<<<<<<<<<<<<
 *             fmt = &r.d.fmt[i]
 *             if fmt.p:
*/
  __pyx_t_3 = __pyx_cur_scope->__pyx_v_r->n_fmt;
  __pyx_t_4 = __pyx_t_3;
  for (__pyx_t_5 = 0; __pyx_t_5 < __pyx_t_4; __pyx_t_5+=1) {
    __pyx_cur_scope->__pyx_v_i = __pyx_t_5;

    /* "pysam/libcbcf.pyx":2474
 * 
 *         for i in range(r.n_fmt):
 *             fmt = &r.d.fmt[i]             # <<<<<<<<<<<<<<
 *             if fmt.p:
 *                 yield bcf_str_cache_get_charptr(bcf_hdr_int2id(hdr, BCF_DT_ID, fmt.id))
*/
    __pyx_cur_scope->__pyx_v_fmt = (&(__pyx_cur_scope->__pyx_v_r->d.fmt[__pyx_cur_scope->__pyx_v_i]));

    /* "pysam/libcbcf.pyx":2475
 *         for i in range(r.n_fmt):
 *             fmt = &r.d.fmt[i]
 *             if fmt.p:             # <<<<<<<<<<<<<<
 *                 yield bcf_str_cache_get_charptr(bcf_hdr_int2id(hdr, BCF_DT_ID, fmt.id))
 * 
*/
    __pyx_t_6 = (__pyx_cur_scope->__pyx_v_fmt->p != 0);
    if (__pyx_t_6) {

      /* "pysam/libcbcf.pyx":2476
 *             fmt = &r.d.fmt[i]
 *             if fmt.p:
 *                 yield bcf_str_cache_get_charptr(bcf_hdr_int2id(hdr, BCF_DT_ID, fmt.id))             # <<<<<<<<<<<<<<
 * 
 *     def get(self, key, default=None):
*/
      __pyx_t_7 = __pyx_f_5pysam_7libcbcf_bcf_str_cache_get_charptr(bcf_hdr_int2id(__pyx_cur_scope->__pyx_v_hdr, BCF_DT_ID, __pyx_cur_scope->__pyx_v_fmt->id)); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 2476, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_7);
      __pyx_r = __pyx_t_7;
      __pyx_t_7 = 0;
      __pyx_cur_scope->__pyx_t_0 = __pyx_t_3;
      __pyx_cur_scope->__pyx_t_1 = __pyx_t_4;
      __pyx_cur_scope->__pyx_t_2 = __pyx_t_5;
      __Pyx_TraceYield(__pyx_r, 0, __PYX_ERR(0, 2476, __pyx_L1_error));
      __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_TraceResumeGen("__iter__", __pyx_f[0], 2467, 0, __PYX_ERR(0, 2476, __pyx_L1_error));
      __pyx_t_3 = __pyx_cur_scope->__pyx_t_0;
      __pyx_t_4 = __pyx_cur_scope->__pyx_t_1;
      __pyx_t_5 = __pyx_cur_scope->__pyx_t_2;
      if (unlikely(!__pyx_sent_value)) __PYX_ERR(0, 2476, __pyx_L1_error)

      /* "pysam/libcbcf.pyx":2475
 *         for i in range(r.n_fmt):
 *             fmt = &r.d.fmt[i]
 *             if fmt.p:             # <<<<<<<<<<<<<<
 *                 yield bcf_str_cache_get_charptr(bcf_hdr_int2id(hdr, BCF_DT_ID, fmt.id))
 * 
*/
    }
  }
  CYTHON_MAYBE_UNUSED_VAR(__pyx_cur_scope);
  __Pyx_TraceReturnValue(Py_None, 0, 0, __PYX_ERR(0, 2467, __pyx_L1_error));

  /* "pysam/libcbcf.pyx":2467
 *                     raise ValueError('Unable to delete FORMAT')
 * 
 *     def __iter__(self):             # <<<<<<<<<<<<<<
 *         cdef bcf_hdr_t *hdr = self.record.header.ptr
 *         cdef bcf1_t *r = self.record.ptr
*/

  /* function exit code */
  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_7);
  if (__Pyx_PyErr_Occurred()) {
    __Pyx_TraceException(__pyx_lineno, 0, 0);
    __Pyx_Generator_Replace_StopIteration(0);
    __Pyx_AddTraceback("__iter__", __pyx_clineno, __pyx_lineno, __pyx_filename);
    __Pyx_TraceExceptionUnwind(0, 0);
  }
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_PyMonitoring_ExitScope(0);
  #if !CYTHON_USE_EXC_INFO_STACK
  __Pyx_Coroutine_ResetAndClearException(__pyx_generator);
  #endif
  __pyx_generator->resume_label = -1;
  __Pyx_Coroutine_clear((PyObject*)__pyx_generator);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "pysam/libcbcf.pyx":2478
 *                 yield bcf_str_cache_get_charptr(bcf_hdr_int2id(hdr, BCF_DT_ID, fmt.id))
 * 
 *     def get(self, key, default=None):             # <<<<<<<<<<<<<<
 *         """D.get(k[,d]) -> D[k] if k in D, else d.  d defaults to None."""
 *         try:
*/

/* Python wrapper */
static PyObject *__pyx_pw_5pysam_7libcbcf_19VariantRecordFormat_16get(PyObject *__pyx_v_self, 
#if 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_5pysam_7libcbcf_19VariantRecordFormat_15get, "VariantRecordFormat.get(self, key, default=None)\n\nD.get(k[,d]) -> D[k] if k in D, else d.  d defaults to None.");
static PyMethodDef __pyx_mdef_5pysam_7libcbcf_19VariantRecordFormat_16get = {"get", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_5pysam_7libcbcf_19VariantRecordFormat_16get, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_5pysam_7libcbcf_19VariantRecordFormat_15get};
static PyObject *__pyx_pw_5pysam_7libcbcf_19VariantRecordFormat_16get(PyObject *__pyx_v_self, 
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
) {
  PyObject *__pyx_v_key = 0;
  PyObject *__pyx_v_default = 0;
  #if !CYTHON_METH_FASTCALL
  CYTHON_UNUSED Py_ssize_t __pyx_nargs;
  #endif
  CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
  PyObject* values[2] = {0,0};
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("get (wrapper)", 0);
  #if !CYTHON_METH_FASTCALL
  #if CYTHON_ASSUME_SAFE_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,&__pyx_mstate_global->__pyx_n_u_default,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, 2478, __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, 2478, __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, 2478, __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, 2478, __pyx_L3_error)
      if (!values[1]) values[1] = __Pyx_NewRef(((PyObject *)Py_None));
      for (Py_ssize_t i = __pyx_nargs; i < 1; i++) {
        if (unlikely(!values[i])) { __Pyx_RaiseArgtupleInvalid("get", 0, 1, 2, i); __PYX_ERR(0, 2478, __pyx_L3_error) }
      }
    } 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, 2478, __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, 2478, __pyx_L3_error)
        break;
        default: goto __pyx_L5_argtuple_error;
      }
      if (!values[1]) values[1] = __Pyx_NewRef(((PyObject *)Py_None));
    }
    __pyx_v_key = values[0];
    __pyx_v_default = values[1];
  }
  goto __pyx_L6_skip;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("get", 0, 1, 2, __pyx_nargs); __PYX_ERR(0, 2478, __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("pysam.libcbcf.VariantRecordFormat.get", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_5pysam_7libcbcf_19VariantRecordFormat_15get(((struct __pyx_obj_5pysam_7libcbcf_VariantRecordFormat *)__pyx_v_self), __pyx_v_key, __pyx_v_default);

  /* 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_5pysam_7libcbcf_19VariantRecordFormat_15get(struct __pyx_obj_5pysam_7libcbcf_VariantRecordFormat *__pyx_v_self, PyObject *__pyx_v_key, PyObject *__pyx_v_default) {
  PyObject *__pyx_r = NULL;
  __Pyx_TraceDeclarationsFunc
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  PyObject *__pyx_t_4 = NULL;
  int __pyx_t_5;
  PyObject *__pyx_t_6 = NULL;
  PyObject *__pyx_t_7 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_TraceFrameInit(((PyObject *)__pyx_mstate_global->__pyx_codeobj_tab[194]))
  __Pyx_RefNannySetupContext("get", 0);
  __Pyx_TraceStartFunc("get", __pyx_f[0], 2478, 0, 0, 0, __PYX_ERR(0, 2478, __pyx_L1_error));

  /* "pysam/libcbcf.pyx":2480
 *     def get(self, key, default=None):
 *         """D.get(k[,d]) -> D[k] if k in D, else d.  d defaults to None."""
 *         try:             # <<<<<<<<<<<<<<
 *             return self[key]
 *         except KeyError:
*/
  {
    __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:*/ {

      /* "pysam/libcbcf.pyx":2481
 *         """D.get(k[,d]) -> D[k] if k in D, else d.  d defaults to None."""
 *         try:
 *             return self[key]             # <<<<<<<<<<<<<<
 *         except KeyError:
 *             return default
*/
      __Pyx_XDECREF(__pyx_r);
      __pyx_t_4 = __Pyx_PyObject_GetItem(((PyObject *)__pyx_v_self), __pyx_v_key); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 2481, __pyx_L3_error)
      __Pyx_GOTREF(__pyx_t_4);
      __pyx_r = __pyx_t_4;
      __pyx_t_4 = 0;
      __Pyx_TraceReturnValue(__pyx_r, 3, 0, __PYX_ERR(0, 2481, __pyx_L3_error));
      goto __pyx_L7_try_return;

      /* "pysam/libcbcf.pyx":2480
 *     def get(self, key, default=None):
 *         """D.get(k[,d]) -> D[k] if k in D, else d.  d defaults to None."""
 *         try:             # <<<<<<<<<<<<<<
 *             return self[key]
 *         except KeyError:
*/
    }
    __pyx_L3_error:;
    __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
    __Pyx_TraceException(__pyx_lineno, 0, 0);

    /* "pysam/libcbcf.pyx":2482
 *         try:
 *             return self[key]
 *         except KeyError:             # <<<<<<<<<<<<<<
 *             return default
 * 
*/
    __pyx_t_5 = __Pyx_PyErr_ExceptionMatches(__pyx_builtin_KeyError);
    if (__pyx_t_5) {
      __Pyx_AddTraceback("pysam.libcbcf.VariantRecordFormat.get", __pyx_clineno, __pyx_lineno, __pyx_filename);
      __Pyx_TraceExceptionHandled(0);
      if (__Pyx_GetException(&__pyx_t_4, &__pyx_t_6, &__pyx_t_7) < 0) __PYX_ERR(0, 2482, __pyx_L5_except_error)
      __Pyx_XGOTREF(__pyx_t_4);
      __Pyx_XGOTREF(__pyx_t_6);
      __Pyx_XGOTREF(__pyx_t_7);
      __Pyx_TraceExceptionDone();

      /* "pysam/libcbcf.pyx":2483
 *             return self[key]
 *         except KeyError:
 *             return default             # <<<<<<<<<<<<<<
 * 
 *     def __contains__(self, key):
*/
      __Pyx_XDECREF(__pyx_r);
      __Pyx_INCREF(__pyx_v_default);
      __pyx_r = __pyx_v_default;
      __Pyx_TraceReturnValue(__pyx_r, 8, 0, __PYX_ERR(0, 2483, __pyx_L5_except_error));
      __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;

    /* "pysam/libcbcf.pyx":2480
 *     def get(self, key, default=None):
 *         """D.get(k[,d]) -> D[k] if k in D, else d.  d defaults to None."""
 *         try:             # <<<<<<<<<<<<<<
 *             return self[key]
 *         except KeyError:
*/
    __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;
  }

  /* "pysam/libcbcf.pyx":2478
 *                 yield bcf_str_cache_get_charptr(bcf_hdr_int2id(hdr, BCF_DT_ID, fmt.id))
 * 
 *     def get(self, key, default=None):             # <<<<<<<<<<<<<<
 *         """D.get(k[,d]) -> D[k] if k in D, else d.  d defaults to None."""
 *         try:
*/

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_XDECREF(__pyx_t_6);
  __Pyx_XDECREF(__pyx_t_7);
  __Pyx_TraceException(__pyx_lineno, 0, 0);
  #if CYTHON_USE_SYS_MONITORING
  __Pyx_TraceExceptionUnwind(0, 0);
  #else
  __Pyx_TraceReturnValue(NULL, 0, 0, __PYX_ERR(0, 2478, __pyx_L1_error));
  #endif
  __Pyx_AddTraceback("pysam.libcbcf.VariantRecordFormat.get", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_PyMonitoring_ExitScope(0);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "pysam/libcbcf.pyx":2485
 *             return default
 * 
 *     def __contains__(self, key):             # <<<<<<<<<<<<<<
 *         cdef bcf_hdr_t *hdr = self.record.header.ptr
 *         cdef bcf1_t *r = self.record.ptr
*/

/* Python wrapper */
static int __pyx_pw_5pysam_7libcbcf_19VariantRecordFormat_18__contains__(PyObject *__pyx_v_self, PyObject *__pyx_v_key); /*proto*/
static int __pyx_pw_5pysam_7libcbcf_19VariantRecordFormat_18__contains__(PyObject *__pyx_v_self, PyObject *__pyx_v_key) {
  CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__contains__ (wrapper)", 0);
  __pyx_kwvalues = __Pyx_KwValues_VARARGS(__pyx_args, __pyx_nargs);
  __pyx_r = __pyx_pf_5pysam_7libcbcf_19VariantRecordFormat_17__contains__(((struct __pyx_obj_5pysam_7libcbcf_VariantRecordFormat *)__pyx_v_self), ((PyObject *)__pyx_v_key));

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

static int __pyx_pf_5pysam_7libcbcf_19VariantRecordFormat_17__contains__(struct __pyx_obj_5pysam_7libcbcf_VariantRecordFormat *__pyx_v_self, PyObject *__pyx_v_key) {
  bcf_hdr_t *__pyx_v_hdr;
  bcf1_t *__pyx_v_r;
  PyObject *__pyx_v_bkey = 0;
  bcf_fmt_t *__pyx_v_fmt;
  int __pyx_r;
  __Pyx_TraceDeclarationsFunc
  __Pyx_RefNannyDeclarations
  bcf_hdr_t *__pyx_t_1;
  bcf1_t *__pyx_t_2;
  PyObject *__pyx_t_3 = NULL;
  char const *__pyx_t_4;
  int __pyx_t_5;
  int __pyx_t_6;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_TraceFrameInit(((PyObject *)__pyx_mstate_global->__pyx_codeobj_tab[195]))
  __Pyx_RefNannySetupContext("__contains__", 0);
  __Pyx_TraceStartFunc("__contains__", __pyx_f[0], 2485, 0, 0, 0, __PYX_ERR(0, 2485, __pyx_L1_error));

  /* "pysam/libcbcf.pyx":2486
 * 
 *     def __contains__(self, key):
 *         cdef bcf_hdr_t *hdr = self.record.header.ptr             # <<<<<<<<<<<<<<
 *         cdef bcf1_t *r = self.record.ptr
 *         cdef bytes bkey = force_bytes(key)
*/
  __pyx_t_1 = __pyx_v_self->record->header->ptr;
  __pyx_v_hdr = __pyx_t_1;

  /* "pysam/libcbcf.pyx":2487
 *     def __contains__(self, key):
 *         cdef bcf_hdr_t *hdr = self.record.header.ptr
 *         cdef bcf1_t *r = self.record.ptr             # <<<<<<<<<<<<<<
 *         cdef bytes bkey = force_bytes(key)
 *         cdef bcf_fmt_t *fmt = bcf_get_fmt(hdr, r, bkey)
*/
  __pyx_t_2 = __pyx_v_self->record->ptr;
  __pyx_v_r = __pyx_t_2;

  /* "pysam/libcbcf.pyx":2488
 *         cdef bcf_hdr_t *hdr = self.record.header.ptr
 *         cdef bcf1_t *r = self.record.ptr
 *         cdef bytes bkey = force_bytes(key)             # <<<<<<<<<<<<<<
 *         cdef bcf_fmt_t *fmt = bcf_get_fmt(hdr, r, bkey)
 *         return fmt != NULL and fmt.p != NULL
*/
  __pyx_t_3 = __pyx_f_5pysam_9libcutils_force_bytes(__pyx_v_key, NULL); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 2488, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __pyx_v_bkey = ((PyObject*)__pyx_t_3);
  __pyx_t_3 = 0;

  /* "pysam/libcbcf.pyx":2489
 *         cdef bcf1_t *r = self.record.ptr
 *         cdef bytes bkey = force_bytes(key)
 *         cdef bcf_fmt_t *fmt = bcf_get_fmt(hdr, r, bkey)             # <<<<<<<<<<<<<<
 *         return fmt != NULL and fmt.p != NULL
 * 
*/
  if (unlikely(__pyx_v_bkey == Py_None)) {
    PyErr_SetString(PyExc_TypeError, "expected bytes, NoneType found");
    __PYX_ERR(0, 2489, __pyx_L1_error)
  }
  __pyx_t_4 = __Pyx_PyBytes_AsString(__pyx_v_bkey); if (unlikely((!__pyx_t_4) && PyErr_Occurred())) __PYX_ERR(0, 2489, __pyx_L1_error)
  __pyx_v_fmt = bcf_get_fmt(__pyx_v_hdr, __pyx_v_r, __pyx_t_4);

  /* "pysam/libcbcf.pyx":2490
 *         cdef bytes bkey = force_bytes(key)
 *         cdef bcf_fmt_t *fmt = bcf_get_fmt(hdr, r, bkey)
 *         return fmt != NULL and fmt.p != NULL             # <<<<<<<<<<<<<<
 * 
 *     def iterkeys(self):
*/
  __pyx_t_6 = (__pyx_v_fmt != NULL);
  if (__pyx_t_6) {
  } else {
    __pyx_t_5 = __pyx_t_6;
    goto __pyx_L3_bool_binop_done;
  }
  __pyx_t_6 = (__pyx_v_fmt->p != NULL);
  __pyx_t_5 = __pyx_t_6;
  __pyx_L3_bool_binop_done:;
  __pyx_r = __pyx_t_5;
  __Pyx_TraceReturnCValue(__pyx_r, __Pyx_PyLong_From_int, 20, 0, __PYX_ERR(0, 2490, __pyx_L1_error));
  goto __pyx_L0;

  /* "pysam/libcbcf.pyx":2485
 *             return default
 * 
 *     def __contains__(self, key):             # <<<<<<<<<<<<<<
 *         cdef bcf_hdr_t *hdr = self.record.header.ptr
 *         cdef bcf1_t *r = self.record.ptr
*/

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_TraceException(__pyx_lineno, 0, 0);
  #if CYTHON_USE_SYS_MONITORING
  __Pyx_TraceExceptionUnwind(0, 0);
  #else
  __Pyx_TraceReturnValue(NULL, 0, 0, __PYX_ERR(0, 2485, __pyx_L1_error));
  #endif
  __Pyx_AddTraceback("pysam.libcbcf.VariantRecordFormat.__contains__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = -1;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_bkey);
  __Pyx_PyMonitoring_ExitScope(0);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "pysam/libcbcf.pyx":2492
 *         return fmt != NULL and fmt.p != NULL
 * 
 *     def iterkeys(self):             # <<<<<<<<<<<<<<
 *         """D.iterkeys() -> an iterator over the keys of D"""
 *         return iter(self)
*/

/* Python wrapper */
static PyObject *__pyx_pw_5pysam_7libcbcf_19VariantRecordFormat_20iterkeys(PyObject *__pyx_v_self, 
#if 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_5pysam_7libcbcf_19VariantRecordFormat_19iterkeys, "VariantRecordFormat.iterkeys(self)\n\nD.iterkeys() -> an iterator over the keys of D");
static PyMethodDef __pyx_mdef_5pysam_7libcbcf_19VariantRecordFormat_20iterkeys = {"iterkeys", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_5pysam_7libcbcf_19VariantRecordFormat_20iterkeys, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_5pysam_7libcbcf_19VariantRecordFormat_19iterkeys};
static PyObject *__pyx_pw_5pysam_7libcbcf_19VariantRecordFormat_20iterkeys(PyObject *__pyx_v_self, 
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
) {
  #if !CYTHON_METH_FASTCALL
  CYTHON_UNUSED Py_ssize_t __pyx_nargs;
  #endif
  CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("iterkeys (wrapper)", 0);
  #if !CYTHON_METH_FASTCALL
  #if CYTHON_ASSUME_SAFE_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("iterkeys", 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("iterkeys", __pyx_kwds); return NULL;}
  __pyx_r = __pyx_pf_5pysam_7libcbcf_19VariantRecordFormat_19iterkeys(((struct __pyx_obj_5pysam_7libcbcf_VariantRecordFormat *)__pyx_v_self));

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

static PyObject *__pyx_pf_5pysam_7libcbcf_19VariantRecordFormat_19iterkeys(struct __pyx_obj_5pysam_7libcbcf_VariantRecordFormat *__pyx_v_self) {
  PyObject *__pyx_r = NULL;
  __Pyx_TraceDeclarationsFunc
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_TraceFrameInit(((PyObject *)__pyx_mstate_global->__pyx_codeobj_tab[196]))
  __Pyx_RefNannySetupContext("iterkeys", 0);
  __Pyx_TraceStartFunc("iterkeys", __pyx_f[0], 2492, 0, 0, 0, __PYX_ERR(0, 2492, __pyx_L1_error));

  /* "pysam/libcbcf.pyx":2494
 *     def iterkeys(self):
 *         """D.iterkeys() -> an iterator over the keys of D"""
 *         return iter(self)             # <<<<<<<<<<<<<<
 * 
 *     def itervalues(self):
*/
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = PyObject_GetIter(((PyObject *)__pyx_v_self)); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 2494, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  __Pyx_TraceReturnValue(__pyx_r, 1, 0, __PYX_ERR(0, 2494, __pyx_L1_error));
  goto __pyx_L0;

  /* "pysam/libcbcf.pyx":2492
 *         return fmt != NULL and fmt.p != NULL
 * 
 *     def iterkeys(self):             # <<<<<<<<<<<<<<
 *         """D.iterkeys() -> an iterator over the keys of D"""
 *         return iter(self)
*/

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_TraceException(__pyx_lineno, 0, 0);
  #if CYTHON_USE_SYS_MONITORING
  __Pyx_TraceExceptionUnwind(0, 0);
  #else
  __Pyx_TraceReturnValue(NULL, 0, 0, __PYX_ERR(0, 2492, __pyx_L1_error));
  #endif
  __Pyx_AddTraceback("pysam.libcbcf.VariantRecordFormat.iterkeys", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_PyMonitoring_ExitScope(0);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}
static PyObject *__pyx_gb_5pysam_7libcbcf_19VariantRecordFormat_23generator15(__pyx_CoroutineObject *__pyx_generator, CYTHON_UNUSED PyThreadState *__pyx_tstate, PyObject *__pyx_sent_value); /* proto */

/* "pysam/libcbcf.pyx":2496
 *         return iter(self)
 * 
 *     def itervalues(self):             # <<<<<<<<<<<<<<
 *         """D.itervalues() -> an iterator over the values of D"""
 *         for key in self:
*/

/* Python wrapper */
static PyObject *__pyx_pw_5pysam_7libcbcf_19VariantRecordFormat_22itervalues(PyObject *__pyx_v_self, 
#if 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_5pysam_7libcbcf_19VariantRecordFormat_21itervalues, "VariantRecordFormat.itervalues(self)\n\nD.itervalues() -> an iterator over the values of D");
static PyMethodDef __pyx_mdef_5pysam_7libcbcf_19VariantRecordFormat_22itervalues = {"itervalues", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_5pysam_7libcbcf_19VariantRecordFormat_22itervalues, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_5pysam_7libcbcf_19VariantRecordFormat_21itervalues};
static PyObject *__pyx_pw_5pysam_7libcbcf_19VariantRecordFormat_22itervalues(PyObject *__pyx_v_self, 
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
) {
  #if !CYTHON_METH_FASTCALL
  CYTHON_UNUSED Py_ssize_t __pyx_nargs;
  #endif
  CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("itervalues (wrapper)", 0);
  #if !CYTHON_METH_FASTCALL
  #if CYTHON_ASSUME_SAFE_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("itervalues", 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("itervalues", __pyx_kwds); return NULL;}
  __pyx_r = __pyx_pf_5pysam_7libcbcf_19VariantRecordFormat_21itervalues(((struct __pyx_obj_5pysam_7libcbcf_VariantRecordFormat *)__pyx_v_self));

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

static PyObject *__pyx_pf_5pysam_7libcbcf_19VariantRecordFormat_21itervalues(struct __pyx_obj_5pysam_7libcbcf_VariantRecordFormat *__pyx_v_self) {
  struct __pyx_obj_5pysam_7libcbcf___pyx_scope_struct_22_itervalues *__pyx_cur_scope;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("itervalues", 0);
  __pyx_cur_scope = (struct __pyx_obj_5pysam_7libcbcf___pyx_scope_struct_22_itervalues *)__pyx_tp_new_5pysam_7libcbcf___pyx_scope_struct_22_itervalues(__pyx_mstate_global->__pyx_ptype_5pysam_7libcbcf___pyx_scope_struct_22_itervalues, __pyx_mstate_global->__pyx_empty_tuple, NULL);
  if (unlikely(!__pyx_cur_scope)) {
    __pyx_cur_scope = ((struct __pyx_obj_5pysam_7libcbcf___pyx_scope_struct_22_itervalues *)Py_None);
    __Pyx_INCREF(Py_None);
    __PYX_ERR(0, 2496, __pyx_L1_error)
  } else {
    __Pyx_GOTREF((PyObject *)__pyx_cur_scope);
  }
  __pyx_cur_scope->__pyx_v_self = __pyx_v_self;
  __Pyx_INCREF((PyObject *)__pyx_cur_scope->__pyx_v_self);
  __Pyx_GIVEREF((PyObject *)__pyx_cur_scope->__pyx_v_self);
  {
    __pyx_CoroutineObject *gen = __Pyx_Generator_New((__pyx_coroutine_body_t) __pyx_gb_5pysam_7libcbcf_19VariantRecordFormat_23generator15, ((PyObject *)__pyx_mstate_global->__pyx_codeobj_tab[197]), (PyObject *) __pyx_cur_scope, __pyx_mstate_global->__pyx_n_u_itervalues, __pyx_mstate_global->__pyx_n_u_VariantRecordFormat_itervalues, __pyx_mstate_global->__pyx_n_u_pysam_libcbcf); if (unlikely(!gen)) __PYX_ERR(0, 2496, __pyx_L1_error)
    __Pyx_DECREF(__pyx_cur_scope);
    __Pyx_RefNannyFinishContext();
    return (PyObject *) gen;
  }

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_AddTraceback("pysam.libcbcf.VariantRecordFormat.itervalues", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __Pyx_DECREF((PyObject *)__pyx_cur_scope);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_gb_5pysam_7libcbcf_19VariantRecordFormat_23generator15(__pyx_CoroutineObject *__pyx_generator, CYTHON_UNUSED PyThreadState *__pyx_tstate, PyObject *__pyx_sent_value) /* generator body */
{
  struct __pyx_obj_5pysam_7libcbcf___pyx_scope_struct_22_itervalues *__pyx_cur_scope = ((struct __pyx_obj_5pysam_7libcbcf___pyx_scope_struct_22_itervalues *)__pyx_generator->closure);
  PyObject *__pyx_r = NULL;
  __Pyx_TraceDeclarationsGen
  PyObject *__pyx_t_1 = NULL;
  Py_ssize_t __pyx_t_2;
  PyObject *(*__pyx_t_3)(PyObject *);
  PyObject *__pyx_t_4 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("itervalues", 0);
  switch (__pyx_generator->resume_label) {
    case 0: goto __pyx_L3_first_run;
    case 1: goto __pyx_L6_resume_from_yield;
    default: /* CPython raises the right error here */
    __Pyx_TraceStartGen("itervalues", __pyx_f[0], 2496, 0, 0, 0, __PYX_ERR(0, 2496, __pyx_L1_error));
    __Pyx_TraceReturnValue(Py_None, 0, 0, __PYX_ERR(0, 2496, __pyx_L1_error));
    __Pyx_RefNannyFinishContext();
    return NULL;
  }
  __pyx_L3_first_run:;
  __Pyx_TraceStartGen("itervalues", __pyx_f[0], 2496, 0, 0, 0, __PYX_ERR(0, 2496, __pyx_L1_error));
  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, 2496, __pyx_L1_error)
  }

  /* "pysam/libcbcf.pyx":2498
 *     def itervalues(self):
 *         """D.itervalues() -> an iterator over the values of D"""
 *         for key in self:             # <<<<<<<<<<<<<<
 *             yield self[key]
 * 
*/
  if (likely(PyList_CheckExact(((PyObject *)__pyx_cur_scope->__pyx_v_self))) || PyTuple_CheckExact(((PyObject *)__pyx_cur_scope->__pyx_v_self))) {
    __pyx_t_1 = ((PyObject *)__pyx_cur_scope->__pyx_v_self); __Pyx_INCREF(__pyx_t_1);
    __pyx_t_2 = 0;
    __pyx_t_3 = NULL;
  } else {
    __pyx_t_2 = -1; __pyx_t_1 = PyObject_GetIter(((PyObject *)__pyx_cur_scope->__pyx_v_self)); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 2498, __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, 2498, __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, 2498, __pyx_L1_error)
          #endif
          if (__pyx_t_2 >= __pyx_temp) break;
        }
        __pyx_t_4 = __Pyx_PyList_GetItemRef(__pyx_t_1, __pyx_t_2);
        ++__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, 2498, __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, 2498, __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, 2498, __pyx_L1_error)
          PyErr_Clear();
        }
        break;
      }
    }
    __Pyx_GOTREF(__pyx_t_4);
    __Pyx_XGOTREF(__pyx_cur_scope->__pyx_v_key);
    __Pyx_XDECREF_SET(__pyx_cur_scope->__pyx_v_key, __pyx_t_4);
    __Pyx_GIVEREF(__pyx_t_4);
    __pyx_t_4 = 0;

    /* "pysam/libcbcf.pyx":2499
 *         """D.itervalues() -> an iterator over the values of D"""
 *         for key in self:
 *             yield self[key]             # <<<<<<<<<<<<<<
 * 
 *     def iteritems(self):
*/
    __pyx_t_4 = __Pyx_PyObject_GetItem(((PyObject *)__pyx_cur_scope->__pyx_v_self), __pyx_cur_scope->__pyx_v_key); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 2499, __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_TraceYield(__pyx_r, 0, __PYX_ERR(0, 2499, __pyx_L1_error));
    __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_TraceResumeGen("itervalues", __pyx_f[0], 2496, 0, __PYX_ERR(0, 2499, __pyx_L1_error));
    __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, 2499, __pyx_L1_error)

    /* "pysam/libcbcf.pyx":2498
 *     def itervalues(self):
 *         """D.itervalues() -> an iterator over the values of D"""
 *         for key in self:             # <<<<<<<<<<<<<<
 *             yield self[key]
 * 
*/
  }
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  CYTHON_MAYBE_UNUSED_VAR(__pyx_cur_scope);
  __Pyx_TraceReturnValue(Py_None, 0, 0, __PYX_ERR(0, 2496, __pyx_L1_error));

  /* "pysam/libcbcf.pyx":2496
 *         return iter(self)
 * 
 *     def itervalues(self):             # <<<<<<<<<<<<<<
 *         """D.itervalues() -> an iterator over the values of D"""
 *         for key in self:
*/

  /* 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_TraceException(__pyx_lineno, 0, 0);
    __Pyx_Generator_Replace_StopIteration(0);
    __Pyx_AddTraceback("itervalues", __pyx_clineno, __pyx_lineno, __pyx_filename);
    __Pyx_TraceExceptionUnwind(0, 0);
  }
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_PyMonitoring_ExitScope(0);
  #if !CYTHON_USE_EXC_INFO_STACK
  __Pyx_Coroutine_ResetAndClearException(__pyx_generator);
  #endif
  __pyx_generator->resume_label = -1;
  __Pyx_Coroutine_clear((PyObject*)__pyx_generator);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}
static PyObject *__pyx_gb_5pysam_7libcbcf_19VariantRecordFormat_26generator16(__pyx_CoroutineObject *__pyx_generator, CYTHON_UNUSED PyThreadState *__pyx_tstate, PyObject *__pyx_sent_value); /* proto */

/* "pysam/libcbcf.pyx":2501
 *             yield self[key]
 * 
 *     def iteritems(self):             # <<<<<<<<<<<<<<
 *         """D.iteritems() -> an iterator over the (key, value) items of D"""
 *         for key in self:
*/

/* Python wrapper */
static PyObject *__pyx_pw_5pysam_7libcbcf_19VariantRecordFormat_25iteritems(PyObject *__pyx_v_self, 
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
); /*proto*/
PyDoc_STRVAR(__pyx_doc_5pysam_7libcbcf_19VariantRecordFormat_24iteritems, "VariantRecordFormat.iteritems(self)\n\nD.iteritems() -> an iterator over the (key, value) items of D");
static PyMethodDef __pyx_mdef_5pysam_7libcbcf_19VariantRecordFormat_25iteritems = {"iteritems", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_5pysam_7libcbcf_19VariantRecordFormat_25iteritems, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_5pysam_7libcbcf_19VariantRecordFormat_24iteritems};
static PyObject *__pyx_pw_5pysam_7libcbcf_19VariantRecordFormat_25iteritems(PyObject *__pyx_v_self, 
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
) {
  #if !CYTHON_METH_FASTCALL
  CYTHON_UNUSED Py_ssize_t __pyx_nargs;
  #endif
  CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("iteritems (wrapper)", 0);
  #if !CYTHON_METH_FASTCALL
  #if CYTHON_ASSUME_SAFE_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("iteritems", 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("iteritems", __pyx_kwds); return NULL;}
  __pyx_r = __pyx_pf_5pysam_7libcbcf_19VariantRecordFormat_24iteritems(((struct __pyx_obj_5pysam_7libcbcf_VariantRecordFormat *)__pyx_v_self));

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

static PyObject *__pyx_pf_5pysam_7libcbcf_19VariantRecordFormat_24iteritems(struct __pyx_obj_5pysam_7libcbcf_VariantRecordFormat *__pyx_v_self) {
  struct __pyx_obj_5pysam_7libcbcf___pyx_scope_struct_23_iteritems *__pyx_cur_scope;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("iteritems", 0);
  __pyx_cur_scope = (struct __pyx_obj_5pysam_7libcbcf___pyx_scope_struct_23_iteritems *)__pyx_tp_new_5pysam_7libcbcf___pyx_scope_struct_23_iteritems(__pyx_mstate_global->__pyx_ptype_5pysam_7libcbcf___pyx_scope_struct_23_iteritems, __pyx_mstate_global->__pyx_empty_tuple, NULL);
  if (unlikely(!__pyx_cur_scope)) {
    __pyx_cur_scope = ((struct __pyx_obj_5pysam_7libcbcf___pyx_scope_struct_23_iteritems *)Py_None);
    __Pyx_INCREF(Py_None);
    __PYX_ERR(0, 2501, __pyx_L1_error)
  } else {
    __Pyx_GOTREF((PyObject *)__pyx_cur_scope);
  }
  __pyx_cur_scope->__pyx_v_self = __pyx_v_self;
  __Pyx_INCREF((PyObject *)__pyx_cur_scope->__pyx_v_self);
  __Pyx_GIVEREF((PyObject *)__pyx_cur_scope->__pyx_v_self);
  {
    __pyx_CoroutineObject *gen = __Pyx_Generator_New((__pyx_coroutine_body_t) __pyx_gb_5pysam_7libcbcf_19VariantRecordFormat_26generator16, ((PyObject *)__pyx_mstate_global->__pyx_codeobj_tab[198]), (PyObject *) __pyx_cur_scope, __pyx_mstate_global->__pyx_n_u_iteritems, __pyx_mstate_global->__pyx_n_u_VariantRecordFormat_iteritems, __pyx_mstate_global->__pyx_n_u_pysam_libcbcf); if (unlikely(!gen)) __PYX_ERR(0, 2501, __pyx_L1_error)
    __Pyx_DECREF(__pyx_cur_scope);
    __Pyx_RefNannyFinishContext();
    return (PyObject *) gen;
  }

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_AddTraceback("pysam.libcbcf.VariantRecordFormat.iteritems", __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_5pysam_7libcbcf_19VariantRecordFormat_26generator16(__pyx_CoroutineObject *__pyx_generator, CYTHON_UNUSED PyThreadState *__pyx_tstate, PyObject *__pyx_sent_value) /* generator body */
{
  struct __pyx_obj_5pysam_7libcbcf___pyx_scope_struct_23_iteritems *__pyx_cur_scope = ((struct __pyx_obj_5pysam_7libcbcf___pyx_scope_struct_23_iteritems *)__pyx_generator->closure);
  PyObject *__pyx_r = NULL;
  __Pyx_TraceDeclarationsGen
  PyObject *__pyx_t_1 = NULL;
  Py_ssize_t __pyx_t_2;
  PyObject *(*__pyx_t_3)(PyObject *);
  PyObject *__pyx_t_4 = NULL;
  PyObject *__pyx_t_5 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("iteritems", 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_TraceStartGen("iteritems", __pyx_f[0], 2501, 0, 0, 0, __PYX_ERR(0, 2501, __pyx_L1_error));
    __Pyx_TraceReturnValue(Py_None, 0, 0, __PYX_ERR(0, 2501, __pyx_L1_error));
    __Pyx_RefNannyFinishContext();
    return NULL;
  }
  __pyx_L3_first_run:;
  __Pyx_TraceStartGen("iteritems", __pyx_f[0], 2501, 0, 0, 0, __PYX_ERR(0, 2501, __pyx_L1_error));
  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, 2501, __pyx_L1_error)
  }

  /* "pysam/libcbcf.pyx":2503
 *     def iteritems(self):
 *         """D.iteritems() -> an iterator over the (key, value) items of D"""
 *         for key in self:             # <<<<<<<<<<<<<<
 *             yield (key, self[key])
 * 
*/
  if (likely(PyList_CheckExact(((PyObject *)__pyx_cur_scope->__pyx_v_self))) || PyTuple_CheckExact(((PyObject *)__pyx_cur_scope->__pyx_v_self))) {
    __pyx_t_1 = ((PyObject *)__pyx_cur_scope->__pyx_v_self); __Pyx_INCREF(__pyx_t_1);
    __pyx_t_2 = 0;
    __pyx_t_3 = NULL;
  } else {
    __pyx_t_2 = -1; __pyx_t_1 = PyObject_GetIter(((PyObject *)__pyx_cur_scope->__pyx_v_self)); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 2503, __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, 2503, __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, 2503, __pyx_L1_error)
          #endif
          if (__pyx_t_2 >= __pyx_temp) break;
        }
        __pyx_t_4 = __Pyx_PyList_GetItemRef(__pyx_t_1, __pyx_t_2);
        ++__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, 2503, __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, 2503, __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, 2503, __pyx_L1_error)
          PyErr_Clear();
        }
        break;
      }
    }
    __Pyx_GOTREF(__pyx_t_4);
    __Pyx_XGOTREF(__pyx_cur_scope->__pyx_v_key);
    __Pyx_XDECREF_SET(__pyx_cur_scope->__pyx_v_key, __pyx_t_4);
    __Pyx_GIVEREF(__pyx_t_4);
    __pyx_t_4 = 0;

    /* "pysam/libcbcf.pyx":2504
 *         """D.iteritems() -> an iterator over the (key, value) items of D"""
 *         for key in self:
 *             yield (key, self[key])             # <<<<<<<<<<<<<<
 * 
 *     def keys(self):
*/
    __pyx_t_4 = __Pyx_PyObject_GetItem(((PyObject *)__pyx_cur_scope->__pyx_v_self), __pyx_cur_scope->__pyx_v_key); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 2504, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
    __pyx_t_5 = PyTuple_New(2); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 2504, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_5);
    __Pyx_INCREF(__pyx_cur_scope->__pyx_v_key);
    __Pyx_GIVEREF(__pyx_cur_scope->__pyx_v_key);
    if (__Pyx_PyTuple_SET_ITEM(__pyx_t_5, 0, __pyx_cur_scope->__pyx_v_key) != (0)) __PYX_ERR(0, 2504, __pyx_L1_error);
    __Pyx_GIVEREF(__pyx_t_4);
    if (__Pyx_PyTuple_SET_ITEM(__pyx_t_5, 1, __pyx_t_4) != (0)) __PYX_ERR(0, 2504, __pyx_L1_error);
    __pyx_t_4 = 0;
    __pyx_r = __pyx_t_5;
    __pyx_t_5 = 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_TraceYield(__pyx_r, 0, __PYX_ERR(0, 2504, __pyx_L1_error));
    __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_TraceResumeGen("iteritems", __pyx_f[0], 2501, 0, __PYX_ERR(0, 2504, __pyx_L1_error));
    __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, 2504, __pyx_L1_error)

    /* "pysam/libcbcf.pyx":2503
 *     def iteritems(self):
 *         """D.iteritems() -> an iterator over the (key, value) items of D"""
 *         for key in self:             # <<<<<<<<<<<<<<
 *             yield (key, self[key])
 * 
*/
  }
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  CYTHON_MAYBE_UNUSED_VAR(__pyx_cur_scope);
  __Pyx_TraceReturnValue(Py_None, 0, 0, __PYX_ERR(0, 2501, __pyx_L1_error));

  /* "pysam/libcbcf.pyx":2501
 *             yield self[key]
 * 
 *     def iteritems(self):             # <<<<<<<<<<<<<<
 *         """D.iteritems() -> an iterator over the (key, value) items of D"""
 *         for key in self:
*/

  /* 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);
  if (__Pyx_PyErr_Occurred()) {
    __Pyx_TraceException(__pyx_lineno, 0, 0);
    __Pyx_Generator_Replace_StopIteration(0);
    __Pyx_AddTraceback("iteritems", __pyx_clineno, __pyx_lineno, __pyx_filename);
    __Pyx_TraceExceptionUnwind(0, 0);
  }
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_PyMonitoring_ExitScope(0);
  #if !CYTHON_USE_EXC_INFO_STACK
  __Pyx_Coroutine_ResetAndClearException(__pyx_generator);
  #endif
  __pyx_generator->resume_label = -1;
  __Pyx_Coroutine_clear((PyObject*)__pyx_generator);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "pysam/libcbcf.pyx":2506
 *             yield (key, self[key])
 * 
 *     def keys(self):             # <<<<<<<<<<<<<<
 *         """D.keys() -> list of D's keys"""
 *         return list(self)
*/

/* Python wrapper */
static PyObject *__pyx_pw_5pysam_7libcbcf_19VariantRecordFormat_28keys(PyObject *__pyx_v_self, 
#if 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_5pysam_7libcbcf_19VariantRecordFormat_27keys, "VariantRecordFormat.keys(self)\n\nD.keys() -> list of D's keys");
static PyMethodDef __pyx_mdef_5pysam_7libcbcf_19VariantRecordFormat_28keys = {"keys", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_5pysam_7libcbcf_19VariantRecordFormat_28keys, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_5pysam_7libcbcf_19VariantRecordFormat_27keys};
static PyObject *__pyx_pw_5pysam_7libcbcf_19VariantRecordFormat_28keys(PyObject *__pyx_v_self, 
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
) {
  #if !CYTHON_METH_FASTCALL
  CYTHON_UNUSED Py_ssize_t __pyx_nargs;
  #endif
  CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("keys (wrapper)", 0);
  #if !CYTHON_METH_FASTCALL
  #if CYTHON_ASSUME_SAFE_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("keys", 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("keys", __pyx_kwds); return NULL;}
  __pyx_r = __pyx_pf_5pysam_7libcbcf_19VariantRecordFormat_27keys(((struct __pyx_obj_5pysam_7libcbcf_VariantRecordFormat *)__pyx_v_self));

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

static PyObject *__pyx_pf_5pysam_7libcbcf_19VariantRecordFormat_27keys(struct __pyx_obj_5pysam_7libcbcf_VariantRecordFormat *__pyx_v_self) {
  PyObject *__pyx_r = NULL;
  __Pyx_TraceDeclarationsFunc
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_TraceFrameInit(((PyObject *)__pyx_mstate_global->__pyx_codeobj_tab[199]))
  __Pyx_RefNannySetupContext("keys", 0);
  __Pyx_TraceStartFunc("keys", __pyx_f[0], 2506, 0, 0, 0, __PYX_ERR(0, 2506, __pyx_L1_error));

  /* "pysam/libcbcf.pyx":2508
 *     def keys(self):
 *         """D.keys() -> list of D's keys"""
 *         return list(self)             # <<<<<<<<<<<<<<
 * 
 *     def items(self):
*/
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = PySequence_List(((PyObject *)__pyx_v_self)); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 2508, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  __Pyx_TraceReturnValue(__pyx_r, 1, 0, __PYX_ERR(0, 2508, __pyx_L1_error));
  goto __pyx_L0;

  /* "pysam/libcbcf.pyx":2506
 *             yield (key, self[key])
 * 
 *     def keys(self):             # <<<<<<<<<<<<<<
 *         """D.keys() -> list of D's keys"""
 *         return list(self)
*/

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_TraceException(__pyx_lineno, 0, 0);
  #if CYTHON_USE_SYS_MONITORING
  __Pyx_TraceExceptionUnwind(0, 0);
  #else
  __Pyx_TraceReturnValue(NULL, 0, 0, __PYX_ERR(0, 2506, __pyx_L1_error));
  #endif
  __Pyx_AddTraceback("pysam.libcbcf.VariantRecordFormat.keys", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_PyMonitoring_ExitScope(0);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "pysam/libcbcf.pyx":2510
 *         return list(self)
 * 
 *     def items(self):             # <<<<<<<<<<<<<<
 *         """D.items() -> list of D's (key, value) pairs, as 2-tuples"""
 *         return list(self.iteritems())
*/

/* Python wrapper */
static PyObject *__pyx_pw_5pysam_7libcbcf_19VariantRecordFormat_30items(PyObject *__pyx_v_self, 
#if 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_5pysam_7libcbcf_19VariantRecordFormat_29items, "VariantRecordFormat.items(self)\n\nD.items() -> list of D's (key, value) pairs, as 2-tuples");
static PyMethodDef __pyx_mdef_5pysam_7libcbcf_19VariantRecordFormat_30items = {"items", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_5pysam_7libcbcf_19VariantRecordFormat_30items, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_5pysam_7libcbcf_19VariantRecordFormat_29items};
static PyObject *__pyx_pw_5pysam_7libcbcf_19VariantRecordFormat_30items(PyObject *__pyx_v_self, 
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
) {
  #if !CYTHON_METH_FASTCALL
  CYTHON_UNUSED Py_ssize_t __pyx_nargs;
  #endif
  CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("items (wrapper)", 0);
  #if !CYTHON_METH_FASTCALL
  #if CYTHON_ASSUME_SAFE_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("items", 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("items", __pyx_kwds); return NULL;}
  __pyx_r = __pyx_pf_5pysam_7libcbcf_19VariantRecordFormat_29items(((struct __pyx_obj_5pysam_7libcbcf_VariantRecordFormat *)__pyx_v_self));

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

static PyObject *__pyx_pf_5pysam_7libcbcf_19VariantRecordFormat_29items(struct __pyx_obj_5pysam_7libcbcf_VariantRecordFormat *__pyx_v_self) {
  PyObject *__pyx_r = NULL;
  __Pyx_TraceDeclarationsFunc
  __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_TraceFrameInit(((PyObject *)__pyx_mstate_global->__pyx_codeobj_tab[200]))
  __Pyx_RefNannySetupContext("items", 0);
  __Pyx_TraceStartFunc("items", __pyx_f[0], 2510, 0, 0, 0, __PYX_ERR(0, 2510, __pyx_L1_error));

  /* "pysam/libcbcf.pyx":2512
 *     def items(self):
 *         """D.items() -> list of D's (key, value) pairs, as 2-tuples"""
 *         return list(self.iteritems())             # <<<<<<<<<<<<<<
 * 
 *     def values(self):
*/
  __Pyx_XDECREF(__pyx_r);
  __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(__pyx_mstate_global->__pyx_n_u_iteritems, __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, 2512, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
  }
  __pyx_t_2 = __Pyx_PySequence_ListKeepNew(__pyx_t_1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 2512, __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;
  __Pyx_TraceReturnValue(__pyx_r, 1, 0, __PYX_ERR(0, 2512, __pyx_L1_error));
  goto __pyx_L0;

  /* "pysam/libcbcf.pyx":2510
 *         return list(self)
 * 
 *     def items(self):             # <<<<<<<<<<<<<<
 *         """D.items() -> list of D's (key, value) pairs, as 2-tuples"""
 *         return list(self.iteritems())
*/

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_TraceException(__pyx_lineno, 0, 0);
  #if CYTHON_USE_SYS_MONITORING
  __Pyx_TraceExceptionUnwind(0, 0);
  #else
  __Pyx_TraceReturnValue(NULL, 0, 0, __PYX_ERR(0, 2510, __pyx_L1_error));
  #endif
  __Pyx_AddTraceback("pysam.libcbcf.VariantRecordFormat.items", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_PyMonitoring_ExitScope(0);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "pysam/libcbcf.pyx":2514
 *         return list(self.iteritems())
 * 
 *     def values(self):             # <<<<<<<<<<<<<<
 *         """D.values() -> list of D's values"""
 *         return list(self.itervalues())
*/

/* Python wrapper */
static PyObject *__pyx_pw_5pysam_7libcbcf_19VariantRecordFormat_32values(PyObject *__pyx_v_self, 
#if 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_5pysam_7libcbcf_19VariantRecordFormat_31values, "VariantRecordFormat.values(self)\n\nD.values() -> list of D's values");
static PyMethodDef __pyx_mdef_5pysam_7libcbcf_19VariantRecordFormat_32values = {"values", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_5pysam_7libcbcf_19VariantRecordFormat_32values, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_5pysam_7libcbcf_19VariantRecordFormat_31values};
static PyObject *__pyx_pw_5pysam_7libcbcf_19VariantRecordFormat_32values(PyObject *__pyx_v_self, 
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
) {
  #if !CYTHON_METH_FASTCALL
  CYTHON_UNUSED Py_ssize_t __pyx_nargs;
  #endif
  CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("values (wrapper)", 0);
  #if !CYTHON_METH_FASTCALL
  #if CYTHON_ASSUME_SAFE_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("values", 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("values", __pyx_kwds); return NULL;}
  __pyx_r = __pyx_pf_5pysam_7libcbcf_19VariantRecordFormat_31values(((struct __pyx_obj_5pysam_7libcbcf_VariantRecordFormat *)__pyx_v_self));

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

static PyObject *__pyx_pf_5pysam_7libcbcf_19VariantRecordFormat_31values(struct __pyx_obj_5pysam_7libcbcf_VariantRecordFormat *__pyx_v_self) {
  PyObject *__pyx_r = NULL;
  __Pyx_TraceDeclarationsFunc
  __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_TraceFrameInit(((PyObject *)__pyx_mstate_global->__pyx_codeobj_tab[201]))
  __Pyx_RefNannySetupContext("values", 0);
  __Pyx_TraceStartFunc("values", __pyx_f[0], 2514, 0, 0, 0, __PYX_ERR(0, 2514, __pyx_L1_error));

  /* "pysam/libcbcf.pyx":2516
 *     def values(self):
 *         """D.values() -> list of D's values"""
 *         return list(self.itervalues())             # <<<<<<<<<<<<<<
 * 
 *     # Mappings are not hashable by default, but subclasses can change this
*/
  __Pyx_XDECREF(__pyx_r);
  __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(__pyx_mstate_global->__pyx_n_u_itervalues, __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, 2516, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
  }
  __pyx_t_2 = __Pyx_PySequence_ListKeepNew(__pyx_t_1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 2516, __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;
  __Pyx_TraceReturnValue(__pyx_r, 1, 0, __PYX_ERR(0, 2516, __pyx_L1_error));
  goto __pyx_L0;

  /* "pysam/libcbcf.pyx":2514
 *         return list(self.iteritems())
 * 
 *     def values(self):             # <<<<<<<<<<<<<<
 *         """D.values() -> list of D's values"""
 *         return list(self.itervalues())
*/

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_TraceException(__pyx_lineno, 0, 0);
  #if CYTHON_USE_SYS_MONITORING
  __Pyx_TraceExceptionUnwind(0, 0);
  #else
  __Pyx_TraceReturnValue(NULL, 0, 0, __PYX_ERR(0, 2514, __pyx_L1_error));
  #endif
  __Pyx_AddTraceback("pysam.libcbcf.VariantRecordFormat.values", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_PyMonitoring_ExitScope(0);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

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

/* Python wrapper */
static PyObject *__pyx_pw_5pysam_7libcbcf_19VariantRecordFormat_34__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*/
PyDoc_STRVAR(__pyx_doc_5pysam_7libcbcf_19VariantRecordFormat_33__reduce_cython__, "VariantRecordFormat.__reduce_cython__(self)");
static PyMethodDef __pyx_mdef_5pysam_7libcbcf_19VariantRecordFormat_34__reduce_cython__ = {"__reduce_cython__", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_5pysam_7libcbcf_19VariantRecordFormat_34__reduce_cython__, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_5pysam_7libcbcf_19VariantRecordFormat_33__reduce_cython__};
static PyObject *__pyx_pw_5pysam_7libcbcf_19VariantRecordFormat_34__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_5pysam_7libcbcf_19VariantRecordFormat_33__reduce_cython__(((struct __pyx_obj_5pysam_7libcbcf_VariantRecordFormat *)__pyx_v_self));

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

static PyObject *__pyx_pf_5pysam_7libcbcf_19VariantRecordFormat_33__reduce_cython__(struct __pyx_obj_5pysam_7libcbcf_VariantRecordFormat *__pyx_v_self) {
  PyObject *__pyx_v_state = 0;
  PyObject *__pyx_v__dict = 0;
  int __pyx_v_use_setstate;
  PyObject *__pyx_r = NULL;
  __Pyx_TraceDeclarationsFunc
  __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_TraceFrameInit(((PyObject *)__pyx_mstate_global->__pyx_codeobj_tab[202]))
  __Pyx_RefNannySetupContext("__reduce_cython__", 0);
  __Pyx_TraceStartFunc("__reduce_cython__", __pyx_f[4], 1, 0, 0, 0, __PYX_ERR(4, 1, __pyx_L1_error));

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

  /* "(tree fragment)":6
 *     cdef bint use_setstate
 *     state = (self.record,)
 *     _dict = getattr(self, '__dict__', None)             # <<<<<<<<<<<<<<
 *     if _dict is not None:
 *         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(4, 6, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_v__dict = __pyx_t_1;
  __pyx_t_1 = 0;

  /* "(tree fragment)":7
 *     state = (self.record,)
 *     _dict = getattr(self, '__dict__', None)
 *     if _dict is not None:             # <<<<<<<<<<<<<<
 *         state += (_dict,)
 *         use_setstate = True
*/
  __pyx_t_2 = (__pyx_v__dict != Py_None);
  if (__pyx_t_2) {

    /* "(tree fragment)":8
 *     _dict = getattr(self, '__dict__', None)
 *     if _dict is not None:
 *         state += (_dict,)             # <<<<<<<<<<<<<<
 *         use_setstate = True
 *     else:
*/
    __pyx_t_1 = PyTuple_New(1); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 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(4, 8, __pyx_L1_error);
    __pyx_t_3 = PyNumber_InPlaceAdd(__pyx_v_state, __pyx_t_1); if (unlikely(!__pyx_t_3)) __PYX_ERR(4, 8, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    __Pyx_DECREF_SET(__pyx_v_state, ((PyObject*)__pyx_t_3));
    __pyx_t_3 = 0;

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

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

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

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

    /* "(tree fragment)":13
 *         use_setstate = self.record is not None
 *     if use_setstate:
 *         return __pyx_unpickle_VariantRecordFormat, (type(self), 0x70ce871, None), state             # <<<<<<<<<<<<<<
 *     else:
 *         return __pyx_unpickle_VariantRecordFormat, (type(self), 0x70ce871, state)
*/
    __Pyx_XDECREF(__pyx_r);
    __Pyx_GetModuleGlobalName(__pyx_t_3, __pyx_mstate_global->__pyx_n_u_pyx_unpickle_VariantRecordForm); if (unlikely(!__pyx_t_3)) __PYX_ERR(4, 13, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __pyx_t_1 = PyTuple_New(3); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 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(4, 13, __pyx_L1_error);
    __Pyx_INCREF(__pyx_mstate_global->__pyx_int_118286449);
    __Pyx_GIVEREF(__pyx_mstate_global->__pyx_int_118286449);
    if (__Pyx_PyTuple_SET_ITEM(__pyx_t_1, 1, __pyx_mstate_global->__pyx_int_118286449) != (0)) __PYX_ERR(4, 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(4, 13, __pyx_L1_error);
    __pyx_t_4 = PyTuple_New(3); if (unlikely(!__pyx_t_4)) __PYX_ERR(4, 13, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
    __Pyx_GIVEREF(__pyx_t_3);
    if (__Pyx_PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_t_3) != (0)) __PYX_ERR(4, 13, __pyx_L1_error);
    __Pyx_GIVEREF(__pyx_t_1);
    if (__Pyx_PyTuple_SET_ITEM(__pyx_t_4, 1, __pyx_t_1) != (0)) __PYX_ERR(4, 13, __pyx_L1_error);
    __Pyx_INCREF(__pyx_v_state);
    __Pyx_GIVEREF(__pyx_v_state);
    if (__Pyx_PyTuple_SET_ITEM(__pyx_t_4, 2, __pyx_v_state) != (0)) __PYX_ERR(4, 13, __pyx_L1_error);
    __pyx_t_3 = 0;
    __pyx_t_1 = 0;
    __pyx_r = __pyx_t_4;
    __pyx_t_4 = 0;
    __Pyx_TraceReturnValue(__pyx_r, 25, 0, __PYX_ERR(4, 13, __pyx_L1_error));
    goto __pyx_L0;

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

  /* "(tree fragment)":15
 *         return __pyx_unpickle_VariantRecordFormat, (type(self), 0x70ce871, None), state
 *     else:
 *         return __pyx_unpickle_VariantRecordFormat, (type(self), 0x70ce871, state)             # <<<<<<<<<<<<<<
 * def __setstate_cython__(self, __pyx_state):
 *     __pyx_unpickle_VariantRecordFormat__set_state(self, __pyx_state)
*/
  /*else*/ {
    __Pyx_XDECREF(__pyx_r);
    __Pyx_GetModuleGlobalName(__pyx_t_4, __pyx_mstate_global->__pyx_n_u_pyx_unpickle_VariantRecordForm); if (unlikely(!__pyx_t_4)) __PYX_ERR(4, 15, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
    __pyx_t_1 = PyTuple_New(3); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 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(4, 15, __pyx_L1_error);
    __Pyx_INCREF(__pyx_mstate_global->__pyx_int_118286449);
    __Pyx_GIVEREF(__pyx_mstate_global->__pyx_int_118286449);
    if (__Pyx_PyTuple_SET_ITEM(__pyx_t_1, 1, __pyx_mstate_global->__pyx_int_118286449) != (0)) __PYX_ERR(4, 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(4, 15, __pyx_L1_error);
    __pyx_t_3 = PyTuple_New(2); if (unlikely(!__pyx_t_3)) __PYX_ERR(4, 15, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __Pyx_GIVEREF(__pyx_t_4);
    if (__Pyx_PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_t_4) != (0)) __PYX_ERR(4, 15, __pyx_L1_error);
    __Pyx_GIVEREF(__pyx_t_1);
    if (__Pyx_PyTuple_SET_ITEM(__pyx_t_3, 1, __pyx_t_1) != (0)) __PYX_ERR(4, 15, __pyx_L1_error);
    __pyx_t_4 = 0;
    __pyx_t_1 = 0;
    __pyx_r = __pyx_t_3;
    __pyx_t_3 = 0;
    __Pyx_TraceReturnValue(__pyx_r, 33, 0, __PYX_ERR(4, 15, __pyx_L1_error));
    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_3);
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_TraceException(__pyx_lineno, 0, 0);
  #if CYTHON_USE_SYS_MONITORING
  __Pyx_TraceExceptionUnwind(0, 0);
  #else
  __Pyx_TraceReturnValue(NULL, 0, 0, __PYX_ERR(4, 1, __pyx_L1_error));
  #endif
  __Pyx_AddTraceback("pysam.libcbcf.VariantRecordFormat.__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_PyMonitoring_ExitScope(0);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "(tree fragment)":16
 *     else:
 *         return __pyx_unpickle_VariantRecordFormat, (type(self), 0x70ce871, state)
 * def __setstate_cython__(self, __pyx_state):             # <<<<<<<<<<<<<<
 *     __pyx_unpickle_VariantRecordFormat__set_state(self, __pyx_state)
*/

/* Python wrapper */
static PyObject *__pyx_pw_5pysam_7libcbcf_19VariantRecordFormat_36__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*/
PyDoc_STRVAR(__pyx_doc_5pysam_7libcbcf_19VariantRecordFormat_35__setstate_cython__, "VariantRecordFormat.__setstate_cython__(self, __pyx_state)");
static PyMethodDef __pyx_mdef_5pysam_7libcbcf_19VariantRecordFormat_36__setstate_cython__ = {"__setstate_cython__", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_5pysam_7libcbcf_19VariantRecordFormat_36__setstate_cython__, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_5pysam_7libcbcf_19VariantRecordFormat_35__setstate_cython__};
static PyObject *__pyx_pw_5pysam_7libcbcf_19VariantRecordFormat_36__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(4, 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(4, 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(4, 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(4, 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(4, 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(4, 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("pysam.libcbcf.VariantRecordFormat.__setstate_cython__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_5pysam_7libcbcf_19VariantRecordFormat_35__setstate_cython__(((struct __pyx_obj_5pysam_7libcbcf_VariantRecordFormat *)__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_5pysam_7libcbcf_19VariantRecordFormat_35__setstate_cython__(struct __pyx_obj_5pysam_7libcbcf_VariantRecordFormat *__pyx_v_self, PyObject *__pyx_v___pyx_state) {
  PyObject *__pyx_r = NULL;
  __Pyx_TraceDeclarationsFunc
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_TraceFrameInit(((PyObject *)__pyx_mstate_global->__pyx_codeobj_tab[203]))
  __Pyx_RefNannySetupContext("__setstate_cython__", 0);
  __Pyx_TraceStartFunc("__setstate_cython__", __pyx_f[4], 16, 0, 0, 0, __PYX_ERR(4, 16, __pyx_L1_error));

  /* "(tree fragment)":17
 *         return __pyx_unpickle_VariantRecordFormat, (type(self), 0x70ce871, state)
 * def __setstate_cython__(self, __pyx_state):
 *     __pyx_unpickle_VariantRecordFormat__set_state(self, __pyx_state)             # <<<<<<<<<<<<<<
*/
  if (!(likely(PyTuple_CheckExact(__pyx_v___pyx_state))||((__pyx_v___pyx_state) == Py_None) || __Pyx_RaiseUnexpectedTypeError("tuple", __pyx_v___pyx_state))) __PYX_ERR(4, 17, __pyx_L1_error)
  __pyx_t_1 = __pyx_f_5pysam_7libcbcf___pyx_unpickle_VariantRecordFormat__set_state(__pyx_v_self, ((PyObject*)__pyx_v___pyx_state)); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 17, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "(tree fragment)":16
 *     else:
 *         return __pyx_unpickle_VariantRecordFormat, (type(self), 0x70ce871, state)
 * def __setstate_cython__(self, __pyx_state):             # <<<<<<<<<<<<<<
 *     __pyx_unpickle_VariantRecordFormat__set_state(self, __pyx_state)
*/

  /* function exit code */
  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  __Pyx_TraceReturnValue(__pyx_r, 0, 0, __PYX_ERR(4, 16, __pyx_L1_error));
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_TraceException(__pyx_lineno, 0, 0);
  #if CYTHON_USE_SYS_MONITORING
  __Pyx_TraceExceptionUnwind(0, 0);
  #else
  __Pyx_TraceReturnValue(NULL, 0, 0, __PYX_ERR(4, 16, __pyx_L1_error));
  #endif
  __Pyx_AddTraceback("pysam.libcbcf.VariantRecordFormat.__setstate_cython__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_PyMonitoring_ExitScope(0);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "pysam/libcbcf.pyx":2524
 * 
 * 
 * cdef VariantRecordFormat makeVariantRecordFormat(VariantRecord record):             # <<<<<<<<<<<<<<
 *     if not record:
 *         raise ValueError('invalid VariantRecord')
*/

static struct __pyx_obj_5pysam_7libcbcf_VariantRecordFormat *__pyx_f_5pysam_7libcbcf_makeVariantRecordFormat(struct __pyx_obj_5pysam_7libcbcf_VariantRecord *__pyx_v_record) {
  struct __pyx_obj_5pysam_7libcbcf_VariantRecordFormat *__pyx_v_format = 0;
  struct __pyx_obj_5pysam_7libcbcf_VariantRecordFormat *__pyx_r = NULL;
  __Pyx_TraceDeclarationsFunc
  __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_TraceFrameInit(((PyObject *)__pyx_mstate_global->__pyx_codeobj_tab[204]))
  __Pyx_RefNannySetupContext("makeVariantRecordFormat", 0);
  __Pyx_TraceStartFunc("makeVariantRecordFormat", __pyx_f[0], 2524, 0, 0, 0, __PYX_ERR(0, 2524, __pyx_L1_error));

  /* "pysam/libcbcf.pyx":2525
 * 
 * cdef VariantRecordFormat makeVariantRecordFormat(VariantRecord record):
 *     if not record:             # <<<<<<<<<<<<<<
 *         raise ValueError('invalid VariantRecord')
 * 
*/
  __pyx_t_1 = __Pyx_PyObject_IsTrue(((PyObject *)__pyx_v_record)); if (unlikely((__pyx_t_1 < 0))) __PYX_ERR(0, 2525, __pyx_L1_error)
  __pyx_t_2 = (!__pyx_t_1);
  if (unlikely(__pyx_t_2)) {

    /* "pysam/libcbcf.pyx":2526
 * cdef VariantRecordFormat makeVariantRecordFormat(VariantRecord record):
 *     if not record:
 *         raise ValueError('invalid VariantRecord')             # <<<<<<<<<<<<<<
 * 
 *     cdef VariantRecordFormat format = VariantRecordFormat.__new__(VariantRecordFormat)
*/
    __pyx_t_4 = NULL;
    __Pyx_INCREF(__pyx_builtin_ValueError);
    __pyx_t_5 = __pyx_builtin_ValueError; 
    __pyx_t_6 = 1;
    {
      PyObject *__pyx_callargs[2] = {__pyx_t_4, __pyx_mstate_global->__pyx_kp_u_invalid_VariantRecord};
      __pyx_t_3 = __Pyx_PyObject_FastCall(__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, 2526, __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, 2526, __pyx_L1_error)

    /* "pysam/libcbcf.pyx":2525
 * 
 * cdef VariantRecordFormat makeVariantRecordFormat(VariantRecord record):
 *     if not record:             # <<<<<<<<<<<<<<
 *         raise ValueError('invalid VariantRecord')
 * 
*/
  }

  /* "pysam/libcbcf.pyx":2528
 *         raise ValueError('invalid VariantRecord')
 * 
 *     cdef VariantRecordFormat format = VariantRecordFormat.__new__(VariantRecordFormat)             # <<<<<<<<<<<<<<
 *     format.record = record
 * 
*/
  __pyx_t_3 = ((PyObject *)__pyx_tp_new_5pysam_7libcbcf_VariantRecordFormat(((PyTypeObject *)__pyx_mstate_global->__pyx_ptype_5pysam_7libcbcf_VariantRecordFormat), __pyx_mstate_global->__pyx_empty_tuple, NULL)); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 2528, __pyx_L1_error)
  __Pyx_GOTREF((PyObject *)__pyx_t_3);
  __pyx_v_format = ((struct __pyx_obj_5pysam_7libcbcf_VariantRecordFormat *)__pyx_t_3);
  __pyx_t_3 = 0;

  /* "pysam/libcbcf.pyx":2529
 * 
 *     cdef VariantRecordFormat format = VariantRecordFormat.__new__(VariantRecordFormat)
 *     format.record = record             # <<<<<<<<<<<<<<
 * 
 *     return format
*/
  __Pyx_INCREF((PyObject *)__pyx_v_record);
  __Pyx_GIVEREF((PyObject *)__pyx_v_record);
  __Pyx_GOTREF((PyObject *)__pyx_v_format->record);
  __Pyx_DECREF((PyObject *)__pyx_v_format->record);
  __pyx_v_format->record = __pyx_v_record;

  /* "pysam/libcbcf.pyx":2531
 *     format.record = record
 * 
 *     return format             # <<<<<<<<<<<<<<
 * 
 * 
*/
  __Pyx_XDECREF((PyObject *)__pyx_r);
  __Pyx_INCREF((PyObject *)__pyx_v_format);
  __pyx_r = __pyx_v_format;
  __Pyx_TraceReturnValue((PyObject *)__pyx_r, 16, 0, __PYX_ERR(0, 2531, __pyx_L1_error));
  goto __pyx_L0;

  /* "pysam/libcbcf.pyx":2524
 * 
 * 
 * cdef VariantRecordFormat makeVariantRecordFormat(VariantRecord record):             # <<<<<<<<<<<<<<
 *     if not record:
 *         raise ValueError('invalid VariantRecord')
*/

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_XDECREF(__pyx_t_5);
  __Pyx_TraceException(__pyx_lineno, 0, 0);
  #if CYTHON_USE_SYS_MONITORING
  __Pyx_TraceExceptionUnwind(0, 0);
  #else
  __Pyx_TraceReturnValue(NULL, 0, 0, __PYX_ERR(0, 2524, __pyx_L1_error));
  #endif
  __Pyx_AddTraceback("pysam.libcbcf.makeVariantRecordFormat", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_XDECREF((PyObject *)__pyx_v_format);
  __Pyx_XGIVEREF((PyObject *)__pyx_r);
  __Pyx_PyMonitoring_ExitScope(0);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "pysam/libcbcf.pyx":2539
 *        mapping from info metadata name to value."""
 * 
 *     def __init__(self, *args, **kwargs):             # <<<<<<<<<<<<<<
 *         raise TypeError('this class cannot be instantiated from Python')
 * 
*/

/* Python wrapper */
static int __pyx_pw_5pysam_7libcbcf_17VariantRecordInfo_1__init__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static int __pyx_pw_5pysam_7libcbcf_17VariantRecordInfo_1__init__(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("__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);
  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("__init__", __pyx_kwds) == -1)) return -1;
  }
  __Pyx_INCREF(__pyx_args);
  __pyx_v_args = __pyx_args;
  __pyx_r = __pyx_pf_5pysam_7libcbcf_17VariantRecordInfo___init__(((struct __pyx_obj_5pysam_7libcbcf_VariantRecordInfo *)__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_5pysam_7libcbcf_17VariantRecordInfo___init__(CYTHON_UNUSED struct __pyx_obj_5pysam_7libcbcf_VariantRecordInfo *__pyx_v_self, CYTHON_UNUSED PyObject *__pyx_v_args, CYTHON_UNUSED PyObject *__pyx_v_kwargs) {
  int __pyx_r;
  __Pyx_TraceDeclarationsFunc
  __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_TraceFrameInit(((PyObject *)__pyx_mstate_global->__pyx_codeobj_tab[205]))
  __Pyx_RefNannySetupContext("__init__", 0);
  __Pyx_TraceStartFunc("__init__", __pyx_f[0], 2539, 0, 0, 0, __PYX_ERR(0, 2539, __pyx_L1_error));

  /* "pysam/libcbcf.pyx":2540
 * 
 *     def __init__(self, *args, **kwargs):
 *         raise TypeError('this class cannot be instantiated from Python')             # <<<<<<<<<<<<<<
 * 
 *     def __len__(self):
*/
  __pyx_t_2 = NULL;
  __Pyx_INCREF(__pyx_builtin_TypeError);
  __pyx_t_3 = __pyx_builtin_TypeError; 
  __pyx_t_4 = 1;
  {
    PyObject *__pyx_callargs[2] = {__pyx_t_2, __pyx_mstate_global->__pyx_kp_u_this_class_cannot_be_instantiate};
    __pyx_t_1 = __Pyx_PyObject_FastCall(__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, 2540, __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, 2540, __pyx_L1_error)

  /* "pysam/libcbcf.pyx":2539
 *        mapping from info metadata name to value."""
 * 
 *     def __init__(self, *args, **kwargs):             # <<<<<<<<<<<<<<
 *         raise TypeError('this class cannot be instantiated from Python')
 * 
*/

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_TraceException(__pyx_lineno, 0, 0);
  #if CYTHON_USE_SYS_MONITORING
  __Pyx_TraceExceptionUnwind(0, 0);
  #else
  __Pyx_TraceReturnValue(NULL, 0, 0, __PYX_ERR(0, 2539, __pyx_L1_error));
  #endif
  __Pyx_AddTraceback("pysam.libcbcf.VariantRecordInfo.__init__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = -1;
  __Pyx_PyMonitoring_ExitScope(0);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "pysam/libcbcf.pyx":2542
 *         raise TypeError('this class cannot be instantiated from Python')
 * 
 *     def __len__(self):             # <<<<<<<<<<<<<<
 *         cdef bcf_hdr_t *hdr = self.record.header.ptr
 *         cdef bcf1_t *r = self.record.ptr
*/

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

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

static Py_ssize_t __pyx_pf_5pysam_7libcbcf_17VariantRecordInfo_2__len__(struct __pyx_obj_5pysam_7libcbcf_VariantRecordInfo *__pyx_v_self) {
  bcf_hdr_t *__pyx_v_hdr;
  bcf1_t *__pyx_v_r;
  bcf_info_t *__pyx_v_info;
  char const *__pyx_v_key;
  int __pyx_v_i;
  int __pyx_v_count;
  Py_ssize_t __pyx_r;
  __Pyx_TraceDeclarationsFunc
  __Pyx_RefNannyDeclarations
  bcf_hdr_t *__pyx_t_1;
  bcf1_t *__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;
  uint32_t __pyx_t_8;
  uint32_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_TraceFrameInit(((PyObject *)__pyx_mstate_global->__pyx_codeobj_tab[206]))
  __Pyx_RefNannySetupContext("__len__", 0);
  __Pyx_TraceStartFunc("__len__", __pyx_f[0], 2542, 0, 0, 0, __PYX_ERR(0, 2542, __pyx_L1_error));

  /* "pysam/libcbcf.pyx":2543
 * 
 *     def __len__(self):
 *         cdef bcf_hdr_t *hdr = self.record.header.ptr             # <<<<<<<<<<<<<<
 *         cdef bcf1_t *r = self.record.ptr
 *         cdef bcf_info_t *info
*/
  __pyx_t_1 = __pyx_v_self->record->header->ptr;
  __pyx_v_hdr = __pyx_t_1;

  /* "pysam/libcbcf.pyx":2544
 *     def __len__(self):
 *         cdef bcf_hdr_t *hdr = self.record.header.ptr
 *         cdef bcf1_t *r = self.record.ptr             # <<<<<<<<<<<<<<
 *         cdef bcf_info_t *info
 *         cdef const char *key
*/
  __pyx_t_2 = __pyx_v_self->record->ptr;
  __pyx_v_r = __pyx_t_2;

  /* "pysam/libcbcf.pyx":2547
 *         cdef bcf_info_t *info
 *         cdef const char *key
 *         cdef int i, count = 0             # <<<<<<<<<<<<<<
 * 
 *         if bcf_unpack(r, BCF_UN_INFO) < 0:
*/
  __pyx_v_count = 0;

  /* "pysam/libcbcf.pyx":2549
 *         cdef int i, count = 0
 * 
 *         if bcf_unpack(r, BCF_UN_INFO) < 0:             # <<<<<<<<<<<<<<
 *             raise ValueError('Error unpacking VariantRecord')
 * 
*/
  __pyx_t_3 = (bcf_unpack(__pyx_v_r, BCF_UN_INFO) < 0);
  if (unlikely(__pyx_t_3)) {

    /* "pysam/libcbcf.pyx":2550
 * 
 *         if bcf_unpack(r, BCF_UN_INFO) < 0:
 *             raise ValueError('Error unpacking VariantRecord')             # <<<<<<<<<<<<<<
 * 
 *         for i in range(r.n_info):
*/
    __pyx_t_5 = NULL;
    __Pyx_INCREF(__pyx_builtin_ValueError);
    __pyx_t_6 = __pyx_builtin_ValueError; 
    __pyx_t_7 = 1;
    {
      PyObject *__pyx_callargs[2] = {__pyx_t_5, __pyx_mstate_global->__pyx_kp_u_Error_unpacking_VariantRecord};
      __pyx_t_4 = __Pyx_PyObject_FastCall(__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, 2550, __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, 2550, __pyx_L1_error)

    /* "pysam/libcbcf.pyx":2549
 *         cdef int i, count = 0
 * 
 *         if bcf_unpack(r, BCF_UN_INFO) < 0:             # <<<<<<<<<<<<<<
 *             raise ValueError('Error unpacking VariantRecord')
 * 
*/
  }

  /* "pysam/libcbcf.pyx":2552
 *             raise ValueError('Error unpacking VariantRecord')
 * 
 *         for i in range(r.n_info):             # <<<<<<<<<<<<<<
 *             info = &r.d.info[i]
 *             key = bcf_hdr_int2id(hdr, BCF_DT_ID, info.key)
*/
  __pyx_t_8 = __pyx_v_r->n_info;
  __pyx_t_9 = __pyx_t_8;
  for (__pyx_t_10 = 0; __pyx_t_10 < __pyx_t_9; __pyx_t_10+=1) {
    __pyx_v_i = __pyx_t_10;

    /* "pysam/libcbcf.pyx":2553
 * 
 *         for i in range(r.n_info):
 *             info = &r.d.info[i]             # <<<<<<<<<<<<<<
 *             key = bcf_hdr_int2id(hdr, BCF_DT_ID, info.key)
 *             if info != NULL and info.vptr != NULL and strcmp(key, b'END') != 0:
*/
    __pyx_v_info = (&(__pyx_v_r->d.info[__pyx_v_i]));

    /* "pysam/libcbcf.pyx":2554
 *         for i in range(r.n_info):
 *             info = &r.d.info[i]
 *             key = bcf_hdr_int2id(hdr, BCF_DT_ID, info.key)             # <<<<<<<<<<<<<<
 *             if info != NULL and info.vptr != NULL and strcmp(key, b'END') != 0:
 *                 count += 1
*/
    __pyx_v_key = bcf_hdr_int2id(__pyx_v_hdr, BCF_DT_ID, __pyx_v_info->key);

    /* "pysam/libcbcf.pyx":2555
 *             info = &r.d.info[i]
 *             key = bcf_hdr_int2id(hdr, BCF_DT_ID, info.key)
 *             if info != NULL and info.vptr != NULL and strcmp(key, b'END') != 0:             # <<<<<<<<<<<<<<
 *                 count += 1
 * 
*/
    __pyx_t_11 = (__pyx_v_info != NULL);
    if (__pyx_t_11) {
    } else {
      __pyx_t_3 = __pyx_t_11;
      goto __pyx_L7_bool_binop_done;
    }
    __pyx_t_11 = (__pyx_v_info->vptr != NULL);
    if (__pyx_t_11) {
    } else {
      __pyx_t_3 = __pyx_t_11;
      goto __pyx_L7_bool_binop_done;
    }
    __pyx_t_11 = (strcmp(__pyx_v_key, ((char const *)"END")) != 0);
    __pyx_t_3 = __pyx_t_11;
    __pyx_L7_bool_binop_done:;
    if (__pyx_t_3) {

      /* "pysam/libcbcf.pyx":2556
 *             key = bcf_hdr_int2id(hdr, BCF_DT_ID, info.key)
 *             if info != NULL and info.vptr != NULL and strcmp(key, b'END') != 0:
 *                 count += 1             # <<<<<<<<<<<<<<
 * 
 *         return count
*/
      __pyx_v_count = (__pyx_v_count + 1);

      /* "pysam/libcbcf.pyx":2555
 *             info = &r.d.info[i]
 *             key = bcf_hdr_int2id(hdr, BCF_DT_ID, info.key)
 *             if info != NULL and info.vptr != NULL and strcmp(key, b'END') != 0:             # <<<<<<<<<<<<<<
 *                 count += 1
 * 
*/
    }
  }

  /* "pysam/libcbcf.pyx":2558
 *                 count += 1
 * 
 *         return count             # <<<<<<<<<<<<<<
 * 
 *     def __bool__(self):
*/
  __pyx_r = __pyx_v_count;
  __Pyx_TraceReturnCValue(__pyx_r, PyLong_FromSsize_t, 61, 0, __PYX_ERR(0, 2558, __pyx_L1_error));
  goto __pyx_L0;

  /* "pysam/libcbcf.pyx":2542
 *         raise TypeError('this class cannot be instantiated from Python')
 * 
 *     def __len__(self):             # <<<<<<<<<<<<<<
 *         cdef bcf_hdr_t *hdr = self.record.header.ptr
 *         cdef bcf1_t *r = self.record.ptr
*/

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_XDECREF(__pyx_t_5);
  __Pyx_XDECREF(__pyx_t_6);
  __Pyx_TraceException(__pyx_lineno, 0, 0);
  #if CYTHON_USE_SYS_MONITORING
  __Pyx_TraceExceptionUnwind(0, 0);
  #else
  __Pyx_TraceReturnValue(NULL, 0, 0, __PYX_ERR(0, 2542, __pyx_L1_error));
  #endif
  __Pyx_AddTraceback("pysam.libcbcf.VariantRecordInfo.__len__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = -1;
  __pyx_L0:;
  __Pyx_PyMonitoring_ExitScope(0);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "pysam/libcbcf.pyx":2560
 *         return count
 * 
 *     def __bool__(self):             # <<<<<<<<<<<<<<
 *         cdef bcf_hdr_t *hdr = self.record.header.ptr
 *         cdef bcf1_t *r = self.record.ptr
*/

/* Python wrapper */
static int __pyx_pw_5pysam_7libcbcf_17VariantRecordInfo_5__bool__(PyObject *__pyx_v_self); /*proto*/
static int __pyx_pw_5pysam_7libcbcf_17VariantRecordInfo_5__bool__(PyObject *__pyx_v_self) {
  CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__bool__ (wrapper)", 0);
  __pyx_kwvalues = __Pyx_KwValues_VARARGS(__pyx_args, __pyx_nargs);
  __pyx_r = __pyx_pf_5pysam_7libcbcf_17VariantRecordInfo_4__bool__(((struct __pyx_obj_5pysam_7libcbcf_VariantRecordInfo *)__pyx_v_self));

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

static int __pyx_pf_5pysam_7libcbcf_17VariantRecordInfo_4__bool__(struct __pyx_obj_5pysam_7libcbcf_VariantRecordInfo *__pyx_v_self) {
  bcf_hdr_t *__pyx_v_hdr;
  bcf1_t *__pyx_v_r;
  bcf_info_t *__pyx_v_info;
  char const *__pyx_v_key;
  int __pyx_v_i;
  int __pyx_r;
  __Pyx_TraceDeclarationsFunc
  __Pyx_RefNannyDeclarations
  bcf_hdr_t *__pyx_t_1;
  bcf1_t *__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;
  uint32_t __pyx_t_8;
  uint32_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_TraceFrameInit(((PyObject *)__pyx_mstate_global->__pyx_codeobj_tab[207]))
  __Pyx_RefNannySetupContext("__bool__", 0);
  __Pyx_TraceStartFunc("__bool__", __pyx_f[0], 2560, 0, 0, 0, __PYX_ERR(0, 2560, __pyx_L1_error));

  /* "pysam/libcbcf.pyx":2561
 * 
 *     def __bool__(self):
 *         cdef bcf_hdr_t *hdr = self.record.header.ptr             # <<<<<<<<<<<<<<
 *         cdef bcf1_t *r = self.record.ptr
 *         cdef bcf_info_t *info
*/
  __pyx_t_1 = __pyx_v_self->record->header->ptr;
  __pyx_v_hdr = __pyx_t_1;

  /* "pysam/libcbcf.pyx":2562
 *     def __bool__(self):
 *         cdef bcf_hdr_t *hdr = self.record.header.ptr
 *         cdef bcf1_t *r = self.record.ptr             # <<<<<<<<<<<<<<
 *         cdef bcf_info_t *info
 *         cdef const char *key
*/
  __pyx_t_2 = __pyx_v_self->record->ptr;
  __pyx_v_r = __pyx_t_2;

  /* "pysam/libcbcf.pyx":2567
 *         cdef int i
 * 
 *         if bcf_unpack(r, BCF_UN_INFO) < 0:             # <<<<<<<<<<<<<<
 *             raise ValueError('Error unpacking VariantRecord')
 * 
*/
  __pyx_t_3 = (bcf_unpack(__pyx_v_r, BCF_UN_INFO) < 0);
  if (unlikely(__pyx_t_3)) {

    /* "pysam/libcbcf.pyx":2568
 * 
 *         if bcf_unpack(r, BCF_UN_INFO) < 0:
 *             raise ValueError('Error unpacking VariantRecord')             # <<<<<<<<<<<<<<
 * 
 *         for i in range(r.n_info):
*/
    __pyx_t_5 = NULL;
    __Pyx_INCREF(__pyx_builtin_ValueError);
    __pyx_t_6 = __pyx_builtin_ValueError; 
    __pyx_t_7 = 1;
    {
      PyObject *__pyx_callargs[2] = {__pyx_t_5, __pyx_mstate_global->__pyx_kp_u_Error_unpacking_VariantRecord};
      __pyx_t_4 = __Pyx_PyObject_FastCall(__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, 2568, __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, 2568, __pyx_L1_error)

    /* "pysam/libcbcf.pyx":2567
 *         cdef int i
 * 
 *         if bcf_unpack(r, BCF_UN_INFO) < 0:             # <<<<<<<<<<<<<<
 *             raise ValueError('Error unpacking VariantRecord')
 * 
*/
  }

  /* "pysam/libcbcf.pyx":2570
 *             raise ValueError('Error unpacking VariantRecord')
 * 
 *         for i in range(r.n_info):             # <<<<<<<<<<<<<<
 *             info = &r.d.info[i]
 *             key = bcf_hdr_int2id(hdr, BCF_DT_ID, info.key)
*/
  __pyx_t_8 = __pyx_v_r->n_info;
  __pyx_t_9 = __pyx_t_8;
  for (__pyx_t_10 = 0; __pyx_t_10 < __pyx_t_9; __pyx_t_10+=1) {
    __pyx_v_i = __pyx_t_10;

    /* "pysam/libcbcf.pyx":2571
 * 
 *         for i in range(r.n_info):
 *             info = &r.d.info[i]             # <<<<<<<<<<<<<<
 *             key = bcf_hdr_int2id(hdr, BCF_DT_ID, info.key)
 *             if info != NULL and info.vptr != NULL and strcmp(key, b'END') != 0:
*/
    __pyx_v_info = (&(__pyx_v_r->d.info[__pyx_v_i]));

    /* "pysam/libcbcf.pyx":2572
 *         for i in range(r.n_info):
 *             info = &r.d.info[i]
 *             key = bcf_hdr_int2id(hdr, BCF_DT_ID, info.key)             # <<<<<<<<<<<<<<
 *             if info != NULL and info.vptr != NULL and strcmp(key, b'END') != 0:
 *                 return True
*/
    __pyx_v_key = bcf_hdr_int2id(__pyx_v_hdr, BCF_DT_ID, __pyx_v_info->key);

    /* "pysam/libcbcf.pyx":2573
 *             info = &r.d.info[i]
 *             key = bcf_hdr_int2id(hdr, BCF_DT_ID, info.key)
 *             if info != NULL and info.vptr != NULL and strcmp(key, b'END') != 0:             # <<<<<<<<<<<<<<
 *                 return True
 * 
*/
    __pyx_t_11 = (__pyx_v_info != NULL);
    if (__pyx_t_11) {
    } else {
      __pyx_t_3 = __pyx_t_11;
      goto __pyx_L7_bool_binop_done;
    }
    __pyx_t_11 = (__pyx_v_info->vptr != NULL);
    if (__pyx_t_11) {
    } else {
      __pyx_t_3 = __pyx_t_11;
      goto __pyx_L7_bool_binop_done;
    }
    __pyx_t_11 = (strcmp(__pyx_v_key, ((char const *)"END")) != 0);
    __pyx_t_3 = __pyx_t_11;
    __pyx_L7_bool_binop_done:;
    if (__pyx_t_3) {

      /* "pysam/libcbcf.pyx":2574
 *             key = bcf_hdr_int2id(hdr, BCF_DT_ID, info.key)
 *             if info != NULL and info.vptr != NULL and strcmp(key, b'END') != 0:
 *                 return True             # <<<<<<<<<<<<<<
 * 
 *         return False
*/
      __pyx_r = 1;
      __Pyx_TraceReturnCValue(__pyx_r, __Pyx_PyLong_From_int, 57, 0, __PYX_ERR(0, 2574, __pyx_L1_error));
      goto __pyx_L0;

      /* "pysam/libcbcf.pyx":2573
 *             info = &r.d.info[i]
 *             key = bcf_hdr_int2id(hdr, BCF_DT_ID, info.key)
 *             if info != NULL and info.vptr != NULL and strcmp(key, b'END') != 0:             # <<<<<<<<<<<<<<
 *                 return True
 * 
*/
    }
  }

  /* "pysam/libcbcf.pyx":2576
 *                 return True
 * 
 *         return False             # <<<<<<<<<<<<<<
 * 
 *     def __getitem__(self, key):
*/
  __pyx_r = 0;
  __Pyx_TraceReturnCValue(__pyx_r, __Pyx_PyLong_From_int, 59, 0, __PYX_ERR(0, 2576, __pyx_L1_error));
  goto __pyx_L0;

  /* "pysam/libcbcf.pyx":2560
 *         return count
 * 
 *     def __bool__(self):             # <<<<<<<<<<<<<<
 *         cdef bcf_hdr_t *hdr = self.record.header.ptr
 *         cdef bcf1_t *r = self.record.ptr
*/

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_XDECREF(__pyx_t_5);
  __Pyx_XDECREF(__pyx_t_6);
  __Pyx_TraceException(__pyx_lineno, 0, 0);
  #if CYTHON_USE_SYS_MONITORING
  __Pyx_TraceExceptionUnwind(0, 0);
  #else
  __Pyx_TraceReturnValue(NULL, 0, 0, __PYX_ERR(0, 2560, __pyx_L1_error));
  #endif
  __Pyx_AddTraceback("pysam.libcbcf.VariantRecordInfo.__bool__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = -1;
  __pyx_L0:;
  __Pyx_PyMonitoring_ExitScope(0);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "pysam/libcbcf.pyx":2578
 *         return False
 * 
 *     def __getitem__(self, key):             # <<<<<<<<<<<<<<
 *         cdef bcf_hdr_t *hdr = self.record.header.ptr
 *         cdef bcf1_t *r = self.record.ptr
*/

/* Python wrapper */
static PyObject *__pyx_pw_5pysam_7libcbcf_17VariantRecordInfo_7__getitem__(PyObject *__pyx_v_self, PyObject *__pyx_v_key); /*proto*/
static PyObject *__pyx_pw_5pysam_7libcbcf_17VariantRecordInfo_7__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_5pysam_7libcbcf_17VariantRecordInfo_6__getitem__(((struct __pyx_obj_5pysam_7libcbcf_VariantRecordInfo *)__pyx_v_self), ((PyObject *)__pyx_v_key));

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

static PyObject *__pyx_pf_5pysam_7libcbcf_17VariantRecordInfo_6__getitem__(struct __pyx_obj_5pysam_7libcbcf_VariantRecordInfo *__pyx_v_self, PyObject *__pyx_v_key) {
  bcf_hdr_t *__pyx_v_hdr;
  bcf1_t *__pyx_v_r;
  PyObject *__pyx_v_bkey = 0;
  bcf_info_t *__pyx_v_info;
  int __pyx_v_info_id;
  PyObject *__pyx_r = NULL;
  __Pyx_TraceDeclarationsFunc
  __Pyx_RefNannyDeclarations
  bcf_hdr_t *__pyx_t_1;
  bcf1_t *__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;
  char const *__pyx_t_8;
  char const *__pyx_t_9;
  int __pyx_t_10;
  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_TraceFrameInit(((PyObject *)__pyx_mstate_global->__pyx_codeobj_tab[208]))
  __Pyx_RefNannySetupContext("__getitem__", 0);
  __Pyx_TraceStartFunc("__getitem__", __pyx_f[0], 2578, 0, 0, 0, __PYX_ERR(0, 2578, __pyx_L1_error));

  /* "pysam/libcbcf.pyx":2579
 * 
 *     def __getitem__(self, key):
 *         cdef bcf_hdr_t *hdr = self.record.header.ptr             # <<<<<<<<<<<<<<
 *         cdef bcf1_t *r = self.record.ptr
 * 
*/
  __pyx_t_1 = __pyx_v_self->record->header->ptr;
  __pyx_v_hdr = __pyx_t_1;

  /* "pysam/libcbcf.pyx":2580
 *     def __getitem__(self, key):
 *         cdef bcf_hdr_t *hdr = self.record.header.ptr
 *         cdef bcf1_t *r = self.record.ptr             # <<<<<<<<<<<<<<
 * 
 *         if bcf_unpack(r, BCF_UN_INFO) < 0:
*/
  __pyx_t_2 = __pyx_v_self->record->ptr;
  __pyx_v_r = __pyx_t_2;

  /* "pysam/libcbcf.pyx":2582
 *         cdef bcf1_t *r = self.record.ptr
 * 
 *         if bcf_unpack(r, BCF_UN_INFO) < 0:             # <<<<<<<<<<<<<<
 *             raise ValueError('Error unpacking VariantRecord')
 * 
*/
  __pyx_t_3 = (bcf_unpack(__pyx_v_r, BCF_UN_INFO) < 0);
  if (unlikely(__pyx_t_3)) {

    /* "pysam/libcbcf.pyx":2583
 * 
 *         if bcf_unpack(r, BCF_UN_INFO) < 0:
 *             raise ValueError('Error unpacking VariantRecord')             # <<<<<<<<<<<<<<
 * 
 *         cdef bytes bkey = force_bytes(key)
*/
    __pyx_t_5 = NULL;
    __Pyx_INCREF(__pyx_builtin_ValueError);
    __pyx_t_6 = __pyx_builtin_ValueError; 
    __pyx_t_7 = 1;
    {
      PyObject *__pyx_callargs[2] = {__pyx_t_5, __pyx_mstate_global->__pyx_kp_u_Error_unpacking_VariantRecord};
      __pyx_t_4 = __Pyx_PyObject_FastCall(__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, 2583, __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, 2583, __pyx_L1_error)

    /* "pysam/libcbcf.pyx":2582
 *         cdef bcf1_t *r = self.record.ptr
 * 
 *         if bcf_unpack(r, BCF_UN_INFO) < 0:             # <<<<<<<<<<<<<<
 *             raise ValueError('Error unpacking VariantRecord')
 * 
*/
  }

  /* "pysam/libcbcf.pyx":2585
 *             raise ValueError('Error unpacking VariantRecord')
 * 
 *         cdef bytes bkey = force_bytes(key)             # <<<<<<<<<<<<<<
 * 
 *         if strcmp(bkey, b'END') == 0:
*/
  __pyx_t_4 = __pyx_f_5pysam_9libcutils_force_bytes(__pyx_v_key, NULL); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 2585, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  __pyx_v_bkey = ((PyObject*)__pyx_t_4);
  __pyx_t_4 = 0;

  /* "pysam/libcbcf.pyx":2587
 *         cdef bytes bkey = force_bytes(key)
 * 
 *         if strcmp(bkey, b'END') == 0:             # <<<<<<<<<<<<<<
 *             raise KeyError('END is a reserved attribute; access is via record.stop')
 * 
*/
  if (unlikely(__pyx_v_bkey == Py_None)) {
    PyErr_SetString(PyExc_TypeError, "expected bytes, NoneType found");
    __PYX_ERR(0, 2587, __pyx_L1_error)
  }
  __pyx_t_8 = __Pyx_PyBytes_AsString(__pyx_v_bkey); if (unlikely((!__pyx_t_8) && PyErr_Occurred())) __PYX_ERR(0, 2587, __pyx_L1_error)
  __pyx_t_3 = (strcmp(__pyx_t_8, ((char const *)"END")) == 0);
  if (unlikely(__pyx_t_3)) {

    /* "pysam/libcbcf.pyx":2588
 * 
 *         if strcmp(bkey, b'END') == 0:
 *             raise KeyError('END is a reserved attribute; access is via record.stop')             # <<<<<<<<<<<<<<
 * 
 *         cdef bcf_info_t *info = bcf_get_info(hdr, r, bkey)
*/
    __pyx_t_6 = NULL;
    __Pyx_INCREF(__pyx_builtin_KeyError);
    __pyx_t_5 = __pyx_builtin_KeyError; 
    __pyx_t_7 = 1;
    {
      PyObject *__pyx_callargs[2] = {__pyx_t_6, __pyx_mstate_global->__pyx_kp_u_END_is_a_reserved_attribute_acce};
      __pyx_t_4 = __Pyx_PyObject_FastCall(__pyx_t_5, __pyx_callargs+__pyx_t_7, (2-__pyx_t_7) | (__pyx_t_7*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
      __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0;
      __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
      if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 2588, __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, 2588, __pyx_L1_error)

    /* "pysam/libcbcf.pyx":2587
 *         cdef bytes bkey = force_bytes(key)
 * 
 *         if strcmp(bkey, b'END') == 0:             # <<<<<<<<<<<<<<
 *             raise KeyError('END is a reserved attribute; access is via record.stop')
 * 
*/
  }

  /* "pysam/libcbcf.pyx":2590
 *             raise KeyError('END is a reserved attribute; access is via record.stop')
 * 
 *         cdef bcf_info_t *info = bcf_get_info(hdr, r, bkey)             # <<<<<<<<<<<<<<
 * 
 *         # Cannot stop here if info == NULL, since flags must return False
*/
  if (unlikely(__pyx_v_bkey == Py_None)) {
    PyErr_SetString(PyExc_TypeError, "expected bytes, NoneType found");
    __PYX_ERR(0, 2590, __pyx_L1_error)
  }
  __pyx_t_9 = __Pyx_PyBytes_AsString(__pyx_v_bkey); if (unlikely((!__pyx_t_9) && PyErr_Occurred())) __PYX_ERR(0, 2590, __pyx_L1_error)
  __pyx_v_info = bcf_get_info(__pyx_v_hdr, __pyx_v_r, __pyx_t_9);

  /* "pysam/libcbcf.pyx":2593
 * 
 *         # Cannot stop here if info == NULL, since flags must return False
 *         cdef int info_id = bcf_header_get_info_id(hdr, bkey) if not info else info.key             # <<<<<<<<<<<<<<
 * 
 *         if info_id < 0:
*/
  __pyx_t_3 = (!(__pyx_v_info != 0));
  if (__pyx_t_3) {
    __pyx_t_11 = __pyx_f_5pysam_7libcbcf_bcf_header_get_info_id(__pyx_v_hdr, __pyx_v_bkey); if (unlikely(__pyx_t_11 == ((int)-2) && PyErr_Occurred())) __PYX_ERR(0, 2593, __pyx_L1_error)
    __pyx_t_10 = __pyx_t_11;
  } else {
    __pyx_t_10 = __pyx_v_info->key;
  }
  __pyx_v_info_id = __pyx_t_10;

  /* "pysam/libcbcf.pyx":2595
 *         cdef int info_id = bcf_header_get_info_id(hdr, bkey) if not info else info.key
 * 
 *         if info_id < 0:             # <<<<<<<<<<<<<<
 *             raise KeyError('Unknown INFO field: {}'.format(key))
 * 
*/
  __pyx_t_3 = (__pyx_v_info_id < 0);
  if (unlikely(__pyx_t_3)) {

    /* "pysam/libcbcf.pyx":2596
 * 
 *         if info_id < 0:
 *             raise KeyError('Unknown INFO field: {}'.format(key))             # <<<<<<<<<<<<<<
 * 
 *         if not check_header_id(hdr, BCF_HL_INFO, info_id):
*/
    __pyx_t_5 = NULL;
    __Pyx_INCREF(__pyx_builtin_KeyError);
    __pyx_t_6 = __pyx_builtin_KeyError; 
    __pyx_t_13 = __pyx_mstate_global->__pyx_kp_u_Unknown_INFO_field;
    __Pyx_INCREF(__pyx_t_13);
    __pyx_t_7 = 0;
    {
      PyObject *__pyx_callargs[2] = {__pyx_t_13, __pyx_v_key};
      __pyx_t_12 = __Pyx_PyObject_FastCallMethod(__pyx_mstate_global->__pyx_n_u_format, __pyx_callargs+__pyx_t_7, (2-__pyx_t_7) | (1*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
      __Pyx_XDECREF(__pyx_t_13); __pyx_t_13 = 0;
      if (unlikely(!__pyx_t_12)) __PYX_ERR(0, 2596, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_12);
    }
    __pyx_t_7 = 1;
    {
      PyObject *__pyx_callargs[2] = {__pyx_t_5, __pyx_t_12};
      __pyx_t_4 = __Pyx_PyObject_FastCall(__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_12); __pyx_t_12 = 0;
      __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
      if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 2596, __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, 2596, __pyx_L1_error)

    /* "pysam/libcbcf.pyx":2595
 *         cdef int info_id = bcf_header_get_info_id(hdr, bkey) if not info else info.key
 * 
 *         if info_id < 0:             # <<<<<<<<<<<<<<
 *             raise KeyError('Unknown INFO field: {}'.format(key))
 * 
*/
  }

  /* "pysam/libcbcf.pyx":2598
 *             raise KeyError('Unknown INFO field: {}'.format(key))
 * 
 *         if not check_header_id(hdr, BCF_HL_INFO, info_id):             # <<<<<<<<<<<<<<
 *             raise ValueError('Invalid header')
 * 
*/
  __pyx_t_3 = __pyx_f_5pysam_7libcbcf_check_header_id(__pyx_v_hdr, BCF_HL_INFO, __pyx_v_info_id); if (unlikely(__pyx_t_3 == ((int)-1) && PyErr_Occurred())) __PYX_ERR(0, 2598, __pyx_L1_error)
  __pyx_t_14 = (!__pyx_t_3);
  if (unlikely(__pyx_t_14)) {

    /* "pysam/libcbcf.pyx":2599
 * 
 *         if not check_header_id(hdr, BCF_HL_INFO, info_id):
 *             raise ValueError('Invalid header')             # <<<<<<<<<<<<<<
 * 
 *         # Handle type=Flag values
*/
    __pyx_t_6 = NULL;
    __Pyx_INCREF(__pyx_builtin_ValueError);
    __pyx_t_12 = __pyx_builtin_ValueError; 
    __pyx_t_7 = 1;
    {
      PyObject *__pyx_callargs[2] = {__pyx_t_6, __pyx_mstate_global->__pyx_kp_u_Invalid_header};
      __pyx_t_4 = __Pyx_PyObject_FastCall(__pyx_t_12, __pyx_callargs+__pyx_t_7, (2-__pyx_t_7) | (__pyx_t_7*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
      __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0;
      __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0;
      if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 2599, __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, 2599, __pyx_L1_error)

    /* "pysam/libcbcf.pyx":2598
 *             raise KeyError('Unknown INFO field: {}'.format(key))
 * 
 *         if not check_header_id(hdr, BCF_HL_INFO, info_id):             # <<<<<<<<<<<<<<
 *             raise ValueError('Invalid header')
 * 
*/
  }

  /* "pysam/libcbcf.pyx":2602
 * 
 *         # Handle type=Flag values
 *         if bcf_hdr_id2type(hdr, BCF_HL_INFO, info_id) == BCF_HT_FLAG:             # <<<<<<<<<<<<<<
 *             return info != NULL and info.vptr != NULL
 * 
*/
  __pyx_t_14 = (bcf_hdr_id2type(__pyx_v_hdr, BCF_HL_INFO, __pyx_v_info_id) == BCF_HT_FLAG);
  if (__pyx_t_14) {

    /* "pysam/libcbcf.pyx":2603
 *         # Handle type=Flag values
 *         if bcf_hdr_id2type(hdr, BCF_HL_INFO, info_id) == BCF_HT_FLAG:
 *             return info != NULL and info.vptr != NULL             # <<<<<<<<<<<<<<
 * 
 *         if not info or not info.vptr:
*/
    __Pyx_XDECREF(__pyx_r);
    __pyx_t_14 = (__pyx_v_info != NULL);
    if (__pyx_t_14) {
    } else {
      __pyx_t_12 = __Pyx_PyBool_FromLong(__pyx_t_14); if (unlikely(!__pyx_t_12)) __PYX_ERR(0, 2603, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_12);
      __pyx_t_4 = __pyx_t_12;
      __pyx_t_12 = 0;
      goto __pyx_L8_bool_binop_done;
    }
    __pyx_t_14 = (__pyx_v_info->vptr != NULL);
    __pyx_t_12 = __Pyx_PyBool_FromLong(__pyx_t_14); if (unlikely(!__pyx_t_12)) __PYX_ERR(0, 2603, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_12);
    __pyx_t_4 = __pyx_t_12;
    __pyx_t_12 = 0;
    __pyx_L8_bool_binop_done:;
    __pyx_r = __pyx_t_4;
    __pyx_t_4 = 0;
    __Pyx_TraceReturnValue(__pyx_r, 81, 0, __PYX_ERR(0, 2603, __pyx_L1_error));
    goto __pyx_L0;

    /* "pysam/libcbcf.pyx":2602
 * 
 *         # Handle type=Flag values
 *         if bcf_hdr_id2type(hdr, BCF_HL_INFO, info_id) == BCF_HT_FLAG:             # <<<<<<<<<<<<<<
 *             return info != NULL and info.vptr != NULL
 * 
*/
  }

  /* "pysam/libcbcf.pyx":2605
 *             return info != NULL and info.vptr != NULL
 * 
 *         if not info or not info.vptr:             # <<<<<<<<<<<<<<
 *             raise KeyError('Invalid INFO field: {}'.format(key))
 * 
*/
  __pyx_t_3 = (!(__pyx_v_info != 0));
  if (!__pyx_t_3) {
  } else {
    __pyx_t_14 = __pyx_t_3;
    goto __pyx_L11_bool_binop_done;
  }
  __pyx_t_3 = (!(__pyx_v_info->vptr != 0));
  __pyx_t_14 = __pyx_t_3;
  __pyx_L11_bool_binop_done:;
  if (unlikely(__pyx_t_14)) {

    /* "pysam/libcbcf.pyx":2606
 * 
 *         if not info or not info.vptr:
 *             raise KeyError('Invalid INFO field: {}'.format(key))             # <<<<<<<<<<<<<<
 * 
 *         return bcf_info_get_value(self.record, info)
*/
    __pyx_t_12 = NULL;
    __Pyx_INCREF(__pyx_builtin_KeyError);
    __pyx_t_6 = __pyx_builtin_KeyError; 
    __pyx_t_13 = __pyx_mstate_global->__pyx_kp_u_Invalid_INFO_field;
    __Pyx_INCREF(__pyx_t_13);
    __pyx_t_7 = 0;
    {
      PyObject *__pyx_callargs[2] = {__pyx_t_13, __pyx_v_key};
      __pyx_t_5 = __Pyx_PyObject_FastCallMethod(__pyx_mstate_global->__pyx_n_u_format, __pyx_callargs+__pyx_t_7, (2-__pyx_t_7) | (1*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
      __Pyx_XDECREF(__pyx_t_13); __pyx_t_13 = 0;
      if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 2606, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_5);
    }
    __pyx_t_7 = 1;
    {
      PyObject *__pyx_callargs[2] = {__pyx_t_12, __pyx_t_5};
      __pyx_t_4 = __Pyx_PyObject_FastCall(__pyx_t_6, __pyx_callargs+__pyx_t_7, (2-__pyx_t_7) | (__pyx_t_7*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
      __Pyx_XDECREF(__pyx_t_12); __pyx_t_12 = 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, 2606, __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, 2606, __pyx_L1_error)

    /* "pysam/libcbcf.pyx":2605
 *             return info != NULL and info.vptr != NULL
 * 
 *         if not info or not info.vptr:             # <<<<<<<<<<<<<<
 *             raise KeyError('Invalid INFO field: {}'.format(key))
 * 
*/
  }

  /* "pysam/libcbcf.pyx":2608
 *             raise KeyError('Invalid INFO field: {}'.format(key))
 * 
 *         return bcf_info_get_value(self.record, info)             # <<<<<<<<<<<<<<
 * 
 *     def __setitem__(self, key, value):
*/
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_4 = ((PyObject *)__pyx_v_self->record);
  __Pyx_INCREF(__pyx_t_4);
  __pyx_t_6 = __pyx_f_5pysam_7libcbcf_bcf_info_get_value(((struct __pyx_obj_5pysam_7libcbcf_VariantRecord *)__pyx_t_4), __pyx_v_info); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 2608, __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;
  __Pyx_TraceReturnValue(__pyx_r, 104, 0, __PYX_ERR(0, 2608, __pyx_L1_error));
  goto __pyx_L0;

  /* "pysam/libcbcf.pyx":2578
 *         return False
 * 
 *     def __getitem__(self, key):             # <<<<<<<<<<<<<<
 *         cdef bcf_hdr_t *hdr = self.record.header.ptr
 *         cdef bcf1_t *r = self.record.ptr
*/

  /* 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_XDECREF(__pyx_t_13);
  __Pyx_TraceException(__pyx_lineno, 0, 0);
  #if CYTHON_USE_SYS_MONITORING
  __Pyx_TraceExceptionUnwind(0, 0);
  #else
  __Pyx_TraceReturnValue(NULL, 0, 0, __PYX_ERR(0, 2578, __pyx_L1_error));
  #endif
  __Pyx_AddTraceback("pysam.libcbcf.VariantRecordInfo.__getitem__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_bkey);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_PyMonitoring_ExitScope(0);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "pysam/libcbcf.pyx":2610
 *         return bcf_info_get_value(self.record, info)
 * 
 *     def __setitem__(self, key, value):             # <<<<<<<<<<<<<<
 *         cdef bytes bkey = force_bytes(key)
 * 
*/

/* Python wrapper */
static int __pyx_pw_5pysam_7libcbcf_17VariantRecordInfo_9__setitem__(PyObject *__pyx_v_self, PyObject *__pyx_v_key, PyObject *__pyx_v_value); /*proto*/
static int __pyx_pw_5pysam_7libcbcf_17VariantRecordInfo_9__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_5pysam_7libcbcf_17VariantRecordInfo_8__setitem__(((struct __pyx_obj_5pysam_7libcbcf_VariantRecordInfo *)__pyx_v_self), ((PyObject *)__pyx_v_key), ((PyObject *)__pyx_v_value));

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

static int __pyx_pf_5pysam_7libcbcf_17VariantRecordInfo_8__setitem__(struct __pyx_obj_5pysam_7libcbcf_VariantRecordInfo *__pyx_v_self, PyObject *__pyx_v_key, PyObject *__pyx_v_value) {
  PyObject *__pyx_v_bkey = 0;
  int __pyx_r;
  __Pyx_TraceDeclarationsFunc
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  char const *__pyx_t_2;
  int __pyx_t_3;
  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_TraceFrameInit(((PyObject *)__pyx_mstate_global->__pyx_codeobj_tab[209]))
  __Pyx_RefNannySetupContext("__setitem__", 0);
  __Pyx_TraceStartFunc("__setitem__", __pyx_f[0], 2610, 0, 0, 0, __PYX_ERR(0, 2610, __pyx_L1_error));

  /* "pysam/libcbcf.pyx":2611
 * 
 *     def __setitem__(self, key, value):
 *         cdef bytes bkey = force_bytes(key)             # <<<<<<<<<<<<<<
 * 
 *         if strcmp(bkey, b'END') == 0:
*/
  __pyx_t_1 = __pyx_f_5pysam_9libcutils_force_bytes(__pyx_v_key, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 2611, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_v_bkey = ((PyObject*)__pyx_t_1);
  __pyx_t_1 = 0;

  /* "pysam/libcbcf.pyx":2613
 *         cdef bytes bkey = force_bytes(key)
 * 
 *         if strcmp(bkey, b'END') == 0:             # <<<<<<<<<<<<<<
 *             raise KeyError('END is a reserved attribute; access is via record.stop')
 * 
*/
  if (unlikely(__pyx_v_bkey == Py_None)) {
    PyErr_SetString(PyExc_TypeError, "expected bytes, NoneType found");
    __PYX_ERR(0, 2613, __pyx_L1_error)
  }
  __pyx_t_2 = __Pyx_PyBytes_AsString(__pyx_v_bkey); if (unlikely((!__pyx_t_2) && PyErr_Occurred())) __PYX_ERR(0, 2613, __pyx_L1_error)
  __pyx_t_3 = (strcmp(__pyx_t_2, ((char const *)"END")) == 0);
  if (unlikely(__pyx_t_3)) {

    /* "pysam/libcbcf.pyx":2614
 * 
 *         if strcmp(bkey, b'END') == 0:
 *             raise KeyError('END is a reserved attribute; access is via record.stop')             # <<<<<<<<<<<<<<
 * 
 *         if bcf_unpack(self.record.ptr, BCF_UN_INFO) < 0:
*/
    __pyx_t_4 = NULL;
    __Pyx_INCREF(__pyx_builtin_KeyError);
    __pyx_t_5 = __pyx_builtin_KeyError; 
    __pyx_t_6 = 1;
    {
      PyObject *__pyx_callargs[2] = {__pyx_t_4, __pyx_mstate_global->__pyx_kp_u_END_is_a_reserved_attribute_acce};
      __pyx_t_1 = __Pyx_PyObject_FastCall(__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, 2614, __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, 2614, __pyx_L1_error)

    /* "pysam/libcbcf.pyx":2613
 *         cdef bytes bkey = force_bytes(key)
 * 
 *         if strcmp(bkey, b'END') == 0:             # <<<<<<<<<<<<<<
 *             raise KeyError('END is a reserved attribute; access is via record.stop')
 * 
*/
  }

  /* "pysam/libcbcf.pyx":2616
 *             raise KeyError('END is a reserved attribute; access is via record.stop')
 * 
 *         if bcf_unpack(self.record.ptr, BCF_UN_INFO) < 0:             # <<<<<<<<<<<<<<
 *             raise ValueError('Error unpacking VariantRecord')
 * 
*/
  __pyx_t_3 = (bcf_unpack(__pyx_v_self->record->ptr, BCF_UN_INFO) < 0);
  if (unlikely(__pyx_t_3)) {

    /* "pysam/libcbcf.pyx":2617
 * 
 *         if bcf_unpack(self.record.ptr, BCF_UN_INFO) < 0:
 *             raise ValueError('Error unpacking VariantRecord')             # <<<<<<<<<<<<<<
 * 
 *         bcf_info_set_value(self.record, key, value)
*/
    __pyx_t_5 = NULL;
    __Pyx_INCREF(__pyx_builtin_ValueError);
    __pyx_t_4 = __pyx_builtin_ValueError; 
    __pyx_t_6 = 1;
    {
      PyObject *__pyx_callargs[2] = {__pyx_t_5, __pyx_mstate_global->__pyx_kp_u_Error_unpacking_VariantRecord};
      __pyx_t_1 = __Pyx_PyObject_FastCall(__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, 2617, __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, 2617, __pyx_L1_error)

    /* "pysam/libcbcf.pyx":2616
 *             raise KeyError('END is a reserved attribute; access is via record.stop')
 * 
 *         if bcf_unpack(self.record.ptr, BCF_UN_INFO) < 0:             # <<<<<<<<<<<<<<
 *             raise ValueError('Error unpacking VariantRecord')
 * 
*/
  }

  /* "pysam/libcbcf.pyx":2619
 *             raise ValueError('Error unpacking VariantRecord')
 * 
 *         bcf_info_set_value(self.record, key, value)             # <<<<<<<<<<<<<<
 * 
 *     def __delitem__(self, key):
*/
  __pyx_t_1 = ((PyObject *)__pyx_v_self->record);
  __Pyx_INCREF(__pyx_t_1);
  __pyx_t_4 = __pyx_f_5pysam_7libcbcf_bcf_info_set_value(((struct __pyx_obj_5pysam_7libcbcf_VariantRecord *)__pyx_t_1), __pyx_v_key, __pyx_v_value); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 2619, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;

  /* "pysam/libcbcf.pyx":2610
 *         return bcf_info_get_value(self.record, info)
 * 
 *     def __setitem__(self, key, value):             # <<<<<<<<<<<<<<
 *         cdef bytes bkey = force_bytes(key)
 * 
*/

  /* function exit code */
  __pyx_r = 0;
  __Pyx_TraceReturnCValue(__pyx_r, __Pyx_Owned_Py_None, 0, 0, __PYX_ERR(0, 2610, __pyx_L1_error));
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_XDECREF(__pyx_t_5);
  __Pyx_TraceException(__pyx_lineno, 0, 0);
  #if CYTHON_USE_SYS_MONITORING
  __Pyx_TraceExceptionUnwind(0, 0);
  #else
  __Pyx_TraceReturnValue(NULL, 0, 0, __PYX_ERR(0, 2610, __pyx_L1_error));
  #endif
  __Pyx_AddTraceback("pysam.libcbcf.VariantRecordInfo.__setitem__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = -1;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_bkey);
  __Pyx_PyMonitoring_ExitScope(0);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "pysam/libcbcf.pyx":2621
 *         bcf_info_set_value(self.record, key, value)
 * 
 *     def __delitem__(self, key):             # <<<<<<<<<<<<<<
 *         cdef bcf_hdr_t *hdr = self.record.header.ptr
 *         cdef bcf1_t *r = self.record.ptr
*/

/* Python wrapper */
static int __pyx_pw_5pysam_7libcbcf_17VariantRecordInfo_11__delitem__(PyObject *__pyx_v_self, PyObject *__pyx_v_key); /*proto*/
static int __pyx_pw_5pysam_7libcbcf_17VariantRecordInfo_11__delitem__(PyObject *__pyx_v_self, PyObject *__pyx_v_key) {
  CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__delitem__ (wrapper)", 0);
  __pyx_kwvalues = __Pyx_KwValues_VARARGS(__pyx_args, __pyx_nargs);
  __pyx_r = __pyx_pf_5pysam_7libcbcf_17VariantRecordInfo_10__delitem__(((struct __pyx_obj_5pysam_7libcbcf_VariantRecordInfo *)__pyx_v_self), ((PyObject *)__pyx_v_key));

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

static int __pyx_pf_5pysam_7libcbcf_17VariantRecordInfo_10__delitem__(struct __pyx_obj_5pysam_7libcbcf_VariantRecordInfo *__pyx_v_self, PyObject *__pyx_v_key) {
  bcf_hdr_t *__pyx_v_hdr;
  bcf1_t *__pyx_v_r;
  PyObject *__pyx_v_bkey = 0;
  bcf_info_t *__pyx_v_info;
  int __pyx_v_info_id;
  int __pyx_r;
  __Pyx_TraceDeclarationsFunc
  __Pyx_RefNannyDeclarations
  bcf_hdr_t *__pyx_t_1;
  bcf1_t *__pyx_t_2;
  PyObject *__pyx_t_3 = NULL;
  char const *__pyx_t_4;
  int __pyx_t_5;
  PyObject *__pyx_t_6 = NULL;
  PyObject *__pyx_t_7 = NULL;
  size_t __pyx_t_8;
  char const *__pyx_t_9;
  int __pyx_t_10;
  int __pyx_t_11;
  PyObject *__pyx_t_12 = NULL;
  PyObject *__pyx_t_13 = NULL;
  int __pyx_t_14;
  char const *__pyx_t_15;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_TraceFrameInit(((PyObject *)__pyx_mstate_global->__pyx_codeobj_tab[210]))
  __Pyx_RefNannySetupContext("__delitem__", 0);
  __Pyx_TraceStartFunc("__delitem__", __pyx_f[0], 2621, 0, 0, 0, __PYX_ERR(0, 2621, __pyx_L1_error));

  /* "pysam/libcbcf.pyx":2622
 * 
 *     def __delitem__(self, key):
 *         cdef bcf_hdr_t *hdr = self.record.header.ptr             # <<<<<<<<<<<<<<
 *         cdef bcf1_t *r = self.record.ptr
 * 
*/
  __pyx_t_1 = __pyx_v_self->record->header->ptr;
  __pyx_v_hdr = __pyx_t_1;

  /* "pysam/libcbcf.pyx":2623
 *     def __delitem__(self, key):
 *         cdef bcf_hdr_t *hdr = self.record.header.ptr
 *         cdef bcf1_t *r = self.record.ptr             # <<<<<<<<<<<<<<
 * 
 *         cdef bytes bkey = force_bytes(key)
*/
  __pyx_t_2 = __pyx_v_self->record->ptr;
  __pyx_v_r = __pyx_t_2;

  /* "pysam/libcbcf.pyx":2625
 *         cdef bcf1_t *r = self.record.ptr
 * 
 *         cdef bytes bkey = force_bytes(key)             # <<<<<<<<<<<<<<
 *         if strcmp(bkey, b'END') == 0:
 *             raise KeyError('END is a reserved attribute; access is via record.stop')
*/
  __pyx_t_3 = __pyx_f_5pysam_9libcutils_force_bytes(__pyx_v_key, NULL); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 2625, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __pyx_v_bkey = ((PyObject*)__pyx_t_3);
  __pyx_t_3 = 0;

  /* "pysam/libcbcf.pyx":2626
 * 
 *         cdef bytes bkey = force_bytes(key)
 *         if strcmp(bkey, b'END') == 0:             # <<<<<<<<<<<<<<
 *             raise KeyError('END is a reserved attribute; access is via record.stop')
 * 
*/
  if (unlikely(__pyx_v_bkey == Py_None)) {
    PyErr_SetString(PyExc_TypeError, "expected bytes, NoneType found");
    __PYX_ERR(0, 2626, __pyx_L1_error)
  }
  __pyx_t_4 = __Pyx_PyBytes_AsString(__pyx_v_bkey); if (unlikely((!__pyx_t_4) && PyErr_Occurred())) __PYX_ERR(0, 2626, __pyx_L1_error)
  __pyx_t_5 = (strcmp(__pyx_t_4, ((char const *)"END")) == 0);
  if (unlikely(__pyx_t_5)) {

    /* "pysam/libcbcf.pyx":2627
 *         cdef bytes bkey = force_bytes(key)
 *         if strcmp(bkey, b'END') == 0:
 *             raise KeyError('END is a reserved attribute; access is via record.stop')             # <<<<<<<<<<<<<<
 * 
 *         if bcf_unpack(r, BCF_UN_INFO) < 0:
*/
    __pyx_t_6 = NULL;
    __Pyx_INCREF(__pyx_builtin_KeyError);
    __pyx_t_7 = __pyx_builtin_KeyError; 
    __pyx_t_8 = 1;
    {
      PyObject *__pyx_callargs[2] = {__pyx_t_6, __pyx_mstate_global->__pyx_kp_u_END_is_a_reserved_attribute_acce};
      __pyx_t_3 = __Pyx_PyObject_FastCall(__pyx_t_7, __pyx_callargs+__pyx_t_8, (2-__pyx_t_8) | (__pyx_t_8*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
      __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0;
      __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
      if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 2627, __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, 2627, __pyx_L1_error)

    /* "pysam/libcbcf.pyx":2626
 * 
 *         cdef bytes bkey = force_bytes(key)
 *         if strcmp(bkey, b'END') == 0:             # <<<<<<<<<<<<<<
 *             raise KeyError('END is a reserved attribute; access is via record.stop')
 * 
*/
  }

  /* "pysam/libcbcf.pyx":2629
 *             raise KeyError('END is a reserved attribute; access is via record.stop')
 * 
 *         if bcf_unpack(r, BCF_UN_INFO) < 0:             # <<<<<<<<<<<<<<
 *             raise ValueError('Error unpacking VariantRecord')
 * 
*/
  __pyx_t_5 = (bcf_unpack(__pyx_v_r, BCF_UN_INFO) < 0);
  if (unlikely(__pyx_t_5)) {

    /* "pysam/libcbcf.pyx":2630
 * 
 *         if bcf_unpack(r, BCF_UN_INFO) < 0:
 *             raise ValueError('Error unpacking VariantRecord')             # <<<<<<<<<<<<<<
 * 
 *         cdef bcf_info_t *info = bcf_get_info(hdr, r, bkey)
*/
    __pyx_t_7 = NULL;
    __Pyx_INCREF(__pyx_builtin_ValueError);
    __pyx_t_6 = __pyx_builtin_ValueError; 
    __pyx_t_8 = 1;
    {
      PyObject *__pyx_callargs[2] = {__pyx_t_7, __pyx_mstate_global->__pyx_kp_u_Error_unpacking_VariantRecord};
      __pyx_t_3 = __Pyx_PyObject_FastCall(__pyx_t_6, __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;
      __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
      if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 2630, __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, 2630, __pyx_L1_error)

    /* "pysam/libcbcf.pyx":2629
 *             raise KeyError('END is a reserved attribute; access is via record.stop')
 * 
 *         if bcf_unpack(r, BCF_UN_INFO) < 0:             # <<<<<<<<<<<<<<
 *             raise ValueError('Error unpacking VariantRecord')
 * 
*/
  }

  /* "pysam/libcbcf.pyx":2632
 *             raise ValueError('Error unpacking VariantRecord')
 * 
 *         cdef bcf_info_t *info = bcf_get_info(hdr, r, bkey)             # <<<<<<<<<<<<<<
 * 
 *         # Cannot stop here if info == NULL, since flags must return False
*/
  if (unlikely(__pyx_v_bkey == Py_None)) {
    PyErr_SetString(PyExc_TypeError, "expected bytes, NoneType found");
    __PYX_ERR(0, 2632, __pyx_L1_error)
  }
  __pyx_t_9 = __Pyx_PyBytes_AsString(__pyx_v_bkey); if (unlikely((!__pyx_t_9) && PyErr_Occurred())) __PYX_ERR(0, 2632, __pyx_L1_error)
  __pyx_v_info = bcf_get_info(__pyx_v_hdr, __pyx_v_r, __pyx_t_9);

  /* "pysam/libcbcf.pyx":2635
 * 
 *         # Cannot stop here if info == NULL, since flags must return False
 *         cdef int info_id = bcf_header_get_info_id(hdr, bkey) if not info else info.key             # <<<<<<<<<<<<<<
 * 
 *         if info_id < 0:
*/
  __pyx_t_5 = (!(__pyx_v_info != 0));
  if (__pyx_t_5) {
    __pyx_t_11 = __pyx_f_5pysam_7libcbcf_bcf_header_get_info_id(__pyx_v_hdr, __pyx_v_bkey); if (unlikely(__pyx_t_11 == ((int)-2) && PyErr_Occurred())) __PYX_ERR(0, 2635, __pyx_L1_error)
    __pyx_t_10 = __pyx_t_11;
  } else {
    __pyx_t_10 = __pyx_v_info->key;
  }
  __pyx_v_info_id = __pyx_t_10;

  /* "pysam/libcbcf.pyx":2637
 *         cdef int info_id = bcf_header_get_info_id(hdr, bkey) if not info else info.key
 * 
 *         if info_id < 0:             # <<<<<<<<<<<<<<
 *             raise KeyError('Unknown INFO field: {}'.format(key))
 * 
*/
  __pyx_t_5 = (__pyx_v_info_id < 0);
  if (unlikely(__pyx_t_5)) {

    /* "pysam/libcbcf.pyx":2638
 * 
 *         if info_id < 0:
 *             raise KeyError('Unknown INFO field: {}'.format(key))             # <<<<<<<<<<<<<<
 * 
 *         if not check_header_id(hdr, BCF_HL_INFO, info_id):
*/
    __pyx_t_6 = NULL;
    __Pyx_INCREF(__pyx_builtin_KeyError);
    __pyx_t_7 = __pyx_builtin_KeyError; 
    __pyx_t_13 = __pyx_mstate_global->__pyx_kp_u_Unknown_INFO_field;
    __Pyx_INCREF(__pyx_t_13);
    __pyx_t_8 = 0;
    {
      PyObject *__pyx_callargs[2] = {__pyx_t_13, __pyx_v_key};
      __pyx_t_12 = __Pyx_PyObject_FastCallMethod(__pyx_mstate_global->__pyx_n_u_format, __pyx_callargs+__pyx_t_8, (2-__pyx_t_8) | (1*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
      __Pyx_XDECREF(__pyx_t_13); __pyx_t_13 = 0;
      if (unlikely(!__pyx_t_12)) __PYX_ERR(0, 2638, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_12);
    }
    __pyx_t_8 = 1;
    {
      PyObject *__pyx_callargs[2] = {__pyx_t_6, __pyx_t_12};
      __pyx_t_3 = __Pyx_PyObject_FastCall(__pyx_t_7, __pyx_callargs+__pyx_t_8, (2-__pyx_t_8) | (__pyx_t_8*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
      __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0;
      __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0;
      __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
      if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 2638, __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, 2638, __pyx_L1_error)

    /* "pysam/libcbcf.pyx":2637
 *         cdef int info_id = bcf_header_get_info_id(hdr, bkey) if not info else info.key
 * 
 *         if info_id < 0:             # <<<<<<<<<<<<<<
 *             raise KeyError('Unknown INFO field: {}'.format(key))
 * 
*/
  }

  /* "pysam/libcbcf.pyx":2640
 *             raise KeyError('Unknown INFO field: {}'.format(key))
 * 
 *         if not check_header_id(hdr, BCF_HL_INFO, info_id):             # <<<<<<<<<<<<<<
 *             raise ValueError('Invalid header')
 * 
*/
  __pyx_t_5 = __pyx_f_5pysam_7libcbcf_check_header_id(__pyx_v_hdr, BCF_HL_INFO, __pyx_v_info_id); if (unlikely(__pyx_t_5 == ((int)-1) && PyErr_Occurred())) __PYX_ERR(0, 2640, __pyx_L1_error)
  __pyx_t_14 = (!__pyx_t_5);
  if (unlikely(__pyx_t_14)) {

    /* "pysam/libcbcf.pyx":2641
 * 
 *         if not check_header_id(hdr, BCF_HL_INFO, info_id):
 *             raise ValueError('Invalid header')             # <<<<<<<<<<<<<<
 * 
 *         # Handle flags
*/
    __pyx_t_7 = NULL;
    __Pyx_INCREF(__pyx_builtin_ValueError);
    __pyx_t_12 = __pyx_builtin_ValueError; 
    __pyx_t_8 = 1;
    {
      PyObject *__pyx_callargs[2] = {__pyx_t_7, __pyx_mstate_global->__pyx_kp_u_Invalid_header};
      __pyx_t_3 = __Pyx_PyObject_FastCall(__pyx_t_12, __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;
      __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0;
      if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 2641, __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, 2641, __pyx_L1_error)

    /* "pysam/libcbcf.pyx":2640
 *             raise KeyError('Unknown INFO field: {}'.format(key))
 * 
 *         if not check_header_id(hdr, BCF_HL_INFO, info_id):             # <<<<<<<<<<<<<<
 *             raise ValueError('Invalid header')
 * 
*/
  }

  /* "pysam/libcbcf.pyx":2644
 * 
 *         # Handle flags
 *         if bcf_hdr_id2type(hdr, BCF_HL_INFO, info_id) == BCF_HT_FLAG and (not info or not info.vptr):             # <<<<<<<<<<<<<<
 *             return
 * 
*/
  __pyx_t_5 = (bcf_hdr_id2type(__pyx_v_hdr, BCF_HL_INFO, __pyx_v_info_id) == BCF_HT_FLAG);
  if (__pyx_t_5) {
  } else {
    __pyx_t_14 = __pyx_t_5;
    goto __pyx_L8_bool_binop_done;
  }
  __pyx_t_5 = (!(__pyx_v_info != 0));
  if (!__pyx_t_5) {
  } else {
    __pyx_t_14 = __pyx_t_5;
    goto __pyx_L8_bool_binop_done;
  }
  __pyx_t_5 = (!(__pyx_v_info->vptr != 0));
  __pyx_t_14 = __pyx_t_5;
  __pyx_L8_bool_binop_done:;
  if (__pyx_t_14) {

    /* "pysam/libcbcf.pyx":2645
 *         # Handle flags
 *         if bcf_hdr_id2type(hdr, BCF_HL_INFO, info_id) == BCF_HT_FLAG and (not info or not info.vptr):
 *             return             # <<<<<<<<<<<<<<
 * 
 *         if not info or not info.vptr:
*/
    __pyx_r = 0;
    goto __pyx_L0;

    /* "pysam/libcbcf.pyx":2644
 * 
 *         # Handle flags
 *         if bcf_hdr_id2type(hdr, BCF_HL_INFO, info_id) == BCF_HT_FLAG and (not info or not info.vptr):             # <<<<<<<<<<<<<<
 *             return
 * 
*/
  }

  /* "pysam/libcbcf.pyx":2647
 *             return
 * 
 *         if not info or not info.vptr:             # <<<<<<<<<<<<<<
 *             raise KeyError('Unknown INFO field: {}'.format(key))
 * 
*/
  __pyx_t_5 = (!(__pyx_v_info != 0));
  if (!__pyx_t_5) {
  } else {
    __pyx_t_14 = __pyx_t_5;
    goto __pyx_L12_bool_binop_done;
  }
  __pyx_t_5 = (!(__pyx_v_info->vptr != 0));
  __pyx_t_14 = __pyx_t_5;
  __pyx_L12_bool_binop_done:;
  if (unlikely(__pyx_t_14)) {

    /* "pysam/libcbcf.pyx":2648
 * 
 *         if not info or not info.vptr:
 *             raise KeyError('Unknown INFO field: {}'.format(key))             # <<<<<<<<<<<<<<
 * 
 *         if bcf_update_info(hdr, r, bkey, NULL, 0, info.type) < 0:
*/
    __pyx_t_12 = NULL;
    __Pyx_INCREF(__pyx_builtin_KeyError);
    __pyx_t_7 = __pyx_builtin_KeyError; 
    __pyx_t_13 = __pyx_mstate_global->__pyx_kp_u_Unknown_INFO_field;
    __Pyx_INCREF(__pyx_t_13);
    __pyx_t_8 = 0;
    {
      PyObject *__pyx_callargs[2] = {__pyx_t_13, __pyx_v_key};
      __pyx_t_6 = __Pyx_PyObject_FastCallMethod(__pyx_mstate_global->__pyx_n_u_format, __pyx_callargs+__pyx_t_8, (2-__pyx_t_8) | (1*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
      __Pyx_XDECREF(__pyx_t_13); __pyx_t_13 = 0;
      if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 2648, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_6);
    }
    __pyx_t_8 = 1;
    {
      PyObject *__pyx_callargs[2] = {__pyx_t_12, __pyx_t_6};
      __pyx_t_3 = __Pyx_PyObject_FastCall(__pyx_t_7, __pyx_callargs+__pyx_t_8, (2-__pyx_t_8) | (__pyx_t_8*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
      __Pyx_XDECREF(__pyx_t_12); __pyx_t_12 = 0;
      __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
      __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
      if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 2648, __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, 2648, __pyx_L1_error)

    /* "pysam/libcbcf.pyx":2647
 *             return
 * 
 *         if not info or not info.vptr:             # <<<<<<<<<<<<<<
 *             raise KeyError('Unknown INFO field: {}'.format(key))
 * 
*/
  }

  /* "pysam/libcbcf.pyx":2650
 *             raise KeyError('Unknown INFO field: {}'.format(key))
 * 
 *         if bcf_update_info(hdr, r, bkey, NULL, 0, info.type) < 0:             # <<<<<<<<<<<<<<
 *             raise ValueError('Unable to delete INFO')
 * 
*/
  if (unlikely(__pyx_v_bkey == Py_None)) {
    PyErr_SetString(PyExc_TypeError, "expected bytes, NoneType found");
    __PYX_ERR(0, 2650, __pyx_L1_error)
  }
  __pyx_t_15 = __Pyx_PyBytes_AsString(__pyx_v_bkey); if (unlikely((!__pyx_t_15) && PyErr_Occurred())) __PYX_ERR(0, 2650, __pyx_L1_error)
  __pyx_t_14 = (bcf_update_info(__pyx_v_hdr, __pyx_v_r, __pyx_t_15, NULL, 0, __pyx_v_info->type) < 0);
  if (unlikely(__pyx_t_14)) {

    /* "pysam/libcbcf.pyx":2651
 * 
 *         if bcf_update_info(hdr, r, bkey, NULL, 0, info.type) < 0:
 *             raise ValueError('Unable to delete INFO')             # <<<<<<<<<<<<<<
 * 
 *     def clear(self):
*/
    __pyx_t_7 = NULL;
    __Pyx_INCREF(__pyx_builtin_ValueError);
    __pyx_t_6 = __pyx_builtin_ValueError; 
    __pyx_t_8 = 1;
    {
      PyObject *__pyx_callargs[2] = {__pyx_t_7, __pyx_mstate_global->__pyx_kp_u_Unable_to_delete_INFO};
      __pyx_t_3 = __Pyx_PyObject_FastCall(__pyx_t_6, __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;
      __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
      if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 2651, __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, 2651, __pyx_L1_error)

    /* "pysam/libcbcf.pyx":2650
 *             raise KeyError('Unknown INFO field: {}'.format(key))
 * 
 *         if bcf_update_info(hdr, r, bkey, NULL, 0, info.type) < 0:             # <<<<<<<<<<<<<<
 *             raise ValueError('Unable to delete INFO')
 * 
*/
  }

  /* "pysam/libcbcf.pyx":2621
 *         bcf_info_set_value(self.record, key, value)
 * 
 *     def __delitem__(self, key):             # <<<<<<<<<<<<<<
 *         cdef bcf_hdr_t *hdr = self.record.header.ptr
 *         cdef bcf1_t *r = self.record.ptr
*/

  /* function exit code */
  __pyx_r = 0;
  __Pyx_TraceReturnCValue(__pyx_r, __Pyx_Owned_Py_None, 0, 0, __PYX_ERR(0, 2621, __pyx_L1_error));
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_6);
  __Pyx_XDECREF(__pyx_t_7);
  __Pyx_XDECREF(__pyx_t_12);
  __Pyx_XDECREF(__pyx_t_13);
  __Pyx_TraceException(__pyx_lineno, 0, 0);
  #if CYTHON_USE_SYS_MONITORING
  __Pyx_TraceExceptionUnwind(0, 0);
  #else
  __Pyx_TraceReturnValue(NULL, 0, 0, __PYX_ERR(0, 2621, __pyx_L1_error));
  #endif
  __Pyx_AddTraceback("pysam.libcbcf.VariantRecordInfo.__delitem__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = -1;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_bkey);
  __Pyx_PyMonitoring_ExitScope(0);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "pysam/libcbcf.pyx":2653
 *             raise ValueError('Unable to delete INFO')
 * 
 *     def clear(self):             # <<<<<<<<<<<<<<
 *         """Clear all info data"""
 *         cdef bcf_hdr_t *hdr = self.record.header.ptr
*/

/* Python wrapper */
static PyObject *__pyx_pw_5pysam_7libcbcf_17VariantRecordInfo_13clear(PyObject *__pyx_v_self, 
#if 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_5pysam_7libcbcf_17VariantRecordInfo_12clear, "VariantRecordInfo.clear(self)\n\nClear all info data");
static PyMethodDef __pyx_mdef_5pysam_7libcbcf_17VariantRecordInfo_13clear = {"clear", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_5pysam_7libcbcf_17VariantRecordInfo_13clear, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_5pysam_7libcbcf_17VariantRecordInfo_12clear};
static PyObject *__pyx_pw_5pysam_7libcbcf_17VariantRecordInfo_13clear(PyObject *__pyx_v_self, 
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
) {
  #if !CYTHON_METH_FASTCALL
  CYTHON_UNUSED Py_ssize_t __pyx_nargs;
  #endif
  CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("clear (wrapper)", 0);
  #if !CYTHON_METH_FASTCALL
  #if CYTHON_ASSUME_SAFE_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("clear", 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("clear", __pyx_kwds); return NULL;}
  __pyx_r = __pyx_pf_5pysam_7libcbcf_17VariantRecordInfo_12clear(((struct __pyx_obj_5pysam_7libcbcf_VariantRecordInfo *)__pyx_v_self));

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

static PyObject *__pyx_pf_5pysam_7libcbcf_17VariantRecordInfo_12clear(struct __pyx_obj_5pysam_7libcbcf_VariantRecordInfo *__pyx_v_self) {
  bcf_hdr_t *__pyx_v_hdr;
  bcf1_t *__pyx_v_r;
  bcf_info_t *__pyx_v_info;
  char const *__pyx_v_key;
  int __pyx_v_i;
  PyObject *__pyx_r = NULL;
  __Pyx_TraceDeclarationsFunc
  __Pyx_RefNannyDeclarations
  bcf_hdr_t *__pyx_t_1;
  bcf1_t *__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;
  uint32_t __pyx_t_8;
  uint32_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_TraceFrameInit(((PyObject *)__pyx_mstate_global->__pyx_codeobj_tab[211]))
  __Pyx_RefNannySetupContext("clear", 0);
  __Pyx_TraceStartFunc("clear", __pyx_f[0], 2653, 0, 0, 0, __PYX_ERR(0, 2653, __pyx_L1_error));

  /* "pysam/libcbcf.pyx":2655
 *     def clear(self):
 *         """Clear all info data"""
 *         cdef bcf_hdr_t *hdr = self.record.header.ptr             # <<<<<<<<<<<<<<
 *         cdef bcf1_t *r = self.record.ptr
 *         cdef bcf_info_t *info
*/
  __pyx_t_1 = __pyx_v_self->record->header->ptr;
  __pyx_v_hdr = __pyx_t_1;

  /* "pysam/libcbcf.pyx":2656
 *         """Clear all info data"""
 *         cdef bcf_hdr_t *hdr = self.record.header.ptr
 *         cdef bcf1_t *r = self.record.ptr             # <<<<<<<<<<<<<<
 *         cdef bcf_info_t *info
 *         cdef const char *key
*/
  __pyx_t_2 = __pyx_v_self->record->ptr;
  __pyx_v_r = __pyx_t_2;

  /* "pysam/libcbcf.pyx":2661
 *         cdef int i
 * 
 *         if bcf_unpack(r, BCF_UN_INFO) < 0:             # <<<<<<<<<<<<<<
 *             raise ValueError('Error unpacking VariantRecord')
 * 
*/
  __pyx_t_3 = (bcf_unpack(__pyx_v_r, BCF_UN_INFO) < 0);
  if (unlikely(__pyx_t_3)) {

    /* "pysam/libcbcf.pyx":2662
 * 
 *         if bcf_unpack(r, BCF_UN_INFO) < 0:
 *             raise ValueError('Error unpacking VariantRecord')             # <<<<<<<<<<<<<<
 * 
 *         for i in range(r.n_info):
*/
    __pyx_t_5 = NULL;
    __Pyx_INCREF(__pyx_builtin_ValueError);
    __pyx_t_6 = __pyx_builtin_ValueError; 
    __pyx_t_7 = 1;
    {
      PyObject *__pyx_callargs[2] = {__pyx_t_5, __pyx_mstate_global->__pyx_kp_u_Error_unpacking_VariantRecord};
      __pyx_t_4 = __Pyx_PyObject_FastCall(__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, 2662, __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, 2662, __pyx_L1_error)

    /* "pysam/libcbcf.pyx":2661
 *         cdef int i
 * 
 *         if bcf_unpack(r, BCF_UN_INFO) < 0:             # <<<<<<<<<<<<<<
 *             raise ValueError('Error unpacking VariantRecord')
 * 
*/
  }

  /* "pysam/libcbcf.pyx":2664
 *             raise ValueError('Error unpacking VariantRecord')
 * 
 *         for i in range(r.n_info):             # <<<<<<<<<<<<<<
 *             info = &r.d.info[i]
 *             if info and info.vptr:
*/
  __pyx_t_8 = __pyx_v_r->n_info;
  __pyx_t_9 = __pyx_t_8;
  for (__pyx_t_10 = 0; __pyx_t_10 < __pyx_t_9; __pyx_t_10+=1) {
    __pyx_v_i = __pyx_t_10;

    /* "pysam/libcbcf.pyx":2665
 * 
 *         for i in range(r.n_info):
 *             info = &r.d.info[i]             # <<<<<<<<<<<<<<
 *             if info and info.vptr:
 *                 key = bcf_hdr_int2id(hdr, BCF_DT_ID, info.key)
*/
    __pyx_v_info = (&(__pyx_v_r->d.info[__pyx_v_i]));

    /* "pysam/libcbcf.pyx":2666
 *         for i in range(r.n_info):
 *             info = &r.d.info[i]
 *             if info and info.vptr:             # <<<<<<<<<<<<<<
 *                 key = bcf_hdr_int2id(hdr, BCF_DT_ID, info.key)
 *                 if strcmp(key, b'END') == 0:
*/
    __pyx_t_11 = (__pyx_v_info != 0);
    if (__pyx_t_11) {
    } else {
      __pyx_t_3 = __pyx_t_11;
      goto __pyx_L7_bool_binop_done;
    }
    __pyx_t_11 = (__pyx_v_info->vptr != 0);
    __pyx_t_3 = __pyx_t_11;
    __pyx_L7_bool_binop_done:;
    if (__pyx_t_3) {

      /* "pysam/libcbcf.pyx":2667
 *             info = &r.d.info[i]
 *             if info and info.vptr:
 *                 key = bcf_hdr_int2id(hdr, BCF_DT_ID, info.key)             # <<<<<<<<<<<<<<
 *                 if strcmp(key, b'END') == 0:
 *                     continue
*/
      __pyx_v_key = bcf_hdr_int2id(__pyx_v_hdr, BCF_DT_ID, __pyx_v_info->key);

      /* "pysam/libcbcf.pyx":2668
 *             if info and info.vptr:
 *                 key = bcf_hdr_int2id(hdr, BCF_DT_ID, info.key)
 *                 if strcmp(key, b'END') == 0:             # <<<<<<<<<<<<<<
 *                     continue
 *                 if bcf_update_info(hdr, r, key, NULL, 0, info.type) < 0:
*/
      __pyx_t_3 = (strcmp(__pyx_v_key, ((char const *)"END")) == 0);
      if (__pyx_t_3) {

        /* "pysam/libcbcf.pyx":2669
 *                 key = bcf_hdr_int2id(hdr, BCF_DT_ID, info.key)
 *                 if strcmp(key, b'END') == 0:
 *                     continue             # <<<<<<<<<<<<<<
 *                 if bcf_update_info(hdr, r, key, NULL, 0, info.type) < 0:
 *                     raise ValueError('Unable to delete INFO')
*/
        goto __pyx_L4_continue;

        /* "pysam/libcbcf.pyx":2668
 *             if info and info.vptr:
 *                 key = bcf_hdr_int2id(hdr, BCF_DT_ID, info.key)
 *                 if strcmp(key, b'END') == 0:             # <<<<<<<<<<<<<<
 *                     continue
 *                 if bcf_update_info(hdr, r, key, NULL, 0, info.type) < 0:
*/
      }

      /* "pysam/libcbcf.pyx":2670
 *                 if strcmp(key, b'END') == 0:
 *                     continue
 *                 if bcf_update_info(hdr, r, key, NULL, 0, info.type) < 0:             # <<<<<<<<<<<<<<
 *                     raise ValueError('Unable to delete INFO')
 * 
*/
      __pyx_t_3 = (bcf_update_info(__pyx_v_hdr, __pyx_v_r, __pyx_v_key, NULL, 0, __pyx_v_info->type) < 0);
      if (unlikely(__pyx_t_3)) {

        /* "pysam/libcbcf.pyx":2671
 *                     continue
 *                 if bcf_update_info(hdr, r, key, NULL, 0, info.type) < 0:
 *                     raise ValueError('Unable to delete INFO')             # <<<<<<<<<<<<<<
 * 
 *     def __iter__(self):
*/
        __pyx_t_6 = NULL;
        __Pyx_INCREF(__pyx_builtin_ValueError);
        __pyx_t_5 = __pyx_builtin_ValueError; 
        __pyx_t_7 = 1;
        {
          PyObject *__pyx_callargs[2] = {__pyx_t_6, __pyx_mstate_global->__pyx_kp_u_Unable_to_delete_INFO};
          __pyx_t_4 = __Pyx_PyObject_FastCall(__pyx_t_5, __pyx_callargs+__pyx_t_7, (2-__pyx_t_7) | (__pyx_t_7*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
          __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0;
          __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
          if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 2671, __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, 2671, __pyx_L1_error)

        /* "pysam/libcbcf.pyx":2670
 *                 if strcmp(key, b'END') == 0:
 *                     continue
 *                 if bcf_update_info(hdr, r, key, NULL, 0, info.type) < 0:             # <<<<<<<<<<<<<<
 *                     raise ValueError('Unable to delete INFO')
 * 
*/
      }

      /* "pysam/libcbcf.pyx":2666
 *         for i in range(r.n_info):
 *             info = &r.d.info[i]
 *             if info and info.vptr:             # <<<<<<<<<<<<<<
 *                 key = bcf_hdr_int2id(hdr, BCF_DT_ID, info.key)
 *                 if strcmp(key, b'END') == 0:
*/
    }
    __pyx_L4_continue:;
  }

  /* "pysam/libcbcf.pyx":2653
 *             raise ValueError('Unable to delete INFO')
 * 
 *     def clear(self):             # <<<<<<<<<<<<<<
 *         """Clear all info data"""
 *         cdef bcf_hdr_t *hdr = self.record.header.ptr
*/

  /* function exit code */
  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  __Pyx_TraceReturnValue(__pyx_r, 0, 0, __PYX_ERR(0, 2653, __pyx_L1_error));
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_XDECREF(__pyx_t_5);
  __Pyx_XDECREF(__pyx_t_6);
  __Pyx_TraceException(__pyx_lineno, 0, 0);
  #if CYTHON_USE_SYS_MONITORING
  __Pyx_TraceExceptionUnwind(0, 0);
  #else
  __Pyx_TraceReturnValue(NULL, 0, 0, __PYX_ERR(0, 2653, __pyx_L1_error));
  #endif
  __Pyx_AddTraceback("pysam.libcbcf.VariantRecordInfo.clear", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_PyMonitoring_ExitScope(0);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}
static PyObject *__pyx_gb_5pysam_7libcbcf_17VariantRecordInfo_16generator17(__pyx_CoroutineObject *__pyx_generator, CYTHON_UNUSED PyThreadState *__pyx_tstate, PyObject *__pyx_sent_value); /* proto */

/* "pysam/libcbcf.pyx":2673
 *                     raise ValueError('Unable to delete INFO')
 * 
 *     def __iter__(self):             # <<<<<<<<<<<<<<
 *         cdef bcf_hdr_t *hdr = self.record.header.ptr
 *         cdef bcf1_t *r = self.record.ptr
*/

/* Python wrapper */
static PyObject *__pyx_pw_5pysam_7libcbcf_17VariantRecordInfo_15__iter__(PyObject *__pyx_v_self); /*proto*/
static PyObject *__pyx_pw_5pysam_7libcbcf_17VariantRecordInfo_15__iter__(PyObject *__pyx_v_self) {
  CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__iter__ (wrapper)", 0);
  __pyx_kwvalues = __Pyx_KwValues_VARARGS(__pyx_args, __pyx_nargs);
  __pyx_r = __pyx_pf_5pysam_7libcbcf_17VariantRecordInfo_14__iter__(((struct __pyx_obj_5pysam_7libcbcf_VariantRecordInfo *)__pyx_v_self));

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

static PyObject *__pyx_pf_5pysam_7libcbcf_17VariantRecordInfo_14__iter__(struct __pyx_obj_5pysam_7libcbcf_VariantRecordInfo *__pyx_v_self) {
  struct __pyx_obj_5pysam_7libcbcf___pyx_scope_struct_24___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("__iter__", 0);
  __pyx_cur_scope = (struct __pyx_obj_5pysam_7libcbcf___pyx_scope_struct_24___iter__ *)__pyx_tp_new_5pysam_7libcbcf___pyx_scope_struct_24___iter__(__pyx_mstate_global->__pyx_ptype_5pysam_7libcbcf___pyx_scope_struct_24___iter__, __pyx_mstate_global->__pyx_empty_tuple, NULL);
  if (unlikely(!__pyx_cur_scope)) {
    __pyx_cur_scope = ((struct __pyx_obj_5pysam_7libcbcf___pyx_scope_struct_24___iter__ *)Py_None);
    __Pyx_INCREF(Py_None);
    __PYX_ERR(0, 2673, __pyx_L1_error)
  } else {
    __Pyx_GOTREF((PyObject *)__pyx_cur_scope);
  }
  __pyx_cur_scope->__pyx_v_self = __pyx_v_self;
  __Pyx_INCREF((PyObject *)__pyx_cur_scope->__pyx_v_self);
  __Pyx_GIVEREF((PyObject *)__pyx_cur_scope->__pyx_v_self);
  {
    __pyx_CoroutineObject *gen = __Pyx_Generator_New((__pyx_coroutine_body_t) __pyx_gb_5pysam_7libcbcf_17VariantRecordInfo_16generator17, ((PyObject *)__pyx_mstate_global->__pyx_codeobj_tab[212]), (PyObject *) __pyx_cur_scope, __pyx_mstate_global->__pyx_n_u_iter, __pyx_mstate_global->__pyx_n_u_VariantRecordInfo___iter, __pyx_mstate_global->__pyx_n_u_pysam_libcbcf); if (unlikely(!gen)) __PYX_ERR(0, 2673, __pyx_L1_error)
    __Pyx_DECREF(__pyx_cur_scope);
    __Pyx_RefNannyFinishContext();
    return (PyObject *) gen;
  }

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_AddTraceback("pysam.libcbcf.VariantRecordInfo.__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_5pysam_7libcbcf_17VariantRecordInfo_16generator17(__pyx_CoroutineObject *__pyx_generator, CYTHON_UNUSED PyThreadState *__pyx_tstate, PyObject *__pyx_sent_value) /* generator body */
{
  struct __pyx_obj_5pysam_7libcbcf___pyx_scope_struct_24___iter__ *__pyx_cur_scope = ((struct __pyx_obj_5pysam_7libcbcf___pyx_scope_struct_24___iter__ *)__pyx_generator->closure);
  PyObject *__pyx_r = NULL;
  __Pyx_TraceDeclarationsGen
  bcf_hdr_t *__pyx_t_1;
  bcf1_t *__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;
  uint32_t __pyx_t_8;
  uint32_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_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__iter__", 0);
  switch (__pyx_generator->resume_label) {
    case 0: goto __pyx_L3_first_run;
    case 1: goto __pyx_L11_resume_from_yield;
    default: /* CPython raises the right error here */
    __Pyx_TraceStartGen("__iter__", __pyx_f[0], 2673, 0, 0, 0, __PYX_ERR(0, 2673, __pyx_L1_error));
    __Pyx_TraceReturnValue(Py_None, 0, 0, __PYX_ERR(0, 2673, __pyx_L1_error));
    __Pyx_RefNannyFinishContext();
    return NULL;
  }
  __pyx_L3_first_run:;
  __Pyx_TraceStartGen("__iter__", __pyx_f[0], 2673, 0, 0, 0, __PYX_ERR(0, 2673, __pyx_L1_error));
  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, 2673, __pyx_L1_error)
  }

  /* "pysam/libcbcf.pyx":2674
 * 
 *     def __iter__(self):
 *         cdef bcf_hdr_t *hdr = self.record.header.ptr             # <<<<<<<<<<<<<<
 *         cdef bcf1_t *r = self.record.ptr
 *         cdef bcf_info_t *info
*/
  __pyx_t_1 = __pyx_cur_scope->__pyx_v_self->record->header->ptr;
  __pyx_cur_scope->__pyx_v_hdr = __pyx_t_1;

  /* "pysam/libcbcf.pyx":2675
 *     def __iter__(self):
 *         cdef bcf_hdr_t *hdr = self.record.header.ptr
 *         cdef bcf1_t *r = self.record.ptr             # <<<<<<<<<<<<<<
 *         cdef bcf_info_t *info
 *         cdef const char *key
*/
  __pyx_t_2 = __pyx_cur_scope->__pyx_v_self->record->ptr;
  __pyx_cur_scope->__pyx_v_r = __pyx_t_2;

  /* "pysam/libcbcf.pyx":2680
 *         cdef int i
 * 
 *         if bcf_unpack(r, BCF_UN_INFO) < 0:             # <<<<<<<<<<<<<<
 *             raise ValueError('Error unpacking VariantRecord')
 * 
*/
  __pyx_t_3 = (bcf_unpack(__pyx_cur_scope->__pyx_v_r, BCF_UN_INFO) < 0);
  if (unlikely(__pyx_t_3)) {

    /* "pysam/libcbcf.pyx":2681
 * 
 *         if bcf_unpack(r, BCF_UN_INFO) < 0:
 *             raise ValueError('Error unpacking VariantRecord')             # <<<<<<<<<<<<<<
 * 
 *         for i in range(r.n_info):
*/
    __pyx_t_5 = NULL;
    __Pyx_INCREF(__pyx_builtin_ValueError);
    __pyx_t_6 = __pyx_builtin_ValueError; 
    __pyx_t_7 = 1;
    {
      PyObject *__pyx_callargs[2] = {__pyx_t_5, __pyx_mstate_global->__pyx_kp_u_Error_unpacking_VariantRecord};
      __pyx_t_4 = __Pyx_PyObject_FastCall(__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, 2681, __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, 2681, __pyx_L1_error)

    /* "pysam/libcbcf.pyx":2680
 *         cdef int i
 * 
 *         if bcf_unpack(r, BCF_UN_INFO) < 0:             # <<<<<<<<<<<<<<
 *             raise ValueError('Error unpacking VariantRecord')
 * 
*/
  }

  /* "pysam/libcbcf.pyx":2683
 *             raise ValueError('Error unpacking VariantRecord')
 * 
 *         for i in range(r.n_info):             # <<<<<<<<<<<<<<
 *             info = &r.d.info[i]
 *             if info and info.vptr:
*/
  __pyx_t_8 = __pyx_cur_scope->__pyx_v_r->n_info;
  __pyx_t_9 = __pyx_t_8;
  for (__pyx_t_10 = 0; __pyx_t_10 < __pyx_t_9; __pyx_t_10+=1) {
    __pyx_cur_scope->__pyx_v_i = __pyx_t_10;

    /* "pysam/libcbcf.pyx":2684
 * 
 *         for i in range(r.n_info):
 *             info = &r.d.info[i]             # <<<<<<<<<<<<<<
 *             if info and info.vptr:
 *                 key = bcf_hdr_int2id(hdr, BCF_DT_ID, info.key)
*/
    __pyx_cur_scope->__pyx_v_info = (&(__pyx_cur_scope->__pyx_v_r->d.info[__pyx_cur_scope->__pyx_v_i]));

    /* "pysam/libcbcf.pyx":2685
 *         for i in range(r.n_info):
 *             info = &r.d.info[i]
 *             if info and info.vptr:             # <<<<<<<<<<<<<<
 *                 key = bcf_hdr_int2id(hdr, BCF_DT_ID, info.key)
 *                 if strcmp(key, b'END') != 0:
*/
    __pyx_t_11 = (__pyx_cur_scope->__pyx_v_info != 0);
    if (__pyx_t_11) {
    } else {
      __pyx_t_3 = __pyx_t_11;
      goto __pyx_L8_bool_binop_done;
    }
    __pyx_t_11 = (__pyx_cur_scope->__pyx_v_info->vptr != 0);
    __pyx_t_3 = __pyx_t_11;
    __pyx_L8_bool_binop_done:;
    if (__pyx_t_3) {

      /* "pysam/libcbcf.pyx":2686
 *             info = &r.d.info[i]
 *             if info and info.vptr:
 *                 key = bcf_hdr_int2id(hdr, BCF_DT_ID, info.key)             # <<<<<<<<<<<<<<
 *                 if strcmp(key, b'END') != 0:
 *                     yield bcf_str_cache_get_charptr(key)
*/
      __pyx_cur_scope->__pyx_v_key = bcf_hdr_int2id(__pyx_cur_scope->__pyx_v_hdr, BCF_DT_ID, __pyx_cur_scope->__pyx_v_info->key);

      /* "pysam/libcbcf.pyx":2687
 *             if info and info.vptr:
 *                 key = bcf_hdr_int2id(hdr, BCF_DT_ID, info.key)
 *                 if strcmp(key, b'END') != 0:             # <<<<<<<<<<<<<<
 *                     yield bcf_str_cache_get_charptr(key)
 * 
*/
      __pyx_t_3 = (strcmp(__pyx_cur_scope->__pyx_v_key, ((char const *)"END")) != 0);
      if (__pyx_t_3) {

        /* "pysam/libcbcf.pyx":2688
 *                 key = bcf_hdr_int2id(hdr, BCF_DT_ID, info.key)
 *                 if strcmp(key, b'END') != 0:
 *                     yield bcf_str_cache_get_charptr(key)             # <<<<<<<<<<<<<<
 * 
 *     def get(self, key, default=None):
*/
        __pyx_t_4 = __pyx_f_5pysam_7libcbcf_bcf_str_cache_get_charptr(__pyx_cur_scope->__pyx_v_key); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 2688, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_4);
        __pyx_r = __pyx_t_4;
        __pyx_t_4 = 0;
        __pyx_cur_scope->__pyx_t_0 = __pyx_t_8;
        __pyx_cur_scope->__pyx_t_1 = __pyx_t_9;
        __pyx_cur_scope->__pyx_t_2 = __pyx_t_10;
        __Pyx_TraceYield(__pyx_r, 0, __PYX_ERR(0, 2688, __pyx_L1_error));
        __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_L11_resume_from_yield:;
        __Pyx_TraceResumeGen("__iter__", __pyx_f[0], 2673, 0, __PYX_ERR(0, 2688, __pyx_L1_error));
        __pyx_t_8 = __pyx_cur_scope->__pyx_t_0;
        __pyx_t_9 = __pyx_cur_scope->__pyx_t_1;
        __pyx_t_10 = __pyx_cur_scope->__pyx_t_2;
        if (unlikely(!__pyx_sent_value)) __PYX_ERR(0, 2688, __pyx_L1_error)

        /* "pysam/libcbcf.pyx":2687
 *             if info and info.vptr:
 *                 key = bcf_hdr_int2id(hdr, BCF_DT_ID, info.key)
 *                 if strcmp(key, b'END') != 0:             # <<<<<<<<<<<<<<
 *                     yield bcf_str_cache_get_charptr(key)
 * 
*/
      }

      /* "pysam/libcbcf.pyx":2685
 *         for i in range(r.n_info):
 *             info = &r.d.info[i]
 *             if info and info.vptr:             # <<<<<<<<<<<<<<
 *                 key = bcf_hdr_int2id(hdr, BCF_DT_ID, info.key)
 *                 if strcmp(key, b'END') != 0:
*/
    }
  }
  CYTHON_MAYBE_UNUSED_VAR(__pyx_cur_scope);
  __Pyx_TraceReturnValue(Py_None, 0, 0, __PYX_ERR(0, 2673, __pyx_L1_error));

  /* "pysam/libcbcf.pyx":2673
 *                     raise ValueError('Unable to delete INFO')
 * 
 *     def __iter__(self):             # <<<<<<<<<<<<<<
 *         cdef bcf_hdr_t *hdr = self.record.header.ptr
 *         cdef bcf1_t *r = self.record.ptr
*/

  /* 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_XDECREF(__pyx_t_6);
  if (__Pyx_PyErr_Occurred()) {
    __Pyx_TraceException(__pyx_lineno, 0, 0);
    __Pyx_Generator_Replace_StopIteration(0);
    __Pyx_AddTraceback("__iter__", __pyx_clineno, __pyx_lineno, __pyx_filename);
    __Pyx_TraceExceptionUnwind(0, 0);
  }
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_PyMonitoring_ExitScope(0);
  #if !CYTHON_USE_EXC_INFO_STACK
  __Pyx_Coroutine_ResetAndClearException(__pyx_generator);
  #endif
  __pyx_generator->resume_label = -1;
  __Pyx_Coroutine_clear((PyObject*)__pyx_generator);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "pysam/libcbcf.pyx":2690
 *                     yield bcf_str_cache_get_charptr(key)
 * 
 *     def get(self, key, default=None):             # <<<<<<<<<<<<<<
 *         """D.get(k[,d]) -> D[k] if k in D, else d.  d defaults to None."""
 *         cdef bcf_hdr_t *hdr = self.record.header.ptr
*/

/* Python wrapper */
static PyObject *__pyx_pw_5pysam_7libcbcf_17VariantRecordInfo_18get(PyObject *__pyx_v_self, 
#if 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_5pysam_7libcbcf_17VariantRecordInfo_17get, "VariantRecordInfo.get(self, key, default=None)\n\nD.get(k[,d]) -> D[k] if k in D, else d.  d defaults to None.");
static PyMethodDef __pyx_mdef_5pysam_7libcbcf_17VariantRecordInfo_18get = {"get", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_5pysam_7libcbcf_17VariantRecordInfo_18get, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_5pysam_7libcbcf_17VariantRecordInfo_17get};
static PyObject *__pyx_pw_5pysam_7libcbcf_17VariantRecordInfo_18get(PyObject *__pyx_v_self, 
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
) {
  PyObject *__pyx_v_key = 0;
  PyObject *__pyx_v_default = 0;
  #if !CYTHON_METH_FASTCALL
  CYTHON_UNUSED Py_ssize_t __pyx_nargs;
  #endif
  CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
  PyObject* values[2] = {0,0};
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("get (wrapper)", 0);
  #if !CYTHON_METH_FASTCALL
  #if CYTHON_ASSUME_SAFE_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,&__pyx_mstate_global->__pyx_n_u_default,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, 2690, __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, 2690, __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, 2690, __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, 2690, __pyx_L3_error)
      if (!values[1]) values[1] = __Pyx_NewRef(((PyObject *)Py_None));
      for (Py_ssize_t i = __pyx_nargs; i < 1; i++) {
        if (unlikely(!values[i])) { __Pyx_RaiseArgtupleInvalid("get", 0, 1, 2, i); __PYX_ERR(0, 2690, __pyx_L3_error) }
      }
    } 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, 2690, __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, 2690, __pyx_L3_error)
        break;
        default: goto __pyx_L5_argtuple_error;
      }
      if (!values[1]) values[1] = __Pyx_NewRef(((PyObject *)Py_None));
    }
    __pyx_v_key = values[0];
    __pyx_v_default = values[1];
  }
  goto __pyx_L6_skip;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("get", 0, 1, 2, __pyx_nargs); __PYX_ERR(0, 2690, __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("pysam.libcbcf.VariantRecordInfo.get", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_5pysam_7libcbcf_17VariantRecordInfo_17get(((struct __pyx_obj_5pysam_7libcbcf_VariantRecordInfo *)__pyx_v_self), __pyx_v_key, __pyx_v_default);

  /* 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_5pysam_7libcbcf_17VariantRecordInfo_17get(struct __pyx_obj_5pysam_7libcbcf_VariantRecordInfo *__pyx_v_self, PyObject *__pyx_v_key, PyObject *__pyx_v_default) {
  bcf_hdr_t *__pyx_v_hdr;
  bcf1_t *__pyx_v_r;
  PyObject *__pyx_v_bkey = 0;
  bcf_info_t *__pyx_v_info;
  int __pyx_v_info_id;
  PyObject *__pyx_r = NULL;
  __Pyx_TraceDeclarationsFunc
  __Pyx_RefNannyDeclarations
  bcf_hdr_t *__pyx_t_1;
  bcf1_t *__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;
  char const *__pyx_t_8;
  char const *__pyx_t_9;
  int __pyx_t_10;
  int __pyx_t_11;
  int __pyx_t_12;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_TraceFrameInit(((PyObject *)__pyx_mstate_global->__pyx_codeobj_tab[213]))
  __Pyx_RefNannySetupContext("get", 0);
  __Pyx_TraceStartFunc("get", __pyx_f[0], 2690, 0, 0, 0, __PYX_ERR(0, 2690, __pyx_L1_error));

  /* "pysam/libcbcf.pyx":2692
 *     def get(self, key, default=None):
 *         """D.get(k[,d]) -> D[k] if k in D, else d.  d defaults to None."""
 *         cdef bcf_hdr_t *hdr = self.record.header.ptr             # <<<<<<<<<<<<<<
 *         cdef bcf1_t *r = self.record.ptr
 * 
*/
  __pyx_t_1 = __pyx_v_self->record->header->ptr;
  __pyx_v_hdr = __pyx_t_1;

  /* "pysam/libcbcf.pyx":2693
 *         """D.get(k[,d]) -> D[k] if k in D, else d.  d defaults to None."""
 *         cdef bcf_hdr_t *hdr = self.record.header.ptr
 *         cdef bcf1_t *r = self.record.ptr             # <<<<<<<<<<<<<<
 * 
 *         if bcf_unpack(r, BCF_UN_INFO) < 0:
*/
  __pyx_t_2 = __pyx_v_self->record->ptr;
  __pyx_v_r = __pyx_t_2;

  /* "pysam/libcbcf.pyx":2695
 *         cdef bcf1_t *r = self.record.ptr
 * 
 *         if bcf_unpack(r, BCF_UN_INFO) < 0:             # <<<<<<<<<<<<<<
 *             raise ValueError('Error unpacking VariantRecord')
 * 
*/
  __pyx_t_3 = (bcf_unpack(__pyx_v_r, BCF_UN_INFO) < 0);
  if (unlikely(__pyx_t_3)) {

    /* "pysam/libcbcf.pyx":2696
 * 
 *         if bcf_unpack(r, BCF_UN_INFO) < 0:
 *             raise ValueError('Error unpacking VariantRecord')             # <<<<<<<<<<<<<<
 * 
 *         cdef bytes bkey = force_bytes(key)
*/
    __pyx_t_5 = NULL;
    __Pyx_INCREF(__pyx_builtin_ValueError);
    __pyx_t_6 = __pyx_builtin_ValueError; 
    __pyx_t_7 = 1;
    {
      PyObject *__pyx_callargs[2] = {__pyx_t_5, __pyx_mstate_global->__pyx_kp_u_Error_unpacking_VariantRecord};
      __pyx_t_4 = __Pyx_PyObject_FastCall(__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, 2696, __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, 2696, __pyx_L1_error)

    /* "pysam/libcbcf.pyx":2695
 *         cdef bcf1_t *r = self.record.ptr
 * 
 *         if bcf_unpack(r, BCF_UN_INFO) < 0:             # <<<<<<<<<<<<<<
 *             raise ValueError('Error unpacking VariantRecord')
 * 
*/
  }

  /* "pysam/libcbcf.pyx":2698
 *             raise ValueError('Error unpacking VariantRecord')
 * 
 *         cdef bytes bkey = force_bytes(key)             # <<<<<<<<<<<<<<
 * 
 *         if strcmp(bkey, b'END') == 0:
*/
  __pyx_t_4 = __pyx_f_5pysam_9libcutils_force_bytes(__pyx_v_key, NULL); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 2698, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  __pyx_v_bkey = ((PyObject*)__pyx_t_4);
  __pyx_t_4 = 0;

  /* "pysam/libcbcf.pyx":2700
 *         cdef bytes bkey = force_bytes(key)
 * 
 *         if strcmp(bkey, b'END') == 0:             # <<<<<<<<<<<<<<
 *             return default
 * 
*/
  if (unlikely(__pyx_v_bkey == Py_None)) {
    PyErr_SetString(PyExc_TypeError, "expected bytes, NoneType found");
    __PYX_ERR(0, 2700, __pyx_L1_error)
  }
  __pyx_t_8 = __Pyx_PyBytes_AsString(__pyx_v_bkey); if (unlikely((!__pyx_t_8) && PyErr_Occurred())) __PYX_ERR(0, 2700, __pyx_L1_error)
  __pyx_t_3 = (strcmp(__pyx_t_8, ((char const *)"END")) == 0);
  if (__pyx_t_3) {

    /* "pysam/libcbcf.pyx":2701
 * 
 *         if strcmp(bkey, b'END') == 0:
 *             return default             # <<<<<<<<<<<<<<
 * 
 *         cdef bcf_info_t *info = bcf_get_info(hdr, r, bkey)
*/
    __Pyx_XDECREF(__pyx_r);
    __Pyx_INCREF(__pyx_v_default);
    __pyx_r = __pyx_v_default;
    __Pyx_TraceReturnValue(__pyx_r, 33, 0, __PYX_ERR(0, 2701, __pyx_L1_error));
    goto __pyx_L0;

    /* "pysam/libcbcf.pyx":2700
 *         cdef bytes bkey = force_bytes(key)
 * 
 *         if strcmp(bkey, b'END') == 0:             # <<<<<<<<<<<<<<
 *             return default
 * 
*/
  }

  /* "pysam/libcbcf.pyx":2703
 *             return default
 * 
 *         cdef bcf_info_t *info = bcf_get_info(hdr, r, bkey)             # <<<<<<<<<<<<<<
 * 
 *         # Cannot stop here if info == NULL, since flags must return False
*/
  if (unlikely(__pyx_v_bkey == Py_None)) {
    PyErr_SetString(PyExc_TypeError, "expected bytes, NoneType found");
    __PYX_ERR(0, 2703, __pyx_L1_error)
  }
  __pyx_t_9 = __Pyx_PyBytes_AsString(__pyx_v_bkey); if (unlikely((!__pyx_t_9) && PyErr_Occurred())) __PYX_ERR(0, 2703, __pyx_L1_error)
  __pyx_v_info = bcf_get_info(__pyx_v_hdr, __pyx_v_r, __pyx_t_9);

  /* "pysam/libcbcf.pyx":2706
 * 
 *         # Cannot stop here if info == NULL, since flags must return False
 *         cdef int info_id = bcf_header_get_info_id(hdr, bkey) if not info else info.key             # <<<<<<<<<<<<<<
 * 
 *         if not check_header_id(hdr, BCF_HL_INFO, info_id):
*/
  __pyx_t_3 = (!(__pyx_v_info != 0));
  if (__pyx_t_3) {
    __pyx_t_11 = __pyx_f_5pysam_7libcbcf_bcf_header_get_info_id(__pyx_v_hdr, __pyx_v_bkey); if (unlikely(__pyx_t_11 == ((int)-2) && PyErr_Occurred())) __PYX_ERR(0, 2706, __pyx_L1_error)
    __pyx_t_10 = __pyx_t_11;
  } else {
    __pyx_t_10 = __pyx_v_info->key;
  }
  __pyx_v_info_id = __pyx_t_10;

  /* "pysam/libcbcf.pyx":2708
 *         cdef int info_id = bcf_header_get_info_id(hdr, bkey) if not info else info.key
 * 
 *         if not check_header_id(hdr, BCF_HL_INFO, info_id):             # <<<<<<<<<<<<<<
 *             raise ValueError('Invalid header')
 * 
*/
  __pyx_t_3 = __pyx_f_5pysam_7libcbcf_check_header_id(__pyx_v_hdr, BCF_HL_INFO, __pyx_v_info_id); if (unlikely(__pyx_t_3 == ((int)-1) && PyErr_Occurred())) __PYX_ERR(0, 2708, __pyx_L1_error)
  __pyx_t_12 = (!__pyx_t_3);
  if (unlikely(__pyx_t_12)) {

    /* "pysam/libcbcf.pyx":2709
 * 
 *         if not check_header_id(hdr, BCF_HL_INFO, info_id):
 *             raise ValueError('Invalid header')             # <<<<<<<<<<<<<<
 * 
 *         # Handle flags
*/
    __pyx_t_6 = NULL;
    __Pyx_INCREF(__pyx_builtin_ValueError);
    __pyx_t_5 = __pyx_builtin_ValueError; 
    __pyx_t_7 = 1;
    {
      PyObject *__pyx_callargs[2] = {__pyx_t_6, __pyx_mstate_global->__pyx_kp_u_Invalid_header};
      __pyx_t_4 = __Pyx_PyObject_FastCall(__pyx_t_5, __pyx_callargs+__pyx_t_7, (2-__pyx_t_7) | (__pyx_t_7*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
      __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0;
      __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
      if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 2709, __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, 2709, __pyx_L1_error)

    /* "pysam/libcbcf.pyx":2708
 *         cdef int info_id = bcf_header_get_info_id(hdr, bkey) if not info else info.key
 * 
 *         if not check_header_id(hdr, BCF_HL_INFO, info_id):             # <<<<<<<<<<<<<<
 *             raise ValueError('Invalid header')
 * 
*/
  }

  /* "pysam/libcbcf.pyx":2712
 * 
 *         # Handle flags
 *         if bcf_hdr_id2type(hdr, BCF_HL_INFO, info_id) == BCF_HT_FLAG:             # <<<<<<<<<<<<<<
 *             return info != NULL and info.vptr != NULL
 * 
*/
  __pyx_t_12 = (bcf_hdr_id2type(__pyx_v_hdr, BCF_HL_INFO, __pyx_v_info_id) == BCF_HT_FLAG);
  if (__pyx_t_12) {

    /* "pysam/libcbcf.pyx":2713
 *         # Handle flags
 *         if bcf_hdr_id2type(hdr, BCF_HL_INFO, info_id) == BCF_HT_FLAG:
 *             return info != NULL and info.vptr != NULL             # <<<<<<<<<<<<<<
 * 
 *         if not info or not info.vptr:
*/
    __Pyx_XDECREF(__pyx_r);
    __pyx_t_12 = (__pyx_v_info != NULL);
    if (__pyx_t_12) {
    } else {
      __pyx_t_5 = __Pyx_PyBool_FromLong(__pyx_t_12); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 2713, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_5);
      __pyx_t_4 = __pyx_t_5;
      __pyx_t_5 = 0;
      goto __pyx_L7_bool_binop_done;
    }
    __pyx_t_12 = (__pyx_v_info->vptr != NULL);
    __pyx_t_5 = __Pyx_PyBool_FromLong(__pyx_t_12); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 2713, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_5);
    __pyx_t_4 = __pyx_t_5;
    __pyx_t_5 = 0;
    __pyx_L7_bool_binop_done:;
    __pyx_r = __pyx_t_4;
    __pyx_t_4 = 0;
    __Pyx_TraceReturnValue(__pyx_r, 69, 0, __PYX_ERR(0, 2713, __pyx_L1_error));
    goto __pyx_L0;

    /* "pysam/libcbcf.pyx":2712
 * 
 *         # Handle flags
 *         if bcf_hdr_id2type(hdr, BCF_HL_INFO, info_id) == BCF_HT_FLAG:             # <<<<<<<<<<<<<<
 *             return info != NULL and info.vptr != NULL
 * 
*/
  }

  /* "pysam/libcbcf.pyx":2715
 *             return info != NULL and info.vptr != NULL
 * 
 *         if not info or not info.vptr:             # <<<<<<<<<<<<<<
 *             return default
 * 
*/
  __pyx_t_3 = (!(__pyx_v_info != 0));
  if (!__pyx_t_3) {
  } else {
    __pyx_t_12 = __pyx_t_3;
    goto __pyx_L10_bool_binop_done;
  }
  __pyx_t_3 = (!(__pyx_v_info->vptr != 0));
  __pyx_t_12 = __pyx_t_3;
  __pyx_L10_bool_binop_done:;
  if (__pyx_t_12) {

    /* "pysam/libcbcf.pyx":2716
 * 
 *         if not info or not info.vptr:
 *             return default             # <<<<<<<<<<<<<<
 * 
 *         return bcf_info_get_value(self.record, info)
*/
    __Pyx_XDECREF(__pyx_r);
    __Pyx_INCREF(__pyx_v_default);
    __pyx_r = __pyx_v_default;
    __Pyx_TraceReturnValue(__pyx_r, 85, 0, __PYX_ERR(0, 2716, __pyx_L1_error));
    goto __pyx_L0;

    /* "pysam/libcbcf.pyx":2715
 *             return info != NULL and info.vptr != NULL
 * 
 *         if not info or not info.vptr:             # <<<<<<<<<<<<<<
 *             return default
 * 
*/
  }

  /* "pysam/libcbcf.pyx":2718
 *             return default
 * 
 *         return bcf_info_get_value(self.record, info)             # <<<<<<<<<<<<<<
 * 
 *     def __contains__(self, key):
*/
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_4 = ((PyObject *)__pyx_v_self->record);
  __Pyx_INCREF(__pyx_t_4);
  __pyx_t_5 = __pyx_f_5pysam_7libcbcf_bcf_info_get_value(((struct __pyx_obj_5pysam_7libcbcf_VariantRecord *)__pyx_t_4), __pyx_v_info); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 2718, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_5);
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  __pyx_r = __pyx_t_5;
  __pyx_t_5 = 0;
  __Pyx_TraceReturnValue(__pyx_r, 87, 0, __PYX_ERR(0, 2718, __pyx_L1_error));
  goto __pyx_L0;

  /* "pysam/libcbcf.pyx":2690
 *                     yield bcf_str_cache_get_charptr(key)
 * 
 *     def get(self, key, default=None):             # <<<<<<<<<<<<<<
 *         """D.get(k[,d]) -> D[k] if k in D, else d.  d defaults to None."""
 *         cdef bcf_hdr_t *hdr = self.record.header.ptr
*/

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_XDECREF(__pyx_t_5);
  __Pyx_XDECREF(__pyx_t_6);
  __Pyx_TraceException(__pyx_lineno, 0, 0);
  #if CYTHON_USE_SYS_MONITORING
  __Pyx_TraceExceptionUnwind(0, 0);
  #else
  __Pyx_TraceReturnValue(NULL, 0, 0, __PYX_ERR(0, 2690, __pyx_L1_error));
  #endif
  __Pyx_AddTraceback("pysam.libcbcf.VariantRecordInfo.get", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_bkey);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_PyMonitoring_ExitScope(0);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "pysam/libcbcf.pyx":2720
 *         return bcf_info_get_value(self.record, info)
 * 
 *     def __contains__(self, key):             # <<<<<<<<<<<<<<
 *         cdef bcf_hdr_t *hdr = self.record.header.ptr
 *         cdef bcf1_t *r = self.record.ptr
*/

/* Python wrapper */
static int __pyx_pw_5pysam_7libcbcf_17VariantRecordInfo_20__contains__(PyObject *__pyx_v_self, PyObject *__pyx_v_key); /*proto*/
static int __pyx_pw_5pysam_7libcbcf_17VariantRecordInfo_20__contains__(PyObject *__pyx_v_self, PyObject *__pyx_v_key) {
  CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__contains__ (wrapper)", 0);
  __pyx_kwvalues = __Pyx_KwValues_VARARGS(__pyx_args, __pyx_nargs);
  __pyx_r = __pyx_pf_5pysam_7libcbcf_17VariantRecordInfo_19__contains__(((struct __pyx_obj_5pysam_7libcbcf_VariantRecordInfo *)__pyx_v_self), ((PyObject *)__pyx_v_key));

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

static int __pyx_pf_5pysam_7libcbcf_17VariantRecordInfo_19__contains__(struct __pyx_obj_5pysam_7libcbcf_VariantRecordInfo *__pyx_v_self, PyObject *__pyx_v_key) {
  bcf_hdr_t *__pyx_v_hdr;
  bcf1_t *__pyx_v_r;
  PyObject *__pyx_v_bkey = 0;
  bcf_info_t *__pyx_v_info;
  int __pyx_r;
  __Pyx_TraceDeclarationsFunc
  __Pyx_RefNannyDeclarations
  bcf_hdr_t *__pyx_t_1;
  bcf1_t *__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;
  char const *__pyx_t_8;
  char const *__pyx_t_9;
  int __pyx_t_10;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_TraceFrameInit(((PyObject *)__pyx_mstate_global->__pyx_codeobj_tab[214]))
  __Pyx_RefNannySetupContext("__contains__", 0);
  __Pyx_TraceStartFunc("__contains__", __pyx_f[0], 2720, 0, 0, 0, __PYX_ERR(0, 2720, __pyx_L1_error));

  /* "pysam/libcbcf.pyx":2721
 * 
 *     def __contains__(self, key):
 *         cdef bcf_hdr_t *hdr = self.record.header.ptr             # <<<<<<<<<<<<<<
 *         cdef bcf1_t *r = self.record.ptr
 * 
*/
  __pyx_t_1 = __pyx_v_self->record->header->ptr;
  __pyx_v_hdr = __pyx_t_1;

  /* "pysam/libcbcf.pyx":2722
 *     def __contains__(self, key):
 *         cdef bcf_hdr_t *hdr = self.record.header.ptr
 *         cdef bcf1_t *r = self.record.ptr             # <<<<<<<<<<<<<<
 * 
 *         if bcf_unpack(r, BCF_UN_INFO) < 0:
*/
  __pyx_t_2 = __pyx_v_self->record->ptr;
  __pyx_v_r = __pyx_t_2;

  /* "pysam/libcbcf.pyx":2724
 *         cdef bcf1_t *r = self.record.ptr
 * 
 *         if bcf_unpack(r, BCF_UN_INFO) < 0:             # <<<<<<<<<<<<<<
 *             raise ValueError('Error unpacking VariantRecord')
 * 
*/
  __pyx_t_3 = (bcf_unpack(__pyx_v_r, BCF_UN_INFO) < 0);
  if (unlikely(__pyx_t_3)) {

    /* "pysam/libcbcf.pyx":2725
 * 
 *         if bcf_unpack(r, BCF_UN_INFO) < 0:
 *             raise ValueError('Error unpacking VariantRecord')             # <<<<<<<<<<<<<<
 * 
 *         cdef bytes bkey = force_bytes(key)
*/
    __pyx_t_5 = NULL;
    __Pyx_INCREF(__pyx_builtin_ValueError);
    __pyx_t_6 = __pyx_builtin_ValueError; 
    __pyx_t_7 = 1;
    {
      PyObject *__pyx_callargs[2] = {__pyx_t_5, __pyx_mstate_global->__pyx_kp_u_Error_unpacking_VariantRecord};
      __pyx_t_4 = __Pyx_PyObject_FastCall(__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, 2725, __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, 2725, __pyx_L1_error)

    /* "pysam/libcbcf.pyx":2724
 *         cdef bcf1_t *r = self.record.ptr
 * 
 *         if bcf_unpack(r, BCF_UN_INFO) < 0:             # <<<<<<<<<<<<<<
 *             raise ValueError('Error unpacking VariantRecord')
 * 
*/
  }

  /* "pysam/libcbcf.pyx":2727
 *             raise ValueError('Error unpacking VariantRecord')
 * 
 *         cdef bytes bkey = force_bytes(key)             # <<<<<<<<<<<<<<
 * 
 *         if strcmp(bkey, b'END') == 0:
*/
  __pyx_t_4 = __pyx_f_5pysam_9libcutils_force_bytes(__pyx_v_key, NULL); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 2727, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  __pyx_v_bkey = ((PyObject*)__pyx_t_4);
  __pyx_t_4 = 0;

  /* "pysam/libcbcf.pyx":2729
 *         cdef bytes bkey = force_bytes(key)
 * 
 *         if strcmp(bkey, b'END') == 0:             # <<<<<<<<<<<<<<
 *             return False
 * 
*/
  if (unlikely(__pyx_v_bkey == Py_None)) {
    PyErr_SetString(PyExc_TypeError, "expected bytes, NoneType found");
    __PYX_ERR(0, 2729, __pyx_L1_error)
  }
  __pyx_t_8 = __Pyx_PyBytes_AsString(__pyx_v_bkey); if (unlikely((!__pyx_t_8) && PyErr_Occurred())) __PYX_ERR(0, 2729, __pyx_L1_error)
  __pyx_t_3 = (strcmp(__pyx_t_8, ((char const *)"END")) == 0);
  if (__pyx_t_3) {

    /* "pysam/libcbcf.pyx":2730
 * 
 *         if strcmp(bkey, b'END') == 0:
 *             return False             # <<<<<<<<<<<<<<
 * 
 *         cdef bcf_info_t *info = bcf_get_info(hdr, r, bkey)
*/
    __pyx_r = 0;
    __Pyx_TraceReturnCValue(__pyx_r, __Pyx_PyLong_From_int, 32, 0, __PYX_ERR(0, 2730, __pyx_L1_error));
    goto __pyx_L0;

    /* "pysam/libcbcf.pyx":2729
 *         cdef bytes bkey = force_bytes(key)
 * 
 *         if strcmp(bkey, b'END') == 0:             # <<<<<<<<<<<<<<
 *             return False
 * 
*/
  }

  /* "pysam/libcbcf.pyx":2732
 *             return False
 * 
 *         cdef bcf_info_t *info = bcf_get_info(hdr, r, bkey)             # <<<<<<<<<<<<<<
 * 
 *         return info != NULL and info.vptr != NULL
*/
  if (unlikely(__pyx_v_bkey == Py_None)) {
    PyErr_SetString(PyExc_TypeError, "expected bytes, NoneType found");
    __PYX_ERR(0, 2732, __pyx_L1_error)
  }
  __pyx_t_9 = __Pyx_PyBytes_AsString(__pyx_v_bkey); if (unlikely((!__pyx_t_9) && PyErr_Occurred())) __PYX_ERR(0, 2732, __pyx_L1_error)
  __pyx_v_info = bcf_get_info(__pyx_v_hdr, __pyx_v_r, __pyx_t_9);

  /* "pysam/libcbcf.pyx":2734
 *         cdef bcf_info_t *info = bcf_get_info(hdr, r, bkey)
 * 
 *         return info != NULL and info.vptr != NULL             # <<<<<<<<<<<<<<
 * 
 *     def iterkeys(self):
*/
  __pyx_t_3 = (__pyx_v_info != NULL);
  if (__pyx_t_3) {
  } else {
    __pyx_t_10 = __pyx_t_3;
    goto __pyx_L5_bool_binop_done;
  }
  __pyx_t_3 = (__pyx_v_info->vptr != NULL);
  __pyx_t_10 = __pyx_t_3;
  __pyx_L5_bool_binop_done:;
  __pyx_r = __pyx_t_10;
  __Pyx_TraceReturnCValue(__pyx_r, __Pyx_PyLong_From_int, 40, 0, __PYX_ERR(0, 2734, __pyx_L1_error));
  goto __pyx_L0;

  /* "pysam/libcbcf.pyx":2720
 *         return bcf_info_get_value(self.record, info)
 * 
 *     def __contains__(self, key):             # <<<<<<<<<<<<<<
 *         cdef bcf_hdr_t *hdr = self.record.header.ptr
 *         cdef bcf1_t *r = self.record.ptr
*/

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_XDECREF(__pyx_t_5);
  __Pyx_XDECREF(__pyx_t_6);
  __Pyx_TraceException(__pyx_lineno, 0, 0);
  #if CYTHON_USE_SYS_MONITORING
  __Pyx_TraceExceptionUnwind(0, 0);
  #else
  __Pyx_TraceReturnValue(NULL, 0, 0, __PYX_ERR(0, 2720, __pyx_L1_error));
  #endif
  __Pyx_AddTraceback("pysam.libcbcf.VariantRecordInfo.__contains__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = -1;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_bkey);
  __Pyx_PyMonitoring_ExitScope(0);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "pysam/libcbcf.pyx":2736
 *         return info != NULL and info.vptr != NULL
 * 
 *     def iterkeys(self):             # <<<<<<<<<<<<<<
 *         """D.iterkeys() -> an iterator over the keys of D"""
 *         return iter(self)
*/

/* Python wrapper */
static PyObject *__pyx_pw_5pysam_7libcbcf_17VariantRecordInfo_22iterkeys(PyObject *__pyx_v_self, 
#if 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_5pysam_7libcbcf_17VariantRecordInfo_21iterkeys, "VariantRecordInfo.iterkeys(self)\n\nD.iterkeys() -> an iterator over the keys of D");
static PyMethodDef __pyx_mdef_5pysam_7libcbcf_17VariantRecordInfo_22iterkeys = {"iterkeys", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_5pysam_7libcbcf_17VariantRecordInfo_22iterkeys, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_5pysam_7libcbcf_17VariantRecordInfo_21iterkeys};
static PyObject *__pyx_pw_5pysam_7libcbcf_17VariantRecordInfo_22iterkeys(PyObject *__pyx_v_self, 
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
) {
  #if !CYTHON_METH_FASTCALL
  CYTHON_UNUSED Py_ssize_t __pyx_nargs;
  #endif
  CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("iterkeys (wrapper)", 0);
  #if !CYTHON_METH_FASTCALL
  #if CYTHON_ASSUME_SAFE_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("iterkeys", 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("iterkeys", __pyx_kwds); return NULL;}
  __pyx_r = __pyx_pf_5pysam_7libcbcf_17VariantRecordInfo_21iterkeys(((struct __pyx_obj_5pysam_7libcbcf_VariantRecordInfo *)__pyx_v_self));

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

static PyObject *__pyx_pf_5pysam_7libcbcf_17VariantRecordInfo_21iterkeys(struct __pyx_obj_5pysam_7libcbcf_VariantRecordInfo *__pyx_v_self) {
  PyObject *__pyx_r = NULL;
  __Pyx_TraceDeclarationsFunc
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_TraceFrameInit(((PyObject *)__pyx_mstate_global->__pyx_codeobj_tab[215]))
  __Pyx_RefNannySetupContext("iterkeys", 0);
  __Pyx_TraceStartFunc("iterkeys", __pyx_f[0], 2736, 0, 0, 0, __PYX_ERR(0, 2736, __pyx_L1_error));

  /* "pysam/libcbcf.pyx":2738
 *     def iterkeys(self):
 *         """D.iterkeys() -> an iterator over the keys of D"""
 *         return iter(self)             # <<<<<<<<<<<<<<
 * 
 *     def itervalues(self):
*/
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = PyObject_GetIter(((PyObject *)__pyx_v_self)); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 2738, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  __Pyx_TraceReturnValue(__pyx_r, 1, 0, __PYX_ERR(0, 2738, __pyx_L1_error));
  goto __pyx_L0;

  /* "pysam/libcbcf.pyx":2736
 *         return info != NULL and info.vptr != NULL
 * 
 *     def iterkeys(self):             # <<<<<<<<<<<<<<
 *         """D.iterkeys() -> an iterator over the keys of D"""
 *         return iter(self)
*/

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_TraceException(__pyx_lineno, 0, 0);
  #if CYTHON_USE_SYS_MONITORING
  __Pyx_TraceExceptionUnwind(0, 0);
  #else
  __Pyx_TraceReturnValue(NULL, 0, 0, __PYX_ERR(0, 2736, __pyx_L1_error));
  #endif
  __Pyx_AddTraceback("pysam.libcbcf.VariantRecordInfo.iterkeys", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_PyMonitoring_ExitScope(0);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}
static PyObject *__pyx_gb_5pysam_7libcbcf_17VariantRecordInfo_25generator18(__pyx_CoroutineObject *__pyx_generator, CYTHON_UNUSED PyThreadState *__pyx_tstate, PyObject *__pyx_sent_value); /* proto */

/* "pysam/libcbcf.pyx":2740
 *         return iter(self)
 * 
 *     def itervalues(self):             # <<<<<<<<<<<<<<
 *         """D.itervalues() -> an iterator over the values of D"""
 *         cdef bcf_hdr_t *hdr = self.record.header.ptr
*/

/* Python wrapper */
static PyObject *__pyx_pw_5pysam_7libcbcf_17VariantRecordInfo_24itervalues(PyObject *__pyx_v_self, 
#if 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_5pysam_7libcbcf_17VariantRecordInfo_23itervalues, "VariantRecordInfo.itervalues(self)\n\nD.itervalues() -> an iterator over the values of D");
static PyMethodDef __pyx_mdef_5pysam_7libcbcf_17VariantRecordInfo_24itervalues = {"itervalues", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_5pysam_7libcbcf_17VariantRecordInfo_24itervalues, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_5pysam_7libcbcf_17VariantRecordInfo_23itervalues};
static PyObject *__pyx_pw_5pysam_7libcbcf_17VariantRecordInfo_24itervalues(PyObject *__pyx_v_self, 
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
) {
  #if !CYTHON_METH_FASTCALL
  CYTHON_UNUSED Py_ssize_t __pyx_nargs;
  #endif
  CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("itervalues (wrapper)", 0);
  #if !CYTHON_METH_FASTCALL
  #if CYTHON_ASSUME_SAFE_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("itervalues", 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("itervalues", __pyx_kwds); return NULL;}
  __pyx_r = __pyx_pf_5pysam_7libcbcf_17VariantRecordInfo_23itervalues(((struct __pyx_obj_5pysam_7libcbcf_VariantRecordInfo *)__pyx_v_self));

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

static PyObject *__pyx_pf_5pysam_7libcbcf_17VariantRecordInfo_23itervalues(struct __pyx_obj_5pysam_7libcbcf_VariantRecordInfo *__pyx_v_self) {
  struct __pyx_obj_5pysam_7libcbcf___pyx_scope_struct_25_itervalues *__pyx_cur_scope;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("itervalues", 0);
  __pyx_cur_scope = (struct __pyx_obj_5pysam_7libcbcf___pyx_scope_struct_25_itervalues *)__pyx_tp_new_5pysam_7libcbcf___pyx_scope_struct_25_itervalues(__pyx_mstate_global->__pyx_ptype_5pysam_7libcbcf___pyx_scope_struct_25_itervalues, __pyx_mstate_global->__pyx_empty_tuple, NULL);
  if (unlikely(!__pyx_cur_scope)) {
    __pyx_cur_scope = ((struct __pyx_obj_5pysam_7libcbcf___pyx_scope_struct_25_itervalues *)Py_None);
    __Pyx_INCREF(Py_None);
    __PYX_ERR(0, 2740, __pyx_L1_error)
  } else {
    __Pyx_GOTREF((PyObject *)__pyx_cur_scope);
  }
  __pyx_cur_scope->__pyx_v_self = __pyx_v_self;
  __Pyx_INCREF((PyObject *)__pyx_cur_scope->__pyx_v_self);
  __Pyx_GIVEREF((PyObject *)__pyx_cur_scope->__pyx_v_self);
  {
    __pyx_CoroutineObject *gen = __Pyx_Generator_New((__pyx_coroutine_body_t) __pyx_gb_5pysam_7libcbcf_17VariantRecordInfo_25generator18, ((PyObject *)__pyx_mstate_global->__pyx_codeobj_tab[216]), (PyObject *) __pyx_cur_scope, __pyx_mstate_global->__pyx_n_u_itervalues, __pyx_mstate_global->__pyx_n_u_VariantRecordInfo_itervalues, __pyx_mstate_global->__pyx_n_u_pysam_libcbcf); if (unlikely(!gen)) __PYX_ERR(0, 2740, __pyx_L1_error)
    __Pyx_DECREF(__pyx_cur_scope);
    __Pyx_RefNannyFinishContext();
    return (PyObject *) gen;
  }

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_AddTraceback("pysam.libcbcf.VariantRecordInfo.itervalues", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __Pyx_DECREF((PyObject *)__pyx_cur_scope);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_gb_5pysam_7libcbcf_17VariantRecordInfo_25generator18(__pyx_CoroutineObject *__pyx_generator, CYTHON_UNUSED PyThreadState *__pyx_tstate, PyObject *__pyx_sent_value) /* generator body */
{
  struct __pyx_obj_5pysam_7libcbcf___pyx_scope_struct_25_itervalues *__pyx_cur_scope = ((struct __pyx_obj_5pysam_7libcbcf___pyx_scope_struct_25_itervalues *)__pyx_generator->closure);
  PyObject *__pyx_r = NULL;
  __Pyx_TraceDeclarationsGen
  bcf_hdr_t *__pyx_t_1;
  bcf1_t *__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;
  uint32_t __pyx_t_8;
  uint32_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_RefNannyDeclarations
  __Pyx_RefNannySetupContext("itervalues", 0);
  switch (__pyx_generator->resume_label) {
    case 0: goto __pyx_L3_first_run;
    case 1: goto __pyx_L11_resume_from_yield;
    default: /* CPython raises the right error here */
    __Pyx_TraceStartGen("itervalues", __pyx_f[0], 2740, 0, 0, 0, __PYX_ERR(0, 2740, __pyx_L1_error));
    __Pyx_TraceReturnValue(Py_None, 0, 0, __PYX_ERR(0, 2740, __pyx_L1_error));
    __Pyx_RefNannyFinishContext();
    return NULL;
  }
  __pyx_L3_first_run:;
  __Pyx_TraceStartGen("itervalues", __pyx_f[0], 2740, 0, 0, 0, __PYX_ERR(0, 2740, __pyx_L1_error));
  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, 2740, __pyx_L1_error)
  }

  /* "pysam/libcbcf.pyx":2742
 *     def itervalues(self):
 *         """D.itervalues() -> an iterator over the values of D"""
 *         cdef bcf_hdr_t *hdr = self.record.header.ptr             # <<<<<<<<<<<<<<
 *         cdef bcf1_t *r = self.record.ptr
 *         cdef bcf_info_t *info
*/
  __pyx_t_1 = __pyx_cur_scope->__pyx_v_self->record->header->ptr;
  __pyx_cur_scope->__pyx_v_hdr = __pyx_t_1;

  /* "pysam/libcbcf.pyx":2743
 *         """D.itervalues() -> an iterator over the values of D"""
 *         cdef bcf_hdr_t *hdr = self.record.header.ptr
 *         cdef bcf1_t *r = self.record.ptr             # <<<<<<<<<<<<<<
 *         cdef bcf_info_t *info
 *         cdef const char *key
*/
  __pyx_t_2 = __pyx_cur_scope->__pyx_v_self->record->ptr;
  __pyx_cur_scope->__pyx_v_r = __pyx_t_2;

  /* "pysam/libcbcf.pyx":2748
 *         cdef int i
 * 
 *         if bcf_unpack(r, BCF_UN_INFO) < 0:             # <<<<<<<<<<<<<<
 *             raise ValueError('Error unpacking VariantRecord')
 * 
*/
  __pyx_t_3 = (bcf_unpack(__pyx_cur_scope->__pyx_v_r, BCF_UN_INFO) < 0);
  if (unlikely(__pyx_t_3)) {

    /* "pysam/libcbcf.pyx":2749
 * 
 *         if bcf_unpack(r, BCF_UN_INFO) < 0:
 *             raise ValueError('Error unpacking VariantRecord')             # <<<<<<<<<<<<<<
 * 
 *         for i in range(r.n_info):
*/
    __pyx_t_5 = NULL;
    __Pyx_INCREF(__pyx_builtin_ValueError);
    __pyx_t_6 = __pyx_builtin_ValueError; 
    __pyx_t_7 = 1;
    {
      PyObject *__pyx_callargs[2] = {__pyx_t_5, __pyx_mstate_global->__pyx_kp_u_Error_unpacking_VariantRecord};
      __pyx_t_4 = __Pyx_PyObject_FastCall(__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, 2749, __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, 2749, __pyx_L1_error)

    /* "pysam/libcbcf.pyx":2748
 *         cdef int i
 * 
 *         if bcf_unpack(r, BCF_UN_INFO) < 0:             # <<<<<<<<<<<<<<
 *             raise ValueError('Error unpacking VariantRecord')
 * 
*/
  }

  /* "pysam/libcbcf.pyx":2751
 *             raise ValueError('Error unpacking VariantRecord')
 * 
 *         for i in range(r.n_info):             # <<<<<<<<<<<<<<
 *             info = &r.d.info[i]
 *             if info and info.vptr:
*/
  __pyx_t_8 = __pyx_cur_scope->__pyx_v_r->n_info;
  __pyx_t_9 = __pyx_t_8;
  for (__pyx_t_10 = 0; __pyx_t_10 < __pyx_t_9; __pyx_t_10+=1) {
    __pyx_cur_scope->__pyx_v_i = __pyx_t_10;

    /* "pysam/libcbcf.pyx":2752
 * 
 *         for i in range(r.n_info):
 *             info = &r.d.info[i]             # <<<<<<<<<<<<<<
 *             if info and info.vptr:
 *                 key = bcf_hdr_int2id(hdr, BCF_DT_ID, info.key)
*/
    __pyx_cur_scope->__pyx_v_info = (&(__pyx_cur_scope->__pyx_v_r->d.info[__pyx_cur_scope->__pyx_v_i]));

    /* "pysam/libcbcf.pyx":2753
 *         for i in range(r.n_info):
 *             info = &r.d.info[i]
 *             if info and info.vptr:             # <<<<<<<<<<<<<<
 *                 key = bcf_hdr_int2id(hdr, BCF_DT_ID, info.key)
 *                 if strcmp(key, b'END') != 0:
*/
    __pyx_t_11 = (__pyx_cur_scope->__pyx_v_info != 0);
    if (__pyx_t_11) {
    } else {
      __pyx_t_3 = __pyx_t_11;
      goto __pyx_L8_bool_binop_done;
    }
    __pyx_t_11 = (__pyx_cur_scope->__pyx_v_info->vptr != 0);
    __pyx_t_3 = __pyx_t_11;
    __pyx_L8_bool_binop_done:;
    if (__pyx_t_3) {

      /* "pysam/libcbcf.pyx":2754
 *             info = &r.d.info[i]
 *             if info and info.vptr:
 *                 key = bcf_hdr_int2id(hdr, BCF_DT_ID, info.key)             # <<<<<<<<<<<<<<
 *                 if strcmp(key, b'END') != 0:
 *                     yield bcf_info_get_value(self.record, info)
*/
      __pyx_cur_scope->__pyx_v_key = bcf_hdr_int2id(__pyx_cur_scope->__pyx_v_hdr, BCF_DT_ID, __pyx_cur_scope->__pyx_v_info->key);

      /* "pysam/libcbcf.pyx":2755
 *             if info and info.vptr:
 *                 key = bcf_hdr_int2id(hdr, BCF_DT_ID, info.key)
 *                 if strcmp(key, b'END') != 0:             # <<<<<<<<<<<<<<
 *                     yield bcf_info_get_value(self.record, info)
 * 
*/
      __pyx_t_3 = (strcmp(__pyx_cur_scope->__pyx_v_key, ((char const *)"END")) != 0);
      if (__pyx_t_3) {

        /* "pysam/libcbcf.pyx":2756
 *                 key = bcf_hdr_int2id(hdr, BCF_DT_ID, info.key)
 *                 if strcmp(key, b'END') != 0:
 *                     yield bcf_info_get_value(self.record, info)             # <<<<<<<<<<<<<<
 * 
 *     def iteritems(self):
*/
        __pyx_t_4 = ((PyObject *)__pyx_cur_scope->__pyx_v_self->record);
        __Pyx_INCREF(__pyx_t_4);
        __pyx_t_6 = __pyx_f_5pysam_7libcbcf_bcf_info_get_value(((struct __pyx_obj_5pysam_7libcbcf_VariantRecord *)__pyx_t_4), __pyx_cur_scope->__pyx_v_info); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 2756, __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;
        __pyx_cur_scope->__pyx_t_0 = __pyx_t_8;
        __pyx_cur_scope->__pyx_t_1 = __pyx_t_9;
        __pyx_cur_scope->__pyx_t_2 = __pyx_t_10;
        __Pyx_TraceYield(__pyx_r, 0, __PYX_ERR(0, 2756, __pyx_L1_error));
        __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_L11_resume_from_yield:;
        __Pyx_TraceResumeGen("itervalues", __pyx_f[0], 2740, 0, __PYX_ERR(0, 2756, __pyx_L1_error));
        __pyx_t_8 = __pyx_cur_scope->__pyx_t_0;
        __pyx_t_9 = __pyx_cur_scope->__pyx_t_1;
        __pyx_t_10 = __pyx_cur_scope->__pyx_t_2;
        if (unlikely(!__pyx_sent_value)) __PYX_ERR(0, 2756, __pyx_L1_error)

        /* "pysam/libcbcf.pyx":2755
 *             if info and info.vptr:
 *                 key = bcf_hdr_int2id(hdr, BCF_DT_ID, info.key)
 *                 if strcmp(key, b'END') != 0:             # <<<<<<<<<<<<<<
 *                     yield bcf_info_get_value(self.record, info)
 * 
*/
      }

      /* "pysam/libcbcf.pyx":2753
 *         for i in range(r.n_info):
 *             info = &r.d.info[i]
 *             if info and info.vptr:             # <<<<<<<<<<<<<<
 *                 key = bcf_hdr_int2id(hdr, BCF_DT_ID, info.key)
 *                 if strcmp(key, b'END') != 0:
*/
    }
  }
  CYTHON_MAYBE_UNUSED_VAR(__pyx_cur_scope);
  __Pyx_TraceReturnValue(Py_None, 0, 0, __PYX_ERR(0, 2740, __pyx_L1_error));

  /* "pysam/libcbcf.pyx":2740
 *         return iter(self)
 * 
 *     def itervalues(self):             # <<<<<<<<<<<<<<
 *         """D.itervalues() -> an iterator over the values of D"""
 *         cdef bcf_hdr_t *hdr = self.record.header.ptr
*/

  /* 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_XDECREF(__pyx_t_6);
  if (__Pyx_PyErr_Occurred()) {
    __Pyx_TraceException(__pyx_lineno, 0, 0);
    __Pyx_Generator_Replace_StopIteration(0);
    __Pyx_AddTraceback("itervalues", __pyx_clineno, __pyx_lineno, __pyx_filename);
    __Pyx_TraceExceptionUnwind(0, 0);
  }
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_PyMonitoring_ExitScope(0);
  #if !CYTHON_USE_EXC_INFO_STACK
  __Pyx_Coroutine_ResetAndClearException(__pyx_generator);
  #endif
  __pyx_generator->resume_label = -1;
  __Pyx_Coroutine_clear((PyObject*)__pyx_generator);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}
static PyObject *__pyx_gb_5pysam_7libcbcf_17VariantRecordInfo_28generator19(__pyx_CoroutineObject *__pyx_generator, CYTHON_UNUSED PyThreadState *__pyx_tstate, PyObject *__pyx_sent_value); /* proto */

/* "pysam/libcbcf.pyx":2758
 *                     yield bcf_info_get_value(self.record, info)
 * 
 *     def iteritems(self):             # <<<<<<<<<<<<<<
 *         """D.iteritems() -> an iterator over the (key, value) items of D"""
 *         cdef bcf_hdr_t *hdr = self.record.header.ptr
*/

/* Python wrapper */
static PyObject *__pyx_pw_5pysam_7libcbcf_17VariantRecordInfo_27iteritems(PyObject *__pyx_v_self, 
#if 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_5pysam_7libcbcf_17VariantRecordInfo_26iteritems, "VariantRecordInfo.iteritems(self)\n\nD.iteritems() -> an iterator over the (key, value) items of D");
static PyMethodDef __pyx_mdef_5pysam_7libcbcf_17VariantRecordInfo_27iteritems = {"iteritems", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_5pysam_7libcbcf_17VariantRecordInfo_27iteritems, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_5pysam_7libcbcf_17VariantRecordInfo_26iteritems};
static PyObject *__pyx_pw_5pysam_7libcbcf_17VariantRecordInfo_27iteritems(PyObject *__pyx_v_self, 
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
) {
  #if !CYTHON_METH_FASTCALL
  CYTHON_UNUSED Py_ssize_t __pyx_nargs;
  #endif
  CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("iteritems (wrapper)", 0);
  #if !CYTHON_METH_FASTCALL
  #if CYTHON_ASSUME_SAFE_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("iteritems", 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("iteritems", __pyx_kwds); return NULL;}
  __pyx_r = __pyx_pf_5pysam_7libcbcf_17VariantRecordInfo_26iteritems(((struct __pyx_obj_5pysam_7libcbcf_VariantRecordInfo *)__pyx_v_self));

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

static PyObject *__pyx_pf_5pysam_7libcbcf_17VariantRecordInfo_26iteritems(struct __pyx_obj_5pysam_7libcbcf_VariantRecordInfo *__pyx_v_self) {
  struct __pyx_obj_5pysam_7libcbcf___pyx_scope_struct_26_iteritems *__pyx_cur_scope;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("iteritems", 0);
  __pyx_cur_scope = (struct __pyx_obj_5pysam_7libcbcf___pyx_scope_struct_26_iteritems *)__pyx_tp_new_5pysam_7libcbcf___pyx_scope_struct_26_iteritems(__pyx_mstate_global->__pyx_ptype_5pysam_7libcbcf___pyx_scope_struct_26_iteritems, __pyx_mstate_global->__pyx_empty_tuple, NULL);
  if (unlikely(!__pyx_cur_scope)) {
    __pyx_cur_scope = ((struct __pyx_obj_5pysam_7libcbcf___pyx_scope_struct_26_iteritems *)Py_None);
    __Pyx_INCREF(Py_None);
    __PYX_ERR(0, 2758, __pyx_L1_error)
  } else {
    __Pyx_GOTREF((PyObject *)__pyx_cur_scope);
  }
  __pyx_cur_scope->__pyx_v_self = __pyx_v_self;
  __Pyx_INCREF((PyObject *)__pyx_cur_scope->__pyx_v_self);
  __Pyx_GIVEREF((PyObject *)__pyx_cur_scope->__pyx_v_self);
  {
    __pyx_CoroutineObject *gen = __Pyx_Generator_New((__pyx_coroutine_body_t) __pyx_gb_5pysam_7libcbcf_17VariantRecordInfo_28generator19, ((PyObject *)__pyx_mstate_global->__pyx_codeobj_tab[217]), (PyObject *) __pyx_cur_scope, __pyx_mstate_global->__pyx_n_u_iteritems, __pyx_mstate_global->__pyx_n_u_VariantRecordInfo_iteritems, __pyx_mstate_global->__pyx_n_u_pysam_libcbcf); if (unlikely(!gen)) __PYX_ERR(0, 2758, __pyx_L1_error)
    __Pyx_DECREF(__pyx_cur_scope);
    __Pyx_RefNannyFinishContext();
    return (PyObject *) gen;
  }

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_AddTraceback("pysam.libcbcf.VariantRecordInfo.iteritems", __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_5pysam_7libcbcf_17VariantRecordInfo_28generator19(__pyx_CoroutineObject *__pyx_generator, CYTHON_UNUSED PyThreadState *__pyx_tstate, PyObject *__pyx_sent_value) /* generator body */
{
  struct __pyx_obj_5pysam_7libcbcf___pyx_scope_struct_26_iteritems *__pyx_cur_scope = ((struct __pyx_obj_5pysam_7libcbcf___pyx_scope_struct_26_iteritems *)__pyx_generator->closure);
  PyObject *__pyx_r = NULL;
  __Pyx_TraceDeclarationsGen
  bcf_hdr_t *__pyx_t_1;
  bcf1_t *__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;
  uint32_t __pyx_t_8;
  uint32_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_RefNannyDeclarations
  __Pyx_RefNannySetupContext("iteritems", 0);
  switch (__pyx_generator->resume_label) {
    case 0: goto __pyx_L3_first_run;
    case 1: goto __pyx_L11_resume_from_yield;
    default: /* CPython raises the right error here */
    __Pyx_TraceStartGen("iteritems", __pyx_f[0], 2758, 0, 0, 0, __PYX_ERR(0, 2758, __pyx_L1_error));
    __Pyx_TraceReturnValue(Py_None, 0, 0, __PYX_ERR(0, 2758, __pyx_L1_error));
    __Pyx_RefNannyFinishContext();
    return NULL;
  }
  __pyx_L3_first_run:;
  __Pyx_TraceStartGen("iteritems", __pyx_f[0], 2758, 0, 0, 0, __PYX_ERR(0, 2758, __pyx_L1_error));
  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, 2758, __pyx_L1_error)
  }

  /* "pysam/libcbcf.pyx":2760
 *     def iteritems(self):
 *         """D.iteritems() -> an iterator over the (key, value) items of D"""
 *         cdef bcf_hdr_t *hdr = self.record.header.ptr             # <<<<<<<<<<<<<<
 *         cdef bcf1_t *r = self.record.ptr
 *         cdef bcf_info_t *info
*/
  __pyx_t_1 = __pyx_cur_scope->__pyx_v_self->record->header->ptr;
  __pyx_cur_scope->__pyx_v_hdr = __pyx_t_1;

  /* "pysam/libcbcf.pyx":2761
 *         """D.iteritems() -> an iterator over the (key, value) items of D"""
 *         cdef bcf_hdr_t *hdr = self.record.header.ptr
 *         cdef bcf1_t *r = self.record.ptr             # <<<<<<<<<<<<<<
 *         cdef bcf_info_t *info
 *         cdef const char *key
*/
  __pyx_t_2 = __pyx_cur_scope->__pyx_v_self->record->ptr;
  __pyx_cur_scope->__pyx_v_r = __pyx_t_2;

  /* "pysam/libcbcf.pyx":2766
 *         cdef int i
 * 
 *         if bcf_unpack(r, BCF_UN_INFO) < 0:             # <<<<<<<<<<<<<<
 *             raise ValueError('Error unpacking VariantRecord')
 * 
*/
  __pyx_t_3 = (bcf_unpack(__pyx_cur_scope->__pyx_v_r, BCF_UN_INFO) < 0);
  if (unlikely(__pyx_t_3)) {

    /* "pysam/libcbcf.pyx":2767
 * 
 *         if bcf_unpack(r, BCF_UN_INFO) < 0:
 *             raise ValueError('Error unpacking VariantRecord')             # <<<<<<<<<<<<<<
 * 
 *         for i in range(r.n_info):
*/
    __pyx_t_5 = NULL;
    __Pyx_INCREF(__pyx_builtin_ValueError);
    __pyx_t_6 = __pyx_builtin_ValueError; 
    __pyx_t_7 = 1;
    {
      PyObject *__pyx_callargs[2] = {__pyx_t_5, __pyx_mstate_global->__pyx_kp_u_Error_unpacking_VariantRecord};
      __pyx_t_4 = __Pyx_PyObject_FastCall(__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, 2767, __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, 2767, __pyx_L1_error)

    /* "pysam/libcbcf.pyx":2766
 *         cdef int i
 * 
 *         if bcf_unpack(r, BCF_UN_INFO) < 0:             # <<<<<<<<<<<<<<
 *             raise ValueError('Error unpacking VariantRecord')
 * 
*/
  }

  /* "pysam/libcbcf.pyx":2769
 *             raise ValueError('Error unpacking VariantRecord')
 * 
 *         for i in range(r.n_info):             # <<<<<<<<<<<<<<
 *             info = &r.d.info[i]
 *             if info and info.vptr:
*/
  __pyx_t_8 = __pyx_cur_scope->__pyx_v_r->n_info;
  __pyx_t_9 = __pyx_t_8;
  for (__pyx_t_10 = 0; __pyx_t_10 < __pyx_t_9; __pyx_t_10+=1) {
    __pyx_cur_scope->__pyx_v_i = __pyx_t_10;

    /* "pysam/libcbcf.pyx":2770
 * 
 *         for i in range(r.n_info):
 *             info = &r.d.info[i]             # <<<<<<<<<<<<<<
 *             if info and info.vptr:
 *                 key = bcf_hdr_int2id(hdr, BCF_DT_ID, info.key)
*/
    __pyx_cur_scope->__pyx_v_info = (&(__pyx_cur_scope->__pyx_v_r->d.info[__pyx_cur_scope->__pyx_v_i]));

    /* "pysam/libcbcf.pyx":2771
 *         for i in range(r.n_info):
 *             info = &r.d.info[i]
 *             if info and info.vptr:             # <<<<<<<<<<<<<<
 *                 key = bcf_hdr_int2id(hdr, BCF_DT_ID, info.key)
 *                 if strcmp(key, b'END') != 0:
*/
    __pyx_t_11 = (__pyx_cur_scope->__pyx_v_info != 0);
    if (__pyx_t_11) {
    } else {
      __pyx_t_3 = __pyx_t_11;
      goto __pyx_L8_bool_binop_done;
    }
    __pyx_t_11 = (__pyx_cur_scope->__pyx_v_info->vptr != 0);
    __pyx_t_3 = __pyx_t_11;
    __pyx_L8_bool_binop_done:;
    if (__pyx_t_3) {

      /* "pysam/libcbcf.pyx":2772
 *             info = &r.d.info[i]
 *             if info and info.vptr:
 *                 key = bcf_hdr_int2id(hdr, BCF_DT_ID, info.key)             # <<<<<<<<<<<<<<
 *                 if strcmp(key, b'END') != 0:
 *                     value = bcf_info_get_value(self.record, info)
*/
      __pyx_cur_scope->__pyx_v_key = bcf_hdr_int2id(__pyx_cur_scope->__pyx_v_hdr, BCF_DT_ID, __pyx_cur_scope->__pyx_v_info->key);

      /* "pysam/libcbcf.pyx":2773
 *             if info and info.vptr:
 *                 key = bcf_hdr_int2id(hdr, BCF_DT_ID, info.key)
 *                 if strcmp(key, b'END') != 0:             # <<<<<<<<<<<<<<
 *                     value = bcf_info_get_value(self.record, info)
 *                     yield bcf_str_cache_get_charptr(key), value
*/
      __pyx_t_3 = (strcmp(__pyx_cur_scope->__pyx_v_key, ((char const *)"END")) != 0);
      if (__pyx_t_3) {

        /* "pysam/libcbcf.pyx":2774
 *                 key = bcf_hdr_int2id(hdr, BCF_DT_ID, info.key)
 *                 if strcmp(key, b'END') != 0:
 *                     value = bcf_info_get_value(self.record, info)             # <<<<<<<<<<<<<<
 *                     yield bcf_str_cache_get_charptr(key), value
 * 
*/
        __pyx_t_4 = ((PyObject *)__pyx_cur_scope->__pyx_v_self->record);
        __Pyx_INCREF(__pyx_t_4);
        __pyx_t_6 = __pyx_f_5pysam_7libcbcf_bcf_info_get_value(((struct __pyx_obj_5pysam_7libcbcf_VariantRecord *)__pyx_t_4), __pyx_cur_scope->__pyx_v_info); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 2774, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_6);
        __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
        __Pyx_XGOTREF(__pyx_cur_scope->__pyx_v_value);
        __Pyx_XDECREF_SET(__pyx_cur_scope->__pyx_v_value, __pyx_t_6);
        __Pyx_GIVEREF(__pyx_t_6);
        __pyx_t_6 = 0;

        /* "pysam/libcbcf.pyx":2775
 *                 if strcmp(key, b'END') != 0:
 *                     value = bcf_info_get_value(self.record, info)
 *                     yield bcf_str_cache_get_charptr(key), value             # <<<<<<<<<<<<<<
 * 
 *     def keys(self):
*/
        __pyx_t_6 = __pyx_f_5pysam_7libcbcf_bcf_str_cache_get_charptr(__pyx_cur_scope->__pyx_v_key); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 2775, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_6);
        __pyx_t_4 = PyTuple_New(2); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 2775, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_4);
        __Pyx_GIVEREF(__pyx_t_6);
        if (__Pyx_PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_t_6) != (0)) __PYX_ERR(0, 2775, __pyx_L1_error);
        __Pyx_INCREF(__pyx_cur_scope->__pyx_v_value);
        __Pyx_GIVEREF(__pyx_cur_scope->__pyx_v_value);
        if (__Pyx_PyTuple_SET_ITEM(__pyx_t_4, 1, __pyx_cur_scope->__pyx_v_value) != (0)) __PYX_ERR(0, 2775, __pyx_L1_error);
        __pyx_t_6 = 0;
        __pyx_r = __pyx_t_4;
        __pyx_t_4 = 0;
        __pyx_cur_scope->__pyx_t_0 = __pyx_t_8;
        __pyx_cur_scope->__pyx_t_1 = __pyx_t_9;
        __pyx_cur_scope->__pyx_t_2 = __pyx_t_10;
        __Pyx_TraceYield(__pyx_r, 0, __PYX_ERR(0, 2775, __pyx_L1_error));
        __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_L11_resume_from_yield:;
        __Pyx_TraceResumeGen("iteritems", __pyx_f[0], 2758, 0, __PYX_ERR(0, 2775, __pyx_L1_error));
        __pyx_t_8 = __pyx_cur_scope->__pyx_t_0;
        __pyx_t_9 = __pyx_cur_scope->__pyx_t_1;
        __pyx_t_10 = __pyx_cur_scope->__pyx_t_2;
        if (unlikely(!__pyx_sent_value)) __PYX_ERR(0, 2775, __pyx_L1_error)

        /* "pysam/libcbcf.pyx":2773
 *             if info and info.vptr:
 *                 key = bcf_hdr_int2id(hdr, BCF_DT_ID, info.key)
 *                 if strcmp(key, b'END') != 0:             # <<<<<<<<<<<<<<
 *                     value = bcf_info_get_value(self.record, info)
 *                     yield bcf_str_cache_get_charptr(key), value
*/
      }

      /* "pysam/libcbcf.pyx":2771
 *         for i in range(r.n_info):
 *             info = &r.d.info[i]
 *             if info and info.vptr:             # <<<<<<<<<<<<<<
 *                 key = bcf_hdr_int2id(hdr, BCF_DT_ID, info.key)
 *                 if strcmp(key, b'END') != 0:
*/
    }
  }
  CYTHON_MAYBE_UNUSED_VAR(__pyx_cur_scope);
  __Pyx_TraceReturnValue(Py_None, 0, 0, __PYX_ERR(0, 2758, __pyx_L1_error));

  /* "pysam/libcbcf.pyx":2758
 *                     yield bcf_info_get_value(self.record, info)
 * 
 *     def iteritems(self):             # <<<<<<<<<<<<<<
 *         """D.iteritems() -> an iterator over the (key, value) items of D"""
 *         cdef bcf_hdr_t *hdr = self.record.header.ptr
*/

  /* 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_XDECREF(__pyx_t_6);
  if (__Pyx_PyErr_Occurred()) {
    __Pyx_TraceException(__pyx_lineno, 0, 0);
    __Pyx_Generator_Replace_StopIteration(0);
    __Pyx_AddTraceback("iteritems", __pyx_clineno, __pyx_lineno, __pyx_filename);
    __Pyx_TraceExceptionUnwind(0, 0);
  }
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_PyMonitoring_ExitScope(0);
  #if !CYTHON_USE_EXC_INFO_STACK
  __Pyx_Coroutine_ResetAndClearException(__pyx_generator);
  #endif
  __pyx_generator->resume_label = -1;
  __Pyx_Coroutine_clear((PyObject*)__pyx_generator);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "pysam/libcbcf.pyx":2777
 *                     yield bcf_str_cache_get_charptr(key), value
 * 
 *     def keys(self):             # <<<<<<<<<<<<<<
 *         """D.keys() -> list of D's keys"""
 *         return list(self)
*/

/* Python wrapper */
static PyObject *__pyx_pw_5pysam_7libcbcf_17VariantRecordInfo_30keys(PyObject *__pyx_v_self, 
#if 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_5pysam_7libcbcf_17VariantRecordInfo_29keys, "VariantRecordInfo.keys(self)\n\nD.keys() -> list of D's keys");
static PyMethodDef __pyx_mdef_5pysam_7libcbcf_17VariantRecordInfo_30keys = {"keys", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_5pysam_7libcbcf_17VariantRecordInfo_30keys, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_5pysam_7libcbcf_17VariantRecordInfo_29keys};
static PyObject *__pyx_pw_5pysam_7libcbcf_17VariantRecordInfo_30keys(PyObject *__pyx_v_self, 
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
) {
  #if !CYTHON_METH_FASTCALL
  CYTHON_UNUSED Py_ssize_t __pyx_nargs;
  #endif
  CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("keys (wrapper)", 0);
  #if !CYTHON_METH_FASTCALL
  #if CYTHON_ASSUME_SAFE_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("keys", 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("keys", __pyx_kwds); return NULL;}
  __pyx_r = __pyx_pf_5pysam_7libcbcf_17VariantRecordInfo_29keys(((struct __pyx_obj_5pysam_7libcbcf_VariantRecordInfo *)__pyx_v_self));

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

static PyObject *__pyx_pf_5pysam_7libcbcf_17VariantRecordInfo_29keys(struct __pyx_obj_5pysam_7libcbcf_VariantRecordInfo *__pyx_v_self) {
  PyObject *__pyx_r = NULL;
  __Pyx_TraceDeclarationsFunc
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_TraceFrameInit(((PyObject *)__pyx_mstate_global->__pyx_codeobj_tab[218]))
  __Pyx_RefNannySetupContext("keys", 0);
  __Pyx_TraceStartFunc("keys", __pyx_f[0], 2777, 0, 0, 0, __PYX_ERR(0, 2777, __pyx_L1_error));

  /* "pysam/libcbcf.pyx":2779
 *     def keys(self):
 *         """D.keys() -> list of D's keys"""
 *         return list(self)             # <<<<<<<<<<<<<<
 * 
 *     def items(self):
*/
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = PySequence_List(((PyObject *)__pyx_v_self)); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 2779, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  __Pyx_TraceReturnValue(__pyx_r, 1, 0, __PYX_ERR(0, 2779, __pyx_L1_error));
  goto __pyx_L0;

  /* "pysam/libcbcf.pyx":2777
 *                     yield bcf_str_cache_get_charptr(key), value
 * 
 *     def keys(self):             # <<<<<<<<<<<<<<
 *         """D.keys() -> list of D's keys"""
 *         return list(self)
*/

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_TraceException(__pyx_lineno, 0, 0);
  #if CYTHON_USE_SYS_MONITORING
  __Pyx_TraceExceptionUnwind(0, 0);
  #else
  __Pyx_TraceReturnValue(NULL, 0, 0, __PYX_ERR(0, 2777, __pyx_L1_error));
  #endif
  __Pyx_AddTraceback("pysam.libcbcf.VariantRecordInfo.keys", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_PyMonitoring_ExitScope(0);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "pysam/libcbcf.pyx":2781
 *         return list(self)
 * 
 *     def items(self):             # <<<<<<<<<<<<<<
 *         """D.items() -> list of D's (key, value) pairs, as 2-tuples"""
 *         return list(self.iteritems())
*/

/* Python wrapper */
static PyObject *__pyx_pw_5pysam_7libcbcf_17VariantRecordInfo_32items(PyObject *__pyx_v_self, 
#if 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_5pysam_7libcbcf_17VariantRecordInfo_31items, "VariantRecordInfo.items(self)\n\nD.items() -> list of D's (key, value) pairs, as 2-tuples");
static PyMethodDef __pyx_mdef_5pysam_7libcbcf_17VariantRecordInfo_32items = {"items", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_5pysam_7libcbcf_17VariantRecordInfo_32items, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_5pysam_7libcbcf_17VariantRecordInfo_31items};
static PyObject *__pyx_pw_5pysam_7libcbcf_17VariantRecordInfo_32items(PyObject *__pyx_v_self, 
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
) {
  #if !CYTHON_METH_FASTCALL
  CYTHON_UNUSED Py_ssize_t __pyx_nargs;
  #endif
  CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("items (wrapper)", 0);
  #if !CYTHON_METH_FASTCALL
  #if CYTHON_ASSUME_SAFE_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("items", 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("items", __pyx_kwds); return NULL;}
  __pyx_r = __pyx_pf_5pysam_7libcbcf_17VariantRecordInfo_31items(((struct __pyx_obj_5pysam_7libcbcf_VariantRecordInfo *)__pyx_v_self));

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

static PyObject *__pyx_pf_5pysam_7libcbcf_17VariantRecordInfo_31items(struct __pyx_obj_5pysam_7libcbcf_VariantRecordInfo *__pyx_v_self) {
  PyObject *__pyx_r = NULL;
  __Pyx_TraceDeclarationsFunc
  __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_TraceFrameInit(((PyObject *)__pyx_mstate_global->__pyx_codeobj_tab[219]))
  __Pyx_RefNannySetupContext("items", 0);
  __Pyx_TraceStartFunc("items", __pyx_f[0], 2781, 0, 0, 0, __PYX_ERR(0, 2781, __pyx_L1_error));

  /* "pysam/libcbcf.pyx":2783
 *     def items(self):
 *         """D.items() -> list of D's (key, value) pairs, as 2-tuples"""
 *         return list(self.iteritems())             # <<<<<<<<<<<<<<
 * 
 *     def values(self):
*/
  __Pyx_XDECREF(__pyx_r);
  __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(__pyx_mstate_global->__pyx_n_u_iteritems, __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, 2783, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
  }
  __pyx_t_2 = __Pyx_PySequence_ListKeepNew(__pyx_t_1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 2783, __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;
  __Pyx_TraceReturnValue(__pyx_r, 1, 0, __PYX_ERR(0, 2783, __pyx_L1_error));
  goto __pyx_L0;

  /* "pysam/libcbcf.pyx":2781
 *         return list(self)
 * 
 *     def items(self):             # <<<<<<<<<<<<<<
 *         """D.items() -> list of D's (key, value) pairs, as 2-tuples"""
 *         return list(self.iteritems())
*/

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_TraceException(__pyx_lineno, 0, 0);
  #if CYTHON_USE_SYS_MONITORING
  __Pyx_TraceExceptionUnwind(0, 0);
  #else
  __Pyx_TraceReturnValue(NULL, 0, 0, __PYX_ERR(0, 2781, __pyx_L1_error));
  #endif
  __Pyx_AddTraceback("pysam.libcbcf.VariantRecordInfo.items", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_PyMonitoring_ExitScope(0);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "pysam/libcbcf.pyx":2785
 *         return list(self.iteritems())
 * 
 *     def values(self):             # <<<<<<<<<<<<<<
 *         """D.values() -> list of D's values"""
 *         return list(self.itervalues())
*/

/* Python wrapper */
static PyObject *__pyx_pw_5pysam_7libcbcf_17VariantRecordInfo_34values(PyObject *__pyx_v_self, 
#if 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_5pysam_7libcbcf_17VariantRecordInfo_33values, "VariantRecordInfo.values(self)\n\nD.values() -> list of D's values");
static PyMethodDef __pyx_mdef_5pysam_7libcbcf_17VariantRecordInfo_34values = {"values", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_5pysam_7libcbcf_17VariantRecordInfo_34values, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_5pysam_7libcbcf_17VariantRecordInfo_33values};
static PyObject *__pyx_pw_5pysam_7libcbcf_17VariantRecordInfo_34values(PyObject *__pyx_v_self, 
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
) {
  #if !CYTHON_METH_FASTCALL
  CYTHON_UNUSED Py_ssize_t __pyx_nargs;
  #endif
  CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("values (wrapper)", 0);
  #if !CYTHON_METH_FASTCALL
  #if CYTHON_ASSUME_SAFE_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("values", 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("values", __pyx_kwds); return NULL;}
  __pyx_r = __pyx_pf_5pysam_7libcbcf_17VariantRecordInfo_33values(((struct __pyx_obj_5pysam_7libcbcf_VariantRecordInfo *)__pyx_v_self));

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

static PyObject *__pyx_pf_5pysam_7libcbcf_17VariantRecordInfo_33values(struct __pyx_obj_5pysam_7libcbcf_VariantRecordInfo *__pyx_v_self) {
  PyObject *__pyx_r = NULL;
  __Pyx_TraceDeclarationsFunc
  __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_TraceFrameInit(((PyObject *)__pyx_mstate_global->__pyx_codeobj_tab[220]))
  __Pyx_RefNannySetupContext("values", 0);
  __Pyx_TraceStartFunc("values", __pyx_f[0], 2785, 0, 0, 0, __PYX_ERR(0, 2785, __pyx_L1_error));

  /* "pysam/libcbcf.pyx":2787
 *     def values(self):
 *         """D.values() -> list of D's values"""
 *         return list(self.itervalues())             # <<<<<<<<<<<<<<
 * 
 *     def update(self, items=None, **kwargs):
*/
  __Pyx_XDECREF(__pyx_r);
  __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(__pyx_mstate_global->__pyx_n_u_itervalues, __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, 2787, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
  }
  __pyx_t_2 = __Pyx_PySequence_ListKeepNew(__pyx_t_1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 2787, __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;
  __Pyx_TraceReturnValue(__pyx_r, 1, 0, __PYX_ERR(0, 2787, __pyx_L1_error));
  goto __pyx_L0;

  /* "pysam/libcbcf.pyx":2785
 *         return list(self.iteritems())
 * 
 *     def values(self):             # <<<<<<<<<<<<<<
 *         """D.values() -> list of D's values"""
 *         return list(self.itervalues())
*/

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_TraceException(__pyx_lineno, 0, 0);
  #if CYTHON_USE_SYS_MONITORING
  __Pyx_TraceExceptionUnwind(0, 0);
  #else
  __Pyx_TraceReturnValue(NULL, 0, 0, __PYX_ERR(0, 2785, __pyx_L1_error));
  #endif
  __Pyx_AddTraceback("pysam.libcbcf.VariantRecordInfo.values", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_PyMonitoring_ExitScope(0);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "pysam/libcbcf.pyx":2789
 *         return list(self.itervalues())
 * 
 *     def update(self, items=None, **kwargs):             # <<<<<<<<<<<<<<
 *         """D.update([E, ]**F) -> None.
 * 
*/

/* Python wrapper */
static PyObject *__pyx_pw_5pysam_7libcbcf_17VariantRecordInfo_36update(PyObject *__pyx_v_self, 
#if 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_5pysam_7libcbcf_17VariantRecordInfo_35update, "VariantRecordInfo.update(self, items=None, **kwargs)\n\nD.update([E, ]**F) -> None.\n\nUpdate D from dict/iterable E and F.");
static PyMethodDef __pyx_mdef_5pysam_7libcbcf_17VariantRecordInfo_36update = {"update", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_5pysam_7libcbcf_17VariantRecordInfo_36update, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_5pysam_7libcbcf_17VariantRecordInfo_35update};
static PyObject *__pyx_pw_5pysam_7libcbcf_17VariantRecordInfo_36update(PyObject *__pyx_v_self, 
#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_items = 0;
  PyObject *__pyx_v_kwargs = 0;
  #if !CYTHON_METH_FASTCALL
  CYTHON_UNUSED Py_ssize_t __pyx_nargs;
  #endif
  CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
  PyObject* values[1] = {0};
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("update (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_kwargs = PyDict_New(); if (unlikely(!__pyx_v_kwargs)) return NULL;
  __Pyx_GOTREF(__pyx_v_kwargs);
  {
    PyObject ** const __pyx_pyargnames[] = {&__pyx_mstate_global->__pyx_n_u_items,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, 2789, __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, 2789, __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, __pyx_v_kwargs, values, kwd_pos_args, __pyx_kwds_len, "update", 1) < 0) __PYX_ERR(0, 2789, __pyx_L3_error)
      if (!values[0]) values[0] = __Pyx_NewRef(((PyObject *)Py_None));
    } 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, 2789, __pyx_L3_error)
        CYTHON_FALLTHROUGH;
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      if (!values[0]) values[0] = __Pyx_NewRef(((PyObject *)Py_None));
    }
    __pyx_v_items = values[0];
  }
  goto __pyx_L6_skip;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("update", 0, 0, 1, __pyx_nargs); __PYX_ERR(0, 2789, __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_kwargs); __pyx_v_kwargs = 0;
  __Pyx_AddTraceback("pysam.libcbcf.VariantRecordInfo.update", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_5pysam_7libcbcf_17VariantRecordInfo_35update(((struct __pyx_obj_5pysam_7libcbcf_VariantRecordInfo *)__pyx_v_self), __pyx_v_items, __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_kwargs);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_5pysam_7libcbcf_17VariantRecordInfo_35update(struct __pyx_obj_5pysam_7libcbcf_VariantRecordInfo *__pyx_v_self, PyObject *__pyx_v_items, PyObject *__pyx_v_kwargs) {
  PyObject *__pyx_v_k = NULL;
  PyObject *__pyx_v_v = NULL;
  PyObject *__pyx_r = NULL;
  __Pyx_TraceDeclarationsFunc
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  Py_ssize_t __pyx_t_2;
  Py_ssize_t __pyx_t_3;
  int __pyx_t_4;
  PyObject *__pyx_t_5 = NULL;
  PyObject *__pyx_t_6 = NULL;
  int __pyx_t_7;
  int __pyx_t_8;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_TraceFrameInit(((PyObject *)__pyx_mstate_global->__pyx_codeobj_tab[221]))
  __Pyx_RefNannySetupContext("update", 0);
  __Pyx_TraceStartFunc("update", __pyx_f[0], 2789, 0, 0, 0, __PYX_ERR(0, 2789, __pyx_L1_error));

  /* "pysam/libcbcf.pyx":2794
 *         Update D from dict/iterable E and F.
 *         """
 *         for k, v in items.items():             # <<<<<<<<<<<<<<
 *             if k != 'END':
 *                 self[k] = v
*/
  __pyx_t_2 = 0;
  if (unlikely(__pyx_v_items == Py_None)) {
    PyErr_Format(PyExc_AttributeError, "'NoneType' object has no attribute '%.30s'", "items");
    __PYX_ERR(0, 2794, __pyx_L1_error)
  }
  __pyx_t_5 = __Pyx_dict_iterator(__pyx_v_items, 0, __pyx_mstate_global->__pyx_n_u_items, (&__pyx_t_3), (&__pyx_t_4)); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 2794, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_5);
  __Pyx_XDECREF(__pyx_t_1);
  __pyx_t_1 = __pyx_t_5;
  __pyx_t_5 = 0;
  while (1) {
    __pyx_t_7 = __Pyx_dict_iter_next(__pyx_t_1, __pyx_t_3, &__pyx_t_2, &__pyx_t_5, &__pyx_t_6, NULL, __pyx_t_4);
    if (unlikely(__pyx_t_7 == 0)) break;
    if (unlikely(__pyx_t_7 == -1)) __PYX_ERR(0, 2794, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_5);
    __Pyx_GOTREF(__pyx_t_6);
    __Pyx_XDECREF_SET(__pyx_v_k, __pyx_t_5);
    __pyx_t_5 = 0;
    __Pyx_XDECREF_SET(__pyx_v_v, __pyx_t_6);
    __pyx_t_6 = 0;

    /* "pysam/libcbcf.pyx":2795
 *         """
 *         for k, v in items.items():
 *             if k != 'END':             # <<<<<<<<<<<<<<
 *                 self[k] = v
 * 
*/
    __pyx_t_8 = (__Pyx_PyUnicode_Equals(__pyx_v_k, __pyx_mstate_global->__pyx_n_u_END, Py_NE)); if (unlikely((__pyx_t_8 < 0))) __PYX_ERR(0, 2795, __pyx_L1_error)
    if (__pyx_t_8) {

      /* "pysam/libcbcf.pyx":2796
 *         for k, v in items.items():
 *             if k != 'END':
 *                 self[k] = v             # <<<<<<<<<<<<<<
 * 
 *         if kwargs:
*/
      if (unlikely((PyObject_SetItem(((PyObject *)__pyx_v_self), __pyx_v_k, __pyx_v_v) < 0))) __PYX_ERR(0, 2796, __pyx_L1_error)

      /* "pysam/libcbcf.pyx":2795
 *         """
 *         for k, v in items.items():
 *             if k != 'END':             # <<<<<<<<<<<<<<
 *                 self[k] = v
 * 
*/
    }
  }
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "pysam/libcbcf.pyx":2798
 *                 self[k] = v
 * 
 *         if kwargs:             # <<<<<<<<<<<<<<
 *             kwargs.pop('END', None)
 *             for k, v in kwargs.items():
*/
  __pyx_t_8 = __Pyx_PyObject_IsTrue(__pyx_v_kwargs); if (unlikely((__pyx_t_8 < 0))) __PYX_ERR(0, 2798, __pyx_L1_error)
  if (__pyx_t_8) {

    /* "pysam/libcbcf.pyx":2799
 * 
 *         if kwargs:
 *             kwargs.pop('END', None)             # <<<<<<<<<<<<<<
 *             for k, v in kwargs.items():
 *                 self[k] = v
*/
    __pyx_t_4 = __Pyx_PyDict_Pop_ignore(__pyx_v_kwargs, __pyx_mstate_global->__pyx_n_u_END, Py_None); if (unlikely(__pyx_t_4 == ((int)-1))) __PYX_ERR(0, 2799, __pyx_L1_error)

    /* "pysam/libcbcf.pyx":2800
 *         if kwargs:
 *             kwargs.pop('END', None)
 *             for k, v in kwargs.items():             # <<<<<<<<<<<<<<
 *                 self[k] = v
 * 
*/
    __pyx_t_3 = 0;
    __pyx_t_6 = __Pyx_dict_iterator(__pyx_v_kwargs, 1, __pyx_mstate_global->__pyx_n_u_items, (&__pyx_t_2), (&__pyx_t_4)); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 2800, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_6);
    __Pyx_XDECREF(__pyx_t_1);
    __pyx_t_1 = __pyx_t_6;
    __pyx_t_6 = 0;
    while (1) {
      __pyx_t_7 = __Pyx_dict_iter_next(__pyx_t_1, __pyx_t_2, &__pyx_t_3, &__pyx_t_6, &__pyx_t_5, NULL, __pyx_t_4);
      if (unlikely(__pyx_t_7 == 0)) break;
      if (unlikely(__pyx_t_7 == -1)) __PYX_ERR(0, 2800, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_6);
      __Pyx_GOTREF(__pyx_t_5);
      __Pyx_XDECREF_SET(__pyx_v_k, __pyx_t_6);
      __pyx_t_6 = 0;
      __Pyx_XDECREF_SET(__pyx_v_v, __pyx_t_5);
      __pyx_t_5 = 0;

      /* "pysam/libcbcf.pyx":2801
 *             kwargs.pop('END', None)
 *             for k, v in kwargs.items():
 *                 self[k] = v             # <<<<<<<<<<<<<<
 * 
 *     def pop(self, key, default=_nothing):
*/
      if (unlikely((PyObject_SetItem(((PyObject *)__pyx_v_self), __pyx_v_k, __pyx_v_v) < 0))) __PYX_ERR(0, 2801, __pyx_L1_error)
    }
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

    /* "pysam/libcbcf.pyx":2798
 *                 self[k] = v
 * 
 *         if kwargs:             # <<<<<<<<<<<<<<
 *             kwargs.pop('END', None)
 *             for k, v in kwargs.items():
*/
  }

  /* "pysam/libcbcf.pyx":2789
 *         return list(self.itervalues())
 * 
 *     def update(self, items=None, **kwargs):             # <<<<<<<<<<<<<<
 *         """D.update([E, ]**F) -> None.
 * 
*/

  /* function exit code */
  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  __Pyx_TraceReturnValue(__pyx_r, 0, 0, __PYX_ERR(0, 2789, __pyx_L1_error));
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_5);
  __Pyx_XDECREF(__pyx_t_6);
  __Pyx_TraceException(__pyx_lineno, 0, 0);
  #if CYTHON_USE_SYS_MONITORING
  __Pyx_TraceExceptionUnwind(0, 0);
  #else
  __Pyx_TraceReturnValue(NULL, 0, 0, __PYX_ERR(0, 2789, __pyx_L1_error));
  #endif
  __Pyx_AddTraceback("pysam.libcbcf.VariantRecordInfo.update", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_k);
  __Pyx_XDECREF(__pyx_v_v);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_PyMonitoring_ExitScope(0);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "pysam/libcbcf.pyx":2803
 *                 self[k] = v
 * 
 *     def pop(self, key, default=_nothing):             # <<<<<<<<<<<<<<
 *         cdef bcf_hdr_t *hdr = self.record.header.ptr
 *         cdef bcf1_t *r = self.record.ptr
*/

/* Python wrapper */
static PyObject *__pyx_pw_5pysam_7libcbcf_17VariantRecordInfo_38pop(PyObject *__pyx_v_self, 
#if 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_5pysam_7libcbcf_17VariantRecordInfo_37pop, "VariantRecordInfo.pop(self, key, default=_nothing)");
static PyMethodDef __pyx_mdef_5pysam_7libcbcf_17VariantRecordInfo_38pop = {"pop", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_5pysam_7libcbcf_17VariantRecordInfo_38pop, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_5pysam_7libcbcf_17VariantRecordInfo_37pop};
static PyObject *__pyx_pw_5pysam_7libcbcf_17VariantRecordInfo_38pop(PyObject *__pyx_v_self, 
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
) {
  PyObject *__pyx_v_key = 0;
  PyObject *__pyx_v_default = 0;
  #if !CYTHON_METH_FASTCALL
  CYTHON_UNUSED Py_ssize_t __pyx_nargs;
  #endif
  CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
  PyObject* values[2] = {0,0};
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("pop (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,&__pyx_mstate_global->__pyx_n_u_default,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, 2803, __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, 2803, __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, 2803, __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, "pop", 0) < 0) __PYX_ERR(0, 2803, __pyx_L3_error)
      if (!values[1]) values[1] = __Pyx_NewRef(__pyx_mstate_global->__pyx_k__6);
      for (Py_ssize_t i = __pyx_nargs; i < 1; i++) {
        if (unlikely(!values[i])) { __Pyx_RaiseArgtupleInvalid("pop", 0, 1, 2, i); __PYX_ERR(0, 2803, __pyx_L3_error) }
      }
    } 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, 2803, __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, 2803, __pyx_L3_error)
        break;
        default: goto __pyx_L5_argtuple_error;
      }
      if (!values[1]) values[1] = __Pyx_NewRef(__pyx_mstate_global->__pyx_k__6);
    }
    __pyx_v_key = values[0];
    __pyx_v_default = values[1];
  }
  goto __pyx_L6_skip;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("pop", 0, 1, 2, __pyx_nargs); __PYX_ERR(0, 2803, __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("pysam.libcbcf.VariantRecordInfo.pop", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_5pysam_7libcbcf_17VariantRecordInfo_37pop(((struct __pyx_obj_5pysam_7libcbcf_VariantRecordInfo *)__pyx_v_self), __pyx_v_key, __pyx_v_default);

  /* 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_5pysam_7libcbcf_17VariantRecordInfo_37pop(struct __pyx_obj_5pysam_7libcbcf_VariantRecordInfo *__pyx_v_self, PyObject *__pyx_v_key, PyObject *__pyx_v_default) {
  bcf_hdr_t *__pyx_v_hdr;
  bcf1_t *__pyx_v_r;
  PyObject *__pyx_v_bkey = 0;
  bcf_info_t *__pyx_v_info;
  int __pyx_v_info_id;
  PyObject *__pyx_v_value = NULL;
  PyObject *__pyx_r = NULL;
  __Pyx_TraceDeclarationsFunc
  __Pyx_RefNannyDeclarations
  bcf_hdr_t *__pyx_t_1;
  bcf1_t *__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;
  char const *__pyx_t_8;
  int __pyx_t_9;
  int __pyx_t_10;
  PyObject *__pyx_t_11 = NULL;
  PyObject *__pyx_t_12 = NULL;
  int __pyx_t_13;
  char const *__pyx_t_14;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_TraceFrameInit(((PyObject *)__pyx_mstate_global->__pyx_codeobj_tab[222]))
  __Pyx_RefNannySetupContext("pop", 0);
  __Pyx_TraceStartFunc("pop", __pyx_f[0], 2803, 0, 0, 0, __PYX_ERR(0, 2803, __pyx_L1_error));

  /* "pysam/libcbcf.pyx":2804
 * 
 *     def pop(self, key, default=_nothing):
 *         cdef bcf_hdr_t *hdr = self.record.header.ptr             # <<<<<<<<<<<<<<
 *         cdef bcf1_t *r = self.record.ptr
 * 
*/
  __pyx_t_1 = __pyx_v_self->record->header->ptr;
  __pyx_v_hdr = __pyx_t_1;

  /* "pysam/libcbcf.pyx":2805
 *     def pop(self, key, default=_nothing):
 *         cdef bcf_hdr_t *hdr = self.record.header.ptr
 *         cdef bcf1_t *r = self.record.ptr             # <<<<<<<<<<<<<<
 * 
 *         if bcf_unpack(r, BCF_UN_INFO) < 0:
*/
  __pyx_t_2 = __pyx_v_self->record->ptr;
  __pyx_v_r = __pyx_t_2;

  /* "pysam/libcbcf.pyx":2807
 *         cdef bcf1_t *r = self.record.ptr
 * 
 *         if bcf_unpack(r, BCF_UN_INFO) < 0:             # <<<<<<<<<<<<<<
 *             raise ValueError('Error unpacking VariantRecord')
 * 
*/
  __pyx_t_3 = (bcf_unpack(__pyx_v_r, BCF_UN_INFO) < 0);
  if (unlikely(__pyx_t_3)) {

    /* "pysam/libcbcf.pyx":2808
 * 
 *         if bcf_unpack(r, BCF_UN_INFO) < 0:
 *             raise ValueError('Error unpacking VariantRecord')             # <<<<<<<<<<<<<<
 * 
 *         cdef bytes bkey = force_bytes(key)
*/
    __pyx_t_5 = NULL;
    __Pyx_INCREF(__pyx_builtin_ValueError);
    __pyx_t_6 = __pyx_builtin_ValueError; 
    __pyx_t_7 = 1;
    {
      PyObject *__pyx_callargs[2] = {__pyx_t_5, __pyx_mstate_global->__pyx_kp_u_Error_unpacking_VariantRecord};
      __pyx_t_4 = __Pyx_PyObject_FastCall(__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, 2808, __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, 2808, __pyx_L1_error)

    /* "pysam/libcbcf.pyx":2807
 *         cdef bcf1_t *r = self.record.ptr
 * 
 *         if bcf_unpack(r, BCF_UN_INFO) < 0:             # <<<<<<<<<<<<<<
 *             raise ValueError('Error unpacking VariantRecord')
 * 
*/
  }

  /* "pysam/libcbcf.pyx":2810
 *             raise ValueError('Error unpacking VariantRecord')
 * 
 *         cdef bytes bkey = force_bytes(key)             # <<<<<<<<<<<<<<
 *         cdef bcf_info_t *info = bcf_get_info(hdr, r, bkey)
 * 
*/
  __pyx_t_4 = __pyx_f_5pysam_9libcutils_force_bytes(__pyx_v_key, NULL); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 2810, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  __pyx_v_bkey = ((PyObject*)__pyx_t_4);
  __pyx_t_4 = 0;

  /* "pysam/libcbcf.pyx":2811
 * 
 *         cdef bytes bkey = force_bytes(key)
 *         cdef bcf_info_t *info = bcf_get_info(hdr, r, bkey)             # <<<<<<<<<<<<<<
 * 
 *         # Cannot stop here if info == NULL, since flags must return False
*/
  if (unlikely(__pyx_v_bkey == Py_None)) {
    PyErr_SetString(PyExc_TypeError, "expected bytes, NoneType found");
    __PYX_ERR(0, 2811, __pyx_L1_error)
  }
  __pyx_t_8 = __Pyx_PyBytes_AsString(__pyx_v_bkey); if (unlikely((!__pyx_t_8) && PyErr_Occurred())) __PYX_ERR(0, 2811, __pyx_L1_error)
  __pyx_v_info = bcf_get_info(__pyx_v_hdr, __pyx_v_r, __pyx_t_8);

  /* "pysam/libcbcf.pyx":2814
 * 
 *         # Cannot stop here if info == NULL, since flags must return False
 *         cdef int info_id = bcf_header_get_info_id(hdr, bkey) if not info else info.key             # <<<<<<<<<<<<<<
 * 
 *         if info_id < 0:
*/
  __pyx_t_3 = (!(__pyx_v_info != 0));
  if (__pyx_t_3) {
    __pyx_t_10 = __pyx_f_5pysam_7libcbcf_bcf_header_get_info_id(__pyx_v_hdr, __pyx_v_bkey); if (unlikely(__pyx_t_10 == ((int)-2) && PyErr_Occurred())) __PYX_ERR(0, 2814, __pyx_L1_error)
    __pyx_t_9 = __pyx_t_10;
  } else {
    __pyx_t_9 = __pyx_v_info->key;
  }
  __pyx_v_info_id = __pyx_t_9;

  /* "pysam/libcbcf.pyx":2816
 *         cdef int info_id = bcf_header_get_info_id(hdr, bkey) if not info else info.key
 * 
 *         if info_id < 0:             # <<<<<<<<<<<<<<
 *             if default is _nothing:
 *                 raise KeyError('Unknown INFO field: {}'.format(key))
*/
  __pyx_t_3 = (__pyx_v_info_id < 0);
  if (__pyx_t_3) {

    /* "pysam/libcbcf.pyx":2817
 * 
 *         if info_id < 0:
 *             if default is _nothing:             # <<<<<<<<<<<<<<
 *                 raise KeyError('Unknown INFO field: {}'.format(key))
 *             return default
*/
    __pyx_t_3 = (__pyx_v_default == __pyx_v_5pysam_7libcbcf__nothing);
    if (unlikely(__pyx_t_3)) {

      /* "pysam/libcbcf.pyx":2818
 *         if info_id < 0:
 *             if default is _nothing:
 *                 raise KeyError('Unknown INFO field: {}'.format(key))             # <<<<<<<<<<<<<<
 *             return default
 * 
*/
      __pyx_t_6 = NULL;
      __Pyx_INCREF(__pyx_builtin_KeyError);
      __pyx_t_5 = __pyx_builtin_KeyError; 
      __pyx_t_12 = __pyx_mstate_global->__pyx_kp_u_Unknown_INFO_field;
      __Pyx_INCREF(__pyx_t_12);
      __pyx_t_7 = 0;
      {
        PyObject *__pyx_callargs[2] = {__pyx_t_12, __pyx_v_key};
        __pyx_t_11 = __Pyx_PyObject_FastCallMethod(__pyx_mstate_global->__pyx_n_u_format, __pyx_callargs+__pyx_t_7, (2-__pyx_t_7) | (1*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
        __Pyx_XDECREF(__pyx_t_12); __pyx_t_12 = 0;
        if (unlikely(!__pyx_t_11)) __PYX_ERR(0, 2818, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_11);
      }
      __pyx_t_7 = 1;
      {
        PyObject *__pyx_callargs[2] = {__pyx_t_6, __pyx_t_11};
        __pyx_t_4 = __Pyx_PyObject_FastCall(__pyx_t_5, __pyx_callargs+__pyx_t_7, (2-__pyx_t_7) | (__pyx_t_7*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
        __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0;
        __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0;
        __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
        if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 2818, __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, 2818, __pyx_L1_error)

      /* "pysam/libcbcf.pyx":2817
 * 
 *         if info_id < 0:
 *             if default is _nothing:             # <<<<<<<<<<<<<<
 *                 raise KeyError('Unknown INFO field: {}'.format(key))
 *             return default
*/
    }

    /* "pysam/libcbcf.pyx":2819
 *             if default is _nothing:
 *                 raise KeyError('Unknown INFO field: {}'.format(key))
 *             return default             # <<<<<<<<<<<<<<
 * 
 *         if not check_header_id(hdr, BCF_HL_INFO, info_id):
*/
    __Pyx_XDECREF(__pyx_r);
    __Pyx_INCREF(__pyx_v_default);
    __pyx_r = __pyx_v_default;
    __Pyx_TraceReturnValue(__pyx_r, 56, 0, __PYX_ERR(0, 2819, __pyx_L1_error));
    goto __pyx_L0;

    /* "pysam/libcbcf.pyx":2816
 *         cdef int info_id = bcf_header_get_info_id(hdr, bkey) if not info else info.key
 * 
 *         if info_id < 0:             # <<<<<<<<<<<<<<
 *             if default is _nothing:
 *                 raise KeyError('Unknown INFO field: {}'.format(key))
*/
  }

  /* "pysam/libcbcf.pyx":2821
 *             return default
 * 
 *         if not check_header_id(hdr, BCF_HL_INFO, info_id):             # <<<<<<<<<<<<<<
 *             raise ValueError('Invalid header')
 * 
*/
  __pyx_t_3 = __pyx_f_5pysam_7libcbcf_check_header_id(__pyx_v_hdr, BCF_HL_INFO, __pyx_v_info_id); if (unlikely(__pyx_t_3 == ((int)-1) && PyErr_Occurred())) __PYX_ERR(0, 2821, __pyx_L1_error)
  __pyx_t_13 = (!__pyx_t_3);
  if (unlikely(__pyx_t_13)) {

    /* "pysam/libcbcf.pyx":2822
 * 
 *         if not check_header_id(hdr, BCF_HL_INFO, info_id):
 *             raise ValueError('Invalid header')             # <<<<<<<<<<<<<<
 * 
 *         # Handle flags
*/
    __pyx_t_5 = NULL;
    __Pyx_INCREF(__pyx_builtin_ValueError);
    __pyx_t_11 = __pyx_builtin_ValueError; 
    __pyx_t_7 = 1;
    {
      PyObject *__pyx_callargs[2] = {__pyx_t_5, __pyx_mstate_global->__pyx_kp_u_Invalid_header};
      __pyx_t_4 = __Pyx_PyObject_FastCall(__pyx_t_11, __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_11); __pyx_t_11 = 0;
      if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 2822, __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, 2822, __pyx_L1_error)

    /* "pysam/libcbcf.pyx":2821
 *             return default
 * 
 *         if not check_header_id(hdr, BCF_HL_INFO, info_id):             # <<<<<<<<<<<<<<
 *             raise ValueError('Invalid header')
 * 
*/
  }

  /* "pysam/libcbcf.pyx":2825
 * 
 *         # Handle flags
 *         if bcf_hdr_id2type(hdr, BCF_HL_INFO, info_id) == BCF_HT_FLAG and (not info or not info.vptr):             # <<<<<<<<<<<<<<
 *             return
 * 
*/
  __pyx_t_3 = (bcf_hdr_id2type(__pyx_v_hdr, BCF_HL_INFO, __pyx_v_info_id) == BCF_HT_FLAG);
  if (__pyx_t_3) {
  } else {
    __pyx_t_13 = __pyx_t_3;
    goto __pyx_L8_bool_binop_done;
  }
  __pyx_t_3 = (!(__pyx_v_info != 0));
  if (!__pyx_t_3) {
  } else {
    __pyx_t_13 = __pyx_t_3;
    goto __pyx_L8_bool_binop_done;
  }
  __pyx_t_3 = (!(__pyx_v_info->vptr != 0));
  __pyx_t_13 = __pyx_t_3;
  __pyx_L8_bool_binop_done:;
  if (__pyx_t_13) {

    /* "pysam/libcbcf.pyx":2826
 *         # Handle flags
 *         if bcf_hdr_id2type(hdr, BCF_HL_INFO, info_id) == BCF_HT_FLAG and (not info or not info.vptr):
 *             return             # <<<<<<<<<<<<<<
 * 
 *         if not info or not info.vptr:
*/
    __Pyx_XDECREF(__pyx_r);
    __pyx_r = Py_None; __Pyx_INCREF(Py_None);
    goto __pyx_L0;

    /* "pysam/libcbcf.pyx":2825
 * 
 *         # Handle flags
 *         if bcf_hdr_id2type(hdr, BCF_HL_INFO, info_id) == BCF_HT_FLAG and (not info or not info.vptr):             # <<<<<<<<<<<<<<
 *             return
 * 
*/
  }

  /* "pysam/libcbcf.pyx":2828
 *             return
 * 
 *         if not info or not info.vptr:             # <<<<<<<<<<<<<<
 *             if default is _nothing:
 *                 raise KeyError('Unknown INFO field: {}'.format(key))
*/
  __pyx_t_3 = (!(__pyx_v_info != 0));
  if (!__pyx_t_3) {
  } else {
    __pyx_t_13 = __pyx_t_3;
    goto __pyx_L12_bool_binop_done;
  }
  __pyx_t_3 = (!(__pyx_v_info->vptr != 0));
  __pyx_t_13 = __pyx_t_3;
  __pyx_L12_bool_binop_done:;
  if (__pyx_t_13) {

    /* "pysam/libcbcf.pyx":2829
 * 
 *         if not info or not info.vptr:
 *             if default is _nothing:             # <<<<<<<<<<<<<<
 *                 raise KeyError('Unknown INFO field: {}'.format(key))
 *             return default
*/
    __pyx_t_13 = (__pyx_v_default == __pyx_v_5pysam_7libcbcf__nothing);
    if (unlikely(__pyx_t_13)) {

      /* "pysam/libcbcf.pyx":2830
 *         if not info or not info.vptr:
 *             if default is _nothing:
 *                 raise KeyError('Unknown INFO field: {}'.format(key))             # <<<<<<<<<<<<<<
 *             return default
 * 
*/
      __pyx_t_11 = NULL;
      __Pyx_INCREF(__pyx_builtin_KeyError);
      __pyx_t_5 = __pyx_builtin_KeyError; 
      __pyx_t_12 = __pyx_mstate_global->__pyx_kp_u_Unknown_INFO_field;
      __Pyx_INCREF(__pyx_t_12);
      __pyx_t_7 = 0;
      {
        PyObject *__pyx_callargs[2] = {__pyx_t_12, __pyx_v_key};
        __pyx_t_6 = __Pyx_PyObject_FastCallMethod(__pyx_mstate_global->__pyx_n_u_format, __pyx_callargs+__pyx_t_7, (2-__pyx_t_7) | (1*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
        __Pyx_XDECREF(__pyx_t_12); __pyx_t_12 = 0;
        if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 2830, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_6);
      }
      __pyx_t_7 = 1;
      {
        PyObject *__pyx_callargs[2] = {__pyx_t_11, __pyx_t_6};
        __pyx_t_4 = __Pyx_PyObject_FastCall(__pyx_t_5, __pyx_callargs+__pyx_t_7, (2-__pyx_t_7) | (__pyx_t_7*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
        __Pyx_XDECREF(__pyx_t_11); __pyx_t_11 = 0;
        __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
        __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
        if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 2830, __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, 2830, __pyx_L1_error)

      /* "pysam/libcbcf.pyx":2829
 * 
 *         if not info or not info.vptr:
 *             if default is _nothing:             # <<<<<<<<<<<<<<
 *                 raise KeyError('Unknown INFO field: {}'.format(key))
 *             return default
*/
    }

    /* "pysam/libcbcf.pyx":2831
 *             if default is _nothing:
 *                 raise KeyError('Unknown INFO field: {}'.format(key))
 *             return default             # <<<<<<<<<<<<<<
 * 
 *         value = bcf_info_get_value(self.record, info)
*/
    __Pyx_XDECREF(__pyx_r);
    __Pyx_INCREF(__pyx_v_default);
    __pyx_r = __pyx_v_default;
    __Pyx_TraceReturnValue(__pyx_r, 103, 0, __PYX_ERR(0, 2831, __pyx_L1_error));
    goto __pyx_L0;

    /* "pysam/libcbcf.pyx":2828
 *             return
 * 
 *         if not info or not info.vptr:             # <<<<<<<<<<<<<<
 *             if default is _nothing:
 *                 raise KeyError('Unknown INFO field: {}'.format(key))
*/
  }

  /* "pysam/libcbcf.pyx":2833
 *             return default
 * 
 *         value = bcf_info_get_value(self.record, info)             # <<<<<<<<<<<<<<
 * 
 *         if bcf_update_info(hdr, r, bkey, NULL, 0, info.type) < 0:
*/
  __pyx_t_4 = ((PyObject *)__pyx_v_self->record);
  __Pyx_INCREF(__pyx_t_4);
  __pyx_t_5 = __pyx_f_5pysam_7libcbcf_bcf_info_get_value(((struct __pyx_obj_5pysam_7libcbcf_VariantRecord *)__pyx_t_4), __pyx_v_info); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 2833, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_5);
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  __pyx_v_value = __pyx_t_5;
  __pyx_t_5 = 0;

  /* "pysam/libcbcf.pyx":2835
 *         value = bcf_info_get_value(self.record, info)
 * 
 *         if bcf_update_info(hdr, r, bkey, NULL, 0, info.type) < 0:             # <<<<<<<<<<<<<<
 *             raise ValueError('Unable to delete INFO')
 * 
*/
  if (unlikely(__pyx_v_bkey == Py_None)) {
    PyErr_SetString(PyExc_TypeError, "expected bytes, NoneType found");
    __PYX_ERR(0, 2835, __pyx_L1_error)
  }
  __pyx_t_14 = __Pyx_PyBytes_AsString(__pyx_v_bkey); if (unlikely((!__pyx_t_14) && PyErr_Occurred())) __PYX_ERR(0, 2835, __pyx_L1_error)
  __pyx_t_13 = (bcf_update_info(__pyx_v_hdr, __pyx_v_r, __pyx_t_14, NULL, 0, __pyx_v_info->type) < 0);
  if (unlikely(__pyx_t_13)) {

    /* "pysam/libcbcf.pyx":2836
 * 
 *         if bcf_update_info(hdr, r, bkey, NULL, 0, info.type) < 0:
 *             raise ValueError('Unable to delete INFO')             # <<<<<<<<<<<<<<
 * 
 *         return value
*/
    __pyx_t_4 = NULL;
    __Pyx_INCREF(__pyx_builtin_ValueError);
    __pyx_t_6 = __pyx_builtin_ValueError; 
    __pyx_t_7 = 1;
    {
      PyObject *__pyx_callargs[2] = {__pyx_t_4, __pyx_mstate_global->__pyx_kp_u_Unable_to_delete_INFO};
      __pyx_t_5 = __Pyx_PyObject_FastCall(__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, 2836, __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, 2836, __pyx_L1_error)

    /* "pysam/libcbcf.pyx":2835
 *         value = bcf_info_get_value(self.record, info)
 * 
 *         if bcf_update_info(hdr, r, bkey, NULL, 0, info.type) < 0:             # <<<<<<<<<<<<<<
 *             raise ValueError('Unable to delete INFO')
 * 
*/
  }

  /* "pysam/libcbcf.pyx":2838
 *             raise ValueError('Unable to delete INFO')
 * 
 *         return value             # <<<<<<<<<<<<<<
 * 
 *     def __richcmp__(VariantRecordInfo self not None, VariantRecordInfo other not None, int op):
*/
  __Pyx_XDECREF(__pyx_r);
  __Pyx_INCREF(__pyx_v_value);
  __pyx_r = __pyx_v_value;
  __Pyx_TraceReturnValue(__pyx_r, 127, 0, __PYX_ERR(0, 2838, __pyx_L1_error));
  goto __pyx_L0;

  /* "pysam/libcbcf.pyx":2803
 *                 self[k] = v
 * 
 *     def pop(self, key, default=_nothing):             # <<<<<<<<<<<<<<
 *         cdef bcf_hdr_t *hdr = self.record.header.ptr
 *         cdef bcf1_t *r = self.record.ptr
*/

  /* 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_11);
  __Pyx_XDECREF(__pyx_t_12);
  __Pyx_TraceException(__pyx_lineno, 0, 0);
  #if CYTHON_USE_SYS_MONITORING
  __Pyx_TraceExceptionUnwind(0, 0);
  #else
  __Pyx_TraceReturnValue(NULL, 0, 0, __PYX_ERR(0, 2803, __pyx_L1_error));
  #endif
  __Pyx_AddTraceback("pysam.libcbcf.VariantRecordInfo.pop", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_bkey);
  __Pyx_XDECREF(__pyx_v_value);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_PyMonitoring_ExitScope(0);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "pysam/libcbcf.pyx":2840
 *         return value
 * 
 *     def __richcmp__(VariantRecordInfo self not None, VariantRecordInfo other not None, int op):             # <<<<<<<<<<<<<<
 *         if op != 2 and op != 3:
 *             return NotImplemented
*/

/* Python wrapper */
static PyObject *__pyx_pw_5pysam_7libcbcf_17VariantRecordInfo_40__richcmp__(PyObject *__pyx_v_self, PyObject *__pyx_v_other, int __pyx_v_op); /*proto*/
static PyObject *__pyx_pw_5pysam_7libcbcf_17VariantRecordInfo_40__richcmp__(PyObject *__pyx_v_self, PyObject *__pyx_v_other, int __pyx_v_op) {
  CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__richcmp__ (wrapper)", 0);
  __pyx_kwvalues = __Pyx_KwValues_VARARGS(__pyx_args, __pyx_nargs);
  if (unlikely(((PyObject *)__pyx_v_self) == Py_None)) {
    PyErr_Format(PyExc_TypeError, "Argument '%.200s' must not be None", "self"); __PYX_ERR(0, 2840, __pyx_L1_error)
  }
  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_other), __pyx_mstate_global->__pyx_ptype_5pysam_7libcbcf_VariantRecordInfo, 0, "other", 0))) __PYX_ERR(0, 2840, __pyx_L1_error)
  __pyx_r = __pyx_pf_5pysam_7libcbcf_17VariantRecordInfo_39__richcmp__(((struct __pyx_obj_5pysam_7libcbcf_VariantRecordInfo *)__pyx_v_self), ((struct __pyx_obj_5pysam_7libcbcf_VariantRecordInfo *)__pyx_v_other), ((int)__pyx_v_op));

  /* function exit code */
  goto __pyx_L0;
  __pyx_L1_error:;
  __pyx_r = NULL;
  goto __pyx_L5_cleaned_up;
  __pyx_L0:;
  __pyx_L5_cleaned_up:;
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_5pysam_7libcbcf_17VariantRecordInfo_39__richcmp__(struct __pyx_obj_5pysam_7libcbcf_VariantRecordInfo *__pyx_v_self, struct __pyx_obj_5pysam_7libcbcf_VariantRecordInfo *__pyx_v_other, int __pyx_v_op) {
  CYTHON_UNUSED bcf1_t *__pyx_v_s;
  CYTHON_UNUSED bcf1_t *__pyx_v_o;
  int __pyx_v_cmp;
  PyObject *__pyx_r = NULL;
  __Pyx_TraceDeclarationsFunc
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  bcf1_t *__pyx_t_2;
  PyObject *__pyx_t_3 = NULL;
  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_TraceFrameInit(((PyObject *)__pyx_mstate_global->__pyx_codeobj_tab[223]))
  __Pyx_RefNannySetupContext("__richcmp__", 0);
  __Pyx_TraceStartFunc("__richcmp__", __pyx_f[0], 2840, 0, 0, 0, __PYX_ERR(0, 2840, __pyx_L1_error));

  /* "pysam/libcbcf.pyx":2841
 * 
 *     def __richcmp__(VariantRecordInfo self not None, VariantRecordInfo other not None, int op):
 *         if op != 2 and op != 3:             # <<<<<<<<<<<<<<
 *             return NotImplemented
 * 
*/
  switch (__pyx_v_op) {
    case 2:
    case 3:
    __pyx_t_1 = 0;
    break;
    default:
    __pyx_t_1 = 1;
    break;
  }
  if (__pyx_t_1) {

    /* "pysam/libcbcf.pyx":2842
 *     def __richcmp__(VariantRecordInfo self not None, VariantRecordInfo other not None, int op):
 *         if op != 2 and op != 3:
 *             return NotImplemented             # <<<<<<<<<<<<<<
 * 
 *         cdef bcf1_t *s = self.record.ptr
*/
    __Pyx_XDECREF(__pyx_r);
    __Pyx_INCREF(__pyx_builtin_NotImplemented);
    __pyx_r = __pyx_builtin_NotImplemented;
    __Pyx_TraceReturnValue(__pyx_r, 9, 0, __PYX_ERR(0, 2842, __pyx_L1_error));
    goto __pyx_L0;

    /* "pysam/libcbcf.pyx":2841
 * 
 *     def __richcmp__(VariantRecordInfo self not None, VariantRecordInfo other not None, int op):
 *         if op != 2 and op != 3:             # <<<<<<<<<<<<<<
 *             return NotImplemented
 * 
*/
  }

  /* "pysam/libcbcf.pyx":2844
 *             return NotImplemented
 * 
 *         cdef bcf1_t *s = self.record.ptr             # <<<<<<<<<<<<<<
 *         cdef bcf1_t *o = other.record.ptr
 * 
*/
  __pyx_t_2 = __pyx_v_self->record->ptr;
  __pyx_v_s = __pyx_t_2;

  /* "pysam/libcbcf.pyx":2845
 * 
 *         cdef bcf1_t *s = self.record.ptr
 *         cdef bcf1_t *o = other.record.ptr             # <<<<<<<<<<<<<<
 * 
 *         # Cannot use n_info as shortcut logic, since null values may remain
*/
  __pyx_t_2 = __pyx_v_other->record->ptr;
  __pyx_v_o = __pyx_t_2;

  /* "pysam/libcbcf.pyx":2848
 * 
 *         # Cannot use n_info as shortcut logic, since null values may remain
 *         cdef bint cmp = dict(self) == dict(other)             # <<<<<<<<<<<<<<
 * 
 *         if op == 3:
*/
  __pyx_t_4 = NULL;
  __Pyx_INCREF((PyObject *)(&PyDict_Type));
  __pyx_t_5 = ((PyObject *)(&PyDict_Type)); 
  __pyx_t_6 = 1;
  {
    PyObject *__pyx_callargs[2] = {__pyx_t_4, ((PyObject *)__pyx_v_self)};
    __pyx_t_3 = __Pyx_PyObject_FastCall(__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, 2848, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
  }
  __pyx_t_4 = NULL;
  __Pyx_INCREF((PyObject *)(&PyDict_Type));
  __pyx_t_7 = ((PyObject *)(&PyDict_Type)); 
  __pyx_t_6 = 1;
  {
    PyObject *__pyx_callargs[2] = {__pyx_t_4, ((PyObject *)__pyx_v_other)};
    __pyx_t_5 = __Pyx_PyObject_FastCall(__pyx_t_7, __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_7); __pyx_t_7 = 0;
    if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 2848, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_5);
  }
  __pyx_t_7 = PyObject_RichCompare(__pyx_t_3, __pyx_t_5, Py_EQ); __Pyx_XGOTREF(__pyx_t_7); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 2848, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  __pyx_t_1 = __Pyx_PyObject_IsTrue(__pyx_t_7); if (unlikely((__pyx_t_1 == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 2848, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
  __pyx_v_cmp = __pyx_t_1;

  /* "pysam/libcbcf.pyx":2850
 *         cdef bint cmp = dict(self) == dict(other)
 * 
 *         if op == 3:             # <<<<<<<<<<<<<<
 *             cmp = not cmp
 * 
*/
  __pyx_t_1 = (__pyx_v_op == 3);
  if (__pyx_t_1) {

    /* "pysam/libcbcf.pyx":2851
 * 
 *         if op == 3:
 *             cmp = not cmp             # <<<<<<<<<<<<<<
 * 
 *         return cmp
*/
    __pyx_v_cmp = (!__pyx_v_cmp);

    /* "pysam/libcbcf.pyx":2850
 *         cdef bint cmp = dict(self) == dict(other)
 * 
 *         if op == 3:             # <<<<<<<<<<<<<<
 *             cmp = not cmp
 * 
*/
  }

  /* "pysam/libcbcf.pyx":2853
 *             cmp = not cmp
 * 
 *         return cmp             # <<<<<<<<<<<<<<
 * 
 *     # Mappings are not hashable by default, but subclasses can change this
*/
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_7 = __Pyx_PyBool_FromLong(__pyx_v_cmp); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 2853, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_7);
  __pyx_r = __pyx_t_7;
  __pyx_t_7 = 0;
  __Pyx_TraceReturnValue(__pyx_r, 34, 0, __PYX_ERR(0, 2853, __pyx_L1_error));
  goto __pyx_L0;

  /* "pysam/libcbcf.pyx":2840
 *         return value
 * 
 *     def __richcmp__(VariantRecordInfo self not None, VariantRecordInfo other not None, int op):             # <<<<<<<<<<<<<<
 *         if op != 2 and op != 3:
 *             return NotImplemented
*/

  /* 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_7);
  __Pyx_TraceException(__pyx_lineno, 0, 0);
  #if CYTHON_USE_SYS_MONITORING
  __Pyx_TraceExceptionUnwind(0, 0);
  #else
  __Pyx_TraceReturnValue(NULL, 0, 0, __PYX_ERR(0, 2840, __pyx_L1_error));
  #endif
  __Pyx_AddTraceback("pysam.libcbcf.VariantRecordInfo.__richcmp__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_PyMonitoring_ExitScope(0);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

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

/* Python wrapper */
static PyObject *__pyx_pw_5pysam_7libcbcf_17VariantRecordInfo_42__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*/
PyDoc_STRVAR(__pyx_doc_5pysam_7libcbcf_17VariantRecordInfo_41__reduce_cython__, "VariantRecordInfo.__reduce_cython__(self)");
static PyMethodDef __pyx_mdef_5pysam_7libcbcf_17VariantRecordInfo_42__reduce_cython__ = {"__reduce_cython__", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_5pysam_7libcbcf_17VariantRecordInfo_42__reduce_cython__, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_5pysam_7libcbcf_17VariantRecordInfo_41__reduce_cython__};
static PyObject *__pyx_pw_5pysam_7libcbcf_17VariantRecordInfo_42__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_5pysam_7libcbcf_17VariantRecordInfo_41__reduce_cython__(((struct __pyx_obj_5pysam_7libcbcf_VariantRecordInfo *)__pyx_v_self));

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

static PyObject *__pyx_pf_5pysam_7libcbcf_17VariantRecordInfo_41__reduce_cython__(struct __pyx_obj_5pysam_7libcbcf_VariantRecordInfo *__pyx_v_self) {
  PyObject *__pyx_v_state = 0;
  PyObject *__pyx_v__dict = 0;
  int __pyx_v_use_setstate;
  PyObject *__pyx_r = NULL;
  __Pyx_TraceDeclarationsFunc
  __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_TraceFrameInit(((PyObject *)__pyx_mstate_global->__pyx_codeobj_tab[224]))
  __Pyx_RefNannySetupContext("__reduce_cython__", 0);
  __Pyx_TraceStartFunc("__reduce_cython__", __pyx_f[4], 1, 0, 0, 0, __PYX_ERR(4, 1, __pyx_L1_error));

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

  /* "(tree fragment)":6
 *     cdef bint use_setstate
 *     state = (self.record,)
 *     _dict = getattr(self, '__dict__', None)             # <<<<<<<<<<<<<<
 *     if _dict is not None:
 *         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(4, 6, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_v__dict = __pyx_t_1;
  __pyx_t_1 = 0;

  /* "(tree fragment)":7
 *     state = (self.record,)
 *     _dict = getattr(self, '__dict__', None)
 *     if _dict is not None:             # <<<<<<<<<<<<<<
 *         state += (_dict,)
 *         use_setstate = True
*/
  __pyx_t_2 = (__pyx_v__dict != Py_None);
  if (__pyx_t_2) {

    /* "(tree fragment)":8
 *     _dict = getattr(self, '__dict__', None)
 *     if _dict is not None:
 *         state += (_dict,)             # <<<<<<<<<<<<<<
 *         use_setstate = True
 *     else:
*/
    __pyx_t_1 = PyTuple_New(1); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 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(4, 8, __pyx_L1_error);
    __pyx_t_3 = PyNumber_InPlaceAdd(__pyx_v_state, __pyx_t_1); if (unlikely(!__pyx_t_3)) __PYX_ERR(4, 8, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    __Pyx_DECREF_SET(__pyx_v_state, ((PyObject*)__pyx_t_3));
    __pyx_t_3 = 0;

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

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

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

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

    /* "(tree fragment)":13
 *         use_setstate = self.record is not None
 *     if use_setstate:
 *         return __pyx_unpickle_VariantRecordInfo, (type(self), 0x70ce871, None), state             # <<<<<<<<<<<<<<
 *     else:
 *         return __pyx_unpickle_VariantRecordInfo, (type(self), 0x70ce871, state)
*/
    __Pyx_XDECREF(__pyx_r);
    __Pyx_GetModuleGlobalName(__pyx_t_3, __pyx_mstate_global->__pyx_n_u_pyx_unpickle_VariantRecordInfo); if (unlikely(!__pyx_t_3)) __PYX_ERR(4, 13, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __pyx_t_1 = PyTuple_New(3); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 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(4, 13, __pyx_L1_error);
    __Pyx_INCREF(__pyx_mstate_global->__pyx_int_118286449);
    __Pyx_GIVEREF(__pyx_mstate_global->__pyx_int_118286449);
    if (__Pyx_PyTuple_SET_ITEM(__pyx_t_1, 1, __pyx_mstate_global->__pyx_int_118286449) != (0)) __PYX_ERR(4, 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(4, 13, __pyx_L1_error);
    __pyx_t_4 = PyTuple_New(3); if (unlikely(!__pyx_t_4)) __PYX_ERR(4, 13, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
    __Pyx_GIVEREF(__pyx_t_3);
    if (__Pyx_PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_t_3) != (0)) __PYX_ERR(4, 13, __pyx_L1_error);
    __Pyx_GIVEREF(__pyx_t_1);
    if (__Pyx_PyTuple_SET_ITEM(__pyx_t_4, 1, __pyx_t_1) != (0)) __PYX_ERR(4, 13, __pyx_L1_error);
    __Pyx_INCREF(__pyx_v_state);
    __Pyx_GIVEREF(__pyx_v_state);
    if (__Pyx_PyTuple_SET_ITEM(__pyx_t_4, 2, __pyx_v_state) != (0)) __PYX_ERR(4, 13, __pyx_L1_error);
    __pyx_t_3 = 0;
    __pyx_t_1 = 0;
    __pyx_r = __pyx_t_4;
    __pyx_t_4 = 0;
    __Pyx_TraceReturnValue(__pyx_r, 25, 0, __PYX_ERR(4, 13, __pyx_L1_error));
    goto __pyx_L0;

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

  /* "(tree fragment)":15
 *         return __pyx_unpickle_VariantRecordInfo, (type(self), 0x70ce871, None), state
 *     else:
 *         return __pyx_unpickle_VariantRecordInfo, (type(self), 0x70ce871, state)             # <<<<<<<<<<<<<<
 * def __setstate_cython__(self, __pyx_state):
 *     __pyx_unpickle_VariantRecordInfo__set_state(self, __pyx_state)
*/
  /*else*/ {
    __Pyx_XDECREF(__pyx_r);
    __Pyx_GetModuleGlobalName(__pyx_t_4, __pyx_mstate_global->__pyx_n_u_pyx_unpickle_VariantRecordInfo); if (unlikely(!__pyx_t_4)) __PYX_ERR(4, 15, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
    __pyx_t_1 = PyTuple_New(3); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 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(4, 15, __pyx_L1_error);
    __Pyx_INCREF(__pyx_mstate_global->__pyx_int_118286449);
    __Pyx_GIVEREF(__pyx_mstate_global->__pyx_int_118286449);
    if (__Pyx_PyTuple_SET_ITEM(__pyx_t_1, 1, __pyx_mstate_global->__pyx_int_118286449) != (0)) __PYX_ERR(4, 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(4, 15, __pyx_L1_error);
    __pyx_t_3 = PyTuple_New(2); if (unlikely(!__pyx_t_3)) __PYX_ERR(4, 15, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __Pyx_GIVEREF(__pyx_t_4);
    if (__Pyx_PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_t_4) != (0)) __PYX_ERR(4, 15, __pyx_L1_error);
    __Pyx_GIVEREF(__pyx_t_1);
    if (__Pyx_PyTuple_SET_ITEM(__pyx_t_3, 1, __pyx_t_1) != (0)) __PYX_ERR(4, 15, __pyx_L1_error);
    __pyx_t_4 = 0;
    __pyx_t_1 = 0;
    __pyx_r = __pyx_t_3;
    __pyx_t_3 = 0;
    __Pyx_TraceReturnValue(__pyx_r, 33, 0, __PYX_ERR(4, 15, __pyx_L1_error));
    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_3);
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_TraceException(__pyx_lineno, 0, 0);
  #if CYTHON_USE_SYS_MONITORING
  __Pyx_TraceExceptionUnwind(0, 0);
  #else
  __Pyx_TraceReturnValue(NULL, 0, 0, __PYX_ERR(4, 1, __pyx_L1_error));
  #endif
  __Pyx_AddTraceback("pysam.libcbcf.VariantRecordInfo.__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_PyMonitoring_ExitScope(0);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "(tree fragment)":16
 *     else:
 *         return __pyx_unpickle_VariantRecordInfo, (type(self), 0x70ce871, state)
 * def __setstate_cython__(self, __pyx_state):             # <<<<<<<<<<<<<<
 *     __pyx_unpickle_VariantRecordInfo__set_state(self, __pyx_state)
*/

/* Python wrapper */
static PyObject *__pyx_pw_5pysam_7libcbcf_17VariantRecordInfo_44__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*/
PyDoc_STRVAR(__pyx_doc_5pysam_7libcbcf_17VariantRecordInfo_43__setstate_cython__, "VariantRecordInfo.__setstate_cython__(self, __pyx_state)");
static PyMethodDef __pyx_mdef_5pysam_7libcbcf_17VariantRecordInfo_44__setstate_cython__ = {"__setstate_cython__", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_5pysam_7libcbcf_17VariantRecordInfo_44__setstate_cython__, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_5pysam_7libcbcf_17VariantRecordInfo_43__setstate_cython__};
static PyObject *__pyx_pw_5pysam_7libcbcf_17VariantRecordInfo_44__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(4, 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(4, 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(4, 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(4, 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(4, 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(4, 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("pysam.libcbcf.VariantRecordInfo.__setstate_cython__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_5pysam_7libcbcf_17VariantRecordInfo_43__setstate_cython__(((struct __pyx_obj_5pysam_7libcbcf_VariantRecordInfo *)__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_5pysam_7libcbcf_17VariantRecordInfo_43__setstate_cython__(struct __pyx_obj_5pysam_7libcbcf_VariantRecordInfo *__pyx_v_self, PyObject *__pyx_v___pyx_state) {
  PyObject *__pyx_r = NULL;
  __Pyx_TraceDeclarationsFunc
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_TraceFrameInit(((PyObject *)__pyx_mstate_global->__pyx_codeobj_tab[225]))
  __Pyx_RefNannySetupContext("__setstate_cython__", 0);
  __Pyx_TraceStartFunc("__setstate_cython__", __pyx_f[4], 16, 0, 0, 0, __PYX_ERR(4, 16, __pyx_L1_error));

  /* "(tree fragment)":17
 *         return __pyx_unpickle_VariantRecordInfo, (type(self), 0x70ce871, state)
 * def __setstate_cython__(self, __pyx_state):
 *     __pyx_unpickle_VariantRecordInfo__set_state(self, __pyx_state)             # <<<<<<<<<<<<<<
*/
  if (!(likely(PyTuple_CheckExact(__pyx_v___pyx_state))||((__pyx_v___pyx_state) == Py_None) || __Pyx_RaiseUnexpectedTypeError("tuple", __pyx_v___pyx_state))) __PYX_ERR(4, 17, __pyx_L1_error)
  __pyx_t_1 = __pyx_f_5pysam_7libcbcf___pyx_unpickle_VariantRecordInfo__set_state(__pyx_v_self, ((PyObject*)__pyx_v___pyx_state)); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 17, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "(tree fragment)":16
 *     else:
 *         return __pyx_unpickle_VariantRecordInfo, (type(self), 0x70ce871, state)
 * def __setstate_cython__(self, __pyx_state):             # <<<<<<<<<<<<<<
 *     __pyx_unpickle_VariantRecordInfo__set_state(self, __pyx_state)
*/

  /* function exit code */
  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  __Pyx_TraceReturnValue(__pyx_r, 0, 0, __PYX_ERR(4, 16, __pyx_L1_error));
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_TraceException(__pyx_lineno, 0, 0);
  #if CYTHON_USE_SYS_MONITORING
  __Pyx_TraceExceptionUnwind(0, 0);
  #else
  __Pyx_TraceReturnValue(NULL, 0, 0, __PYX_ERR(4, 16, __pyx_L1_error));
  #endif
  __Pyx_AddTraceback("pysam.libcbcf.VariantRecordInfo.__setstate_cython__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_PyMonitoring_ExitScope(0);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "pysam/libcbcf.pyx":2859
 * 
 * 
 * cdef VariantRecordInfo makeVariantRecordInfo(VariantRecord record):             # <<<<<<<<<<<<<<
 *     if not record:
 *         raise ValueError('invalid VariantRecord')
*/

static struct __pyx_obj_5pysam_7libcbcf_VariantRecordInfo *__pyx_f_5pysam_7libcbcf_makeVariantRecordInfo(struct __pyx_obj_5pysam_7libcbcf_VariantRecord *__pyx_v_record) {
  struct __pyx_obj_5pysam_7libcbcf_VariantRecordInfo *__pyx_v_info = 0;
  struct __pyx_obj_5pysam_7libcbcf_VariantRecordInfo *__pyx_r = NULL;
  __Pyx_TraceDeclarationsFunc
  __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_TraceFrameInit(((PyObject *)__pyx_mstate_global->__pyx_codeobj_tab[226]))
  __Pyx_RefNannySetupContext("makeVariantRecordInfo", 0);
  __Pyx_TraceStartFunc("makeVariantRecordInfo", __pyx_f[0], 2859, 0, 0, 0, __PYX_ERR(0, 2859, __pyx_L1_error));

  /* "pysam/libcbcf.pyx":2860
 * 
 * cdef VariantRecordInfo makeVariantRecordInfo(VariantRecord record):
 *     if not record:             # <<<<<<<<<<<<<<
 *         raise ValueError('invalid VariantRecord')
 * 
*/
  __pyx_t_1 = __Pyx_PyObject_IsTrue(((PyObject *)__pyx_v_record)); if (unlikely((__pyx_t_1 < 0))) __PYX_ERR(0, 2860, __pyx_L1_error)
  __pyx_t_2 = (!__pyx_t_1);
  if (unlikely(__pyx_t_2)) {

    /* "pysam/libcbcf.pyx":2861
 * cdef VariantRecordInfo makeVariantRecordInfo(VariantRecord record):
 *     if not record:
 *         raise ValueError('invalid VariantRecord')             # <<<<<<<<<<<<<<
 * 
 *     cdef VariantRecordInfo info = VariantRecordInfo.__new__(VariantRecordInfo)
*/
    __pyx_t_4 = NULL;
    __Pyx_INCREF(__pyx_builtin_ValueError);
    __pyx_t_5 = __pyx_builtin_ValueError; 
    __pyx_t_6 = 1;
    {
      PyObject *__pyx_callargs[2] = {__pyx_t_4, __pyx_mstate_global->__pyx_kp_u_invalid_VariantRecord};
      __pyx_t_3 = __Pyx_PyObject_FastCall(__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, 2861, __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, 2861, __pyx_L1_error)

    /* "pysam/libcbcf.pyx":2860
 * 
 * cdef VariantRecordInfo makeVariantRecordInfo(VariantRecord record):
 *     if not record:             # <<<<<<<<<<<<<<
 *         raise ValueError('invalid VariantRecord')
 * 
*/
  }

  /* "pysam/libcbcf.pyx":2863
 *         raise ValueError('invalid VariantRecord')
 * 
 *     cdef VariantRecordInfo info = VariantRecordInfo.__new__(VariantRecordInfo)             # <<<<<<<<<<<<<<
 *     info.record = record
 * 
*/
  __pyx_t_3 = ((PyObject *)__pyx_tp_new_5pysam_7libcbcf_VariantRecordInfo(((PyTypeObject *)__pyx_mstate_global->__pyx_ptype_5pysam_7libcbcf_VariantRecordInfo), __pyx_mstate_global->__pyx_empty_tuple, NULL)); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 2863, __pyx_L1_error)
  __Pyx_GOTREF((PyObject *)__pyx_t_3);
  __pyx_v_info = ((struct __pyx_obj_5pysam_7libcbcf_VariantRecordInfo *)__pyx_t_3);
  __pyx_t_3 = 0;

  /* "pysam/libcbcf.pyx":2864
 * 
 *     cdef VariantRecordInfo info = VariantRecordInfo.__new__(VariantRecordInfo)
 *     info.record = record             # <<<<<<<<<<<<<<
 * 
 *     return info
*/
  __Pyx_INCREF((PyObject *)__pyx_v_record);
  __Pyx_GIVEREF((PyObject *)__pyx_v_record);
  __Pyx_GOTREF((PyObject *)__pyx_v_info->record);
  __Pyx_DECREF((PyObject *)__pyx_v_info->record);
  __pyx_v_info->record = __pyx_v_record;

  /* "pysam/libcbcf.pyx":2866
 *     info.record = record
 * 
 *     return info             # <<<<<<<<<<<<<<
 * 
 * 
*/
  __Pyx_XDECREF((PyObject *)__pyx_r);
  __Pyx_INCREF((PyObject *)__pyx_v_info);
  __pyx_r = __pyx_v_info;
  __Pyx_TraceReturnValue((PyObject *)__pyx_r, 16, 0, __PYX_ERR(0, 2866, __pyx_L1_error));
  goto __pyx_L0;

  /* "pysam/libcbcf.pyx":2859
 * 
 * 
 * cdef VariantRecordInfo makeVariantRecordInfo(VariantRecord record):             # <<<<<<<<<<<<<<
 *     if not record:
 *         raise ValueError('invalid VariantRecord')
*/

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_XDECREF(__pyx_t_5);
  __Pyx_TraceException(__pyx_lineno, 0, 0);
  #if CYTHON_USE_SYS_MONITORING
  __Pyx_TraceExceptionUnwind(0, 0);
  #else
  __Pyx_TraceReturnValue(NULL, 0, 0, __PYX_ERR(0, 2859, __pyx_L1_error));
  #endif
  __Pyx_AddTraceback("pysam.libcbcf.makeVariantRecordInfo", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_XDECREF((PyObject *)__pyx_v_info);
  __Pyx_XGIVEREF((PyObject *)__pyx_r);
  __Pyx_PyMonitoring_ExitScope(0);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "pysam/libcbcf.pyx":2871
 * cdef class VariantRecordSamples(object):
 *     """mapping from sample index or name to :class:`VariantRecordSample` object."""
 *     def __init__(self, *args, **kwargs):             # <<<<<<<<<<<<<<
 *         raise TypeError('this class cannot be instantiated from Python')
 * 
*/

/* Python wrapper */
static int __pyx_pw_5pysam_7libcbcf_20VariantRecordSamples_1__init__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static int __pyx_pw_5pysam_7libcbcf_20VariantRecordSamples_1__init__(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("__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);
  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("__init__", __pyx_kwds) == -1)) return -1;
  }
  __Pyx_INCREF(__pyx_args);
  __pyx_v_args = __pyx_args;
  __pyx_r = __pyx_pf_5pysam_7libcbcf_20VariantRecordSamples___init__(((struct __pyx_obj_5pysam_7libcbcf_VariantRecordSamples *)__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_5pysam_7libcbcf_20VariantRecordSamples___init__(CYTHON_UNUSED struct __pyx_obj_5pysam_7libcbcf_VariantRecordSamples *__pyx_v_self, CYTHON_UNUSED PyObject *__pyx_v_args, CYTHON_UNUSED PyObject *__pyx_v_kwargs) {
  int __pyx_r;
  __Pyx_TraceDeclarationsFunc
  __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_TraceFrameInit(((PyObject *)__pyx_mstate_global->__pyx_codeobj_tab[227]))
  __Pyx_RefNannySetupContext("__init__", 0);
  __Pyx_TraceStartFunc("__init__", __pyx_f[0], 2871, 0, 0, 0, __PYX_ERR(0, 2871, __pyx_L1_error));

  /* "pysam/libcbcf.pyx":2872
 *     """mapping from sample index or name to :class:`VariantRecordSample` object."""
 *     def __init__(self, *args, **kwargs):
 *         raise TypeError('this class cannot be instantiated from Python')             # <<<<<<<<<<<<<<
 * 
 *     def __len__(self):
*/
  __pyx_t_2 = NULL;
  __Pyx_INCREF(__pyx_builtin_TypeError);
  __pyx_t_3 = __pyx_builtin_TypeError; 
  __pyx_t_4 = 1;
  {
    PyObject *__pyx_callargs[2] = {__pyx_t_2, __pyx_mstate_global->__pyx_kp_u_this_class_cannot_be_instantiate};
    __pyx_t_1 = __Pyx_PyObject_FastCall(__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, 2872, __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, 2872, __pyx_L1_error)

  /* "pysam/libcbcf.pyx":2871
 * cdef class VariantRecordSamples(object):
 *     """mapping from sample index or name to :class:`VariantRecordSample` object."""
 *     def __init__(self, *args, **kwargs):             # <<<<<<<<<<<<<<
 *         raise TypeError('this class cannot be instantiated from Python')
 * 
*/

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_TraceException(__pyx_lineno, 0, 0);
  #if CYTHON_USE_SYS_MONITORING
  __Pyx_TraceExceptionUnwind(0, 0);
  #else
  __Pyx_TraceReturnValue(NULL, 0, 0, __PYX_ERR(0, 2871, __pyx_L1_error));
  #endif
  __Pyx_AddTraceback("pysam.libcbcf.VariantRecordSamples.__init__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = -1;
  __Pyx_PyMonitoring_ExitScope(0);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "pysam/libcbcf.pyx":2874
 *         raise TypeError('this class cannot be instantiated from Python')
 * 
 *     def __len__(self):             # <<<<<<<<<<<<<<
 *         return self.record.ptr.n_sample  # bcf_hdr_nsamples(self.record.header.ptr)
 * 
*/

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

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

static Py_ssize_t __pyx_pf_5pysam_7libcbcf_20VariantRecordSamples_2__len__(struct __pyx_obj_5pysam_7libcbcf_VariantRecordSamples *__pyx_v_self) {
  Py_ssize_t __pyx_r;
  __Pyx_TraceDeclarationsFunc
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_TraceFrameInit(((PyObject *)__pyx_mstate_global->__pyx_codeobj_tab[228]))
  __Pyx_TraceStartFunc("__len__", __pyx_f[0], 2874, 0, 0, 0, __PYX_ERR(0, 2874, __pyx_L1_error));

  /* "pysam/libcbcf.pyx":2875
 * 
 *     def __len__(self):
 *         return self.record.ptr.n_sample  # bcf_hdr_nsamples(self.record.header.ptr)             # <<<<<<<<<<<<<<
 * 
 *     def __bool__(self):
*/
  __pyx_r = __pyx_v_self->record->ptr->n_sample;
  __Pyx_TraceReturnCValue(__pyx_r, PyLong_FromSsize_t, 1, 0, __PYX_ERR(0, 2875, __pyx_L1_error));
  goto __pyx_L0;

  /* "pysam/libcbcf.pyx":2874
 *         raise TypeError('this class cannot be instantiated from Python')
 * 
 *     def __len__(self):             # <<<<<<<<<<<<<<
 *         return self.record.ptr.n_sample  # bcf_hdr_nsamples(self.record.header.ptr)
 * 
*/

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_TraceException(__pyx_lineno, 0, 0);
  #if CYTHON_USE_SYS_MONITORING
  __Pyx_TraceExceptionUnwind(0, 0);
  #else
  __Pyx_TraceReturnValue(NULL, 0, 0, __PYX_ERR(0, 2874, __pyx_L1_error));
  #endif
  __Pyx_AddTraceback("pysam.libcbcf.VariantRecordSamples.__len__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = -1;
  __pyx_L0:;
  __Pyx_PyMonitoring_ExitScope(0);
  return __pyx_r;
}

/* "pysam/libcbcf.pyx":2877
 *         return self.record.ptr.n_sample  # bcf_hdr_nsamples(self.record.header.ptr)
 * 
 *     def __bool__(self):             # <<<<<<<<<<<<<<
 *         return self.record.ptr.n_sample != 0  # bcf_hdr_nsamples(self.record.header.ptr) != 0
 * 
*/

/* Python wrapper */
static int __pyx_pw_5pysam_7libcbcf_20VariantRecordSamples_5__bool__(PyObject *__pyx_v_self); /*proto*/
static int __pyx_pw_5pysam_7libcbcf_20VariantRecordSamples_5__bool__(PyObject *__pyx_v_self) {
  CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__bool__ (wrapper)", 0);
  __pyx_kwvalues = __Pyx_KwValues_VARARGS(__pyx_args, __pyx_nargs);
  __pyx_r = __pyx_pf_5pysam_7libcbcf_20VariantRecordSamples_4__bool__(((struct __pyx_obj_5pysam_7libcbcf_VariantRecordSamples *)__pyx_v_self));

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

static int __pyx_pf_5pysam_7libcbcf_20VariantRecordSamples_4__bool__(struct __pyx_obj_5pysam_7libcbcf_VariantRecordSamples *__pyx_v_self) {
  int __pyx_r;
  __Pyx_TraceDeclarationsFunc
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_TraceFrameInit(((PyObject *)__pyx_mstate_global->__pyx_codeobj_tab[229]))
  __Pyx_TraceStartFunc("__bool__", __pyx_f[0], 2877, 0, 0, 0, __PYX_ERR(0, 2877, __pyx_L1_error));

  /* "pysam/libcbcf.pyx":2878
 * 
 *     def __bool__(self):
 *         return self.record.ptr.n_sample != 0  # bcf_hdr_nsamples(self.record.header.ptr) != 0             # <<<<<<<<<<<<<<
 * 
 *     def __getitem__(self, key):
*/
  __pyx_r = (__pyx_v_self->record->ptr->n_sample != 0);
  __Pyx_TraceReturnCValue(__pyx_r, __Pyx_PyLong_From_int, 1, 0, __PYX_ERR(0, 2878, __pyx_L1_error));
  goto __pyx_L0;

  /* "pysam/libcbcf.pyx":2877
 *         return self.record.ptr.n_sample  # bcf_hdr_nsamples(self.record.header.ptr)
 * 
 *     def __bool__(self):             # <<<<<<<<<<<<<<
 *         return self.record.ptr.n_sample != 0  # bcf_hdr_nsamples(self.record.header.ptr) != 0
 * 
*/

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_TraceException(__pyx_lineno, 0, 0);
  #if CYTHON_USE_SYS_MONITORING
  __Pyx_TraceExceptionUnwind(0, 0);
  #else
  __Pyx_TraceReturnValue(NULL, 0, 0, __PYX_ERR(0, 2877, __pyx_L1_error));
  #endif
  __Pyx_AddTraceback("pysam.libcbcf.VariantRecordSamples.__bool__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = -1;
  __pyx_L0:;
  __Pyx_PyMonitoring_ExitScope(0);
  return __pyx_r;
}

/* "pysam/libcbcf.pyx":2880
 *         return self.record.ptr.n_sample != 0  # bcf_hdr_nsamples(self.record.header.ptr) != 0
 * 
 *     def __getitem__(self, key):             # <<<<<<<<<<<<<<
 *         cdef bcf_hdr_t *hdr = self.record.header.ptr
 *         cdef bcf1_t *r = self.record.ptr
*/

/* Python wrapper */
static PyObject *__pyx_pw_5pysam_7libcbcf_20VariantRecordSamples_7__getitem__(PyObject *__pyx_v_self, PyObject *__pyx_v_key); /*proto*/
static PyObject *__pyx_pw_5pysam_7libcbcf_20VariantRecordSamples_7__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_5pysam_7libcbcf_20VariantRecordSamples_6__getitem__(((struct __pyx_obj_5pysam_7libcbcf_VariantRecordSamples *)__pyx_v_self), ((PyObject *)__pyx_v_key));

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

static PyObject *__pyx_pf_5pysam_7libcbcf_20VariantRecordSamples_6__getitem__(struct __pyx_obj_5pysam_7libcbcf_VariantRecordSamples *__pyx_v_self, PyObject *__pyx_v_key) {
  bcf_hdr_t *__pyx_v_hdr;
  CYTHON_UNUSED bcf1_t *__pyx_v_r;
  int __pyx_v_n;
  int __pyx_v_sample_index;
  PyObject *__pyx_v_bkey = NULL;
  PyObject *__pyx_r = NULL;
  __Pyx_TraceDeclarationsFunc
  __Pyx_RefNannyDeclarations
  bcf_hdr_t *__pyx_t_1;
  bcf1_t *__pyx_t_2;
  uint32_t __pyx_t_3;
  int __pyx_t_4;
  int __pyx_t_5;
  PyObject *__pyx_t_6 = NULL;
  char const *__pyx_t_7;
  PyObject *__pyx_t_8 = NULL;
  PyObject *__pyx_t_9 = NULL;
  PyObject *__pyx_t_10 = NULL;
  PyObject *__pyx_t_11 = NULL;
  size_t __pyx_t_12;
  int __pyx_t_13;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_TraceFrameInit(((PyObject *)__pyx_mstate_global->__pyx_codeobj_tab[230]))
  __Pyx_RefNannySetupContext("__getitem__", 0);
  __Pyx_TraceStartFunc("__getitem__", __pyx_f[0], 2880, 0, 0, 0, __PYX_ERR(0, 2880, __pyx_L1_error));

  /* "pysam/libcbcf.pyx":2881
 * 
 *     def __getitem__(self, key):
 *         cdef bcf_hdr_t *hdr = self.record.header.ptr             # <<<<<<<<<<<<<<
 *         cdef bcf1_t *r = self.record.ptr
 *         cdef int n = self.record.ptr.n_sample
*/
  __pyx_t_1 = __pyx_v_self->record->header->ptr;
  __pyx_v_hdr = __pyx_t_1;

  /* "pysam/libcbcf.pyx":2882
 *     def __getitem__(self, key):
 *         cdef bcf_hdr_t *hdr = self.record.header.ptr
 *         cdef bcf1_t *r = self.record.ptr             # <<<<<<<<<<<<<<
 *         cdef int n = self.record.ptr.n_sample
 *         cdef int sample_index
*/
  __pyx_t_2 = __pyx_v_self->record->ptr;
  __pyx_v_r = __pyx_t_2;

  /* "pysam/libcbcf.pyx":2883
 *         cdef bcf_hdr_t *hdr = self.record.header.ptr
 *         cdef bcf1_t *r = self.record.ptr
 *         cdef int n = self.record.ptr.n_sample             # <<<<<<<<<<<<<<
 *         cdef int sample_index
 *         cdef vdict_t *d
*/
  __pyx_t_3 = __pyx_v_self->record->ptr->n_sample;
  __pyx_v_n = __pyx_t_3;

  /* "pysam/libcbcf.pyx":2888
 *         cdef khiter_t k
 * 
 *         if isinstance(key, int):             # <<<<<<<<<<<<<<
 *             sample_index = key
 *         else:
*/
  __pyx_t_4 = PyLong_Check(__pyx_v_key); 
  if (__pyx_t_4) {

    /* "pysam/libcbcf.pyx":2889
 * 
 *         if isinstance(key, int):
 *             sample_index = key             # <<<<<<<<<<<<<<
 *         else:
 *             bkey = force_bytes(key)
*/
    __pyx_t_5 = __Pyx_PyLong_As_int(__pyx_v_key); if (unlikely((__pyx_t_5 == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 2889, __pyx_L1_error)
    __pyx_v_sample_index = __pyx_t_5;

    /* "pysam/libcbcf.pyx":2888
 *         cdef khiter_t k
 * 
 *         if isinstance(key, int):             # <<<<<<<<<<<<<<
 *             sample_index = key
 *         else:
*/
    goto __pyx_L3;
  }

  /* "pysam/libcbcf.pyx":2891
 *             sample_index = key
 *         else:
 *             bkey = force_bytes(key)             # <<<<<<<<<<<<<<
 *             sample_index = bcf_hdr_id2int(hdr, BCF_DT_SAMPLE, bkey)
 *             if sample_index < 0:
*/
  /*else*/ {
    __pyx_t_6 = __pyx_f_5pysam_9libcutils_force_bytes(__pyx_v_key, NULL); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 2891, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_6);
    __pyx_v_bkey = ((PyObject*)__pyx_t_6);
    __pyx_t_6 = 0;

    /* "pysam/libcbcf.pyx":2892
 *         else:
 *             bkey = force_bytes(key)
 *             sample_index = bcf_hdr_id2int(hdr, BCF_DT_SAMPLE, bkey)             # <<<<<<<<<<<<<<
 *             if sample_index < 0:
 *                 raise KeyError('invalid sample name: {}'.format(key))
*/
    if (unlikely(__pyx_v_bkey == Py_None)) {
      PyErr_SetString(PyExc_TypeError, "expected bytes, NoneType found");
      __PYX_ERR(0, 2892, __pyx_L1_error)
    }
    __pyx_t_7 = __Pyx_PyBytes_AsString(__pyx_v_bkey); if (unlikely((!__pyx_t_7) && PyErr_Occurred())) __PYX_ERR(0, 2892, __pyx_L1_error)
    __pyx_v_sample_index = bcf_hdr_id2int(__pyx_v_hdr, BCF_DT_SAMPLE, __pyx_t_7);

    /* "pysam/libcbcf.pyx":2893
 *             bkey = force_bytes(key)
 *             sample_index = bcf_hdr_id2int(hdr, BCF_DT_SAMPLE, bkey)
 *             if sample_index < 0:             # <<<<<<<<<<<<<<
 *                 raise KeyError('invalid sample name: {}'.format(key))
 * 
*/
    __pyx_t_4 = (__pyx_v_sample_index < 0);
    if (unlikely(__pyx_t_4)) {

      /* "pysam/libcbcf.pyx":2894
 *             sample_index = bcf_hdr_id2int(hdr, BCF_DT_SAMPLE, bkey)
 *             if sample_index < 0:
 *                 raise KeyError('invalid sample name: {}'.format(key))             # <<<<<<<<<<<<<<
 * 
 *         if sample_index < 0 or sample_index >= n:
*/
      __pyx_t_8 = NULL;
      __Pyx_INCREF(__pyx_builtin_KeyError);
      __pyx_t_9 = __pyx_builtin_KeyError; 
      __pyx_t_11 = __pyx_mstate_global->__pyx_kp_u_invalid_sample_name;
      __Pyx_INCREF(__pyx_t_11);
      __pyx_t_12 = 0;
      {
        PyObject *__pyx_callargs[2] = {__pyx_t_11, __pyx_v_key};
        __pyx_t_10 = __Pyx_PyObject_FastCallMethod(__pyx_mstate_global->__pyx_n_u_format, __pyx_callargs+__pyx_t_12, (2-__pyx_t_12) | (1*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
        __Pyx_XDECREF(__pyx_t_11); __pyx_t_11 = 0;
        if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 2894, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_10);
      }
      __pyx_t_12 = 1;
      {
        PyObject *__pyx_callargs[2] = {__pyx_t_8, __pyx_t_10};
        __pyx_t_6 = __Pyx_PyObject_FastCall(__pyx_t_9, __pyx_callargs+__pyx_t_12, (2-__pyx_t_12) | (__pyx_t_12*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
        __Pyx_XDECREF(__pyx_t_8); __pyx_t_8 = 0;
        __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
        __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
        if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 2894, __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, 2894, __pyx_L1_error)

      /* "pysam/libcbcf.pyx":2893
 *             bkey = force_bytes(key)
 *             sample_index = bcf_hdr_id2int(hdr, BCF_DT_SAMPLE, bkey)
 *             if sample_index < 0:             # <<<<<<<<<<<<<<
 *                 raise KeyError('invalid sample name: {}'.format(key))
 * 
*/
    }
  }
  __pyx_L3:;

  /* "pysam/libcbcf.pyx":2896
 *                 raise KeyError('invalid sample name: {}'.format(key))
 * 
 *         if sample_index < 0 or sample_index >= n:             # <<<<<<<<<<<<<<
 *             raise IndexError('invalid sample index')
 * 
*/
  __pyx_t_13 = (__pyx_v_sample_index < 0);
  if (!__pyx_t_13) {
  } else {
    __pyx_t_4 = __pyx_t_13;
    goto __pyx_L6_bool_binop_done;
  }
  __pyx_t_13 = (__pyx_v_sample_index >= __pyx_v_n);
  __pyx_t_4 = __pyx_t_13;
  __pyx_L6_bool_binop_done:;
  if (unlikely(__pyx_t_4)) {

    /* "pysam/libcbcf.pyx":2897
 * 
 *         if sample_index < 0 or sample_index >= n:
 *             raise IndexError('invalid sample index')             # <<<<<<<<<<<<<<
 * 
 *         return makeVariantRecordSample(self.record, sample_index)
*/
    __pyx_t_9 = NULL;
    __Pyx_INCREF(__pyx_builtin_IndexError);
    __pyx_t_10 = __pyx_builtin_IndexError; 
    __pyx_t_12 = 1;
    {
      PyObject *__pyx_callargs[2] = {__pyx_t_9, __pyx_mstate_global->__pyx_kp_u_invalid_sample_index};
      __pyx_t_6 = __Pyx_PyObject_FastCall(__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_10); __pyx_t_10 = 0;
      if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 2897, __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, 2897, __pyx_L1_error)

    /* "pysam/libcbcf.pyx":2896
 *                 raise KeyError('invalid sample name: {}'.format(key))
 * 
 *         if sample_index < 0 or sample_index >= n:             # <<<<<<<<<<<<<<
 *             raise IndexError('invalid sample index')
 * 
*/
  }

  /* "pysam/libcbcf.pyx":2899
 *             raise IndexError('invalid sample index')
 * 
 *         return makeVariantRecordSample(self.record, sample_index)             # <<<<<<<<<<<<<<
 * 
 *     def __iter__(self):
*/
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_6 = ((PyObject *)__pyx_v_self->record);
  __Pyx_INCREF(__pyx_t_6);
  __pyx_t_10 = ((PyObject *)__pyx_f_5pysam_7libcbcf_makeVariantRecordSample(((struct __pyx_obj_5pysam_7libcbcf_VariantRecord *)__pyx_t_6), __pyx_v_sample_index)); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 2899, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_10);
  __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
  __pyx_r = __pyx_t_10;
  __pyx_t_10 = 0;
  __Pyx_TraceReturnValue(__pyx_r, 55, 0, __PYX_ERR(0, 2899, __pyx_L1_error));
  goto __pyx_L0;

  /* "pysam/libcbcf.pyx":2880
 *         return self.record.ptr.n_sample != 0  # bcf_hdr_nsamples(self.record.header.ptr) != 0
 * 
 *     def __getitem__(self, key):             # <<<<<<<<<<<<<<
 *         cdef bcf_hdr_t *hdr = self.record.header.ptr
 *         cdef bcf1_t *r = self.record.ptr
*/

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_6);
  __Pyx_XDECREF(__pyx_t_8);
  __Pyx_XDECREF(__pyx_t_9);
  __Pyx_XDECREF(__pyx_t_10);
  __Pyx_XDECREF(__pyx_t_11);
  __Pyx_TraceException(__pyx_lineno, 0, 0);
  #if CYTHON_USE_SYS_MONITORING
  __Pyx_TraceExceptionUnwind(0, 0);
  #else
  __Pyx_TraceReturnValue(NULL, 0, 0, __PYX_ERR(0, 2880, __pyx_L1_error));
  #endif
  __Pyx_AddTraceback("pysam.libcbcf.VariantRecordSamples.__getitem__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_bkey);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_PyMonitoring_ExitScope(0);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}
static PyObject *__pyx_gb_5pysam_7libcbcf_20VariantRecordSamples_10generator20(__pyx_CoroutineObject *__pyx_generator, CYTHON_UNUSED PyThreadState *__pyx_tstate, PyObject *__pyx_sent_value); /* proto */

/* "pysam/libcbcf.pyx":2901
 *         return makeVariantRecordSample(self.record, sample_index)
 * 
 *     def __iter__(self):             # <<<<<<<<<<<<<<
 *         cdef bcf_hdr_t *hdr = self.record.header.ptr
 *         cdef bcf1_t *r = self.record.ptr
*/

/* Python wrapper */
static PyObject *__pyx_pw_5pysam_7libcbcf_20VariantRecordSamples_9__iter__(PyObject *__pyx_v_self); /*proto*/
static PyObject *__pyx_pw_5pysam_7libcbcf_20VariantRecordSamples_9__iter__(PyObject *__pyx_v_self) {
  CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__iter__ (wrapper)", 0);
  __pyx_kwvalues = __Pyx_KwValues_VARARGS(__pyx_args, __pyx_nargs);
  __pyx_r = __pyx_pf_5pysam_7libcbcf_20VariantRecordSamples_8__iter__(((struct __pyx_obj_5pysam_7libcbcf_VariantRecordSamples *)__pyx_v_self));

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

static PyObject *__pyx_pf_5pysam_7libcbcf_20VariantRecordSamples_8__iter__(struct __pyx_obj_5pysam_7libcbcf_VariantRecordSamples *__pyx_v_self) {
  struct __pyx_obj_5pysam_7libcbcf___pyx_scope_struct_27___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("__iter__", 0);
  __pyx_cur_scope = (struct __pyx_obj_5pysam_7libcbcf___pyx_scope_struct_27___iter__ *)__pyx_tp_new_5pysam_7libcbcf___pyx_scope_struct_27___iter__(__pyx_mstate_global->__pyx_ptype_5pysam_7libcbcf___pyx_scope_struct_27___iter__, __pyx_mstate_global->__pyx_empty_tuple, NULL);
  if (unlikely(!__pyx_cur_scope)) {
    __pyx_cur_scope = ((struct __pyx_obj_5pysam_7libcbcf___pyx_scope_struct_27___iter__ *)Py_None);
    __Pyx_INCREF(Py_None);
    __PYX_ERR(0, 2901, __pyx_L1_error)
  } else {
    __Pyx_GOTREF((PyObject *)__pyx_cur_scope);
  }
  __pyx_cur_scope->__pyx_v_self = __pyx_v_self;
  __Pyx_INCREF((PyObject *)__pyx_cur_scope->__pyx_v_self);
  __Pyx_GIVEREF((PyObject *)__pyx_cur_scope->__pyx_v_self);
  {
    __pyx_CoroutineObject *gen = __Pyx_Generator_New((__pyx_coroutine_body_t) __pyx_gb_5pysam_7libcbcf_20VariantRecordSamples_10generator20, ((PyObject *)__pyx_mstate_global->__pyx_codeobj_tab[231]), (PyObject *) __pyx_cur_scope, __pyx_mstate_global->__pyx_n_u_iter, __pyx_mstate_global->__pyx_n_u_VariantRecordSamples___iter, __pyx_mstate_global->__pyx_n_u_pysam_libcbcf); if (unlikely(!gen)) __PYX_ERR(0, 2901, __pyx_L1_error)
    __Pyx_DECREF(__pyx_cur_scope);
    __Pyx_RefNannyFinishContext();
    return (PyObject *) gen;
  }

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_AddTraceback("pysam.libcbcf.VariantRecordSamples.__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_5pysam_7libcbcf_20VariantRecordSamples_10generator20(__pyx_CoroutineObject *__pyx_generator, CYTHON_UNUSED PyThreadState *__pyx_tstate, PyObject *__pyx_sent_value) /* generator body */
{
  struct __pyx_obj_5pysam_7libcbcf___pyx_scope_struct_27___iter__ *__pyx_cur_scope = ((struct __pyx_obj_5pysam_7libcbcf___pyx_scope_struct_27___iter__ *)__pyx_generator->closure);
  PyObject *__pyx_r = NULL;
  __Pyx_TraceDeclarationsGen
  bcf_hdr_t *__pyx_t_1;
  bcf1_t *__pyx_t_2;
  uint32_t __pyx_t_3;
  int32_t __pyx_t_4;
  int32_t __pyx_t_5;
  int32_t __pyx_t_6;
  PyObject *__pyx_t_7 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__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_TraceStartGen("__iter__", __pyx_f[0], 2901, 0, 0, 0, __PYX_ERR(0, 2901, __pyx_L1_error));
    __Pyx_TraceReturnValue(Py_None, 0, 0, __PYX_ERR(0, 2901, __pyx_L1_error));
    __Pyx_RefNannyFinishContext();
    return NULL;
  }
  __pyx_L3_first_run:;
  __Pyx_TraceStartGen("__iter__", __pyx_f[0], 2901, 0, 0, 0, __PYX_ERR(0, 2901, __pyx_L1_error));
  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, 2901, __pyx_L1_error)
  }

  /* "pysam/libcbcf.pyx":2902
 * 
 *     def __iter__(self):
 *         cdef bcf_hdr_t *hdr = self.record.header.ptr             # <<<<<<<<<<<<<<
 *         cdef bcf1_t *r = self.record.ptr
 *         cdef int32_t i, n = self.record.ptr.n_sample
*/
  __pyx_t_1 = __pyx_cur_scope->__pyx_v_self->record->header->ptr;
  __pyx_cur_scope->__pyx_v_hdr = __pyx_t_1;

  /* "pysam/libcbcf.pyx":2903
 *     def __iter__(self):
 *         cdef bcf_hdr_t *hdr = self.record.header.ptr
 *         cdef bcf1_t *r = self.record.ptr             # <<<<<<<<<<<<<<
 *         cdef int32_t i, n = self.record.ptr.n_sample
 * 
*/
  __pyx_t_2 = __pyx_cur_scope->__pyx_v_self->record->ptr;
  __pyx_cur_scope->__pyx_v_r = __pyx_t_2;

  /* "pysam/libcbcf.pyx":2904
 *         cdef bcf_hdr_t *hdr = self.record.header.ptr
 *         cdef bcf1_t *r = self.record.ptr
 *         cdef int32_t i, n = self.record.ptr.n_sample             # <<<<<<<<<<<<<<
 * 
 *         for i in range(n):
*/
  __pyx_t_3 = __pyx_cur_scope->__pyx_v_self->record->ptr->n_sample;
  __pyx_cur_scope->__pyx_v_n = __pyx_t_3;

  /* "pysam/libcbcf.pyx":2906
 *         cdef int32_t i, n = self.record.ptr.n_sample
 * 
 *         for i in range(n):             # <<<<<<<<<<<<<<
 *             yield charptr_to_str(hdr.samples[i])
 * 
*/
  __pyx_t_4 = __pyx_cur_scope->__pyx_v_n;
  __pyx_t_5 = __pyx_t_4;
  for (__pyx_t_6 = 0; __pyx_t_6 < __pyx_t_5; __pyx_t_6+=1) {
    __pyx_cur_scope->__pyx_v_i = __pyx_t_6;

    /* "pysam/libcbcf.pyx":2907
 * 
 *         for i in range(n):
 *             yield charptr_to_str(hdr.samples[i])             # <<<<<<<<<<<<<<
 * 
 *     def get(self, key, default=None):
*/
    __pyx_t_7 = __pyx_f_5pysam_9libcutils_charptr_to_str((__pyx_cur_scope->__pyx_v_hdr->samples[__pyx_cur_scope->__pyx_v_i]), NULL); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 2907, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_7);
    __pyx_r = __pyx_t_7;
    __pyx_t_7 = 0;
    __pyx_cur_scope->__pyx_t_0 = __pyx_t_4;
    __pyx_cur_scope->__pyx_t_1 = __pyx_t_5;
    __pyx_cur_scope->__pyx_t_2 = __pyx_t_6;
    __Pyx_TraceYield(__pyx_r, 0, __PYX_ERR(0, 2907, __pyx_L1_error));
    __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_TraceResumeGen("__iter__", __pyx_f[0], 2901, 0, __PYX_ERR(0, 2907, __pyx_L1_error));
    __pyx_t_4 = __pyx_cur_scope->__pyx_t_0;
    __pyx_t_5 = __pyx_cur_scope->__pyx_t_1;
    __pyx_t_6 = __pyx_cur_scope->__pyx_t_2;
    if (unlikely(!__pyx_sent_value)) __PYX_ERR(0, 2907, __pyx_L1_error)
  }
  CYTHON_MAYBE_UNUSED_VAR(__pyx_cur_scope);
  __Pyx_TraceReturnValue(Py_None, 0, 0, __PYX_ERR(0, 2901, __pyx_L1_error));

  /* "pysam/libcbcf.pyx":2901
 *         return makeVariantRecordSample(self.record, sample_index)
 * 
 *     def __iter__(self):             # <<<<<<<<<<<<<<
 *         cdef bcf_hdr_t *hdr = self.record.header.ptr
 *         cdef bcf1_t *r = self.record.ptr
*/

  /* function exit code */
  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_7);
  if (__Pyx_PyErr_Occurred()) {
    __Pyx_TraceException(__pyx_lineno, 0, 0);
    __Pyx_Generator_Replace_StopIteration(0);
    __Pyx_AddTraceback("__iter__", __pyx_clineno, __pyx_lineno, __pyx_filename);
    __Pyx_TraceExceptionUnwind(0, 0);
  }
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_PyMonitoring_ExitScope(0);
  #if !CYTHON_USE_EXC_INFO_STACK
  __Pyx_Coroutine_ResetAndClearException(__pyx_generator);
  #endif
  __pyx_generator->resume_label = -1;
  __Pyx_Coroutine_clear((PyObject*)__pyx_generator);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "pysam/libcbcf.pyx":2909
 *             yield charptr_to_str(hdr.samples[i])
 * 
 *     def get(self, key, default=None):             # <<<<<<<<<<<<<<
 *         """D.get(k[,d]) -> D[k] if k in D, else d.  d defaults to None."""
 *         try:
*/

/* Python wrapper */
static PyObject *__pyx_pw_5pysam_7libcbcf_20VariantRecordSamples_12get(PyObject *__pyx_v_self, 
#if 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_5pysam_7libcbcf_20VariantRecordSamples_11get, "VariantRecordSamples.get(self, key, default=None)\n\nD.get(k[,d]) -> D[k] if k in D, else d.  d defaults to None.");
static PyMethodDef __pyx_mdef_5pysam_7libcbcf_20VariantRecordSamples_12get = {"get", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_5pysam_7libcbcf_20VariantRecordSamples_12get, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_5pysam_7libcbcf_20VariantRecordSamples_11get};
static PyObject *__pyx_pw_5pysam_7libcbcf_20VariantRecordSamples_12get(PyObject *__pyx_v_self, 
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
) {
  PyObject *__pyx_v_key = 0;
  PyObject *__pyx_v_default = 0;
  #if !CYTHON_METH_FASTCALL
  CYTHON_UNUSED Py_ssize_t __pyx_nargs;
  #endif
  CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
  PyObject* values[2] = {0,0};
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("get (wrapper)", 0);
  #if !CYTHON_METH_FASTCALL
  #if CYTHON_ASSUME_SAFE_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,&__pyx_mstate_global->__pyx_n_u_default,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, 2909, __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, 2909, __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, 2909, __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, 2909, __pyx_L3_error)
      if (!values[1]) values[1] = __Pyx_NewRef(((PyObject *)Py_None));
      for (Py_ssize_t i = __pyx_nargs; i < 1; i++) {
        if (unlikely(!values[i])) { __Pyx_RaiseArgtupleInvalid("get", 0, 1, 2, i); __PYX_ERR(0, 2909, __pyx_L3_error) }
      }
    } 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, 2909, __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, 2909, __pyx_L3_error)
        break;
        default: goto __pyx_L5_argtuple_error;
      }
      if (!values[1]) values[1] = __Pyx_NewRef(((PyObject *)Py_None));
    }
    __pyx_v_key = values[0];
    __pyx_v_default = values[1];
  }
  goto __pyx_L6_skip;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("get", 0, 1, 2, __pyx_nargs); __PYX_ERR(0, 2909, __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("pysam.libcbcf.VariantRecordSamples.get", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_5pysam_7libcbcf_20VariantRecordSamples_11get(((struct __pyx_obj_5pysam_7libcbcf_VariantRecordSamples *)__pyx_v_self), __pyx_v_key, __pyx_v_default);

  /* 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_5pysam_7libcbcf_20VariantRecordSamples_11get(struct __pyx_obj_5pysam_7libcbcf_VariantRecordSamples *__pyx_v_self, PyObject *__pyx_v_key, PyObject *__pyx_v_default) {
  PyObject *__pyx_r = NULL;
  __Pyx_TraceDeclarationsFunc
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  PyObject *__pyx_t_4 = NULL;
  int __pyx_t_5;
  PyObject *__pyx_t_6 = NULL;
  PyObject *__pyx_t_7 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_TraceFrameInit(((PyObject *)__pyx_mstate_global->__pyx_codeobj_tab[232]))
  __Pyx_RefNannySetupContext("get", 0);
  __Pyx_TraceStartFunc("get", __pyx_f[0], 2909, 0, 0, 0, __PYX_ERR(0, 2909, __pyx_L1_error));

  /* "pysam/libcbcf.pyx":2911
 *     def get(self, key, default=None):
 *         """D.get(k[,d]) -> D[k] if k in D, else d.  d defaults to None."""
 *         try:             # <<<<<<<<<<<<<<
 *             return self[key]
 *         except KeyError:
*/
  {
    __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:*/ {

      /* "pysam/libcbcf.pyx":2912
 *         """D.get(k[,d]) -> D[k] if k in D, else d.  d defaults to None."""
 *         try:
 *             return self[key]             # <<<<<<<<<<<<<<
 *         except KeyError:
 *             return default
*/
      __Pyx_XDECREF(__pyx_r);
      __pyx_t_4 = __Pyx_PyObject_GetItem(((PyObject *)__pyx_v_self), __pyx_v_key); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 2912, __pyx_L3_error)
      __Pyx_GOTREF(__pyx_t_4);
      __pyx_r = __pyx_t_4;
      __pyx_t_4 = 0;
      __Pyx_TraceReturnValue(__pyx_r, 3, 0, __PYX_ERR(0, 2912, __pyx_L3_error));
      goto __pyx_L7_try_return;

      /* "pysam/libcbcf.pyx":2911
 *     def get(self, key, default=None):
 *         """D.get(k[,d]) -> D[k] if k in D, else d.  d defaults to None."""
 *         try:             # <<<<<<<<<<<<<<
 *             return self[key]
 *         except KeyError:
*/
    }
    __pyx_L3_error:;
    __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
    __Pyx_TraceException(__pyx_lineno, 0, 0);

    /* "pysam/libcbcf.pyx":2913
 *         try:
 *             return self[key]
 *         except KeyError:             # <<<<<<<<<<<<<<
 *             return default
 * 
*/
    __pyx_t_5 = __Pyx_PyErr_ExceptionMatches(__pyx_builtin_KeyError);
    if (__pyx_t_5) {
      __Pyx_AddTraceback("pysam.libcbcf.VariantRecordSamples.get", __pyx_clineno, __pyx_lineno, __pyx_filename);
      __Pyx_TraceExceptionHandled(0);
      if (__Pyx_GetException(&__pyx_t_4, &__pyx_t_6, &__pyx_t_7) < 0) __PYX_ERR(0, 2913, __pyx_L5_except_error)
      __Pyx_XGOTREF(__pyx_t_4);
      __Pyx_XGOTREF(__pyx_t_6);
      __Pyx_XGOTREF(__pyx_t_7);
      __Pyx_TraceExceptionDone();

      /* "pysam/libcbcf.pyx":2914
 *             return self[key]
 *         except KeyError:
 *             return default             # <<<<<<<<<<<<<<
 * 
 *     def __contains__(self, key):
*/
      __Pyx_XDECREF(__pyx_r);
      __Pyx_INCREF(__pyx_v_default);
      __pyx_r = __pyx_v_default;
      __Pyx_TraceReturnValue(__pyx_r, 8, 0, __PYX_ERR(0, 2914, __pyx_L5_except_error));
      __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;

    /* "pysam/libcbcf.pyx":2911
 *     def get(self, key, default=None):
 *         """D.get(k[,d]) -> D[k] if k in D, else d.  d defaults to None."""
 *         try:             # <<<<<<<<<<<<<<
 *             return self[key]
 *         except KeyError:
*/
    __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;
  }

  /* "pysam/libcbcf.pyx":2909
 *             yield charptr_to_str(hdr.samples[i])
 * 
 *     def get(self, key, default=None):             # <<<<<<<<<<<<<<
 *         """D.get(k[,d]) -> D[k] if k in D, else d.  d defaults to None."""
 *         try:
*/

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_XDECREF(__pyx_t_6);
  __Pyx_XDECREF(__pyx_t_7);
  __Pyx_TraceException(__pyx_lineno, 0, 0);
  #if CYTHON_USE_SYS_MONITORING
  __Pyx_TraceExceptionUnwind(0, 0);
  #else
  __Pyx_TraceReturnValue(NULL, 0, 0, __PYX_ERR(0, 2909, __pyx_L1_error));
  #endif
  __Pyx_AddTraceback("pysam.libcbcf.VariantRecordSamples.get", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_PyMonitoring_ExitScope(0);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "pysam/libcbcf.pyx":2916
 *             return default
 * 
 *     def __contains__(self, key):             # <<<<<<<<<<<<<<
 *         cdef bcf_hdr_t *hdr = self.record.header.ptr
 *         cdef bcf1_t *r = self.record.ptr
*/

/* Python wrapper */
static int __pyx_pw_5pysam_7libcbcf_20VariantRecordSamples_14__contains__(PyObject *__pyx_v_self, PyObject *__pyx_v_key); /*proto*/
static int __pyx_pw_5pysam_7libcbcf_20VariantRecordSamples_14__contains__(PyObject *__pyx_v_self, PyObject *__pyx_v_key) {
  CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__contains__ (wrapper)", 0);
  __pyx_kwvalues = __Pyx_KwValues_VARARGS(__pyx_args, __pyx_nargs);
  __pyx_r = __pyx_pf_5pysam_7libcbcf_20VariantRecordSamples_13__contains__(((struct __pyx_obj_5pysam_7libcbcf_VariantRecordSamples *)__pyx_v_self), ((PyObject *)__pyx_v_key));

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

static int __pyx_pf_5pysam_7libcbcf_20VariantRecordSamples_13__contains__(struct __pyx_obj_5pysam_7libcbcf_VariantRecordSamples *__pyx_v_self, PyObject *__pyx_v_key) {
  bcf_hdr_t *__pyx_v_hdr;
  CYTHON_UNUSED bcf1_t *__pyx_v_r;
  int __pyx_v_n;
  int __pyx_v_sample_index;
  PyObject *__pyx_v_bkey = NULL;
  int __pyx_r;
  __Pyx_TraceDeclarationsFunc
  __Pyx_RefNannyDeclarations
  bcf_hdr_t *__pyx_t_1;
  bcf1_t *__pyx_t_2;
  uint32_t __pyx_t_3;
  int __pyx_t_4;
  int __pyx_t_5;
  PyObject *__pyx_t_6 = NULL;
  char const *__pyx_t_7;
  PyObject *__pyx_t_8 = NULL;
  PyObject *__pyx_t_9 = NULL;
  PyObject *__pyx_t_10 = NULL;
  PyObject *__pyx_t_11 = NULL;
  size_t __pyx_t_12;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_TraceFrameInit(((PyObject *)__pyx_mstate_global->__pyx_codeobj_tab[233]))
  __Pyx_RefNannySetupContext("__contains__", 0);
  __Pyx_TraceStartFunc("__contains__", __pyx_f[0], 2916, 0, 0, 0, __PYX_ERR(0, 2916, __pyx_L1_error));

  /* "pysam/libcbcf.pyx":2917
 * 
 *     def __contains__(self, key):
 *         cdef bcf_hdr_t *hdr = self.record.header.ptr             # <<<<<<<<<<<<<<
 *         cdef bcf1_t *r = self.record.ptr
 *         cdef int n = self.record.ptr.n_sample
*/
  __pyx_t_1 = __pyx_v_self->record->header->ptr;
  __pyx_v_hdr = __pyx_t_1;

  /* "pysam/libcbcf.pyx":2918
 *     def __contains__(self, key):
 *         cdef bcf_hdr_t *hdr = self.record.header.ptr
 *         cdef bcf1_t *r = self.record.ptr             # <<<<<<<<<<<<<<
 *         cdef int n = self.record.ptr.n_sample
 *         cdef int sample_index
*/
  __pyx_t_2 = __pyx_v_self->record->ptr;
  __pyx_v_r = __pyx_t_2;

  /* "pysam/libcbcf.pyx":2919
 *         cdef bcf_hdr_t *hdr = self.record.header.ptr
 *         cdef bcf1_t *r = self.record.ptr
 *         cdef int n = self.record.ptr.n_sample             # <<<<<<<<<<<<<<
 *         cdef int sample_index
 *         cdef vdict_t *d
*/
  __pyx_t_3 = __pyx_v_self->record->ptr->n_sample;
  __pyx_v_n = __pyx_t_3;

  /* "pysam/libcbcf.pyx":2924
 *         cdef khiter_t k
 * 
 *         if isinstance(key, int):             # <<<<<<<<<<<<<<
 *             sample_index = key
 *         else:
*/
  __pyx_t_4 = PyLong_Check(__pyx_v_key); 
  if (__pyx_t_4) {

    /* "pysam/libcbcf.pyx":2925
 * 
 *         if isinstance(key, int):
 *             sample_index = key             # <<<<<<<<<<<<<<
 *         else:
 *             bkey = force_bytes(key)
*/
    __pyx_t_5 = __Pyx_PyLong_As_int(__pyx_v_key); if (unlikely((__pyx_t_5 == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 2925, __pyx_L1_error)
    __pyx_v_sample_index = __pyx_t_5;

    /* "pysam/libcbcf.pyx":2924
 *         cdef khiter_t k
 * 
 *         if isinstance(key, int):             # <<<<<<<<<<<<<<
 *             sample_index = key
 *         else:
*/
    goto __pyx_L3;
  }

  /* "pysam/libcbcf.pyx":2927
 *             sample_index = key
 *         else:
 *             bkey = force_bytes(key)             # <<<<<<<<<<<<<<
 *             sample_index = bcf_hdr_id2int(hdr, BCF_DT_SAMPLE, bkey)
 *             if sample_index < 0:
*/
  /*else*/ {
    __pyx_t_6 = __pyx_f_5pysam_9libcutils_force_bytes(__pyx_v_key, NULL); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 2927, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_6);
    __pyx_v_bkey = ((PyObject*)__pyx_t_6);
    __pyx_t_6 = 0;

    /* "pysam/libcbcf.pyx":2928
 *         else:
 *             bkey = force_bytes(key)
 *             sample_index = bcf_hdr_id2int(hdr, BCF_DT_SAMPLE, bkey)             # <<<<<<<<<<<<<<
 *             if sample_index < 0:
 *                 raise KeyError('invalid sample name: {}'.format(key))
*/
    if (unlikely(__pyx_v_bkey == Py_None)) {
      PyErr_SetString(PyExc_TypeError, "expected bytes, NoneType found");
      __PYX_ERR(0, 2928, __pyx_L1_error)
    }
    __pyx_t_7 = __Pyx_PyBytes_AsString(__pyx_v_bkey); if (unlikely((!__pyx_t_7) && PyErr_Occurred())) __PYX_ERR(0, 2928, __pyx_L1_error)
    __pyx_v_sample_index = bcf_hdr_id2int(__pyx_v_hdr, BCF_DT_SAMPLE, __pyx_t_7);

    /* "pysam/libcbcf.pyx":2929
 *             bkey = force_bytes(key)
 *             sample_index = bcf_hdr_id2int(hdr, BCF_DT_SAMPLE, bkey)
 *             if sample_index < 0:             # <<<<<<<<<<<<<<
 *                 raise KeyError('invalid sample name: {}'.format(key))
 * 
*/
    __pyx_t_4 = (__pyx_v_sample_index < 0);
    if (unlikely(__pyx_t_4)) {

      /* "pysam/libcbcf.pyx":2930
 *             sample_index = bcf_hdr_id2int(hdr, BCF_DT_SAMPLE, bkey)
 *             if sample_index < 0:
 *                 raise KeyError('invalid sample name: {}'.format(key))             # <<<<<<<<<<<<<<
 * 
 *         return 0 <= sample_index < n
*/
      __pyx_t_8 = NULL;
      __Pyx_INCREF(__pyx_builtin_KeyError);
      __pyx_t_9 = __pyx_builtin_KeyError; 
      __pyx_t_11 = __pyx_mstate_global->__pyx_kp_u_invalid_sample_name;
      __Pyx_INCREF(__pyx_t_11);
      __pyx_t_12 = 0;
      {
        PyObject *__pyx_callargs[2] = {__pyx_t_11, __pyx_v_key};
        __pyx_t_10 = __Pyx_PyObject_FastCallMethod(__pyx_mstate_global->__pyx_n_u_format, __pyx_callargs+__pyx_t_12, (2-__pyx_t_12) | (1*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
        __Pyx_XDECREF(__pyx_t_11); __pyx_t_11 = 0;
        if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 2930, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_10);
      }
      __pyx_t_12 = 1;
      {
        PyObject *__pyx_callargs[2] = {__pyx_t_8, __pyx_t_10};
        __pyx_t_6 = __Pyx_PyObject_FastCall(__pyx_t_9, __pyx_callargs+__pyx_t_12, (2-__pyx_t_12) | (__pyx_t_12*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
        __Pyx_XDECREF(__pyx_t_8); __pyx_t_8 = 0;
        __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
        __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
        if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 2930, __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, 2930, __pyx_L1_error)

      /* "pysam/libcbcf.pyx":2929
 *             bkey = force_bytes(key)
 *             sample_index = bcf_hdr_id2int(hdr, BCF_DT_SAMPLE, bkey)
 *             if sample_index < 0:             # <<<<<<<<<<<<<<
 *                 raise KeyError('invalid sample name: {}'.format(key))
 * 
*/
    }
  }
  __pyx_L3:;

  /* "pysam/libcbcf.pyx":2932
 *                 raise KeyError('invalid sample name: {}'.format(key))
 * 
 *         return 0 <= sample_index < n             # <<<<<<<<<<<<<<
 * 
 *     def iterkeys(self):
*/
  __pyx_t_4 = (0 <= __pyx_v_sample_index);
  if (__pyx_t_4) {
    __pyx_t_4 = (__pyx_v_sample_index < __pyx_v_n);
  }
  __pyx_r = __pyx_t_4;
  __Pyx_TraceReturnCValue(__pyx_r, __Pyx_PyLong_From_int, 43, 0, __PYX_ERR(0, 2932, __pyx_L1_error));
  goto __pyx_L0;

  /* "pysam/libcbcf.pyx":2916
 *             return default
 * 
 *     def __contains__(self, key):             # <<<<<<<<<<<<<<
 *         cdef bcf_hdr_t *hdr = self.record.header.ptr
 *         cdef bcf1_t *r = self.record.ptr
*/

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_6);
  __Pyx_XDECREF(__pyx_t_8);
  __Pyx_XDECREF(__pyx_t_9);
  __Pyx_XDECREF(__pyx_t_10);
  __Pyx_XDECREF(__pyx_t_11);
  __Pyx_TraceException(__pyx_lineno, 0, 0);
  #if CYTHON_USE_SYS_MONITORING
  __Pyx_TraceExceptionUnwind(0, 0);
  #else
  __Pyx_TraceReturnValue(NULL, 0, 0, __PYX_ERR(0, 2916, __pyx_L1_error));
  #endif
  __Pyx_AddTraceback("pysam.libcbcf.VariantRecordSamples.__contains__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = -1;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_bkey);
  __Pyx_PyMonitoring_ExitScope(0);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "pysam/libcbcf.pyx":2934
 *         return 0 <= sample_index < n
 * 
 *     def iterkeys(self):             # <<<<<<<<<<<<<<
 *         """D.iterkeys() -> an iterator over the keys of D"""
 *         return iter(self)
*/

/* Python wrapper */
static PyObject *__pyx_pw_5pysam_7libcbcf_20VariantRecordSamples_16iterkeys(PyObject *__pyx_v_self, 
#if 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_5pysam_7libcbcf_20VariantRecordSamples_15iterkeys, "VariantRecordSamples.iterkeys(self)\n\nD.iterkeys() -> an iterator over the keys of D");
static PyMethodDef __pyx_mdef_5pysam_7libcbcf_20VariantRecordSamples_16iterkeys = {"iterkeys", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_5pysam_7libcbcf_20VariantRecordSamples_16iterkeys, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_5pysam_7libcbcf_20VariantRecordSamples_15iterkeys};
static PyObject *__pyx_pw_5pysam_7libcbcf_20VariantRecordSamples_16iterkeys(PyObject *__pyx_v_self, 
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
) {
  #if !CYTHON_METH_FASTCALL
  CYTHON_UNUSED Py_ssize_t __pyx_nargs;
  #endif
  CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("iterkeys (wrapper)", 0);
  #if !CYTHON_METH_FASTCALL
  #if CYTHON_ASSUME_SAFE_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("iterkeys", 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("iterkeys", __pyx_kwds); return NULL;}
  __pyx_r = __pyx_pf_5pysam_7libcbcf_20VariantRecordSamples_15iterkeys(((struct __pyx_obj_5pysam_7libcbcf_VariantRecordSamples *)__pyx_v_self));

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

static PyObject *__pyx_pf_5pysam_7libcbcf_20VariantRecordSamples_15iterkeys(struct __pyx_obj_5pysam_7libcbcf_VariantRecordSamples *__pyx_v_self) {
  PyObject *__pyx_r = NULL;
  __Pyx_TraceDeclarationsFunc
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_TraceFrameInit(((PyObject *)__pyx_mstate_global->__pyx_codeobj_tab[234]))
  __Pyx_RefNannySetupContext("iterkeys", 0);
  __Pyx_TraceStartFunc("iterkeys", __pyx_f[0], 2934, 0, 0, 0, __PYX_ERR(0, 2934, __pyx_L1_error));

  /* "pysam/libcbcf.pyx":2936
 *     def iterkeys(self):
 *         """D.iterkeys() -> an iterator over the keys of D"""
 *         return iter(self)             # <<<<<<<<<<<<<<
 * 
 *     def itervalues(self):
*/
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = PyObject_GetIter(((PyObject *)__pyx_v_self)); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 2936, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  __Pyx_TraceReturnValue(__pyx_r, 1, 0, __PYX_ERR(0, 2936, __pyx_L1_error));
  goto __pyx_L0;

  /* "pysam/libcbcf.pyx":2934
 *         return 0 <= sample_index < n
 * 
 *     def iterkeys(self):             # <<<<<<<<<<<<<<
 *         """D.iterkeys() -> an iterator over the keys of D"""
 *         return iter(self)
*/

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_TraceException(__pyx_lineno, 0, 0);
  #if CYTHON_USE_SYS_MONITORING
  __Pyx_TraceExceptionUnwind(0, 0);
  #else
  __Pyx_TraceReturnValue(NULL, 0, 0, __PYX_ERR(0, 2934, __pyx_L1_error));
  #endif
  __Pyx_AddTraceback("pysam.libcbcf.VariantRecordSamples.iterkeys", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_PyMonitoring_ExitScope(0);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}
static PyObject *__pyx_gb_5pysam_7libcbcf_20VariantRecordSamples_19generator21(__pyx_CoroutineObject *__pyx_generator, CYTHON_UNUSED PyThreadState *__pyx_tstate, PyObject *__pyx_sent_value); /* proto */

/* "pysam/libcbcf.pyx":2938
 *         return iter(self)
 * 
 *     def itervalues(self):             # <<<<<<<<<<<<<<
 *         """D.itervalues() -> an iterator over the values of D"""
 *         cdef bcf_hdr_t *hdr = self.record.header.ptr
*/

/* Python wrapper */
static PyObject *__pyx_pw_5pysam_7libcbcf_20VariantRecordSamples_18itervalues(PyObject *__pyx_v_self, 
#if 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_5pysam_7libcbcf_20VariantRecordSamples_17itervalues, "VariantRecordSamples.itervalues(self)\n\nD.itervalues() -> an iterator over the values of D");
static PyMethodDef __pyx_mdef_5pysam_7libcbcf_20VariantRecordSamples_18itervalues = {"itervalues", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_5pysam_7libcbcf_20VariantRecordSamples_18itervalues, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_5pysam_7libcbcf_20VariantRecordSamples_17itervalues};
static PyObject *__pyx_pw_5pysam_7libcbcf_20VariantRecordSamples_18itervalues(PyObject *__pyx_v_self, 
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
) {
  #if !CYTHON_METH_FASTCALL
  CYTHON_UNUSED Py_ssize_t __pyx_nargs;
  #endif
  CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("itervalues (wrapper)", 0);
  #if !CYTHON_METH_FASTCALL
  #if CYTHON_ASSUME_SAFE_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("itervalues", 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("itervalues", __pyx_kwds); return NULL;}
  __pyx_r = __pyx_pf_5pysam_7libcbcf_20VariantRecordSamples_17itervalues(((struct __pyx_obj_5pysam_7libcbcf_VariantRecordSamples *)__pyx_v_self));

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

static PyObject *__pyx_pf_5pysam_7libcbcf_20VariantRecordSamples_17itervalues(struct __pyx_obj_5pysam_7libcbcf_VariantRecordSamples *__pyx_v_self) {
  struct __pyx_obj_5pysam_7libcbcf___pyx_scope_struct_28_itervalues *__pyx_cur_scope;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("itervalues", 0);
  __pyx_cur_scope = (struct __pyx_obj_5pysam_7libcbcf___pyx_scope_struct_28_itervalues *)__pyx_tp_new_5pysam_7libcbcf___pyx_scope_struct_28_itervalues(__pyx_mstate_global->__pyx_ptype_5pysam_7libcbcf___pyx_scope_struct_28_itervalues, __pyx_mstate_global->__pyx_empty_tuple, NULL);
  if (unlikely(!__pyx_cur_scope)) {
    __pyx_cur_scope = ((struct __pyx_obj_5pysam_7libcbcf___pyx_scope_struct_28_itervalues *)Py_None);
    __Pyx_INCREF(Py_None);
    __PYX_ERR(0, 2938, __pyx_L1_error)
  } else {
    __Pyx_GOTREF((PyObject *)__pyx_cur_scope);
  }
  __pyx_cur_scope->__pyx_v_self = __pyx_v_self;
  __Pyx_INCREF((PyObject *)__pyx_cur_scope->__pyx_v_self);
  __Pyx_GIVEREF((PyObject *)__pyx_cur_scope->__pyx_v_self);
  {
    __pyx_CoroutineObject *gen = __Pyx_Generator_New((__pyx_coroutine_body_t) __pyx_gb_5pysam_7libcbcf_20VariantRecordSamples_19generator21, ((PyObject *)__pyx_mstate_global->__pyx_codeobj_tab[235]), (PyObject *) __pyx_cur_scope, __pyx_mstate_global->__pyx_n_u_itervalues, __pyx_mstate_global->__pyx_n_u_VariantRecordSamples_itervalues, __pyx_mstate_global->__pyx_n_u_pysam_libcbcf); if (unlikely(!gen)) __PYX_ERR(0, 2938, __pyx_L1_error)
    __Pyx_DECREF(__pyx_cur_scope);
    __Pyx_RefNannyFinishContext();
    return (PyObject *) gen;
  }

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_AddTraceback("pysam.libcbcf.VariantRecordSamples.itervalues", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __Pyx_DECREF((PyObject *)__pyx_cur_scope);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_gb_5pysam_7libcbcf_20VariantRecordSamples_19generator21(__pyx_CoroutineObject *__pyx_generator, CYTHON_UNUSED PyThreadState *__pyx_tstate, PyObject *__pyx_sent_value) /* generator body */
{
  struct __pyx_obj_5pysam_7libcbcf___pyx_scope_struct_28_itervalues *__pyx_cur_scope = ((struct __pyx_obj_5pysam_7libcbcf___pyx_scope_struct_28_itervalues *)__pyx_generator->closure);
  PyObject *__pyx_r = NULL;
  __Pyx_TraceDeclarationsGen
  bcf_hdr_t *__pyx_t_1;
  bcf1_t *__pyx_t_2;
  uint32_t __pyx_t_3;
  int32_t __pyx_t_4;
  int32_t __pyx_t_5;
  int32_t __pyx_t_6;
  PyObject *__pyx_t_7 = NULL;
  PyObject *__pyx_t_8 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("itervalues", 0);
  switch (__pyx_generator->resume_label) {
    case 0: goto __pyx_L3_first_run;
    case 1: goto __pyx_L6_resume_from_yield;
    default: /* CPython raises the right error here */
    __Pyx_TraceStartGen("itervalues", __pyx_f[0], 2938, 0, 0, 0, __PYX_ERR(0, 2938, __pyx_L1_error));
    __Pyx_TraceReturnValue(Py_None, 0, 0, __PYX_ERR(0, 2938, __pyx_L1_error));
    __Pyx_RefNannyFinishContext();
    return NULL;
  }
  __pyx_L3_first_run:;
  __Pyx_TraceStartGen("itervalues", __pyx_f[0], 2938, 0, 0, 0, __PYX_ERR(0, 2938, __pyx_L1_error));
  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, 2938, __pyx_L1_error)
  }

  /* "pysam/libcbcf.pyx":2940
 *     def itervalues(self):
 *         """D.itervalues() -> an iterator over the values of D"""
 *         cdef bcf_hdr_t *hdr = self.record.header.ptr             # <<<<<<<<<<<<<<
 *         cdef bcf1_t *r = self.record.ptr
 *         cdef int32_t i, n = self.record.ptr.n_sample
*/
  __pyx_t_1 = __pyx_cur_scope->__pyx_v_self->record->header->ptr;
  __pyx_cur_scope->__pyx_v_hdr = __pyx_t_1;

  /* "pysam/libcbcf.pyx":2941
 *         """D.itervalues() -> an iterator over the values of D"""
 *         cdef bcf_hdr_t *hdr = self.record.header.ptr
 *         cdef bcf1_t *r = self.record.ptr             # <<<<<<<<<<<<<<
 *         cdef int32_t i, n = self.record.ptr.n_sample
 * 
*/
  __pyx_t_2 = __pyx_cur_scope->__pyx_v_self->record->ptr;
  __pyx_cur_scope->__pyx_v_r = __pyx_t_2;

  /* "pysam/libcbcf.pyx":2942
 *         cdef bcf_hdr_t *hdr = self.record.header.ptr
 *         cdef bcf1_t *r = self.record.ptr
 *         cdef int32_t i, n = self.record.ptr.n_sample             # <<<<<<<<<<<<<<
 * 
 *         for i in range(n):
*/
  __pyx_t_3 = __pyx_cur_scope->__pyx_v_self->record->ptr->n_sample;
  __pyx_cur_scope->__pyx_v_n = __pyx_t_3;

  /* "pysam/libcbcf.pyx":2944
 *         cdef int32_t i, n = self.record.ptr.n_sample
 * 
 *         for i in range(n):             # <<<<<<<<<<<<<<
 *             yield makeVariantRecordSample(self.record, i)
 * 
*/
  __pyx_t_4 = __pyx_cur_scope->__pyx_v_n;
  __pyx_t_5 = __pyx_t_4;
  for (__pyx_t_6 = 0; __pyx_t_6 < __pyx_t_5; __pyx_t_6+=1) {
    __pyx_cur_scope->__pyx_v_i = __pyx_t_6;

    /* "pysam/libcbcf.pyx":2945
 * 
 *         for i in range(n):
 *             yield makeVariantRecordSample(self.record, i)             # <<<<<<<<<<<<<<
 * 
 *     def iteritems(self):
*/
    __pyx_t_7 = ((PyObject *)__pyx_cur_scope->__pyx_v_self->record);
    __Pyx_INCREF(__pyx_t_7);
    __pyx_t_8 = ((PyObject *)__pyx_f_5pysam_7libcbcf_makeVariantRecordSample(((struct __pyx_obj_5pysam_7libcbcf_VariantRecord *)__pyx_t_7), __pyx_cur_scope->__pyx_v_i)); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 2945, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_8);
    __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
    __pyx_r = __pyx_t_8;
    __pyx_t_8 = 0;
    __pyx_cur_scope->__pyx_t_0 = __pyx_t_4;
    __pyx_cur_scope->__pyx_t_1 = __pyx_t_5;
    __pyx_cur_scope->__pyx_t_2 = __pyx_t_6;
    __Pyx_TraceYield(__pyx_r, 0, __PYX_ERR(0, 2945, __pyx_L1_error));
    __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_TraceResumeGen("itervalues", __pyx_f[0], 2938, 0, __PYX_ERR(0, 2945, __pyx_L1_error));
    __pyx_t_4 = __pyx_cur_scope->__pyx_t_0;
    __pyx_t_5 = __pyx_cur_scope->__pyx_t_1;
    __pyx_t_6 = __pyx_cur_scope->__pyx_t_2;
    if (unlikely(!__pyx_sent_value)) __PYX_ERR(0, 2945, __pyx_L1_error)
  }
  CYTHON_MAYBE_UNUSED_VAR(__pyx_cur_scope);
  __Pyx_TraceReturnValue(Py_None, 0, 0, __PYX_ERR(0, 2938, __pyx_L1_error));

  /* "pysam/libcbcf.pyx":2938
 *         return iter(self)
 * 
 *     def itervalues(self):             # <<<<<<<<<<<<<<
 *         """D.itervalues() -> an iterator over the values of D"""
 *         cdef bcf_hdr_t *hdr = self.record.header.ptr
*/

  /* function exit code */
  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_7);
  __Pyx_XDECREF(__pyx_t_8);
  if (__Pyx_PyErr_Occurred()) {
    __Pyx_TraceException(__pyx_lineno, 0, 0);
    __Pyx_Generator_Replace_StopIteration(0);
    __Pyx_AddTraceback("itervalues", __pyx_clineno, __pyx_lineno, __pyx_filename);
    __Pyx_TraceExceptionUnwind(0, 0);
  }
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_PyMonitoring_ExitScope(0);
  #if !CYTHON_USE_EXC_INFO_STACK
  __Pyx_Coroutine_ResetAndClearException(__pyx_generator);
  #endif
  __pyx_generator->resume_label = -1;
  __Pyx_Coroutine_clear((PyObject*)__pyx_generator);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}
static PyObject *__pyx_gb_5pysam_7libcbcf_20VariantRecordSamples_22generator22(__pyx_CoroutineObject *__pyx_generator, CYTHON_UNUSED PyThreadState *__pyx_tstate, PyObject *__pyx_sent_value); /* proto */

/* "pysam/libcbcf.pyx":2947
 *             yield makeVariantRecordSample(self.record, i)
 * 
 *     def iteritems(self):             # <<<<<<<<<<<<<<
 *         """D.iteritems() -> an iterator over the (key, value) items of D"""
 *         cdef bcf_hdr_t *hdr = self.record.header.ptr
*/

/* Python wrapper */
static PyObject *__pyx_pw_5pysam_7libcbcf_20VariantRecordSamples_21iteritems(PyObject *__pyx_v_self, 
#if 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_5pysam_7libcbcf_20VariantRecordSamples_20iteritems, "VariantRecordSamples.iteritems(self)\n\nD.iteritems() -> an iterator over the (key, value) items of D");
static PyMethodDef __pyx_mdef_5pysam_7libcbcf_20VariantRecordSamples_21iteritems = {"iteritems", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_5pysam_7libcbcf_20VariantRecordSamples_21iteritems, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_5pysam_7libcbcf_20VariantRecordSamples_20iteritems};
static PyObject *__pyx_pw_5pysam_7libcbcf_20VariantRecordSamples_21iteritems(PyObject *__pyx_v_self, 
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
) {
  #if !CYTHON_METH_FASTCALL
  CYTHON_UNUSED Py_ssize_t __pyx_nargs;
  #endif
  CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("iteritems (wrapper)", 0);
  #if !CYTHON_METH_FASTCALL
  #if CYTHON_ASSUME_SAFE_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("iteritems", 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("iteritems", __pyx_kwds); return NULL;}
  __pyx_r = __pyx_pf_5pysam_7libcbcf_20VariantRecordSamples_20iteritems(((struct __pyx_obj_5pysam_7libcbcf_VariantRecordSamples *)__pyx_v_self));

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

static PyObject *__pyx_pf_5pysam_7libcbcf_20VariantRecordSamples_20iteritems(struct __pyx_obj_5pysam_7libcbcf_VariantRecordSamples *__pyx_v_self) {
  struct __pyx_obj_5pysam_7libcbcf___pyx_scope_struct_29_iteritems *__pyx_cur_scope;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("iteritems", 0);
  __pyx_cur_scope = (struct __pyx_obj_5pysam_7libcbcf___pyx_scope_struct_29_iteritems *)__pyx_tp_new_5pysam_7libcbcf___pyx_scope_struct_29_iteritems(__pyx_mstate_global->__pyx_ptype_5pysam_7libcbcf___pyx_scope_struct_29_iteritems, __pyx_mstate_global->__pyx_empty_tuple, NULL);
  if (unlikely(!__pyx_cur_scope)) {
    __pyx_cur_scope = ((struct __pyx_obj_5pysam_7libcbcf___pyx_scope_struct_29_iteritems *)Py_None);
    __Pyx_INCREF(Py_None);
    __PYX_ERR(0, 2947, __pyx_L1_error)
  } else {
    __Pyx_GOTREF((PyObject *)__pyx_cur_scope);
  }
  __pyx_cur_scope->__pyx_v_self = __pyx_v_self;
  __Pyx_INCREF((PyObject *)__pyx_cur_scope->__pyx_v_self);
  __Pyx_GIVEREF((PyObject *)__pyx_cur_scope->__pyx_v_self);
  {
    __pyx_CoroutineObject *gen = __Pyx_Generator_New((__pyx_coroutine_body_t) __pyx_gb_5pysam_7libcbcf_20VariantRecordSamples_22generator22, ((PyObject *)__pyx_mstate_global->__pyx_codeobj_tab[236]), (PyObject *) __pyx_cur_scope, __pyx_mstate_global->__pyx_n_u_iteritems, __pyx_mstate_global->__pyx_n_u_VariantRecordSamples_iteritems, __pyx_mstate_global->__pyx_n_u_pysam_libcbcf); if (unlikely(!gen)) __PYX_ERR(0, 2947, __pyx_L1_error)
    __Pyx_DECREF(__pyx_cur_scope);
    __Pyx_RefNannyFinishContext();
    return (PyObject *) gen;
  }

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_AddTraceback("pysam.libcbcf.VariantRecordSamples.iteritems", __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_5pysam_7libcbcf_20VariantRecordSamples_22generator22(__pyx_CoroutineObject *__pyx_generator, CYTHON_UNUSED PyThreadState *__pyx_tstate, PyObject *__pyx_sent_value) /* generator body */
{
  struct __pyx_obj_5pysam_7libcbcf___pyx_scope_struct_29_iteritems *__pyx_cur_scope = ((struct __pyx_obj_5pysam_7libcbcf___pyx_scope_struct_29_iteritems *)__pyx_generator->closure);
  PyObject *__pyx_r = NULL;
  __Pyx_TraceDeclarationsGen
  bcf_hdr_t *__pyx_t_1;
  bcf1_t *__pyx_t_2;
  uint32_t __pyx_t_3;
  int32_t __pyx_t_4;
  int32_t __pyx_t_5;
  int32_t __pyx_t_6;
  PyObject *__pyx_t_7 = NULL;
  PyObject *__pyx_t_8 = NULL;
  PyObject *__pyx_t_9 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("iteritems", 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_TraceStartGen("iteritems", __pyx_f[0], 2947, 0, 0, 0, __PYX_ERR(0, 2947, __pyx_L1_error));
    __Pyx_TraceReturnValue(Py_None, 0, 0, __PYX_ERR(0, 2947, __pyx_L1_error));
    __Pyx_RefNannyFinishContext();
    return NULL;
  }
  __pyx_L3_first_run:;
  __Pyx_TraceStartGen("iteritems", __pyx_f[0], 2947, 0, 0, 0, __PYX_ERR(0, 2947, __pyx_L1_error));
  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, 2947, __pyx_L1_error)
  }

  /* "pysam/libcbcf.pyx":2949
 *     def iteritems(self):
 *         """D.iteritems() -> an iterator over the (key, value) items of D"""
 *         cdef bcf_hdr_t *hdr = self.record.header.ptr             # <<<<<<<<<<<<<<
 *         cdef bcf1_t *r = self.record.ptr
 *         cdef int32_t i, n = self.record.ptr.n_sample
*/
  __pyx_t_1 = __pyx_cur_scope->__pyx_v_self->record->header->ptr;
  __pyx_cur_scope->__pyx_v_hdr = __pyx_t_1;

  /* "pysam/libcbcf.pyx":2950
 *         """D.iteritems() -> an iterator over the (key, value) items of D"""
 *         cdef bcf_hdr_t *hdr = self.record.header.ptr
 *         cdef bcf1_t *r = self.record.ptr             # <<<<<<<<<<<<<<
 *         cdef int32_t i, n = self.record.ptr.n_sample
 * 
*/
  __pyx_t_2 = __pyx_cur_scope->__pyx_v_self->record->ptr;
  __pyx_cur_scope->__pyx_v_r = __pyx_t_2;

  /* "pysam/libcbcf.pyx":2951
 *         cdef bcf_hdr_t *hdr = self.record.header.ptr
 *         cdef bcf1_t *r = self.record.ptr
 *         cdef int32_t i, n = self.record.ptr.n_sample             # <<<<<<<<<<<<<<
 * 
 *         for i in range(n):
*/
  __pyx_t_3 = __pyx_cur_scope->__pyx_v_self->record->ptr->n_sample;
  __pyx_cur_scope->__pyx_v_n = __pyx_t_3;

  /* "pysam/libcbcf.pyx":2953
 *         cdef int32_t i, n = self.record.ptr.n_sample
 * 
 *         for i in range(n):             # <<<<<<<<<<<<<<
 *             yield (charptr_to_str(hdr.samples[i]), makeVariantRecordSample(self.record, i))
 * 
*/
  __pyx_t_4 = __pyx_cur_scope->__pyx_v_n;
  __pyx_t_5 = __pyx_t_4;
  for (__pyx_t_6 = 0; __pyx_t_6 < __pyx_t_5; __pyx_t_6+=1) {
    __pyx_cur_scope->__pyx_v_i = __pyx_t_6;

    /* "pysam/libcbcf.pyx":2954
 * 
 *         for i in range(n):
 *             yield (charptr_to_str(hdr.samples[i]), makeVariantRecordSample(self.record, i))             # <<<<<<<<<<<<<<
 * 
 *     def keys(self):
*/
    __pyx_t_7 = __pyx_f_5pysam_9libcutils_charptr_to_str((__pyx_cur_scope->__pyx_v_hdr->samples[__pyx_cur_scope->__pyx_v_i]), NULL); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 2954, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_7);
    __pyx_t_8 = ((PyObject *)__pyx_cur_scope->__pyx_v_self->record);
    __Pyx_INCREF(__pyx_t_8);
    __pyx_t_9 = ((PyObject *)__pyx_f_5pysam_7libcbcf_makeVariantRecordSample(((struct __pyx_obj_5pysam_7libcbcf_VariantRecord *)__pyx_t_8), __pyx_cur_scope->__pyx_v_i)); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 2954, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_9);
    __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
    __pyx_t_8 = PyTuple_New(2); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 2954, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_8);
    __Pyx_GIVEREF(__pyx_t_7);
    if (__Pyx_PyTuple_SET_ITEM(__pyx_t_8, 0, __pyx_t_7) != (0)) __PYX_ERR(0, 2954, __pyx_L1_error);
    __Pyx_GIVEREF(__pyx_t_9);
    if (__Pyx_PyTuple_SET_ITEM(__pyx_t_8, 1, __pyx_t_9) != (0)) __PYX_ERR(0, 2954, __pyx_L1_error);
    __pyx_t_7 = 0;
    __pyx_t_9 = 0;
    __pyx_r = __pyx_t_8;
    __pyx_t_8 = 0;
    __pyx_cur_scope->__pyx_t_0 = __pyx_t_4;
    __pyx_cur_scope->__pyx_t_1 = __pyx_t_5;
    __pyx_cur_scope->__pyx_t_2 = __pyx_t_6;
    __Pyx_TraceYield(__pyx_r, 0, __PYX_ERR(0, 2954, __pyx_L1_error));
    __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_TraceResumeGen("iteritems", __pyx_f[0], 2947, 0, __PYX_ERR(0, 2954, __pyx_L1_error));
    __pyx_t_4 = __pyx_cur_scope->__pyx_t_0;
    __pyx_t_5 = __pyx_cur_scope->__pyx_t_1;
    __pyx_t_6 = __pyx_cur_scope->__pyx_t_2;
    if (unlikely(!__pyx_sent_value)) __PYX_ERR(0, 2954, __pyx_L1_error)
  }
  CYTHON_MAYBE_UNUSED_VAR(__pyx_cur_scope);
  __Pyx_TraceReturnValue(Py_None, 0, 0, __PYX_ERR(0, 2947, __pyx_L1_error));

  /* "pysam/libcbcf.pyx":2947
 *             yield makeVariantRecordSample(self.record, i)
 * 
 *     def iteritems(self):             # <<<<<<<<<<<<<<
 *         """D.iteritems() -> an iterator over the (key, value) items of D"""
 *         cdef bcf_hdr_t *hdr = self.record.header.ptr
*/

  /* function exit code */
  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_7);
  __Pyx_XDECREF(__pyx_t_8);
  __Pyx_XDECREF(__pyx_t_9);
  if (__Pyx_PyErr_Occurred()) {
    __Pyx_TraceException(__pyx_lineno, 0, 0);
    __Pyx_Generator_Replace_StopIteration(0);
    __Pyx_AddTraceback("iteritems", __pyx_clineno, __pyx_lineno, __pyx_filename);
    __Pyx_TraceExceptionUnwind(0, 0);
  }
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_PyMonitoring_ExitScope(0);
  #if !CYTHON_USE_EXC_INFO_STACK
  __Pyx_Coroutine_ResetAndClearException(__pyx_generator);
  #endif
  __pyx_generator->resume_label = -1;
  __Pyx_Coroutine_clear((PyObject*)__pyx_generator);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "pysam/libcbcf.pyx":2956
 *             yield (charptr_to_str(hdr.samples[i]), makeVariantRecordSample(self.record, i))
 * 
 *     def keys(self):             # <<<<<<<<<<<<<<
 *         """D.keys() -> list of D's keys"""
 *         return list(self)
*/

/* Python wrapper */
static PyObject *__pyx_pw_5pysam_7libcbcf_20VariantRecordSamples_24keys(PyObject *__pyx_v_self, 
#if 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_5pysam_7libcbcf_20VariantRecordSamples_23keys, "VariantRecordSamples.keys(self)\n\nD.keys() -> list of D's keys");
static PyMethodDef __pyx_mdef_5pysam_7libcbcf_20VariantRecordSamples_24keys = {"keys", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_5pysam_7libcbcf_20VariantRecordSamples_24keys, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_5pysam_7libcbcf_20VariantRecordSamples_23keys};
static PyObject *__pyx_pw_5pysam_7libcbcf_20VariantRecordSamples_24keys(PyObject *__pyx_v_self, 
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
) {
  #if !CYTHON_METH_FASTCALL
  CYTHON_UNUSED Py_ssize_t __pyx_nargs;
  #endif
  CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("keys (wrapper)", 0);
  #if !CYTHON_METH_FASTCALL
  #if CYTHON_ASSUME_SAFE_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("keys", 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("keys", __pyx_kwds); return NULL;}
  __pyx_r = __pyx_pf_5pysam_7libcbcf_20VariantRecordSamples_23keys(((struct __pyx_obj_5pysam_7libcbcf_VariantRecordSamples *)__pyx_v_self));

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

static PyObject *__pyx_pf_5pysam_7libcbcf_20VariantRecordSamples_23keys(struct __pyx_obj_5pysam_7libcbcf_VariantRecordSamples *__pyx_v_self) {
  PyObject *__pyx_r = NULL;
  __Pyx_TraceDeclarationsFunc
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_TraceFrameInit(((PyObject *)__pyx_mstate_global->__pyx_codeobj_tab[237]))
  __Pyx_RefNannySetupContext("keys", 0);
  __Pyx_TraceStartFunc("keys", __pyx_f[0], 2956, 0, 0, 0, __PYX_ERR(0, 2956, __pyx_L1_error));

  /* "pysam/libcbcf.pyx":2958
 *     def keys(self):
 *         """D.keys() -> list of D's keys"""
 *         return list(self)             # <<<<<<<<<<<<<<
 * 
 *     def items(self):
*/
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = PySequence_List(((PyObject *)__pyx_v_self)); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 2958, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  __Pyx_TraceReturnValue(__pyx_r, 1, 0, __PYX_ERR(0, 2958, __pyx_L1_error));
  goto __pyx_L0;

  /* "pysam/libcbcf.pyx":2956
 *             yield (charptr_to_str(hdr.samples[i]), makeVariantRecordSample(self.record, i))
 * 
 *     def keys(self):             # <<<<<<<<<<<<<<
 *         """D.keys() -> list of D's keys"""
 *         return list(self)
*/

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_TraceException(__pyx_lineno, 0, 0);
  #if CYTHON_USE_SYS_MONITORING
  __Pyx_TraceExceptionUnwind(0, 0);
  #else
  __Pyx_TraceReturnValue(NULL, 0, 0, __PYX_ERR(0, 2956, __pyx_L1_error));
  #endif
  __Pyx_AddTraceback("pysam.libcbcf.VariantRecordSamples.keys", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_PyMonitoring_ExitScope(0);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "pysam/libcbcf.pyx":2960
 *         return list(self)
 * 
 *     def items(self):             # <<<<<<<<<<<<<<
 *         """D.items() -> list of D's (key, value) pairs, as 2-tuples"""
 *         return list(self.iteritems())
*/

/* Python wrapper */
static PyObject *__pyx_pw_5pysam_7libcbcf_20VariantRecordSamples_26items(PyObject *__pyx_v_self, 
#if 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_5pysam_7libcbcf_20VariantRecordSamples_25items, "VariantRecordSamples.items(self)\n\nD.items() -> list of D's (key, value) pairs, as 2-tuples");
static PyMethodDef __pyx_mdef_5pysam_7libcbcf_20VariantRecordSamples_26items = {"items", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_5pysam_7libcbcf_20VariantRecordSamples_26items, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_5pysam_7libcbcf_20VariantRecordSamples_25items};
static PyObject *__pyx_pw_5pysam_7libcbcf_20VariantRecordSamples_26items(PyObject *__pyx_v_self, 
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
) {
  #if !CYTHON_METH_FASTCALL
  CYTHON_UNUSED Py_ssize_t __pyx_nargs;
  #endif
  CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("items (wrapper)", 0);
  #if !CYTHON_METH_FASTCALL
  #if CYTHON_ASSUME_SAFE_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("items", 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("items", __pyx_kwds); return NULL;}
  __pyx_r = __pyx_pf_5pysam_7libcbcf_20VariantRecordSamples_25items(((struct __pyx_obj_5pysam_7libcbcf_VariantRecordSamples *)__pyx_v_self));

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

static PyObject *__pyx_pf_5pysam_7libcbcf_20VariantRecordSamples_25items(struct __pyx_obj_5pysam_7libcbcf_VariantRecordSamples *__pyx_v_self) {
  PyObject *__pyx_r = NULL;
  __Pyx_TraceDeclarationsFunc
  __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_TraceFrameInit(((PyObject *)__pyx_mstate_global->__pyx_codeobj_tab[238]))
  __Pyx_RefNannySetupContext("items", 0);
  __Pyx_TraceStartFunc("items", __pyx_f[0], 2960, 0, 0, 0, __PYX_ERR(0, 2960, __pyx_L1_error));

  /* "pysam/libcbcf.pyx":2962
 *     def items(self):
 *         """D.items() -> list of D's (key, value) pairs, as 2-tuples"""
 *         return list(self.iteritems())             # <<<<<<<<<<<<<<
 * 
 *     def values(self):
*/
  __Pyx_XDECREF(__pyx_r);
  __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(__pyx_mstate_global->__pyx_n_u_iteritems, __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, 2962, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
  }
  __pyx_t_2 = __Pyx_PySequence_ListKeepNew(__pyx_t_1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 2962, __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;
  __Pyx_TraceReturnValue(__pyx_r, 1, 0, __PYX_ERR(0, 2962, __pyx_L1_error));
  goto __pyx_L0;

  /* "pysam/libcbcf.pyx":2960
 *         return list(self)
 * 
 *     def items(self):             # <<<<<<<<<<<<<<
 *         """D.items() -> list of D's (key, value) pairs, as 2-tuples"""
 *         return list(self.iteritems())
*/

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_TraceException(__pyx_lineno, 0, 0);
  #if CYTHON_USE_SYS_MONITORING
  __Pyx_TraceExceptionUnwind(0, 0);
  #else
  __Pyx_TraceReturnValue(NULL, 0, 0, __PYX_ERR(0, 2960, __pyx_L1_error));
  #endif
  __Pyx_AddTraceback("pysam.libcbcf.VariantRecordSamples.items", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_PyMonitoring_ExitScope(0);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "pysam/libcbcf.pyx":2964
 *         return list(self.iteritems())
 * 
 *     def values(self):             # <<<<<<<<<<<<<<
 *         """D.values() -> list of D's values"""
 *         return list(self.itervalues())
*/

/* Python wrapper */
static PyObject *__pyx_pw_5pysam_7libcbcf_20VariantRecordSamples_28values(PyObject *__pyx_v_self, 
#if 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_5pysam_7libcbcf_20VariantRecordSamples_27values, "VariantRecordSamples.values(self)\n\nD.values() -> list of D's values");
static PyMethodDef __pyx_mdef_5pysam_7libcbcf_20VariantRecordSamples_28values = {"values", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_5pysam_7libcbcf_20VariantRecordSamples_28values, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_5pysam_7libcbcf_20VariantRecordSamples_27values};
static PyObject *__pyx_pw_5pysam_7libcbcf_20VariantRecordSamples_28values(PyObject *__pyx_v_self, 
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
) {
  #if !CYTHON_METH_FASTCALL
  CYTHON_UNUSED Py_ssize_t __pyx_nargs;
  #endif
  CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("values (wrapper)", 0);
  #if !CYTHON_METH_FASTCALL
  #if CYTHON_ASSUME_SAFE_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("values", 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("values", __pyx_kwds); return NULL;}
  __pyx_r = __pyx_pf_5pysam_7libcbcf_20VariantRecordSamples_27values(((struct __pyx_obj_5pysam_7libcbcf_VariantRecordSamples *)__pyx_v_self));

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

static PyObject *__pyx_pf_5pysam_7libcbcf_20VariantRecordSamples_27values(struct __pyx_obj_5pysam_7libcbcf_VariantRecordSamples *__pyx_v_self) {
  PyObject *__pyx_r = NULL;
  __Pyx_TraceDeclarationsFunc
  __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_TraceFrameInit(((PyObject *)__pyx_mstate_global->__pyx_codeobj_tab[239]))
  __Pyx_RefNannySetupContext("values", 0);
  __Pyx_TraceStartFunc("values", __pyx_f[0], 2964, 0, 0, 0, __PYX_ERR(0, 2964, __pyx_L1_error));

  /* "pysam/libcbcf.pyx":2966
 *     def values(self):
 *         """D.values() -> list of D's values"""
 *         return list(self.itervalues())             # <<<<<<<<<<<<<<
 * 
 *     def update(self, items=None, **kwargs):
*/
  __Pyx_XDECREF(__pyx_r);
  __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(__pyx_mstate_global->__pyx_n_u_itervalues, __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, 2966, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
  }
  __pyx_t_2 = __Pyx_PySequence_ListKeepNew(__pyx_t_1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 2966, __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;
  __Pyx_TraceReturnValue(__pyx_r, 1, 0, __PYX_ERR(0, 2966, __pyx_L1_error));
  goto __pyx_L0;

  /* "pysam/libcbcf.pyx":2964
 *         return list(self.iteritems())
 * 
 *     def values(self):             # <<<<<<<<<<<<<<
 *         """D.values() -> list of D's values"""
 *         return list(self.itervalues())
*/

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_TraceException(__pyx_lineno, 0, 0);
  #if CYTHON_USE_SYS_MONITORING
  __Pyx_TraceExceptionUnwind(0, 0);
  #else
  __Pyx_TraceReturnValue(NULL, 0, 0, __PYX_ERR(0, 2964, __pyx_L1_error));
  #endif
  __Pyx_AddTraceback("pysam.libcbcf.VariantRecordSamples.values", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_PyMonitoring_ExitScope(0);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "pysam/libcbcf.pyx":2968
 *         return list(self.itervalues())
 * 
 *     def update(self, items=None, **kwargs):             # <<<<<<<<<<<<<<
 *         """D.update([E, ]**F) -> None.
 * 
*/

/* Python wrapper */
static PyObject *__pyx_pw_5pysam_7libcbcf_20VariantRecordSamples_30update(PyObject *__pyx_v_self, 
#if 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_5pysam_7libcbcf_20VariantRecordSamples_29update, "VariantRecordSamples.update(self, items=None, **kwargs)\n\nD.update([E, ]**F) -> None.\n\nUpdate D from dict/iterable E and F.");
static PyMethodDef __pyx_mdef_5pysam_7libcbcf_20VariantRecordSamples_30update = {"update", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_5pysam_7libcbcf_20VariantRecordSamples_30update, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_5pysam_7libcbcf_20VariantRecordSamples_29update};
static PyObject *__pyx_pw_5pysam_7libcbcf_20VariantRecordSamples_30update(PyObject *__pyx_v_self, 
#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_items = 0;
  PyObject *__pyx_v_kwargs = 0;
  #if !CYTHON_METH_FASTCALL
  CYTHON_UNUSED Py_ssize_t __pyx_nargs;
  #endif
  CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
  PyObject* values[1] = {0};
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("update (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_kwargs = PyDict_New(); if (unlikely(!__pyx_v_kwargs)) return NULL;
  __Pyx_GOTREF(__pyx_v_kwargs);
  {
    PyObject ** const __pyx_pyargnames[] = {&__pyx_mstate_global->__pyx_n_u_items,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, 2968, __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, 2968, __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, __pyx_v_kwargs, values, kwd_pos_args, __pyx_kwds_len, "update", 1) < 0) __PYX_ERR(0, 2968, __pyx_L3_error)
      if (!values[0]) values[0] = __Pyx_NewRef(((PyObject *)Py_None));
    } 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, 2968, __pyx_L3_error)
        CYTHON_FALLTHROUGH;
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      if (!values[0]) values[0] = __Pyx_NewRef(((PyObject *)Py_None));
    }
    __pyx_v_items = values[0];
  }
  goto __pyx_L6_skip;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("update", 0, 0, 1, __pyx_nargs); __PYX_ERR(0, 2968, __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_kwargs); __pyx_v_kwargs = 0;
  __Pyx_AddTraceback("pysam.libcbcf.VariantRecordSamples.update", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_5pysam_7libcbcf_20VariantRecordSamples_29update(((struct __pyx_obj_5pysam_7libcbcf_VariantRecordSamples *)__pyx_v_self), __pyx_v_items, __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_kwargs);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_5pysam_7libcbcf_20VariantRecordSamples_29update(struct __pyx_obj_5pysam_7libcbcf_VariantRecordSamples *__pyx_v_self, PyObject *__pyx_v_items, PyObject *__pyx_v_kwargs) {
  PyObject *__pyx_v_k = NULL;
  PyObject *__pyx_v_v = NULL;
  PyObject *__pyx_r = NULL;
  __Pyx_TraceDeclarationsFunc
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  Py_ssize_t __pyx_t_2;
  Py_ssize_t __pyx_t_3;
  int __pyx_t_4;
  PyObject *__pyx_t_5 = NULL;
  PyObject *__pyx_t_6 = NULL;
  int __pyx_t_7;
  int __pyx_t_8;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_TraceFrameInit(((PyObject *)__pyx_mstate_global->__pyx_codeobj_tab[240]))
  __Pyx_RefNannySetupContext("update", 0);
  __Pyx_TraceStartFunc("update", __pyx_f[0], 2968, 0, 0, 0, __PYX_ERR(0, 2968, __pyx_L1_error));

  /* "pysam/libcbcf.pyx":2973
 *         Update D from dict/iterable E and F.
 *         """
 *         for k, v in items.items():             # <<<<<<<<<<<<<<
 *             self[k] = v
 * 
*/
  __pyx_t_2 = 0;
  if (unlikely(__pyx_v_items == Py_None)) {
    PyErr_Format(PyExc_AttributeError, "'NoneType' object has no attribute '%.30s'", "items");
    __PYX_ERR(0, 2973, __pyx_L1_error)
  }
  __pyx_t_5 = __Pyx_dict_iterator(__pyx_v_items, 0, __pyx_mstate_global->__pyx_n_u_items, (&__pyx_t_3), (&__pyx_t_4)); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 2973, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_5);
  __Pyx_XDECREF(__pyx_t_1);
  __pyx_t_1 = __pyx_t_5;
  __pyx_t_5 = 0;
  while (1) {
    __pyx_t_7 = __Pyx_dict_iter_next(__pyx_t_1, __pyx_t_3, &__pyx_t_2, &__pyx_t_5, &__pyx_t_6, NULL, __pyx_t_4);
    if (unlikely(__pyx_t_7 == 0)) break;
    if (unlikely(__pyx_t_7 == -1)) __PYX_ERR(0, 2973, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_5);
    __Pyx_GOTREF(__pyx_t_6);
    __Pyx_XDECREF_SET(__pyx_v_k, __pyx_t_5);
    __pyx_t_5 = 0;
    __Pyx_XDECREF_SET(__pyx_v_v, __pyx_t_6);
    __pyx_t_6 = 0;

    /* "pysam/libcbcf.pyx":2974
 *         """
 *         for k, v in items.items():
 *             self[k] = v             # <<<<<<<<<<<<<<
 * 
 *         if kwargs:
*/
    if (unlikely((PyObject_SetItem(((PyObject *)__pyx_v_self), __pyx_v_k, __pyx_v_v) < 0))) __PYX_ERR(0, 2974, __pyx_L1_error)
  }
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "pysam/libcbcf.pyx":2976
 *             self[k] = v
 * 
 *         if kwargs:             # <<<<<<<<<<<<<<
 *             for k, v in kwargs.items():
 *                 self[k] = v
*/
  __pyx_t_8 = __Pyx_PyObject_IsTrue(__pyx_v_kwargs); if (unlikely((__pyx_t_8 < 0))) __PYX_ERR(0, 2976, __pyx_L1_error)
  if (__pyx_t_8) {

    /* "pysam/libcbcf.pyx":2977
 * 
 *         if kwargs:
 *             for k, v in kwargs.items():             # <<<<<<<<<<<<<<
 *                 self[k] = v
 * 
*/
    __pyx_t_3 = 0;
    __pyx_t_6 = __Pyx_dict_iterator(__pyx_v_kwargs, 1, __pyx_mstate_global->__pyx_n_u_items, (&__pyx_t_2), (&__pyx_t_4)); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 2977, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_6);
    __Pyx_XDECREF(__pyx_t_1);
    __pyx_t_1 = __pyx_t_6;
    __pyx_t_6 = 0;
    while (1) {
      __pyx_t_7 = __Pyx_dict_iter_next(__pyx_t_1, __pyx_t_2, &__pyx_t_3, &__pyx_t_6, &__pyx_t_5, NULL, __pyx_t_4);
      if (unlikely(__pyx_t_7 == 0)) break;
      if (unlikely(__pyx_t_7 == -1)) __PYX_ERR(0, 2977, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_6);
      __Pyx_GOTREF(__pyx_t_5);
      __Pyx_XDECREF_SET(__pyx_v_k, __pyx_t_6);
      __pyx_t_6 = 0;
      __Pyx_XDECREF_SET(__pyx_v_v, __pyx_t_5);
      __pyx_t_5 = 0;

      /* "pysam/libcbcf.pyx":2978
 *         if kwargs:
 *             for k, v in kwargs.items():
 *                 self[k] = v             # <<<<<<<<<<<<<<
 * 
 *     def pop(self, key, default=_nothing):
*/
      if (unlikely((PyObject_SetItem(((PyObject *)__pyx_v_self), __pyx_v_k, __pyx_v_v) < 0))) __PYX_ERR(0, 2978, __pyx_L1_error)
    }
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

    /* "pysam/libcbcf.pyx":2976
 *             self[k] = v
 * 
 *         if kwargs:             # <<<<<<<<<<<<<<
 *             for k, v in kwargs.items():
 *                 self[k] = v
*/
  }

  /* "pysam/libcbcf.pyx":2968
 *         return list(self.itervalues())
 * 
 *     def update(self, items=None, **kwargs):             # <<<<<<<<<<<<<<
 *         """D.update([E, ]**F) -> None.
 * 
*/

  /* function exit code */
  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  __Pyx_TraceReturnValue(__pyx_r, 0, 0, __PYX_ERR(0, 2968, __pyx_L1_error));
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_5);
  __Pyx_XDECREF(__pyx_t_6);
  __Pyx_TraceException(__pyx_lineno, 0, 0);
  #if CYTHON_USE_SYS_MONITORING
  __Pyx_TraceExceptionUnwind(0, 0);
  #else
  __Pyx_TraceReturnValue(NULL, 0, 0, __PYX_ERR(0, 2968, __pyx_L1_error));
  #endif
  __Pyx_AddTraceback("pysam.libcbcf.VariantRecordSamples.update", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_k);
  __Pyx_XDECREF(__pyx_v_v);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_PyMonitoring_ExitScope(0);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "pysam/libcbcf.pyx":2980
 *                 self[k] = v
 * 
 *     def pop(self, key, default=_nothing):             # <<<<<<<<<<<<<<
 *         try:
 *             value = self[key]
*/

/* Python wrapper */
static PyObject *__pyx_pw_5pysam_7libcbcf_20VariantRecordSamples_32pop(PyObject *__pyx_v_self, 
#if 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_5pysam_7libcbcf_20VariantRecordSamples_31pop, "VariantRecordSamples.pop(self, key, default=_nothing)");
static PyMethodDef __pyx_mdef_5pysam_7libcbcf_20VariantRecordSamples_32pop = {"pop", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_5pysam_7libcbcf_20VariantRecordSamples_32pop, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_5pysam_7libcbcf_20VariantRecordSamples_31pop};
static PyObject *__pyx_pw_5pysam_7libcbcf_20VariantRecordSamples_32pop(PyObject *__pyx_v_self, 
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
) {
  PyObject *__pyx_v_key = 0;
  PyObject *__pyx_v_default = 0;
  #if !CYTHON_METH_FASTCALL
  CYTHON_UNUSED Py_ssize_t __pyx_nargs;
  #endif
  CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
  PyObject* values[2] = {0,0};
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("pop (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,&__pyx_mstate_global->__pyx_n_u_default,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, 2980, __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, 2980, __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, 2980, __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, "pop", 0) < 0) __PYX_ERR(0, 2980, __pyx_L3_error)
      if (!values[1]) values[1] = __Pyx_NewRef(__pyx_mstate_global->__pyx_k__7);
      for (Py_ssize_t i = __pyx_nargs; i < 1; i++) {
        if (unlikely(!values[i])) { __Pyx_RaiseArgtupleInvalid("pop", 0, 1, 2, i); __PYX_ERR(0, 2980, __pyx_L3_error) }
      }
    } 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, 2980, __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, 2980, __pyx_L3_error)
        break;
        default: goto __pyx_L5_argtuple_error;
      }
      if (!values[1]) values[1] = __Pyx_NewRef(__pyx_mstate_global->__pyx_k__7);
    }
    __pyx_v_key = values[0];
    __pyx_v_default = values[1];
  }
  goto __pyx_L6_skip;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("pop", 0, 1, 2, __pyx_nargs); __PYX_ERR(0, 2980, __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("pysam.libcbcf.VariantRecordSamples.pop", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_5pysam_7libcbcf_20VariantRecordSamples_31pop(((struct __pyx_obj_5pysam_7libcbcf_VariantRecordSamples *)__pyx_v_self), __pyx_v_key, __pyx_v_default);

  /* 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_5pysam_7libcbcf_20VariantRecordSamples_31pop(struct __pyx_obj_5pysam_7libcbcf_VariantRecordSamples *__pyx_v_self, PyObject *__pyx_v_key, PyObject *__pyx_v_default) {
  PyObject *__pyx_v_value = NULL;
  PyObject *__pyx_r = NULL;
  __Pyx_TraceDeclarationsFunc
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  PyObject *__pyx_t_4 = NULL;
  int __pyx_t_5;
  PyObject *__pyx_t_6 = NULL;
  PyObject *__pyx_t_7 = NULL;
  int __pyx_t_8;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_TraceFrameInit(((PyObject *)__pyx_mstate_global->__pyx_codeobj_tab[241]))
  __Pyx_RefNannySetupContext("pop", 0);
  __Pyx_TraceStartFunc("pop", __pyx_f[0], 2980, 0, 0, 0, __PYX_ERR(0, 2980, __pyx_L1_error));

  /* "pysam/libcbcf.pyx":2981
 * 
 *     def pop(self, key, default=_nothing):
 *         try:             # <<<<<<<<<<<<<<
 *             value = self[key]
 *             del self[key]
*/
  {
    __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:*/ {

      /* "pysam/libcbcf.pyx":2982
 *     def pop(self, key, default=_nothing):
 *         try:
 *             value = self[key]             # <<<<<<<<<<<<<<
 *             del self[key]
 *             return value
*/
      __pyx_t_4 = __Pyx_PyObject_GetItem(((PyObject *)__pyx_v_self), __pyx_v_key); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 2982, __pyx_L3_error)
      __Pyx_GOTREF(__pyx_t_4);
      __pyx_v_value = __pyx_t_4;
      __pyx_t_4 = 0;

      /* "pysam/libcbcf.pyx":2983
 *         try:
 *             value = self[key]
 *             del self[key]             # <<<<<<<<<<<<<<
 *             return value
 *         except KeyError:
*/
      if (unlikely((PyObject_DelItem(((PyObject *)__pyx_v_self), __pyx_v_key) < 0))) __PYX_ERR(0, 2983, __pyx_L3_error)

      /* "pysam/libcbcf.pyx":2984
 *             value = self[key]
 *             del self[key]
 *             return value             # <<<<<<<<<<<<<<
 *         except KeyError:
 *             if default is not _nothing:
*/
      __Pyx_XDECREF(__pyx_r);
      __Pyx_INCREF(__pyx_v_value);
      __pyx_r = __pyx_v_value;
      __Pyx_TraceReturnValue(__pyx_r, 11, 0, __PYX_ERR(0, 2984, __pyx_L3_error));
      goto __pyx_L7_try_return;

      /* "pysam/libcbcf.pyx":2981
 * 
 *     def pop(self, key, default=_nothing):
 *         try:             # <<<<<<<<<<<<<<
 *             value = self[key]
 *             del self[key]
*/
    }
    __pyx_L3_error:;
    __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
    __Pyx_TraceException(__pyx_lineno, 0, 0);

    /* "pysam/libcbcf.pyx":2985
 *             del self[key]
 *             return value
 *         except KeyError:             # <<<<<<<<<<<<<<
 *             if default is not _nothing:
 *                 return default
*/
    __pyx_t_5 = __Pyx_PyErr_ExceptionMatches(__pyx_builtin_KeyError);
    if (__pyx_t_5) {
      __Pyx_AddTraceback("pysam.libcbcf.VariantRecordSamples.pop", __pyx_clineno, __pyx_lineno, __pyx_filename);
      __Pyx_TraceExceptionHandled(0);
      if (__Pyx_GetException(&__pyx_t_4, &__pyx_t_6, &__pyx_t_7) < 0) __PYX_ERR(0, 2985, __pyx_L5_except_error)
      __Pyx_XGOTREF(__pyx_t_4);
      __Pyx_XGOTREF(__pyx_t_6);
      __Pyx_XGOTREF(__pyx_t_7);
      __Pyx_TraceExceptionDone();

      /* "pysam/libcbcf.pyx":2986
 *             return value
 *         except KeyError:
 *             if default is not _nothing:             # <<<<<<<<<<<<<<
 *                 return default
 *             raise
*/
      __pyx_t_8 = (__pyx_v_default != __pyx_v_5pysam_7libcbcf__nothing);
      if (__pyx_t_8) {

        /* "pysam/libcbcf.pyx":2987
 *         except KeyError:
 *             if default is not _nothing:
 *                 return default             # <<<<<<<<<<<<<<
 *             raise
 * 
*/
        __Pyx_XDECREF(__pyx_r);
        __Pyx_INCREF(__pyx_v_default);
        __pyx_r = __pyx_v_default;
        __Pyx_TraceReturnValue(__pyx_r, 18, 0, __PYX_ERR(0, 2987, __pyx_L5_except_error));
        __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;

        /* "pysam/libcbcf.pyx":2986
 *             return value
 *         except KeyError:
 *             if default is not _nothing:             # <<<<<<<<<<<<<<
 *                 return default
 *             raise
*/
      }

      /* "pysam/libcbcf.pyx":2988
 *             if default is not _nothing:
 *                 return default
 *             raise             # <<<<<<<<<<<<<<
 * 
 *     def __richcmp__(VariantRecordSamples self not None, VariantRecordSamples other not None, int op):
*/
      __Pyx_GIVEREF(__pyx_t_4);
      __Pyx_GIVEREF(__pyx_t_6);
      __Pyx_XGIVEREF(__pyx_t_7);
      __Pyx_ErrRestoreWithState(__pyx_t_4, __pyx_t_6, __pyx_t_7);
      __pyx_t_4 = 0;  __pyx_t_6 = 0;  __pyx_t_7 = 0; 
      __Pyx_TraceException(20, 1, 0);
      __PYX_ERR(0, 2988, __pyx_L5_except_error)
    }
    goto __pyx_L5_except_error;

    /* "pysam/libcbcf.pyx":2981
 * 
 *     def pop(self, key, default=_nothing):
 *         try:             # <<<<<<<<<<<<<<
 *             value = self[key]
 *             del self[key]
*/
    __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;
  }

  /* "pysam/libcbcf.pyx":2980
 *                 self[k] = v
 * 
 *     def pop(self, key, default=_nothing):             # <<<<<<<<<<<<<<
 *         try:
 *             value = self[key]
*/

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_XDECREF(__pyx_t_6);
  __Pyx_XDECREF(__pyx_t_7);
  __Pyx_TraceException(__pyx_lineno, 0, 0);
  #if CYTHON_USE_SYS_MONITORING
  __Pyx_TraceExceptionUnwind(0, 0);
  #else
  __Pyx_TraceReturnValue(NULL, 0, 0, __PYX_ERR(0, 2980, __pyx_L1_error));
  #endif
  __Pyx_AddTraceback("pysam.libcbcf.VariantRecordSamples.pop", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_value);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_PyMonitoring_ExitScope(0);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "pysam/libcbcf.pyx":2990
 *             raise
 * 
 *     def __richcmp__(VariantRecordSamples self not None, VariantRecordSamples other not None, int op):             # <<<<<<<<<<<<<<
 *         if op != 2 and op != 3:
 *             return NotImplemented
*/

/* Python wrapper */
static PyObject *__pyx_pw_5pysam_7libcbcf_20VariantRecordSamples_34__richcmp__(PyObject *__pyx_v_self, PyObject *__pyx_v_other, int __pyx_v_op); /*proto*/
static PyObject *__pyx_pw_5pysam_7libcbcf_20VariantRecordSamples_34__richcmp__(PyObject *__pyx_v_self, PyObject *__pyx_v_other, int __pyx_v_op) {
  CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__richcmp__ (wrapper)", 0);
  __pyx_kwvalues = __Pyx_KwValues_VARARGS(__pyx_args, __pyx_nargs);
  if (unlikely(((PyObject *)__pyx_v_self) == Py_None)) {
    PyErr_Format(PyExc_TypeError, "Argument '%.200s' must not be None", "self"); __PYX_ERR(0, 2990, __pyx_L1_error)
  }
  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_other), __pyx_mstate_global->__pyx_ptype_5pysam_7libcbcf_VariantRecordSamples, 0, "other", 0))) __PYX_ERR(0, 2990, __pyx_L1_error)
  __pyx_r = __pyx_pf_5pysam_7libcbcf_20VariantRecordSamples_33__richcmp__(((struct __pyx_obj_5pysam_7libcbcf_VariantRecordSamples *)__pyx_v_self), ((struct __pyx_obj_5pysam_7libcbcf_VariantRecordSamples *)__pyx_v_other), ((int)__pyx_v_op));

  /* function exit code */
  goto __pyx_L0;
  __pyx_L1_error:;
  __pyx_r = NULL;
  goto __pyx_L5_cleaned_up;
  __pyx_L0:;
  __pyx_L5_cleaned_up:;
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_5pysam_7libcbcf_20VariantRecordSamples_33__richcmp__(struct __pyx_obj_5pysam_7libcbcf_VariantRecordSamples *__pyx_v_self, struct __pyx_obj_5pysam_7libcbcf_VariantRecordSamples *__pyx_v_other, int __pyx_v_op) {
  bcf1_t *__pyx_v_s;
  bcf1_t *__pyx_v_o;
  int __pyx_v_cmp;
  PyObject *__pyx_r = NULL;
  __Pyx_TraceDeclarationsFunc
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  bcf1_t *__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_TraceFrameInit(((PyObject *)__pyx_mstate_global->__pyx_codeobj_tab[242]))
  __Pyx_RefNannySetupContext("__richcmp__", 0);
  __Pyx_TraceStartFunc("__richcmp__", __pyx_f[0], 2990, 0, 0, 0, __PYX_ERR(0, 2990, __pyx_L1_error));

  /* "pysam/libcbcf.pyx":2991
 * 
 *     def __richcmp__(VariantRecordSamples self not None, VariantRecordSamples other not None, int op):
 *         if op != 2 and op != 3:             # <<<<<<<<<<<<<<
 *             return NotImplemented
 * 
*/
  switch (__pyx_v_op) {
    case 2:
    case 3:
    __pyx_t_1 = 0;
    break;
    default:
    __pyx_t_1 = 1;
    break;
  }
  if (__pyx_t_1) {

    /* "pysam/libcbcf.pyx":2992
 *     def __richcmp__(VariantRecordSamples self not None, VariantRecordSamples other not None, int op):
 *         if op != 2 and op != 3:
 *             return NotImplemented             # <<<<<<<<<<<<<<
 * 
 *         cdef bcf1_t *s = self.record.ptr
*/
    __Pyx_XDECREF(__pyx_r);
    __Pyx_INCREF(__pyx_builtin_NotImplemented);
    __pyx_r = __pyx_builtin_NotImplemented;
    __Pyx_TraceReturnValue(__pyx_r, 9, 0, __PYX_ERR(0, 2992, __pyx_L1_error));
    goto __pyx_L0;

    /* "pysam/libcbcf.pyx":2991
 * 
 *     def __richcmp__(VariantRecordSamples self not None, VariantRecordSamples other not None, int op):
 *         if op != 2 and op != 3:             # <<<<<<<<<<<<<<
 *             return NotImplemented
 * 
*/
  }

  /* "pysam/libcbcf.pyx":2994
 *             return NotImplemented
 * 
 *         cdef bcf1_t *s = self.record.ptr             # <<<<<<<<<<<<<<
 *         cdef bcf1_t *o = other.record.ptr
 * 
*/
  __pyx_t_2 = __pyx_v_self->record->ptr;
  __pyx_v_s = __pyx_t_2;

  /* "pysam/libcbcf.pyx":2995
 * 
 *         cdef bcf1_t *s = self.record.ptr
 *         cdef bcf1_t *o = other.record.ptr             # <<<<<<<<<<<<<<
 * 
 *         cdef bint cmp = (s.n_sample == o.n_sample and self.values() == other.values())
*/
  __pyx_t_2 = __pyx_v_other->record->ptr;
  __pyx_v_o = __pyx_t_2;

  /* "pysam/libcbcf.pyx":2997
 *         cdef bcf1_t *o = other.record.ptr
 * 
 *         cdef bint cmp = (s.n_sample == o.n_sample and self.values() == other.values())             # <<<<<<<<<<<<<<
 * 
 *         if op == 3:
*/
  __pyx_t_3 = (__pyx_v_s->n_sample == __pyx_v_o->n_sample);
  if (__pyx_t_3) {
  } else {
    __pyx_t_1 = __pyx_t_3;
    goto __pyx_L4_bool_binop_done;
  }
  __pyx_t_5 = ((PyObject *)__pyx_v_self);
  __Pyx_INCREF(__pyx_t_5);
  __pyx_t_6 = 0;
  {
    PyObject *__pyx_callargs[2] = {__pyx_t_5, NULL};
    __pyx_t_4 = __Pyx_PyObject_FastCallMethod(__pyx_mstate_global->__pyx_n_u_values, __pyx_callargs+__pyx_t_6, (1-__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(0, 2997, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
  }
  __pyx_t_7 = ((PyObject *)__pyx_v_other);
  __Pyx_INCREF(__pyx_t_7);
  __pyx_t_6 = 0;
  {
    PyObject *__pyx_callargs[2] = {__pyx_t_7, NULL};
    __pyx_t_5 = __Pyx_PyObject_FastCallMethod(__pyx_mstate_global->__pyx_n_u_values, __pyx_callargs+__pyx_t_6, (1-__pyx_t_6) | (1*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
    __Pyx_XDECREF(__pyx_t_7); __pyx_t_7 = 0;
    if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 2997, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_5);
  }
  __pyx_t_7 = PyObject_RichCompare(__pyx_t_4, __pyx_t_5, Py_EQ); __Pyx_XGOTREF(__pyx_t_7); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 2997, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  __pyx_t_3 = __Pyx_PyObject_IsTrue(__pyx_t_7); if (unlikely((__pyx_t_3 < 0))) __PYX_ERR(0, 2997, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
  __pyx_t_1 = __pyx_t_3;
  __pyx_L4_bool_binop_done:;
  __pyx_v_cmp = __pyx_t_1;

  /* "pysam/libcbcf.pyx":2999
 *         cdef bint cmp = (s.n_sample == o.n_sample and self.values() == other.values())
 * 
 *         if op == 3:             # <<<<<<<<<<<<<<
 *             cmp = not cmp
 * 
*/
  __pyx_t_1 = (__pyx_v_op == 3);
  if (__pyx_t_1) {

    /* "pysam/libcbcf.pyx":3000
 * 
 *         if op == 3:
 *             cmp = not cmp             # <<<<<<<<<<<<<<
 * 
 *         return cmp
*/
    __pyx_v_cmp = (!__pyx_v_cmp);

    /* "pysam/libcbcf.pyx":2999
 *         cdef bint cmp = (s.n_sample == o.n_sample and self.values() == other.values())
 * 
 *         if op == 3:             # <<<<<<<<<<<<<<
 *             cmp = not cmp
 * 
*/
  }

  /* "pysam/libcbcf.pyx":3002
 *             cmp = not cmp
 * 
 *         return cmp             # <<<<<<<<<<<<<<
 * 
 *     # Mappings are not hashable by default, but subclasses can change this
*/
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_7 = __Pyx_PyBool_FromLong(__pyx_v_cmp); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 3002, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_7);
  __pyx_r = __pyx_t_7;
  __pyx_t_7 = 0;
  __Pyx_TraceReturnValue(__pyx_r, 40, 0, __PYX_ERR(0, 3002, __pyx_L1_error));
  goto __pyx_L0;

  /* "pysam/libcbcf.pyx":2990
 *             raise
 * 
 *     def __richcmp__(VariantRecordSamples self not None, VariantRecordSamples other not None, int op):             # <<<<<<<<<<<<<<
 *         if op != 2 and op != 3:
 *             return NotImplemented
*/

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_XDECREF(__pyx_t_5);
  __Pyx_XDECREF(__pyx_t_7);
  __Pyx_TraceException(__pyx_lineno, 0, 0);
  #if CYTHON_USE_SYS_MONITORING
  __Pyx_TraceExceptionUnwind(0, 0);
  #else
  __Pyx_TraceReturnValue(NULL, 0, 0, __PYX_ERR(0, 2990, __pyx_L1_error));
  #endif
  __Pyx_AddTraceback("pysam.libcbcf.VariantRecordSamples.__richcmp__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_PyMonitoring_ExitScope(0);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

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

/* Python wrapper */
static PyObject *__pyx_pw_5pysam_7libcbcf_20VariantRecordSamples_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*/
PyDoc_STRVAR(__pyx_doc_5pysam_7libcbcf_20VariantRecordSamples_35__reduce_cython__, "VariantRecordSamples.__reduce_cython__(self)");
static PyMethodDef __pyx_mdef_5pysam_7libcbcf_20VariantRecordSamples_36__reduce_cython__ = {"__reduce_cython__", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_5pysam_7libcbcf_20VariantRecordSamples_36__reduce_cython__, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_5pysam_7libcbcf_20VariantRecordSamples_35__reduce_cython__};
static PyObject *__pyx_pw_5pysam_7libcbcf_20VariantRecordSamples_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_5pysam_7libcbcf_20VariantRecordSamples_35__reduce_cython__(((struct __pyx_obj_5pysam_7libcbcf_VariantRecordSamples *)__pyx_v_self));

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

static PyObject *__pyx_pf_5pysam_7libcbcf_20VariantRecordSamples_35__reduce_cython__(struct __pyx_obj_5pysam_7libcbcf_VariantRecordSamples *__pyx_v_self) {
  PyObject *__pyx_v_state = 0;
  PyObject *__pyx_v__dict = 0;
  int __pyx_v_use_setstate;
  PyObject *__pyx_r = NULL;
  __Pyx_TraceDeclarationsFunc
  __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_TraceFrameInit(((PyObject *)__pyx_mstate_global->__pyx_codeobj_tab[243]))
  __Pyx_RefNannySetupContext("__reduce_cython__", 0);
  __Pyx_TraceStartFunc("__reduce_cython__", __pyx_f[4], 1, 0, 0, 0, __PYX_ERR(4, 1, __pyx_L1_error));

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

  /* "(tree fragment)":6
 *     cdef bint use_setstate
 *     state = (self.record,)
 *     _dict = getattr(self, '__dict__', None)             # <<<<<<<<<<<<<<
 *     if _dict is not None:
 *         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(4, 6, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_v__dict = __pyx_t_1;
  __pyx_t_1 = 0;

  /* "(tree fragment)":7
 *     state = (self.record,)
 *     _dict = getattr(self, '__dict__', None)
 *     if _dict is not None:             # <<<<<<<<<<<<<<
 *         state += (_dict,)
 *         use_setstate = True
*/
  __pyx_t_2 = (__pyx_v__dict != Py_None);
  if (__pyx_t_2) {

    /* "(tree fragment)":8
 *     _dict = getattr(self, '__dict__', None)
 *     if _dict is not None:
 *         state += (_dict,)             # <<<<<<<<<<<<<<
 *         use_setstate = True
 *     else:
*/
    __pyx_t_1 = PyTuple_New(1); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 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(4, 8, __pyx_L1_error);
    __pyx_t_3 = PyNumber_InPlaceAdd(__pyx_v_state, __pyx_t_1); if (unlikely(!__pyx_t_3)) __PYX_ERR(4, 8, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    __Pyx_DECREF_SET(__pyx_v_state, ((PyObject*)__pyx_t_3));
    __pyx_t_3 = 0;

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

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

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

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

    /* "(tree fragment)":13
 *         use_setstate = self.record is not None
 *     if use_setstate:
 *         return __pyx_unpickle_VariantRecordSamples, (type(self), 0x70ce871, None), state             # <<<<<<<<<<<<<<
 *     else:
 *         return __pyx_unpickle_VariantRecordSamples, (type(self), 0x70ce871, state)
*/
    __Pyx_XDECREF(__pyx_r);
    __Pyx_GetModuleGlobalName(__pyx_t_3, __pyx_mstate_global->__pyx_n_u_pyx_unpickle_VariantRecordSamp); if (unlikely(!__pyx_t_3)) __PYX_ERR(4, 13, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __pyx_t_1 = PyTuple_New(3); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 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(4, 13, __pyx_L1_error);
    __Pyx_INCREF(__pyx_mstate_global->__pyx_int_118286449);
    __Pyx_GIVEREF(__pyx_mstate_global->__pyx_int_118286449);
    if (__Pyx_PyTuple_SET_ITEM(__pyx_t_1, 1, __pyx_mstate_global->__pyx_int_118286449) != (0)) __PYX_ERR(4, 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(4, 13, __pyx_L1_error);
    __pyx_t_4 = PyTuple_New(3); if (unlikely(!__pyx_t_4)) __PYX_ERR(4, 13, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
    __Pyx_GIVEREF(__pyx_t_3);
    if (__Pyx_PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_t_3) != (0)) __PYX_ERR(4, 13, __pyx_L1_error);
    __Pyx_GIVEREF(__pyx_t_1);
    if (__Pyx_PyTuple_SET_ITEM(__pyx_t_4, 1, __pyx_t_1) != (0)) __PYX_ERR(4, 13, __pyx_L1_error);
    __Pyx_INCREF(__pyx_v_state);
    __Pyx_GIVEREF(__pyx_v_state);
    if (__Pyx_PyTuple_SET_ITEM(__pyx_t_4, 2, __pyx_v_state) != (0)) __PYX_ERR(4, 13, __pyx_L1_error);
    __pyx_t_3 = 0;
    __pyx_t_1 = 0;
    __pyx_r = __pyx_t_4;
    __pyx_t_4 = 0;
    __Pyx_TraceReturnValue(__pyx_r, 25, 0, __PYX_ERR(4, 13, __pyx_L1_error));
    goto __pyx_L0;

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

  /* "(tree fragment)":15
 *         return __pyx_unpickle_VariantRecordSamples, (type(self), 0x70ce871, None), state
 *     else:
 *         return __pyx_unpickle_VariantRecordSamples, (type(self), 0x70ce871, state)             # <<<<<<<<<<<<<<
 * def __setstate_cython__(self, __pyx_state):
 *     __pyx_unpickle_VariantRecordSamples__set_state(self, __pyx_state)
*/
  /*else*/ {
    __Pyx_XDECREF(__pyx_r);
    __Pyx_GetModuleGlobalName(__pyx_t_4, __pyx_mstate_global->__pyx_n_u_pyx_unpickle_VariantRecordSamp); if (unlikely(!__pyx_t_4)) __PYX_ERR(4, 15, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
    __pyx_t_1 = PyTuple_New(3); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 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(4, 15, __pyx_L1_error);
    __Pyx_INCREF(__pyx_mstate_global->__pyx_int_118286449);
    __Pyx_GIVEREF(__pyx_mstate_global->__pyx_int_118286449);
    if (__Pyx_PyTuple_SET_ITEM(__pyx_t_1, 1, __pyx_mstate_global->__pyx_int_118286449) != (0)) __PYX_ERR(4, 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(4, 15, __pyx_L1_error);
    __pyx_t_3 = PyTuple_New(2); if (unlikely(!__pyx_t_3)) __PYX_ERR(4, 15, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __Pyx_GIVEREF(__pyx_t_4);
    if (__Pyx_PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_t_4) != (0)) __PYX_ERR(4, 15, __pyx_L1_error);
    __Pyx_GIVEREF(__pyx_t_1);
    if (__Pyx_PyTuple_SET_ITEM(__pyx_t_3, 1, __pyx_t_1) != (0)) __PYX_ERR(4, 15, __pyx_L1_error);
    __pyx_t_4 = 0;
    __pyx_t_1 = 0;
    __pyx_r = __pyx_t_3;
    __pyx_t_3 = 0;
    __Pyx_TraceReturnValue(__pyx_r, 33, 0, __PYX_ERR(4, 15, __pyx_L1_error));
    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_3);
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_TraceException(__pyx_lineno, 0, 0);
  #if CYTHON_USE_SYS_MONITORING
  __Pyx_TraceExceptionUnwind(0, 0);
  #else
  __Pyx_TraceReturnValue(NULL, 0, 0, __PYX_ERR(4, 1, __pyx_L1_error));
  #endif
  __Pyx_AddTraceback("pysam.libcbcf.VariantRecordSamples.__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_PyMonitoring_ExitScope(0);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "(tree fragment)":16
 *     else:
 *         return __pyx_unpickle_VariantRecordSamples, (type(self), 0x70ce871, state)
 * def __setstate_cython__(self, __pyx_state):             # <<<<<<<<<<<<<<
 *     __pyx_unpickle_VariantRecordSamples__set_state(self, __pyx_state)
*/

/* Python wrapper */
static PyObject *__pyx_pw_5pysam_7libcbcf_20VariantRecordSamples_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*/
PyDoc_STRVAR(__pyx_doc_5pysam_7libcbcf_20VariantRecordSamples_37__setstate_cython__, "VariantRecordSamples.__setstate_cython__(self, __pyx_state)");
static PyMethodDef __pyx_mdef_5pysam_7libcbcf_20VariantRecordSamples_38__setstate_cython__ = {"__setstate_cython__", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_5pysam_7libcbcf_20VariantRecordSamples_38__setstate_cython__, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_5pysam_7libcbcf_20VariantRecordSamples_37__setstate_cython__};
static PyObject *__pyx_pw_5pysam_7libcbcf_20VariantRecordSamples_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
) {
  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(4, 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(4, 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(4, 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(4, 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(4, 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(4, 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("pysam.libcbcf.VariantRecordSamples.__setstate_cython__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_5pysam_7libcbcf_20VariantRecordSamples_37__setstate_cython__(((struct __pyx_obj_5pysam_7libcbcf_VariantRecordSamples *)__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_5pysam_7libcbcf_20VariantRecordSamples_37__setstate_cython__(struct __pyx_obj_5pysam_7libcbcf_VariantRecordSamples *__pyx_v_self, PyObject *__pyx_v___pyx_state) {
  PyObject *__pyx_r = NULL;
  __Pyx_TraceDeclarationsFunc
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_TraceFrameInit(((PyObject *)__pyx_mstate_global->__pyx_codeobj_tab[244]))
  __Pyx_RefNannySetupContext("__setstate_cython__", 0);
  __Pyx_TraceStartFunc("__setstate_cython__", __pyx_f[4], 16, 0, 0, 0, __PYX_ERR(4, 16, __pyx_L1_error));

  /* "(tree fragment)":17
 *         return __pyx_unpickle_VariantRecordSamples, (type(self), 0x70ce871, state)
 * def __setstate_cython__(self, __pyx_state):
 *     __pyx_unpickle_VariantRecordSamples__set_state(self, __pyx_state)             # <<<<<<<<<<<<<<
*/
  if (!(likely(PyTuple_CheckExact(__pyx_v___pyx_state))||((__pyx_v___pyx_state) == Py_None) || __Pyx_RaiseUnexpectedTypeError("tuple", __pyx_v___pyx_state))) __PYX_ERR(4, 17, __pyx_L1_error)
  __pyx_t_1 = __pyx_f_5pysam_7libcbcf___pyx_unpickle_VariantRecordSamples__set_state(__pyx_v_self, ((PyObject*)__pyx_v___pyx_state)); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 17, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "(tree fragment)":16
 *     else:
 *         return __pyx_unpickle_VariantRecordSamples, (type(self), 0x70ce871, state)
 * def __setstate_cython__(self, __pyx_state):             # <<<<<<<<<<<<<<
 *     __pyx_unpickle_VariantRecordSamples__set_state(self, __pyx_state)
*/

  /* function exit code */
  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  __Pyx_TraceReturnValue(__pyx_r, 0, 0, __PYX_ERR(4, 16, __pyx_L1_error));
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_TraceException(__pyx_lineno, 0, 0);
  #if CYTHON_USE_SYS_MONITORING
  __Pyx_TraceExceptionUnwind(0, 0);
  #else
  __Pyx_TraceReturnValue(NULL, 0, 0, __PYX_ERR(4, 16, __pyx_L1_error));
  #endif
  __Pyx_AddTraceback("pysam.libcbcf.VariantRecordSamples.__setstate_cython__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_PyMonitoring_ExitScope(0);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "pysam/libcbcf.pyx":3008
 * 
 * 
 * cdef VariantRecordSamples makeVariantRecordSamples(VariantRecord record):             # <<<<<<<<<<<<<<
 *     if not record:
 *         raise ValueError('invalid VariantRecord')
*/

static struct __pyx_obj_5pysam_7libcbcf_VariantRecordSamples *__pyx_f_5pysam_7libcbcf_makeVariantRecordSamples(struct __pyx_obj_5pysam_7libcbcf_VariantRecord *__pyx_v_record) {
  struct __pyx_obj_5pysam_7libcbcf_VariantRecordSamples *__pyx_v_samples = 0;
  struct __pyx_obj_5pysam_7libcbcf_VariantRecordSamples *__pyx_r = NULL;
  __Pyx_TraceDeclarationsFunc
  __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_TraceFrameInit(((PyObject *)__pyx_mstate_global->__pyx_codeobj_tab[245]))
  __Pyx_RefNannySetupContext("makeVariantRecordSamples", 0);
  __Pyx_TraceStartFunc("makeVariantRecordSamples", __pyx_f[0], 3008, 0, 0, 0, __PYX_ERR(0, 3008, __pyx_L1_error));

  /* "pysam/libcbcf.pyx":3009
 * 
 * cdef VariantRecordSamples makeVariantRecordSamples(VariantRecord record):
 *     if not record:             # <<<<<<<<<<<<<<
 *         raise ValueError('invalid VariantRecord')
 * 
*/
  __pyx_t_1 = __Pyx_PyObject_IsTrue(((PyObject *)__pyx_v_record)); if (unlikely((__pyx_t_1 < 0))) __PYX_ERR(0, 3009, __pyx_L1_error)
  __pyx_t_2 = (!__pyx_t_1);
  if (unlikely(__pyx_t_2)) {

    /* "pysam/libcbcf.pyx":3010
 * cdef VariantRecordSamples makeVariantRecordSamples(VariantRecord record):
 *     if not record:
 *         raise ValueError('invalid VariantRecord')             # <<<<<<<<<<<<<<
 * 
 *     cdef VariantRecordSamples samples = VariantRecordSamples.__new__(
*/
    __pyx_t_4 = NULL;
    __Pyx_INCREF(__pyx_builtin_ValueError);
    __pyx_t_5 = __pyx_builtin_ValueError; 
    __pyx_t_6 = 1;
    {
      PyObject *__pyx_callargs[2] = {__pyx_t_4, __pyx_mstate_global->__pyx_kp_u_invalid_VariantRecord};
      __pyx_t_3 = __Pyx_PyObject_FastCall(__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, 3010, __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, 3010, __pyx_L1_error)

    /* "pysam/libcbcf.pyx":3009
 * 
 * cdef VariantRecordSamples makeVariantRecordSamples(VariantRecord record):
 *     if not record:             # <<<<<<<<<<<<<<
 *         raise ValueError('invalid VariantRecord')
 * 
*/
  }

  /* "pysam/libcbcf.pyx":3012
 *         raise ValueError('invalid VariantRecord')
 * 
 *     cdef VariantRecordSamples samples = VariantRecordSamples.__new__(             # <<<<<<<<<<<<<<
 *         VariantRecordSamples)
 *     samples.record = record
*/
  __pyx_t_3 = ((PyObject *)__pyx_tp_new_5pysam_7libcbcf_VariantRecordSamples(((PyTypeObject *)__pyx_mstate_global->__pyx_ptype_5pysam_7libcbcf_VariantRecordSamples), __pyx_mstate_global->__pyx_empty_tuple, NULL)); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 3012, __pyx_L1_error)
  __Pyx_GOTREF((PyObject *)__pyx_t_3);
  __pyx_v_samples = ((struct __pyx_obj_5pysam_7libcbcf_VariantRecordSamples *)__pyx_t_3);
  __pyx_t_3 = 0;

  /* "pysam/libcbcf.pyx":3014
 *     cdef VariantRecordSamples samples = VariantRecordSamples.__new__(
 *         VariantRecordSamples)
 *     samples.record = record             # <<<<<<<<<<<<<<
 * 
 *     return samples
*/
  __Pyx_INCREF((PyObject *)__pyx_v_record);
  __Pyx_GIVEREF((PyObject *)__pyx_v_record);
  __Pyx_GOTREF((PyObject *)__pyx_v_samples->record);
  __Pyx_DECREF((PyObject *)__pyx_v_samples->record);
  __pyx_v_samples->record = __pyx_v_record;

  /* "pysam/libcbcf.pyx":3016
 *     samples.record = record
 * 
 *     return samples             # <<<<<<<<<<<<<<
 * 
 * 
*/
  __Pyx_XDECREF((PyObject *)__pyx_r);
  __Pyx_INCREF((PyObject *)__pyx_v_samples);
  __pyx_r = __pyx_v_samples;
  __Pyx_TraceReturnValue((PyObject *)__pyx_r, 16, 0, __PYX_ERR(0, 3016, __pyx_L1_error));
  goto __pyx_L0;

  /* "pysam/libcbcf.pyx":3008
 * 
 * 
 * cdef VariantRecordSamples makeVariantRecordSamples(VariantRecord record):             # <<<<<<<<<<<<<<
 *     if not record:
 *         raise ValueError('invalid VariantRecord')
*/

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_XDECREF(__pyx_t_5);
  __Pyx_TraceException(__pyx_lineno, 0, 0);
  #if CYTHON_USE_SYS_MONITORING
  __Pyx_TraceExceptionUnwind(0, 0);
  #else
  __Pyx_TraceReturnValue(NULL, 0, 0, __PYX_ERR(0, 3008, __pyx_L1_error));
  #endif
  __Pyx_AddTraceback("pysam.libcbcf.makeVariantRecordSamples", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_XDECREF((PyObject *)__pyx_v_samples);
  __Pyx_XGIVEREF((PyObject *)__pyx_r);
  __Pyx_PyMonitoring_ExitScope(0);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "pysam/libcbcf.pyx":3021
 * cdef class VariantRecord(object):
 *     """Variant record"""
 *     def __init__(self, *args, **kwargs):             # <<<<<<<<<<<<<<
 *         raise TypeError('this class cannot be instantiated from Python')
 * 
*/

/* Python wrapper */
static int __pyx_pw_5pysam_7libcbcf_13VariantRecord_1__init__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static int __pyx_pw_5pysam_7libcbcf_13VariantRecord_1__init__(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("__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);
  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("__init__", __pyx_kwds) == -1)) return -1;
  }
  __Pyx_INCREF(__pyx_args);
  __pyx_v_args = __pyx_args;
  __pyx_r = __pyx_pf_5pysam_7libcbcf_13VariantRecord___init__(((struct __pyx_obj_5pysam_7libcbcf_VariantRecord *)__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_5pysam_7libcbcf_13VariantRecord___init__(CYTHON_UNUSED struct __pyx_obj_5pysam_7libcbcf_VariantRecord *__pyx_v_self, CYTHON_UNUSED PyObject *__pyx_v_args, CYTHON_UNUSED PyObject *__pyx_v_kwargs) {
  int __pyx_r;
  __Pyx_TraceDeclarationsFunc
  __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_TraceFrameInit(((PyObject *)__pyx_mstate_global->__pyx_codeobj_tab[246]))
  __Pyx_RefNannySetupContext("__init__", 0);
  __Pyx_TraceStartFunc("__init__", __pyx_f[0], 3021, 0, 0, 0, __PYX_ERR(0, 3021, __pyx_L1_error));

  /* "pysam/libcbcf.pyx":3022
 *     """Variant record"""
 *     def __init__(self, *args, **kwargs):
 *         raise TypeError('this class cannot be instantiated from Python')             # <<<<<<<<<<<<<<
 * 
 *     def __dealloc__(self):
*/
  __pyx_t_2 = NULL;
  __Pyx_INCREF(__pyx_builtin_TypeError);
  __pyx_t_3 = __pyx_builtin_TypeError; 
  __pyx_t_4 = 1;
  {
    PyObject *__pyx_callargs[2] = {__pyx_t_2, __pyx_mstate_global->__pyx_kp_u_this_class_cannot_be_instantiate};
    __pyx_t_1 = __Pyx_PyObject_FastCall(__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, 3022, __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, 3022, __pyx_L1_error)

  /* "pysam/libcbcf.pyx":3021
 * cdef class VariantRecord(object):
 *     """Variant record"""
 *     def __init__(self, *args, **kwargs):             # <<<<<<<<<<<<<<
 *         raise TypeError('this class cannot be instantiated from Python')
 * 
*/

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_TraceException(__pyx_lineno, 0, 0);
  #if CYTHON_USE_SYS_MONITORING
  __Pyx_TraceExceptionUnwind(0, 0);
  #else
  __Pyx_TraceReturnValue(NULL, 0, 0, __PYX_ERR(0, 3021, __pyx_L1_error));
  #endif
  __Pyx_AddTraceback("pysam.libcbcf.VariantRecord.__init__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = -1;
  __Pyx_PyMonitoring_ExitScope(0);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "pysam/libcbcf.pyx":3024
 *         raise TypeError('this class cannot be instantiated from Python')
 * 
 *     def __dealloc__(self):             # <<<<<<<<<<<<<<
 *         if self.ptr:
 *             bcf_destroy1(self.ptr)
*/

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

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

static void __pyx_pf_5pysam_7libcbcf_13VariantRecord_2__dealloc__(struct __pyx_obj_5pysam_7libcbcf_VariantRecord *__pyx_v_self) {
  __Pyx_TraceDeclarationsFunc
  int __pyx_t_1;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_TraceFrameInit(((PyObject *)__pyx_mstate_global->__pyx_codeobj_tab[247]))
  __Pyx_TraceStartFunc("__dealloc__", __pyx_f[0], 3024, 0, 0, 0, __PYX_ERR(0, 3024, __pyx_L1_error));

  /* "pysam/libcbcf.pyx":3025
 * 
 *     def __dealloc__(self):
 *         if self.ptr:             # <<<<<<<<<<<<<<
 *             bcf_destroy1(self.ptr)
 *             self.ptr = NULL
*/
  __pyx_t_1 = (__pyx_v_self->ptr != 0);
  if (__pyx_t_1) {

    /* "pysam/libcbcf.pyx":3026
 *     def __dealloc__(self):
 *         if self.ptr:
 *             bcf_destroy1(self.ptr)             # <<<<<<<<<<<<<<
 *             self.ptr = NULL
 * 
*/
    bcf_destroy1(__pyx_v_self->ptr);

    /* "pysam/libcbcf.pyx":3027
 *         if self.ptr:
 *             bcf_destroy1(self.ptr)
 *             self.ptr = NULL             # <<<<<<<<<<<<<<
 * 
 *     def copy(self):
*/
    __pyx_v_self->ptr = NULL;

    /* "pysam/libcbcf.pyx":3025
 * 
 *     def __dealloc__(self):
 *         if self.ptr:             # <<<<<<<<<<<<<<
 *             bcf_destroy1(self.ptr)
 *             self.ptr = NULL
*/
  }

  /* "pysam/libcbcf.pyx":3024
 *         raise TypeError('this class cannot be instantiated from Python')
 * 
 *     def __dealloc__(self):             # <<<<<<<<<<<<<<
 *         if self.ptr:
 *             bcf_destroy1(self.ptr)
*/

  /* function exit code */
  __Pyx_TraceReturnValue(Py_None, 0, 0, __PYX_ERR(0, 3024, __pyx_L1_error));
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_TraceException(__pyx_lineno, 0, 0);
  #if CYTHON_USE_SYS_MONITORING
  __Pyx_TraceExceptionUnwind(0, 0);
  #else
  __Pyx_TraceReturnValue(NULL, 0, 0, __PYX_ERR(0, 3024, __pyx_L1_error));
  #endif
  __Pyx_WriteUnraisable("pysam.libcbcf.VariantRecord.__dealloc__", __pyx_clineno, __pyx_lineno, __pyx_filename, 1, 0);
  __pyx_L0:;
  __Pyx_PyMonitoring_ExitScope(0);
}

/* "pysam/libcbcf.pyx":3029
 *             self.ptr = NULL
 * 
 *     def copy(self):             # <<<<<<<<<<<<<<
 *         """return a copy of this VariantRecord object"""
 *         return makeVariantRecord(self.header, bcf_dup(self.ptr))
*/

/* Python wrapper */
static PyObject *__pyx_pw_5pysam_7libcbcf_13VariantRecord_5copy(PyObject *__pyx_v_self, 
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
); /*proto*/
PyDoc_STRVAR(__pyx_doc_5pysam_7libcbcf_13VariantRecord_4copy, "VariantRecord.copy(self)\n\nreturn a copy of this VariantRecord object");
static PyMethodDef __pyx_mdef_5pysam_7libcbcf_13VariantRecord_5copy = {"copy", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_5pysam_7libcbcf_13VariantRecord_5copy, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_5pysam_7libcbcf_13VariantRecord_4copy};
static PyObject *__pyx_pw_5pysam_7libcbcf_13VariantRecord_5copy(PyObject *__pyx_v_self, 
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
) {
  #if !CYTHON_METH_FASTCALL
  CYTHON_UNUSED Py_ssize_t __pyx_nargs;
  #endif
  CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("copy (wrapper)", 0);
  #if !CYTHON_METH_FASTCALL
  #if CYTHON_ASSUME_SAFE_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_pf_5pysam_7libcbcf_13VariantRecord_4copy(((struct __pyx_obj_5pysam_7libcbcf_VariantRecord *)__pyx_v_self));

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

static PyObject *__pyx_pf_5pysam_7libcbcf_13VariantRecord_4copy(struct __pyx_obj_5pysam_7libcbcf_VariantRecord *__pyx_v_self) {
  PyObject *__pyx_r = NULL;
  __Pyx_TraceDeclarationsFunc
  __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_TraceFrameInit(((PyObject *)__pyx_mstate_global->__pyx_codeobj_tab[248]))
  __Pyx_RefNannySetupContext("copy", 0);
  __Pyx_TraceStartFunc("copy", __pyx_f[0], 3029, 0, 0, 0, __PYX_ERR(0, 3029, __pyx_L1_error));

  /* "pysam/libcbcf.pyx":3031
 *     def copy(self):
 *         """return a copy of this VariantRecord object"""
 *         return makeVariantRecord(self.header, bcf_dup(self.ptr))             # <<<<<<<<<<<<<<
 * 
 *     def translate(self, VariantHeader dst_header):
*/
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = ((PyObject *)__pyx_v_self->header);
  __Pyx_INCREF(__pyx_t_1);
  __pyx_t_2 = ((PyObject *)__pyx_f_5pysam_7libcbcf_makeVariantRecord(((struct __pyx_obj_5pysam_7libcbcf_VariantHeader *)__pyx_t_1), bcf_dup(__pyx_v_self->ptr))); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 3031, __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;
  __Pyx_TraceReturnValue(__pyx_r, 1, 0, __PYX_ERR(0, 3031, __pyx_L1_error));
  goto __pyx_L0;

  /* "pysam/libcbcf.pyx":3029
 *             self.ptr = NULL
 * 
 *     def copy(self):             # <<<<<<<<<<<<<<
 *         """return a copy of this VariantRecord object"""
 *         return makeVariantRecord(self.header, bcf_dup(self.ptr))
*/

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_TraceException(__pyx_lineno, 0, 0);
  #if CYTHON_USE_SYS_MONITORING
  __Pyx_TraceExceptionUnwind(0, 0);
  #else
  __Pyx_TraceReturnValue(NULL, 0, 0, __PYX_ERR(0, 3029, __pyx_L1_error));
  #endif
  __Pyx_AddTraceback("pysam.libcbcf.VariantRecord.copy", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_PyMonitoring_ExitScope(0);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "pysam/libcbcf.pyx":3033
 *         return makeVariantRecord(self.header, bcf_dup(self.ptr))
 * 
 *     def translate(self, VariantHeader dst_header):             # <<<<<<<<<<<<<<
 *         if dst_header is None:
 *             raise ValueError('dst_header must not be None')
*/

/* Python wrapper */
static PyObject *__pyx_pw_5pysam_7libcbcf_13VariantRecord_7translate(PyObject *__pyx_v_self, 
#if 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_5pysam_7libcbcf_13VariantRecord_6translate, "VariantRecord.translate(self, VariantHeader dst_header)");
static PyMethodDef __pyx_mdef_5pysam_7libcbcf_13VariantRecord_7translate = {"translate", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_5pysam_7libcbcf_13VariantRecord_7translate, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_5pysam_7libcbcf_13VariantRecord_6translate};
static PyObject *__pyx_pw_5pysam_7libcbcf_13VariantRecord_7translate(PyObject *__pyx_v_self, 
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
) {
  struct __pyx_obj_5pysam_7libcbcf_VariantHeader *__pyx_v_dst_header = 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("translate (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_dst_header,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, 3033, __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, 3033, __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, "translate", 0) < 0) __PYX_ERR(0, 3033, __pyx_L3_error)
      for (Py_ssize_t i = __pyx_nargs; i < 1; i++) {
        if (unlikely(!values[i])) { __Pyx_RaiseArgtupleInvalid("translate", 1, 1, 1, i); __PYX_ERR(0, 3033, __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, 3033, __pyx_L3_error)
    }
    __pyx_v_dst_header = ((struct __pyx_obj_5pysam_7libcbcf_VariantHeader *)values[0]);
  }
  goto __pyx_L6_skip;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("translate", 1, 1, 1, __pyx_nargs); __PYX_ERR(0, 3033, __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("pysam.libcbcf.VariantRecord.translate", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_dst_header), __pyx_mstate_global->__pyx_ptype_5pysam_7libcbcf_VariantHeader, 1, "dst_header", 0))) __PYX_ERR(0, 3033, __pyx_L1_error)
  __pyx_r = __pyx_pf_5pysam_7libcbcf_13VariantRecord_6translate(((struct __pyx_obj_5pysam_7libcbcf_VariantRecord *)__pyx_v_self), __pyx_v_dst_header);

  /* 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_5pysam_7libcbcf_13VariantRecord_6translate(struct __pyx_obj_5pysam_7libcbcf_VariantRecord *__pyx_v_self, struct __pyx_obj_5pysam_7libcbcf_VariantHeader *__pyx_v_dst_header) {
  bcf_hdr_t *__pyx_v_src_hdr;
  bcf_hdr_t *__pyx_v_dst_hdr;
  PyObject *__pyx_v_msg = NULL;
  PyObject *__pyx_r = NULL;
  __Pyx_TraceDeclarationsFunc
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  PyObject *__pyx_t_4 = NULL;
  size_t __pyx_t_5;
  bcf_hdr_t *__pyx_t_6;
  PyObject *__pyx_t_7 = NULL;
  PyObject *__pyx_t_8 = NULL;
  PyObject *__pyx_t_9 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_TraceFrameInit(((PyObject *)__pyx_mstate_global->__pyx_codeobj_tab[249]))
  __Pyx_RefNannySetupContext("translate", 0);
  __Pyx_TraceStartFunc("translate", __pyx_f[0], 3033, 0, 0, 0, __PYX_ERR(0, 3033, __pyx_L1_error));

  /* "pysam/libcbcf.pyx":3034
 * 
 *     def translate(self, VariantHeader dst_header):
 *         if dst_header is None:             # <<<<<<<<<<<<<<
 *             raise ValueError('dst_header must not be None')
 * 
*/
  __pyx_t_1 = (((PyObject *)__pyx_v_dst_header) == Py_None);
  if (unlikely(__pyx_t_1)) {

    /* "pysam/libcbcf.pyx":3035
 *     def translate(self, VariantHeader dst_header):
 *         if dst_header is None:
 *             raise ValueError('dst_header must not be None')             # <<<<<<<<<<<<<<
 * 
 *         cdef bcf_hdr_t *src_hdr = self.header.ptr
*/
    __pyx_t_3 = NULL;
    __Pyx_INCREF(__pyx_builtin_ValueError);
    __pyx_t_4 = __pyx_builtin_ValueError; 
    __pyx_t_5 = 1;
    {
      PyObject *__pyx_callargs[2] = {__pyx_t_3, __pyx_mstate_global->__pyx_kp_u_dst_header_must_not_be_None};
      __pyx_t_2 = __Pyx_PyObject_FastCall(__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_2)) __PYX_ERR(0, 3035, __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, 3035, __pyx_L1_error)

    /* "pysam/libcbcf.pyx":3034
 * 
 *     def translate(self, VariantHeader dst_header):
 *         if dst_header is None:             # <<<<<<<<<<<<<<
 *             raise ValueError('dst_header must not be None')
 * 
*/
  }

  /* "pysam/libcbcf.pyx":3037
 *             raise ValueError('dst_header must not be None')
 * 
 *         cdef bcf_hdr_t *src_hdr = self.header.ptr             # <<<<<<<<<<<<<<
 *         cdef bcf_hdr_t *dst_hdr = dst_header.ptr
 * 
*/
  __pyx_t_6 = __pyx_v_self->header->ptr;
  __pyx_v_src_hdr = __pyx_t_6;

  /* "pysam/libcbcf.pyx":3038
 * 
 *         cdef bcf_hdr_t *src_hdr = self.header.ptr
 *         cdef bcf_hdr_t *dst_hdr = dst_header.ptr             # <<<<<<<<<<<<<<
 * 
 *         if src_hdr != dst_hdr:
*/
  __pyx_t_6 = __pyx_v_dst_header->ptr;
  __pyx_v_dst_hdr = __pyx_t_6;

  /* "pysam/libcbcf.pyx":3040
 *         cdef bcf_hdr_t *dst_hdr = dst_header.ptr
 * 
 *         if src_hdr != dst_hdr:             # <<<<<<<<<<<<<<
 *             if self.ptr.n_sample != bcf_hdr_nsamples(dst_hdr):
 *                 msg = 'Cannot translate record.  Number of samples does not match header ({} vs {})'
*/
  __pyx_t_1 = (__pyx_v_src_hdr != __pyx_v_dst_hdr);
  if (__pyx_t_1) {

    /* "pysam/libcbcf.pyx":3041
 * 
 *         if src_hdr != dst_hdr:
 *             if self.ptr.n_sample != bcf_hdr_nsamples(dst_hdr):             # <<<<<<<<<<<<<<
 *                 msg = 'Cannot translate record.  Number of samples does not match header ({} vs {})'
 *                 raise ValueError(msg.format(self.ptr.n_sample, bcf_hdr_nsamples(dst_hdr)))
*/
    __pyx_t_1 = (__pyx_v_self->ptr->n_sample != bcf_hdr_nsamples(__pyx_v_dst_hdr));
    if (unlikely(__pyx_t_1)) {

      /* "pysam/libcbcf.pyx":3042
 *         if src_hdr != dst_hdr:
 *             if self.ptr.n_sample != bcf_hdr_nsamples(dst_hdr):
 *                 msg = 'Cannot translate record.  Number of samples does not match header ({} vs {})'             # <<<<<<<<<<<<<<
 *                 raise ValueError(msg.format(self.ptr.n_sample, bcf_hdr_nsamples(dst_hdr)))
 * 
*/
      __Pyx_INCREF(__pyx_mstate_global->__pyx_kp_u_Cannot_translate_record_Number_o);
      __pyx_v_msg = __pyx_mstate_global->__pyx_kp_u_Cannot_translate_record_Number_o;

      /* "pysam/libcbcf.pyx":3043
 *             if self.ptr.n_sample != bcf_hdr_nsamples(dst_hdr):
 *                 msg = 'Cannot translate record.  Number of samples does not match header ({} vs {})'
 *                 raise ValueError(msg.format(self.ptr.n_sample, bcf_hdr_nsamples(dst_hdr)))             # <<<<<<<<<<<<<<
 * 
 *             bcf_translate(dst_hdr, src_hdr, self.ptr)
*/
      __pyx_t_4 = NULL;
      __Pyx_INCREF(__pyx_builtin_ValueError);
      __pyx_t_3 = __pyx_builtin_ValueError; 
      __pyx_t_7 = __Pyx_PyLong_From_uint32_t(__pyx_v_self->ptr->n_sample); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 3043, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_7);
      __pyx_t_8 = __Pyx_PyLong_From_int32_t(bcf_hdr_nsamples(__pyx_v_dst_hdr)); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 3043, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_8);
      __pyx_t_9 = __Pyx_CallUnboundCMethod2(&__pyx_mstate_global->__pyx_umethod_PyUnicode_Type__format, __pyx_v_msg, __pyx_t_7, __pyx_t_8); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 3043, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_9);
      __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
      __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
      __pyx_t_5 = 1;
      {
        PyObject *__pyx_callargs[2] = {__pyx_t_4, __pyx_t_9};
        __pyx_t_2 = __Pyx_PyObject_FastCall(__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_9); __pyx_t_9 = 0;
        __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
        if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 3043, __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, 3043, __pyx_L1_error)

      /* "pysam/libcbcf.pyx":3041
 * 
 *         if src_hdr != dst_hdr:
 *             if self.ptr.n_sample != bcf_hdr_nsamples(dst_hdr):             # <<<<<<<<<<<<<<
 *                 msg = 'Cannot translate record.  Number of samples does not match header ({} vs {})'
 *                 raise ValueError(msg.format(self.ptr.n_sample, bcf_hdr_nsamples(dst_hdr)))
*/
    }

    /* "pysam/libcbcf.pyx":3045
 *                 raise ValueError(msg.format(self.ptr.n_sample, bcf_hdr_nsamples(dst_hdr)))
 * 
 *             bcf_translate(dst_hdr, src_hdr, self.ptr)             # <<<<<<<<<<<<<<
 *             self.header = dst_header
 * 
*/
    (void)(bcf_translate(__pyx_v_dst_hdr, __pyx_v_src_hdr, __pyx_v_self->ptr));

    /* "pysam/libcbcf.pyx":3046
 * 
 *             bcf_translate(dst_hdr, src_hdr, self.ptr)
 *             self.header = dst_header             # <<<<<<<<<<<<<<
 * 
 *     @property
*/
    __Pyx_INCREF((PyObject *)__pyx_v_dst_header);
    __Pyx_GIVEREF((PyObject *)__pyx_v_dst_header);
    __Pyx_GOTREF((PyObject *)__pyx_v_self->header);
    __Pyx_DECREF((PyObject *)__pyx_v_self->header);
    __pyx_v_self->header = __pyx_v_dst_header;

    /* "pysam/libcbcf.pyx":3040
 *         cdef bcf_hdr_t *dst_hdr = dst_header.ptr
 * 
 *         if src_hdr != dst_hdr:             # <<<<<<<<<<<<<<
 *             if self.ptr.n_sample != bcf_hdr_nsamples(dst_hdr):
 *                 msg = 'Cannot translate record.  Number of samples does not match header ({} vs {})'
*/
  }

  /* "pysam/libcbcf.pyx":3033
 *         return makeVariantRecord(self.header, bcf_dup(self.ptr))
 * 
 *     def translate(self, VariantHeader dst_header):             # <<<<<<<<<<<<<<
 *         if dst_header is None:
 *             raise ValueError('dst_header must not be None')
*/

  /* function exit code */
  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  __Pyx_TraceReturnValue(__pyx_r, 0, 0, __PYX_ERR(0, 3033, __pyx_L1_error));
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_XDECREF(__pyx_t_7);
  __Pyx_XDECREF(__pyx_t_8);
  __Pyx_XDECREF(__pyx_t_9);
  __Pyx_TraceException(__pyx_lineno, 0, 0);
  #if CYTHON_USE_SYS_MONITORING
  __Pyx_TraceExceptionUnwind(0, 0);
  #else
  __Pyx_TraceReturnValue(NULL, 0, 0, __PYX_ERR(0, 3033, __pyx_L1_error));
  #endif
  __Pyx_AddTraceback("pysam.libcbcf.VariantRecord.translate", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_msg);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_PyMonitoring_ExitScope(0);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "pysam/libcbcf.pyx":3048
 *             self.header = dst_header
 * 
 *     @property             # <<<<<<<<<<<<<<
 *     def rid(self):
 *         """internal reference id number"""
*/

/* Python wrapper */
static PyObject *__pyx_pw_5pysam_7libcbcf_13VariantRecord_3rid_1__get__(PyObject *__pyx_v_self); /*proto*/
static PyObject *__pyx_pw_5pysam_7libcbcf_13VariantRecord_3rid_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_5pysam_7libcbcf_13VariantRecord_3rid___get__(((struct __pyx_obj_5pysam_7libcbcf_VariantRecord *)__pyx_v_self));

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

static PyObject *__pyx_pf_5pysam_7libcbcf_13VariantRecord_3rid___get__(struct __pyx_obj_5pysam_7libcbcf_VariantRecord *__pyx_v_self) {
  PyObject *__pyx_r = NULL;
  __Pyx_TraceDeclarationsFunc
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_TraceFrameInit(((PyObject *)__pyx_mstate_global->__pyx_codeobj_tab[250]))
  __Pyx_RefNannySetupContext("__get__", 0);
  __Pyx_TraceStartFunc("__get__", __pyx_f[0], 3048, 0, 0, 0, __PYX_ERR(0, 3048, __pyx_L1_error));

  /* "pysam/libcbcf.pyx":3051
 *     def rid(self):
 *         """internal reference id number"""
 *         return self.ptr.rid             # <<<<<<<<<<<<<<
 * 
 *     @rid.setter
*/
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = __Pyx_PyLong_From_int32_t(__pyx_v_self->ptr->rid); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 3051, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  __Pyx_TraceReturnValue(__pyx_r, 1, 0, __PYX_ERR(0, 3051, __pyx_L1_error));
  goto __pyx_L0;

  /* "pysam/libcbcf.pyx":3048
 *             self.header = dst_header
 * 
 *     @property             # <<<<<<<<<<<<<<
 *     def rid(self):
 *         """internal reference id number"""
*/

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_TraceException(__pyx_lineno, 0, 0);
  #if CYTHON_USE_SYS_MONITORING
  __Pyx_TraceExceptionUnwind(0, 0);
  #else
  __Pyx_TraceReturnValue(NULL, 0, 0, __PYX_ERR(0, 3048, __pyx_L1_error));
  #endif
  __Pyx_AddTraceback("pysam.libcbcf.VariantRecord.rid.__get__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_PyMonitoring_ExitScope(0);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "pysam/libcbcf.pyx":3053
 *         return self.ptr.rid
 * 
 *     @rid.setter             # <<<<<<<<<<<<<<
 *     def rid(self, value):
 *         cdef bcf_hdr_t *hdr = self.header.ptr
*/

/* Python wrapper */
static int __pyx_pw_5pysam_7libcbcf_13VariantRecord_3rid_3__set__(PyObject *__pyx_v_self, PyObject *__pyx_v_value); /*proto*/
static int __pyx_pw_5pysam_7libcbcf_13VariantRecord_3rid_3__set__(PyObject *__pyx_v_self, PyObject *__pyx_v_value) {
  CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__set__ (wrapper)", 0);
  __pyx_kwvalues = __Pyx_KwValues_VARARGS(__pyx_args, __pyx_nargs);
  __pyx_r = __pyx_pf_5pysam_7libcbcf_13VariantRecord_3rid_2__set__(((struct __pyx_obj_5pysam_7libcbcf_VariantRecord *)__pyx_v_self), ((PyObject *)__pyx_v_value));

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

static int __pyx_pf_5pysam_7libcbcf_13VariantRecord_3rid_2__set__(struct __pyx_obj_5pysam_7libcbcf_VariantRecord *__pyx_v_self, PyObject *__pyx_v_value) {
  bcf_hdr_t *__pyx_v_hdr;
  int __pyx_v_r;
  int __pyx_r;
  __Pyx_TraceDeclarationsFunc
  __Pyx_RefNannyDeclarations
  bcf_hdr_t *__pyx_t_1;
  int __pyx_t_2;
  int __pyx_t_3;
  int __pyx_t_4;
  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_TraceFrameInit(((PyObject *)__pyx_mstate_global->__pyx_codeobj_tab[251]))
  __Pyx_RefNannySetupContext("__set__", 0);
  __Pyx_TraceStartFunc("__set__", __pyx_f[0], 3053, 0, 0, 0, __PYX_ERR(0, 3053, __pyx_L1_error));

  /* "pysam/libcbcf.pyx":3055
 *     @rid.setter
 *     def rid(self, value):
 *         cdef bcf_hdr_t *hdr = self.header.ptr             # <<<<<<<<<<<<<<
 *         cdef int r = value
 *         if r < 0 or r >= hdr.n[BCF_DT_CTG] or not hdr.id[BCF_DT_CTG][r].val:
*/
  __pyx_t_1 = __pyx_v_self->header->ptr;
  __pyx_v_hdr = __pyx_t_1;

  /* "pysam/libcbcf.pyx":3056
 *     def rid(self, value):
 *         cdef bcf_hdr_t *hdr = self.header.ptr
 *         cdef int r = value             # <<<<<<<<<<<<<<
 *         if r < 0 or r >= hdr.n[BCF_DT_CTG] or not hdr.id[BCF_DT_CTG][r].val:
 *             raise ValueError('invalid reference id')
*/
  __pyx_t_2 = __Pyx_PyLong_As_int(__pyx_v_value); if (unlikely((__pyx_t_2 == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 3056, __pyx_L1_error)
  __pyx_v_r = __pyx_t_2;

  /* "pysam/libcbcf.pyx":3057
 *         cdef bcf_hdr_t *hdr = self.header.ptr
 *         cdef int r = value
 *         if r < 0 or r >= hdr.n[BCF_DT_CTG] or not hdr.id[BCF_DT_CTG][r].val:             # <<<<<<<<<<<<<<
 *             raise ValueError('invalid reference id')
 *         self.ptr.rid = r
*/
  __pyx_t_4 = (__pyx_v_r < 0);
  if (!__pyx_t_4) {
  } else {
    __pyx_t_3 = __pyx_t_4;
    goto __pyx_L4_bool_binop_done;
  }
  __pyx_t_4 = (__pyx_v_r >= (__pyx_v_hdr->n[BCF_DT_CTG]));
  if (!__pyx_t_4) {
  } else {
    __pyx_t_3 = __pyx_t_4;
    goto __pyx_L4_bool_binop_done;
  }
  __pyx_t_4 = (!(((__pyx_v_hdr->id[BCF_DT_CTG])[__pyx_v_r]).val != 0));
  __pyx_t_3 = __pyx_t_4;
  __pyx_L4_bool_binop_done:;
  if (unlikely(__pyx_t_3)) {

    /* "pysam/libcbcf.pyx":3058
 *         cdef int r = value
 *         if r < 0 or r >= hdr.n[BCF_DT_CTG] or not hdr.id[BCF_DT_CTG][r].val:
 *             raise ValueError('invalid reference id')             # <<<<<<<<<<<<<<
 *         self.ptr.rid = r
 * 
*/
    __pyx_t_6 = NULL;
    __Pyx_INCREF(__pyx_builtin_ValueError);
    __pyx_t_7 = __pyx_builtin_ValueError; 
    __pyx_t_8 = 1;
    {
      PyObject *__pyx_callargs[2] = {__pyx_t_6, __pyx_mstate_global->__pyx_kp_u_invalid_reference_id};
      __pyx_t_5 = __Pyx_PyObject_FastCall(__pyx_t_7, __pyx_callargs+__pyx_t_8, (2-__pyx_t_8) | (__pyx_t_8*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
      __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0;
      __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
      if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 3058, __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, 3058, __pyx_L1_error)

    /* "pysam/libcbcf.pyx":3057
 *         cdef bcf_hdr_t *hdr = self.header.ptr
 *         cdef int r = value
 *         if r < 0 or r >= hdr.n[BCF_DT_CTG] or not hdr.id[BCF_DT_CTG][r].val:             # <<<<<<<<<<<<<<
 *             raise ValueError('invalid reference id')
 *         self.ptr.rid = r
*/
  }

  /* "pysam/libcbcf.pyx":3059
 *         if r < 0 or r >= hdr.n[BCF_DT_CTG] or not hdr.id[BCF_DT_CTG][r].val:
 *             raise ValueError('invalid reference id')
 *         self.ptr.rid = r             # <<<<<<<<<<<<<<
 * 
 *     @property
*/
  __pyx_v_self->ptr->rid = __pyx_v_r;

  /* "pysam/libcbcf.pyx":3053
 *         return self.ptr.rid
 * 
 *     @rid.setter             # <<<<<<<<<<<<<<
 *     def rid(self, value):
 *         cdef bcf_hdr_t *hdr = self.header.ptr
*/

  /* function exit code */
  __pyx_r = 0;
  __Pyx_TraceReturnCValue(__pyx_r, __Pyx_Owned_Py_None, 0, 0, __PYX_ERR(0, 3053, __pyx_L1_error));
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_5);
  __Pyx_XDECREF(__pyx_t_6);
  __Pyx_XDECREF(__pyx_t_7);
  __Pyx_TraceException(__pyx_lineno, 0, 0);
  #if CYTHON_USE_SYS_MONITORING
  __Pyx_TraceExceptionUnwind(0, 0);
  #else
  __Pyx_TraceReturnValue(NULL, 0, 0, __PYX_ERR(0, 3053, __pyx_L1_error));
  #endif
  __Pyx_AddTraceback("pysam.libcbcf.VariantRecord.rid.__set__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = -1;
  __pyx_L0:;
  __Pyx_PyMonitoring_ExitScope(0);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "pysam/libcbcf.pyx":3061
 *         self.ptr.rid = r
 * 
 *     @property             # <<<<<<<<<<<<<<
 *     def chrom(self):
 *         """chromosome/contig name"""
*/

/* Python wrapper */
static PyObject *__pyx_pw_5pysam_7libcbcf_13VariantRecord_5chrom_1__get__(PyObject *__pyx_v_self); /*proto*/
static PyObject *__pyx_pw_5pysam_7libcbcf_13VariantRecord_5chrom_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_5pysam_7libcbcf_13VariantRecord_5chrom___get__(((struct __pyx_obj_5pysam_7libcbcf_VariantRecord *)__pyx_v_self));

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

static PyObject *__pyx_pf_5pysam_7libcbcf_13VariantRecord_5chrom___get__(struct __pyx_obj_5pysam_7libcbcf_VariantRecord *__pyx_v_self) {
  bcf_hdr_t *__pyx_v_hdr;
  int __pyx_v_rid;
  PyObject *__pyx_r = NULL;
  __Pyx_TraceDeclarationsFunc
  __Pyx_RefNannyDeclarations
  bcf_hdr_t *__pyx_t_1;
  int32_t __pyx_t_2;
  int __pyx_t_3;
  int __pyx_t_4;
  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_TraceFrameInit(((PyObject *)__pyx_mstate_global->__pyx_codeobj_tab[252]))
  __Pyx_RefNannySetupContext("__get__", 0);
  __Pyx_TraceStartFunc("__get__", __pyx_f[0], 3061, 0, 0, 0, __PYX_ERR(0, 3061, __pyx_L1_error));

  /* "pysam/libcbcf.pyx":3064
 *     def chrom(self):
 *         """chromosome/contig name"""
 *         cdef bcf_hdr_t *hdr = self.header.ptr             # <<<<<<<<<<<<<<
 *         cdef int rid = self.ptr.rid
 *         if rid < 0 or rid >= hdr.n[BCF_DT_CTG]:
*/
  __pyx_t_1 = __pyx_v_self->header->ptr;
  __pyx_v_hdr = __pyx_t_1;

  /* "pysam/libcbcf.pyx":3065
 *         """chromosome/contig name"""
 *         cdef bcf_hdr_t *hdr = self.header.ptr
 *         cdef int rid = self.ptr.rid             # <<<<<<<<<<<<<<
 *         if rid < 0 or rid >= hdr.n[BCF_DT_CTG]:
 *             raise ValueError('Invalid header')
*/
  __pyx_t_2 = __pyx_v_self->ptr->rid;
  __pyx_v_rid = __pyx_t_2;

  /* "pysam/libcbcf.pyx":3066
 *         cdef bcf_hdr_t *hdr = self.header.ptr
 *         cdef int rid = self.ptr.rid
 *         if rid < 0 or rid >= hdr.n[BCF_DT_CTG]:             # <<<<<<<<<<<<<<
 *             raise ValueError('Invalid header')
 *         return bcf_str_cache_get_charptr(bcf_hdr_id2name(hdr, rid))
*/
  __pyx_t_4 = (__pyx_v_rid < 0);
  if (!__pyx_t_4) {
  } else {
    __pyx_t_3 = __pyx_t_4;
    goto __pyx_L4_bool_binop_done;
  }
  __pyx_t_4 = (__pyx_v_rid >= (__pyx_v_hdr->n[BCF_DT_CTG]));
  __pyx_t_3 = __pyx_t_4;
  __pyx_L4_bool_binop_done:;
  if (unlikely(__pyx_t_3)) {

    /* "pysam/libcbcf.pyx":3067
 *         cdef int rid = self.ptr.rid
 *         if rid < 0 or rid >= hdr.n[BCF_DT_CTG]:
 *             raise ValueError('Invalid header')             # <<<<<<<<<<<<<<
 *         return bcf_str_cache_get_charptr(bcf_hdr_id2name(hdr, rid))
 * 
*/
    __pyx_t_6 = NULL;
    __Pyx_INCREF(__pyx_builtin_ValueError);
    __pyx_t_7 = __pyx_builtin_ValueError; 
    __pyx_t_8 = 1;
    {
      PyObject *__pyx_callargs[2] = {__pyx_t_6, __pyx_mstate_global->__pyx_kp_u_Invalid_header};
      __pyx_t_5 = __Pyx_PyObject_FastCall(__pyx_t_7, __pyx_callargs+__pyx_t_8, (2-__pyx_t_8) | (__pyx_t_8*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
      __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0;
      __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
      if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 3067, __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, 3067, __pyx_L1_error)

    /* "pysam/libcbcf.pyx":3066
 *         cdef bcf_hdr_t *hdr = self.header.ptr
 *         cdef int rid = self.ptr.rid
 *         if rid < 0 or rid >= hdr.n[BCF_DT_CTG]:             # <<<<<<<<<<<<<<
 *             raise ValueError('Invalid header')
 *         return bcf_str_cache_get_charptr(bcf_hdr_id2name(hdr, rid))
*/
  }

  /* "pysam/libcbcf.pyx":3068
 *         if rid < 0 or rid >= hdr.n[BCF_DT_CTG]:
 *             raise ValueError('Invalid header')
 *         return bcf_str_cache_get_charptr(bcf_hdr_id2name(hdr, rid))             # <<<<<<<<<<<<<<
 * 
 *     @chrom.setter
*/
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_5 = __pyx_f_5pysam_7libcbcf_bcf_str_cache_get_charptr(bcf_hdr_id2name(__pyx_v_hdr, __pyx_v_rid)); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 3068, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_5);
  __pyx_r = __pyx_t_5;
  __pyx_t_5 = 0;
  __Pyx_TraceReturnValue(__pyx_r, 24, 0, __PYX_ERR(0, 3068, __pyx_L1_error));
  goto __pyx_L0;

  /* "pysam/libcbcf.pyx":3061
 *         self.ptr.rid = r
 * 
 *     @property             # <<<<<<<<<<<<<<
 *     def chrom(self):
 *         """chromosome/contig name"""
*/

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_5);
  __Pyx_XDECREF(__pyx_t_6);
  __Pyx_XDECREF(__pyx_t_7);
  __Pyx_TraceException(__pyx_lineno, 0, 0);
  #if CYTHON_USE_SYS_MONITORING
  __Pyx_TraceExceptionUnwind(0, 0);
  #else
  __Pyx_TraceReturnValue(NULL, 0, 0, __PYX_ERR(0, 3061, __pyx_L1_error));
  #endif
  __Pyx_AddTraceback("pysam.libcbcf.VariantRecord.chrom.__get__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_PyMonitoring_ExitScope(0);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "pysam/libcbcf.pyx":3070
 *         return bcf_str_cache_get_charptr(bcf_hdr_id2name(hdr, rid))
 * 
 *     @chrom.setter             # <<<<<<<<<<<<<<
 *     def chrom(self, value):
 *         cdef vdict_t *d = <vdict_t*>self.header.ptr.dict[BCF_DT_CTG]
*/

/* Python wrapper */
static int __pyx_pw_5pysam_7libcbcf_13VariantRecord_5chrom_3__set__(PyObject *__pyx_v_self, PyObject *__pyx_v_value); /*proto*/
static int __pyx_pw_5pysam_7libcbcf_13VariantRecord_5chrom_3__set__(PyObject *__pyx_v_self, PyObject *__pyx_v_value) {
  CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__set__ (wrapper)", 0);
  __pyx_kwvalues = __Pyx_KwValues_VARARGS(__pyx_args, __pyx_nargs);
  __pyx_r = __pyx_pf_5pysam_7libcbcf_13VariantRecord_5chrom_2__set__(((struct __pyx_obj_5pysam_7libcbcf_VariantRecord *)__pyx_v_self), ((PyObject *)__pyx_v_value));

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

static int __pyx_pf_5pysam_7libcbcf_13VariantRecord_5chrom_2__set__(struct __pyx_obj_5pysam_7libcbcf_VariantRecord *__pyx_v_self, PyObject *__pyx_v_value) {
  vdict_t *__pyx_v_d;
  PyObject *__pyx_v_bchrom = NULL;
  khint_t __pyx_v_k;
  int __pyx_r;
  __Pyx_TraceDeclarationsFunc
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  char const *__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;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_TraceFrameInit(((PyObject *)__pyx_mstate_global->__pyx_codeobj_tab[253]))
  __Pyx_RefNannySetupContext("__set__", 0);
  __Pyx_TraceStartFunc("__set__", __pyx_f[0], 3070, 0, 0, 0, __PYX_ERR(0, 3070, __pyx_L1_error));

  /* "pysam/libcbcf.pyx":3072
 *     @chrom.setter
 *     def chrom(self, value):
 *         cdef vdict_t *d = <vdict_t*>self.header.ptr.dict[BCF_DT_CTG]             # <<<<<<<<<<<<<<
 *         bchrom = force_bytes(value)
 *         cdef khint_t k = kh_get_vdict(d, bchrom)
*/
  __pyx_v_d = ((vdict_t *)(__pyx_v_self->header->ptr->dict[BCF_DT_CTG]));

  /* "pysam/libcbcf.pyx":3073
 *     def chrom(self, value):
 *         cdef vdict_t *d = <vdict_t*>self.header.ptr.dict[BCF_DT_CTG]
 *         bchrom = force_bytes(value)             # <<<<<<<<<<<<<<
 *         cdef khint_t k = kh_get_vdict(d, bchrom)
 *         if k == kh_end(d):
*/
  __pyx_t_1 = __pyx_f_5pysam_9libcutils_force_bytes(__pyx_v_value, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 3073, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_v_bchrom = ((PyObject*)__pyx_t_1);
  __pyx_t_1 = 0;

  /* "pysam/libcbcf.pyx":3074
 *         cdef vdict_t *d = <vdict_t*>self.header.ptr.dict[BCF_DT_CTG]
 *         bchrom = force_bytes(value)
 *         cdef khint_t k = kh_get_vdict(d, bchrom)             # <<<<<<<<<<<<<<
 *         if k == kh_end(d):
 *             raise ValueError('Invalid chromosome/contig')
*/
  if (unlikely(__pyx_v_bchrom == Py_None)) {
    PyErr_SetString(PyExc_TypeError, "expected bytes, NoneType found");
    __PYX_ERR(0, 3074, __pyx_L1_error)
  }
  __pyx_t_2 = __Pyx_PyBytes_AsString(__pyx_v_bchrom); if (unlikely((!__pyx_t_2) && PyErr_Occurred())) __PYX_ERR(0, 3074, __pyx_L1_error)
  __pyx_v_k = kh_get_vdict(__pyx_v_d, __pyx_t_2);

  /* "pysam/libcbcf.pyx":3075
 *         bchrom = force_bytes(value)
 *         cdef khint_t k = kh_get_vdict(d, bchrom)
 *         if k == kh_end(d):             # <<<<<<<<<<<<<<
 *             raise ValueError('Invalid chromosome/contig')
 *         self.ptr.rid = kh_val_vdict(d, k).id
*/
  __pyx_t_3 = (__pyx_v_k == kh_end(__pyx_v_d));
  if (unlikely(__pyx_t_3)) {

    /* "pysam/libcbcf.pyx":3076
 *         cdef khint_t k = kh_get_vdict(d, bchrom)
 *         if k == kh_end(d):
 *             raise ValueError('Invalid chromosome/contig')             # <<<<<<<<<<<<<<
 *         self.ptr.rid = kh_val_vdict(d, k).id
 * 
*/
    __pyx_t_4 = NULL;
    __Pyx_INCREF(__pyx_builtin_ValueError);
    __pyx_t_5 = __pyx_builtin_ValueError; 
    __pyx_t_6 = 1;
    {
      PyObject *__pyx_callargs[2] = {__pyx_t_4, __pyx_mstate_global->__pyx_kp_u_Invalid_chromosome_contig};
      __pyx_t_1 = __Pyx_PyObject_FastCall(__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, 3076, __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, 3076, __pyx_L1_error)

    /* "pysam/libcbcf.pyx":3075
 *         bchrom = force_bytes(value)
 *         cdef khint_t k = kh_get_vdict(d, bchrom)
 *         if k == kh_end(d):             # <<<<<<<<<<<<<<
 *             raise ValueError('Invalid chromosome/contig')
 *         self.ptr.rid = kh_val_vdict(d, k).id
*/
  }

  /* "pysam/libcbcf.pyx":3077
 *         if k == kh_end(d):
 *             raise ValueError('Invalid chromosome/contig')
 *         self.ptr.rid = kh_val_vdict(d, k).id             # <<<<<<<<<<<<<<
 * 
 *     @property
*/
  __pyx_t_7 = kh_val(__pyx_v_d, __pyx_v_k).id;
  __pyx_v_self->ptr->rid = __pyx_t_7;

  /* "pysam/libcbcf.pyx":3070
 *         return bcf_str_cache_get_charptr(bcf_hdr_id2name(hdr, rid))
 * 
 *     @chrom.setter             # <<<<<<<<<<<<<<
 *     def chrom(self, value):
 *         cdef vdict_t *d = <vdict_t*>self.header.ptr.dict[BCF_DT_CTG]
*/

  /* function exit code */
  __pyx_r = 0;
  __Pyx_TraceReturnCValue(__pyx_r, __Pyx_Owned_Py_None, 0, 0, __PYX_ERR(0, 3070, __pyx_L1_error));
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_XDECREF(__pyx_t_5);
  __Pyx_TraceException(__pyx_lineno, 0, 0);
  #if CYTHON_USE_SYS_MONITORING
  __Pyx_TraceExceptionUnwind(0, 0);
  #else
  __Pyx_TraceReturnValue(NULL, 0, 0, __PYX_ERR(0, 3070, __pyx_L1_error));
  #endif
  __Pyx_AddTraceback("pysam.libcbcf.VariantRecord.chrom.__set__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = -1;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_bchrom);
  __Pyx_PyMonitoring_ExitScope(0);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "pysam/libcbcf.pyx":3079
 *         self.ptr.rid = kh_val_vdict(d, k).id
 * 
 *     @property             # <<<<<<<<<<<<<<
 *     def contig(self):
 *         """chromosome/contig name"""
*/

/* Python wrapper */
static PyObject *__pyx_pw_5pysam_7libcbcf_13VariantRecord_6contig_1__get__(PyObject *__pyx_v_self); /*proto*/
static PyObject *__pyx_pw_5pysam_7libcbcf_13VariantRecord_6contig_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_5pysam_7libcbcf_13VariantRecord_6contig___get__(((struct __pyx_obj_5pysam_7libcbcf_VariantRecord *)__pyx_v_self));

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

static PyObject *__pyx_pf_5pysam_7libcbcf_13VariantRecord_6contig___get__(struct __pyx_obj_5pysam_7libcbcf_VariantRecord *__pyx_v_self) {
  bcf_hdr_t *__pyx_v_hdr;
  int __pyx_v_rid;
  PyObject *__pyx_r = NULL;
  __Pyx_TraceDeclarationsFunc
  __Pyx_RefNannyDeclarations
  bcf_hdr_t *__pyx_t_1;
  int32_t __pyx_t_2;
  int __pyx_t_3;
  int __pyx_t_4;
  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_TraceFrameInit(((PyObject *)__pyx_mstate_global->__pyx_codeobj_tab[254]))
  __Pyx_RefNannySetupContext("__get__", 0);
  __Pyx_TraceStartFunc("__get__", __pyx_f[0], 3079, 0, 0, 0, __PYX_ERR(0, 3079, __pyx_L1_error));

  /* "pysam/libcbcf.pyx":3082
 *     def contig(self):
 *         """chromosome/contig name"""
 *         cdef bcf_hdr_t *hdr = self.header.ptr             # <<<<<<<<<<<<<<
 *         cdef int rid = self.ptr.rid
 *         if rid < 0 or rid >= hdr.n[BCF_DT_CTG]:
*/
  __pyx_t_1 = __pyx_v_self->header->ptr;
  __pyx_v_hdr = __pyx_t_1;

  /* "pysam/libcbcf.pyx":3083
 *         """chromosome/contig name"""
 *         cdef bcf_hdr_t *hdr = self.header.ptr
 *         cdef int rid = self.ptr.rid             # <<<<<<<<<<<<<<
 *         if rid < 0 or rid >= hdr.n[BCF_DT_CTG]:
 *             raise ValueError('Invalid header')
*/
  __pyx_t_2 = __pyx_v_self->ptr->rid;
  __pyx_v_rid = __pyx_t_2;

  /* "pysam/libcbcf.pyx":3084
 *         cdef bcf_hdr_t *hdr = self.header.ptr
 *         cdef int rid = self.ptr.rid
 *         if rid < 0 or rid >= hdr.n[BCF_DT_CTG]:             # <<<<<<<<<<<<<<
 *             raise ValueError('Invalid header')
 *         return bcf_str_cache_get_charptr(bcf_hdr_id2name(hdr, rid))
*/
  __pyx_t_4 = (__pyx_v_rid < 0);
  if (!__pyx_t_4) {
  } else {
    __pyx_t_3 = __pyx_t_4;
    goto __pyx_L4_bool_binop_done;
  }
  __pyx_t_4 = (__pyx_v_rid >= (__pyx_v_hdr->n[BCF_DT_CTG]));
  __pyx_t_3 = __pyx_t_4;
  __pyx_L4_bool_binop_done:;
  if (unlikely(__pyx_t_3)) {

    /* "pysam/libcbcf.pyx":3085
 *         cdef int rid = self.ptr.rid
 *         if rid < 0 or rid >= hdr.n[BCF_DT_CTG]:
 *             raise ValueError('Invalid header')             # <<<<<<<<<<<<<<
 *         return bcf_str_cache_get_charptr(bcf_hdr_id2name(hdr, rid))
 * 
*/
    __pyx_t_6 = NULL;
    __Pyx_INCREF(__pyx_builtin_ValueError);
    __pyx_t_7 = __pyx_builtin_ValueError; 
    __pyx_t_8 = 1;
    {
      PyObject *__pyx_callargs[2] = {__pyx_t_6, __pyx_mstate_global->__pyx_kp_u_Invalid_header};
      __pyx_t_5 = __Pyx_PyObject_FastCall(__pyx_t_7, __pyx_callargs+__pyx_t_8, (2-__pyx_t_8) | (__pyx_t_8*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
      __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0;
      __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
      if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 3085, __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, 3085, __pyx_L1_error)

    /* "pysam/libcbcf.pyx":3084
 *         cdef bcf_hdr_t *hdr = self.header.ptr
 *         cdef int rid = self.ptr.rid
 *         if rid < 0 or rid >= hdr.n[BCF_DT_CTG]:             # <<<<<<<<<<<<<<
 *             raise ValueError('Invalid header')
 *         return bcf_str_cache_get_charptr(bcf_hdr_id2name(hdr, rid))
*/
  }

  /* "pysam/libcbcf.pyx":3086
 *         if rid < 0 or rid >= hdr.n[BCF_DT_CTG]:
 *             raise ValueError('Invalid header')
 *         return bcf_str_cache_get_charptr(bcf_hdr_id2name(hdr, rid))             # <<<<<<<<<<<<<<
 * 
 *     @contig.setter
*/
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_5 = __pyx_f_5pysam_7libcbcf_bcf_str_cache_get_charptr(bcf_hdr_id2name(__pyx_v_hdr, __pyx_v_rid)); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 3086, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_5);
  __pyx_r = __pyx_t_5;
  __pyx_t_5 = 0;
  __Pyx_TraceReturnValue(__pyx_r, 24, 0, __PYX_ERR(0, 3086, __pyx_L1_error));
  goto __pyx_L0;

  /* "pysam/libcbcf.pyx":3079
 *         self.ptr.rid = kh_val_vdict(d, k).id
 * 
 *     @property             # <<<<<<<<<<<<<<
 *     def contig(self):
 *         """chromosome/contig name"""
*/

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_5);
  __Pyx_XDECREF(__pyx_t_6);
  __Pyx_XDECREF(__pyx_t_7);
  __Pyx_TraceException(__pyx_lineno, 0, 0);
  #if CYTHON_USE_SYS_MONITORING
  __Pyx_TraceExceptionUnwind(0, 0);
  #else
  __Pyx_TraceReturnValue(NULL, 0, 0, __PYX_ERR(0, 3079, __pyx_L1_error));
  #endif
  __Pyx_AddTraceback("pysam.libcbcf.VariantRecord.contig.__get__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_PyMonitoring_ExitScope(0);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "pysam/libcbcf.pyx":3088
 *         return bcf_str_cache_get_charptr(bcf_hdr_id2name(hdr, rid))
 * 
 *     @contig.setter             # <<<<<<<<<<<<<<
 *     def contig(self, value):
 *         cdef vdict_t *d = <vdict_t*>self.header.ptr.dict[BCF_DT_CTG]
*/

/* Python wrapper */
static int __pyx_pw_5pysam_7libcbcf_13VariantRecord_6contig_3__set__(PyObject *__pyx_v_self, PyObject *__pyx_v_value); /*proto*/
static int __pyx_pw_5pysam_7libcbcf_13VariantRecord_6contig_3__set__(PyObject *__pyx_v_self, PyObject *__pyx_v_value) {
  CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__set__ (wrapper)", 0);
  __pyx_kwvalues = __Pyx_KwValues_VARARGS(__pyx_args, __pyx_nargs);
  __pyx_r = __pyx_pf_5pysam_7libcbcf_13VariantRecord_6contig_2__set__(((struct __pyx_obj_5pysam_7libcbcf_VariantRecord *)__pyx_v_self), ((PyObject *)__pyx_v_value));

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

static int __pyx_pf_5pysam_7libcbcf_13VariantRecord_6contig_2__set__(struct __pyx_obj_5pysam_7libcbcf_VariantRecord *__pyx_v_self, PyObject *__pyx_v_value) {
  vdict_t *__pyx_v_d;
  PyObject *__pyx_v_bchrom = NULL;
  khint_t __pyx_v_k;
  int __pyx_r;
  __Pyx_TraceDeclarationsFunc
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  char const *__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;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_TraceFrameInit(((PyObject *)__pyx_mstate_global->__pyx_codeobj_tab[255]))
  __Pyx_RefNannySetupContext("__set__", 0);
  __Pyx_TraceStartFunc("__set__", __pyx_f[0], 3088, 0, 0, 0, __PYX_ERR(0, 3088, __pyx_L1_error));

  /* "pysam/libcbcf.pyx":3090
 *     @contig.setter
 *     def contig(self, value):
 *         cdef vdict_t *d = <vdict_t*>self.header.ptr.dict[BCF_DT_CTG]             # <<<<<<<<<<<<<<
 *         bchrom = force_bytes(value)
 *         cdef khint_t k = kh_get_vdict(d, bchrom)
*/
  __pyx_v_d = ((vdict_t *)(__pyx_v_self->header->ptr->dict[BCF_DT_CTG]));

  /* "pysam/libcbcf.pyx":3091
 *     def contig(self, value):
 *         cdef vdict_t *d = <vdict_t*>self.header.ptr.dict[BCF_DT_CTG]
 *         bchrom = force_bytes(value)             # <<<<<<<<<<<<<<
 *         cdef khint_t k = kh_get_vdict(d, bchrom)
 *         if k == kh_end(d):
*/
  __pyx_t_1 = __pyx_f_5pysam_9libcutils_force_bytes(__pyx_v_value, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 3091, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_v_bchrom = ((PyObject*)__pyx_t_1);
  __pyx_t_1 = 0;

  /* "pysam/libcbcf.pyx":3092
 *         cdef vdict_t *d = <vdict_t*>self.header.ptr.dict[BCF_DT_CTG]
 *         bchrom = force_bytes(value)
 *         cdef khint_t k = kh_get_vdict(d, bchrom)             # <<<<<<<<<<<<<<
 *         if k == kh_end(d):
 *             raise ValueError('Invalid chromosome/contig')
*/
  if (unlikely(__pyx_v_bchrom == Py_None)) {
    PyErr_SetString(PyExc_TypeError, "expected bytes, NoneType found");
    __PYX_ERR(0, 3092, __pyx_L1_error)
  }
  __pyx_t_2 = __Pyx_PyBytes_AsString(__pyx_v_bchrom); if (unlikely((!__pyx_t_2) && PyErr_Occurred())) __PYX_ERR(0, 3092, __pyx_L1_error)
  __pyx_v_k = kh_get_vdict(__pyx_v_d, __pyx_t_2);

  /* "pysam/libcbcf.pyx":3093
 *         bchrom = force_bytes(value)
 *         cdef khint_t k = kh_get_vdict(d, bchrom)
 *         if k == kh_end(d):             # <<<<<<<<<<<<<<
 *             raise ValueError('Invalid chromosome/contig')
 *         self.ptr.rid = kh_val_vdict(d, k).id
*/
  __pyx_t_3 = (__pyx_v_k == kh_end(__pyx_v_d));
  if (unlikely(__pyx_t_3)) {

    /* "pysam/libcbcf.pyx":3094
 *         cdef khint_t k = kh_get_vdict(d, bchrom)
 *         if k == kh_end(d):
 *             raise ValueError('Invalid chromosome/contig')             # <<<<<<<<<<<<<<
 *         self.ptr.rid = kh_val_vdict(d, k).id
 * 
*/
    __pyx_t_4 = NULL;
    __Pyx_INCREF(__pyx_builtin_ValueError);
    __pyx_t_5 = __pyx_builtin_ValueError; 
    __pyx_t_6 = 1;
    {
      PyObject *__pyx_callargs[2] = {__pyx_t_4, __pyx_mstate_global->__pyx_kp_u_Invalid_chromosome_contig};
      __pyx_t_1 = __Pyx_PyObject_FastCall(__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, 3094, __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, 3094, __pyx_L1_error)

    /* "pysam/libcbcf.pyx":3093
 *         bchrom = force_bytes(value)
 *         cdef khint_t k = kh_get_vdict(d, bchrom)
 *         if k == kh_end(d):             # <<<<<<<<<<<<<<
 *             raise ValueError('Invalid chromosome/contig')
 *         self.ptr.rid = kh_val_vdict(d, k).id
*/
  }

  /* "pysam/libcbcf.pyx":3095
 *         if k == kh_end(d):
 *             raise ValueError('Invalid chromosome/contig')
 *         self.ptr.rid = kh_val_vdict(d, k).id             # <<<<<<<<<<<<<<
 * 
 *     @property
*/
  __pyx_t_7 = kh_val(__pyx_v_d, __pyx_v_k).id;
  __pyx_v_self->ptr->rid = __pyx_t_7;

  /* "pysam/libcbcf.pyx":3088
 *         return bcf_str_cache_get_charptr(bcf_hdr_id2name(hdr, rid))
 * 
 *     @contig.setter             # <<<<<<<<<<<<<<
 *     def contig(self, value):
 *         cdef vdict_t *d = <vdict_t*>self.header.ptr.dict[BCF_DT_CTG]
*/

  /* function exit code */
  __pyx_r = 0;
  __Pyx_TraceReturnCValue(__pyx_r, __Pyx_Owned_Py_None, 0, 0, __PYX_ERR(0, 3088, __pyx_L1_error));
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_XDECREF(__pyx_t_5);
  __Pyx_TraceException(__pyx_lineno, 0, 0);
  #if CYTHON_USE_SYS_MONITORING
  __Pyx_TraceExceptionUnwind(0, 0);
  #else
  __Pyx_TraceReturnValue(NULL, 0, 0, __PYX_ERR(0, 3088, __pyx_L1_error));
  #endif
  __Pyx_AddTraceback("pysam.libcbcf.VariantRecord.contig.__set__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = -1;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_bchrom);
  __Pyx_PyMonitoring_ExitScope(0);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "pysam/libcbcf.pyx":3097
 *         self.ptr.rid = kh_val_vdict(d, k).id
 * 
 *     @property             # <<<<<<<<<<<<<<
 *     def pos(self):
 *         """record start position on chrom/contig (1-based inclusive)"""
*/

/* Python wrapper */
static PyObject *__pyx_pw_5pysam_7libcbcf_13VariantRecord_3pos_1__get__(PyObject *__pyx_v_self); /*proto*/
static PyObject *__pyx_pw_5pysam_7libcbcf_13VariantRecord_3pos_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_5pysam_7libcbcf_13VariantRecord_3pos___get__(((struct __pyx_obj_5pysam_7libcbcf_VariantRecord *)__pyx_v_self));

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

static PyObject *__pyx_pf_5pysam_7libcbcf_13VariantRecord_3pos___get__(struct __pyx_obj_5pysam_7libcbcf_VariantRecord *__pyx_v_self) {
  PyObject *__pyx_r = NULL;
  __Pyx_TraceDeclarationsFunc
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_TraceFrameInit(((PyObject *)__pyx_mstate_global->__pyx_codeobj_tab[256]))
  __Pyx_RefNannySetupContext("__get__", 0);
  __Pyx_TraceStartFunc("__get__", __pyx_f[0], 3097, 0, 0, 0, __PYX_ERR(0, 3097, __pyx_L1_error));

  /* "pysam/libcbcf.pyx":3100
 *     def pos(self):
 *         """record start position on chrom/contig (1-based inclusive)"""
 *         return self.ptr.pos + 1             # <<<<<<<<<<<<<<
 * 
 *     @pos.setter
*/
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = __Pyx_PyLong_From_long((__pyx_v_self->ptr->pos + 1)); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 3100, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  __Pyx_TraceReturnValue(__pyx_r, 1, 0, __PYX_ERR(0, 3100, __pyx_L1_error));
  goto __pyx_L0;

  /* "pysam/libcbcf.pyx":3097
 *         self.ptr.rid = kh_val_vdict(d, k).id
 * 
 *     @property             # <<<<<<<<<<<<<<
 *     def pos(self):
 *         """record start position on chrom/contig (1-based inclusive)"""
*/

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_TraceException(__pyx_lineno, 0, 0);
  #if CYTHON_USE_SYS_MONITORING
  __Pyx_TraceExceptionUnwind(0, 0);
  #else
  __Pyx_TraceReturnValue(NULL, 0, 0, __PYX_ERR(0, 3097, __pyx_L1_error));
  #endif
  __Pyx_AddTraceback("pysam.libcbcf.VariantRecord.pos.__get__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_PyMonitoring_ExitScope(0);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "pysam/libcbcf.pyx":3102
 *         return self.ptr.pos + 1
 * 
 *     @pos.setter             # <<<<<<<<<<<<<<
 *     def pos(self, value):
 *         cdef int p = value
*/

/* Python wrapper */
static int __pyx_pw_5pysam_7libcbcf_13VariantRecord_3pos_3__set__(PyObject *__pyx_v_self, PyObject *__pyx_v_value); /*proto*/
static int __pyx_pw_5pysam_7libcbcf_13VariantRecord_3pos_3__set__(PyObject *__pyx_v_self, PyObject *__pyx_v_value) {
  CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__set__ (wrapper)", 0);
  __pyx_kwvalues = __Pyx_KwValues_VARARGS(__pyx_args, __pyx_nargs);
  __pyx_r = __pyx_pf_5pysam_7libcbcf_13VariantRecord_3pos_2__set__(((struct __pyx_obj_5pysam_7libcbcf_VariantRecord *)__pyx_v_self), ((PyObject *)__pyx_v_value));

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

static int __pyx_pf_5pysam_7libcbcf_13VariantRecord_3pos_2__set__(struct __pyx_obj_5pysam_7libcbcf_VariantRecord *__pyx_v_self, PyObject *__pyx_v_value) {
  int __pyx_v_p;
  int __pyx_r;
  __Pyx_TraceDeclarationsFunc
  __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_TraceFrameInit(((PyObject *)__pyx_mstate_global->__pyx_codeobj_tab[257]))
  __Pyx_RefNannySetupContext("__set__", 0);
  __Pyx_TraceStartFunc("__set__", __pyx_f[0], 3102, 0, 0, 0, __PYX_ERR(0, 3102, __pyx_L1_error));

  /* "pysam/libcbcf.pyx":3104
 *     @pos.setter
 *     def pos(self, value):
 *         cdef int p = value             # <<<<<<<<<<<<<<
 *         if p < 1:
 *             raise ValueError('Position must be positive')
*/
  __pyx_t_1 = __Pyx_PyLong_As_int(__pyx_v_value); if (unlikely((__pyx_t_1 == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 3104, __pyx_L1_error)
  __pyx_v_p = __pyx_t_1;

  /* "pysam/libcbcf.pyx":3105
 *     def pos(self, value):
 *         cdef int p = value
 *         if p < 1:             # <<<<<<<<<<<<<<
 *             raise ValueError('Position must be positive')
 *         self.ptr.pos = p - 1
*/
  __pyx_t_2 = (__pyx_v_p < 1);
  if (unlikely(__pyx_t_2)) {

    /* "pysam/libcbcf.pyx":3106
 *         cdef int p = value
 *         if p < 1:
 *             raise ValueError('Position must be positive')             # <<<<<<<<<<<<<<
 *         self.ptr.pos = p - 1
 *         bcf_sync_end(self)
*/
    __pyx_t_4 = NULL;
    __Pyx_INCREF(__pyx_builtin_ValueError);
    __pyx_t_5 = __pyx_builtin_ValueError; 
    __pyx_t_6 = 1;
    {
      PyObject *__pyx_callargs[2] = {__pyx_t_4, __pyx_mstate_global->__pyx_kp_u_Position_must_be_positive};
      __pyx_t_3 = __Pyx_PyObject_FastCall(__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, 3106, __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, 3106, __pyx_L1_error)

    /* "pysam/libcbcf.pyx":3105
 *     def pos(self, value):
 *         cdef int p = value
 *         if p < 1:             # <<<<<<<<<<<<<<
 *             raise ValueError('Position must be positive')
 *         self.ptr.pos = p - 1
*/
  }

  /* "pysam/libcbcf.pyx":3107
 *         if p < 1:
 *             raise ValueError('Position must be positive')
 *         self.ptr.pos = p - 1             # <<<<<<<<<<<<<<
 *         bcf_sync_end(self)
 * 
*/
  __pyx_v_self->ptr->pos = (__pyx_v_p - 1);

  /* "pysam/libcbcf.pyx":3108
 *             raise ValueError('Position must be positive')
 *         self.ptr.pos = p - 1
 *         bcf_sync_end(self)             # <<<<<<<<<<<<<<
 * 
 *     @property
*/
  __pyx_t_3 = __pyx_f_5pysam_7libcbcf_bcf_sync_end(__pyx_v_self); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 3108, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;

  /* "pysam/libcbcf.pyx":3102
 *         return self.ptr.pos + 1
 * 
 *     @pos.setter             # <<<<<<<<<<<<<<
 *     def pos(self, value):
 *         cdef int p = value
*/

  /* function exit code */
  __pyx_r = 0;
  __Pyx_TraceReturnCValue(__pyx_r, __Pyx_Owned_Py_None, 0, 0, __PYX_ERR(0, 3102, __pyx_L1_error));
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_XDECREF(__pyx_t_5);
  __Pyx_TraceException(__pyx_lineno, 0, 0);
  #if CYTHON_USE_SYS_MONITORING
  __Pyx_TraceExceptionUnwind(0, 0);
  #else
  __Pyx_TraceReturnValue(NULL, 0, 0, __PYX_ERR(0, 3102, __pyx_L1_error));
  #endif
  __Pyx_AddTraceback("pysam.libcbcf.VariantRecord.pos.__set__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = -1;
  __pyx_L0:;
  __Pyx_PyMonitoring_ExitScope(0);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "pysam/libcbcf.pyx":3110
 *         bcf_sync_end(self)
 * 
 *     @property             # <<<<<<<<<<<<<<
 *     def start(self):
 *         """record start position on chrom/contig (0-based inclusive)"""
*/

/* Python wrapper */
static PyObject *__pyx_pw_5pysam_7libcbcf_13VariantRecord_5start_1__get__(PyObject *__pyx_v_self); /*proto*/
static PyObject *__pyx_pw_5pysam_7libcbcf_13VariantRecord_5start_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_5pysam_7libcbcf_13VariantRecord_5start___get__(((struct __pyx_obj_5pysam_7libcbcf_VariantRecord *)__pyx_v_self));

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

static PyObject *__pyx_pf_5pysam_7libcbcf_13VariantRecord_5start___get__(struct __pyx_obj_5pysam_7libcbcf_VariantRecord *__pyx_v_self) {
  PyObject *__pyx_r = NULL;
  __Pyx_TraceDeclarationsFunc
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_TraceFrameInit(((PyObject *)__pyx_mstate_global->__pyx_codeobj_tab[258]))
  __Pyx_RefNannySetupContext("__get__", 0);
  __Pyx_TraceStartFunc("__get__", __pyx_f[0], 3110, 0, 0, 0, __PYX_ERR(0, 3110, __pyx_L1_error));

  /* "pysam/libcbcf.pyx":3113
 *     def start(self):
 *         """record start position on chrom/contig (0-based inclusive)"""
 *         return self.ptr.pos             # <<<<<<<<<<<<<<
 * 
 *     @start.setter
*/
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = __Pyx_PyLong_From_int32_t(__pyx_v_self->ptr->pos); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 3113, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  __Pyx_TraceReturnValue(__pyx_r, 1, 0, __PYX_ERR(0, 3113, __pyx_L1_error));
  goto __pyx_L0;

  /* "pysam/libcbcf.pyx":3110
 *         bcf_sync_end(self)
 * 
 *     @property             # <<<<<<<<<<<<<<
 *     def start(self):
 *         """record start position on chrom/contig (0-based inclusive)"""
*/

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_TraceException(__pyx_lineno, 0, 0);
  #if CYTHON_USE_SYS_MONITORING
  __Pyx_TraceExceptionUnwind(0, 0);
  #else
  __Pyx_TraceReturnValue(NULL, 0, 0, __PYX_ERR(0, 3110, __pyx_L1_error));
  #endif
  __Pyx_AddTraceback("pysam.libcbcf.VariantRecord.start.__get__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_PyMonitoring_ExitScope(0);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "pysam/libcbcf.pyx":3115
 *         return self.ptr.pos
 * 
 *     @start.setter             # <<<<<<<<<<<<<<
 *     def start(self, value):
 *         cdef int s = value
*/

/* Python wrapper */
static int __pyx_pw_5pysam_7libcbcf_13VariantRecord_5start_3__set__(PyObject *__pyx_v_self, PyObject *__pyx_v_value); /*proto*/
static int __pyx_pw_5pysam_7libcbcf_13VariantRecord_5start_3__set__(PyObject *__pyx_v_self, PyObject *__pyx_v_value) {
  CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__set__ (wrapper)", 0);
  __pyx_kwvalues = __Pyx_KwValues_VARARGS(__pyx_args, __pyx_nargs);
  __pyx_r = __pyx_pf_5pysam_7libcbcf_13VariantRecord_5start_2__set__(((struct __pyx_obj_5pysam_7libcbcf_VariantRecord *)__pyx_v_self), ((PyObject *)__pyx_v_value));

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

static int __pyx_pf_5pysam_7libcbcf_13VariantRecord_5start_2__set__(struct __pyx_obj_5pysam_7libcbcf_VariantRecord *__pyx_v_self, PyObject *__pyx_v_value) {
  int __pyx_v_s;
  int __pyx_r;
  __Pyx_TraceDeclarationsFunc
  __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_TraceFrameInit(((PyObject *)__pyx_mstate_global->__pyx_codeobj_tab[259]))
  __Pyx_RefNannySetupContext("__set__", 0);
  __Pyx_TraceStartFunc("__set__", __pyx_f[0], 3115, 0, 0, 0, __PYX_ERR(0, 3115, __pyx_L1_error));

  /* "pysam/libcbcf.pyx":3117
 *     @start.setter
 *     def start(self, value):
 *         cdef int s = value             # <<<<<<<<<<<<<<
 *         if s < 0:
 *             raise ValueError('Start coordinate must be non-negative')
*/
  __pyx_t_1 = __Pyx_PyLong_As_int(__pyx_v_value); if (unlikely((__pyx_t_1 == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 3117, __pyx_L1_error)
  __pyx_v_s = __pyx_t_1;

  /* "pysam/libcbcf.pyx":3118
 *     def start(self, value):
 *         cdef int s = value
 *         if s < 0:             # <<<<<<<<<<<<<<
 *             raise ValueError('Start coordinate must be non-negative')
 *         self.ptr.pos = s
*/
  __pyx_t_2 = (__pyx_v_s < 0);
  if (unlikely(__pyx_t_2)) {

    /* "pysam/libcbcf.pyx":3119
 *         cdef int s = value
 *         if s < 0:
 *             raise ValueError('Start coordinate must be non-negative')             # <<<<<<<<<<<<<<
 *         self.ptr.pos = s
 *         bcf_sync_end(self)
*/
    __pyx_t_4 = NULL;
    __Pyx_INCREF(__pyx_builtin_ValueError);
    __pyx_t_5 = __pyx_builtin_ValueError; 
    __pyx_t_6 = 1;
    {
      PyObject *__pyx_callargs[2] = {__pyx_t_4, __pyx_mstate_global->__pyx_kp_u_Start_coordinate_must_be_non_neg};
      __pyx_t_3 = __Pyx_PyObject_FastCall(__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, 3119, __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, 3119, __pyx_L1_error)

    /* "pysam/libcbcf.pyx":3118
 *     def start(self, value):
 *         cdef int s = value
 *         if s < 0:             # <<<<<<<<<<<<<<
 *             raise ValueError('Start coordinate must be non-negative')
 *         self.ptr.pos = s
*/
  }

  /* "pysam/libcbcf.pyx":3120
 *         if s < 0:
 *             raise ValueError('Start coordinate must be non-negative')
 *         self.ptr.pos = s             # <<<<<<<<<<<<<<
 *         bcf_sync_end(self)
 * 
*/
  __pyx_v_self->ptr->pos = __pyx_v_s;

  /* "pysam/libcbcf.pyx":3121
 *             raise ValueError('Start coordinate must be non-negative')
 *         self.ptr.pos = s
 *         bcf_sync_end(self)             # <<<<<<<<<<<<<<
 * 
 *     @property
*/
  __pyx_t_3 = __pyx_f_5pysam_7libcbcf_bcf_sync_end(__pyx_v_self); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 3121, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;

  /* "pysam/libcbcf.pyx":3115
 *         return self.ptr.pos
 * 
 *     @start.setter             # <<<<<<<<<<<<<<
 *     def start(self, value):
 *         cdef int s = value
*/

  /* function exit code */
  __pyx_r = 0;
  __Pyx_TraceReturnCValue(__pyx_r, __Pyx_Owned_Py_None, 0, 0, __PYX_ERR(0, 3115, __pyx_L1_error));
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_XDECREF(__pyx_t_5);
  __Pyx_TraceException(__pyx_lineno, 0, 0);
  #if CYTHON_USE_SYS_MONITORING
  __Pyx_TraceExceptionUnwind(0, 0);
  #else
  __Pyx_TraceReturnValue(NULL, 0, 0, __PYX_ERR(0, 3115, __pyx_L1_error));
  #endif
  __Pyx_AddTraceback("pysam.libcbcf.VariantRecord.start.__set__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = -1;
  __pyx_L0:;
  __Pyx_PyMonitoring_ExitScope(0);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "pysam/libcbcf.pyx":3123
 *         bcf_sync_end(self)
 * 
 *     @property             # <<<<<<<<<<<<<<
 *     def stop(self):
 *         """record stop position on chrom/contig (0-based exclusive)"""
*/

/* Python wrapper */
static PyObject *__pyx_pw_5pysam_7libcbcf_13VariantRecord_4stop_1__get__(PyObject *__pyx_v_self); /*proto*/
static PyObject *__pyx_pw_5pysam_7libcbcf_13VariantRecord_4stop_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_5pysam_7libcbcf_13VariantRecord_4stop___get__(((struct __pyx_obj_5pysam_7libcbcf_VariantRecord *)__pyx_v_self));

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

static PyObject *__pyx_pf_5pysam_7libcbcf_13VariantRecord_4stop___get__(struct __pyx_obj_5pysam_7libcbcf_VariantRecord *__pyx_v_self) {
  PyObject *__pyx_r = NULL;
  __Pyx_TraceDeclarationsFunc
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_TraceFrameInit(((PyObject *)__pyx_mstate_global->__pyx_codeobj_tab[260]))
  __Pyx_RefNannySetupContext("__get__", 0);
  __Pyx_TraceStartFunc("__get__", __pyx_f[0], 3123, 0, 0, 0, __PYX_ERR(0, 3123, __pyx_L1_error));

  /* "pysam/libcbcf.pyx":3126
 *     def stop(self):
 *         """record stop position on chrom/contig (0-based exclusive)"""
 *         return self.ptr.pos + self.ptr.rlen             # <<<<<<<<<<<<<<
 * 
 *     @stop.setter
*/
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = __Pyx_PyLong_From_int32_t((__pyx_v_self->ptr->pos + __pyx_v_self->ptr->rlen)); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 3126, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  __Pyx_TraceReturnValue(__pyx_r, 1, 0, __PYX_ERR(0, 3126, __pyx_L1_error));
  goto __pyx_L0;

  /* "pysam/libcbcf.pyx":3123
 *         bcf_sync_end(self)
 * 
 *     @property             # <<<<<<<<<<<<<<
 *     def stop(self):
 *         """record stop position on chrom/contig (0-based exclusive)"""
*/

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_TraceException(__pyx_lineno, 0, 0);
  #if CYTHON_USE_SYS_MONITORING
  __Pyx_TraceExceptionUnwind(0, 0);
  #else
  __Pyx_TraceReturnValue(NULL, 0, 0, __PYX_ERR(0, 3123, __pyx_L1_error));
  #endif
  __Pyx_AddTraceback("pysam.libcbcf.VariantRecord.stop.__get__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_PyMonitoring_ExitScope(0);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "pysam/libcbcf.pyx":3128
 *         return self.ptr.pos + self.ptr.rlen
 * 
 *     @stop.setter             # <<<<<<<<<<<<<<
 *     def stop(self, value):
 *         cdef int s = value
*/

/* Python wrapper */
static int __pyx_pw_5pysam_7libcbcf_13VariantRecord_4stop_3__set__(PyObject *__pyx_v_self, PyObject *__pyx_v_value); /*proto*/
static int __pyx_pw_5pysam_7libcbcf_13VariantRecord_4stop_3__set__(PyObject *__pyx_v_self, PyObject *__pyx_v_value) {
  CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__set__ (wrapper)", 0);
  __pyx_kwvalues = __Pyx_KwValues_VARARGS(__pyx_args, __pyx_nargs);
  __pyx_r = __pyx_pf_5pysam_7libcbcf_13VariantRecord_4stop_2__set__(((struct __pyx_obj_5pysam_7libcbcf_VariantRecord *)__pyx_v_self), ((PyObject *)__pyx_v_value));

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

static int __pyx_pf_5pysam_7libcbcf_13VariantRecord_4stop_2__set__(struct __pyx_obj_5pysam_7libcbcf_VariantRecord *__pyx_v_self, PyObject *__pyx_v_value) {
  int __pyx_v_s;
  int __pyx_r;
  __Pyx_TraceDeclarationsFunc
  __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_TraceFrameInit(((PyObject *)__pyx_mstate_global->__pyx_codeobj_tab[261]))
  __Pyx_RefNannySetupContext("__set__", 0);
  __Pyx_TraceStartFunc("__set__", __pyx_f[0], 3128, 0, 0, 0, __PYX_ERR(0, 3128, __pyx_L1_error));

  /* "pysam/libcbcf.pyx":3130
 *     @stop.setter
 *     def stop(self, value):
 *         cdef int s = value             # <<<<<<<<<<<<<<
 *         if s < 0:
 *             raise ValueError('Stop coordinate must be non-negative')
*/
  __pyx_t_1 = __Pyx_PyLong_As_int(__pyx_v_value); if (unlikely((__pyx_t_1 == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 3130, __pyx_L1_error)
  __pyx_v_s = __pyx_t_1;

  /* "pysam/libcbcf.pyx":3131
 *     def stop(self, value):
 *         cdef int s = value
 *         if s < 0:             # <<<<<<<<<<<<<<
 *             raise ValueError('Stop coordinate must be non-negative')
 *         self.ptr.rlen = s - self.ptr.pos
*/
  __pyx_t_2 = (__pyx_v_s < 0);
  if (unlikely(__pyx_t_2)) {

    /* "pysam/libcbcf.pyx":3132
 *         cdef int s = value
 *         if s < 0:
 *             raise ValueError('Stop coordinate must be non-negative')             # <<<<<<<<<<<<<<
 *         self.ptr.rlen = s - self.ptr.pos
 *         bcf_sync_end(self)
*/
    __pyx_t_4 = NULL;
    __Pyx_INCREF(__pyx_builtin_ValueError);
    __pyx_t_5 = __pyx_builtin_ValueError; 
    __pyx_t_6 = 1;
    {
      PyObject *__pyx_callargs[2] = {__pyx_t_4, __pyx_mstate_global->__pyx_kp_u_Stop_coordinate_must_be_non_nega};
      __pyx_t_3 = __Pyx_PyObject_FastCall(__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, 3132, __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, 3132, __pyx_L1_error)

    /* "pysam/libcbcf.pyx":3131
 *     def stop(self, value):
 *         cdef int s = value
 *         if s < 0:             # <<<<<<<<<<<<<<
 *             raise ValueError('Stop coordinate must be non-negative')
 *         self.ptr.rlen = s - self.ptr.pos
*/
  }

  /* "pysam/libcbcf.pyx":3133
 *         if s < 0:
 *             raise ValueError('Stop coordinate must be non-negative')
 *         self.ptr.rlen = s - self.ptr.pos             # <<<<<<<<<<<<<<
 *         bcf_sync_end(self)
 * 
*/
  __pyx_v_self->ptr->rlen = (__pyx_v_s - __pyx_v_self->ptr->pos);

  /* "pysam/libcbcf.pyx":3134
 *             raise ValueError('Stop coordinate must be non-negative')
 *         self.ptr.rlen = s - self.ptr.pos
 *         bcf_sync_end(self)             # <<<<<<<<<<<<<<
 * 
 *     @property
*/
  __pyx_t_3 = __pyx_f_5pysam_7libcbcf_bcf_sync_end(__pyx_v_self); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 3134, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;

  /* "pysam/libcbcf.pyx":3128
 *         return self.ptr.pos + self.ptr.rlen
 * 
 *     @stop.setter             # <<<<<<<<<<<<<<
 *     def stop(self, value):
 *         cdef int s = value
*/

  /* function exit code */
  __pyx_r = 0;
  __Pyx_TraceReturnCValue(__pyx_r, __Pyx_Owned_Py_None, 0, 0, __PYX_ERR(0, 3128, __pyx_L1_error));
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_XDECREF(__pyx_t_5);
  __Pyx_TraceException(__pyx_lineno, 0, 0);
  #if CYTHON_USE_SYS_MONITORING
  __Pyx_TraceExceptionUnwind(0, 0);
  #else
  __Pyx_TraceReturnValue(NULL, 0, 0, __PYX_ERR(0, 3128, __pyx_L1_error));
  #endif
  __Pyx_AddTraceback("pysam.libcbcf.VariantRecord.stop.__set__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = -1;
  __pyx_L0:;
  __Pyx_PyMonitoring_ExitScope(0);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "pysam/libcbcf.pyx":3136
 *         bcf_sync_end(self)
 * 
 *     @property             # <<<<<<<<<<<<<<
 *     def rlen(self):
 *         """record length on chrom/contig (aka rec.stop - rec.start)"""
*/

/* Python wrapper */
static PyObject *__pyx_pw_5pysam_7libcbcf_13VariantRecord_4rlen_1__get__(PyObject *__pyx_v_self); /*proto*/
static PyObject *__pyx_pw_5pysam_7libcbcf_13VariantRecord_4rlen_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_5pysam_7libcbcf_13VariantRecord_4rlen___get__(((struct __pyx_obj_5pysam_7libcbcf_VariantRecord *)__pyx_v_self));

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

static PyObject *__pyx_pf_5pysam_7libcbcf_13VariantRecord_4rlen___get__(struct __pyx_obj_5pysam_7libcbcf_VariantRecord *__pyx_v_self) {
  PyObject *__pyx_r = NULL;
  __Pyx_TraceDeclarationsFunc
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_TraceFrameInit(((PyObject *)__pyx_mstate_global->__pyx_codeobj_tab[262]))
  __Pyx_RefNannySetupContext("__get__", 0);
  __Pyx_TraceStartFunc("__get__", __pyx_f[0], 3136, 0, 0, 0, __PYX_ERR(0, 3136, __pyx_L1_error));

  /* "pysam/libcbcf.pyx":3139
 *     def rlen(self):
 *         """record length on chrom/contig (aka rec.stop - rec.start)"""
 *         return self.ptr.rlen             # <<<<<<<<<<<<<<
 * 
 *     @rlen.setter
*/
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = __Pyx_PyLong_From_int32_t(__pyx_v_self->ptr->rlen); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 3139, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  __Pyx_TraceReturnValue(__pyx_r, 1, 0, __PYX_ERR(0, 3139, __pyx_L1_error));
  goto __pyx_L0;

  /* "pysam/libcbcf.pyx":3136
 *         bcf_sync_end(self)
 * 
 *     @property             # <<<<<<<<<<<<<<
 *     def rlen(self):
 *         """record length on chrom/contig (aka rec.stop - rec.start)"""
*/

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_TraceException(__pyx_lineno, 0, 0);
  #if CYTHON_USE_SYS_MONITORING
  __Pyx_TraceExceptionUnwind(0, 0);
  #else
  __Pyx_TraceReturnValue(NULL, 0, 0, __PYX_ERR(0, 3136, __pyx_L1_error));
  #endif
  __Pyx_AddTraceback("pysam.libcbcf.VariantRecord.rlen.__get__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_PyMonitoring_ExitScope(0);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "pysam/libcbcf.pyx":3141
 *         return self.ptr.rlen
 * 
 *     @rlen.setter             # <<<<<<<<<<<<<<
 *     def rlen(self, value):
 *         cdef int r = value
*/

/* Python wrapper */
static int __pyx_pw_5pysam_7libcbcf_13VariantRecord_4rlen_3__set__(PyObject *__pyx_v_self, PyObject *__pyx_v_value); /*proto*/
static int __pyx_pw_5pysam_7libcbcf_13VariantRecord_4rlen_3__set__(PyObject *__pyx_v_self, PyObject *__pyx_v_value) {
  CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__set__ (wrapper)", 0);
  __pyx_kwvalues = __Pyx_KwValues_VARARGS(__pyx_args, __pyx_nargs);
  __pyx_r = __pyx_pf_5pysam_7libcbcf_13VariantRecord_4rlen_2__set__(((struct __pyx_obj_5pysam_7libcbcf_VariantRecord *)__pyx_v_self), ((PyObject *)__pyx_v_value));

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

static int __pyx_pf_5pysam_7libcbcf_13VariantRecord_4rlen_2__set__(struct __pyx_obj_5pysam_7libcbcf_VariantRecord *__pyx_v_self, PyObject *__pyx_v_value) {
  int __pyx_v_r;
  int __pyx_r;
  __Pyx_TraceDeclarationsFunc
  __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_TraceFrameInit(((PyObject *)__pyx_mstate_global->__pyx_codeobj_tab[263]))
  __Pyx_RefNannySetupContext("__set__", 0);
  __Pyx_TraceStartFunc("__set__", __pyx_f[0], 3141, 0, 0, 0, __PYX_ERR(0, 3141, __pyx_L1_error));

  /* "pysam/libcbcf.pyx":3143
 *     @rlen.setter
 *     def rlen(self, value):
 *         cdef int r = value             # <<<<<<<<<<<<<<
 *         self.ptr.rlen = r
 *         bcf_sync_end(self)
*/
  __pyx_t_1 = __Pyx_PyLong_As_int(__pyx_v_value); if (unlikely((__pyx_t_1 == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 3143, __pyx_L1_error)
  __pyx_v_r = __pyx_t_1;

  /* "pysam/libcbcf.pyx":3144
 *     def rlen(self, value):
 *         cdef int r = value
 *         self.ptr.rlen = r             # <<<<<<<<<<<<<<
 *         bcf_sync_end(self)
 * 
*/
  __pyx_v_self->ptr->rlen = __pyx_v_r;

  /* "pysam/libcbcf.pyx":3145
 *         cdef int r = value
 *         self.ptr.rlen = r
 *         bcf_sync_end(self)             # <<<<<<<<<<<<<<
 * 
 *     @property
*/
  __pyx_t_2 = __pyx_f_5pysam_7libcbcf_bcf_sync_end(__pyx_v_self); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 3145, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

  /* "pysam/libcbcf.pyx":3141
 *         return self.ptr.rlen
 * 
 *     @rlen.setter             # <<<<<<<<<<<<<<
 *     def rlen(self, value):
 *         cdef int r = value
*/

  /* function exit code */
  __pyx_r = 0;
  __Pyx_TraceReturnCValue(__pyx_r, __Pyx_Owned_Py_None, 0, 0, __PYX_ERR(0, 3141, __pyx_L1_error));
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_TraceException(__pyx_lineno, 0, 0);
  #if CYTHON_USE_SYS_MONITORING
  __Pyx_TraceExceptionUnwind(0, 0);
  #else
  __Pyx_TraceReturnValue(NULL, 0, 0, __PYX_ERR(0, 3141, __pyx_L1_error));
  #endif
  __Pyx_AddTraceback("pysam.libcbcf.VariantRecord.rlen.__set__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = -1;
  __pyx_L0:;
  __Pyx_PyMonitoring_ExitScope(0);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "pysam/libcbcf.pyx":3147
 *         bcf_sync_end(self)
 * 
 *     @property             # <<<<<<<<<<<<<<
 *     def qual(self):
 *         """phred scaled quality score or None if not available"""
*/

/* Python wrapper */
static PyObject *__pyx_pw_5pysam_7libcbcf_13VariantRecord_4qual_1__get__(PyObject *__pyx_v_self); /*proto*/
static PyObject *__pyx_pw_5pysam_7libcbcf_13VariantRecord_4qual_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_5pysam_7libcbcf_13VariantRecord_4qual___get__(((struct __pyx_obj_5pysam_7libcbcf_VariantRecord *)__pyx_v_self));

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

static PyObject *__pyx_pf_5pysam_7libcbcf_13VariantRecord_4qual___get__(struct __pyx_obj_5pysam_7libcbcf_VariantRecord *__pyx_v_self) {
  PyObject *__pyx_r = NULL;
  __Pyx_TraceDeclarationsFunc
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_t_2;
  PyObject *__pyx_t_3 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_TraceFrameInit(((PyObject *)__pyx_mstate_global->__pyx_codeobj_tab[264]))
  __Pyx_RefNannySetupContext("__get__", 0);
  __Pyx_TraceStartFunc("__get__", __pyx_f[0], 3147, 0, 0, 0, __PYX_ERR(0, 3147, __pyx_L1_error));

  /* "pysam/libcbcf.pyx":3150
 *     def qual(self):
 *         """phred scaled quality score or None if not available"""
 *         return self.ptr.qual if not bcf_float_is_missing(self.ptr.qual) else None             # <<<<<<<<<<<<<<
 * 
 *     @qual.setter
*/
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_2 = (!(bcf_float_is_missing(__pyx_v_self->ptr->qual) != 0));
  if (__pyx_t_2) {
    __pyx_t_3 = PyFloat_FromDouble(__pyx_v_self->ptr->qual); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 3150, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __pyx_t_1 = __pyx_t_3;
    __pyx_t_3 = 0;
  } else {
    __Pyx_INCREF(Py_None);
    __pyx_t_1 = Py_None;
  }
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  __Pyx_TraceReturnValue(__pyx_r, 1, 0, __PYX_ERR(0, 3150, __pyx_L1_error));
  goto __pyx_L0;

  /* "pysam/libcbcf.pyx":3147
 *         bcf_sync_end(self)
 * 
 *     @property             # <<<<<<<<<<<<<<
 *     def qual(self):
 *         """phred scaled quality score or None if not available"""
*/

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_TraceException(__pyx_lineno, 0, 0);
  #if CYTHON_USE_SYS_MONITORING
  __Pyx_TraceExceptionUnwind(0, 0);
  #else
  __Pyx_TraceReturnValue(NULL, 0, 0, __PYX_ERR(0, 3147, __pyx_L1_error));
  #endif
  __Pyx_AddTraceback("pysam.libcbcf.VariantRecord.qual.__get__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_PyMonitoring_ExitScope(0);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "pysam/libcbcf.pyx":3152
 *         return self.ptr.qual if not bcf_float_is_missing(self.ptr.qual) else None
 * 
 *     @qual.setter             # <<<<<<<<<<<<<<
 *     def qual(self, value):
 *         if value is not None:
*/

/* Python wrapper */
static int __pyx_pw_5pysam_7libcbcf_13VariantRecord_4qual_3__set__(PyObject *__pyx_v_self, PyObject *__pyx_v_value); /*proto*/
static int __pyx_pw_5pysam_7libcbcf_13VariantRecord_4qual_3__set__(PyObject *__pyx_v_self, PyObject *__pyx_v_value) {
  CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__set__ (wrapper)", 0);
  __pyx_kwvalues = __Pyx_KwValues_VARARGS(__pyx_args, __pyx_nargs);
  __pyx_r = __pyx_pf_5pysam_7libcbcf_13VariantRecord_4qual_2__set__(((struct __pyx_obj_5pysam_7libcbcf_VariantRecord *)__pyx_v_self), ((PyObject *)__pyx_v_value));

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

static int __pyx_pf_5pysam_7libcbcf_13VariantRecord_4qual_2__set__(struct __pyx_obj_5pysam_7libcbcf_VariantRecord *__pyx_v_self, PyObject *__pyx_v_value) {
  int __pyx_r;
  __Pyx_TraceDeclarationsFunc
  int __pyx_t_1;
  float __pyx_t_2;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_TraceFrameInit(((PyObject *)__pyx_mstate_global->__pyx_codeobj_tab[265]))
  __Pyx_TraceStartFunc("__set__", __pyx_f[0], 3152, 0, 0, 0, __PYX_ERR(0, 3152, __pyx_L1_error));

  /* "pysam/libcbcf.pyx":3154
 *     @qual.setter
 *     def qual(self, value):
 *         if value is not None:             # <<<<<<<<<<<<<<
 *             self.ptr.qual = value
 *         else:
*/
  __pyx_t_1 = (__pyx_v_value != Py_None);
  if (__pyx_t_1) {

    /* "pysam/libcbcf.pyx":3155
 *     def qual(self, value):
 *         if value is not None:
 *             self.ptr.qual = value             # <<<<<<<<<<<<<<
 *         else:
 *             bcf_float_set(&self.ptr.qual, bcf_float_missing)
*/
    __pyx_t_2 = __Pyx_PyFloat_AsFloat(__pyx_v_value); if (unlikely((__pyx_t_2 == (float)-1) && PyErr_Occurred())) __PYX_ERR(0, 3155, __pyx_L1_error)
    __pyx_v_self->ptr->qual = __pyx_t_2;

    /* "pysam/libcbcf.pyx":3154
 *     @qual.setter
 *     def qual(self, value):
 *         if value is not None:             # <<<<<<<<<<<<<<
 *             self.ptr.qual = value
 *         else:
*/
    goto __pyx_L3;
  }

  /* "pysam/libcbcf.pyx":3157
 *             self.ptr.qual = value
 *         else:
 *             bcf_float_set(&self.ptr.qual, bcf_float_missing)             # <<<<<<<<<<<<<<
 * 
 * 
*/
  /*else*/ {
    bcf_float_set((&__pyx_v_self->ptr->qual), bcf_float_missing);
  }
  __pyx_L3:;

  /* "pysam/libcbcf.pyx":3152
 *         return self.ptr.qual if not bcf_float_is_missing(self.ptr.qual) else None
 * 
 *     @qual.setter             # <<<<<<<<<<<<<<
 *     def qual(self, value):
 *         if value is not None:
*/

  /* function exit code */
  __pyx_r = 0;
  __Pyx_TraceReturnCValue(__pyx_r, __Pyx_Owned_Py_None, 0, 0, __PYX_ERR(0, 3152, __pyx_L1_error));
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_TraceException(__pyx_lineno, 0, 0);
  #if CYTHON_USE_SYS_MONITORING
  __Pyx_TraceExceptionUnwind(0, 0);
  #else
  __Pyx_TraceReturnValue(NULL, 0, 0, __PYX_ERR(0, 3152, __pyx_L1_error));
  #endif
  __Pyx_AddTraceback("pysam.libcbcf.VariantRecord.qual.__set__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = -1;
  __pyx_L0:;
  __Pyx_PyMonitoring_ExitScope(0);
  return __pyx_r;
}

/* "pysam/libcbcf.pyx":3168
 * #       return self.ptr.n_sample
 * 
 *     @property             # <<<<<<<<<<<<<<
 *     def id(self):
 *         """record identifier or None if not available"""
*/

/* Python wrapper */
static PyObject *__pyx_pw_5pysam_7libcbcf_13VariantRecord_2id_1__get__(PyObject *__pyx_v_self); /*proto*/
static PyObject *__pyx_pw_5pysam_7libcbcf_13VariantRecord_2id_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_5pysam_7libcbcf_13VariantRecord_2id___get__(((struct __pyx_obj_5pysam_7libcbcf_VariantRecord *)__pyx_v_self));

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

static PyObject *__pyx_pf_5pysam_7libcbcf_13VariantRecord_2id___get__(struct __pyx_obj_5pysam_7libcbcf_VariantRecord *__pyx_v_self) {
  bcf1_t *__pyx_v_r;
  PyObject *__pyx_r = NULL;
  __Pyx_TraceDeclarationsFunc
  __Pyx_RefNannyDeclarations
  bcf1_t *__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_TraceFrameInit(((PyObject *)__pyx_mstate_global->__pyx_codeobj_tab[266]))
  __Pyx_RefNannySetupContext("__get__", 0);
  __Pyx_TraceStartFunc("__get__", __pyx_f[0], 3168, 0, 0, 0, __PYX_ERR(0, 3168, __pyx_L1_error));

  /* "pysam/libcbcf.pyx":3171
 *     def id(self):
 *         """record identifier or None if not available"""
 *         cdef bcf1_t *r = self.ptr             # <<<<<<<<<<<<<<
 *         if bcf_unpack(r, BCF_UN_STR) < 0:
 *             raise ValueError('Error unpacking VariantRecord')
*/
  __pyx_t_1 = __pyx_v_self->ptr;
  __pyx_v_r = __pyx_t_1;

  /* "pysam/libcbcf.pyx":3172
 *         """record identifier or None if not available"""
 *         cdef bcf1_t *r = self.ptr
 *         if bcf_unpack(r, BCF_UN_STR) < 0:             # <<<<<<<<<<<<<<
 *             raise ValueError('Error unpacking VariantRecord')
 *         # causes a memory leak https://github.com/pysam-developers/pysam/issues/773
*/
  __pyx_t_2 = (bcf_unpack(__pyx_v_r, BCF_UN_STR) < 0);
  if (unlikely(__pyx_t_2)) {

    /* "pysam/libcbcf.pyx":3173
 *         cdef bcf1_t *r = self.ptr
 *         if bcf_unpack(r, BCF_UN_STR) < 0:
 *             raise ValueError('Error unpacking VariantRecord')             # <<<<<<<<<<<<<<
 *         # causes a memory leak https://github.com/pysam-developers/pysam/issues/773
 *         # return bcf_str_cache_get_charptr(r.d.id) if r.d.id != b'.' else None
*/
    __pyx_t_4 = NULL;
    __Pyx_INCREF(__pyx_builtin_ValueError);
    __pyx_t_5 = __pyx_builtin_ValueError; 
    __pyx_t_6 = 1;
    {
      PyObject *__pyx_callargs[2] = {__pyx_t_4, __pyx_mstate_global->__pyx_kp_u_Error_unpacking_VariantRecord};
      __pyx_t_3 = __Pyx_PyObject_FastCall(__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, 3173, __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, 3173, __pyx_L1_error)

    /* "pysam/libcbcf.pyx":3172
 *         """record identifier or None if not available"""
 *         cdef bcf1_t *r = self.ptr
 *         if bcf_unpack(r, BCF_UN_STR) < 0:             # <<<<<<<<<<<<<<
 *             raise ValueError('Error unpacking VariantRecord')
 *         # causes a memory leak https://github.com/pysam-developers/pysam/issues/773
*/
  }

  /* "pysam/libcbcf.pyx":3176
 *         # causes a memory leak https://github.com/pysam-developers/pysam/issues/773
 *         # return bcf_str_cache_get_charptr(r.d.id) if r.d.id != b'.' else None
 *         if (r.d.m_id == 0):             # <<<<<<<<<<<<<<
 *             raise ValueError('Error extracting ID')
 *         return charptr_to_str(r.d.id) if r.d.id != b'.' else None
*/
  __pyx_t_2 = (__pyx_v_r->d.m_id == 0);
  if (unlikely(__pyx_t_2)) {

    /* "pysam/libcbcf.pyx":3177
 *         # return bcf_str_cache_get_charptr(r.d.id) if r.d.id != b'.' else None
 *         if (r.d.m_id == 0):
 *             raise ValueError('Error extracting ID')             # <<<<<<<<<<<<<<
 *         return charptr_to_str(r.d.id) if r.d.id != b'.' else None
 * 
*/
    __pyx_t_5 = NULL;
    __Pyx_INCREF(__pyx_builtin_ValueError);
    __pyx_t_4 = __pyx_builtin_ValueError; 
    __pyx_t_6 = 1;
    {
      PyObject *__pyx_callargs[2] = {__pyx_t_5, __pyx_mstate_global->__pyx_kp_u_Error_extracting_ID};
      __pyx_t_3 = __Pyx_PyObject_FastCall(__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_3)) __PYX_ERR(0, 3177, __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, 3177, __pyx_L1_error)

    /* "pysam/libcbcf.pyx":3176
 *         # causes a memory leak https://github.com/pysam-developers/pysam/issues/773
 *         # return bcf_str_cache_get_charptr(r.d.id) if r.d.id != b'.' else None
 *         if (r.d.m_id == 0):             # <<<<<<<<<<<<<<
 *             raise ValueError('Error extracting ID')
 *         return charptr_to_str(r.d.id) if r.d.id != b'.' else None
*/
  }

  /* "pysam/libcbcf.pyx":3178
 *         if (r.d.m_id == 0):
 *             raise ValueError('Error extracting ID')
 *         return charptr_to_str(r.d.id) if r.d.id != b'.' else None             # <<<<<<<<<<<<<<
 * 
 *     @id.setter
*/
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_4 = __Pyx_PyBytes_FromString(__pyx_v_r->d.id); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 3178, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  __pyx_t_2 = (__Pyx_PyBytes_Equals(__pyx_t_4, __pyx_mstate_global->__pyx_kp_b__4, Py_NE)); if (unlikely((__pyx_t_2 < 0))) __PYX_ERR(0, 3178, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  if (__pyx_t_2) {
    __pyx_t_4 = __pyx_f_5pysam_9libcutils_charptr_to_str(__pyx_v_r->d.id, NULL); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 3178, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
    __pyx_t_3 = __pyx_t_4;
    __pyx_t_4 = 0;
  } else {
    __Pyx_INCREF(Py_None);
    __pyx_t_3 = Py_None;
  }
  __pyx_r = __pyx_t_3;
  __pyx_t_3 = 0;
  __Pyx_TraceReturnValue(__pyx_r, 25, 0, __PYX_ERR(0, 3178, __pyx_L1_error));
  goto __pyx_L0;

  /* "pysam/libcbcf.pyx":3168
 * #       return self.ptr.n_sample
 * 
 *     @property             # <<<<<<<<<<<<<<
 *     def id(self):
 *         """record identifier or None if not available"""
*/

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_XDECREF(__pyx_t_5);
  __Pyx_TraceException(__pyx_lineno, 0, 0);
  #if CYTHON_USE_SYS_MONITORING
  __Pyx_TraceExceptionUnwind(0, 0);
  #else
  __Pyx_TraceReturnValue(NULL, 0, 0, __PYX_ERR(0, 3168, __pyx_L1_error));
  #endif
  __Pyx_AddTraceback("pysam.libcbcf.VariantRecord.id.__get__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_PyMonitoring_ExitScope(0);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "pysam/libcbcf.pyx":3180
 *         return charptr_to_str(r.d.id) if r.d.id != b'.' else None
 * 
 *     @id.setter             # <<<<<<<<<<<<<<
 *     def id(self, value):
 *         cdef bcf1_t *r = self.ptr
*/

/* Python wrapper */
static int __pyx_pw_5pysam_7libcbcf_13VariantRecord_2id_3__set__(PyObject *__pyx_v_self, PyObject *__pyx_v_value); /*proto*/
static int __pyx_pw_5pysam_7libcbcf_13VariantRecord_2id_3__set__(PyObject *__pyx_v_self, PyObject *__pyx_v_value) {
  CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__set__ (wrapper)", 0);
  __pyx_kwvalues = __Pyx_KwValues_VARARGS(__pyx_args, __pyx_nargs);
  __pyx_r = __pyx_pf_5pysam_7libcbcf_13VariantRecord_2id_2__set__(((struct __pyx_obj_5pysam_7libcbcf_VariantRecord *)__pyx_v_self), ((PyObject *)__pyx_v_value));

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

static int __pyx_pf_5pysam_7libcbcf_13VariantRecord_2id_2__set__(struct __pyx_obj_5pysam_7libcbcf_VariantRecord *__pyx_v_self, PyObject *__pyx_v_value) {
  bcf1_t *__pyx_v_r;
  char *__pyx_v_idstr;
  PyObject *__pyx_v_bid = NULL;
  int __pyx_r;
  __Pyx_TraceDeclarationsFunc
  __Pyx_RefNannyDeclarations
  bcf1_t *__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;
  char *__pyx_t_7;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_TraceFrameInit(((PyObject *)__pyx_mstate_global->__pyx_codeobj_tab[267]))
  __Pyx_RefNannySetupContext("__set__", 0);
  __Pyx_TraceStartFunc("__set__", __pyx_f[0], 3180, 0, 0, 0, __PYX_ERR(0, 3180, __pyx_L1_error));

  /* "pysam/libcbcf.pyx":3182
 *     @id.setter
 *     def id(self, value):
 *         cdef bcf1_t *r = self.ptr             # <<<<<<<<<<<<<<
 *         if bcf_unpack(r, BCF_UN_STR) < 0:
 *             raise ValueError('Error unpacking VariantRecord')
*/
  __pyx_t_1 = __pyx_v_self->ptr;
  __pyx_v_r = __pyx_t_1;

  /* "pysam/libcbcf.pyx":3183
 *     def id(self, value):
 *         cdef bcf1_t *r = self.ptr
 *         if bcf_unpack(r, BCF_UN_STR) < 0:             # <<<<<<<<<<<<<<
 *             raise ValueError('Error unpacking VariantRecord')
 *         cdef char *idstr = NULL
*/
  __pyx_t_2 = (bcf_unpack(__pyx_v_r, BCF_UN_STR) < 0);
  if (unlikely(__pyx_t_2)) {

    /* "pysam/libcbcf.pyx":3184
 *         cdef bcf1_t *r = self.ptr
 *         if bcf_unpack(r, BCF_UN_STR) < 0:
 *             raise ValueError('Error unpacking VariantRecord')             # <<<<<<<<<<<<<<
 *         cdef char *idstr = NULL
 *         if value is not None:
*/
    __pyx_t_4 = NULL;
    __Pyx_INCREF(__pyx_builtin_ValueError);
    __pyx_t_5 = __pyx_builtin_ValueError; 
    __pyx_t_6 = 1;
    {
      PyObject *__pyx_callargs[2] = {__pyx_t_4, __pyx_mstate_global->__pyx_kp_u_Error_unpacking_VariantRecord};
      __pyx_t_3 = __Pyx_PyObject_FastCall(__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, 3184, __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, 3184, __pyx_L1_error)

    /* "pysam/libcbcf.pyx":3183
 *     def id(self, value):
 *         cdef bcf1_t *r = self.ptr
 *         if bcf_unpack(r, BCF_UN_STR) < 0:             # <<<<<<<<<<<<<<
 *             raise ValueError('Error unpacking VariantRecord')
 *         cdef char *idstr = NULL
*/
  }

  /* "pysam/libcbcf.pyx":3185
 *         if bcf_unpack(r, BCF_UN_STR) < 0:
 *             raise ValueError('Error unpacking VariantRecord')
 *         cdef char *idstr = NULL             # <<<<<<<<<<<<<<
 *         if value is not None:
 *             bid = force_bytes(value)
*/
  __pyx_v_idstr = NULL;

  /* "pysam/libcbcf.pyx":3186
 *             raise ValueError('Error unpacking VariantRecord')
 *         cdef char *idstr = NULL
 *         if value is not None:             # <<<<<<<<<<<<<<
 *             bid = force_bytes(value)
 *             idstr = bid
*/
  __pyx_t_2 = (__pyx_v_value != Py_None);
  if (__pyx_t_2) {

    /* "pysam/libcbcf.pyx":3187
 *         cdef char *idstr = NULL
 *         if value is not None:
 *             bid = force_bytes(value)             # <<<<<<<<<<<<<<
 *             idstr = bid
 *         if bcf_update_id(self.header.ptr, self.ptr, idstr) < 0:
*/
    __pyx_t_3 = __pyx_f_5pysam_9libcutils_force_bytes(__pyx_v_value, NULL); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 3187, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __pyx_v_bid = ((PyObject*)__pyx_t_3);
    __pyx_t_3 = 0;

    /* "pysam/libcbcf.pyx":3188
 *         if value is not None:
 *             bid = force_bytes(value)
 *             idstr = bid             # <<<<<<<<<<<<<<
 *         if bcf_update_id(self.header.ptr, self.ptr, idstr) < 0:
 *             raise ValueError('Error updating id')
*/
    if (unlikely(__pyx_v_bid == Py_None)) {
      PyErr_SetString(PyExc_TypeError, "expected bytes, NoneType found");
      __PYX_ERR(0, 3188, __pyx_L1_error)
    }
    __pyx_t_7 = __Pyx_PyBytes_AsWritableString(__pyx_v_bid); if (unlikely((!__pyx_t_7) && PyErr_Occurred())) __PYX_ERR(0, 3188, __pyx_L1_error)
    __pyx_v_idstr = __pyx_t_7;

    /* "pysam/libcbcf.pyx":3186
 *             raise ValueError('Error unpacking VariantRecord')
 *         cdef char *idstr = NULL
 *         if value is not None:             # <<<<<<<<<<<<<<
 *             bid = force_bytes(value)
 *             idstr = bid
*/
  }

  /* "pysam/libcbcf.pyx":3189
 *             bid = force_bytes(value)
 *             idstr = bid
 *         if bcf_update_id(self.header.ptr, self.ptr, idstr) < 0:             # <<<<<<<<<<<<<<
 *             raise ValueError('Error updating id')
 * 
*/
  __pyx_t_2 = (bcf_update_id(__pyx_v_self->header->ptr, __pyx_v_self->ptr, __pyx_v_idstr) < 0);
  if (unlikely(__pyx_t_2)) {

    /* "pysam/libcbcf.pyx":3190
 *             idstr = bid
 *         if bcf_update_id(self.header.ptr, self.ptr, idstr) < 0:
 *             raise ValueError('Error updating id')             # <<<<<<<<<<<<<<
 * 
 *     @property
*/
    __pyx_t_5 = NULL;
    __Pyx_INCREF(__pyx_builtin_ValueError);
    __pyx_t_4 = __pyx_builtin_ValueError; 
    __pyx_t_6 = 1;
    {
      PyObject *__pyx_callargs[2] = {__pyx_t_5, __pyx_mstate_global->__pyx_kp_u_Error_updating_id};
      __pyx_t_3 = __Pyx_PyObject_FastCall(__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_3)) __PYX_ERR(0, 3190, __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, 3190, __pyx_L1_error)

    /* "pysam/libcbcf.pyx":3189
 *             bid = force_bytes(value)
 *             idstr = bid
 *         if bcf_update_id(self.header.ptr, self.ptr, idstr) < 0:             # <<<<<<<<<<<<<<
 *             raise ValueError('Error updating id')
 * 
*/
  }

  /* "pysam/libcbcf.pyx":3180
 *         return charptr_to_str(r.d.id) if r.d.id != b'.' else None
 * 
 *     @id.setter             # <<<<<<<<<<<<<<
 *     def id(self, value):
 *         cdef bcf1_t *r = self.ptr
*/

  /* function exit code */
  __pyx_r = 0;
  __Pyx_TraceReturnCValue(__pyx_r, __Pyx_Owned_Py_None, 0, 0, __PYX_ERR(0, 3180, __pyx_L1_error));
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_XDECREF(__pyx_t_5);
  __Pyx_TraceException(__pyx_lineno, 0, 0);
  #if CYTHON_USE_SYS_MONITORING
  __Pyx_TraceExceptionUnwind(0, 0);
  #else
  __Pyx_TraceReturnValue(NULL, 0, 0, __PYX_ERR(0, 3180, __pyx_L1_error));
  #endif
  __Pyx_AddTraceback("pysam.libcbcf.VariantRecord.id.__set__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = -1;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_bid);
  __Pyx_PyMonitoring_ExitScope(0);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "pysam/libcbcf.pyx":3192
 *             raise ValueError('Error updating id')
 * 
 *     @property             # <<<<<<<<<<<<<<
 *     def ref(self):
 *         """reference allele"""
*/

/* Python wrapper */
static PyObject *__pyx_pw_5pysam_7libcbcf_13VariantRecord_3ref_1__get__(PyObject *__pyx_v_self); /*proto*/
static PyObject *__pyx_pw_5pysam_7libcbcf_13VariantRecord_3ref_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_5pysam_7libcbcf_13VariantRecord_3ref___get__(((struct __pyx_obj_5pysam_7libcbcf_VariantRecord *)__pyx_v_self));

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

static PyObject *__pyx_pf_5pysam_7libcbcf_13VariantRecord_3ref___get__(struct __pyx_obj_5pysam_7libcbcf_VariantRecord *__pyx_v_self) {
  bcf1_t *__pyx_v_r;
  PyObject *__pyx_r = NULL;
  __Pyx_TraceDeclarationsFunc
  __Pyx_RefNannyDeclarations
  bcf1_t *__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_TraceFrameInit(((PyObject *)__pyx_mstate_global->__pyx_codeobj_tab[268]))
  __Pyx_RefNannySetupContext("__get__", 0);
  __Pyx_TraceStartFunc("__get__", __pyx_f[0], 3192, 0, 0, 0, __PYX_ERR(0, 3192, __pyx_L1_error));

  /* "pysam/libcbcf.pyx":3195
 *     def ref(self):
 *         """reference allele"""
 *         cdef bcf1_t *r = self.ptr             # <<<<<<<<<<<<<<
 *         if bcf_unpack(r, BCF_UN_STR) < 0:
 *             raise ValueError('Error unpacking VariantRecord')
*/
  __pyx_t_1 = __pyx_v_self->ptr;
  __pyx_v_r = __pyx_t_1;

  /* "pysam/libcbcf.pyx":3196
 *         """reference allele"""
 *         cdef bcf1_t *r = self.ptr
 *         if bcf_unpack(r, BCF_UN_STR) < 0:             # <<<<<<<<<<<<<<
 *             raise ValueError('Error unpacking VariantRecord')
 *         return charptr_to_str(r.d.allele[0]) if r.d.allele else None
*/
  __pyx_t_2 = (bcf_unpack(__pyx_v_r, BCF_UN_STR) < 0);
  if (unlikely(__pyx_t_2)) {

    /* "pysam/libcbcf.pyx":3197
 *         cdef bcf1_t *r = self.ptr
 *         if bcf_unpack(r, BCF_UN_STR) < 0:
 *             raise ValueError('Error unpacking VariantRecord')             # <<<<<<<<<<<<<<
 *         return charptr_to_str(r.d.allele[0]) if r.d.allele else None
 * 
*/
    __pyx_t_4 = NULL;
    __Pyx_INCREF(__pyx_builtin_ValueError);
    __pyx_t_5 = __pyx_builtin_ValueError; 
    __pyx_t_6 = 1;
    {
      PyObject *__pyx_callargs[2] = {__pyx_t_4, __pyx_mstate_global->__pyx_kp_u_Error_unpacking_VariantRecord};
      __pyx_t_3 = __Pyx_PyObject_FastCall(__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, 3197, __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, 3197, __pyx_L1_error)

    /* "pysam/libcbcf.pyx":3196
 *         """reference allele"""
 *         cdef bcf1_t *r = self.ptr
 *         if bcf_unpack(r, BCF_UN_STR) < 0:             # <<<<<<<<<<<<<<
 *             raise ValueError('Error unpacking VariantRecord')
 *         return charptr_to_str(r.d.allele[0]) if r.d.allele else None
*/
  }

  /* "pysam/libcbcf.pyx":3198
 *         if bcf_unpack(r, BCF_UN_STR) < 0:
 *             raise ValueError('Error unpacking VariantRecord')
 *         return charptr_to_str(r.d.allele[0]) if r.d.allele else None             # <<<<<<<<<<<<<<
 * 
 *     @ref.setter
*/
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_2 = (__pyx_v_r->d.allele != 0);
  if (__pyx_t_2) {
    __pyx_t_5 = __pyx_f_5pysam_9libcutils_charptr_to_str((__pyx_v_r->d.allele[0]), NULL); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 3198, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_5);
    __pyx_t_3 = __pyx_t_5;
    __pyx_t_5 = 0;
  } else {
    __Pyx_INCREF(Py_None);
    __pyx_t_3 = Py_None;
  }
  __pyx_r = __pyx_t_3;
  __pyx_t_3 = 0;
  __Pyx_TraceReturnValue(__pyx_r, 15, 0, __PYX_ERR(0, 3198, __pyx_L1_error));
  goto __pyx_L0;

  /* "pysam/libcbcf.pyx":3192
 *             raise ValueError('Error updating id')
 * 
 *     @property             # <<<<<<<<<<<<<<
 *     def ref(self):
 *         """reference allele"""
*/

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_XDECREF(__pyx_t_5);
  __Pyx_TraceException(__pyx_lineno, 0, 0);
  #if CYTHON_USE_SYS_MONITORING
  __Pyx_TraceExceptionUnwind(0, 0);
  #else
  __Pyx_TraceReturnValue(NULL, 0, 0, __PYX_ERR(0, 3192, __pyx_L1_error));
  #endif
  __Pyx_AddTraceback("pysam.libcbcf.VariantRecord.ref.__get__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_PyMonitoring_ExitScope(0);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "pysam/libcbcf.pyx":3200
 *         return charptr_to_str(r.d.allele[0]) if r.d.allele else None
 * 
 *     @ref.setter             # <<<<<<<<<<<<<<
 *     def ref(self, value):
 *         cdef bcf1_t *r = self.ptr
*/

/* Python wrapper */
static int __pyx_pw_5pysam_7libcbcf_13VariantRecord_3ref_3__set__(PyObject *__pyx_v_self, PyObject *__pyx_v_value); /*proto*/
static int __pyx_pw_5pysam_7libcbcf_13VariantRecord_3ref_3__set__(PyObject *__pyx_v_self, PyObject *__pyx_v_value) {
  CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__set__ (wrapper)", 0);
  __pyx_kwvalues = __Pyx_KwValues_VARARGS(__pyx_args, __pyx_nargs);
  __pyx_r = __pyx_pf_5pysam_7libcbcf_13VariantRecord_3ref_2__set__(((struct __pyx_obj_5pysam_7libcbcf_VariantRecord *)__pyx_v_self), ((PyObject *)__pyx_v_value));

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

static int __pyx_pf_5pysam_7libcbcf_13VariantRecord_3ref_2__set__(struct __pyx_obj_5pysam_7libcbcf_VariantRecord *__pyx_v_self, PyObject *__pyx_v_value) {
  bcf1_t *__pyx_v_r;
  PyObject *__pyx_v_alleles = NULL;
  uint32_t __pyx_8genexpr6__pyx_v_i;
  int __pyx_r;
  __Pyx_TraceDeclarationsFunc
  __Pyx_RefNannyDeclarations
  bcf1_t *__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_t_7;
  uint32_t __pyx_t_8;
  uint32_t __pyx_t_9;
  uint32_t __pyx_t_10;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_TraceFrameInit(((PyObject *)__pyx_mstate_global->__pyx_codeobj_tab[269]))
  __Pyx_RefNannySetupContext("__set__", 0);
  __Pyx_TraceStartFunc("__set__", __pyx_f[0], 3200, 0, 0, 0, __PYX_ERR(0, 3200, __pyx_L1_error));
  __Pyx_INCREF(__pyx_v_value);

  /* "pysam/libcbcf.pyx":3202
 *     @ref.setter
 *     def ref(self, value):
 *         cdef bcf1_t *r = self.ptr             # <<<<<<<<<<<<<<
 *         if bcf_unpack(r, BCF_UN_STR) < 0:
 *             raise ValueError('Error unpacking VariantRecord')
*/
  __pyx_t_1 = __pyx_v_self->ptr;
  __pyx_v_r = __pyx_t_1;

  /* "pysam/libcbcf.pyx":3203
 *     def ref(self, value):
 *         cdef bcf1_t *r = self.ptr
 *         if bcf_unpack(r, BCF_UN_STR) < 0:             # <<<<<<<<<<<<<<
 *             raise ValueError('Error unpacking VariantRecord')
 *         #FIXME: Set alleles directly -- this is stupid
*/
  __pyx_t_2 = (bcf_unpack(__pyx_v_r, BCF_UN_STR) < 0);
  if (unlikely(__pyx_t_2)) {

    /* "pysam/libcbcf.pyx":3204
 *         cdef bcf1_t *r = self.ptr
 *         if bcf_unpack(r, BCF_UN_STR) < 0:
 *             raise ValueError('Error unpacking VariantRecord')             # <<<<<<<<<<<<<<
 *         #FIXME: Set alleles directly -- this is stupid
 *         if not value:
*/
    __pyx_t_4 = NULL;
    __Pyx_INCREF(__pyx_builtin_ValueError);
    __pyx_t_5 = __pyx_builtin_ValueError; 
    __pyx_t_6 = 1;
    {
      PyObject *__pyx_callargs[2] = {__pyx_t_4, __pyx_mstate_global->__pyx_kp_u_Error_unpacking_VariantRecord};
      __pyx_t_3 = __Pyx_PyObject_FastCall(__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, 3204, __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, 3204, __pyx_L1_error)

    /* "pysam/libcbcf.pyx":3203
 *     def ref(self, value):
 *         cdef bcf1_t *r = self.ptr
 *         if bcf_unpack(r, BCF_UN_STR) < 0:             # <<<<<<<<<<<<<<
 *             raise ValueError('Error unpacking VariantRecord')
 *         #FIXME: Set alleles directly -- this is stupid
*/
  }

  /* "pysam/libcbcf.pyx":3206
 *             raise ValueError('Error unpacking VariantRecord')
 *         #FIXME: Set alleles directly -- this is stupid
 *         if not value:             # <<<<<<<<<<<<<<
 *             raise ValueError('ref allele must not be null')
 *         value = force_bytes(value)
*/
  __pyx_t_2 = __Pyx_PyObject_IsTrue(__pyx_v_value); if (unlikely((__pyx_t_2 < 0))) __PYX_ERR(0, 3206, __pyx_L1_error)
  __pyx_t_7 = (!__pyx_t_2);
  if (unlikely(__pyx_t_7)) {

    /* "pysam/libcbcf.pyx":3207
 *         #FIXME: Set alleles directly -- this is stupid
 *         if not value:
 *             raise ValueError('ref allele must not be null')             # <<<<<<<<<<<<<<
 *         value = force_bytes(value)
 *         if r.d.allele and r.n_allele:
*/
    __pyx_t_5 = NULL;
    __Pyx_INCREF(__pyx_builtin_ValueError);
    __pyx_t_4 = __pyx_builtin_ValueError; 
    __pyx_t_6 = 1;
    {
      PyObject *__pyx_callargs[2] = {__pyx_t_5, __pyx_mstate_global->__pyx_kp_u_ref_allele_must_not_be_null};
      __pyx_t_3 = __Pyx_PyObject_FastCall(__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_3)) __PYX_ERR(0, 3207, __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, 3207, __pyx_L1_error)

    /* "pysam/libcbcf.pyx":3206
 *             raise ValueError('Error unpacking VariantRecord')
 *         #FIXME: Set alleles directly -- this is stupid
 *         if not value:             # <<<<<<<<<<<<<<
 *             raise ValueError('ref allele must not be null')
 *         value = force_bytes(value)
*/
  }

  /* "pysam/libcbcf.pyx":3208
 *         if not value:
 *             raise ValueError('ref allele must not be null')
 *         value = force_bytes(value)             # <<<<<<<<<<<<<<
 *         if r.d.allele and r.n_allele:
 *             alleles = [r.d.allele[i] for i in range(r.n_allele)]
*/
  __pyx_t_3 = __pyx_f_5pysam_9libcutils_force_bytes(__pyx_v_value, NULL); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 3208, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_DECREF_SET(__pyx_v_value, __pyx_t_3);
  __pyx_t_3 = 0;

  /* "pysam/libcbcf.pyx":3209
 *             raise ValueError('ref allele must not be null')
 *         value = force_bytes(value)
 *         if r.d.allele and r.n_allele:             # <<<<<<<<<<<<<<
 *             alleles = [r.d.allele[i] for i in range(r.n_allele)]
 *             alleles[0] = value
*/
  __pyx_t_2 = (__pyx_v_r->d.allele != 0);
  if (__pyx_t_2) {
  } else {
    __pyx_t_7 = __pyx_t_2;
    goto __pyx_L6_bool_binop_done;
  }
  __pyx_t_2 = (__pyx_v_r->n_allele != 0);
  __pyx_t_7 = __pyx_t_2;
  __pyx_L6_bool_binop_done:;
  if (__pyx_t_7) {

    /* "pysam/libcbcf.pyx":3210
 *         value = force_bytes(value)
 *         if r.d.allele and r.n_allele:
 *             alleles = [r.d.allele[i] for i in range(r.n_allele)]             # <<<<<<<<<<<<<<
 *             alleles[0] = value
 *         else:
*/
    { /* enter inner scope */
      __pyx_t_3 = PyList_New(0); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 3210, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_3);
      __pyx_t_8 = __pyx_v_r->n_allele;
      __pyx_t_9 = __pyx_t_8;
      for (__pyx_t_10 = 0; __pyx_t_10 < __pyx_t_9; __pyx_t_10+=1) {
        __pyx_8genexpr6__pyx_v_i = __pyx_t_10;
        __pyx_t_4 = __Pyx_PyBytes_FromString((__pyx_v_r->d.allele[__pyx_8genexpr6__pyx_v_i])); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 3210, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_4);
        if (unlikely(__Pyx_ListComp_Append(__pyx_t_3, (PyObject*)__pyx_t_4))) __PYX_ERR(0, 3210, __pyx_L1_error)
        __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
      }
    } /* exit inner scope */
    __pyx_v_alleles = ((PyObject*)__pyx_t_3);
    __pyx_t_3 = 0;

    /* "pysam/libcbcf.pyx":3211
 *         if r.d.allele and r.n_allele:
 *             alleles = [r.d.allele[i] for i in range(r.n_allele)]
 *             alleles[0] = value             # <<<<<<<<<<<<<<
 *         else:
 *             alleles = [value, '<NON_REF>']
*/
    if (unlikely((__Pyx_SetItemInt(__pyx_v_alleles, 0, __pyx_v_value, long, 1, __Pyx_PyLong_From_long, 1, 0, 1, 1) < 0))) __PYX_ERR(0, 3211, __pyx_L1_error)

    /* "pysam/libcbcf.pyx":3209
 *             raise ValueError('ref allele must not be null')
 *         value = force_bytes(value)
 *         if r.d.allele and r.n_allele:             # <<<<<<<<<<<<<<
 *             alleles = [r.d.allele[i] for i in range(r.n_allele)]
 *             alleles[0] = value
*/
    goto __pyx_L5;
  }

  /* "pysam/libcbcf.pyx":3213
 *             alleles[0] = value
 *         else:
 *             alleles = [value, '<NON_REF>']             # <<<<<<<<<<<<<<
 *         self.alleles = alleles
 *         bcf_sync_end(self)
*/
  /*else*/ {
    __pyx_t_3 = PyList_New(2); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 3213, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __Pyx_INCREF(__pyx_v_value);
    __Pyx_GIVEREF(__pyx_v_value);
    if (__Pyx_PyList_SET_ITEM(__pyx_t_3, 0, __pyx_v_value) != (0)) __PYX_ERR(0, 3213, __pyx_L1_error);
    __Pyx_INCREF(__pyx_mstate_global->__pyx_kp_u_NON_REF);
    __Pyx_GIVEREF(__pyx_mstate_global->__pyx_kp_u_NON_REF);
    if (__Pyx_PyList_SET_ITEM(__pyx_t_3, 1, __pyx_mstate_global->__pyx_kp_u_NON_REF) != (0)) __PYX_ERR(0, 3213, __pyx_L1_error);
    __pyx_v_alleles = ((PyObject*)__pyx_t_3);
    __pyx_t_3 = 0;
  }
  __pyx_L5:;

  /* "pysam/libcbcf.pyx":3214
 *         else:
 *             alleles = [value, '<NON_REF>']
 *         self.alleles = alleles             # <<<<<<<<<<<<<<
 *         bcf_sync_end(self)
 * 
*/
  if (__Pyx_PyObject_SetAttrStr(((PyObject *)__pyx_v_self), __pyx_mstate_global->__pyx_n_u_alleles, __pyx_v_alleles) < 0) __PYX_ERR(0, 3214, __pyx_L1_error)

  /* "pysam/libcbcf.pyx":3215
 *             alleles = [value, '<NON_REF>']
 *         self.alleles = alleles
 *         bcf_sync_end(self)             # <<<<<<<<<<<<<<
 * 
 *     @property
*/
  __pyx_t_3 = __pyx_f_5pysam_7libcbcf_bcf_sync_end(__pyx_v_self); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 3215, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;

  /* "pysam/libcbcf.pyx":3200
 *         return charptr_to_str(r.d.allele[0]) if r.d.allele else None
 * 
 *     @ref.setter             # <<<<<<<<<<<<<<
 *     def ref(self, value):
 *         cdef bcf1_t *r = self.ptr
*/

  /* function exit code */
  __pyx_r = 0;
  __Pyx_TraceReturnCValue(__pyx_r, __Pyx_Owned_Py_None, 0, 0, __PYX_ERR(0, 3200, __pyx_L1_error));
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_XDECREF(__pyx_t_5);
  __Pyx_TraceException(__pyx_lineno, 0, 0);
  #if CYTHON_USE_SYS_MONITORING
  __Pyx_TraceExceptionUnwind(0, 0);
  #else
  __Pyx_TraceReturnValue(NULL, 0, 0, __PYX_ERR(0, 3200, __pyx_L1_error));
  #endif
  __Pyx_AddTraceback("pysam.libcbcf.VariantRecord.ref.__set__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = -1;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_alleles);
  __Pyx_XDECREF(__pyx_v_value);
  __Pyx_PyMonitoring_ExitScope(0);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "pysam/libcbcf.pyx":3217
 *         bcf_sync_end(self)
 * 
 *     @property             # <<<<<<<<<<<<<<
 *     def alleles(self):
 *         """tuple of reference allele followed by alt alleles"""
*/

/* Python wrapper */
static PyObject *__pyx_pw_5pysam_7libcbcf_13VariantRecord_7alleles_1__get__(PyObject *__pyx_v_self); /*proto*/
static PyObject *__pyx_pw_5pysam_7libcbcf_13VariantRecord_7alleles_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_5pysam_7libcbcf_13VariantRecord_7alleles___get__(((struct __pyx_obj_5pysam_7libcbcf_VariantRecord *)__pyx_v_self));

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

static PyObject *__pyx_pf_5pysam_7libcbcf_13VariantRecord_7alleles___get__(struct __pyx_obj_5pysam_7libcbcf_VariantRecord *__pyx_v_self) {
  bcf1_t *__pyx_v_r;
  PyObject *__pyx_v_res = 0;
  uint32_t __pyx_v_i;
  PyObject *__pyx_v_a = NULL;
  PyObject *__pyx_r = NULL;
  __Pyx_TraceDeclarationsFunc
  __Pyx_RefNannyDeclarations
  bcf1_t *__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;
  uint32_t __pyx_t_7;
  uint32_t __pyx_t_8;
  uint32_t __pyx_t_9;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_TraceFrameInit(((PyObject *)__pyx_mstate_global->__pyx_codeobj_tab[270]))
  __Pyx_RefNannySetupContext("__get__", 0);
  __Pyx_TraceStartFunc("__get__", __pyx_f[0], 3217, 0, 0, 0, __PYX_ERR(0, 3217, __pyx_L1_error));

  /* "pysam/libcbcf.pyx":3220
 *     def alleles(self):
 *         """tuple of reference allele followed by alt alleles"""
 *         cdef bcf1_t *r = self.ptr             # <<<<<<<<<<<<<<
 *         if bcf_unpack(r, BCF_UN_STR) < 0:
 *             raise ValueError('Error unpacking VariantRecord')
*/
  __pyx_t_1 = __pyx_v_self->ptr;
  __pyx_v_r = __pyx_t_1;

  /* "pysam/libcbcf.pyx":3221
 *         """tuple of reference allele followed by alt alleles"""
 *         cdef bcf1_t *r = self.ptr
 *         if bcf_unpack(r, BCF_UN_STR) < 0:             # <<<<<<<<<<<<<<
 *             raise ValueError('Error unpacking VariantRecord')
 *         if not r.d.allele:
*/
  __pyx_t_2 = (bcf_unpack(__pyx_v_r, BCF_UN_STR) < 0);
  if (unlikely(__pyx_t_2)) {

    /* "pysam/libcbcf.pyx":3222
 *         cdef bcf1_t *r = self.ptr
 *         if bcf_unpack(r, BCF_UN_STR) < 0:
 *             raise ValueError('Error unpacking VariantRecord')             # <<<<<<<<<<<<<<
 *         if not r.d.allele:
 *             return None
*/
    __pyx_t_4 = NULL;
    __Pyx_INCREF(__pyx_builtin_ValueError);
    __pyx_t_5 = __pyx_builtin_ValueError; 
    __pyx_t_6 = 1;
    {
      PyObject *__pyx_callargs[2] = {__pyx_t_4, __pyx_mstate_global->__pyx_kp_u_Error_unpacking_VariantRecord};
      __pyx_t_3 = __Pyx_PyObject_FastCall(__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, 3222, __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, 3222, __pyx_L1_error)

    /* "pysam/libcbcf.pyx":3221
 *         """tuple of reference allele followed by alt alleles"""
 *         cdef bcf1_t *r = self.ptr
 *         if bcf_unpack(r, BCF_UN_STR) < 0:             # <<<<<<<<<<<<<<
 *             raise ValueError('Error unpacking VariantRecord')
 *         if not r.d.allele:
*/
  }

  /* "pysam/libcbcf.pyx":3223
 *         if bcf_unpack(r, BCF_UN_STR) < 0:
 *             raise ValueError('Error unpacking VariantRecord')
 *         if not r.d.allele:             # <<<<<<<<<<<<<<
 *             return None
 *         cdef tuple res = PyTuple_New(r.n_allele)
*/
  __pyx_t_2 = (!(__pyx_v_r->d.allele != 0));
  if (__pyx_t_2) {

    /* "pysam/libcbcf.pyx":3224
 *             raise ValueError('Error unpacking VariantRecord')
 *         if not r.d.allele:
 *             return None             # <<<<<<<<<<<<<<
 *         cdef tuple res = PyTuple_New(r.n_allele)
 *         for i in range(r.n_allele):
*/
    __Pyx_XDECREF(__pyx_r);
    __pyx_r = Py_None; __Pyx_INCREF(Py_None);
    goto __pyx_L0;

    /* "pysam/libcbcf.pyx":3223
 *         if bcf_unpack(r, BCF_UN_STR) < 0:
 *             raise ValueError('Error unpacking VariantRecord')
 *         if not r.d.allele:             # <<<<<<<<<<<<<<
 *             return None
 *         cdef tuple res = PyTuple_New(r.n_allele)
*/
  }

  /* "pysam/libcbcf.pyx":3225
 *         if not r.d.allele:
 *             return None
 *         cdef tuple res = PyTuple_New(r.n_allele)             # <<<<<<<<<<<<<<
 *         for i in range(r.n_allele):
 *             a = charptr_to_str(r.d.allele[i])
*/
  __pyx_t_3 = PyTuple_New(__pyx_v_r->n_allele); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 3225, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __pyx_v_res = ((PyObject*)__pyx_t_3);
  __pyx_t_3 = 0;

  /* "pysam/libcbcf.pyx":3226
 *             return None
 *         cdef tuple res = PyTuple_New(r.n_allele)
 *         for i in range(r.n_allele):             # <<<<<<<<<<<<<<
 *             a = charptr_to_str(r.d.allele[i])
 *             PyTuple_SET_ITEM(res, i, a)
*/
  __pyx_t_7 = __pyx_v_r->n_allele;
  __pyx_t_8 = __pyx_t_7;
  for (__pyx_t_9 = 0; __pyx_t_9 < __pyx_t_8; __pyx_t_9+=1) {
    __pyx_v_i = __pyx_t_9;

    /* "pysam/libcbcf.pyx":3227
 *         cdef tuple res = PyTuple_New(r.n_allele)
 *         for i in range(r.n_allele):
 *             a = charptr_to_str(r.d.allele[i])             # <<<<<<<<<<<<<<
 *             PyTuple_SET_ITEM(res, i, a)
 *             Py_INCREF(a)
*/
    __pyx_t_3 = __pyx_f_5pysam_9libcutils_charptr_to_str((__pyx_v_r->d.allele[__pyx_v_i]), NULL); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 3227, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __Pyx_XDECREF_SET(__pyx_v_a, __pyx_t_3);
    __pyx_t_3 = 0;

    /* "pysam/libcbcf.pyx":3228
 *         for i in range(r.n_allele):
 *             a = charptr_to_str(r.d.allele[i])
 *             PyTuple_SET_ITEM(res, i, a)             # <<<<<<<<<<<<<<
 *             Py_INCREF(a)
 *         return res
*/
    PyTuple_SET_ITEM(__pyx_v_res, __pyx_v_i, __pyx_v_a);

    /* "pysam/libcbcf.pyx":3229
 *             a = charptr_to_str(r.d.allele[i])
 *             PyTuple_SET_ITEM(res, i, a)
 *             Py_INCREF(a)             # <<<<<<<<<<<<<<
 *         return res
 * 
*/
    Py_INCREF(__pyx_v_a);
  }

  /* "pysam/libcbcf.pyx":3230
 *             PyTuple_SET_ITEM(res, i, a)
 *             Py_INCREF(a)
 *         return res             # <<<<<<<<<<<<<<
 * 
 *     @alleles.setter
*/
  __Pyx_XDECREF(__pyx_r);
  __Pyx_INCREF(__pyx_v_res);
  __pyx_r = __pyx_v_res;
  __Pyx_TraceReturnValue(__pyx_r, 49, 0, __PYX_ERR(0, 3230, __pyx_L1_error));
  goto __pyx_L0;

  /* "pysam/libcbcf.pyx":3217
 *         bcf_sync_end(self)
 * 
 *     @property             # <<<<<<<<<<<<<<
 *     def alleles(self):
 *         """tuple of reference allele followed by alt alleles"""
*/

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_XDECREF(__pyx_t_5);
  __Pyx_TraceException(__pyx_lineno, 0, 0);
  #if CYTHON_USE_SYS_MONITORING
  __Pyx_TraceExceptionUnwind(0, 0);
  #else
  __Pyx_TraceReturnValue(NULL, 0, 0, __PYX_ERR(0, 3217, __pyx_L1_error));
  #endif
  __Pyx_AddTraceback("pysam.libcbcf.VariantRecord.alleles.__get__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_res);
  __Pyx_XDECREF(__pyx_v_a);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_PyMonitoring_ExitScope(0);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "pysam/libcbcf.pyx":3232
 *         return res
 * 
 *     @alleles.setter             # <<<<<<<<<<<<<<
 *     def alleles(self, values):
 *         cdef bcf1_t *r = self.ptr
*/

/* Python wrapper */
static int __pyx_pw_5pysam_7libcbcf_13VariantRecord_7alleles_3__set__(PyObject *__pyx_v_self, PyObject *__pyx_v_values); /*proto*/
static int __pyx_pw_5pysam_7libcbcf_13VariantRecord_7alleles_3__set__(PyObject *__pyx_v_self, PyObject *__pyx_v_values) {
  CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__set__ (wrapper)", 0);
  __pyx_kwvalues = __Pyx_KwValues_VARARGS(__pyx_args, __pyx_nargs);
  __pyx_r = __pyx_pf_5pysam_7libcbcf_13VariantRecord_7alleles_2__set__(((struct __pyx_obj_5pysam_7libcbcf_VariantRecord *)__pyx_v_self), ((PyObject *)__pyx_v_values));

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

static int __pyx_pf_5pysam_7libcbcf_13VariantRecord_7alleles_2__set__(struct __pyx_obj_5pysam_7libcbcf_VariantRecord *__pyx_v_self, PyObject *__pyx_v_values) {
  bcf1_t *__pyx_v_r;
  int __pyx_v_rlen;
  PyObject *__pyx_v_value = NULL;
  PyObject *__pyx_8genexpr7__pyx_v_v = NULL;
  int __pyx_r;
  __Pyx_TraceDeclarationsFunc
  __Pyx_RefNannyDeclarations
  bcf1_t *__pyx_t_1;
  int32_t __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;
  Py_ssize_t __pyx_t_8;
  PyObject *(*__pyx_t_9)(PyObject *);
  char const *__pyx_t_10;
  int __pyx_t_11;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_TraceFrameInit(((PyObject *)__pyx_mstate_global->__pyx_codeobj_tab[271]))
  __Pyx_RefNannySetupContext("__set__", 0);
  __Pyx_TraceStartFunc("__set__", __pyx_f[0], 3232, 0, 0, 0, __PYX_ERR(0, 3232, __pyx_L1_error));
  __Pyx_INCREF(__pyx_v_values);

  /* "pysam/libcbcf.pyx":3234
 *     @alleles.setter
 *     def alleles(self, values):
 *         cdef bcf1_t *r = self.ptr             # <<<<<<<<<<<<<<
 * 
 *         # Cache rlen of symbolic alleles before call to bcf_update_alleles_str
*/
  __pyx_t_1 = __pyx_v_self->ptr;
  __pyx_v_r = __pyx_t_1;

  /* "pysam/libcbcf.pyx":3237
 * 
 *         # Cache rlen of symbolic alleles before call to bcf_update_alleles_str
 *         cdef int rlen = r.rlen             # <<<<<<<<<<<<<<
 * 
 *         if bcf_unpack(r, BCF_UN_STR) < 0:
*/
  __pyx_t_2 = __pyx_v_r->rlen;
  __pyx_v_rlen = __pyx_t_2;

  /* "pysam/libcbcf.pyx":3239
 *         cdef int rlen = r.rlen
 * 
 *         if bcf_unpack(r, BCF_UN_STR) < 0:             # <<<<<<<<<<<<<<
 *             raise ValueError('Error unpacking VariantRecord')
 * 
*/
  __pyx_t_3 = (bcf_unpack(__pyx_v_r, BCF_UN_STR) < 0);
  if (unlikely(__pyx_t_3)) {

    /* "pysam/libcbcf.pyx":3240
 * 
 *         if bcf_unpack(r, BCF_UN_STR) < 0:
 *             raise ValueError('Error unpacking VariantRecord')             # <<<<<<<<<<<<<<
 * 
 *         values = [force_bytes(v) for v in values]
*/
    __pyx_t_5 = NULL;
    __Pyx_INCREF(__pyx_builtin_ValueError);
    __pyx_t_6 = __pyx_builtin_ValueError; 
    __pyx_t_7 = 1;
    {
      PyObject *__pyx_callargs[2] = {__pyx_t_5, __pyx_mstate_global->__pyx_kp_u_Error_unpacking_VariantRecord};
      __pyx_t_4 = __Pyx_PyObject_FastCall(__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, 3240, __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, 3240, __pyx_L1_error)

    /* "pysam/libcbcf.pyx":3239
 *         cdef int rlen = r.rlen
 * 
 *         if bcf_unpack(r, BCF_UN_STR) < 0:             # <<<<<<<<<<<<<<
 *             raise ValueError('Error unpacking VariantRecord')
 * 
*/
  }

  /* "pysam/libcbcf.pyx":3242
 *             raise ValueError('Error unpacking VariantRecord')
 * 
 *         values = [force_bytes(v) for v in values]             # <<<<<<<<<<<<<<
 * 
 *         if len(values) < 2:
*/
  { /* enter inner scope */
    __pyx_t_4 = PyList_New(0); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 3242, __pyx_L6_error)
    __Pyx_GOTREF(__pyx_t_4);
    if (likely(PyList_CheckExact(__pyx_v_values)) || PyTuple_CheckExact(__pyx_v_values)) {
      __pyx_t_6 = __pyx_v_values; __Pyx_INCREF(__pyx_t_6);
      __pyx_t_8 = 0;
      __pyx_t_9 = NULL;
    } else {
      __pyx_t_8 = -1; __pyx_t_6 = PyObject_GetIter(__pyx_v_values); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 3242, __pyx_L6_error)
      __Pyx_GOTREF(__pyx_t_6);
      __pyx_t_9 = (CYTHON_COMPILING_IN_LIMITED_API) ? PyIter_Next : __Pyx_PyObject_GetIterNextFunc(__pyx_t_6); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 3242, __pyx_L6_error)
    }
    for (;;) {
      if (likely(!__pyx_t_9)) {
        if (likely(PyList_CheckExact(__pyx_t_6))) {
          {
            Py_ssize_t __pyx_temp = __Pyx_PyList_GET_SIZE(__pyx_t_6);
            #if !CYTHON_ASSUME_SAFE_SIZE
            if (unlikely((__pyx_temp < 0))) __PYX_ERR(0, 3242, __pyx_L6_error)
            #endif
            if (__pyx_t_8 >= __pyx_temp) break;
          }
          __pyx_t_5 = __Pyx_PyList_GetItemRef(__pyx_t_6, __pyx_t_8);
          ++__pyx_t_8;
        } else {
          {
            Py_ssize_t __pyx_temp = __Pyx_PyTuple_GET_SIZE(__pyx_t_6);
            #if !CYTHON_ASSUME_SAFE_SIZE
            if (unlikely((__pyx_temp < 0))) __PYX_ERR(0, 3242, __pyx_L6_error)
            #endif
            if (__pyx_t_8 >= __pyx_temp) break;
          }
          #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
          __pyx_t_5 = __Pyx_NewRef(PyTuple_GET_ITEM(__pyx_t_6, __pyx_t_8));
          #else
          __pyx_t_5 = __Pyx_PySequence_ITEM(__pyx_t_6, __pyx_t_8);
          #endif
          ++__pyx_t_8;
        }
        if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 3242, __pyx_L6_error)
      } else {
        __pyx_t_5 = __pyx_t_9(__pyx_t_6);
        if (unlikely(!__pyx_t_5)) {
          PyObject* exc_type = PyErr_Occurred();
          if (exc_type) {
            if (unlikely(!__Pyx_PyErr_GivenExceptionMatches(exc_type, PyExc_StopIteration))) __PYX_ERR(0, 3242, __pyx_L6_error)
            PyErr_Clear();
          }
          break;
        }
      }
      __Pyx_GOTREF(__pyx_t_5);
      __Pyx_XDECREF_SET(__pyx_8genexpr7__pyx_v_v, __pyx_t_5);
      __pyx_t_5 = 0;
      __pyx_t_5 = __pyx_f_5pysam_9libcutils_force_bytes(__pyx_8genexpr7__pyx_v_v, NULL); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 3242, __pyx_L6_error)
      __Pyx_GOTREF(__pyx_t_5);
      if (unlikely(__Pyx_ListComp_Append(__pyx_t_4, (PyObject*)__pyx_t_5))) __PYX_ERR(0, 3242, __pyx_L6_error)
      __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
    }
    __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
    __Pyx_XDECREF(__pyx_8genexpr7__pyx_v_v); __pyx_8genexpr7__pyx_v_v = 0;
    goto __pyx_L10_exit_scope;
    __pyx_L6_error:;
    __Pyx_XDECREF(__pyx_8genexpr7__pyx_v_v); __pyx_8genexpr7__pyx_v_v = 0;
    goto __pyx_L1_error;
    __pyx_L10_exit_scope:;
  } /* exit inner scope */
  __Pyx_DECREF_SET(__pyx_v_values, __pyx_t_4);
  __pyx_t_4 = 0;

  /* "pysam/libcbcf.pyx":3244
 *         values = [force_bytes(v) for v in values]
 * 
 *         if len(values) < 2:             # <<<<<<<<<<<<<<
 *             raise ValueError('must set at least 2 alleles')
 * 
*/
  __pyx_t_8 = PyObject_Length(__pyx_v_values); if (unlikely(__pyx_t_8 == ((Py_ssize_t)-1))) __PYX_ERR(0, 3244, __pyx_L1_error)
  __pyx_t_3 = (__pyx_t_8 < 2);
  if (unlikely(__pyx_t_3)) {

    /* "pysam/libcbcf.pyx":3245
 * 
 *         if len(values) < 2:
 *             raise ValueError('must set at least 2 alleles')             # <<<<<<<<<<<<<<
 * 
 *         if b'' in values:
*/
    __pyx_t_6 = NULL;
    __Pyx_INCREF(__pyx_builtin_ValueError);
    __pyx_t_5 = __pyx_builtin_ValueError; 
    __pyx_t_7 = 1;
    {
      PyObject *__pyx_callargs[2] = {__pyx_t_6, __pyx_mstate_global->__pyx_kp_u_must_set_at_least_2_alleles};
      __pyx_t_4 = __Pyx_PyObject_FastCall(__pyx_t_5, __pyx_callargs+__pyx_t_7, (2-__pyx_t_7) | (__pyx_t_7*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
      __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0;
      __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
      if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 3245, __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, 3245, __pyx_L1_error)

    /* "pysam/libcbcf.pyx":3244
 *         values = [force_bytes(v) for v in values]
 * 
 *         if len(values) < 2:             # <<<<<<<<<<<<<<
 *             raise ValueError('must set at least 2 alleles')
 * 
*/
  }

  /* "pysam/libcbcf.pyx":3247
 *             raise ValueError('must set at least 2 alleles')
 * 
 *         if b'' in values:             # <<<<<<<<<<<<<<
 *             raise ValueError('cannot set null allele')
 * 
*/
  __pyx_t_3 = (__Pyx_PySequence_ContainsTF(__pyx_mstate_global->__pyx_kp_b__2, __pyx_v_values, Py_EQ)); if (unlikely((__pyx_t_3 < 0))) __PYX_ERR(0, 3247, __pyx_L1_error)
  if (unlikely(__pyx_t_3)) {

    /* "pysam/libcbcf.pyx":3248
 * 
 *         if b'' in values:
 *             raise ValueError('cannot set null allele')             # <<<<<<<<<<<<<<
 * 
 *         value = b','.join(values)
*/
    __pyx_t_5 = NULL;
    __Pyx_INCREF(__pyx_builtin_ValueError);
    __pyx_t_6 = __pyx_builtin_ValueError; 
    __pyx_t_7 = 1;
    {
      PyObject *__pyx_callargs[2] = {__pyx_t_5, __pyx_mstate_global->__pyx_kp_u_cannot_set_null_allele};
      __pyx_t_4 = __Pyx_PyObject_FastCall(__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, 3248, __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, 3248, __pyx_L1_error)

    /* "pysam/libcbcf.pyx":3247
 *             raise ValueError('must set at least 2 alleles')
 * 
 *         if b'' in values:             # <<<<<<<<<<<<<<
 *             raise ValueError('cannot set null allele')
 * 
*/
  }

  /* "pysam/libcbcf.pyx":3250
 *             raise ValueError('cannot set null allele')
 * 
 *         value = b','.join(values)             # <<<<<<<<<<<<<<
 * 
 *         if bcf_update_alleles_str(self.header.ptr, r, value) < 0:
*/
  __pyx_t_4 = __Pyx_PyBytes_Join(__pyx_mstate_global->__pyx_kp_b_, __pyx_v_values); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 3250, __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(0, 3250, __pyx_L1_error)
  __pyx_v_value = ((PyObject*)__pyx_t_4);
  __pyx_t_4 = 0;

  /* "pysam/libcbcf.pyx":3252
 *         value = b','.join(values)
 * 
 *         if bcf_update_alleles_str(self.header.ptr, r, value) < 0:             # <<<<<<<<<<<<<<
 *             raise ValueError('Error updating alleles')
 * 
*/
  if (unlikely(__pyx_v_value == Py_None)) {
    PyErr_SetString(PyExc_TypeError, "expected bytes, NoneType found");
    __PYX_ERR(0, 3252, __pyx_L1_error)
  }
  __pyx_t_10 = __Pyx_PyBytes_AsString(__pyx_v_value); if (unlikely((!__pyx_t_10) && PyErr_Occurred())) __PYX_ERR(0, 3252, __pyx_L1_error)
  __pyx_t_3 = (bcf_update_alleles_str(__pyx_v_self->header->ptr, __pyx_v_r, __pyx_t_10) < 0);
  if (unlikely(__pyx_t_3)) {

    /* "pysam/libcbcf.pyx":3253
 * 
 *         if bcf_update_alleles_str(self.header.ptr, r, value) < 0:
 *             raise ValueError('Error updating alleles')             # <<<<<<<<<<<<<<
 * 
 *         # Reset rlen if alternate allele isn't symbolic, otherwise used cached
*/
    __pyx_t_6 = NULL;
    __Pyx_INCREF(__pyx_builtin_ValueError);
    __pyx_t_5 = __pyx_builtin_ValueError; 
    __pyx_t_7 = 1;
    {
      PyObject *__pyx_callargs[2] = {__pyx_t_6, __pyx_mstate_global->__pyx_kp_u_Error_updating_alleles};
      __pyx_t_4 = __Pyx_PyObject_FastCall(__pyx_t_5, __pyx_callargs+__pyx_t_7, (2-__pyx_t_7) | (__pyx_t_7*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
      __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0;
      __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
      if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 3253, __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, 3253, __pyx_L1_error)

    /* "pysam/libcbcf.pyx":3252
 *         value = b','.join(values)
 * 
 *         if bcf_update_alleles_str(self.header.ptr, r, value) < 0:             # <<<<<<<<<<<<<<
 *             raise ValueError('Error updating alleles')
 * 
*/
  }

  /* "pysam/libcbcf.pyx":3256
 * 
 *         # Reset rlen if alternate allele isn't symbolic, otherwise used cached
 *         if has_symbolic_allele(self):             # <<<<<<<<<<<<<<
 *             self.ptr.rlen = rlen
 *         else:
*/
  __pyx_t_11 = __pyx_f_5pysam_7libcbcf_has_symbolic_allele(__pyx_v_self); if (unlikely(__pyx_t_11 == ((int)-1) && PyErr_Occurred())) __PYX_ERR(0, 3256, __pyx_L1_error)
  __pyx_t_3 = (__pyx_t_11 != 0);
  if (__pyx_t_3) {

    /* "pysam/libcbcf.pyx":3257
 *         # Reset rlen if alternate allele isn't symbolic, otherwise used cached
 *         if has_symbolic_allele(self):
 *             self.ptr.rlen = rlen             # <<<<<<<<<<<<<<
 *         else:
 *             self.ptr.rlen = len(values[0])
*/
    __pyx_v_self->ptr->rlen = __pyx_v_rlen;

    /* "pysam/libcbcf.pyx":3256
 * 
 *         # Reset rlen if alternate allele isn't symbolic, otherwise used cached
 *         if has_symbolic_allele(self):             # <<<<<<<<<<<<<<
 *             self.ptr.rlen = rlen
 *         else:
*/
    goto __pyx_L14;
  }

  /* "pysam/libcbcf.pyx":3259
 *             self.ptr.rlen = rlen
 *         else:
 *             self.ptr.rlen = len(values[0])             # <<<<<<<<<<<<<<
 *         r.d.var_type = -1
 *         bcf_sync_end(self)
*/
  /*else*/ {
    __pyx_t_4 = __Pyx_GetItemInt(__pyx_v_values, 0, long, 1, __Pyx_PyLong_From_long, 0, 0, 1, 1); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 3259, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
    __pyx_t_8 = PyObject_Length(__pyx_t_4); if (unlikely(__pyx_t_8 == ((Py_ssize_t)-1))) __PYX_ERR(0, 3259, __pyx_L1_error)
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    __pyx_v_self->ptr->rlen = __pyx_t_8;
  }
  __pyx_L14:;

  /* "pysam/libcbcf.pyx":3260
 *         else:
 *             self.ptr.rlen = len(values[0])
 *         r.d.var_type = -1             # <<<<<<<<<<<<<<
 *         bcf_sync_end(self)
 * 
*/
  __pyx_v_r->d.var_type = -1;

  /* "pysam/libcbcf.pyx":3261
 *             self.ptr.rlen = len(values[0])
 *         r.d.var_type = -1
 *         bcf_sync_end(self)             # <<<<<<<<<<<<<<
 * 
 *     @property
*/
  __pyx_t_4 = __pyx_f_5pysam_7libcbcf_bcf_sync_end(__pyx_v_self); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 3261, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;

  /* "pysam/libcbcf.pyx":3232
 *         return res
 * 
 *     @alleles.setter             # <<<<<<<<<<<<<<
 *     def alleles(self, values):
 *         cdef bcf1_t *r = self.ptr
*/

  /* function exit code */
  __pyx_r = 0;
  __Pyx_TraceReturnCValue(__pyx_r, __Pyx_Owned_Py_None, 0, 0, __PYX_ERR(0, 3232, __pyx_L1_error));
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_XDECREF(__pyx_t_5);
  __Pyx_XDECREF(__pyx_t_6);
  __Pyx_TraceException(__pyx_lineno, 0, 0);
  #if CYTHON_USE_SYS_MONITORING
  __Pyx_TraceExceptionUnwind(0, 0);
  #else
  __Pyx_TraceReturnValue(NULL, 0, 0, __PYX_ERR(0, 3232, __pyx_L1_error));
  #endif
  __Pyx_AddTraceback("pysam.libcbcf.VariantRecord.alleles.__set__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = -1;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_value);
  __Pyx_XDECREF(__pyx_8genexpr7__pyx_v_v);
  __Pyx_XDECREF(__pyx_v_values);
  __Pyx_PyMonitoring_ExitScope(0);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "pysam/libcbcf.pyx":3263
 *         bcf_sync_end(self)
 * 
 *     @property             # <<<<<<<<<<<<<<
 *     def alts(self):
 *         """tuple of alt alleles"""
*/

/* Python wrapper */
static PyObject *__pyx_pw_5pysam_7libcbcf_13VariantRecord_4alts_1__get__(PyObject *__pyx_v_self); /*proto*/
static PyObject *__pyx_pw_5pysam_7libcbcf_13VariantRecord_4alts_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_5pysam_7libcbcf_13VariantRecord_4alts___get__(((struct __pyx_obj_5pysam_7libcbcf_VariantRecord *)__pyx_v_self));

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

static PyObject *__pyx_pf_5pysam_7libcbcf_13VariantRecord_4alts___get__(struct __pyx_obj_5pysam_7libcbcf_VariantRecord *__pyx_v_self) {
  bcf1_t *__pyx_v_r;
  PyObject *__pyx_v_res = 0;
  PyObject *__pyx_v_i = NULL;
  PyObject *__pyx_v_a = NULL;
  PyObject *__pyx_r = NULL;
  __Pyx_TraceDeclarationsFunc
  __Pyx_RefNannyDeclarations
  bcf1_t *__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_t_7;
  PyObject *__pyx_t_8 = NULL;
  Py_ssize_t __pyx_t_9;
  PyObject *(*__pyx_t_10)(PyObject *);
  Py_ssize_t __pyx_t_11;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_TraceFrameInit(((PyObject *)__pyx_mstate_global->__pyx_codeobj_tab[272]))
  __Pyx_RefNannySetupContext("__get__", 0);
  __Pyx_TraceStartFunc("__get__", __pyx_f[0], 3263, 0, 0, 0, __PYX_ERR(0, 3263, __pyx_L1_error));

  /* "pysam/libcbcf.pyx":3266
 *     def alts(self):
 *         """tuple of alt alleles"""
 *         cdef bcf1_t *r = self.ptr             # <<<<<<<<<<<<<<
 *         if bcf_unpack(r, BCF_UN_STR) < 0:
 *             raise ValueError('Error unpacking VariantRecord')
*/
  __pyx_t_1 = __pyx_v_self->ptr;
  __pyx_v_r = __pyx_t_1;

  /* "pysam/libcbcf.pyx":3267
 *         """tuple of alt alleles"""
 *         cdef bcf1_t *r = self.ptr
 *         if bcf_unpack(r, BCF_UN_STR) < 0:             # <<<<<<<<<<<<<<
 *             raise ValueError('Error unpacking VariantRecord')
 *         if r.n_allele < 2 or not r.d.allele:
*/
  __pyx_t_2 = (bcf_unpack(__pyx_v_r, BCF_UN_STR) < 0);
  if (unlikely(__pyx_t_2)) {

    /* "pysam/libcbcf.pyx":3268
 *         cdef bcf1_t *r = self.ptr
 *         if bcf_unpack(r, BCF_UN_STR) < 0:
 *             raise ValueError('Error unpacking VariantRecord')             # <<<<<<<<<<<<<<
 *         if r.n_allele < 2 or not r.d.allele:
 *             return None
*/
    __pyx_t_4 = NULL;
    __Pyx_INCREF(__pyx_builtin_ValueError);
    __pyx_t_5 = __pyx_builtin_ValueError; 
    __pyx_t_6 = 1;
    {
      PyObject *__pyx_callargs[2] = {__pyx_t_4, __pyx_mstate_global->__pyx_kp_u_Error_unpacking_VariantRecord};
      __pyx_t_3 = __Pyx_PyObject_FastCall(__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, 3268, __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, 3268, __pyx_L1_error)

    /* "pysam/libcbcf.pyx":3267
 *         """tuple of alt alleles"""
 *         cdef bcf1_t *r = self.ptr
 *         if bcf_unpack(r, BCF_UN_STR) < 0:             # <<<<<<<<<<<<<<
 *             raise ValueError('Error unpacking VariantRecord')
 *         if r.n_allele < 2 or not r.d.allele:
*/
  }

  /* "pysam/libcbcf.pyx":3269
 *         if bcf_unpack(r, BCF_UN_STR) < 0:
 *             raise ValueError('Error unpacking VariantRecord')
 *         if r.n_allele < 2 or not r.d.allele:             # <<<<<<<<<<<<<<
 *             return None
 *         cdef tuple res = PyTuple_New(r.n_allele - 1)
*/
  __pyx_t_7 = (__pyx_v_r->n_allele < 2);
  if (!__pyx_t_7) {
  } else {
    __pyx_t_2 = __pyx_t_7;
    goto __pyx_L5_bool_binop_done;
  }
  __pyx_t_7 = (!(__pyx_v_r->d.allele != 0));
  __pyx_t_2 = __pyx_t_7;
  __pyx_L5_bool_binop_done:;
  if (__pyx_t_2) {

    /* "pysam/libcbcf.pyx":3270
 *             raise ValueError('Error unpacking VariantRecord')
 *         if r.n_allele < 2 or not r.d.allele:
 *             return None             # <<<<<<<<<<<<<<
 *         cdef tuple res = PyTuple_New(r.n_allele - 1)
 *         for i in range(1, r.n_allele):
*/
    __Pyx_XDECREF(__pyx_r);
    __pyx_r = Py_None; __Pyx_INCREF(Py_None);
    goto __pyx_L0;

    /* "pysam/libcbcf.pyx":3269
 *         if bcf_unpack(r, BCF_UN_STR) < 0:
 *             raise ValueError('Error unpacking VariantRecord')
 *         if r.n_allele < 2 or not r.d.allele:             # <<<<<<<<<<<<<<
 *             return None
 *         cdef tuple res = PyTuple_New(r.n_allele - 1)
*/
  }

  /* "pysam/libcbcf.pyx":3271
 *         if r.n_allele < 2 or not r.d.allele:
 *             return None
 *         cdef tuple res = PyTuple_New(r.n_allele - 1)             # <<<<<<<<<<<<<<
 *         for i in range(1, r.n_allele):
 *             a = charptr_to_str(r.d.allele[i])
*/
  __pyx_t_3 = PyTuple_New((__pyx_v_r->n_allele - 1)); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 3271, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __pyx_v_res = ((PyObject*)__pyx_t_3);
  __pyx_t_3 = 0;

  /* "pysam/libcbcf.pyx":3272
 *             return None
 *         cdef tuple res = PyTuple_New(r.n_allele - 1)
 *         for i in range(1, r.n_allele):             # <<<<<<<<<<<<<<
 *             a = charptr_to_str(r.d.allele[i])
 *             PyTuple_SET_ITEM(res, i - 1, a)
*/
  __pyx_t_5 = NULL;
  __Pyx_INCREF(__pyx_builtin_range);
  __pyx_t_4 = __pyx_builtin_range; 
  __pyx_t_8 = __Pyx_PyLong_From_uint32_t(__pyx_v_r->n_allele); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 3272, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_8);
  __pyx_t_6 = 1;
  {
    PyObject *__pyx_callargs[3] = {__pyx_t_5, __pyx_mstate_global->__pyx_int_1, __pyx_t_8};
    __pyx_t_3 = __Pyx_PyObject_FastCall(__pyx_t_4, __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;
    __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, 3272, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
  }
  if (likely(PyList_CheckExact(__pyx_t_3)) || PyTuple_CheckExact(__pyx_t_3)) {
    __pyx_t_4 = __pyx_t_3; __Pyx_INCREF(__pyx_t_4);
    __pyx_t_9 = 0;
    __pyx_t_10 = NULL;
  } else {
    __pyx_t_9 = -1; __pyx_t_4 = PyObject_GetIter(__pyx_t_3); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 3272, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
    __pyx_t_10 = (CYTHON_COMPILING_IN_LIMITED_API) ? PyIter_Next : __Pyx_PyObject_GetIterNextFunc(__pyx_t_4); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 3272, __pyx_L1_error)
  }
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  for (;;) {
    if (likely(!__pyx_t_10)) {
      if (likely(PyList_CheckExact(__pyx_t_4))) {
        {
          Py_ssize_t __pyx_temp = __Pyx_PyList_GET_SIZE(__pyx_t_4);
          #if !CYTHON_ASSUME_SAFE_SIZE
          if (unlikely((__pyx_temp < 0))) __PYX_ERR(0, 3272, __pyx_L1_error)
          #endif
          if (__pyx_t_9 >= __pyx_temp) break;
        }
        __pyx_t_3 = __Pyx_PyList_GetItemRef(__pyx_t_4, __pyx_t_9);
        ++__pyx_t_9;
      } else {
        {
          Py_ssize_t __pyx_temp = __Pyx_PyTuple_GET_SIZE(__pyx_t_4);
          #if !CYTHON_ASSUME_SAFE_SIZE
          if (unlikely((__pyx_temp < 0))) __PYX_ERR(0, 3272, __pyx_L1_error)
          #endif
          if (__pyx_t_9 >= __pyx_temp) break;
        }
        #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
        __pyx_t_3 = __Pyx_NewRef(PyTuple_GET_ITEM(__pyx_t_4, __pyx_t_9));
        #else
        __pyx_t_3 = __Pyx_PySequence_ITEM(__pyx_t_4, __pyx_t_9);
        #endif
        ++__pyx_t_9;
      }
      if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 3272, __pyx_L1_error)
    } else {
      __pyx_t_3 = __pyx_t_10(__pyx_t_4);
      if (unlikely(!__pyx_t_3)) {
        PyObject* exc_type = PyErr_Occurred();
        if (exc_type) {
          if (unlikely(!__Pyx_PyErr_GivenExceptionMatches(exc_type, PyExc_StopIteration))) __PYX_ERR(0, 3272, __pyx_L1_error)
          PyErr_Clear();
        }
        break;
      }
    }
    __Pyx_GOTREF(__pyx_t_3);
    __Pyx_XDECREF_SET(__pyx_v_i, __pyx_t_3);
    __pyx_t_3 = 0;

    /* "pysam/libcbcf.pyx":3273
 *         cdef tuple res = PyTuple_New(r.n_allele - 1)
 *         for i in range(1, r.n_allele):
 *             a = charptr_to_str(r.d.allele[i])             # <<<<<<<<<<<<<<
 *             PyTuple_SET_ITEM(res, i - 1, a)
 *             Py_INCREF(a)
*/
    __pyx_t_11 = __Pyx_PyIndex_AsSsize_t(__pyx_v_i); if (unlikely((__pyx_t_11 == (Py_ssize_t)-1) && PyErr_Occurred())) __PYX_ERR(0, 3273, __pyx_L1_error)
    __pyx_t_3 = __pyx_f_5pysam_9libcutils_charptr_to_str((__pyx_v_r->d.allele[__pyx_t_11]), NULL); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 3273, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __Pyx_XDECREF_SET(__pyx_v_a, __pyx_t_3);
    __pyx_t_3 = 0;

    /* "pysam/libcbcf.pyx":3274
 *         for i in range(1, r.n_allele):
 *             a = charptr_to_str(r.d.allele[i])
 *             PyTuple_SET_ITEM(res, i - 1, a)             # <<<<<<<<<<<<<<
 *             Py_INCREF(a)
 *         return res
*/
    __pyx_t_3 = __Pyx_PyLong_SubtractObjC(__pyx_v_i, __pyx_mstate_global->__pyx_int_1, 1, 0, 0); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 3274, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __pyx_t_11 = __Pyx_PyIndex_AsSsize_t(__pyx_t_3); if (unlikely((__pyx_t_11 == (Py_ssize_t)-1) && PyErr_Occurred())) __PYX_ERR(0, 3274, __pyx_L1_error)
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    PyTuple_SET_ITEM(__pyx_v_res, __pyx_t_11, __pyx_v_a);

    /* "pysam/libcbcf.pyx":3275
 *             a = charptr_to_str(r.d.allele[i])
 *             PyTuple_SET_ITEM(res, i - 1, a)
 *             Py_INCREF(a)             # <<<<<<<<<<<<<<
 *         return res
 * 
*/
    Py_INCREF(__pyx_v_a);

    /* "pysam/libcbcf.pyx":3272
 *             return None
 *         cdef tuple res = PyTuple_New(r.n_allele - 1)
 *         for i in range(1, r.n_allele):             # <<<<<<<<<<<<<<
 *             a = charptr_to_str(r.d.allele[i])
 *             PyTuple_SET_ITEM(res, i - 1, a)
*/
  }
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;

  /* "pysam/libcbcf.pyx":3276
 *             PyTuple_SET_ITEM(res, i - 1, a)
 *             Py_INCREF(a)
 *         return res             # <<<<<<<<<<<<<<
 * 
 *     @alts.setter
*/
  __Pyx_XDECREF(__pyx_r);
  __Pyx_INCREF(__pyx_v_res);
  __pyx_r = __pyx_v_res;
  __Pyx_TraceReturnValue(__pyx_r, 59, 0, __PYX_ERR(0, 3276, __pyx_L1_error));
  goto __pyx_L0;

  /* "pysam/libcbcf.pyx":3263
 *         bcf_sync_end(self)
 * 
 *     @property             # <<<<<<<<<<<<<<
 *     def alts(self):
 *         """tuple of alt alleles"""
*/

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_XDECREF(__pyx_t_5);
  __Pyx_XDECREF(__pyx_t_8);
  __Pyx_TraceException(__pyx_lineno, 0, 0);
  #if CYTHON_USE_SYS_MONITORING
  __Pyx_TraceExceptionUnwind(0, 0);
  #else
  __Pyx_TraceReturnValue(NULL, 0, 0, __PYX_ERR(0, 3263, __pyx_L1_error));
  #endif
  __Pyx_AddTraceback("pysam.libcbcf.VariantRecord.alts.__get__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_res);
  __Pyx_XDECREF(__pyx_v_i);
  __Pyx_XDECREF(__pyx_v_a);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_PyMonitoring_ExitScope(0);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "pysam/libcbcf.pyx":3278
 *         return res
 * 
 *     @alts.setter             # <<<<<<<<<<<<<<
 *     def alts(self, value):
 *         #FIXME: Set alleles directly -- this is stupid
*/

/* Python wrapper */
static int __pyx_pw_5pysam_7libcbcf_13VariantRecord_4alts_3__set__(PyObject *__pyx_v_self, PyObject *__pyx_v_value); /*proto*/
static int __pyx_pw_5pysam_7libcbcf_13VariantRecord_4alts_3__set__(PyObject *__pyx_v_self, PyObject *__pyx_v_value) {
  CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__set__ (wrapper)", 0);
  __pyx_kwvalues = __Pyx_KwValues_VARARGS(__pyx_args, __pyx_nargs);
  __pyx_r = __pyx_pf_5pysam_7libcbcf_13VariantRecord_4alts_2__set__(((struct __pyx_obj_5pysam_7libcbcf_VariantRecord *)__pyx_v_self), ((PyObject *)__pyx_v_value));

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

static int __pyx_pf_5pysam_7libcbcf_13VariantRecord_4alts_2__set__(struct __pyx_obj_5pysam_7libcbcf_VariantRecord *__pyx_v_self, PyObject *__pyx_v_value) {
  bcf1_t *__pyx_v_r;
  PyObject *__pyx_v_ref = NULL;
  PyObject *__pyx_8genexpr8__pyx_v_v = NULL;
  int __pyx_r;
  __Pyx_TraceDeclarationsFunc
  __Pyx_RefNannyDeclarations
  bcf1_t *__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;
  Py_ssize_t __pyx_t_7;
  PyObject *(*__pyx_t_8)(PyObject *);
  int __pyx_t_9;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_TraceFrameInit(((PyObject *)__pyx_mstate_global->__pyx_codeobj_tab[273]))
  __Pyx_RefNannySetupContext("__set__", 0);
  __Pyx_TraceStartFunc("__set__", __pyx_f[0], 3278, 0, 0, 0, __PYX_ERR(0, 3278, __pyx_L1_error));
  __Pyx_INCREF(__pyx_v_value);

  /* "pysam/libcbcf.pyx":3281
 *     def alts(self, value):
 *         #FIXME: Set alleles directly -- this is stupid
 *         cdef bcf1_t *r = self.ptr             # <<<<<<<<<<<<<<
 *         if bcf_unpack(r, BCF_UN_STR) < 0:
 *             raise ValueError('Error unpacking VariantRecord')
*/
  __pyx_t_1 = __pyx_v_self->ptr;
  __pyx_v_r = __pyx_t_1;

  /* "pysam/libcbcf.pyx":3282
 *         #FIXME: Set alleles directly -- this is stupid
 *         cdef bcf1_t *r = self.ptr
 *         if bcf_unpack(r, BCF_UN_STR) < 0:             # <<<<<<<<<<<<<<
 *             raise ValueError('Error unpacking VariantRecord')
 *         value = [force_bytes(v) for v in value]
*/
  __pyx_t_2 = (bcf_unpack(__pyx_v_r, BCF_UN_STR) < 0);
  if (unlikely(__pyx_t_2)) {

    /* "pysam/libcbcf.pyx":3283
 *         cdef bcf1_t *r = self.ptr
 *         if bcf_unpack(r, BCF_UN_STR) < 0:
 *             raise ValueError('Error unpacking VariantRecord')             # <<<<<<<<<<<<<<
 *         value = [force_bytes(v) for v in value]
 *         if b'' in value:
*/
    __pyx_t_4 = NULL;
    __Pyx_INCREF(__pyx_builtin_ValueError);
    __pyx_t_5 = __pyx_builtin_ValueError; 
    __pyx_t_6 = 1;
    {
      PyObject *__pyx_callargs[2] = {__pyx_t_4, __pyx_mstate_global->__pyx_kp_u_Error_unpacking_VariantRecord};
      __pyx_t_3 = __Pyx_PyObject_FastCall(__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, 3283, __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, 3283, __pyx_L1_error)

    /* "pysam/libcbcf.pyx":3282
 *         #FIXME: Set alleles directly -- this is stupid
 *         cdef bcf1_t *r = self.ptr
 *         if bcf_unpack(r, BCF_UN_STR) < 0:             # <<<<<<<<<<<<<<
 *             raise ValueError('Error unpacking VariantRecord')
 *         value = [force_bytes(v) for v in value]
*/
  }

  /* "pysam/libcbcf.pyx":3284
 *         if bcf_unpack(r, BCF_UN_STR) < 0:
 *             raise ValueError('Error unpacking VariantRecord')
 *         value = [force_bytes(v) for v in value]             # <<<<<<<<<<<<<<
 *         if b'' in value:
 *             raise ValueError('cannot set null alt allele')
*/
  { /* enter inner scope */
    __pyx_t_3 = PyList_New(0); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 3284, __pyx_L6_error)
    __Pyx_GOTREF(__pyx_t_3);
    if (likely(PyList_CheckExact(__pyx_v_value)) || PyTuple_CheckExact(__pyx_v_value)) {
      __pyx_t_5 = __pyx_v_value; __Pyx_INCREF(__pyx_t_5);
      __pyx_t_7 = 0;
      __pyx_t_8 = NULL;
    } else {
      __pyx_t_7 = -1; __pyx_t_5 = PyObject_GetIter(__pyx_v_value); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 3284, __pyx_L6_error)
      __Pyx_GOTREF(__pyx_t_5);
      __pyx_t_8 = (CYTHON_COMPILING_IN_LIMITED_API) ? PyIter_Next : __Pyx_PyObject_GetIterNextFunc(__pyx_t_5); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 3284, __pyx_L6_error)
    }
    for (;;) {
      if (likely(!__pyx_t_8)) {
        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, 3284, __pyx_L6_error)
            #endif
            if (__pyx_t_7 >= __pyx_temp) break;
          }
          __pyx_t_4 = __Pyx_PyList_GetItemRef(__pyx_t_5, __pyx_t_7);
          ++__pyx_t_7;
        } 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, 3284, __pyx_L6_error)
            #endif
            if (__pyx_t_7 >= __pyx_temp) break;
          }
          #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
          __pyx_t_4 = __Pyx_NewRef(PyTuple_GET_ITEM(__pyx_t_5, __pyx_t_7));
          #else
          __pyx_t_4 = __Pyx_PySequence_ITEM(__pyx_t_5, __pyx_t_7);
          #endif
          ++__pyx_t_7;
        }
        if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 3284, __pyx_L6_error)
      } else {
        __pyx_t_4 = __pyx_t_8(__pyx_t_5);
        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, 3284, __pyx_L6_error)
            PyErr_Clear();
          }
          break;
        }
      }
      __Pyx_GOTREF(__pyx_t_4);
      __Pyx_XDECREF_SET(__pyx_8genexpr8__pyx_v_v, __pyx_t_4);
      __pyx_t_4 = 0;
      __pyx_t_4 = __pyx_f_5pysam_9libcutils_force_bytes(__pyx_8genexpr8__pyx_v_v, NULL); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 3284, __pyx_L6_error)
      __Pyx_GOTREF(__pyx_t_4);
      if (unlikely(__Pyx_ListComp_Append(__pyx_t_3, (PyObject*)__pyx_t_4))) __PYX_ERR(0, 3284, __pyx_L6_error)
      __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    }
    __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
    __Pyx_XDECREF(__pyx_8genexpr8__pyx_v_v); __pyx_8genexpr8__pyx_v_v = 0;
    goto __pyx_L10_exit_scope;
    __pyx_L6_error:;
    __Pyx_XDECREF(__pyx_8genexpr8__pyx_v_v); __pyx_8genexpr8__pyx_v_v = 0;
    goto __pyx_L1_error;
    __pyx_L10_exit_scope:;
  } /* exit inner scope */
  __Pyx_DECREF_SET(__pyx_v_value, __pyx_t_3);
  __pyx_t_3 = 0;

  /* "pysam/libcbcf.pyx":3285
 *             raise ValueError('Error unpacking VariantRecord')
 *         value = [force_bytes(v) for v in value]
 *         if b'' in value:             # <<<<<<<<<<<<<<
 *             raise ValueError('cannot set null alt allele')
 *         ref  = [r.d.allele[0] if r.d.allele and r.n_allele else b'.']
*/
  __pyx_t_2 = (__Pyx_PySequence_ContainsTF(__pyx_mstate_global->__pyx_kp_b__2, __pyx_v_value, Py_EQ)); if (unlikely((__pyx_t_2 < 0))) __PYX_ERR(0, 3285, __pyx_L1_error)
  if (unlikely(__pyx_t_2)) {

    /* "pysam/libcbcf.pyx":3286
 *         value = [force_bytes(v) for v in value]
 *         if b'' in value:
 *             raise ValueError('cannot set null alt allele')             # <<<<<<<<<<<<<<
 *         ref  = [r.d.allele[0] if r.d.allele and r.n_allele else b'.']
 *         self.alleles = ref + value
*/
    __pyx_t_5 = NULL;
    __Pyx_INCREF(__pyx_builtin_ValueError);
    __pyx_t_4 = __pyx_builtin_ValueError; 
    __pyx_t_6 = 1;
    {
      PyObject *__pyx_callargs[2] = {__pyx_t_5, __pyx_mstate_global->__pyx_kp_u_cannot_set_null_alt_allele};
      __pyx_t_3 = __Pyx_PyObject_FastCall(__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_3)) __PYX_ERR(0, 3286, __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, 3286, __pyx_L1_error)

    /* "pysam/libcbcf.pyx":3285
 *             raise ValueError('Error unpacking VariantRecord')
 *         value = [force_bytes(v) for v in value]
 *         if b'' in value:             # <<<<<<<<<<<<<<
 *             raise ValueError('cannot set null alt allele')
 *         ref  = [r.d.allele[0] if r.d.allele and r.n_allele else b'.']
*/
  }

  /* "pysam/libcbcf.pyx":3287
 *         if b'' in value:
 *             raise ValueError('cannot set null alt allele')
 *         ref  = [r.d.allele[0] if r.d.allele and r.n_allele else b'.']             # <<<<<<<<<<<<<<
 *         self.alleles = ref + value
 *         r.d.var_type = -1
*/
  __pyx_t_9 = (__pyx_v_r->d.allele != 0);
  if (__pyx_t_9) {
  } else {
    __pyx_t_2 = __pyx_t_9;
    goto __pyx_L12_bool_binop_done;
  }
  __pyx_t_9 = (__pyx_v_r->n_allele != 0);
  __pyx_t_2 = __pyx_t_9;
  __pyx_L12_bool_binop_done:;
  if (__pyx_t_2) {
    __pyx_t_4 = __Pyx_PyBytes_FromString((__pyx_v_r->d.allele[0])); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 3287, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
    __pyx_t_3 = __pyx_t_4;
    __pyx_t_4 = 0;
  } else {
    __Pyx_INCREF(__pyx_mstate_global->__pyx_kp_b__4);
    __pyx_t_3 = __pyx_mstate_global->__pyx_kp_b__4;
  }
  __pyx_t_4 = PyList_New(1); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 3287, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  __Pyx_GIVEREF(__pyx_t_3);
  if (__Pyx_PyList_SET_ITEM(__pyx_t_4, 0, __pyx_t_3) != (0)) __PYX_ERR(0, 3287, __pyx_L1_error);
  __pyx_t_3 = 0;
  __pyx_v_ref = ((PyObject*)__pyx_t_4);
  __pyx_t_4 = 0;

  /* "pysam/libcbcf.pyx":3288
 *             raise ValueError('cannot set null alt allele')
 *         ref  = [r.d.allele[0] if r.d.allele and r.n_allele else b'.']
 *         self.alleles = ref + value             # <<<<<<<<<<<<<<
 *         r.d.var_type = -1
 * 
*/
  __pyx_t_4 = PyNumber_Add(__pyx_v_ref, __pyx_v_value); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 3288, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  if (__Pyx_PyObject_SetAttrStr(((PyObject *)__pyx_v_self), __pyx_mstate_global->__pyx_n_u_alleles, __pyx_t_4) < 0) __PYX_ERR(0, 3288, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;

  /* "pysam/libcbcf.pyx":3289
 *         ref  = [r.d.allele[0] if r.d.allele and r.n_allele else b'.']
 *         self.alleles = ref + value
 *         r.d.var_type = -1             # <<<<<<<<<<<<<<
 * 
 *     @property
*/
  __pyx_v_r->d.var_type = -1;

  /* "pysam/libcbcf.pyx":3278
 *         return res
 * 
 *     @alts.setter             # <<<<<<<<<<<<<<
 *     def alts(self, value):
 *         #FIXME: Set alleles directly -- this is stupid
*/

  /* function exit code */
  __pyx_r = 0;
  __Pyx_TraceReturnCValue(__pyx_r, __Pyx_Owned_Py_None, 0, 0, __PYX_ERR(0, 3278, __pyx_L1_error));
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_XDECREF(__pyx_t_5);
  __Pyx_TraceException(__pyx_lineno, 0, 0);
  #if CYTHON_USE_SYS_MONITORING
  __Pyx_TraceExceptionUnwind(0, 0);
  #else
  __Pyx_TraceReturnValue(NULL, 0, 0, __PYX_ERR(0, 3278, __pyx_L1_error));
  #endif
  __Pyx_AddTraceback("pysam.libcbcf.VariantRecord.alts.__set__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = -1;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_ref);
  __Pyx_XDECREF(__pyx_8genexpr8__pyx_v_v);
  __Pyx_XDECREF(__pyx_v_value);
  __Pyx_PyMonitoring_ExitScope(0);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "pysam/libcbcf.pyx":3291
 *         r.d.var_type = -1
 * 
 *     @property             # <<<<<<<<<<<<<<
 *     def filter(self):
 *         """filter information (see :class:`VariantRecordFilter`)"""
*/

/* Python wrapper */
static PyObject *__pyx_pw_5pysam_7libcbcf_13VariantRecord_6filter_1__get__(PyObject *__pyx_v_self); /*proto*/
static PyObject *__pyx_pw_5pysam_7libcbcf_13VariantRecord_6filter_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_5pysam_7libcbcf_13VariantRecord_6filter___get__(((struct __pyx_obj_5pysam_7libcbcf_VariantRecord *)__pyx_v_self));

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

static PyObject *__pyx_pf_5pysam_7libcbcf_13VariantRecord_6filter___get__(struct __pyx_obj_5pysam_7libcbcf_VariantRecord *__pyx_v_self) {
  PyObject *__pyx_r = NULL;
  __Pyx_TraceDeclarationsFunc
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  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_TraceFrameInit(((PyObject *)__pyx_mstate_global->__pyx_codeobj_tab[274]))
  __Pyx_RefNannySetupContext("__get__", 0);
  __Pyx_TraceStartFunc("__get__", __pyx_f[0], 3291, 0, 0, 0, __PYX_ERR(0, 3291, __pyx_L1_error));

  /* "pysam/libcbcf.pyx":3294
 *     def filter(self):
 *         """filter information (see :class:`VariantRecordFilter`)"""
 *         if bcf_unpack(self.ptr, BCF_UN_FLT) < 0:             # <<<<<<<<<<<<<<
 *             raise ValueError('Error unpacking VariantRecord')
 *         return makeVariantRecordFilter(self)
*/
  __pyx_t_1 = (bcf_unpack(__pyx_v_self->ptr, BCF_UN_FLT) < 0);
  if (unlikely(__pyx_t_1)) {

    /* "pysam/libcbcf.pyx":3295
 *         """filter information (see :class:`VariantRecordFilter`)"""
 *         if bcf_unpack(self.ptr, BCF_UN_FLT) < 0:
 *             raise ValueError('Error unpacking VariantRecord')             # <<<<<<<<<<<<<<
 *         return makeVariantRecordFilter(self)
 * 
*/
    __pyx_t_3 = NULL;
    __Pyx_INCREF(__pyx_builtin_ValueError);
    __pyx_t_4 = __pyx_builtin_ValueError; 
    __pyx_t_5 = 1;
    {
      PyObject *__pyx_callargs[2] = {__pyx_t_3, __pyx_mstate_global->__pyx_kp_u_Error_unpacking_VariantRecord};
      __pyx_t_2 = __Pyx_PyObject_FastCall(__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_2)) __PYX_ERR(0, 3295, __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, 3295, __pyx_L1_error)

    /* "pysam/libcbcf.pyx":3294
 *     def filter(self):
 *         """filter information (see :class:`VariantRecordFilter`)"""
 *         if bcf_unpack(self.ptr, BCF_UN_FLT) < 0:             # <<<<<<<<<<<<<<
 *             raise ValueError('Error unpacking VariantRecord')
 *         return makeVariantRecordFilter(self)
*/
  }

  /* "pysam/libcbcf.pyx":3296
 *         if bcf_unpack(self.ptr, BCF_UN_FLT) < 0:
 *             raise ValueError('Error unpacking VariantRecord')
 *         return makeVariantRecordFilter(self)             # <<<<<<<<<<<<<<
 * 
 *     @property
*/
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_2 = ((PyObject *)__pyx_f_5pysam_7libcbcf_makeVariantRecordFilter(__pyx_v_self)); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 3296, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_r = __pyx_t_2;
  __pyx_t_2 = 0;
  __Pyx_TraceReturnValue(__pyx_r, 13, 0, __PYX_ERR(0, 3296, __pyx_L1_error));
  goto __pyx_L0;

  /* "pysam/libcbcf.pyx":3291
 *         r.d.var_type = -1
 * 
 *     @property             # <<<<<<<<<<<<<<
 *     def filter(self):
 *         """filter information (see :class:`VariantRecordFilter`)"""
*/

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_TraceException(__pyx_lineno, 0, 0);
  #if CYTHON_USE_SYS_MONITORING
  __Pyx_TraceExceptionUnwind(0, 0);
  #else
  __Pyx_TraceReturnValue(NULL, 0, 0, __PYX_ERR(0, 3291, __pyx_L1_error));
  #endif
  __Pyx_AddTraceback("pysam.libcbcf.VariantRecord.filter.__get__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_PyMonitoring_ExitScope(0);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "pysam/libcbcf.pyx":3298
 *         return makeVariantRecordFilter(self)
 * 
 *     @property             # <<<<<<<<<<<<<<
 *     def info(self):
 *         """info data (see :class:`VariantRecordInfo`)"""
*/

/* Python wrapper */
static PyObject *__pyx_pw_5pysam_7libcbcf_13VariantRecord_4info_1__get__(PyObject *__pyx_v_self); /*proto*/
static PyObject *__pyx_pw_5pysam_7libcbcf_13VariantRecord_4info_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_5pysam_7libcbcf_13VariantRecord_4info___get__(((struct __pyx_obj_5pysam_7libcbcf_VariantRecord *)__pyx_v_self));

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

static PyObject *__pyx_pf_5pysam_7libcbcf_13VariantRecord_4info___get__(struct __pyx_obj_5pysam_7libcbcf_VariantRecord *__pyx_v_self) {
  PyObject *__pyx_r = NULL;
  __Pyx_TraceDeclarationsFunc
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  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_TraceFrameInit(((PyObject *)__pyx_mstate_global->__pyx_codeobj_tab[275]))
  __Pyx_RefNannySetupContext("__get__", 0);
  __Pyx_TraceStartFunc("__get__", __pyx_f[0], 3298, 0, 0, 0, __PYX_ERR(0, 3298, __pyx_L1_error));

  /* "pysam/libcbcf.pyx":3301
 *     def info(self):
 *         """info data (see :class:`VariantRecordInfo`)"""
 *         if bcf_unpack(self.ptr, BCF_UN_INFO) < 0:             # <<<<<<<<<<<<<<
 *             raise ValueError('Error unpacking VariantRecord')
 *         return makeVariantRecordInfo(self)
*/
  __pyx_t_1 = (bcf_unpack(__pyx_v_self->ptr, BCF_UN_INFO) < 0);
  if (unlikely(__pyx_t_1)) {

    /* "pysam/libcbcf.pyx":3302
 *         """info data (see :class:`VariantRecordInfo`)"""
 *         if bcf_unpack(self.ptr, BCF_UN_INFO) < 0:
 *             raise ValueError('Error unpacking VariantRecord')             # <<<<<<<<<<<<<<
 *         return makeVariantRecordInfo(self)
 * 
*/
    __pyx_t_3 = NULL;
    __Pyx_INCREF(__pyx_builtin_ValueError);
    __pyx_t_4 = __pyx_builtin_ValueError; 
    __pyx_t_5 = 1;
    {
      PyObject *__pyx_callargs[2] = {__pyx_t_3, __pyx_mstate_global->__pyx_kp_u_Error_unpacking_VariantRecord};
      __pyx_t_2 = __Pyx_PyObject_FastCall(__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_2)) __PYX_ERR(0, 3302, __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, 3302, __pyx_L1_error)

    /* "pysam/libcbcf.pyx":3301
 *     def info(self):
 *         """info data (see :class:`VariantRecordInfo`)"""
 *         if bcf_unpack(self.ptr, BCF_UN_INFO) < 0:             # <<<<<<<<<<<<<<
 *             raise ValueError('Error unpacking VariantRecord')
 *         return makeVariantRecordInfo(self)
*/
  }

  /* "pysam/libcbcf.pyx":3303
 *         if bcf_unpack(self.ptr, BCF_UN_INFO) < 0:
 *             raise ValueError('Error unpacking VariantRecord')
 *         return makeVariantRecordInfo(self)             # <<<<<<<<<<<<<<
 * 
 *     @property
*/
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_2 = ((PyObject *)__pyx_f_5pysam_7libcbcf_makeVariantRecordInfo(__pyx_v_self)); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 3303, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_r = __pyx_t_2;
  __pyx_t_2 = 0;
  __Pyx_TraceReturnValue(__pyx_r, 13, 0, __PYX_ERR(0, 3303, __pyx_L1_error));
  goto __pyx_L0;

  /* "pysam/libcbcf.pyx":3298
 *         return makeVariantRecordFilter(self)
 * 
 *     @property             # <<<<<<<<<<<<<<
 *     def info(self):
 *         """info data (see :class:`VariantRecordInfo`)"""
*/

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_TraceException(__pyx_lineno, 0, 0);
  #if CYTHON_USE_SYS_MONITORING
  __Pyx_TraceExceptionUnwind(0, 0);
  #else
  __Pyx_TraceReturnValue(NULL, 0, 0, __PYX_ERR(0, 3298, __pyx_L1_error));
  #endif
  __Pyx_AddTraceback("pysam.libcbcf.VariantRecord.info.__get__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_PyMonitoring_ExitScope(0);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "pysam/libcbcf.pyx":3305
 *         return makeVariantRecordInfo(self)
 * 
 *     @property             # <<<<<<<<<<<<<<
 *     def format(self):
 *         """sample format metadata (see :class:`VariantRecordFormat`)"""
*/

/* Python wrapper */
static PyObject *__pyx_pw_5pysam_7libcbcf_13VariantRecord_6format_1__get__(PyObject *__pyx_v_self); /*proto*/
static PyObject *__pyx_pw_5pysam_7libcbcf_13VariantRecord_6format_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_5pysam_7libcbcf_13VariantRecord_6format___get__(((struct __pyx_obj_5pysam_7libcbcf_VariantRecord *)__pyx_v_self));

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

static PyObject *__pyx_pf_5pysam_7libcbcf_13VariantRecord_6format___get__(struct __pyx_obj_5pysam_7libcbcf_VariantRecord *__pyx_v_self) {
  PyObject *__pyx_r = NULL;
  __Pyx_TraceDeclarationsFunc
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  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_TraceFrameInit(((PyObject *)__pyx_mstate_global->__pyx_codeobj_tab[276]))
  __Pyx_RefNannySetupContext("__get__", 0);
  __Pyx_TraceStartFunc("__get__", __pyx_f[0], 3305, 0, 0, 0, __PYX_ERR(0, 3305, __pyx_L1_error));

  /* "pysam/libcbcf.pyx":3308
 *     def format(self):
 *         """sample format metadata (see :class:`VariantRecordFormat`)"""
 *         if bcf_unpack(self.ptr, BCF_UN_FMT) < 0:             # <<<<<<<<<<<<<<
 *             raise ValueError('Error unpacking VariantRecord')
 *         return makeVariantRecordFormat(self)
*/
  __pyx_t_1 = (bcf_unpack(__pyx_v_self->ptr, BCF_UN_FMT) < 0);
  if (unlikely(__pyx_t_1)) {

    /* "pysam/libcbcf.pyx":3309
 *         """sample format metadata (see :class:`VariantRecordFormat`)"""
 *         if bcf_unpack(self.ptr, BCF_UN_FMT) < 0:
 *             raise ValueError('Error unpacking VariantRecord')             # <<<<<<<<<<<<<<
 *         return makeVariantRecordFormat(self)
 * 
*/
    __pyx_t_3 = NULL;
    __Pyx_INCREF(__pyx_builtin_ValueError);
    __pyx_t_4 = __pyx_builtin_ValueError; 
    __pyx_t_5 = 1;
    {
      PyObject *__pyx_callargs[2] = {__pyx_t_3, __pyx_mstate_global->__pyx_kp_u_Error_unpacking_VariantRecord};
      __pyx_t_2 = __Pyx_PyObject_FastCall(__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_2)) __PYX_ERR(0, 3309, __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, 3309, __pyx_L1_error)

    /* "pysam/libcbcf.pyx":3308
 *     def format(self):
 *         """sample format metadata (see :class:`VariantRecordFormat`)"""
 *         if bcf_unpack(self.ptr, BCF_UN_FMT) < 0:             # <<<<<<<<<<<<<<
 *             raise ValueError('Error unpacking VariantRecord')
 *         return makeVariantRecordFormat(self)
*/
  }

  /* "pysam/libcbcf.pyx":3310
 *         if bcf_unpack(self.ptr, BCF_UN_FMT) < 0:
 *             raise ValueError('Error unpacking VariantRecord')
 *         return makeVariantRecordFormat(self)             # <<<<<<<<<<<<<<
 * 
 *     @property
*/
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_2 = ((PyObject *)__pyx_f_5pysam_7libcbcf_makeVariantRecordFormat(__pyx_v_self)); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 3310, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_r = __pyx_t_2;
  __pyx_t_2 = 0;
  __Pyx_TraceReturnValue(__pyx_r, 13, 0, __PYX_ERR(0, 3310, __pyx_L1_error));
  goto __pyx_L0;

  /* "pysam/libcbcf.pyx":3305
 *         return makeVariantRecordInfo(self)
 * 
 *     @property             # <<<<<<<<<<<<<<
 *     def format(self):
 *         """sample format metadata (see :class:`VariantRecordFormat`)"""
*/

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_TraceException(__pyx_lineno, 0, 0);
  #if CYTHON_USE_SYS_MONITORING
  __Pyx_TraceExceptionUnwind(0, 0);
  #else
  __Pyx_TraceReturnValue(NULL, 0, 0, __PYX_ERR(0, 3305, __pyx_L1_error));
  #endif
  __Pyx_AddTraceback("pysam.libcbcf.VariantRecord.format.__get__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_PyMonitoring_ExitScope(0);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "pysam/libcbcf.pyx":3312
 *         return makeVariantRecordFormat(self)
 * 
 *     @property             # <<<<<<<<<<<<<<
 *     def samples(self):
 *         """sample data (see :class:`VariantRecordSamples`)"""
*/

/* Python wrapper */
static PyObject *__pyx_pw_5pysam_7libcbcf_13VariantRecord_7samples_1__get__(PyObject *__pyx_v_self); /*proto*/
static PyObject *__pyx_pw_5pysam_7libcbcf_13VariantRecord_7samples_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_5pysam_7libcbcf_13VariantRecord_7samples___get__(((struct __pyx_obj_5pysam_7libcbcf_VariantRecord *)__pyx_v_self));

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

static PyObject *__pyx_pf_5pysam_7libcbcf_13VariantRecord_7samples___get__(struct __pyx_obj_5pysam_7libcbcf_VariantRecord *__pyx_v_self) {
  PyObject *__pyx_r = NULL;
  __Pyx_TraceDeclarationsFunc
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  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_TraceFrameInit(((PyObject *)__pyx_mstate_global->__pyx_codeobj_tab[277]))
  __Pyx_RefNannySetupContext("__get__", 0);
  __Pyx_TraceStartFunc("__get__", __pyx_f[0], 3312, 0, 0, 0, __PYX_ERR(0, 3312, __pyx_L1_error));

  /* "pysam/libcbcf.pyx":3315
 *     def samples(self):
 *         """sample data (see :class:`VariantRecordSamples`)"""
 *         if bcf_unpack(self.ptr, BCF_UN_ALL) < 0:             # <<<<<<<<<<<<<<
 *             raise ValueError('Error unpacking VariantRecord')
 *         return makeVariantRecordSamples(self)
*/
  __pyx_t_1 = (bcf_unpack(__pyx_v_self->ptr, BCF_UN_ALL) < 0);
  if (unlikely(__pyx_t_1)) {

    /* "pysam/libcbcf.pyx":3316
 *         """sample data (see :class:`VariantRecordSamples`)"""
 *         if bcf_unpack(self.ptr, BCF_UN_ALL) < 0:
 *             raise ValueError('Error unpacking VariantRecord')             # <<<<<<<<<<<<<<
 *         return makeVariantRecordSamples(self)
 * 
*/
    __pyx_t_3 = NULL;
    __Pyx_INCREF(__pyx_builtin_ValueError);
    __pyx_t_4 = __pyx_builtin_ValueError; 
    __pyx_t_5 = 1;
    {
      PyObject *__pyx_callargs[2] = {__pyx_t_3, __pyx_mstate_global->__pyx_kp_u_Error_unpacking_VariantRecord};
      __pyx_t_2 = __Pyx_PyObject_FastCall(__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_2)) __PYX_ERR(0, 3316, __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, 3316, __pyx_L1_error)

    /* "pysam/libcbcf.pyx":3315
 *     def samples(self):
 *         """sample data (see :class:`VariantRecordSamples`)"""
 *         if bcf_unpack(self.ptr, BCF_UN_ALL) < 0:             # <<<<<<<<<<<<<<
 *             raise ValueError('Error unpacking VariantRecord')
 *         return makeVariantRecordSamples(self)
*/
  }

  /* "pysam/libcbcf.pyx":3317
 *         if bcf_unpack(self.ptr, BCF_UN_ALL) < 0:
 *             raise ValueError('Error unpacking VariantRecord')
 *         return makeVariantRecordSamples(self)             # <<<<<<<<<<<<<<
 * 
 *     property alleles_variant_types:
*/
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_2 = ((PyObject *)__pyx_f_5pysam_7libcbcf_makeVariantRecordSamples(__pyx_v_self)); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 3317, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_r = __pyx_t_2;
  __pyx_t_2 = 0;
  __Pyx_TraceReturnValue(__pyx_r, 13, 0, __PYX_ERR(0, 3317, __pyx_L1_error));
  goto __pyx_L0;

  /* "pysam/libcbcf.pyx":3312
 *         return makeVariantRecordFormat(self)
 * 
 *     @property             # <<<<<<<<<<<<<<
 *     def samples(self):
 *         """sample data (see :class:`VariantRecordSamples`)"""
*/

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_TraceException(__pyx_lineno, 0, 0);
  #if CYTHON_USE_SYS_MONITORING
  __Pyx_TraceExceptionUnwind(0, 0);
  #else
  __Pyx_TraceReturnValue(NULL, 0, 0, __PYX_ERR(0, 3312, __pyx_L1_error));
  #endif
  __Pyx_AddTraceback("pysam.libcbcf.VariantRecord.samples.__get__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_PyMonitoring_ExitScope(0);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "pysam/libcbcf.pyx":3320
 * 
 *     property alleles_variant_types:
 *         def __get__(self):             # <<<<<<<<<<<<<<
 *             cdef bcf1_t *r = self.ptr
 *             cdef tuple result = PyTuple_New(r.n_allele)
*/

/* Python wrapper */
static PyObject *__pyx_pw_5pysam_7libcbcf_13VariantRecord_21alleles_variant_types_1__get__(PyObject *__pyx_v_self); /*proto*/
static PyObject *__pyx_pw_5pysam_7libcbcf_13VariantRecord_21alleles_variant_types_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_5pysam_7libcbcf_13VariantRecord_21alleles_variant_types___get__(((struct __pyx_obj_5pysam_7libcbcf_VariantRecord *)__pyx_v_self));

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

static PyObject *__pyx_pf_5pysam_7libcbcf_13VariantRecord_21alleles_variant_types___get__(struct __pyx_obj_5pysam_7libcbcf_VariantRecord *__pyx_v_self) {
  bcf1_t *__pyx_v_r;
  PyObject *__pyx_v_result = 0;
  uint32_t __pyx_v_i;
  int __pyx_v_tp;
  PyObject *__pyx_v_v_type = NULL;
  PyObject *__pyx_r = NULL;
  __Pyx_TraceDeclarationsFunc
  __Pyx_RefNannyDeclarations
  bcf1_t *__pyx_t_1;
  PyObject *__pyx_t_2 = NULL;
  uint32_t __pyx_t_3;
  uint32_t __pyx_t_4;
  uint32_t __pyx_t_5;
  int __pyx_t_6;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_TraceFrameInit(((PyObject *)__pyx_mstate_global->__pyx_codeobj_tab[278]))
  __Pyx_RefNannySetupContext("__get__", 0);
  __Pyx_TraceStartFunc("__get__", __pyx_f[0], 3320, 0, 0, 0, __PYX_ERR(0, 3320, __pyx_L1_error));

  /* "pysam/libcbcf.pyx":3321
 *     property alleles_variant_types:
 *         def __get__(self):
 *             cdef bcf1_t *r = self.ptr             # <<<<<<<<<<<<<<
 *             cdef tuple result = PyTuple_New(r.n_allele)
 * 
*/
  __pyx_t_1 = __pyx_v_self->ptr;
  __pyx_v_r = __pyx_t_1;

  /* "pysam/libcbcf.pyx":3322
 *         def __get__(self):
 *             cdef bcf1_t *r = self.ptr
 *             cdef tuple result = PyTuple_New(r.n_allele)             # <<<<<<<<<<<<<<
 * 
 *             for i in range(r.n_allele):
*/
  __pyx_t_2 = PyTuple_New(__pyx_v_r->n_allele); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 3322, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_v_result = ((PyObject*)__pyx_t_2);
  __pyx_t_2 = 0;

  /* "pysam/libcbcf.pyx":3324
 *             cdef tuple result = PyTuple_New(r.n_allele)
 * 
 *             for i in range(r.n_allele):             # <<<<<<<<<<<<<<
 *                 tp = bcf_get_variant_type(r, i)
 * 
*/
  __pyx_t_3 = __pyx_v_r->n_allele;
  __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;

    /* "pysam/libcbcf.pyx":3325
 * 
 *             for i in range(r.n_allele):
 *                 tp = bcf_get_variant_type(r, i)             # <<<<<<<<<<<<<<
 * 
 *                 if tp == VCF_REF:
*/
    __pyx_v_tp = bcf_get_variant_type(__pyx_v_r, __pyx_v_i);

    /* "pysam/libcbcf.pyx":3327
 *                 tp = bcf_get_variant_type(r, i)
 * 
 *                 if tp == VCF_REF:             # <<<<<<<<<<<<<<
 *                     v_type = "REF"
 *                 elif tp == VCF_SNP:
*/
    __pyx_t_6 = (__pyx_v_tp == VCF_REF);
    if (__pyx_t_6) {

      /* "pysam/libcbcf.pyx":3328
 * 
 *                 if tp == VCF_REF:
 *                     v_type = "REF"             # <<<<<<<<<<<<<<
 *                 elif tp == VCF_SNP:
 *                     v_type = "SNP"
*/
      __Pyx_INCREF(__pyx_mstate_global->__pyx_n_u_REF);
      __Pyx_XDECREF_SET(__pyx_v_v_type, __pyx_mstate_global->__pyx_n_u_REF);

      /* "pysam/libcbcf.pyx":3327
 *                 tp = bcf_get_variant_type(r, i)
 * 
 *                 if tp == VCF_REF:             # <<<<<<<<<<<<<<
 *                     v_type = "REF"
 *                 elif tp == VCF_SNP:
*/
      goto __pyx_L5;
    }

    /* "pysam/libcbcf.pyx":3329
 *                 if tp == VCF_REF:
 *                     v_type = "REF"
 *                 elif tp == VCF_SNP:             # <<<<<<<<<<<<<<
 *                     v_type = "SNP"
 *                 elif tp == VCF_MNP:
*/
    __pyx_t_6 = (__pyx_v_tp == VCF_SNP);
    if (__pyx_t_6) {

      /* "pysam/libcbcf.pyx":3330
 *                     v_type = "REF"
 *                 elif tp == VCF_SNP:
 *                     v_type = "SNP"             # <<<<<<<<<<<<<<
 *                 elif tp == VCF_MNP:
 *                     v_type = "MNP"
*/
      __Pyx_INCREF(__pyx_mstate_global->__pyx_n_u_SNP);
      __Pyx_XDECREF_SET(__pyx_v_v_type, __pyx_mstate_global->__pyx_n_u_SNP);

      /* "pysam/libcbcf.pyx":3329
 *                 if tp == VCF_REF:
 *                     v_type = "REF"
 *                 elif tp == VCF_SNP:             # <<<<<<<<<<<<<<
 *                     v_type = "SNP"
 *                 elif tp == VCF_MNP:
*/
      goto __pyx_L5;
    }

    /* "pysam/libcbcf.pyx":3331
 *                 elif tp == VCF_SNP:
 *                     v_type = "SNP"
 *                 elif tp == VCF_MNP:             # <<<<<<<<<<<<<<
 *                     v_type = "MNP"
 *                 elif tp == VCF_INDEL:
*/
    __pyx_t_6 = (__pyx_v_tp == VCF_MNP);
    if (__pyx_t_6) {

      /* "pysam/libcbcf.pyx":3332
 *                     v_type = "SNP"
 *                 elif tp == VCF_MNP:
 *                     v_type = "MNP"             # <<<<<<<<<<<<<<
 *                 elif tp == VCF_INDEL:
 *                     v_type = "INDEL"
*/
      __Pyx_INCREF(__pyx_mstate_global->__pyx_n_u_MNP);
      __Pyx_XDECREF_SET(__pyx_v_v_type, __pyx_mstate_global->__pyx_n_u_MNP);

      /* "pysam/libcbcf.pyx":3331
 *                 elif tp == VCF_SNP:
 *                     v_type = "SNP"
 *                 elif tp == VCF_MNP:             # <<<<<<<<<<<<<<
 *                     v_type = "MNP"
 *                 elif tp == VCF_INDEL:
*/
      goto __pyx_L5;
    }

    /* "pysam/libcbcf.pyx":3333
 *                 elif tp == VCF_MNP:
 *                     v_type = "MNP"
 *                 elif tp == VCF_INDEL:             # <<<<<<<<<<<<<<
 *                     v_type = "INDEL"
 *                 elif tp == VCF_BND:
*/
    __pyx_t_6 = (__pyx_v_tp == VCF_INDEL);
    if (__pyx_t_6) {

      /* "pysam/libcbcf.pyx":3334
 *                     v_type = "MNP"
 *                 elif tp == VCF_INDEL:
 *                     v_type = "INDEL"             # <<<<<<<<<<<<<<
 *                 elif tp == VCF_BND:
 *                     v_type = "BND"
*/
      __Pyx_INCREF(__pyx_mstate_global->__pyx_n_u_INDEL);
      __Pyx_XDECREF_SET(__pyx_v_v_type, __pyx_mstate_global->__pyx_n_u_INDEL);

      /* "pysam/libcbcf.pyx":3333
 *                 elif tp == VCF_MNP:
 *                     v_type = "MNP"
 *                 elif tp == VCF_INDEL:             # <<<<<<<<<<<<<<
 *                     v_type = "INDEL"
 *                 elif tp == VCF_BND:
*/
      goto __pyx_L5;
    }

    /* "pysam/libcbcf.pyx":3335
 *                 elif tp == VCF_INDEL:
 *                     v_type = "INDEL"
 *                 elif tp == VCF_BND:             # <<<<<<<<<<<<<<
 *                     v_type = "BND"
 *                 elif tp == VCF_OVERLAP:
*/
    __pyx_t_6 = (__pyx_v_tp == VCF_BND);
    if (__pyx_t_6) {

      /* "pysam/libcbcf.pyx":3336
 *                     v_type = "INDEL"
 *                 elif tp == VCF_BND:
 *                     v_type = "BND"             # <<<<<<<<<<<<<<
 *                 elif tp == VCF_OVERLAP:
 *                     v_type = "OVERLAP"
*/
      __Pyx_INCREF(__pyx_mstate_global->__pyx_n_u_BND);
      __Pyx_XDECREF_SET(__pyx_v_v_type, __pyx_mstate_global->__pyx_n_u_BND);

      /* "pysam/libcbcf.pyx":3335
 *                 elif tp == VCF_INDEL:
 *                     v_type = "INDEL"
 *                 elif tp == VCF_BND:             # <<<<<<<<<<<<<<
 *                     v_type = "BND"
 *                 elif tp == VCF_OVERLAP:
*/
      goto __pyx_L5;
    }

    /* "pysam/libcbcf.pyx":3337
 *                 elif tp == VCF_BND:
 *                     v_type = "BND"
 *                 elif tp == VCF_OVERLAP:             # <<<<<<<<<<<<<<
 *                     v_type = "OVERLAP"
 *                 else:
*/
    __pyx_t_6 = (__pyx_v_tp == VCF_OVERLAP);
    if (__pyx_t_6) {

      /* "pysam/libcbcf.pyx":3338
 *                     v_type = "BND"
 *                 elif tp == VCF_OVERLAP:
 *                     v_type = "OVERLAP"             # <<<<<<<<<<<<<<
 *                 else:
 *                     v_type = "OTHER"
*/
      __Pyx_INCREF(__pyx_mstate_global->__pyx_n_u_OVERLAP);
      __Pyx_XDECREF_SET(__pyx_v_v_type, __pyx_mstate_global->__pyx_n_u_OVERLAP);

      /* "pysam/libcbcf.pyx":3337
 *                 elif tp == VCF_BND:
 *                     v_type = "BND"
 *                 elif tp == VCF_OVERLAP:             # <<<<<<<<<<<<<<
 *                     v_type = "OVERLAP"
 *                 else:
*/
      goto __pyx_L5;
    }

    /* "pysam/libcbcf.pyx":3340
 *                     v_type = "OVERLAP"
 *                 else:
 *                     v_type = "OTHER"             # <<<<<<<<<<<<<<
 * 
 *                 PyTuple_SET_ITEM(result, i, v_type)
*/
    /*else*/ {
      __Pyx_INCREF(__pyx_mstate_global->__pyx_n_u_OTHER);
      __Pyx_XDECREF_SET(__pyx_v_v_type, __pyx_mstate_global->__pyx_n_u_OTHER);
    }
    __pyx_L5:;

    /* "pysam/libcbcf.pyx":3342
 *                     v_type = "OTHER"
 * 
 *                 PyTuple_SET_ITEM(result, i, v_type)             # <<<<<<<<<<<<<<
 *                 Py_INCREF(v_type)
 * 
*/
    PyTuple_SET_ITEM(__pyx_v_result, __pyx_v_i, __pyx_v_v_type);

    /* "pysam/libcbcf.pyx":3343
 * 
 *                 PyTuple_SET_ITEM(result, i, v_type)
 *                 Py_INCREF(v_type)             # <<<<<<<<<<<<<<
 * 
 *             return result
*/
    Py_INCREF(__pyx_v_v_type);
  }

  /* "pysam/libcbcf.pyx":3345
 *                 Py_INCREF(v_type)
 * 
 *             return result             # <<<<<<<<<<<<<<
 * 
 *     def __richcmp__(VariantRecord self not None, VariantRecord other not None, int op):
*/
  __Pyx_XDECREF(__pyx_r);
  __Pyx_INCREF(__pyx_v_result);
  __pyx_r = __pyx_v_result;
  __Pyx_TraceReturnValue(__pyx_r, 61, 0, __PYX_ERR(0, 3345, __pyx_L1_error));
  goto __pyx_L0;

  /* "pysam/libcbcf.pyx":3320
 * 
 *     property alleles_variant_types:
 *         def __get__(self):             # <<<<<<<<<<<<<<
 *             cdef bcf1_t *r = self.ptr
 *             cdef tuple result = PyTuple_New(r.n_allele)
*/

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_TraceException(__pyx_lineno, 0, 0);
  #if CYTHON_USE_SYS_MONITORING
  __Pyx_TraceExceptionUnwind(0, 0);
  #else
  __Pyx_TraceReturnValue(NULL, 0, 0, __PYX_ERR(0, 3320, __pyx_L1_error));
  #endif
  __Pyx_AddTraceback("pysam.libcbcf.VariantRecord.alleles_variant_types.__get__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_result);
  __Pyx_XDECREF(__pyx_v_v_type);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_PyMonitoring_ExitScope(0);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "pysam/libcbcf.pyx":3347
 *             return result
 * 
 *     def __richcmp__(VariantRecord self not None, VariantRecord other not None, int op):             # <<<<<<<<<<<<<<
 *         if op != 2 and op != 3:
 *             return NotImplemented
*/

/* Python wrapper */
static PyObject *__pyx_pw_5pysam_7libcbcf_13VariantRecord_9__richcmp__(PyObject *__pyx_v_self, PyObject *__pyx_v_other, int __pyx_v_op); /*proto*/
static PyObject *__pyx_pw_5pysam_7libcbcf_13VariantRecord_9__richcmp__(PyObject *__pyx_v_self, PyObject *__pyx_v_other, int __pyx_v_op) {
  CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__richcmp__ (wrapper)", 0);
  __pyx_kwvalues = __Pyx_KwValues_VARARGS(__pyx_args, __pyx_nargs);
  if (unlikely(((PyObject *)__pyx_v_self) == Py_None)) {
    PyErr_Format(PyExc_TypeError, "Argument '%.200s' must not be None", "self"); __PYX_ERR(0, 3347, __pyx_L1_error)
  }
  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_other), __pyx_mstate_global->__pyx_ptype_5pysam_7libcbcf_VariantRecord, 0, "other", 0))) __PYX_ERR(0, 3347, __pyx_L1_error)
  __pyx_r = __pyx_pf_5pysam_7libcbcf_13VariantRecord_8__richcmp__(((struct __pyx_obj_5pysam_7libcbcf_VariantRecord *)__pyx_v_self), ((struct __pyx_obj_5pysam_7libcbcf_VariantRecord *)__pyx_v_other), ((int)__pyx_v_op));

  /* function exit code */
  goto __pyx_L0;
  __pyx_L1_error:;
  __pyx_r = NULL;
  goto __pyx_L5_cleaned_up;
  __pyx_L0:;
  __pyx_L5_cleaned_up:;
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_5pysam_7libcbcf_13VariantRecord_8__richcmp__(struct __pyx_obj_5pysam_7libcbcf_VariantRecord *__pyx_v_self, struct __pyx_obj_5pysam_7libcbcf_VariantRecord *__pyx_v_other, int __pyx_v_op) {
  bcf1_t *__pyx_v_s;
  bcf1_t *__pyx_v_o;
  int __pyx_v_cmp;
  PyObject *__pyx_r = NULL;
  __Pyx_TraceDeclarationsFunc
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  bcf1_t *__pyx_t_2;
  int __pyx_t_3;
  PyObject *__pyx_t_4 = NULL;
  PyObject *__pyx_t_5 = NULL;
  PyObject *__pyx_t_6 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_TraceFrameInit(((PyObject *)__pyx_mstate_global->__pyx_codeobj_tab[279]))
  __Pyx_RefNannySetupContext("__richcmp__", 0);
  __Pyx_TraceStartFunc("__richcmp__", __pyx_f[0], 3347, 0, 0, 0, __PYX_ERR(0, 3347, __pyx_L1_error));

  /* "pysam/libcbcf.pyx":3348
 * 
 *     def __richcmp__(VariantRecord self not None, VariantRecord other not None, int op):
 *         if op != 2 and op != 3:             # <<<<<<<<<<<<<<
 *             return NotImplemented
 * 
*/
  switch (__pyx_v_op) {
    case 2:
    case 3:
    __pyx_t_1 = 0;
    break;
    default:
    __pyx_t_1 = 1;
    break;
  }
  if (__pyx_t_1) {

    /* "pysam/libcbcf.pyx":3349
 *     def __richcmp__(VariantRecord self not None, VariantRecord other not None, int op):
 *         if op != 2 and op != 3:
 *             return NotImplemented             # <<<<<<<<<<<<<<
 * 
 *         cdef bcf1_t *s = self.ptr
*/
    __Pyx_XDECREF(__pyx_r);
    __Pyx_INCREF(__pyx_builtin_NotImplemented);
    __pyx_r = __pyx_builtin_NotImplemented;
    __Pyx_TraceReturnValue(__pyx_r, 9, 0, __PYX_ERR(0, 3349, __pyx_L1_error));
    goto __pyx_L0;

    /* "pysam/libcbcf.pyx":3348
 * 
 *     def __richcmp__(VariantRecord self not None, VariantRecord other not None, int op):
 *         if op != 2 and op != 3:             # <<<<<<<<<<<<<<
 *             return NotImplemented
 * 
*/
  }

  /* "pysam/libcbcf.pyx":3351
 *             return NotImplemented
 * 
 *         cdef bcf1_t *s = self.ptr             # <<<<<<<<<<<<<<
 *         cdef bcf1_t *o = other.ptr
 * 
*/
  __pyx_t_2 = __pyx_v_self->ptr;
  __pyx_v_s = __pyx_t_2;

  /* "pysam/libcbcf.pyx":3352
 * 
 *         cdef bcf1_t *s = self.ptr
 *         cdef bcf1_t *o = other.ptr             # <<<<<<<<<<<<<<
 * 
 *         cdef bint cmp = self is other or (
*/
  __pyx_t_2 = __pyx_v_other->ptr;
  __pyx_v_o = __pyx_t_2;

  /* "pysam/libcbcf.pyx":3354
 *         cdef bcf1_t *o = other.ptr
 * 
 *         cdef bint cmp = self is other or (             # <<<<<<<<<<<<<<
 *                              s.pos        == o.pos
 *                         and  s.rlen       == o.rlen
*/
  __pyx_t_3 = (__pyx_v_self == __pyx_v_other);
  if (!__pyx_t_3) {
  } else {
    __pyx_t_1 = __pyx_t_3;
    goto __pyx_L4_bool_binop_done;
  }

  /* "pysam/libcbcf.pyx":3355
 * 
 *         cdef bint cmp = self is other or (
 *                              s.pos        == o.pos             # <<<<<<<<<<<<<<
 *                         and  s.rlen       == o.rlen
 *                         and ((bcf_float_is_missing(s.qual) and bcf_float_is_missing(o.qual))
*/
  __pyx_t_3 = (__pyx_v_s->pos == __pyx_v_o->pos);
  if (__pyx_t_3) {
  } else {
    __pyx_t_1 = __pyx_t_3;
    goto __pyx_L4_bool_binop_done;
  }

  /* "pysam/libcbcf.pyx":3356
 *         cdef bint cmp = self is other or (
 *                              s.pos        == o.pos
 *                         and  s.rlen       == o.rlen             # <<<<<<<<<<<<<<
 *                         and ((bcf_float_is_missing(s.qual) and bcf_float_is_missing(o.qual))
 *                           or s.qual       == o.qual)
*/
  __pyx_t_3 = (__pyx_v_s->rlen == __pyx_v_o->rlen);
  if (__pyx_t_3) {
  } else {
    __pyx_t_1 = __pyx_t_3;
    goto __pyx_L4_bool_binop_done;
  }

  /* "pysam/libcbcf.pyx":3357
 *                              s.pos        == o.pos
 *                         and  s.rlen       == o.rlen
 *                         and ((bcf_float_is_missing(s.qual) and bcf_float_is_missing(o.qual))             # <<<<<<<<<<<<<<
 *                           or s.qual       == o.qual)
 *                         and  s.n_sample   == o.n_sample
*/
  __pyx_t_3 = (bcf_float_is_missing(__pyx_v_s->qual) != 0);
  if (!__pyx_t_3) {
    goto __pyx_L9_next_or;
  } else {
  }
  __pyx_t_3 = (bcf_float_is_missing(__pyx_v_o->qual) != 0);
  if (!__pyx_t_3) {
  } else {
    goto __pyx_L8_next_and;
  }
  __pyx_L9_next_or:;

  /* "pysam/libcbcf.pyx":3358
 *                         and  s.rlen       == o.rlen
 *                         and ((bcf_float_is_missing(s.qual) and bcf_float_is_missing(o.qual))
 *                           or s.qual       == o.qual)             # <<<<<<<<<<<<<<
 *                         and  s.n_sample   == o.n_sample
 *                         and  s.n_allele   == o.n_allele
*/
  __pyx_t_3 = (__pyx_v_s->qual == __pyx_v_o->qual);
  if (__pyx_t_3) {
  } else {
    __pyx_t_1 = __pyx_t_3;
    goto __pyx_L4_bool_binop_done;
  }
  __pyx_L8_next_and:;

  /* "pysam/libcbcf.pyx":3359
 *                         and ((bcf_float_is_missing(s.qual) and bcf_float_is_missing(o.qual))
 *                           or s.qual       == o.qual)
 *                         and  s.n_sample   == o.n_sample             # <<<<<<<<<<<<<<
 *                         and  s.n_allele   == o.n_allele
 *                         and  self.contig  == other.contig
*/
  __pyx_t_3 = (__pyx_v_s->n_sample == __pyx_v_o->n_sample);
  if (__pyx_t_3) {
  } else {
    __pyx_t_1 = __pyx_t_3;
    goto __pyx_L4_bool_binop_done;
  }

  /* "pysam/libcbcf.pyx":3360
 *                           or s.qual       == o.qual)
 *                         and  s.n_sample   == o.n_sample
 *                         and  s.n_allele   == o.n_allele             # <<<<<<<<<<<<<<
 *                         and  self.contig  == other.contig
 *                         and  self.alleles == other.alleles
*/
  __pyx_t_3 = (__pyx_v_s->n_allele == __pyx_v_o->n_allele);
  if (__pyx_t_3) {
  } else {
    __pyx_t_1 = __pyx_t_3;
    goto __pyx_L4_bool_binop_done;
  }

  /* "pysam/libcbcf.pyx":3361
 *                         and  s.n_sample   == o.n_sample
 *                         and  s.n_allele   == o.n_allele
 *                         and  self.contig  == other.contig             # <<<<<<<<<<<<<<
 *                         and  self.alleles == other.alleles
 *                         and  self.id      == other.id
*/
  __pyx_t_4 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_mstate_global->__pyx_n_u_contig); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 3361, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  __pyx_t_5 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_other), __pyx_mstate_global->__pyx_n_u_contig); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 3361, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_5);
  __pyx_t_6 = PyObject_RichCompare(__pyx_t_4, __pyx_t_5, Py_EQ); __Pyx_XGOTREF(__pyx_t_6); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 3361, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  __pyx_t_3 = __Pyx_PyObject_IsTrue(__pyx_t_6); if (unlikely((__pyx_t_3 < 0))) __PYX_ERR(0, 3361, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
  if (__pyx_t_3) {
  } else {
    __pyx_t_1 = __pyx_t_3;
    goto __pyx_L4_bool_binop_done;
  }

  /* "pysam/libcbcf.pyx":3362
 *                         and  s.n_allele   == o.n_allele
 *                         and  self.contig  == other.contig
 *                         and  self.alleles == other.alleles             # <<<<<<<<<<<<<<
 *                         and  self.id      == other.id
 *                         and  self.info    == other.info
*/
  __pyx_t_6 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_mstate_global->__pyx_n_u_alleles); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 3362, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_6);
  __pyx_t_5 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_other), __pyx_mstate_global->__pyx_n_u_alleles); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 3362, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_5);
  __pyx_t_4 = PyObject_RichCompare(__pyx_t_6, __pyx_t_5, Py_EQ); __Pyx_XGOTREF(__pyx_t_4); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 3362, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  __pyx_t_3 = __Pyx_PyObject_IsTrue(__pyx_t_4); if (unlikely((__pyx_t_3 < 0))) __PYX_ERR(0, 3362, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  if (__pyx_t_3) {
  } else {
    __pyx_t_1 = __pyx_t_3;
    goto __pyx_L4_bool_binop_done;
  }

  /* "pysam/libcbcf.pyx":3363
 *                         and  self.contig  == other.contig
 *                         and  self.alleles == other.alleles
 *                         and  self.id      == other.id             # <<<<<<<<<<<<<<
 *                         and  self.info    == other.info
 *                         and  self.filter  == other.filter
*/
  __pyx_t_4 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_mstate_global->__pyx_n_u_id); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 3363, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  __pyx_t_5 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_other), __pyx_mstate_global->__pyx_n_u_id); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 3363, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_5);
  __pyx_t_6 = PyObject_RichCompare(__pyx_t_4, __pyx_t_5, Py_EQ); __Pyx_XGOTREF(__pyx_t_6); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 3363, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  __pyx_t_3 = __Pyx_PyObject_IsTrue(__pyx_t_6); if (unlikely((__pyx_t_3 < 0))) __PYX_ERR(0, 3363, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
  if (__pyx_t_3) {
  } else {
    __pyx_t_1 = __pyx_t_3;
    goto __pyx_L4_bool_binop_done;
  }

  /* "pysam/libcbcf.pyx":3364
 *                         and  self.alleles == other.alleles
 *                         and  self.id      == other.id
 *                         and  self.info    == other.info             # <<<<<<<<<<<<<<
 *                         and  self.filter  == other.filter
 *                         and  self.samples == other.samples)
*/
  __pyx_t_6 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_mstate_global->__pyx_n_u_info); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 3364, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_6);
  __pyx_t_5 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_other), __pyx_mstate_global->__pyx_n_u_info); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 3364, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_5);
  __pyx_t_4 = PyObject_RichCompare(__pyx_t_6, __pyx_t_5, Py_EQ); __Pyx_XGOTREF(__pyx_t_4); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 3364, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  __pyx_t_3 = __Pyx_PyObject_IsTrue(__pyx_t_4); if (unlikely((__pyx_t_3 < 0))) __PYX_ERR(0, 3364, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  if (__pyx_t_3) {
  } else {
    __pyx_t_1 = __pyx_t_3;
    goto __pyx_L4_bool_binop_done;
  }

  /* "pysam/libcbcf.pyx":3365
 *                         and  self.id      == other.id
 *                         and  self.info    == other.info
 *                         and  self.filter  == other.filter             # <<<<<<<<<<<<<<
 *                         and  self.samples == other.samples)
 * 
*/
  __pyx_t_4 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_mstate_global->__pyx_n_u_filter); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 3365, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  __pyx_t_5 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_other), __pyx_mstate_global->__pyx_n_u_filter); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 3365, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_5);
  __pyx_t_6 = PyObject_RichCompare(__pyx_t_4, __pyx_t_5, Py_EQ); __Pyx_XGOTREF(__pyx_t_6); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 3365, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  __pyx_t_3 = __Pyx_PyObject_IsTrue(__pyx_t_6); if (unlikely((__pyx_t_3 < 0))) __PYX_ERR(0, 3365, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
  if (__pyx_t_3) {
  } else {
    __pyx_t_1 = __pyx_t_3;
    goto __pyx_L4_bool_binop_done;
  }

  /* "pysam/libcbcf.pyx":3366
 *                         and  self.info    == other.info
 *                         and  self.filter  == other.filter
 *                         and  self.samples == other.samples)             # <<<<<<<<<<<<<<
 * 
 *         if op == 3:
*/
  __pyx_t_6 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_mstate_global->__pyx_n_u_samples); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 3366, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_6);
  __pyx_t_5 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_other), __pyx_mstate_global->__pyx_n_u_samples); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 3366, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_5);
  __pyx_t_4 = PyObject_RichCompare(__pyx_t_6, __pyx_t_5, Py_EQ); __Pyx_XGOTREF(__pyx_t_4); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 3366, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  __pyx_t_3 = __Pyx_PyObject_IsTrue(__pyx_t_4); if (unlikely((__pyx_t_3 < 0))) __PYX_ERR(0, 3366, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  __pyx_t_1 = __pyx_t_3;
  __pyx_L4_bool_binop_done:;
  __pyx_v_cmp = __pyx_t_1;

  /* "pysam/libcbcf.pyx":3368
 *                         and  self.samples == other.samples)
 * 
 *         if op == 3:             # <<<<<<<<<<<<<<
 *             cmp = not cmp
 * 
*/
  __pyx_t_1 = (__pyx_v_op == 3);
  if (__pyx_t_1) {

    /* "pysam/libcbcf.pyx":3369
 * 
 *         if op == 3:
 *             cmp = not cmp             # <<<<<<<<<<<<<<
 * 
 *         return cmp
*/
    __pyx_v_cmp = (!__pyx_v_cmp);

    /* "pysam/libcbcf.pyx":3368
 *                         and  self.samples == other.samples)
 * 
 *         if op == 3:             # <<<<<<<<<<<<<<
 *             cmp = not cmp
 * 
*/
  }

  /* "pysam/libcbcf.pyx":3371
 *             cmp = not cmp
 * 
 *         return cmp             # <<<<<<<<<<<<<<
 * 
 *     def __str__(self):
*/
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_4 = __Pyx_PyBool_FromLong(__pyx_v_cmp); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 3371, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  __pyx_r = __pyx_t_4;
  __pyx_t_4 = 0;
  __Pyx_TraceReturnValue(__pyx_r, 104, 0, __PYX_ERR(0, 3371, __pyx_L1_error));
  goto __pyx_L0;

  /* "pysam/libcbcf.pyx":3347
 *             return result
 * 
 *     def __richcmp__(VariantRecord self not None, VariantRecord other not None, int op):             # <<<<<<<<<<<<<<
 *         if op != 2 and op != 3:
 *             return NotImplemented
*/

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_XDECREF(__pyx_t_5);
  __Pyx_XDECREF(__pyx_t_6);
  __Pyx_TraceException(__pyx_lineno, 0, 0);
  #if CYTHON_USE_SYS_MONITORING
  __Pyx_TraceExceptionUnwind(0, 0);
  #else
  __Pyx_TraceReturnValue(NULL, 0, 0, __PYX_ERR(0, 3347, __pyx_L1_error));
  #endif
  __Pyx_AddTraceback("pysam.libcbcf.VariantRecord.__richcmp__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_PyMonitoring_ExitScope(0);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "pysam/libcbcf.pyx":3373
 *         return cmp
 * 
 *     def __str__(self):             # <<<<<<<<<<<<<<
 *         cdef kstring_t line
 *         cdef char c
*/

/* Python wrapper */
static PyObject *__pyx_pw_5pysam_7libcbcf_13VariantRecord_11__str__(PyObject *__pyx_v_self); /*proto*/
static PyObject *__pyx_pw_5pysam_7libcbcf_13VariantRecord_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_5pysam_7libcbcf_13VariantRecord_10__str__(((struct __pyx_obj_5pysam_7libcbcf_VariantRecord *)__pyx_v_self));

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

static PyObject *__pyx_pf_5pysam_7libcbcf_13VariantRecord_10__str__(struct __pyx_obj_5pysam_7libcbcf_VariantRecord *__pyx_v_self) {
  kstring_t __pyx_v_line;
  PyObject *__pyx_v_ret = NULL;
  PyObject *__pyx_r = NULL;
  __Pyx_TraceDeclarationsFunc
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  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_TraceFrameInit(((PyObject *)__pyx_mstate_global->__pyx_codeobj_tab[280]))
  __Pyx_RefNannySetupContext("__str__", 0);
  __Pyx_TraceStartFunc("__str__", __pyx_f[0], 3373, 0, 0, 0, __PYX_ERR(0, 3373, __pyx_L1_error));

  /* "pysam/libcbcf.pyx":3377
 *         cdef char c
 * 
 *         line.l = line.m = 0             # <<<<<<<<<<<<<<
 *         line.s = NULL
 * 
*/
  __pyx_v_line.l = 0;
  __pyx_v_line.m = 0;

  /* "pysam/libcbcf.pyx":3378
 * 
 *         line.l = line.m = 0
 *         line.s = NULL             # <<<<<<<<<<<<<<
 * 
 *         if vcf_format(self.header.ptr, self.ptr, &line) < 0:
*/
  __pyx_v_line.s = NULL;

  /* "pysam/libcbcf.pyx":3380
 *         line.s = NULL
 * 
 *         if vcf_format(self.header.ptr, self.ptr, &line) < 0:             # <<<<<<<<<<<<<<
 *             if line.m:
 *                 free(line.s)
*/
  __pyx_t_1 = (vcf_format(__pyx_v_self->header->ptr, __pyx_v_self->ptr, (&__pyx_v_line)) < 0);
  if (__pyx_t_1) {

    /* "pysam/libcbcf.pyx":3381
 * 
 *         if vcf_format(self.header.ptr, self.ptr, &line) < 0:
 *             if line.m:             # <<<<<<<<<<<<<<
 *                 free(line.s)
 *             raise ValueError('vcf_format failed')
*/
    __pyx_t_1 = (__pyx_v_line.m != 0);
    if (__pyx_t_1) {

      /* "pysam/libcbcf.pyx":3382
 *         if vcf_format(self.header.ptr, self.ptr, &line) < 0:
 *             if line.m:
 *                 free(line.s)             # <<<<<<<<<<<<<<
 *             raise ValueError('vcf_format failed')
 * 
*/
      free(__pyx_v_line.s);

      /* "pysam/libcbcf.pyx":3381
 * 
 *         if vcf_format(self.header.ptr, self.ptr, &line) < 0:
 *             if line.m:             # <<<<<<<<<<<<<<
 *                 free(line.s)
 *             raise ValueError('vcf_format failed')
*/
    }

    /* "pysam/libcbcf.pyx":3383
 *             if line.m:
 *                 free(line.s)
 *             raise ValueError('vcf_format failed')             # <<<<<<<<<<<<<<
 * 
 *         # Strip CR/LF?
*/
    __pyx_t_3 = NULL;
    __Pyx_INCREF(__pyx_builtin_ValueError);
    __pyx_t_4 = __pyx_builtin_ValueError; 
    __pyx_t_5 = 1;
    {
      PyObject *__pyx_callargs[2] = {__pyx_t_3, __pyx_mstate_global->__pyx_kp_u_vcf_format_failed};
      __pyx_t_2 = __Pyx_PyObject_FastCall(__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_2)) __PYX_ERR(0, 3383, __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, 3383, __pyx_L1_error)

    /* "pysam/libcbcf.pyx":3380
 *         line.s = NULL
 * 
 *         if vcf_format(self.header.ptr, self.ptr, &line) < 0:             # <<<<<<<<<<<<<<
 *             if line.m:
 *                 free(line.s)
*/
  }

  /* "pysam/libcbcf.pyx":3392
 *         #    line.l -= 1
 * 
 *         ret = charptr_to_str_w_len(line.s, line.l)             # <<<<<<<<<<<<<<
 * 
 *         if line.m:
*/
  __pyx_t_2 = __pyx_f_5pysam_9libcutils_charptr_to_str_w_len(__pyx_v_line.s, __pyx_v_line.l, NULL); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 3392, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_v_ret = __pyx_t_2;
  __pyx_t_2 = 0;

  /* "pysam/libcbcf.pyx":3394
 *         ret = charptr_to_str_w_len(line.s, line.l)
 * 
 *         if line.m:             # <<<<<<<<<<<<<<
 *             free(line.s)
 * 
*/
  __pyx_t_1 = (__pyx_v_line.m != 0);
  if (__pyx_t_1) {

    /* "pysam/libcbcf.pyx":3395
 * 
 *         if line.m:
 *             free(line.s)             # <<<<<<<<<<<<<<
 * 
 *         return ret
*/
    free(__pyx_v_line.s);

    /* "pysam/libcbcf.pyx":3394
 *         ret = charptr_to_str_w_len(line.s, line.l)
 * 
 *         if line.m:             # <<<<<<<<<<<<<<
 *             free(line.s)
 * 
*/
  }

  /* "pysam/libcbcf.pyx":3397
 *             free(line.s)
 * 
 *         return ret             # <<<<<<<<<<<<<<
 * 
 * 
*/
  __Pyx_XDECREF(__pyx_r);
  __Pyx_INCREF(__pyx_v_ret);
  __pyx_r = __pyx_v_ret;
  __Pyx_TraceReturnValue(__pyx_r, 46, 0, __PYX_ERR(0, 3397, __pyx_L1_error));
  goto __pyx_L0;

  /* "pysam/libcbcf.pyx":3373
 *         return cmp
 * 
 *     def __str__(self):             # <<<<<<<<<<<<<<
 *         cdef kstring_t line
 *         cdef char c
*/

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_TraceException(__pyx_lineno, 0, 0);
  #if CYTHON_USE_SYS_MONITORING
  __Pyx_TraceExceptionUnwind(0, 0);
  #else
  __Pyx_TraceReturnValue(NULL, 0, 0, __PYX_ERR(0, 3373, __pyx_L1_error));
  #endif
  __Pyx_AddTraceback("pysam.libcbcf.VariantRecord.__str__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_ret);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_PyMonitoring_ExitScope(0);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "pysam/libcbcf.pxd":81
 * 
 * cdef class VariantRecord(object):
 *     cdef readonly VariantHeader header             # <<<<<<<<<<<<<<
 *     cdef bcf1_t *ptr
 * 
*/

/* Python wrapper */
static PyObject *__pyx_pw_5pysam_7libcbcf_13VariantRecord_6header_1__get__(PyObject *__pyx_v_self); /*proto*/
static PyObject *__pyx_pw_5pysam_7libcbcf_13VariantRecord_6header_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_5pysam_7libcbcf_13VariantRecord_6header___get__(((struct __pyx_obj_5pysam_7libcbcf_VariantRecord *)__pyx_v_self));

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

static PyObject *__pyx_pf_5pysam_7libcbcf_13VariantRecord_6header___get__(struct __pyx_obj_5pysam_7libcbcf_VariantRecord *__pyx_v_self) {
  PyObject *__pyx_r = NULL;
  __Pyx_TraceDeclarationsFunc
  __Pyx_RefNannyDeclarations
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_TraceFrameInit(((PyObject *)__pyx_mstate_global->__pyx_codeobj_tab[281]))
  __Pyx_RefNannySetupContext("__get__", 0);
  __Pyx_TraceStartFunc("__get__", __pyx_f[3], 81, 0, 0, 0, __PYX_ERR(3, 81, __pyx_L1_error));
  __Pyx_XDECREF(__pyx_r);
  __Pyx_INCREF((PyObject *)__pyx_v_self->header);
  __pyx_r = ((PyObject *)__pyx_v_self->header);
  __Pyx_TraceReturnValue(__pyx_r, 0, 0, __PYX_ERR(3, 81, __pyx_L1_error));
  goto __pyx_L0;

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_TraceException(__pyx_lineno, 0, 0);
  #if CYTHON_USE_SYS_MONITORING
  __Pyx_TraceExceptionUnwind(0, 0);
  #else
  __Pyx_TraceReturnValue(NULL, 0, 0, __PYX_ERR(3, 81, __pyx_L1_error));
  #endif
  __Pyx_AddTraceback("pysam.libcbcf.VariantRecord.header.__get__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_PyMonitoring_ExitScope(0);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "(tree fragment)":1
 * def __reduce_cython__(self):             # <<<<<<<<<<<<<<
 *     raise TypeError, "self.ptr cannot be converted to a Python object for pickling"
 * def __setstate_cython__(self, __pyx_state):
*/

/* Python wrapper */
static PyObject *__pyx_pw_5pysam_7libcbcf_13VariantRecord_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*/
PyDoc_STRVAR(__pyx_doc_5pysam_7libcbcf_13VariantRecord_12__reduce_cython__, "VariantRecord.__reduce_cython__(self)");
static PyMethodDef __pyx_mdef_5pysam_7libcbcf_13VariantRecord_13__reduce_cython__ = {"__reduce_cython__", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_5pysam_7libcbcf_13VariantRecord_13__reduce_cython__, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_5pysam_7libcbcf_13VariantRecord_12__reduce_cython__};
static PyObject *__pyx_pw_5pysam_7libcbcf_13VariantRecord_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_5pysam_7libcbcf_13VariantRecord_12__reduce_cython__(((struct __pyx_obj_5pysam_7libcbcf_VariantRecord *)__pyx_v_self));

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

static PyObject *__pyx_pf_5pysam_7libcbcf_13VariantRecord_12__reduce_cython__(CYTHON_UNUSED struct __pyx_obj_5pysam_7libcbcf_VariantRecord *__pyx_v_self) {
  PyObject *__pyx_r = NULL;
  __Pyx_TraceDeclarationsFunc
  __Pyx_RefNannyDeclarations
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_TraceFrameInit(((PyObject *)__pyx_mstate_global->__pyx_codeobj_tab[282]))
  __Pyx_RefNannySetupContext("__reduce_cython__", 0);
  __Pyx_TraceStartFunc("__reduce_cython__", __pyx_f[4], 1, 0, 0, 0, __PYX_ERR(4, 1, __pyx_L1_error));

  /* "(tree fragment)":2
 * def __reduce_cython__(self):
 *     raise TypeError, "self.ptr cannot be converted to a Python object for pickling"             # <<<<<<<<<<<<<<
 * def __setstate_cython__(self, __pyx_state):
 *     raise TypeError, "self.ptr cannot be converted to a Python object for pickling"
*/
  __Pyx_Raise(__pyx_builtin_TypeError, __pyx_mstate_global->__pyx_kp_u_self_ptr_cannot_be_converted_to, 0, 0);
  __PYX_ERR(4, 2, __pyx_L1_error)

  /* "(tree fragment)":1
 * def __reduce_cython__(self):             # <<<<<<<<<<<<<<
 *     raise TypeError, "self.ptr cannot be converted to a Python object for pickling"
 * def __setstate_cython__(self, __pyx_state):
*/

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_TraceException(__pyx_lineno, 0, 0);
  #if CYTHON_USE_SYS_MONITORING
  __Pyx_TraceExceptionUnwind(0, 0);
  #else
  __Pyx_TraceReturnValue(NULL, 0, 0, __PYX_ERR(4, 1, __pyx_L1_error));
  #endif
  __Pyx_AddTraceback("pysam.libcbcf.VariantRecord.__reduce_cython__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_PyMonitoring_ExitScope(0);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "(tree fragment)":3
 * def __reduce_cython__(self):
 *     raise TypeError, "self.ptr cannot be converted to a Python object for pickling"
 * def __setstate_cython__(self, __pyx_state):             # <<<<<<<<<<<<<<
 *     raise TypeError, "self.ptr cannot be converted to a Python object for pickling"
*/

/* Python wrapper */
static PyObject *__pyx_pw_5pysam_7libcbcf_13VariantRecord_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*/
PyDoc_STRVAR(__pyx_doc_5pysam_7libcbcf_13VariantRecord_14__setstate_cython__, "VariantRecord.__setstate_cython__(self, __pyx_state)");
static PyMethodDef __pyx_mdef_5pysam_7libcbcf_13VariantRecord_15__setstate_cython__ = {"__setstate_cython__", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_5pysam_7libcbcf_13VariantRecord_15__setstate_cython__, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_5pysam_7libcbcf_13VariantRecord_14__setstate_cython__};
static PyObject *__pyx_pw_5pysam_7libcbcf_13VariantRecord_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(4, 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(4, 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(4, 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(4, 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(4, 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(4, 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("pysam.libcbcf.VariantRecord.__setstate_cython__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_5pysam_7libcbcf_13VariantRecord_14__setstate_cython__(((struct __pyx_obj_5pysam_7libcbcf_VariantRecord *)__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_5pysam_7libcbcf_13VariantRecord_14__setstate_cython__(CYTHON_UNUSED struct __pyx_obj_5pysam_7libcbcf_VariantRecord *__pyx_v_self, CYTHON_UNUSED PyObject *__pyx_v___pyx_state) {
  PyObject *__pyx_r = NULL;
  __Pyx_TraceDeclarationsFunc
  __Pyx_RefNannyDeclarations
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_TraceFrameInit(((PyObject *)__pyx_mstate_global->__pyx_codeobj_tab[283]))
  __Pyx_RefNannySetupContext("__setstate_cython__", 0);
  __Pyx_TraceStartFunc("__setstate_cython__", __pyx_f[4], 3, 0, 0, 0, __PYX_ERR(4, 3, __pyx_L1_error));

  /* "(tree fragment)":4
 *     raise TypeError, "self.ptr cannot be converted to a Python object for pickling"
 * def __setstate_cython__(self, __pyx_state):
 *     raise TypeError, "self.ptr cannot be converted to a Python object for pickling"             # <<<<<<<<<<<<<<
*/
  __Pyx_Raise(__pyx_builtin_TypeError, __pyx_mstate_global->__pyx_kp_u_self_ptr_cannot_be_converted_to, 0, 0);
  __PYX_ERR(4, 4, __pyx_L1_error)

  /* "(tree fragment)":3
 * def __reduce_cython__(self):
 *     raise TypeError, "self.ptr cannot be converted to a Python object for pickling"
 * def __setstate_cython__(self, __pyx_state):             # <<<<<<<<<<<<<<
 *     raise TypeError, "self.ptr cannot be converted to a Python object for pickling"
*/

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_TraceException(__pyx_lineno, 0, 0);
  #if CYTHON_USE_SYS_MONITORING
  __Pyx_TraceExceptionUnwind(0, 0);
  #else
  __Pyx_TraceReturnValue(NULL, 0, 0, __PYX_ERR(4, 3, __pyx_L1_error));
  #endif
  __Pyx_AddTraceback("pysam.libcbcf.VariantRecord.__setstate_cython__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_PyMonitoring_ExitScope(0);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "pysam/libcbcf.pyx":3400
 * 
 * 
 * cdef VariantRecord makeVariantRecord(VariantHeader header, bcf1_t *r):             # <<<<<<<<<<<<<<
 *     if not header:
 *         raise ValueError('invalid VariantHeader')
*/

static struct __pyx_obj_5pysam_7libcbcf_VariantRecord *__pyx_f_5pysam_7libcbcf_makeVariantRecord(struct __pyx_obj_5pysam_7libcbcf_VariantHeader *__pyx_v_header, bcf1_t *__pyx_v_r) {
  PyObject *__pyx_v_msg = NULL;
  struct __pyx_obj_5pysam_7libcbcf_VariantRecord *__pyx_v_record = 0;
  struct __pyx_obj_5pysam_7libcbcf_VariantRecord *__pyx_r = NULL;
  __Pyx_TraceDeclarationsFunc
  __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_t_7;
  PyObject *__pyx_t_8 = NULL;
  PyObject *__pyx_t_9 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_TraceFrameInit(((PyObject *)__pyx_mstate_global->__pyx_codeobj_tab[284]))
  __Pyx_RefNannySetupContext("makeVariantRecord", 0);
  __Pyx_TraceStartFunc("makeVariantRecord", __pyx_f[0], 3400, 0, 0, 0, __PYX_ERR(0, 3400, __pyx_L1_error));

  /* "pysam/libcbcf.pyx":3401
 * 
 * cdef VariantRecord makeVariantRecord(VariantHeader header, bcf1_t *r):
 *     if not header:             # <<<<<<<<<<<<<<
 *         raise ValueError('invalid VariantHeader')
 * 
*/
  __pyx_t_1 = __Pyx_PyObject_IsTrue(((PyObject *)__pyx_v_header)); if (unlikely((__pyx_t_1 < 0))) __PYX_ERR(0, 3401, __pyx_L1_error)
  __pyx_t_2 = (!__pyx_t_1);
  if (unlikely(__pyx_t_2)) {

    /* "pysam/libcbcf.pyx":3402
 * cdef VariantRecord makeVariantRecord(VariantHeader header, bcf1_t *r):
 *     if not header:
 *         raise ValueError('invalid VariantHeader')             # <<<<<<<<<<<<<<
 * 
 *     if not r:
*/
    __pyx_t_4 = NULL;
    __Pyx_INCREF(__pyx_builtin_ValueError);
    __pyx_t_5 = __pyx_builtin_ValueError; 
    __pyx_t_6 = 1;
    {
      PyObject *__pyx_callargs[2] = {__pyx_t_4, __pyx_mstate_global->__pyx_kp_u_invalid_VariantHeader};
      __pyx_t_3 = __Pyx_PyObject_FastCall(__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, 3402, __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, 3402, __pyx_L1_error)

    /* "pysam/libcbcf.pyx":3401
 * 
 * cdef VariantRecord makeVariantRecord(VariantHeader header, bcf1_t *r):
 *     if not header:             # <<<<<<<<<<<<<<
 *         raise ValueError('invalid VariantHeader')
 * 
*/
  }

  /* "pysam/libcbcf.pyx":3404
 *         raise ValueError('invalid VariantHeader')
 * 
 *     if not r:             # <<<<<<<<<<<<<<
 *         raise ValueError('cannot create VariantRecord')
 * 
*/
  __pyx_t_2 = (!(__pyx_v_r != 0));
  if (unlikely(__pyx_t_2)) {

    /* "pysam/libcbcf.pyx":3405
 * 
 *     if not r:
 *         raise ValueError('cannot create VariantRecord')             # <<<<<<<<<<<<<<
 * 
 *     if r.errcode:
*/
    __pyx_t_5 = NULL;
    __Pyx_INCREF(__pyx_builtin_ValueError);
    __pyx_t_4 = __pyx_builtin_ValueError; 
    __pyx_t_6 = 1;
    {
      PyObject *__pyx_callargs[2] = {__pyx_t_5, __pyx_mstate_global->__pyx_kp_u_cannot_create_VariantRecord};
      __pyx_t_3 = __Pyx_PyObject_FastCall(__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_3)) __PYX_ERR(0, 3405, __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, 3405, __pyx_L1_error)

    /* "pysam/libcbcf.pyx":3404
 *         raise ValueError('invalid VariantHeader')
 * 
 *     if not r:             # <<<<<<<<<<<<<<
 *         raise ValueError('cannot create VariantRecord')
 * 
*/
  }

  /* "pysam/libcbcf.pyx":3407
 *         raise ValueError('cannot create VariantRecord')
 * 
 *     if r.errcode:             # <<<<<<<<<<<<<<
 *         msg = []
 *         #if r.errcode & BCF_ERR_CTG_UNDEF:
*/
  __pyx_t_2 = (__pyx_v_r->errcode != 0);
  if (__pyx_t_2) {

    /* "pysam/libcbcf.pyx":3408
 * 
 *     if r.errcode:
 *         msg = []             # <<<<<<<<<<<<<<
 *         #if r.errcode & BCF_ERR_CTG_UNDEF:
 *         #    msg.append('undefined contig')
*/
    __pyx_t_3 = PyList_New(0); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 3408, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __pyx_v_msg = __pyx_t_3;
    __pyx_t_3 = 0;

    /* "pysam/libcbcf.pyx":3413
 *         #if r.errcode & BCF_ERR_TAG_UNDEF:
 *         #    msg.append('undefined tag')
 *         if r.errcode & BCF_ERR_NCOLS:             # <<<<<<<<<<<<<<
 *             msg.append('invalid number of columns')
 *         if r.errcode & BCF_ERR_LIMITS:
*/
    __pyx_t_2 = ((__pyx_v_r->errcode & BCF_ERR_NCOLS) != 0);
    if (__pyx_t_2) {

      /* "pysam/libcbcf.pyx":3414
 *         #    msg.append('undefined tag')
 *         if r.errcode & BCF_ERR_NCOLS:
 *             msg.append('invalid number of columns')             # <<<<<<<<<<<<<<
 *         if r.errcode & BCF_ERR_LIMITS:
 *             msg.append('limits violated')
*/
      __pyx_t_7 = __Pyx_PyObject_Append(__pyx_v_msg, __pyx_mstate_global->__pyx_kp_u_invalid_number_of_columns); if (unlikely(__pyx_t_7 == ((int)-1))) __PYX_ERR(0, 3414, __pyx_L1_error)

      /* "pysam/libcbcf.pyx":3413
 *         #if r.errcode & BCF_ERR_TAG_UNDEF:
 *         #    msg.append('undefined tag')
 *         if r.errcode & BCF_ERR_NCOLS:             # <<<<<<<<<<<<<<
 *             msg.append('invalid number of columns')
 *         if r.errcode & BCF_ERR_LIMITS:
*/
    }

    /* "pysam/libcbcf.pyx":3415
 *         if r.errcode & BCF_ERR_NCOLS:
 *             msg.append('invalid number of columns')
 *         if r.errcode & BCF_ERR_LIMITS:             # <<<<<<<<<<<<<<
 *             msg.append('limits violated')
 *         if r.errcode & BCF_ERR_CHAR:
*/
    __pyx_t_2 = ((__pyx_v_r->errcode & BCF_ERR_LIMITS) != 0);
    if (__pyx_t_2) {

      /* "pysam/libcbcf.pyx":3416
 *             msg.append('invalid number of columns')
 *         if r.errcode & BCF_ERR_LIMITS:
 *             msg.append('limits violated')             # <<<<<<<<<<<<<<
 *         if r.errcode & BCF_ERR_CHAR:
 *             msg.append('invalid character found')
*/
      __pyx_t_7 = __Pyx_PyObject_Append(__pyx_v_msg, __pyx_mstate_global->__pyx_kp_u_limits_violated); if (unlikely(__pyx_t_7 == ((int)-1))) __PYX_ERR(0, 3416, __pyx_L1_error)

      /* "pysam/libcbcf.pyx":3415
 *         if r.errcode & BCF_ERR_NCOLS:
 *             msg.append('invalid number of columns')
 *         if r.errcode & BCF_ERR_LIMITS:             # <<<<<<<<<<<<<<
 *             msg.append('limits violated')
 *         if r.errcode & BCF_ERR_CHAR:
*/
    }

    /* "pysam/libcbcf.pyx":3417
 *         if r.errcode & BCF_ERR_LIMITS:
 *             msg.append('limits violated')
 *         if r.errcode & BCF_ERR_CHAR:             # <<<<<<<<<<<<<<
 *             msg.append('invalid character found')
 *         if r.errcode & BCF_ERR_CTG_INVALID:
*/
    __pyx_t_2 = ((__pyx_v_r->errcode & BCF_ERR_CHAR) != 0);
    if (__pyx_t_2) {

      /* "pysam/libcbcf.pyx":3418
 *             msg.append('limits violated')
 *         if r.errcode & BCF_ERR_CHAR:
 *             msg.append('invalid character found')             # <<<<<<<<<<<<<<
 *         if r.errcode & BCF_ERR_CTG_INVALID:
 *             msg.append('invalid contig')
*/
      __pyx_t_7 = __Pyx_PyObject_Append(__pyx_v_msg, __pyx_mstate_global->__pyx_kp_u_invalid_character_found); if (unlikely(__pyx_t_7 == ((int)-1))) __PYX_ERR(0, 3418, __pyx_L1_error)

      /* "pysam/libcbcf.pyx":3417
 *         if r.errcode & BCF_ERR_LIMITS:
 *             msg.append('limits violated')
 *         if r.errcode & BCF_ERR_CHAR:             # <<<<<<<<<<<<<<
 *             msg.append('invalid character found')
 *         if r.errcode & BCF_ERR_CTG_INVALID:
*/
    }

    /* "pysam/libcbcf.pyx":3419
 *         if r.errcode & BCF_ERR_CHAR:
 *             msg.append('invalid character found')
 *         if r.errcode & BCF_ERR_CTG_INVALID:             # <<<<<<<<<<<<<<
 *             msg.append('invalid contig')
 *         if r.errcode & BCF_ERR_TAG_INVALID:
*/
    __pyx_t_2 = ((__pyx_v_r->errcode & BCF_ERR_CTG_INVALID) != 0);
    if (__pyx_t_2) {

      /* "pysam/libcbcf.pyx":3420
 *             msg.append('invalid character found')
 *         if r.errcode & BCF_ERR_CTG_INVALID:
 *             msg.append('invalid contig')             # <<<<<<<<<<<<<<
 *         if r.errcode & BCF_ERR_TAG_INVALID:
 *             msg.append('invalid tag')
*/
      __pyx_t_7 = __Pyx_PyObject_Append(__pyx_v_msg, __pyx_mstate_global->__pyx_kp_u_invalid_contig_2); if (unlikely(__pyx_t_7 == ((int)-1))) __PYX_ERR(0, 3420, __pyx_L1_error)

      /* "pysam/libcbcf.pyx":3419
 *         if r.errcode & BCF_ERR_CHAR:
 *             msg.append('invalid character found')
 *         if r.errcode & BCF_ERR_CTG_INVALID:             # <<<<<<<<<<<<<<
 *             msg.append('invalid contig')
 *         if r.errcode & BCF_ERR_TAG_INVALID:
*/
    }

    /* "pysam/libcbcf.pyx":3421
 *         if r.errcode & BCF_ERR_CTG_INVALID:
 *             msg.append('invalid contig')
 *         if r.errcode & BCF_ERR_TAG_INVALID:             # <<<<<<<<<<<<<<
 *             msg.append('invalid tag')
 * 
*/
    __pyx_t_2 = ((__pyx_v_r->errcode & BCF_ERR_TAG_INVALID) != 0);
    if (__pyx_t_2) {

      /* "pysam/libcbcf.pyx":3422
 *             msg.append('invalid contig')
 *         if r.errcode & BCF_ERR_TAG_INVALID:
 *             msg.append('invalid tag')             # <<<<<<<<<<<<<<
 * 
 *         if msg:
*/
      __pyx_t_7 = __Pyx_PyObject_Append(__pyx_v_msg, __pyx_mstate_global->__pyx_kp_u_invalid_tag); if (unlikely(__pyx_t_7 == ((int)-1))) __PYX_ERR(0, 3422, __pyx_L1_error)

      /* "pysam/libcbcf.pyx":3421
 *         if r.errcode & BCF_ERR_CTG_INVALID:
 *             msg.append('invalid contig')
 *         if r.errcode & BCF_ERR_TAG_INVALID:             # <<<<<<<<<<<<<<
 *             msg.append('invalid tag')
 * 
*/
    }

    /* "pysam/libcbcf.pyx":3424
 *             msg.append('invalid tag')
 * 
 *         if msg:             # <<<<<<<<<<<<<<
 *             msg = ', '.join(msg)
 *             raise ValueError('Error(s) reading record: {}'.format(msg))
*/
    __pyx_t_2 = __Pyx_PyObject_IsTrue(__pyx_v_msg); if (unlikely((__pyx_t_2 < 0))) __PYX_ERR(0, 3424, __pyx_L1_error)
    if (unlikely(__pyx_t_2)) {

      /* "pysam/libcbcf.pyx":3425
 * 
 *         if msg:
 *             msg = ', '.join(msg)             # <<<<<<<<<<<<<<
 *             raise ValueError('Error(s) reading record: {}'.format(msg))
 * 
*/
      __pyx_t_3 = PyUnicode_Join(__pyx_mstate_global->__pyx_kp_u__8, __pyx_v_msg); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 3425, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_3);
      __Pyx_DECREF_SET(__pyx_v_msg, __pyx_t_3);
      __pyx_t_3 = 0;

      /* "pysam/libcbcf.pyx":3426
 *         if msg:
 *             msg = ', '.join(msg)
 *             raise ValueError('Error(s) reading record: {}'.format(msg))             # <<<<<<<<<<<<<<
 * 
 *     cdef VariantRecord record = VariantRecord.__new__(VariantRecord)
*/
      __pyx_t_4 = NULL;
      __Pyx_INCREF(__pyx_builtin_ValueError);
      __pyx_t_5 = __pyx_builtin_ValueError; 
      __pyx_t_9 = __pyx_mstate_global->__pyx_kp_u_Error_s_reading_record;
      __Pyx_INCREF(__pyx_t_9);
      __pyx_t_6 = 0;
      {
        PyObject *__pyx_callargs[2] = {__pyx_t_9, __pyx_v_msg};
        __pyx_t_8 = __Pyx_PyObject_FastCallMethod(__pyx_mstate_global->__pyx_n_u_format, __pyx_callargs+__pyx_t_6, (2-__pyx_t_6) | (1*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
        __Pyx_XDECREF(__pyx_t_9); __pyx_t_9 = 0;
        if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 3426, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_8);
      }
      __pyx_t_6 = 1;
      {
        PyObject *__pyx_callargs[2] = {__pyx_t_4, __pyx_t_8};
        __pyx_t_3 = __Pyx_PyObject_FastCall(__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_8); __pyx_t_8 = 0;
        __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
        if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 3426, __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, 3426, __pyx_L1_error)

      /* "pysam/libcbcf.pyx":3424
 *             msg.append('invalid tag')
 * 
 *         if msg:             # <<<<<<<<<<<<<<
 *             msg = ', '.join(msg)
 *             raise ValueError('Error(s) reading record: {}'.format(msg))
*/
    }

    /* "pysam/libcbcf.pyx":3407
 *         raise ValueError('cannot create VariantRecord')
 * 
 *     if r.errcode:             # <<<<<<<<<<<<<<
 *         msg = []
 *         #if r.errcode & BCF_ERR_CTG_UNDEF:
*/
  }

  /* "pysam/libcbcf.pyx":3428
 *             raise ValueError('Error(s) reading record: {}'.format(msg))
 * 
 *     cdef VariantRecord record = VariantRecord.__new__(VariantRecord)             # <<<<<<<<<<<<<<
 *     record.header = header
 *     record.ptr = r
*/
  __pyx_t_3 = ((PyObject *)__pyx_tp_new_5pysam_7libcbcf_VariantRecord(((PyTypeObject *)__pyx_mstate_global->__pyx_ptype_5pysam_7libcbcf_VariantRecord), __pyx_mstate_global->__pyx_empty_tuple, NULL)); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 3428, __pyx_L1_error)
  __Pyx_GOTREF((PyObject *)__pyx_t_3);
  __pyx_v_record = ((struct __pyx_obj_5pysam_7libcbcf_VariantRecord *)__pyx_t_3);
  __pyx_t_3 = 0;

  /* "pysam/libcbcf.pyx":3429
 * 
 *     cdef VariantRecord record = VariantRecord.__new__(VariantRecord)
 *     record.header = header             # <<<<<<<<<<<<<<
 *     record.ptr = r
 * 
*/
  __Pyx_INCREF((PyObject *)__pyx_v_header);
  __Pyx_GIVEREF((PyObject *)__pyx_v_header);
  __Pyx_GOTREF((PyObject *)__pyx_v_record->header);
  __Pyx_DECREF((PyObject *)__pyx_v_record->header);
  __pyx_v_record->header = __pyx_v_header;

  /* "pysam/libcbcf.pyx":3430
 *     cdef VariantRecord record = VariantRecord.__new__(VariantRecord)
 *     record.header = header
 *     record.ptr = r             # <<<<<<<<<<<<<<
 * 
 *     return record
*/
  __pyx_v_record->ptr = __pyx_v_r;

  /* "pysam/libcbcf.pyx":3432
 *     record.ptr = r
 * 
 *     return record             # <<<<<<<<<<<<<<
 * 
 * 
*/
  __Pyx_XDECREF((PyObject *)__pyx_r);
  __Pyx_INCREF((PyObject *)__pyx_v_record);
  __pyx_r = __pyx_v_record;
  __Pyx_TraceReturnValue((PyObject *)__pyx_r, 90, 0, __PYX_ERR(0, 3432, __pyx_L1_error));
  goto __pyx_L0;

  /* "pysam/libcbcf.pyx":3400
 * 
 * 
 * cdef VariantRecord makeVariantRecord(VariantHeader header, bcf1_t *r):             # <<<<<<<<<<<<<<
 *     if not header:
 *         raise ValueError('invalid VariantHeader')
*/

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_XDECREF(__pyx_t_5);
  __Pyx_XDECREF(__pyx_t_8);
  __Pyx_XDECREF(__pyx_t_9);
  __Pyx_TraceException(__pyx_lineno, 0, 0);
  #if CYTHON_USE_SYS_MONITORING
  __Pyx_TraceExceptionUnwind(0, 0);
  #else
  __Pyx_TraceReturnValue(NULL, 0, 0, __PYX_ERR(0, 3400, __pyx_L1_error));
  #endif
  __Pyx_AddTraceback("pysam.libcbcf.makeVariantRecord", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_msg);
  __Pyx_XDECREF((PyObject *)__pyx_v_record);
  __Pyx_XGIVEREF((PyObject *)__pyx_r);
  __Pyx_PyMonitoring_ExitScope(0);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "pysam/libcbcf.pyx":3446
 *        from format name to values.
 *     """
 *     def __init__(self, *args, **kwargs):             # <<<<<<<<<<<<<<
 *         raise TypeError('this class cannot be instantiated from Python')
 * 
*/

/* Python wrapper */
static int __pyx_pw_5pysam_7libcbcf_19VariantRecordSample_1__init__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static int __pyx_pw_5pysam_7libcbcf_19VariantRecordSample_1__init__(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("__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);
  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("__init__", __pyx_kwds) == -1)) return -1;
  }
  __Pyx_INCREF(__pyx_args);
  __pyx_v_args = __pyx_args;
  __pyx_r = __pyx_pf_5pysam_7libcbcf_19VariantRecordSample___init__(((struct __pyx_obj_5pysam_7libcbcf_VariantRecordSample *)__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_5pysam_7libcbcf_19VariantRecordSample___init__(CYTHON_UNUSED struct __pyx_obj_5pysam_7libcbcf_VariantRecordSample *__pyx_v_self, CYTHON_UNUSED PyObject *__pyx_v_args, CYTHON_UNUSED PyObject *__pyx_v_kwargs) {
  int __pyx_r;
  __Pyx_TraceDeclarationsFunc
  __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_TraceFrameInit(((PyObject *)__pyx_mstate_global->__pyx_codeobj_tab[285]))
  __Pyx_RefNannySetupContext("__init__", 0);
  __Pyx_TraceStartFunc("__init__", __pyx_f[0], 3446, 0, 0, 0, __PYX_ERR(0, 3446, __pyx_L1_error));

  /* "pysam/libcbcf.pyx":3447
 *     """
 *     def __init__(self, *args, **kwargs):
 *         raise TypeError('this class cannot be instantiated from Python')             # <<<<<<<<<<<<<<
 * 
 *     @property
*/
  __pyx_t_2 = NULL;
  __Pyx_INCREF(__pyx_builtin_TypeError);
  __pyx_t_3 = __pyx_builtin_TypeError; 
  __pyx_t_4 = 1;
  {
    PyObject *__pyx_callargs[2] = {__pyx_t_2, __pyx_mstate_global->__pyx_kp_u_this_class_cannot_be_instantiate};
    __pyx_t_1 = __Pyx_PyObject_FastCall(__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, 3447, __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, 3447, __pyx_L1_error)

  /* "pysam/libcbcf.pyx":3446
 *        from format name to values.
 *     """
 *     def __init__(self, *args, **kwargs):             # <<<<<<<<<<<<<<
 *         raise TypeError('this class cannot be instantiated from Python')
 * 
*/

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_TraceException(__pyx_lineno, 0, 0);
  #if CYTHON_USE_SYS_MONITORING
  __Pyx_TraceExceptionUnwind(0, 0);
  #else
  __Pyx_TraceReturnValue(NULL, 0, 0, __PYX_ERR(0, 3446, __pyx_L1_error));
  #endif
  __Pyx_AddTraceback("pysam.libcbcf.VariantRecordSample.__init__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = -1;
  __Pyx_PyMonitoring_ExitScope(0);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "pysam/libcbcf.pyx":3449
 *         raise TypeError('this class cannot be instantiated from Python')
 * 
 *     @property             # <<<<<<<<<<<<<<
 *     def name(self):
 *         """sample name"""
*/

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

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

static PyObject *__pyx_pf_5pysam_7libcbcf_19VariantRecordSample_4name___get__(struct __pyx_obj_5pysam_7libcbcf_VariantRecordSample *__pyx_v_self) {
  bcf_hdr_t *__pyx_v_hdr;
  bcf1_t *__pyx_v_r;
  int32_t __pyx_v_n;
  PyObject *__pyx_r = NULL;
  __Pyx_TraceDeclarationsFunc
  __Pyx_RefNannyDeclarations
  bcf_hdr_t *__pyx_t_1;
  bcf1_t *__pyx_t_2;
  uint32_t __pyx_t_3;
  int __pyx_t_4;
  int __pyx_t_5;
  PyObject *__pyx_t_6 = NULL;
  PyObject *__pyx_t_7 = NULL;
  PyObject *__pyx_t_8 = NULL;
  size_t __pyx_t_9;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_TraceFrameInit(((PyObject *)__pyx_mstate_global->__pyx_codeobj_tab[286]))
  __Pyx_RefNannySetupContext("__get__", 0);
  __Pyx_TraceStartFunc("__get__", __pyx_f[0], 3449, 0, 0, 0, __PYX_ERR(0, 3449, __pyx_L1_error));

  /* "pysam/libcbcf.pyx":3452
 *     def name(self):
 *         """sample name"""
 *         cdef bcf_hdr_t *hdr = self.record.header.ptr             # <<<<<<<<<<<<<<
 *         cdef bcf1_t *r = self.record.ptr
 *         cdef int32_t n = r.n_sample
*/
  __pyx_t_1 = __pyx_v_self->record->header->ptr;
  __pyx_v_hdr = __pyx_t_1;

  /* "pysam/libcbcf.pyx":3453
 *         """sample name"""
 *         cdef bcf_hdr_t *hdr = self.record.header.ptr
 *         cdef bcf1_t *r = self.record.ptr             # <<<<<<<<<<<<<<
 *         cdef int32_t n = r.n_sample
 * 
*/
  __pyx_t_2 = __pyx_v_self->record->ptr;
  __pyx_v_r = __pyx_t_2;

  /* "pysam/libcbcf.pyx":3454
 *         cdef bcf_hdr_t *hdr = self.record.header.ptr
 *         cdef bcf1_t *r = self.record.ptr
 *         cdef int32_t n = r.n_sample             # <<<<<<<<<<<<<<
 * 
 *         if self.index < 0 or self.index >= n:
*/
  __pyx_t_3 = __pyx_v_r->n_sample;
  __pyx_v_n = __pyx_t_3;

  /* "pysam/libcbcf.pyx":3456
 *         cdef int32_t n = r.n_sample
 * 
 *         if self.index < 0 or self.index >= n:             # <<<<<<<<<<<<<<
 *             raise ValueError('invalid sample index')
 * 
*/
  __pyx_t_5 = (__pyx_v_self->index < 0);
  if (!__pyx_t_5) {
  } else {
    __pyx_t_4 = __pyx_t_5;
    goto __pyx_L4_bool_binop_done;
  }
  __pyx_t_5 = (__pyx_v_self->index >= __pyx_v_n);
  __pyx_t_4 = __pyx_t_5;
  __pyx_L4_bool_binop_done:;
  if (unlikely(__pyx_t_4)) {

    /* "pysam/libcbcf.pyx":3457
 * 
 *         if self.index < 0 or self.index >= n:
 *             raise ValueError('invalid sample index')             # <<<<<<<<<<<<<<
 * 
 *         return charptr_to_str(hdr.samples[self.index])
*/
    __pyx_t_7 = NULL;
    __Pyx_INCREF(__pyx_builtin_ValueError);
    __pyx_t_8 = __pyx_builtin_ValueError; 
    __pyx_t_9 = 1;
    {
      PyObject *__pyx_callargs[2] = {__pyx_t_7, __pyx_mstate_global->__pyx_kp_u_invalid_sample_index};
      __pyx_t_6 = __Pyx_PyObject_FastCall(__pyx_t_8, __pyx_callargs+__pyx_t_9, (2-__pyx_t_9) | (__pyx_t_9*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
      __Pyx_XDECREF(__pyx_t_7); __pyx_t_7 = 0;
      __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
      if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 3457, __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, 3457, __pyx_L1_error)

    /* "pysam/libcbcf.pyx":3456
 *         cdef int32_t n = r.n_sample
 * 
 *         if self.index < 0 or self.index >= n:             # <<<<<<<<<<<<<<
 *             raise ValueError('invalid sample index')
 * 
*/
  }

  /* "pysam/libcbcf.pyx":3459
 *             raise ValueError('invalid sample index')
 * 
 *         return charptr_to_str(hdr.samples[self.index])             # <<<<<<<<<<<<<<
 * 
 *     @property
*/
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_6 = __pyx_f_5pysam_9libcutils_charptr_to_str((__pyx_v_hdr->samples[__pyx_v_self->index]), NULL); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 3459, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_6);
  __pyx_r = __pyx_t_6;
  __pyx_t_6 = 0;
  __Pyx_TraceReturnValue(__pyx_r, 27, 0, __PYX_ERR(0, 3459, __pyx_L1_error));
  goto __pyx_L0;

  /* "pysam/libcbcf.pyx":3449
 *         raise TypeError('this class cannot be instantiated from Python')
 * 
 *     @property             # <<<<<<<<<<<<<<
 *     def name(self):
 *         """sample name"""
*/

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_6);
  __Pyx_XDECREF(__pyx_t_7);
  __Pyx_XDECREF(__pyx_t_8);
  __Pyx_TraceException(__pyx_lineno, 0, 0);
  #if CYTHON_USE_SYS_MONITORING
  __Pyx_TraceExceptionUnwind(0, 0);
  #else
  __Pyx_TraceReturnValue(NULL, 0, 0, __PYX_ERR(0, 3449, __pyx_L1_error));
  #endif
  __Pyx_AddTraceback("pysam.libcbcf.VariantRecordSample.name.__get__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_PyMonitoring_ExitScope(0);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "pysam/libcbcf.pyx":3461
 *         return charptr_to_str(hdr.samples[self.index])
 * 
 *     @property             # <<<<<<<<<<<<<<
 *     def allele_indices(self):
 *         """allele indices for called genotype, if present.  Otherwise None"""
*/

/* Python wrapper */
static PyObject *__pyx_pw_5pysam_7libcbcf_19VariantRecordSample_14allele_indices_1__get__(PyObject *__pyx_v_self); /*proto*/
static PyObject *__pyx_pw_5pysam_7libcbcf_19VariantRecordSample_14allele_indices_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_5pysam_7libcbcf_19VariantRecordSample_14allele_indices___get__(((struct __pyx_obj_5pysam_7libcbcf_VariantRecordSample *)__pyx_v_self));

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

static PyObject *__pyx_pf_5pysam_7libcbcf_19VariantRecordSample_14allele_indices___get__(struct __pyx_obj_5pysam_7libcbcf_VariantRecordSample *__pyx_v_self) {
  PyObject *__pyx_r = NULL;
  __Pyx_TraceDeclarationsFunc
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_TraceFrameInit(((PyObject *)__pyx_mstate_global->__pyx_codeobj_tab[287]))
  __Pyx_RefNannySetupContext("__get__", 0);
  __Pyx_TraceStartFunc("__get__", __pyx_f[0], 3461, 0, 0, 0, __PYX_ERR(0, 3461, __pyx_L1_error));

  /* "pysam/libcbcf.pyx":3464
 *     def allele_indices(self):
 *         """allele indices for called genotype, if present.  Otherwise None"""
 *         return bcf_format_get_allele_indices(self)             # <<<<<<<<<<<<<<
 * 
 *     @allele_indices.setter
*/
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = __pyx_f_5pysam_7libcbcf_bcf_format_get_allele_indices(__pyx_v_self); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 3464, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  __Pyx_TraceReturnValue(__pyx_r, 1, 0, __PYX_ERR(0, 3464, __pyx_L1_error));
  goto __pyx_L0;

  /* "pysam/libcbcf.pyx":3461
 *         return charptr_to_str(hdr.samples[self.index])
 * 
 *     @property             # <<<<<<<<<<<<<<
 *     def allele_indices(self):
 *         """allele indices for called genotype, if present.  Otherwise None"""
*/

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_TraceException(__pyx_lineno, 0, 0);
  #if CYTHON_USE_SYS_MONITORING
  __Pyx_TraceExceptionUnwind(0, 0);
  #else
  __Pyx_TraceReturnValue(NULL, 0, 0, __PYX_ERR(0, 3461, __pyx_L1_error));
  #endif
  __Pyx_AddTraceback("pysam.libcbcf.VariantRecordSample.allele_indices.__get__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_PyMonitoring_ExitScope(0);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "pysam/libcbcf.pyx":3466
 *         return bcf_format_get_allele_indices(self)
 * 
 *     @allele_indices.setter             # <<<<<<<<<<<<<<
 *     def allele_indices(self, value):
 *         self['GT'] = value
*/

/* Python wrapper */
static int __pyx_pw_5pysam_7libcbcf_19VariantRecordSample_14allele_indices_3__set__(PyObject *__pyx_v_self, PyObject *__pyx_v_value); /*proto*/
static int __pyx_pw_5pysam_7libcbcf_19VariantRecordSample_14allele_indices_3__set__(PyObject *__pyx_v_self, PyObject *__pyx_v_value) {
  CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__set__ (wrapper)", 0);
  __pyx_kwvalues = __Pyx_KwValues_VARARGS(__pyx_args, __pyx_nargs);
  __pyx_r = __pyx_pf_5pysam_7libcbcf_19VariantRecordSample_14allele_indices_2__set__(((struct __pyx_obj_5pysam_7libcbcf_VariantRecordSample *)__pyx_v_self), ((PyObject *)__pyx_v_value));

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

static int __pyx_pf_5pysam_7libcbcf_19VariantRecordSample_14allele_indices_2__set__(struct __pyx_obj_5pysam_7libcbcf_VariantRecordSample *__pyx_v_self, PyObject *__pyx_v_value) {
  int __pyx_r;
  __Pyx_TraceDeclarationsFunc
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_TraceFrameInit(((PyObject *)__pyx_mstate_global->__pyx_codeobj_tab[288]))
  __Pyx_TraceStartFunc("__set__", __pyx_f[0], 3466, 0, 0, 0, __PYX_ERR(0, 3466, __pyx_L1_error));

  /* "pysam/libcbcf.pyx":3468
 *     @allele_indices.setter
 *     def allele_indices(self, value):
 *         self['GT'] = value             # <<<<<<<<<<<<<<
 * 
 *     @allele_indices.deleter
*/
  if (unlikely((PyObject_SetItem(((PyObject *)__pyx_v_self), __pyx_mstate_global->__pyx_n_u_GT, __pyx_v_value) < 0))) __PYX_ERR(0, 3468, __pyx_L1_error)

  /* "pysam/libcbcf.pyx":3466
 *         return bcf_format_get_allele_indices(self)
 * 
 *     @allele_indices.setter             # <<<<<<<<<<<<<<
 *     def allele_indices(self, value):
 *         self['GT'] = value
*/

  /* function exit code */
  __pyx_r = 0;
  __Pyx_TraceReturnCValue(__pyx_r, __Pyx_Owned_Py_None, 0, 0, __PYX_ERR(0, 3466, __pyx_L1_error));
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_TraceException(__pyx_lineno, 0, 0);
  #if CYTHON_USE_SYS_MONITORING
  __Pyx_TraceExceptionUnwind(0, 0);
  #else
  __Pyx_TraceReturnValue(NULL, 0, 0, __PYX_ERR(0, 3466, __pyx_L1_error));
  #endif
  __Pyx_AddTraceback("pysam.libcbcf.VariantRecordSample.allele_indices.__set__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = -1;
  __pyx_L0:;
  __Pyx_PyMonitoring_ExitScope(0);
  return __pyx_r;
}

/* "pysam/libcbcf.pyx":3470
 *         self['GT'] = value
 * 
 *     @allele_indices.deleter             # <<<<<<<<<<<<<<
 *     def allele_indices(self):
 *         self['GT'] = ()
*/

/* Python wrapper */
static int __pyx_pw_5pysam_7libcbcf_19VariantRecordSample_14allele_indices_5__del__(PyObject *__pyx_v_self); /*proto*/
static int __pyx_pw_5pysam_7libcbcf_19VariantRecordSample_14allele_indices_5__del__(PyObject *__pyx_v_self) {
  CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__del__ (wrapper)", 0);
  __pyx_kwvalues = __Pyx_KwValues_VARARGS(__pyx_args, __pyx_nargs);
  __pyx_r = __pyx_pf_5pysam_7libcbcf_19VariantRecordSample_14allele_indices_4__del__(((struct __pyx_obj_5pysam_7libcbcf_VariantRecordSample *)__pyx_v_self));

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

static int __pyx_pf_5pysam_7libcbcf_19VariantRecordSample_14allele_indices_4__del__(struct __pyx_obj_5pysam_7libcbcf_VariantRecordSample *__pyx_v_self) {
  int __pyx_r;
  __Pyx_TraceDeclarationsFunc
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_TraceFrameInit(((PyObject *)__pyx_mstate_global->__pyx_codeobj_tab[289]))
  __Pyx_TraceStartFunc("__del__", __pyx_f[0], 3470, 0, 0, 0, __PYX_ERR(0, 3470, __pyx_L1_error));

  /* "pysam/libcbcf.pyx":3472
 *     @allele_indices.deleter
 *     def allele_indices(self):
 *         self['GT'] = ()             # <<<<<<<<<<<<<<
 * 
 *     @property
*/
  if (unlikely((PyObject_SetItem(((PyObject *)__pyx_v_self), __pyx_mstate_global->__pyx_n_u_GT, __pyx_mstate_global->__pyx_empty_tuple) < 0))) __PYX_ERR(0, 3472, __pyx_L1_error)

  /* "pysam/libcbcf.pyx":3470
 *         self['GT'] = value
 * 
 *     @allele_indices.deleter             # <<<<<<<<<<<<<<
 *     def allele_indices(self):
 *         self['GT'] = ()
*/

  /* function exit code */
  __pyx_r = 0;
  __Pyx_TraceReturnCValue(__pyx_r, __Pyx_Owned_Py_None, 0, 0, __PYX_ERR(0, 3470, __pyx_L1_error));
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_TraceException(__pyx_lineno, 0, 0);
  #if CYTHON_USE_SYS_MONITORING
  __Pyx_TraceExceptionUnwind(0, 0);
  #else
  __Pyx_TraceReturnValue(NULL, 0, 0, __PYX_ERR(0, 3470, __pyx_L1_error));
  #endif
  __Pyx_AddTraceback("pysam.libcbcf.VariantRecordSample.allele_indices.__del__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = -1;
  __pyx_L0:;
  __Pyx_PyMonitoring_ExitScope(0);
  return __pyx_r;
}

/* "pysam/libcbcf.pyx":3474
 *         self['GT'] = ()
 * 
 *     @property             # <<<<<<<<<<<<<<
 *     def alleles(self):
 *         """alleles for called genotype, if present.  Otherwise None"""
*/

/* Python wrapper */
static PyObject *__pyx_pw_5pysam_7libcbcf_19VariantRecordSample_7alleles_1__get__(PyObject *__pyx_v_self); /*proto*/
static PyObject *__pyx_pw_5pysam_7libcbcf_19VariantRecordSample_7alleles_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_5pysam_7libcbcf_19VariantRecordSample_7alleles___get__(((struct __pyx_obj_5pysam_7libcbcf_VariantRecordSample *)__pyx_v_self));

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

static PyObject *__pyx_pf_5pysam_7libcbcf_19VariantRecordSample_7alleles___get__(struct __pyx_obj_5pysam_7libcbcf_VariantRecordSample *__pyx_v_self) {
  PyObject *__pyx_r = NULL;
  __Pyx_TraceDeclarationsFunc
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_TraceFrameInit(((PyObject *)__pyx_mstate_global->__pyx_codeobj_tab[290]))
  __Pyx_RefNannySetupContext("__get__", 0);
  __Pyx_TraceStartFunc("__get__", __pyx_f[0], 3474, 0, 0, 0, __PYX_ERR(0, 3474, __pyx_L1_error));

  /* "pysam/libcbcf.pyx":3477
 *     def alleles(self):
 *         """alleles for called genotype, if present.  Otherwise None"""
 *         return bcf_format_get_alleles(self)             # <<<<<<<<<<<<<<
 * 
 *     @alleles.setter
*/
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = __pyx_f_5pysam_7libcbcf_bcf_format_get_alleles(__pyx_v_self); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 3477, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  __Pyx_TraceReturnValue(__pyx_r, 1, 0, __PYX_ERR(0, 3477, __pyx_L1_error));
  goto __pyx_L0;

  /* "pysam/libcbcf.pyx":3474
 *         self['GT'] = ()
 * 
 *     @property             # <<<<<<<<<<<<<<
 *     def alleles(self):
 *         """alleles for called genotype, if present.  Otherwise None"""
*/

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_TraceException(__pyx_lineno, 0, 0);
  #if CYTHON_USE_SYS_MONITORING
  __Pyx_TraceExceptionUnwind(0, 0);
  #else
  __Pyx_TraceReturnValue(NULL, 0, 0, __PYX_ERR(0, 3474, __pyx_L1_error));
  #endif
  __Pyx_AddTraceback("pysam.libcbcf.VariantRecordSample.alleles.__get__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_PyMonitoring_ExitScope(0);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "pysam/libcbcf.pyx":3479
 *         return bcf_format_get_alleles(self)
 * 
 *     @alleles.setter             # <<<<<<<<<<<<<<
 *     def alleles(self, value):
 *         # Sets the genotype, supply a tuple of alleles to set.
*/

/* Python wrapper */
static int __pyx_pw_5pysam_7libcbcf_19VariantRecordSample_7alleles_3__set__(PyObject *__pyx_v_self, PyObject *__pyx_v_value); /*proto*/
static int __pyx_pw_5pysam_7libcbcf_19VariantRecordSample_7alleles_3__set__(PyObject *__pyx_v_self, PyObject *__pyx_v_value) {
  CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__set__ (wrapper)", 0);
  __pyx_kwvalues = __Pyx_KwValues_VARARGS(__pyx_args, __pyx_nargs);
  __pyx_r = __pyx_pf_5pysam_7libcbcf_19VariantRecordSample_7alleles_2__set__(((struct __pyx_obj_5pysam_7libcbcf_VariantRecordSample *)__pyx_v_self), ((PyObject *)__pyx_v_value));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}
static PyObject *__pyx_gb_5pysam_7libcbcf_19VariantRecordSample_7alleles_7__set___2generator33(__pyx_CoroutineObject *__pyx_generator, CYTHON_UNUSED PyThreadState *__pyx_tstate, PyObject *__pyx_sent_value); /* proto */

/* "pysam/libcbcf.pyx":3489
 *             return
 * 
 *         if any((type(x) == int for x in value)):             # <<<<<<<<<<<<<<
 *             raise ValueError('Use .allele_indices to set integer allele indices')
 * 
*/

static PyObject *__pyx_pf_5pysam_7libcbcf_19VariantRecordSample_7alleles_7__set___genexpr(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_genexpr_arg_0) {
  struct __pyx_obj_5pysam_7libcbcf___pyx_scope_struct_31_genexpr *__pyx_cur_scope;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("genexpr", 0);
  __pyx_cur_scope = (struct __pyx_obj_5pysam_7libcbcf___pyx_scope_struct_31_genexpr *)__pyx_tp_new_5pysam_7libcbcf___pyx_scope_struct_31_genexpr(__pyx_mstate_global->__pyx_ptype_5pysam_7libcbcf___pyx_scope_struct_31_genexpr, __pyx_mstate_global->__pyx_empty_tuple, NULL);
  if (unlikely(!__pyx_cur_scope)) {
    __pyx_cur_scope = ((struct __pyx_obj_5pysam_7libcbcf___pyx_scope_struct_31_genexpr *)Py_None);
    __Pyx_INCREF(Py_None);
    __PYX_ERR(0, 3489, __pyx_L1_error)
  } else {
    __Pyx_GOTREF((PyObject *)__pyx_cur_scope);
  }
  __pyx_cur_scope->__pyx_genexpr_arg_0 = __pyx_genexpr_arg_0;
  __Pyx_INCREF(__pyx_cur_scope->__pyx_genexpr_arg_0);
  __Pyx_GIVEREF(__pyx_cur_scope->__pyx_genexpr_arg_0);
  {
    __pyx_CoroutineObject *gen = __Pyx_Generator_New((__pyx_coroutine_body_t) __pyx_gb_5pysam_7libcbcf_19VariantRecordSample_7alleles_7__set___2generator33, ((PyObject *)__pyx_mstate_global->__pyx_codeobj_tab[291]), (PyObject *) __pyx_cur_scope, __pyx_mstate_global->__pyx_n_u_genexpr, __pyx_mstate_global->__pyx_n_u_VariantRecordSample___set___loca, __pyx_mstate_global->__pyx_n_u_pysam_libcbcf); if (unlikely(!gen)) __PYX_ERR(0, 3489, __pyx_L1_error)
    __Pyx_DECREF(__pyx_cur_scope);
    __Pyx_RefNannyFinishContext();
    return (PyObject *) gen;
  }

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_AddTraceback("pysam.libcbcf.VariantRecordSample.alleles.__set__.genexpr", __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_5pysam_7libcbcf_19VariantRecordSample_7alleles_7__set___2generator33(__pyx_CoroutineObject *__pyx_generator, CYTHON_UNUSED PyThreadState *__pyx_tstate, PyObject *__pyx_sent_value) /* generator body */
{
  struct __pyx_obj_5pysam_7libcbcf___pyx_scope_struct_31_genexpr *__pyx_cur_scope = ((struct __pyx_obj_5pysam_7libcbcf___pyx_scope_struct_31_genexpr *)__pyx_generator->closure);
  PyObject *__pyx_r = NULL;
  __Pyx_TraceDeclarationsGen
  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_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("genexpr", 0);
  switch (__pyx_generator->resume_label) {
    case 0: goto __pyx_L3_first_run;
    default: /* CPython raises the right error here */
    __Pyx_TraceStartGen("genexpr", __pyx_f[0], 3489, 0, 0, 0, __PYX_ERR(0, 3489, __pyx_L1_error));
    __Pyx_TraceReturnValue(Py_None, 0, 0, __PYX_ERR(0, 3489, __pyx_L1_error));
    __Pyx_RefNannyFinishContext();
    return NULL;
  }
  __pyx_L3_first_run:;
  __Pyx_TraceStartGen("genexpr", __pyx_f[0], 3489, 0, 0, 0, __PYX_ERR(0, 3489, __pyx_L1_error));
  if (unlikely(!__pyx_sent_value)) __PYX_ERR(0, 3489, __pyx_L1_error)
  if (unlikely(!__pyx_cur_scope->__pyx_genexpr_arg_0)) { __Pyx_RaiseUnboundLocalError(".0"); __PYX_ERR(0, 3489, __pyx_L1_error) }
  if (likely(PyList_CheckExact(__pyx_cur_scope->__pyx_genexpr_arg_0)) || PyTuple_CheckExact(__pyx_cur_scope->__pyx_genexpr_arg_0)) {
    __pyx_t_1 = __pyx_cur_scope->__pyx_genexpr_arg_0; __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_genexpr_arg_0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 3489, __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, 3489, __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, 3489, __pyx_L1_error)
          #endif
          if (__pyx_t_2 >= __pyx_temp) break;
        }
        __pyx_t_4 = __Pyx_PyList_GetItemRef(__pyx_t_1, __pyx_t_2);
        ++__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, 3489, __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, 3489, __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, 3489, __pyx_L1_error)
          PyErr_Clear();
        }
        break;
      }
    }
    __Pyx_GOTREF(__pyx_t_4);
    __Pyx_XGOTREF(__pyx_cur_scope->__pyx_v_x);
    __Pyx_XDECREF_SET(__pyx_cur_scope->__pyx_v_x, __pyx_t_4);
    __Pyx_GIVEREF(__pyx_t_4);
    __pyx_t_4 = 0;
    __pyx_t_4 = PyObject_RichCompare(((PyObject *)Py_TYPE(__pyx_cur_scope->__pyx_v_x)), ((PyObject *)(&PyLong_Type)), Py_EQ); __Pyx_XGOTREF(__pyx_t_4); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 3489, __pyx_L1_error)
    __pyx_t_5 = __Pyx_PyObject_IsTrue(__pyx_t_4); if (unlikely((__pyx_t_5 < 0))) __PYX_ERR(0, 3489, __pyx_L1_error)
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    if (__pyx_t_5) {
      __Pyx_XDECREF(__pyx_r);
      __Pyx_INCREF(Py_True);
      __pyx_r = Py_True;
      __Pyx_TraceReturnValue(__pyx_r, 0, 0, __PYX_ERR(0, 3489, __pyx_L1_error));
      __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
      goto __pyx_L0;
    }
  }
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  /*else*/ {
    __Pyx_XDECREF(__pyx_r);
    __Pyx_INCREF(Py_False);
    __pyx_r = Py_False;
    __Pyx_TraceReturnValue(__pyx_r, 0, 0, __PYX_ERR(0, 3489, __pyx_L1_error));
    goto __pyx_L0;
  }
  CYTHON_MAYBE_UNUSED_VAR(__pyx_cur_scope);
  __Pyx_TraceReturnValue(Py_None, 0, 0, __PYX_ERR(0, 3489, __pyx_L1_error));

  /* function exit code */
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_4);
  if (__Pyx_PyErr_Occurred()) {
    __Pyx_TraceException(__pyx_lineno, 0, 0);
    __Pyx_Generator_Replace_StopIteration(0);
    __Pyx_AddTraceback("genexpr", __pyx_clineno, __pyx_lineno, __pyx_filename);
    __Pyx_TraceExceptionUnwind(0, 0);
  }
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_PyMonitoring_ExitScope(0);
  #if !CYTHON_USE_EXC_INFO_STACK
  __Pyx_Coroutine_ResetAndClearException(__pyx_generator);
  #endif
  __pyx_generator->resume_label = -1;
  __Pyx_Coroutine_clear((PyObject*)__pyx_generator);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}
static PyObject *__pyx_gb_5pysam_7libcbcf_19VariantRecordSample_7alleles_7__set___5generator34(__pyx_CoroutineObject *__pyx_generator, CYTHON_UNUSED PyThreadState *__pyx_tstate, PyObject *__pyx_sent_value); /* proto */

/* "pysam/libcbcf.pyx":3494
 *         # determine and set allele indices:
 *         try:
 *             self['GT'] = tuple( (self.record.alleles.index(allele) for allele in value) )             # <<<<<<<<<<<<<<
 *         except ValueError:
 *             raise ValueError("One or more of the supplied sample alleles are not defined as alleles of the corresponding pysam.libcbcf.VariantRecord."
*/

static PyObject *__pyx_pf_5pysam_7libcbcf_19VariantRecordSample_7alleles_7__set___3genexpr(PyObject *__pyx_self, PyObject *__pyx_genexpr_arg_0) {
  struct __pyx_obj_5pysam_7libcbcf___pyx_scope_struct_32_genexpr *__pyx_cur_scope;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("genexpr", 0);
  __pyx_cur_scope = (struct __pyx_obj_5pysam_7libcbcf___pyx_scope_struct_32_genexpr *)__pyx_tp_new_5pysam_7libcbcf___pyx_scope_struct_32_genexpr(__pyx_mstate_global->__pyx_ptype_5pysam_7libcbcf___pyx_scope_struct_32_genexpr, __pyx_mstate_global->__pyx_empty_tuple, NULL);
  if (unlikely(!__pyx_cur_scope)) {
    __pyx_cur_scope = ((struct __pyx_obj_5pysam_7libcbcf___pyx_scope_struct_32_genexpr *)Py_None);
    __Pyx_INCREF(Py_None);
    __PYX_ERR(0, 3494, __pyx_L1_error)
  } else {
    __Pyx_GOTREF((PyObject *)__pyx_cur_scope);
  }
  __pyx_cur_scope->__pyx_outer_scope = (struct __pyx_obj_5pysam_7libcbcf___pyx_scope_struct_30___set__ *) __pyx_self;
  __Pyx_INCREF((PyObject *)__pyx_cur_scope->__pyx_outer_scope);
  __Pyx_GIVEREF((PyObject *)__pyx_cur_scope->__pyx_outer_scope);
  __pyx_cur_scope->__pyx_genexpr_arg_0 = __pyx_genexpr_arg_0;
  __Pyx_INCREF(__pyx_cur_scope->__pyx_genexpr_arg_0);
  __Pyx_GIVEREF(__pyx_cur_scope->__pyx_genexpr_arg_0);
  {
    __pyx_CoroutineObject *gen = __Pyx_Generator_New((__pyx_coroutine_body_t) __pyx_gb_5pysam_7libcbcf_19VariantRecordSample_7alleles_7__set___5generator34, ((PyObject *)__pyx_mstate_global->__pyx_codeobj_tab[292]), (PyObject *) __pyx_cur_scope, __pyx_mstate_global->__pyx_n_u_genexpr, __pyx_mstate_global->__pyx_n_u_VariantRecordSample___set___loca, __pyx_mstate_global->__pyx_n_u_pysam_libcbcf); if (unlikely(!gen)) __PYX_ERR(0, 3494, __pyx_L1_error)
    __Pyx_DECREF(__pyx_cur_scope);
    __Pyx_RefNannyFinishContext();
    return (PyObject *) gen;
  }

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_AddTraceback("pysam.libcbcf.VariantRecordSample.alleles.__set__.genexpr", __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_5pysam_7libcbcf_19VariantRecordSample_7alleles_7__set___5generator34(__pyx_CoroutineObject *__pyx_generator, CYTHON_UNUSED PyThreadState *__pyx_tstate, PyObject *__pyx_sent_value) /* generator body */
{
  struct __pyx_obj_5pysam_7libcbcf___pyx_scope_struct_32_genexpr *__pyx_cur_scope = ((struct __pyx_obj_5pysam_7libcbcf___pyx_scope_struct_32_genexpr *)__pyx_generator->closure);
  PyObject *__pyx_r = NULL;
  __Pyx_TraceDeclarationsGen
  PyObject *__pyx_t_1 = NULL;
  Py_ssize_t __pyx_t_2;
  PyObject *(*__pyx_t_3)(PyObject *);
  PyObject *__pyx_t_4 = NULL;
  PyObject *__pyx_t_5 = NULL;
  PyObject *__pyx_t_6 = NULL;
  size_t __pyx_t_7;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("genexpr", 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_TraceStartGen("genexpr", __pyx_f[0], 3494, 0, 0, 0, __PYX_ERR(0, 3494, __pyx_L1_error));
    __Pyx_TraceReturnValue(Py_None, 0, 0, __PYX_ERR(0, 3494, __pyx_L1_error));
    __Pyx_RefNannyFinishContext();
    return NULL;
  }
  __pyx_L3_first_run:;
  __Pyx_TraceStartGen("genexpr", __pyx_f[0], 3494, 0, 0, 0, __PYX_ERR(0, 3494, __pyx_L1_error));
  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, 3494, __pyx_L1_error)
  }
  if (unlikely(!__pyx_cur_scope->__pyx_genexpr_arg_0)) { __Pyx_RaiseUnboundLocalError(".0"); __PYX_ERR(0, 3494, __pyx_L1_error) }
  if (likely(PyList_CheckExact(__pyx_cur_scope->__pyx_genexpr_arg_0)) || PyTuple_CheckExact(__pyx_cur_scope->__pyx_genexpr_arg_0)) {
    __pyx_t_1 = __pyx_cur_scope->__pyx_genexpr_arg_0; __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_genexpr_arg_0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 3494, __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, 3494, __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, 3494, __pyx_L1_error)
          #endif
          if (__pyx_t_2 >= __pyx_temp) break;
        }
        __pyx_t_4 = __Pyx_PyList_GetItemRef(__pyx_t_1, __pyx_t_2);
        ++__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, 3494, __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, 3494, __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, 3494, __pyx_L1_error)
          PyErr_Clear();
        }
        break;
      }
    }
    __Pyx_GOTREF(__pyx_t_4);
    __Pyx_XGOTREF(__pyx_cur_scope->__pyx_v_allele);
    __Pyx_XDECREF_SET(__pyx_cur_scope->__pyx_v_allele, __pyx_t_4);
    __Pyx_GIVEREF(__pyx_t_4);
    __pyx_t_4 = 0;
    if (unlikely(!__pyx_cur_scope->__pyx_outer_scope->__pyx_v_self)) { __Pyx_RaiseClosureNameError("self"); __PYX_ERR(0, 3494, __pyx_L1_error) }
    __pyx_t_6 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_cur_scope->__pyx_outer_scope->__pyx_v_self->record), __pyx_mstate_global->__pyx_n_u_alleles); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 3494, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_6);
    __pyx_t_5 = __pyx_t_6;
    __Pyx_INCREF(__pyx_t_5);
    __pyx_t_7 = 0;
    {
      PyObject *__pyx_callargs[2] = {__pyx_t_5, __pyx_cur_scope->__pyx_v_allele};
      __pyx_t_4 = __Pyx_PyObject_FastCallMethod(__pyx_mstate_global->__pyx_n_u_index, __pyx_callargs+__pyx_t_7, (2-__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_4)) __PYX_ERR(0, 3494, __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_TraceYield(__pyx_r, 0, __PYX_ERR(0, 3494, __pyx_L1_error));
    __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_TraceResumeGen("genexpr", __pyx_f[0], 3494, 0, __PYX_ERR(0, 3494, __pyx_L1_error));
    __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, 3494, __pyx_L1_error)
  }
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  CYTHON_MAYBE_UNUSED_VAR(__pyx_cur_scope);
  __Pyx_TraceReturnValue(Py_None, 0, 0, __PYX_ERR(0, 3494, __pyx_L1_error));

  /* 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);
  if (__Pyx_PyErr_Occurred()) {
    __Pyx_TraceException(__pyx_lineno, 0, 0);
    __Pyx_Generator_Replace_StopIteration(0);
    __Pyx_AddTraceback("genexpr", __pyx_clineno, __pyx_lineno, __pyx_filename);
    __Pyx_TraceExceptionUnwind(0, 0);
  }
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_PyMonitoring_ExitScope(0);
  #if !CYTHON_USE_EXC_INFO_STACK
  __Pyx_Coroutine_ResetAndClearException(__pyx_generator);
  #endif
  __pyx_generator->resume_label = -1;
  __Pyx_Coroutine_clear((PyObject*)__pyx_generator);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "pysam/libcbcf.pyx":3479
 *         return bcf_format_get_alleles(self)
 * 
 *     @alleles.setter             # <<<<<<<<<<<<<<
 *     def alleles(self, value):
 *         # Sets the genotype, supply a tuple of alleles to set.
*/

static int __pyx_pf_5pysam_7libcbcf_19VariantRecordSample_7alleles_2__set__(struct __pyx_obj_5pysam_7libcbcf_VariantRecordSample *__pyx_v_self, PyObject *__pyx_v_value) {
  struct __pyx_obj_5pysam_7libcbcf___pyx_scope_struct_30___set__ *__pyx_cur_scope;
  PyObject *__pyx_gb_5pysam_7libcbcf_19VariantRecordSample_7alleles_7__set___2generator33 = 0;
  PyObject *__pyx_gb_5pysam_7libcbcf_19VariantRecordSample_7alleles_7__set___5generator34 = 0;
  int __pyx_r;
  __Pyx_TraceDeclarationsFunc
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  PyObject *__pyx_t_2 = NULL;
  int __pyx_t_3;
  PyObject *__pyx_t_4 = NULL;
  PyObject *__pyx_t_5 = NULL;
  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;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_TraceFrameInit(((PyObject *)__pyx_mstate_global->__pyx_codeobj_tab[293]))
  __Pyx_RefNannySetupContext("__set__", 0);
  __pyx_cur_scope = (struct __pyx_obj_5pysam_7libcbcf___pyx_scope_struct_30___set__ *)__pyx_tp_new_5pysam_7libcbcf___pyx_scope_struct_30___set__(__pyx_mstate_global->__pyx_ptype_5pysam_7libcbcf___pyx_scope_struct_30___set__, __pyx_mstate_global->__pyx_empty_tuple, NULL);
  if (unlikely(!__pyx_cur_scope)) {
    __pyx_cur_scope = ((struct __pyx_obj_5pysam_7libcbcf___pyx_scope_struct_30___set__ *)Py_None);
    __Pyx_INCREF(Py_None);
    __PYX_ERR(0, 3479, __pyx_L1_error)
  } else {
    __Pyx_GOTREF((PyObject *)__pyx_cur_scope);
  }
  __Pyx_TraceStartFunc("__set__", __pyx_f[0], 3479, 0, 0, 0, __PYX_ERR(0, 3479, __pyx_L1_error));
  __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);

  /* "pysam/libcbcf.pyx":3485
 *         # The genotype is reset when an empty tuple, None or (None,) is supplied
 * 
 *         if value==(None,) or value==tuple() or value is None:             # <<<<<<<<<<<<<<
 *             self['GT'] = ()
 *             return
*/
  __pyx_t_2 = PyObject_RichCompare(__pyx_v_value, __pyx_mstate_global->__pyx_tuple[0], Py_EQ); __Pyx_XGOTREF(__pyx_t_2); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 3485, __pyx_L1_error)
  __pyx_t_3 = __Pyx_PyObject_IsTrue(__pyx_t_2); if (unlikely((__pyx_t_3 < 0))) __PYX_ERR(0, 3485, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  if (!__pyx_t_3) {
  } else {
    __pyx_t_1 = __pyx_t_3;
    goto __pyx_L4_bool_binop_done;
  }
  __pyx_t_4 = NULL;
  __Pyx_INCREF((PyObject *)(&PyTuple_Type));
  __pyx_t_5 = ((PyObject *)(&PyTuple_Type)); 
  __pyx_t_6 = 1;
  {
    PyObject *__pyx_callargs[2] = {__pyx_t_4, NULL};
    __pyx_t_2 = __Pyx_PyObject_FastCall(__pyx_t_5, __pyx_callargs+__pyx_t_6, (1-__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_2)) __PYX_ERR(0, 3485, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
  }
  __pyx_t_5 = PyObject_RichCompare(__pyx_v_value, __pyx_t_2, Py_EQ); __Pyx_XGOTREF(__pyx_t_5); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 3485, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __pyx_t_3 = __Pyx_PyObject_IsTrue(__pyx_t_5); if (unlikely((__pyx_t_3 < 0))) __PYX_ERR(0, 3485, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  if (!__pyx_t_3) {
  } else {
    __pyx_t_1 = __pyx_t_3;
    goto __pyx_L4_bool_binop_done;
  }
  __pyx_t_3 = (__pyx_v_value == Py_None);
  __pyx_t_1 = __pyx_t_3;
  __pyx_L4_bool_binop_done:;
  if (__pyx_t_1) {

    /* "pysam/libcbcf.pyx":3486
 * 
 *         if value==(None,) or value==tuple() or value is None:
 *             self['GT'] = ()             # <<<<<<<<<<<<<<
 *             return
 * 
*/
    if (unlikely((PyObject_SetItem(((PyObject *)__pyx_cur_scope->__pyx_v_self), __pyx_mstate_global->__pyx_n_u_GT, __pyx_mstate_global->__pyx_empty_tuple) < 0))) __PYX_ERR(0, 3486, __pyx_L1_error)

    /* "pysam/libcbcf.pyx":3487
 *         if value==(None,) or value==tuple() or value is None:
 *             self['GT'] = ()
 *             return             # <<<<<<<<<<<<<<
 * 
 *         if any((type(x) == int for x in value)):
*/
    __pyx_r = 0;
    goto __pyx_L0;

    /* "pysam/libcbcf.pyx":3485
 *         # The genotype is reset when an empty tuple, None or (None,) is supplied
 * 
 *         if value==(None,) or value==tuple() or value is None:             # <<<<<<<<<<<<<<
 *             self['GT'] = ()
 *             return
*/
  }

  /* "pysam/libcbcf.pyx":3489
 *             return
 * 
 *         if any((type(x) == int for x in value)):             # <<<<<<<<<<<<<<
 *             raise ValueError('Use .allele_indices to set integer allele indices')
 * 
*/
  __pyx_t_5 = __pyx_pf_5pysam_7libcbcf_19VariantRecordSample_7alleles_7__set___genexpr(NULL, __pyx_v_value); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 3489, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_5);
  __pyx_t_2 = __Pyx_Generator_GetInlinedResult(__pyx_t_5); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 3489, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  __pyx_t_1 = __Pyx_PyObject_IsTrue(__pyx_t_2); if (unlikely((__pyx_t_1 < 0))) __PYX_ERR(0, 3489, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  if (unlikely(__pyx_t_1)) {

    /* "pysam/libcbcf.pyx":3490
 * 
 *         if any((type(x) == int for x in value)):
 *             raise ValueError('Use .allele_indices to set integer allele indices')             # <<<<<<<<<<<<<<
 * 
 *         # determine and set allele indices:
*/
    __pyx_t_5 = NULL;
    __Pyx_INCREF(__pyx_builtin_ValueError);
    __pyx_t_4 = __pyx_builtin_ValueError; 
    __pyx_t_6 = 1;
    {
      PyObject *__pyx_callargs[2] = {__pyx_t_5, __pyx_mstate_global->__pyx_kp_u_Use_allele_indices_to_set_intege};
      __pyx_t_2 = __Pyx_PyObject_FastCall(__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_2)) __PYX_ERR(0, 3490, __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, 3490, __pyx_L1_error)

    /* "pysam/libcbcf.pyx":3489
 *             return
 * 
 *         if any((type(x) == int for x in value)):             # <<<<<<<<<<<<<<
 *             raise ValueError('Use .allele_indices to set integer allele indices')
 * 
*/
  }

  /* "pysam/libcbcf.pyx":3493
 * 
 *         # determine and set allele indices:
 *         try:             # <<<<<<<<<<<<<<
 *             self['GT'] = tuple( (self.record.alleles.index(allele) for allele in value) )
 *         except ValueError:
*/
  {
    __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:*/ {

      /* "pysam/libcbcf.pyx":3494
 *         # determine and set allele indices:
 *         try:
 *             self['GT'] = tuple( (self.record.alleles.index(allele) for allele in value) )             # <<<<<<<<<<<<<<
 *         except ValueError:
 *             raise ValueError("One or more of the supplied sample alleles are not defined as alleles of the corresponding pysam.libcbcf.VariantRecord."
*/
      __pyx_t_2 = __pyx_pf_5pysam_7libcbcf_19VariantRecordSample_7alleles_7__set___3genexpr(((PyObject*)__pyx_cur_scope), __pyx_v_value); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 3494, __pyx_L8_error)
      __Pyx_GOTREF(__pyx_t_2);
      __pyx_t_4 = __Pyx_PySequence_Tuple(__pyx_t_2); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 3494, __pyx_L8_error)
      __Pyx_GOTREF(__pyx_t_4);
      __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
      if (unlikely((PyObject_SetItem(((PyObject *)__pyx_cur_scope->__pyx_v_self), __pyx_mstate_global->__pyx_n_u_GT, __pyx_t_4) < 0))) __PYX_ERR(0, 3494, __pyx_L8_error)
      __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;

      /* "pysam/libcbcf.pyx":3493
 * 
 *         # determine and set allele indices:
 *         try:             # <<<<<<<<<<<<<<
 *             self['GT'] = tuple( (self.record.alleles.index(allele) for allele in value) )
 *         except ValueError:
*/
    }
    __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_L13_try_end;
    __pyx_L8_error:;
    __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
    __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
    __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
    __Pyx_TraceException(__pyx_lineno, 0, 0);

    /* "pysam/libcbcf.pyx":3495
 *         try:
 *             self['GT'] = tuple( (self.record.alleles.index(allele) for allele in value) )
 *         except ValueError:             # <<<<<<<<<<<<<<
 *             raise ValueError("One or more of the supplied sample alleles are not defined as alleles of the corresponding pysam.libcbcf.VariantRecord."
 *                              "First set the .alleles of this record to define the alleles")
*/
    __pyx_t_10 = __Pyx_PyErr_ExceptionMatches(__pyx_builtin_ValueError);
    if (__pyx_t_10) {
      __Pyx_AddTraceback("pysam.libcbcf.VariantRecordSample.alleles.__set__", __pyx_clineno, __pyx_lineno, __pyx_filename);
      __Pyx_TraceExceptionHandled(0);
      if (__Pyx_GetException(&__pyx_t_4, &__pyx_t_2, &__pyx_t_5) < 0) __PYX_ERR(0, 3495, __pyx_L10_except_error)
      __Pyx_XGOTREF(__pyx_t_4);
      __Pyx_XGOTREF(__pyx_t_2);
      __Pyx_XGOTREF(__pyx_t_5);
      __Pyx_TraceExceptionDone();

      /* "pysam/libcbcf.pyx":3496
 *             self['GT'] = tuple( (self.record.alleles.index(allele) for allele in value) )
 *         except ValueError:
 *             raise ValueError("One or more of the supplied sample alleles are not defined as alleles of the corresponding pysam.libcbcf.VariantRecord."             # <<<<<<<<<<<<<<
 *                              "First set the .alleles of this record to define the alleles")
 * 
*/
      __pyx_t_12 = NULL;
      __Pyx_INCREF(__pyx_builtin_ValueError);
      __pyx_t_13 = __pyx_builtin_ValueError; 
      __pyx_t_6 = 1;
      {
        PyObject *__pyx_callargs[2] = {__pyx_t_12, __pyx_mstate_global->__pyx_kp_u_One_or_more_of_the_supplied_samp};
        __pyx_t_11 = __Pyx_PyObject_FastCall(__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, 3496, __pyx_L10_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, 3496, __pyx_L10_except_error)
    }
    goto __pyx_L10_except_error;

    /* "pysam/libcbcf.pyx":3493
 * 
 *         # determine and set allele indices:
 *         try:             # <<<<<<<<<<<<<<
 *             self['GT'] = tuple( (self.record.alleles.index(allele) for allele in value) )
 *         except ValueError:
*/
    __pyx_L10_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_L13_try_end:;
  }

  /* "pysam/libcbcf.pyx":3479
 *         return bcf_format_get_alleles(self)
 * 
 *     @alleles.setter             # <<<<<<<<<<<<<<
 *     def alleles(self, value):
 *         # Sets the genotype, supply a tuple of alleles to set.
*/

  /* function exit code */
  __pyx_r = 0;
  __Pyx_TraceReturnCValue(__pyx_r, __Pyx_Owned_Py_None, 0, 0, __PYX_ERR(0, 3479, __pyx_L1_error));
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_XDECREF(__pyx_t_5);
  __Pyx_XDECREF(__pyx_t_11);
  __Pyx_XDECREF(__pyx_t_12);
  __Pyx_XDECREF(__pyx_t_13);
  __Pyx_TraceException(__pyx_lineno, 0, 0);
  #if CYTHON_USE_SYS_MONITORING
  __Pyx_TraceExceptionUnwind(0, 0);
  #else
  __Pyx_TraceReturnValue(NULL, 0, 0, __PYX_ERR(0, 3479, __pyx_L1_error));
  #endif
  __Pyx_AddTraceback("pysam.libcbcf.VariantRecordSample.alleles.__set__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = -1;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_gb_5pysam_7libcbcf_19VariantRecordSample_7alleles_7__set___2generator33);
  __Pyx_XDECREF(__pyx_gb_5pysam_7libcbcf_19VariantRecordSample_7alleles_7__set___5generator34);
  __Pyx_DECREF((PyObject *)__pyx_cur_scope);
  __Pyx_PyMonitoring_ExitScope(0);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "pysam/libcbcf.pyx":3499
 *                              "First set the .alleles of this record to define the alleles")
 * 
 *     @alleles.deleter             # <<<<<<<<<<<<<<
 *     def alleles(self):
 *         self['GT'] = ()
*/

/* Python wrapper */
static int __pyx_pw_5pysam_7libcbcf_19VariantRecordSample_7alleles_5__del__(PyObject *__pyx_v_self); /*proto*/
static int __pyx_pw_5pysam_7libcbcf_19VariantRecordSample_7alleles_5__del__(PyObject *__pyx_v_self) {
  CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__del__ (wrapper)", 0);
  __pyx_kwvalues = __Pyx_KwValues_VARARGS(__pyx_args, __pyx_nargs);
  __pyx_r = __pyx_pf_5pysam_7libcbcf_19VariantRecordSample_7alleles_4__del__(((struct __pyx_obj_5pysam_7libcbcf_VariantRecordSample *)__pyx_v_self));

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

static int __pyx_pf_5pysam_7libcbcf_19VariantRecordSample_7alleles_4__del__(struct __pyx_obj_5pysam_7libcbcf_VariantRecordSample *__pyx_v_self) {
  int __pyx_r;
  __Pyx_TraceDeclarationsFunc
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_TraceFrameInit(((PyObject *)__pyx_mstate_global->__pyx_codeobj_tab[294]))
  __Pyx_TraceStartFunc("__del__", __pyx_f[0], 3499, 0, 0, 0, __PYX_ERR(0, 3499, __pyx_L1_error));

  /* "pysam/libcbcf.pyx":3501
 *     @alleles.deleter
 *     def alleles(self):
 *         self['GT'] = ()             # <<<<<<<<<<<<<<
 * 
 *     @property
*/
  if (unlikely((PyObject_SetItem(((PyObject *)__pyx_v_self), __pyx_mstate_global->__pyx_n_u_GT, __pyx_mstate_global->__pyx_empty_tuple) < 0))) __PYX_ERR(0, 3501, __pyx_L1_error)

  /* "pysam/libcbcf.pyx":3499
 *                              "First set the .alleles of this record to define the alleles")
 * 
 *     @alleles.deleter             # <<<<<<<<<<<<<<
 *     def alleles(self):
 *         self['GT'] = ()
*/

  /* function exit code */
  __pyx_r = 0;
  __Pyx_TraceReturnCValue(__pyx_r, __Pyx_Owned_Py_None, 0, 0, __PYX_ERR(0, 3499, __pyx_L1_error));
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_TraceException(__pyx_lineno, 0, 0);
  #if CYTHON_USE_SYS_MONITORING
  __Pyx_TraceExceptionUnwind(0, 0);
  #else
  __Pyx_TraceReturnValue(NULL, 0, 0, __PYX_ERR(0, 3499, __pyx_L1_error));
  #endif
  __Pyx_AddTraceback("pysam.libcbcf.VariantRecordSample.alleles.__del__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = -1;
  __pyx_L0:;
  __Pyx_PyMonitoring_ExitScope(0);
  return __pyx_r;
}

/* "pysam/libcbcf.pyx":3503
 *         self['GT'] = ()
 * 
 *     @property             # <<<<<<<<<<<<<<
 *     def phased(self):
 *         """False if genotype is missing or any allele is unphased.  Otherwise True."""
*/

/* Python wrapper */
static PyObject *__pyx_pw_5pysam_7libcbcf_19VariantRecordSample_6phased_1__get__(PyObject *__pyx_v_self); /*proto*/
static PyObject *__pyx_pw_5pysam_7libcbcf_19VariantRecordSample_6phased_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_5pysam_7libcbcf_19VariantRecordSample_6phased___get__(((struct __pyx_obj_5pysam_7libcbcf_VariantRecordSample *)__pyx_v_self));

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

static PyObject *__pyx_pf_5pysam_7libcbcf_19VariantRecordSample_6phased___get__(struct __pyx_obj_5pysam_7libcbcf_VariantRecordSample *__pyx_v_self) {
  PyObject *__pyx_r = NULL;
  __Pyx_TraceDeclarationsFunc
  __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_TraceFrameInit(((PyObject *)__pyx_mstate_global->__pyx_codeobj_tab[295]))
  __Pyx_RefNannySetupContext("__get__", 0);
  __Pyx_TraceStartFunc("__get__", __pyx_f[0], 3503, 0, 0, 0, __PYX_ERR(0, 3503, __pyx_L1_error));

  /* "pysam/libcbcf.pyx":3506
 *     def phased(self):
 *         """False if genotype is missing or any allele is unphased.  Otherwise True."""
 *         return bcf_sample_get_phased(self)             # <<<<<<<<<<<<<<
 * 
 *     @phased.setter
*/
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = __pyx_f_5pysam_7libcbcf_bcf_sample_get_phased(__pyx_v_self); if (unlikely(__pyx_t_1 == ((int)-1) && PyErr_Occurred())) __PYX_ERR(0, 3506, __pyx_L1_error)
  __pyx_t_2 = __Pyx_PyBool_FromLong(__pyx_t_1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 3506, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_r = __pyx_t_2;
  __pyx_t_2 = 0;
  __Pyx_TraceReturnValue(__pyx_r, 1, 0, __PYX_ERR(0, 3506, __pyx_L1_error));
  goto __pyx_L0;

  /* "pysam/libcbcf.pyx":3503
 *         self['GT'] = ()
 * 
 *     @property             # <<<<<<<<<<<<<<
 *     def phased(self):
 *         """False if genotype is missing or any allele is unphased.  Otherwise True."""
*/

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_TraceException(__pyx_lineno, 0, 0);
  #if CYTHON_USE_SYS_MONITORING
  __Pyx_TraceExceptionUnwind(0, 0);
  #else
  __Pyx_TraceReturnValue(NULL, 0, 0, __PYX_ERR(0, 3503, __pyx_L1_error));
  #endif
  __Pyx_AddTraceback("pysam.libcbcf.VariantRecordSample.phased.__get__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_PyMonitoring_ExitScope(0);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "pysam/libcbcf.pyx":3508
 *         return bcf_sample_get_phased(self)
 * 
 *     @phased.setter             # <<<<<<<<<<<<<<
 *     def phased(self, value):
 *         bcf_sample_set_phased(self, value)
*/

/* Python wrapper */
static int __pyx_pw_5pysam_7libcbcf_19VariantRecordSample_6phased_3__set__(PyObject *__pyx_v_self, PyObject *__pyx_v_value); /*proto*/
static int __pyx_pw_5pysam_7libcbcf_19VariantRecordSample_6phased_3__set__(PyObject *__pyx_v_self, PyObject *__pyx_v_value) {
  CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__set__ (wrapper)", 0);
  __pyx_kwvalues = __Pyx_KwValues_VARARGS(__pyx_args, __pyx_nargs);
  __pyx_r = __pyx_pf_5pysam_7libcbcf_19VariantRecordSample_6phased_2__set__(((struct __pyx_obj_5pysam_7libcbcf_VariantRecordSample *)__pyx_v_self), ((PyObject *)__pyx_v_value));

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

static int __pyx_pf_5pysam_7libcbcf_19VariantRecordSample_6phased_2__set__(struct __pyx_obj_5pysam_7libcbcf_VariantRecordSample *__pyx_v_self, PyObject *__pyx_v_value) {
  int __pyx_r;
  __Pyx_TraceDeclarationsFunc
  __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_TraceFrameInit(((PyObject *)__pyx_mstate_global->__pyx_codeobj_tab[296]))
  __Pyx_RefNannySetupContext("__set__", 0);
  __Pyx_TraceStartFunc("__set__", __pyx_f[0], 3508, 0, 0, 0, __PYX_ERR(0, 3508, __pyx_L1_error));

  /* "pysam/libcbcf.pyx":3510
 *     @phased.setter
 *     def phased(self, value):
 *         bcf_sample_set_phased(self, value)             # <<<<<<<<<<<<<<
 * 
 *     def __len__(self):
*/
  __pyx_t_1 = __Pyx_PyObject_IsTrue(__pyx_v_value); if (unlikely((__pyx_t_1 == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 3510, __pyx_L1_error)
  __pyx_t_2 = __pyx_f_5pysam_7libcbcf_bcf_sample_set_phased(__pyx_v_self, __pyx_t_1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 3510, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

  /* "pysam/libcbcf.pyx":3508
 *         return bcf_sample_get_phased(self)
 * 
 *     @phased.setter             # <<<<<<<<<<<<<<
 *     def phased(self, value):
 *         bcf_sample_set_phased(self, value)
*/

  /* function exit code */
  __pyx_r = 0;
  __Pyx_TraceReturnCValue(__pyx_r, __Pyx_Owned_Py_None, 0, 0, __PYX_ERR(0, 3508, __pyx_L1_error));
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_TraceException(__pyx_lineno, 0, 0);
  #if CYTHON_USE_SYS_MONITORING
  __Pyx_TraceExceptionUnwind(0, 0);
  #else
  __Pyx_TraceReturnValue(NULL, 0, 0, __PYX_ERR(0, 3508, __pyx_L1_error));
  #endif
  __Pyx_AddTraceback("pysam.libcbcf.VariantRecordSample.phased.__set__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = -1;
  __pyx_L0:;
  __Pyx_PyMonitoring_ExitScope(0);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "pysam/libcbcf.pyx":3512
 *         bcf_sample_set_phased(self, value)
 * 
 *     def __len__(self):             # <<<<<<<<<<<<<<
 *         cdef bcf_hdr_t *hdr = self.record.header.ptr
 *         cdef bcf1_t *r = self.record.ptr
*/

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

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

static Py_ssize_t __pyx_pf_5pysam_7libcbcf_19VariantRecordSample_2__len__(struct __pyx_obj_5pysam_7libcbcf_VariantRecordSample *__pyx_v_self) {
  CYTHON_UNUSED bcf_hdr_t *__pyx_v_hdr;
  bcf1_t *__pyx_v_r;
  int __pyx_v_i;
  int __pyx_v_n;
  Py_ssize_t __pyx_r;
  __Pyx_TraceDeclarationsFunc
  __Pyx_RefNannyDeclarations
  bcf_hdr_t *__pyx_t_1;
  bcf1_t *__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;
  uint32_t __pyx_t_8;
  uint32_t __pyx_t_9;
  int __pyx_t_10;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_TraceFrameInit(((PyObject *)__pyx_mstate_global->__pyx_codeobj_tab[297]))
  __Pyx_RefNannySetupContext("__len__", 0);
  __Pyx_TraceStartFunc("__len__", __pyx_f[0], 3512, 0, 0, 0, __PYX_ERR(0, 3512, __pyx_L1_error));

  /* "pysam/libcbcf.pyx":3513
 * 
 *     def __len__(self):
 *         cdef bcf_hdr_t *hdr = self.record.header.ptr             # <<<<<<<<<<<<<<
 *         cdef bcf1_t *r = self.record.ptr
 *         cdef int i, n = 0
*/
  __pyx_t_1 = __pyx_v_self->record->header->ptr;
  __pyx_v_hdr = __pyx_t_1;

  /* "pysam/libcbcf.pyx":3514
 *     def __len__(self):
 *         cdef bcf_hdr_t *hdr = self.record.header.ptr
 *         cdef bcf1_t *r = self.record.ptr             # <<<<<<<<<<<<<<
 *         cdef int i, n = 0
 * 
*/
  __pyx_t_2 = __pyx_v_self->record->ptr;
  __pyx_v_r = __pyx_t_2;

  /* "pysam/libcbcf.pyx":3515
 *         cdef bcf_hdr_t *hdr = self.record.header.ptr
 *         cdef bcf1_t *r = self.record.ptr
 *         cdef int i, n = 0             # <<<<<<<<<<<<<<
 * 
 *         if bcf_unpack(r, BCF_UN_FMT) < 0:
*/
  __pyx_v_n = 0;

  /* "pysam/libcbcf.pyx":3517
 *         cdef int i, n = 0
 * 
 *         if bcf_unpack(r, BCF_UN_FMT) < 0:             # <<<<<<<<<<<<<<
 *             raise ValueError('Error unpacking VariantRecord')
 * 
*/
  __pyx_t_3 = (bcf_unpack(__pyx_v_r, BCF_UN_FMT) < 0);
  if (unlikely(__pyx_t_3)) {

    /* "pysam/libcbcf.pyx":3518
 * 
 *         if bcf_unpack(r, BCF_UN_FMT) < 0:
 *             raise ValueError('Error unpacking VariantRecord')             # <<<<<<<<<<<<<<
 * 
 *         for i in range(r.n_fmt):
*/
    __pyx_t_5 = NULL;
    __Pyx_INCREF(__pyx_builtin_ValueError);
    __pyx_t_6 = __pyx_builtin_ValueError; 
    __pyx_t_7 = 1;
    {
      PyObject *__pyx_callargs[2] = {__pyx_t_5, __pyx_mstate_global->__pyx_kp_u_Error_unpacking_VariantRecord};
      __pyx_t_4 = __Pyx_PyObject_FastCall(__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, 3518, __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, 3518, __pyx_L1_error)

    /* "pysam/libcbcf.pyx":3517
 *         cdef int i, n = 0
 * 
 *         if bcf_unpack(r, BCF_UN_FMT) < 0:             # <<<<<<<<<<<<<<
 *             raise ValueError('Error unpacking VariantRecord')
 * 
*/
  }

  /* "pysam/libcbcf.pyx":3520
 *             raise ValueError('Error unpacking VariantRecord')
 * 
 *         for i in range(r.n_fmt):             # <<<<<<<<<<<<<<
 *             if r.d.fmt[i].p:
 *                 n += 1
*/
  __pyx_t_8 = __pyx_v_r->n_fmt;
  __pyx_t_9 = __pyx_t_8;
  for (__pyx_t_10 = 0; __pyx_t_10 < __pyx_t_9; __pyx_t_10+=1) {
    __pyx_v_i = __pyx_t_10;

    /* "pysam/libcbcf.pyx":3521
 * 
 *         for i in range(r.n_fmt):
 *             if r.d.fmt[i].p:             # <<<<<<<<<<<<<<
 *                 n += 1
 *         return n
*/
    __pyx_t_3 = ((__pyx_v_r->d.fmt[__pyx_v_i]).p != 0);
    if (__pyx_t_3) {

      /* "pysam/libcbcf.pyx":3522
 *         for i in range(r.n_fmt):
 *             if r.d.fmt[i].p:
 *                 n += 1             # <<<<<<<<<<<<<<
 *         return n
 * 
*/
      __pyx_v_n = (__pyx_v_n + 1);

      /* "pysam/libcbcf.pyx":3521
 * 
 *         for i in range(r.n_fmt):
 *             if r.d.fmt[i].p:             # <<<<<<<<<<<<<<
 *                 n += 1
 *         return n
*/
    }
  }

  /* "pysam/libcbcf.pyx":3523
 *             if r.d.fmt[i].p:
 *                 n += 1
 *         return n             # <<<<<<<<<<<<<<
 * 
 *     def __bool__(self):
*/
  __pyx_r = __pyx_v_n;
  __Pyx_TraceReturnCValue(__pyx_r, PyLong_FromSsize_t, 38, 0, __PYX_ERR(0, 3523, __pyx_L1_error));
  goto __pyx_L0;

  /* "pysam/libcbcf.pyx":3512
 *         bcf_sample_set_phased(self, value)
 * 
 *     def __len__(self):             # <<<<<<<<<<<<<<
 *         cdef bcf_hdr_t *hdr = self.record.header.ptr
 *         cdef bcf1_t *r = self.record.ptr
*/

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_XDECREF(__pyx_t_5);
  __Pyx_XDECREF(__pyx_t_6);
  __Pyx_TraceException(__pyx_lineno, 0, 0);
  #if CYTHON_USE_SYS_MONITORING
  __Pyx_TraceExceptionUnwind(0, 0);
  #else
  __Pyx_TraceReturnValue(NULL, 0, 0, __PYX_ERR(0, 3512, __pyx_L1_error));
  #endif
  __Pyx_AddTraceback("pysam.libcbcf.VariantRecordSample.__len__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = -1;
  __pyx_L0:;
  __Pyx_PyMonitoring_ExitScope(0);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "pysam/libcbcf.pyx":3525
 *         return n
 * 
 *     def __bool__(self):             # <<<<<<<<<<<<<<
 *         cdef bcf_hdr_t *hdr = self.record.header.ptr
 *         cdef bcf1_t *r = self.record.ptr
*/

/* Python wrapper */
static int __pyx_pw_5pysam_7libcbcf_19VariantRecordSample_5__bool__(PyObject *__pyx_v_self); /*proto*/
static int __pyx_pw_5pysam_7libcbcf_19VariantRecordSample_5__bool__(PyObject *__pyx_v_self) {
  CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__bool__ (wrapper)", 0);
  __pyx_kwvalues = __Pyx_KwValues_VARARGS(__pyx_args, __pyx_nargs);
  __pyx_r = __pyx_pf_5pysam_7libcbcf_19VariantRecordSample_4__bool__(((struct __pyx_obj_5pysam_7libcbcf_VariantRecordSample *)__pyx_v_self));

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

static int __pyx_pf_5pysam_7libcbcf_19VariantRecordSample_4__bool__(struct __pyx_obj_5pysam_7libcbcf_VariantRecordSample *__pyx_v_self) {
  CYTHON_UNUSED bcf_hdr_t *__pyx_v_hdr;
  bcf1_t *__pyx_v_r;
  int __pyx_v_i;
  int __pyx_r;
  __Pyx_TraceDeclarationsFunc
  __Pyx_RefNannyDeclarations
  bcf_hdr_t *__pyx_t_1;
  bcf1_t *__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;
  uint32_t __pyx_t_8;
  uint32_t __pyx_t_9;
  int __pyx_t_10;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_TraceFrameInit(((PyObject *)__pyx_mstate_global->__pyx_codeobj_tab[298]))
  __Pyx_RefNannySetupContext("__bool__", 0);
  __Pyx_TraceStartFunc("__bool__", __pyx_f[0], 3525, 0, 0, 0, __PYX_ERR(0, 3525, __pyx_L1_error));

  /* "pysam/libcbcf.pyx":3526
 * 
 *     def __bool__(self):
 *         cdef bcf_hdr_t *hdr = self.record.header.ptr             # <<<<<<<<<<<<<<
 *         cdef bcf1_t *r = self.record.ptr
 *         cdef int i
*/
  __pyx_t_1 = __pyx_v_self->record->header->ptr;
  __pyx_v_hdr = __pyx_t_1;

  /* "pysam/libcbcf.pyx":3527
 *     def __bool__(self):
 *         cdef bcf_hdr_t *hdr = self.record.header.ptr
 *         cdef bcf1_t *r = self.record.ptr             # <<<<<<<<<<<<<<
 *         cdef int i
 * 
*/
  __pyx_t_2 = __pyx_v_self->record->ptr;
  __pyx_v_r = __pyx_t_2;

  /* "pysam/libcbcf.pyx":3530
 *         cdef int i
 * 
 *         if bcf_unpack(r, BCF_UN_FMT) < 0:             # <<<<<<<<<<<<<<
 *             raise ValueError('Error unpacking VariantRecord')
 * 
*/
  __pyx_t_3 = (bcf_unpack(__pyx_v_r, BCF_UN_FMT) < 0);
  if (unlikely(__pyx_t_3)) {

    /* "pysam/libcbcf.pyx":3531
 * 
 *         if bcf_unpack(r, BCF_UN_FMT) < 0:
 *             raise ValueError('Error unpacking VariantRecord')             # <<<<<<<<<<<<<<
 * 
 *         for i in range(r.n_fmt):
*/
    __pyx_t_5 = NULL;
    __Pyx_INCREF(__pyx_builtin_ValueError);
    __pyx_t_6 = __pyx_builtin_ValueError; 
    __pyx_t_7 = 1;
    {
      PyObject *__pyx_callargs[2] = {__pyx_t_5, __pyx_mstate_global->__pyx_kp_u_Error_unpacking_VariantRecord};
      __pyx_t_4 = __Pyx_PyObject_FastCall(__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, 3531, __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, 3531, __pyx_L1_error)

    /* "pysam/libcbcf.pyx":3530
 *         cdef int i
 * 
 *         if bcf_unpack(r, BCF_UN_FMT) < 0:             # <<<<<<<<<<<<<<
 *             raise ValueError('Error unpacking VariantRecord')
 * 
*/
  }

  /* "pysam/libcbcf.pyx":3533
 *             raise ValueError('Error unpacking VariantRecord')
 * 
 *         for i in range(r.n_fmt):             # <<<<<<<<<<<<<<
 *             if r.d.fmt[i].p:
 *                 return True
*/
  __pyx_t_8 = __pyx_v_r->n_fmt;
  __pyx_t_9 = __pyx_t_8;
  for (__pyx_t_10 = 0; __pyx_t_10 < __pyx_t_9; __pyx_t_10+=1) {
    __pyx_v_i = __pyx_t_10;

    /* "pysam/libcbcf.pyx":3534
 * 
 *         for i in range(r.n_fmt):
 *             if r.d.fmt[i].p:             # <<<<<<<<<<<<<<
 *                 return True
 *         return False
*/
    __pyx_t_3 = ((__pyx_v_r->d.fmt[__pyx_v_i]).p != 0);
    if (__pyx_t_3) {

      /* "pysam/libcbcf.pyx":3535
 *         for i in range(r.n_fmt):
 *             if r.d.fmt[i].p:
 *                 return True             # <<<<<<<<<<<<<<
 *         return False
 * 
*/
      __pyx_r = 1;
      __Pyx_TraceReturnCValue(__pyx_r, __Pyx_PyLong_From_int, 34, 0, __PYX_ERR(0, 3535, __pyx_L1_error));
      goto __pyx_L0;

      /* "pysam/libcbcf.pyx":3534
 * 
 *         for i in range(r.n_fmt):
 *             if r.d.fmt[i].p:             # <<<<<<<<<<<<<<
 *                 return True
 *         return False
*/
    }
  }

  /* "pysam/libcbcf.pyx":3536
 *             if r.d.fmt[i].p:
 *                 return True
 *         return False             # <<<<<<<<<<<<<<
 * 
 *     def __getitem__(self, key):
*/
  __pyx_r = 0;
  __Pyx_TraceReturnCValue(__pyx_r, __Pyx_PyLong_From_int, 36, 0, __PYX_ERR(0, 3536, __pyx_L1_error));
  goto __pyx_L0;

  /* "pysam/libcbcf.pyx":3525
 *         return n
 * 
 *     def __bool__(self):             # <<<<<<<<<<<<<<
 *         cdef bcf_hdr_t *hdr = self.record.header.ptr
 *         cdef bcf1_t *r = self.record.ptr
*/

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_XDECREF(__pyx_t_5);
  __Pyx_XDECREF(__pyx_t_6);
  __Pyx_TraceException(__pyx_lineno, 0, 0);
  #if CYTHON_USE_SYS_MONITORING
  __Pyx_TraceExceptionUnwind(0, 0);
  #else
  __Pyx_TraceReturnValue(NULL, 0, 0, __PYX_ERR(0, 3525, __pyx_L1_error));
  #endif
  __Pyx_AddTraceback("pysam.libcbcf.VariantRecordSample.__bool__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = -1;
  __pyx_L0:;
  __Pyx_PyMonitoring_ExitScope(0);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "pysam/libcbcf.pyx":3538
 *         return False
 * 
 *     def __getitem__(self, key):             # <<<<<<<<<<<<<<
 *         return bcf_format_get_value(self, key)
 * 
*/

/* Python wrapper */
static PyObject *__pyx_pw_5pysam_7libcbcf_19VariantRecordSample_7__getitem__(PyObject *__pyx_v_self, PyObject *__pyx_v_key); /*proto*/
static PyObject *__pyx_pw_5pysam_7libcbcf_19VariantRecordSample_7__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_5pysam_7libcbcf_19VariantRecordSample_6__getitem__(((struct __pyx_obj_5pysam_7libcbcf_VariantRecordSample *)__pyx_v_self), ((PyObject *)__pyx_v_key));

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

static PyObject *__pyx_pf_5pysam_7libcbcf_19VariantRecordSample_6__getitem__(struct __pyx_obj_5pysam_7libcbcf_VariantRecordSample *__pyx_v_self, PyObject *__pyx_v_key) {
  PyObject *__pyx_r = NULL;
  __Pyx_TraceDeclarationsFunc
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_TraceFrameInit(((PyObject *)__pyx_mstate_global->__pyx_codeobj_tab[299]))
  __Pyx_RefNannySetupContext("__getitem__", 0);
  __Pyx_TraceStartFunc("__getitem__", __pyx_f[0], 3538, 0, 0, 0, __PYX_ERR(0, 3538, __pyx_L1_error));

  /* "pysam/libcbcf.pyx":3539
 * 
 *     def __getitem__(self, key):
 *         return bcf_format_get_value(self, key)             # <<<<<<<<<<<<<<
 * 
 *     def __setitem__(self, key, value):
*/
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = __pyx_f_5pysam_7libcbcf_bcf_format_get_value(__pyx_v_self, __pyx_v_key); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 3539, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  __Pyx_TraceReturnValue(__pyx_r, 1, 0, __PYX_ERR(0, 3539, __pyx_L1_error));
  goto __pyx_L0;

  /* "pysam/libcbcf.pyx":3538
 *         return False
 * 
 *     def __getitem__(self, key):             # <<<<<<<<<<<<<<
 *         return bcf_format_get_value(self, key)
 * 
*/

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_TraceException(__pyx_lineno, 0, 0);
  #if CYTHON_USE_SYS_MONITORING
  __Pyx_TraceExceptionUnwind(0, 0);
  #else
  __Pyx_TraceReturnValue(NULL, 0, 0, __PYX_ERR(0, 3538, __pyx_L1_error));
  #endif
  __Pyx_AddTraceback("pysam.libcbcf.VariantRecordSample.__getitem__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_PyMonitoring_ExitScope(0);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "pysam/libcbcf.pyx":3541
 *         return bcf_format_get_value(self, key)
 * 
 *     def __setitem__(self, key, value):             # <<<<<<<<<<<<<<
 *         bcf_format_set_value(self, key, value)
 * 
*/

/* Python wrapper */
static int __pyx_pw_5pysam_7libcbcf_19VariantRecordSample_9__setitem__(PyObject *__pyx_v_self, PyObject *__pyx_v_key, PyObject *__pyx_v_value); /*proto*/
static int __pyx_pw_5pysam_7libcbcf_19VariantRecordSample_9__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_5pysam_7libcbcf_19VariantRecordSample_8__setitem__(((struct __pyx_obj_5pysam_7libcbcf_VariantRecordSample *)__pyx_v_self), ((PyObject *)__pyx_v_key), ((PyObject *)__pyx_v_value));

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

static int __pyx_pf_5pysam_7libcbcf_19VariantRecordSample_8__setitem__(struct __pyx_obj_5pysam_7libcbcf_VariantRecordSample *__pyx_v_self, PyObject *__pyx_v_key, PyObject *__pyx_v_value) {
  int __pyx_r;
  __Pyx_TraceDeclarationsFunc
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_TraceFrameInit(((PyObject *)__pyx_mstate_global->__pyx_codeobj_tab[300]))
  __Pyx_RefNannySetupContext("__setitem__", 0);
  __Pyx_TraceStartFunc("__setitem__", __pyx_f[0], 3541, 0, 0, 0, __PYX_ERR(0, 3541, __pyx_L1_error));

  /* "pysam/libcbcf.pyx":3542
 * 
 *     def __setitem__(self, key, value):
 *         bcf_format_set_value(self, key, value)             # <<<<<<<<<<<<<<
 * 
 *     def __delitem__(self, key):
*/
  __pyx_t_1 = __pyx_f_5pysam_7libcbcf_bcf_format_set_value(__pyx_v_self, __pyx_v_key, __pyx_v_value); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 3542, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "pysam/libcbcf.pyx":3541
 *         return bcf_format_get_value(self, key)
 * 
 *     def __setitem__(self, key, value):             # <<<<<<<<<<<<<<
 *         bcf_format_set_value(self, key, value)
 * 
*/

  /* function exit code */
  __pyx_r = 0;
  __Pyx_TraceReturnCValue(__pyx_r, __Pyx_Owned_Py_None, 0, 0, __PYX_ERR(0, 3541, __pyx_L1_error));
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_TraceException(__pyx_lineno, 0, 0);
  #if CYTHON_USE_SYS_MONITORING
  __Pyx_TraceExceptionUnwind(0, 0);
  #else
  __Pyx_TraceReturnValue(NULL, 0, 0, __PYX_ERR(0, 3541, __pyx_L1_error));
  #endif
  __Pyx_AddTraceback("pysam.libcbcf.VariantRecordSample.__setitem__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = -1;
  __pyx_L0:;
  __Pyx_PyMonitoring_ExitScope(0);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "pysam/libcbcf.pyx":3544
 *         bcf_format_set_value(self, key, value)
 * 
 *     def __delitem__(self, key):             # <<<<<<<<<<<<<<
 *         bcf_format_del_value(self, key)
 * 
*/

/* Python wrapper */
static int __pyx_pw_5pysam_7libcbcf_19VariantRecordSample_11__delitem__(PyObject *__pyx_v_self, PyObject *__pyx_v_key); /*proto*/
static int __pyx_pw_5pysam_7libcbcf_19VariantRecordSample_11__delitem__(PyObject *__pyx_v_self, PyObject *__pyx_v_key) {
  CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__delitem__ (wrapper)", 0);
  __pyx_kwvalues = __Pyx_KwValues_VARARGS(__pyx_args, __pyx_nargs);
  __pyx_r = __pyx_pf_5pysam_7libcbcf_19VariantRecordSample_10__delitem__(((struct __pyx_obj_5pysam_7libcbcf_VariantRecordSample *)__pyx_v_self), ((PyObject *)__pyx_v_key));

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

static int __pyx_pf_5pysam_7libcbcf_19VariantRecordSample_10__delitem__(struct __pyx_obj_5pysam_7libcbcf_VariantRecordSample *__pyx_v_self, PyObject *__pyx_v_key) {
  int __pyx_r;
  __Pyx_TraceDeclarationsFunc
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_TraceFrameInit(((PyObject *)__pyx_mstate_global->__pyx_codeobj_tab[301]))
  __Pyx_RefNannySetupContext("__delitem__", 0);
  __Pyx_TraceStartFunc("__delitem__", __pyx_f[0], 3544, 0, 0, 0, __PYX_ERR(0, 3544, __pyx_L1_error));

  /* "pysam/libcbcf.pyx":3545
 * 
 *     def __delitem__(self, key):
 *         bcf_format_del_value(self, key)             # <<<<<<<<<<<<<<
 * 
 *     def clear(self):
*/
  __pyx_t_1 = __pyx_f_5pysam_7libcbcf_bcf_format_del_value(__pyx_v_self, __pyx_v_key); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 3545, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "pysam/libcbcf.pyx":3544
 *         bcf_format_set_value(self, key, value)
 * 
 *     def __delitem__(self, key):             # <<<<<<<<<<<<<<
 *         bcf_format_del_value(self, key)
 * 
*/

  /* function exit code */
  __pyx_r = 0;
  __Pyx_TraceReturnCValue(__pyx_r, __Pyx_Owned_Py_None, 0, 0, __PYX_ERR(0, 3544, __pyx_L1_error));
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_TraceException(__pyx_lineno, 0, 0);
  #if CYTHON_USE_SYS_MONITORING
  __Pyx_TraceExceptionUnwind(0, 0);
  #else
  __Pyx_TraceReturnValue(NULL, 0, 0, __PYX_ERR(0, 3544, __pyx_L1_error));
  #endif
  __Pyx_AddTraceback("pysam.libcbcf.VariantRecordSample.__delitem__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = -1;
  __pyx_L0:;
  __Pyx_PyMonitoring_ExitScope(0);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "pysam/libcbcf.pyx":3547
 *         bcf_format_del_value(self, key)
 * 
 *     def clear(self):             # <<<<<<<<<<<<<<
 *         """Clear all format data (including genotype) for this sample"""
 *         cdef bcf_hdr_t *hdr = self.record.header.ptr
*/

/* Python wrapper */
static PyObject *__pyx_pw_5pysam_7libcbcf_19VariantRecordSample_13clear(PyObject *__pyx_v_self, 
#if 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_5pysam_7libcbcf_19VariantRecordSample_12clear, "VariantRecordSample.clear(self)\n\nClear all format data (including genotype) for this sample");
static PyMethodDef __pyx_mdef_5pysam_7libcbcf_19VariantRecordSample_13clear = {"clear", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_5pysam_7libcbcf_19VariantRecordSample_13clear, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_5pysam_7libcbcf_19VariantRecordSample_12clear};
static PyObject *__pyx_pw_5pysam_7libcbcf_19VariantRecordSample_13clear(PyObject *__pyx_v_self, 
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
) {
  #if !CYTHON_METH_FASTCALL
  CYTHON_UNUSED Py_ssize_t __pyx_nargs;
  #endif
  CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("clear (wrapper)", 0);
  #if !CYTHON_METH_FASTCALL
  #if CYTHON_ASSUME_SAFE_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("clear", 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("clear", __pyx_kwds); return NULL;}
  __pyx_r = __pyx_pf_5pysam_7libcbcf_19VariantRecordSample_12clear(((struct __pyx_obj_5pysam_7libcbcf_VariantRecordSample *)__pyx_v_self));

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

static PyObject *__pyx_pf_5pysam_7libcbcf_19VariantRecordSample_12clear(struct __pyx_obj_5pysam_7libcbcf_VariantRecordSample *__pyx_v_self) {
  bcf_hdr_t *__pyx_v_hdr;
  bcf1_t *__pyx_v_r;
  bcf_fmt_t *__pyx_v_fmt;
  int __pyx_v_i;
  PyObject *__pyx_r = NULL;
  __Pyx_TraceDeclarationsFunc
  __Pyx_RefNannyDeclarations
  bcf_hdr_t *__pyx_t_1;
  bcf1_t *__pyx_t_2;
  uint32_t __pyx_t_3;
  uint32_t __pyx_t_4;
  int __pyx_t_5;
  int __pyx_t_6;
  PyObject *__pyx_t_7 = NULL;
  PyObject *__pyx_t_8 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_TraceFrameInit(((PyObject *)__pyx_mstate_global->__pyx_codeobj_tab[302]))
  __Pyx_RefNannySetupContext("clear", 0);
  __Pyx_TraceStartFunc("clear", __pyx_f[0], 3547, 0, 0, 0, __PYX_ERR(0, 3547, __pyx_L1_error));

  /* "pysam/libcbcf.pyx":3549
 *     def clear(self):
 *         """Clear all format data (including genotype) for this sample"""
 *         cdef bcf_hdr_t *hdr = self.record.header.ptr             # <<<<<<<<<<<<<<
 *         cdef bcf1_t *r = self.record.ptr
 *         cdef bcf_fmt_t *fmt
*/
  __pyx_t_1 = __pyx_v_self->record->header->ptr;
  __pyx_v_hdr = __pyx_t_1;

  /* "pysam/libcbcf.pyx":3550
 *         """Clear all format data (including genotype) for this sample"""
 *         cdef bcf_hdr_t *hdr = self.record.header.ptr
 *         cdef bcf1_t *r = self.record.ptr             # <<<<<<<<<<<<<<
 *         cdef bcf_fmt_t *fmt
 *         cdef int i
*/
  __pyx_t_2 = __pyx_v_self->record->ptr;
  __pyx_v_r = __pyx_t_2;

  /* "pysam/libcbcf.pyx":3554
 *         cdef int i
 * 
 *         for i in range(r.n_fmt):             # <<<<<<<<<<<<<<
 *             fmt = &r.d.fmt[i]
 *             if fmt.p:
*/
  __pyx_t_3 = __pyx_v_r->n_fmt;
  __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;

    /* "pysam/libcbcf.pyx":3555
 * 
 *         for i in range(r.n_fmt):
 *             fmt = &r.d.fmt[i]             # <<<<<<<<<<<<<<
 *             if fmt.p:
 *                 bcf_format_del_value(self, bcf_hdr_int2id(hdr, BCF_DT_ID, fmt.id))
*/
    __pyx_v_fmt = (&(__pyx_v_r->d.fmt[__pyx_v_i]));

    /* "pysam/libcbcf.pyx":3556
 *         for i in range(r.n_fmt):
 *             fmt = &r.d.fmt[i]
 *             if fmt.p:             # <<<<<<<<<<<<<<
 *                 bcf_format_del_value(self, bcf_hdr_int2id(hdr, BCF_DT_ID, fmt.id))
 * 
*/
    __pyx_t_6 = (__pyx_v_fmt->p != 0);
    if (__pyx_t_6) {

      /* "pysam/libcbcf.pyx":3557
 *             fmt = &r.d.fmt[i]
 *             if fmt.p:
 *                 bcf_format_del_value(self, bcf_hdr_int2id(hdr, BCF_DT_ID, fmt.id))             # <<<<<<<<<<<<<<
 * 
 *     def __iter__(self):
*/
      __pyx_t_7 = __Pyx_PyBytes_FromString(bcf_hdr_int2id(__pyx_v_hdr, BCF_DT_ID, __pyx_v_fmt->id)); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 3557, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_7);
      __pyx_t_8 = __pyx_f_5pysam_7libcbcf_bcf_format_del_value(__pyx_v_self, __pyx_t_7); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 3557, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_8);
      __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
      __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;

      /* "pysam/libcbcf.pyx":3556
 *         for i in range(r.n_fmt):
 *             fmt = &r.d.fmt[i]
 *             if fmt.p:             # <<<<<<<<<<<<<<
 *                 bcf_format_del_value(self, bcf_hdr_int2id(hdr, BCF_DT_ID, fmt.id))
 * 
*/
    }
  }

  /* "pysam/libcbcf.pyx":3547
 *         bcf_format_del_value(self, key)
 * 
 *     def clear(self):             # <<<<<<<<<<<<<<
 *         """Clear all format data (including genotype) for this sample"""
 *         cdef bcf_hdr_t *hdr = self.record.header.ptr
*/

  /* function exit code */
  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  __Pyx_TraceReturnValue(__pyx_r, 0, 0, __PYX_ERR(0, 3547, __pyx_L1_error));
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_7);
  __Pyx_XDECREF(__pyx_t_8);
  __Pyx_TraceException(__pyx_lineno, 0, 0);
  #if CYTHON_USE_SYS_MONITORING
  __Pyx_TraceExceptionUnwind(0, 0);
  #else
  __Pyx_TraceReturnValue(NULL, 0, 0, __PYX_ERR(0, 3547, __pyx_L1_error));
  #endif
  __Pyx_AddTraceback("pysam.libcbcf.VariantRecordSample.clear", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_PyMonitoring_ExitScope(0);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}
static PyObject *__pyx_gb_5pysam_7libcbcf_19VariantRecordSample_16generator23(__pyx_CoroutineObject *__pyx_generator, CYTHON_UNUSED PyThreadState *__pyx_tstate, PyObject *__pyx_sent_value); /* proto */

/* "pysam/libcbcf.pyx":3559
 *                 bcf_format_del_value(self, bcf_hdr_int2id(hdr, BCF_DT_ID, fmt.id))
 * 
 *     def __iter__(self):             # <<<<<<<<<<<<<<
 *         cdef bcf_hdr_t *hdr = self.record.header.ptr
 *         cdef bcf1_t *r = self.record.ptr
*/

/* Python wrapper */
static PyObject *__pyx_pw_5pysam_7libcbcf_19VariantRecordSample_15__iter__(PyObject *__pyx_v_self); /*proto*/
static PyObject *__pyx_pw_5pysam_7libcbcf_19VariantRecordSample_15__iter__(PyObject *__pyx_v_self) {
  CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__iter__ (wrapper)", 0);
  __pyx_kwvalues = __Pyx_KwValues_VARARGS(__pyx_args, __pyx_nargs);
  __pyx_r = __pyx_pf_5pysam_7libcbcf_19VariantRecordSample_14__iter__(((struct __pyx_obj_5pysam_7libcbcf_VariantRecordSample *)__pyx_v_self));

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

static PyObject *__pyx_pf_5pysam_7libcbcf_19VariantRecordSample_14__iter__(struct __pyx_obj_5pysam_7libcbcf_VariantRecordSample *__pyx_v_self) {
  struct __pyx_obj_5pysam_7libcbcf___pyx_scope_struct_33___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("__iter__", 0);
  __pyx_cur_scope = (struct __pyx_obj_5pysam_7libcbcf___pyx_scope_struct_33___iter__ *)__pyx_tp_new_5pysam_7libcbcf___pyx_scope_struct_33___iter__(__pyx_mstate_global->__pyx_ptype_5pysam_7libcbcf___pyx_scope_struct_33___iter__, __pyx_mstate_global->__pyx_empty_tuple, NULL);
  if (unlikely(!__pyx_cur_scope)) {
    __pyx_cur_scope = ((struct __pyx_obj_5pysam_7libcbcf___pyx_scope_struct_33___iter__ *)Py_None);
    __Pyx_INCREF(Py_None);
    __PYX_ERR(0, 3559, __pyx_L1_error)
  } else {
    __Pyx_GOTREF((PyObject *)__pyx_cur_scope);
  }
  __pyx_cur_scope->__pyx_v_self = __pyx_v_self;
  __Pyx_INCREF((PyObject *)__pyx_cur_scope->__pyx_v_self);
  __Pyx_GIVEREF((PyObject *)__pyx_cur_scope->__pyx_v_self);
  {
    __pyx_CoroutineObject *gen = __Pyx_Generator_New((__pyx_coroutine_body_t) __pyx_gb_5pysam_7libcbcf_19VariantRecordSample_16generator23, ((PyObject *)__pyx_mstate_global->__pyx_codeobj_tab[303]), (PyObject *) __pyx_cur_scope, __pyx_mstate_global->__pyx_n_u_iter, __pyx_mstate_global->__pyx_n_u_VariantRecordSample___iter, __pyx_mstate_global->__pyx_n_u_pysam_libcbcf); if (unlikely(!gen)) __PYX_ERR(0, 3559, __pyx_L1_error)
    __Pyx_DECREF(__pyx_cur_scope);
    __Pyx_RefNannyFinishContext();
    return (PyObject *) gen;
  }

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_AddTraceback("pysam.libcbcf.VariantRecordSample.__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_5pysam_7libcbcf_19VariantRecordSample_16generator23(__pyx_CoroutineObject *__pyx_generator, CYTHON_UNUSED PyThreadState *__pyx_tstate, PyObject *__pyx_sent_value) /* generator body */
{
  struct __pyx_obj_5pysam_7libcbcf___pyx_scope_struct_33___iter__ *__pyx_cur_scope = ((struct __pyx_obj_5pysam_7libcbcf___pyx_scope_struct_33___iter__ *)__pyx_generator->closure);
  PyObject *__pyx_r = NULL;
  __Pyx_TraceDeclarationsGen
  bcf_hdr_t *__pyx_t_1;
  bcf1_t *__pyx_t_2;
  uint32_t __pyx_t_3;
  uint32_t __pyx_t_4;
  int __pyx_t_5;
  int __pyx_t_6;
  PyObject *__pyx_t_7 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__iter__", 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_TraceStartGen("__iter__", __pyx_f[0], 3559, 0, 0, 0, __PYX_ERR(0, 3559, __pyx_L1_error));
    __Pyx_TraceReturnValue(Py_None, 0, 0, __PYX_ERR(0, 3559, __pyx_L1_error));
    __Pyx_RefNannyFinishContext();
    return NULL;
  }
  __pyx_L3_first_run:;
  __Pyx_TraceStartGen("__iter__", __pyx_f[0], 3559, 0, 0, 0, __PYX_ERR(0, 3559, __pyx_L1_error));
  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, 3559, __pyx_L1_error)
  }

  /* "pysam/libcbcf.pyx":3560
 * 
 *     def __iter__(self):
 *         cdef bcf_hdr_t *hdr = self.record.header.ptr             # <<<<<<<<<<<<<<
 *         cdef bcf1_t *r = self.record.ptr
 *         cdef bcf_fmt_t *fmt
*/
  __pyx_t_1 = __pyx_cur_scope->__pyx_v_self->record->header->ptr;
  __pyx_cur_scope->__pyx_v_hdr = __pyx_t_1;

  /* "pysam/libcbcf.pyx":3561
 *     def __iter__(self):
 *         cdef bcf_hdr_t *hdr = self.record.header.ptr
 *         cdef bcf1_t *r = self.record.ptr             # <<<<<<<<<<<<<<
 *         cdef bcf_fmt_t *fmt
 *         cdef int i
*/
  __pyx_t_2 = __pyx_cur_scope->__pyx_v_self->record->ptr;
  __pyx_cur_scope->__pyx_v_r = __pyx_t_2;

  /* "pysam/libcbcf.pyx":3565
 *         cdef int i
 * 
 *         for i in range(r.n_fmt):             # <<<<<<<<<<<<<<
 *             fmt = &r.d.fmt[i]
 *             if r.d.fmt[i].p:
*/
  __pyx_t_3 = __pyx_cur_scope->__pyx_v_r->n_fmt;
  __pyx_t_4 = __pyx_t_3;
  for (__pyx_t_5 = 0; __pyx_t_5 < __pyx_t_4; __pyx_t_5+=1) {
    __pyx_cur_scope->__pyx_v_i = __pyx_t_5;

    /* "pysam/libcbcf.pyx":3566
 * 
 *         for i in range(r.n_fmt):
 *             fmt = &r.d.fmt[i]             # <<<<<<<<<<<<<<
 *             if r.d.fmt[i].p:
 *                 yield bcf_str_cache_get_charptr(bcf_hdr_int2id(hdr, BCF_DT_ID, fmt.id))
*/
    __pyx_cur_scope->__pyx_v_fmt = (&(__pyx_cur_scope->__pyx_v_r->d.fmt[__pyx_cur_scope->__pyx_v_i]));

    /* "pysam/libcbcf.pyx":3567
 *         for i in range(r.n_fmt):
 *             fmt = &r.d.fmt[i]
 *             if r.d.fmt[i].p:             # <<<<<<<<<<<<<<
 *                 yield bcf_str_cache_get_charptr(bcf_hdr_int2id(hdr, BCF_DT_ID, fmt.id))
 * 
*/
    __pyx_t_6 = ((__pyx_cur_scope->__pyx_v_r->d.fmt[__pyx_cur_scope->__pyx_v_i]).p != 0);
    if (__pyx_t_6) {

      /* "pysam/libcbcf.pyx":3568
 *             fmt = &r.d.fmt[i]
 *             if r.d.fmt[i].p:
 *                 yield bcf_str_cache_get_charptr(bcf_hdr_int2id(hdr, BCF_DT_ID, fmt.id))             # <<<<<<<<<<<<<<
 * 
 *     def get(self, key, default=None):
*/
      __pyx_t_7 = __pyx_f_5pysam_7libcbcf_bcf_str_cache_get_charptr(bcf_hdr_int2id(__pyx_cur_scope->__pyx_v_hdr, BCF_DT_ID, __pyx_cur_scope->__pyx_v_fmt->id)); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 3568, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_7);
      __pyx_r = __pyx_t_7;
      __pyx_t_7 = 0;
      __pyx_cur_scope->__pyx_t_0 = __pyx_t_3;
      __pyx_cur_scope->__pyx_t_1 = __pyx_t_4;
      __pyx_cur_scope->__pyx_t_2 = __pyx_t_5;
      __Pyx_TraceYield(__pyx_r, 0, __PYX_ERR(0, 3568, __pyx_L1_error));
      __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_TraceResumeGen("__iter__", __pyx_f[0], 3559, 0, __PYX_ERR(0, 3568, __pyx_L1_error));
      __pyx_t_3 = __pyx_cur_scope->__pyx_t_0;
      __pyx_t_4 = __pyx_cur_scope->__pyx_t_1;
      __pyx_t_5 = __pyx_cur_scope->__pyx_t_2;
      if (unlikely(!__pyx_sent_value)) __PYX_ERR(0, 3568, __pyx_L1_error)

      /* "pysam/libcbcf.pyx":3567
 *         for i in range(r.n_fmt):
 *             fmt = &r.d.fmt[i]
 *             if r.d.fmt[i].p:             # <<<<<<<<<<<<<<
 *                 yield bcf_str_cache_get_charptr(bcf_hdr_int2id(hdr, BCF_DT_ID, fmt.id))
 * 
*/
    }
  }
  CYTHON_MAYBE_UNUSED_VAR(__pyx_cur_scope);
  __Pyx_TraceReturnValue(Py_None, 0, 0, __PYX_ERR(0, 3559, __pyx_L1_error));

  /* "pysam/libcbcf.pyx":3559
 *                 bcf_format_del_value(self, bcf_hdr_int2id(hdr, BCF_DT_ID, fmt.id))
 * 
 *     def __iter__(self):             # <<<<<<<<<<<<<<
 *         cdef bcf_hdr_t *hdr = self.record.header.ptr
 *         cdef bcf1_t *r = self.record.ptr
*/

  /* function exit code */
  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_7);
  if (__Pyx_PyErr_Occurred()) {
    __Pyx_TraceException(__pyx_lineno, 0, 0);
    __Pyx_Generator_Replace_StopIteration(0);
    __Pyx_AddTraceback("__iter__", __pyx_clineno, __pyx_lineno, __pyx_filename);
    __Pyx_TraceExceptionUnwind(0, 0);
  }
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_PyMonitoring_ExitScope(0);
  #if !CYTHON_USE_EXC_INFO_STACK
  __Pyx_Coroutine_ResetAndClearException(__pyx_generator);
  #endif
  __pyx_generator->resume_label = -1;
  __Pyx_Coroutine_clear((PyObject*)__pyx_generator);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "pysam/libcbcf.pyx":3570
 *                 yield bcf_str_cache_get_charptr(bcf_hdr_int2id(hdr, BCF_DT_ID, fmt.id))
 * 
 *     def get(self, key, default=None):             # <<<<<<<<<<<<<<
 *         """D.get(k[,d]) -> D[k] if k in D, else d.  d defaults to None."""
 *         try:
*/

/* Python wrapper */
static PyObject *__pyx_pw_5pysam_7libcbcf_19VariantRecordSample_18get(PyObject *__pyx_v_self, 
#if 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_5pysam_7libcbcf_19VariantRecordSample_17get, "VariantRecordSample.get(self, key, default=None)\n\nD.get(k[,d]) -> D[k] if k in D, else d.  d defaults to None.");
static PyMethodDef __pyx_mdef_5pysam_7libcbcf_19VariantRecordSample_18get = {"get", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_5pysam_7libcbcf_19VariantRecordSample_18get, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_5pysam_7libcbcf_19VariantRecordSample_17get};
static PyObject *__pyx_pw_5pysam_7libcbcf_19VariantRecordSample_18get(PyObject *__pyx_v_self, 
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
) {
  PyObject *__pyx_v_key = 0;
  PyObject *__pyx_v_default = 0;
  #if !CYTHON_METH_FASTCALL
  CYTHON_UNUSED Py_ssize_t __pyx_nargs;
  #endif
  CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
  PyObject* values[2] = {0,0};
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("get (wrapper)", 0);
  #if !CYTHON_METH_FASTCALL
  #if CYTHON_ASSUME_SAFE_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,&__pyx_mstate_global->__pyx_n_u_default,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, 3570, __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, 3570, __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, 3570, __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, 3570, __pyx_L3_error)
      if (!values[1]) values[1] = __Pyx_NewRef(((PyObject *)Py_None));
      for (Py_ssize_t i = __pyx_nargs; i < 1; i++) {
        if (unlikely(!values[i])) { __Pyx_RaiseArgtupleInvalid("get", 0, 1, 2, i); __PYX_ERR(0, 3570, __pyx_L3_error) }
      }
    } 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, 3570, __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, 3570, __pyx_L3_error)
        break;
        default: goto __pyx_L5_argtuple_error;
      }
      if (!values[1]) values[1] = __Pyx_NewRef(((PyObject *)Py_None));
    }
    __pyx_v_key = values[0];
    __pyx_v_default = values[1];
  }
  goto __pyx_L6_skip;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("get", 0, 1, 2, __pyx_nargs); __PYX_ERR(0, 3570, __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("pysam.libcbcf.VariantRecordSample.get", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_5pysam_7libcbcf_19VariantRecordSample_17get(((struct __pyx_obj_5pysam_7libcbcf_VariantRecordSample *)__pyx_v_self), __pyx_v_key, __pyx_v_default);

  /* 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_5pysam_7libcbcf_19VariantRecordSample_17get(struct __pyx_obj_5pysam_7libcbcf_VariantRecordSample *__pyx_v_self, PyObject *__pyx_v_key, PyObject *__pyx_v_default) {
  PyObject *__pyx_r = NULL;
  __Pyx_TraceDeclarationsFunc
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  PyObject *__pyx_t_4 = NULL;
  int __pyx_t_5;
  PyObject *__pyx_t_6 = NULL;
  PyObject *__pyx_t_7 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_TraceFrameInit(((PyObject *)__pyx_mstate_global->__pyx_codeobj_tab[304]))
  __Pyx_RefNannySetupContext("get", 0);
  __Pyx_TraceStartFunc("get", __pyx_f[0], 3570, 0, 0, 0, __PYX_ERR(0, 3570, __pyx_L1_error));

  /* "pysam/libcbcf.pyx":3572
 *     def get(self, key, default=None):
 *         """D.get(k[,d]) -> D[k] if k in D, else d.  d defaults to None."""
 *         try:             # <<<<<<<<<<<<<<
 *             return self[key]
 *         except KeyError:
*/
  {
    __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:*/ {

      /* "pysam/libcbcf.pyx":3573
 *         """D.get(k[,d]) -> D[k] if k in D, else d.  d defaults to None."""
 *         try:
 *             return self[key]             # <<<<<<<<<<<<<<
 *         except KeyError:
 *             return default
*/
      __Pyx_XDECREF(__pyx_r);
      __pyx_t_4 = __Pyx_PyObject_GetItem(((PyObject *)__pyx_v_self), __pyx_v_key); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 3573, __pyx_L3_error)
      __Pyx_GOTREF(__pyx_t_4);
      __pyx_r = __pyx_t_4;
      __pyx_t_4 = 0;
      __Pyx_TraceReturnValue(__pyx_r, 3, 0, __PYX_ERR(0, 3573, __pyx_L3_error));
      goto __pyx_L7_try_return;

      /* "pysam/libcbcf.pyx":3572
 *     def get(self, key, default=None):
 *         """D.get(k[,d]) -> D[k] if k in D, else d.  d defaults to None."""
 *         try:             # <<<<<<<<<<<<<<
 *             return self[key]
 *         except KeyError:
*/
    }
    __pyx_L3_error:;
    __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
    __Pyx_TraceException(__pyx_lineno, 0, 0);

    /* "pysam/libcbcf.pyx":3574
 *         try:
 *             return self[key]
 *         except KeyError:             # <<<<<<<<<<<<<<
 *             return default
 * 
*/
    __pyx_t_5 = __Pyx_PyErr_ExceptionMatches(__pyx_builtin_KeyError);
    if (__pyx_t_5) {
      __Pyx_AddTraceback("pysam.libcbcf.VariantRecordSample.get", __pyx_clineno, __pyx_lineno, __pyx_filename);
      __Pyx_TraceExceptionHandled(0);
      if (__Pyx_GetException(&__pyx_t_4, &__pyx_t_6, &__pyx_t_7) < 0) __PYX_ERR(0, 3574, __pyx_L5_except_error)
      __Pyx_XGOTREF(__pyx_t_4);
      __Pyx_XGOTREF(__pyx_t_6);
      __Pyx_XGOTREF(__pyx_t_7);
      __Pyx_TraceExceptionDone();

      /* "pysam/libcbcf.pyx":3575
 *             return self[key]
 *         except KeyError:
 *             return default             # <<<<<<<<<<<<<<
 * 
 *     def __contains__(self, key):
*/
      __Pyx_XDECREF(__pyx_r);
      __Pyx_INCREF(__pyx_v_default);
      __pyx_r = __pyx_v_default;
      __Pyx_TraceReturnValue(__pyx_r, 8, 0, __PYX_ERR(0, 3575, __pyx_L5_except_error));
      __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;

    /* "pysam/libcbcf.pyx":3572
 *     def get(self, key, default=None):
 *         """D.get(k[,d]) -> D[k] if k in D, else d.  d defaults to None."""
 *         try:             # <<<<<<<<<<<<<<
 *             return self[key]
 *         except KeyError:
*/
    __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;
  }

  /* "pysam/libcbcf.pyx":3570
 *                 yield bcf_str_cache_get_charptr(bcf_hdr_int2id(hdr, BCF_DT_ID, fmt.id))
 * 
 *     def get(self, key, default=None):             # <<<<<<<<<<<<<<
 *         """D.get(k[,d]) -> D[k] if k in D, else d.  d defaults to None."""
 *         try:
*/

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_XDECREF(__pyx_t_6);
  __Pyx_XDECREF(__pyx_t_7);
  __Pyx_TraceException(__pyx_lineno, 0, 0);
  #if CYTHON_USE_SYS_MONITORING
  __Pyx_TraceExceptionUnwind(0, 0);
  #else
  __Pyx_TraceReturnValue(NULL, 0, 0, __PYX_ERR(0, 3570, __pyx_L1_error));
  #endif
  __Pyx_AddTraceback("pysam.libcbcf.VariantRecordSample.get", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_PyMonitoring_ExitScope(0);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "pysam/libcbcf.pyx":3577
 *             return default
 * 
 *     def __contains__(self, key):             # <<<<<<<<<<<<<<
 *         cdef bcf_hdr_t *hdr = self.record.header.ptr
 *         cdef bcf1_t *r = self.record.ptr
*/

/* Python wrapper */
static int __pyx_pw_5pysam_7libcbcf_19VariantRecordSample_20__contains__(PyObject *__pyx_v_self, PyObject *__pyx_v_key); /*proto*/
static int __pyx_pw_5pysam_7libcbcf_19VariantRecordSample_20__contains__(PyObject *__pyx_v_self, PyObject *__pyx_v_key) {
  CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__contains__ (wrapper)", 0);
  __pyx_kwvalues = __Pyx_KwValues_VARARGS(__pyx_args, __pyx_nargs);
  __pyx_r = __pyx_pf_5pysam_7libcbcf_19VariantRecordSample_19__contains__(((struct __pyx_obj_5pysam_7libcbcf_VariantRecordSample *)__pyx_v_self), ((PyObject *)__pyx_v_key));

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

static int __pyx_pf_5pysam_7libcbcf_19VariantRecordSample_19__contains__(struct __pyx_obj_5pysam_7libcbcf_VariantRecordSample *__pyx_v_self, PyObject *__pyx_v_key) {
  bcf_hdr_t *__pyx_v_hdr;
  bcf1_t *__pyx_v_r;
  PyObject *__pyx_v_bkey = 0;
  bcf_fmt_t *__pyx_v_fmt;
  int __pyx_r;
  __Pyx_TraceDeclarationsFunc
  __Pyx_RefNannyDeclarations
  bcf_hdr_t *__pyx_t_1;
  bcf1_t *__pyx_t_2;
  PyObject *__pyx_t_3 = NULL;
  char const *__pyx_t_4;
  int __pyx_t_5;
  int __pyx_t_6;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_TraceFrameInit(((PyObject *)__pyx_mstate_global->__pyx_codeobj_tab[305]))
  __Pyx_RefNannySetupContext("__contains__", 0);
  __Pyx_TraceStartFunc("__contains__", __pyx_f[0], 3577, 0, 0, 0, __PYX_ERR(0, 3577, __pyx_L1_error));

  /* "pysam/libcbcf.pyx":3578
 * 
 *     def __contains__(self, key):
 *         cdef bcf_hdr_t *hdr = self.record.header.ptr             # <<<<<<<<<<<<<<
 *         cdef bcf1_t *r = self.record.ptr
 *         cdef bytes bkey = force_bytes(key)
*/
  __pyx_t_1 = __pyx_v_self->record->header->ptr;
  __pyx_v_hdr = __pyx_t_1;

  /* "pysam/libcbcf.pyx":3579
 *     def __contains__(self, key):
 *         cdef bcf_hdr_t *hdr = self.record.header.ptr
 *         cdef bcf1_t *r = self.record.ptr             # <<<<<<<<<<<<<<
 *         cdef bytes bkey = force_bytes(key)
 *         cdef bcf_fmt_t *fmt = bcf_get_fmt(hdr, r, bkey)
*/
  __pyx_t_2 = __pyx_v_self->record->ptr;
  __pyx_v_r = __pyx_t_2;

  /* "pysam/libcbcf.pyx":3580
 *         cdef bcf_hdr_t *hdr = self.record.header.ptr
 *         cdef bcf1_t *r = self.record.ptr
 *         cdef bytes bkey = force_bytes(key)             # <<<<<<<<<<<<<<
 *         cdef bcf_fmt_t *fmt = bcf_get_fmt(hdr, r, bkey)
 *         return fmt != NULL and fmt.p != NULL
*/
  __pyx_t_3 = __pyx_f_5pysam_9libcutils_force_bytes(__pyx_v_key, NULL); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 3580, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __pyx_v_bkey = ((PyObject*)__pyx_t_3);
  __pyx_t_3 = 0;

  /* "pysam/libcbcf.pyx":3581
 *         cdef bcf1_t *r = self.record.ptr
 *         cdef bytes bkey = force_bytes(key)
 *         cdef bcf_fmt_t *fmt = bcf_get_fmt(hdr, r, bkey)             # <<<<<<<<<<<<<<
 *         return fmt != NULL and fmt.p != NULL
 * 
*/
  if (unlikely(__pyx_v_bkey == Py_None)) {
    PyErr_SetString(PyExc_TypeError, "expected bytes, NoneType found");
    __PYX_ERR(0, 3581, __pyx_L1_error)
  }
  __pyx_t_4 = __Pyx_PyBytes_AsString(__pyx_v_bkey); if (unlikely((!__pyx_t_4) && PyErr_Occurred())) __PYX_ERR(0, 3581, __pyx_L1_error)
  __pyx_v_fmt = bcf_get_fmt(__pyx_v_hdr, __pyx_v_r, __pyx_t_4);

  /* "pysam/libcbcf.pyx":3582
 *         cdef bytes bkey = force_bytes(key)
 *         cdef bcf_fmt_t *fmt = bcf_get_fmt(hdr, r, bkey)
 *         return fmt != NULL and fmt.p != NULL             # <<<<<<<<<<<<<<
 * 
 *     def iterkeys(self):
*/
  __pyx_t_6 = (__pyx_v_fmt != NULL);
  if (__pyx_t_6) {
  } else {
    __pyx_t_5 = __pyx_t_6;
    goto __pyx_L3_bool_binop_done;
  }
  __pyx_t_6 = (__pyx_v_fmt->p != NULL);
  __pyx_t_5 = __pyx_t_6;
  __pyx_L3_bool_binop_done:;
  __pyx_r = __pyx_t_5;
  __Pyx_TraceReturnCValue(__pyx_r, __Pyx_PyLong_From_int, 20, 0, __PYX_ERR(0, 3582, __pyx_L1_error));
  goto __pyx_L0;

  /* "pysam/libcbcf.pyx":3577
 *             return default
 * 
 *     def __contains__(self, key):             # <<<<<<<<<<<<<<
 *         cdef bcf_hdr_t *hdr = self.record.header.ptr
 *         cdef bcf1_t *r = self.record.ptr
*/

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_TraceException(__pyx_lineno, 0, 0);
  #if CYTHON_USE_SYS_MONITORING
  __Pyx_TraceExceptionUnwind(0, 0);
  #else
  __Pyx_TraceReturnValue(NULL, 0, 0, __PYX_ERR(0, 3577, __pyx_L1_error));
  #endif
  __Pyx_AddTraceback("pysam.libcbcf.VariantRecordSample.__contains__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = -1;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_bkey);
  __Pyx_PyMonitoring_ExitScope(0);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "pysam/libcbcf.pyx":3584
 *         return fmt != NULL and fmt.p != NULL
 * 
 *     def iterkeys(self):             # <<<<<<<<<<<<<<
 *         """D.iterkeys() -> an iterator over the keys of D"""
 *         return iter(self)
*/

/* Python wrapper */
static PyObject *__pyx_pw_5pysam_7libcbcf_19VariantRecordSample_22iterkeys(PyObject *__pyx_v_self, 
#if 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_5pysam_7libcbcf_19VariantRecordSample_21iterkeys, "VariantRecordSample.iterkeys(self)\n\nD.iterkeys() -> an iterator over the keys of D");
static PyMethodDef __pyx_mdef_5pysam_7libcbcf_19VariantRecordSample_22iterkeys = {"iterkeys", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_5pysam_7libcbcf_19VariantRecordSample_22iterkeys, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_5pysam_7libcbcf_19VariantRecordSample_21iterkeys};
static PyObject *__pyx_pw_5pysam_7libcbcf_19VariantRecordSample_22iterkeys(PyObject *__pyx_v_self, 
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
) {
  #if !CYTHON_METH_FASTCALL
  CYTHON_UNUSED Py_ssize_t __pyx_nargs;
  #endif
  CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("iterkeys (wrapper)", 0);
  #if !CYTHON_METH_FASTCALL
  #if CYTHON_ASSUME_SAFE_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("iterkeys", 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("iterkeys", __pyx_kwds); return NULL;}
  __pyx_r = __pyx_pf_5pysam_7libcbcf_19VariantRecordSample_21iterkeys(((struct __pyx_obj_5pysam_7libcbcf_VariantRecordSample *)__pyx_v_self));

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

static PyObject *__pyx_pf_5pysam_7libcbcf_19VariantRecordSample_21iterkeys(struct __pyx_obj_5pysam_7libcbcf_VariantRecordSample *__pyx_v_self) {
  PyObject *__pyx_r = NULL;
  __Pyx_TraceDeclarationsFunc
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_TraceFrameInit(((PyObject *)__pyx_mstate_global->__pyx_codeobj_tab[306]))
  __Pyx_RefNannySetupContext("iterkeys", 0);
  __Pyx_TraceStartFunc("iterkeys", __pyx_f[0], 3584, 0, 0, 0, __PYX_ERR(0, 3584, __pyx_L1_error));

  /* "pysam/libcbcf.pyx":3586
 *     def iterkeys(self):
 *         """D.iterkeys() -> an iterator over the keys of D"""
 *         return iter(self)             # <<<<<<<<<<<<<<
 * 
 *     def itervalues(self):
*/
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = PyObject_GetIter(((PyObject *)__pyx_v_self)); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 3586, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  __Pyx_TraceReturnValue(__pyx_r, 1, 0, __PYX_ERR(0, 3586, __pyx_L1_error));
  goto __pyx_L0;

  /* "pysam/libcbcf.pyx":3584
 *         return fmt != NULL and fmt.p != NULL
 * 
 *     def iterkeys(self):             # <<<<<<<<<<<<<<
 *         """D.iterkeys() -> an iterator over the keys of D"""
 *         return iter(self)
*/

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_TraceException(__pyx_lineno, 0, 0);
  #if CYTHON_USE_SYS_MONITORING
  __Pyx_TraceExceptionUnwind(0, 0);
  #else
  __Pyx_TraceReturnValue(NULL, 0, 0, __PYX_ERR(0, 3584, __pyx_L1_error));
  #endif
  __Pyx_AddTraceback("pysam.libcbcf.VariantRecordSample.iterkeys", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_PyMonitoring_ExitScope(0);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}
static PyObject *__pyx_gb_5pysam_7libcbcf_19VariantRecordSample_25generator24(__pyx_CoroutineObject *__pyx_generator, CYTHON_UNUSED PyThreadState *__pyx_tstate, PyObject *__pyx_sent_value); /* proto */

/* "pysam/libcbcf.pyx":3588
 *         return iter(self)
 * 
 *     def itervalues(self):             # <<<<<<<<<<<<<<
 *         """D.itervalues() -> an iterator over the values of D"""
 *         for key in self:
*/

/* Python wrapper */
static PyObject *__pyx_pw_5pysam_7libcbcf_19VariantRecordSample_24itervalues(PyObject *__pyx_v_self, 
#if 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_5pysam_7libcbcf_19VariantRecordSample_23itervalues, "VariantRecordSample.itervalues(self)\n\nD.itervalues() -> an iterator over the values of D");
static PyMethodDef __pyx_mdef_5pysam_7libcbcf_19VariantRecordSample_24itervalues = {"itervalues", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_5pysam_7libcbcf_19VariantRecordSample_24itervalues, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_5pysam_7libcbcf_19VariantRecordSample_23itervalues};
static PyObject *__pyx_pw_5pysam_7libcbcf_19VariantRecordSample_24itervalues(PyObject *__pyx_v_self, 
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
) {
  #if !CYTHON_METH_FASTCALL
  CYTHON_UNUSED Py_ssize_t __pyx_nargs;
  #endif
  CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("itervalues (wrapper)", 0);
  #if !CYTHON_METH_FASTCALL
  #if CYTHON_ASSUME_SAFE_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("itervalues", 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("itervalues", __pyx_kwds); return NULL;}
  __pyx_r = __pyx_pf_5pysam_7libcbcf_19VariantRecordSample_23itervalues(((struct __pyx_obj_5pysam_7libcbcf_VariantRecordSample *)__pyx_v_self));

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

static PyObject *__pyx_pf_5pysam_7libcbcf_19VariantRecordSample_23itervalues(struct __pyx_obj_5pysam_7libcbcf_VariantRecordSample *__pyx_v_self) {
  struct __pyx_obj_5pysam_7libcbcf___pyx_scope_struct_34_itervalues *__pyx_cur_scope;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("itervalues", 0);
  __pyx_cur_scope = (struct __pyx_obj_5pysam_7libcbcf___pyx_scope_struct_34_itervalues *)__pyx_tp_new_5pysam_7libcbcf___pyx_scope_struct_34_itervalues(__pyx_mstate_global->__pyx_ptype_5pysam_7libcbcf___pyx_scope_struct_34_itervalues, __pyx_mstate_global->__pyx_empty_tuple, NULL);
  if (unlikely(!__pyx_cur_scope)) {
    __pyx_cur_scope = ((struct __pyx_obj_5pysam_7libcbcf___pyx_scope_struct_34_itervalues *)Py_None);
    __Pyx_INCREF(Py_None);
    __PYX_ERR(0, 3588, __pyx_L1_error)
  } else {
    __Pyx_GOTREF((PyObject *)__pyx_cur_scope);
  }
  __pyx_cur_scope->__pyx_v_self = __pyx_v_self;
  __Pyx_INCREF((PyObject *)__pyx_cur_scope->__pyx_v_self);
  __Pyx_GIVEREF((PyObject *)__pyx_cur_scope->__pyx_v_self);
  {
    __pyx_CoroutineObject *gen = __Pyx_Generator_New((__pyx_coroutine_body_t) __pyx_gb_5pysam_7libcbcf_19VariantRecordSample_25generator24, ((PyObject *)__pyx_mstate_global->__pyx_codeobj_tab[307]), (PyObject *) __pyx_cur_scope, __pyx_mstate_global->__pyx_n_u_itervalues, __pyx_mstate_global->__pyx_n_u_VariantRecordSample_itervalues, __pyx_mstate_global->__pyx_n_u_pysam_libcbcf); if (unlikely(!gen)) __PYX_ERR(0, 3588, __pyx_L1_error)
    __Pyx_DECREF(__pyx_cur_scope);
    __Pyx_RefNannyFinishContext();
    return (PyObject *) gen;
  }

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_AddTraceback("pysam.libcbcf.VariantRecordSample.itervalues", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __Pyx_DECREF((PyObject *)__pyx_cur_scope);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_gb_5pysam_7libcbcf_19VariantRecordSample_25generator24(__pyx_CoroutineObject *__pyx_generator, CYTHON_UNUSED PyThreadState *__pyx_tstate, PyObject *__pyx_sent_value) /* generator body */
{
  struct __pyx_obj_5pysam_7libcbcf___pyx_scope_struct_34_itervalues *__pyx_cur_scope = ((struct __pyx_obj_5pysam_7libcbcf___pyx_scope_struct_34_itervalues *)__pyx_generator->closure);
  PyObject *__pyx_r = NULL;
  __Pyx_TraceDeclarationsGen
  PyObject *__pyx_t_1 = NULL;
  Py_ssize_t __pyx_t_2;
  PyObject *(*__pyx_t_3)(PyObject *);
  PyObject *__pyx_t_4 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("itervalues", 0);
  switch (__pyx_generator->resume_label) {
    case 0: goto __pyx_L3_first_run;
    case 1: goto __pyx_L6_resume_from_yield;
    default: /* CPython raises the right error here */
    __Pyx_TraceStartGen("itervalues", __pyx_f[0], 3588, 0, 0, 0, __PYX_ERR(0, 3588, __pyx_L1_error));
    __Pyx_TraceReturnValue(Py_None, 0, 0, __PYX_ERR(0, 3588, __pyx_L1_error));
    __Pyx_RefNannyFinishContext();
    return NULL;
  }
  __pyx_L3_first_run:;
  __Pyx_TraceStartGen("itervalues", __pyx_f[0], 3588, 0, 0, 0, __PYX_ERR(0, 3588, __pyx_L1_error));
  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, 3588, __pyx_L1_error)
  }

  /* "pysam/libcbcf.pyx":3590
 *     def itervalues(self):
 *         """D.itervalues() -> an iterator over the values of D"""
 *         for key in self:             # <<<<<<<<<<<<<<
 *             yield self[key]
 * 
*/
  if (likely(PyList_CheckExact(((PyObject *)__pyx_cur_scope->__pyx_v_self))) || PyTuple_CheckExact(((PyObject *)__pyx_cur_scope->__pyx_v_self))) {
    __pyx_t_1 = ((PyObject *)__pyx_cur_scope->__pyx_v_self); __Pyx_INCREF(__pyx_t_1);
    __pyx_t_2 = 0;
    __pyx_t_3 = NULL;
  } else {
    __pyx_t_2 = -1; __pyx_t_1 = PyObject_GetIter(((PyObject *)__pyx_cur_scope->__pyx_v_self)); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 3590, __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, 3590, __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, 3590, __pyx_L1_error)
          #endif
          if (__pyx_t_2 >= __pyx_temp) break;
        }
        __pyx_t_4 = __Pyx_PyList_GetItemRef(__pyx_t_1, __pyx_t_2);
        ++__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, 3590, __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, 3590, __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, 3590, __pyx_L1_error)
          PyErr_Clear();
        }
        break;
      }
    }
    __Pyx_GOTREF(__pyx_t_4);
    __Pyx_XGOTREF(__pyx_cur_scope->__pyx_v_key);
    __Pyx_XDECREF_SET(__pyx_cur_scope->__pyx_v_key, __pyx_t_4);
    __Pyx_GIVEREF(__pyx_t_4);
    __pyx_t_4 = 0;

    /* "pysam/libcbcf.pyx":3591
 *         """D.itervalues() -> an iterator over the values of D"""
 *         for key in self:
 *             yield self[key]             # <<<<<<<<<<<<<<
 * 
 *     def iteritems(self):
*/
    __pyx_t_4 = __Pyx_PyObject_GetItem(((PyObject *)__pyx_cur_scope->__pyx_v_self), __pyx_cur_scope->__pyx_v_key); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 3591, __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_TraceYield(__pyx_r, 0, __PYX_ERR(0, 3591, __pyx_L1_error));
    __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_TraceResumeGen("itervalues", __pyx_f[0], 3588, 0, __PYX_ERR(0, 3591, __pyx_L1_error));
    __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, 3591, __pyx_L1_error)

    /* "pysam/libcbcf.pyx":3590
 *     def itervalues(self):
 *         """D.itervalues() -> an iterator over the values of D"""
 *         for key in self:             # <<<<<<<<<<<<<<
 *             yield self[key]
 * 
*/
  }
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  CYTHON_MAYBE_UNUSED_VAR(__pyx_cur_scope);
  __Pyx_TraceReturnValue(Py_None, 0, 0, __PYX_ERR(0, 3588, __pyx_L1_error));

  /* "pysam/libcbcf.pyx":3588
 *         return iter(self)
 * 
 *     def itervalues(self):             # <<<<<<<<<<<<<<
 *         """D.itervalues() -> an iterator over the values of D"""
 *         for key in self:
*/

  /* 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_TraceException(__pyx_lineno, 0, 0);
    __Pyx_Generator_Replace_StopIteration(0);
    __Pyx_AddTraceback("itervalues", __pyx_clineno, __pyx_lineno, __pyx_filename);
    __Pyx_TraceExceptionUnwind(0, 0);
  }
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_PyMonitoring_ExitScope(0);
  #if !CYTHON_USE_EXC_INFO_STACK
  __Pyx_Coroutine_ResetAndClearException(__pyx_generator);
  #endif
  __pyx_generator->resume_label = -1;
  __Pyx_Coroutine_clear((PyObject*)__pyx_generator);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}
static PyObject *__pyx_gb_5pysam_7libcbcf_19VariantRecordSample_28generator25(__pyx_CoroutineObject *__pyx_generator, CYTHON_UNUSED PyThreadState *__pyx_tstate, PyObject *__pyx_sent_value); /* proto */

/* "pysam/libcbcf.pyx":3593
 *             yield self[key]
 * 
 *     def iteritems(self):             # <<<<<<<<<<<<<<
 *         """D.iteritems() -> an iterator over the (key, value) items of D"""
 *         for key in self:
*/

/* Python wrapper */
static PyObject *__pyx_pw_5pysam_7libcbcf_19VariantRecordSample_27iteritems(PyObject *__pyx_v_self, 
#if 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_5pysam_7libcbcf_19VariantRecordSample_26iteritems, "VariantRecordSample.iteritems(self)\n\nD.iteritems() -> an iterator over the (key, value) items of D");
static PyMethodDef __pyx_mdef_5pysam_7libcbcf_19VariantRecordSample_27iteritems = {"iteritems", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_5pysam_7libcbcf_19VariantRecordSample_27iteritems, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_5pysam_7libcbcf_19VariantRecordSample_26iteritems};
static PyObject *__pyx_pw_5pysam_7libcbcf_19VariantRecordSample_27iteritems(PyObject *__pyx_v_self, 
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
) {
  #if !CYTHON_METH_FASTCALL
  CYTHON_UNUSED Py_ssize_t __pyx_nargs;
  #endif
  CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("iteritems (wrapper)", 0);
  #if !CYTHON_METH_FASTCALL
  #if CYTHON_ASSUME_SAFE_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("iteritems", 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("iteritems", __pyx_kwds); return NULL;}
  __pyx_r = __pyx_pf_5pysam_7libcbcf_19VariantRecordSample_26iteritems(((struct __pyx_obj_5pysam_7libcbcf_VariantRecordSample *)__pyx_v_self));

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

static PyObject *__pyx_pf_5pysam_7libcbcf_19VariantRecordSample_26iteritems(struct __pyx_obj_5pysam_7libcbcf_VariantRecordSample *__pyx_v_self) {
  struct __pyx_obj_5pysam_7libcbcf___pyx_scope_struct_35_iteritems *__pyx_cur_scope;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("iteritems", 0);
  __pyx_cur_scope = (struct __pyx_obj_5pysam_7libcbcf___pyx_scope_struct_35_iteritems *)__pyx_tp_new_5pysam_7libcbcf___pyx_scope_struct_35_iteritems(__pyx_mstate_global->__pyx_ptype_5pysam_7libcbcf___pyx_scope_struct_35_iteritems, __pyx_mstate_global->__pyx_empty_tuple, NULL);
  if (unlikely(!__pyx_cur_scope)) {
    __pyx_cur_scope = ((struct __pyx_obj_5pysam_7libcbcf___pyx_scope_struct_35_iteritems *)Py_None);
    __Pyx_INCREF(Py_None);
    __PYX_ERR(0, 3593, __pyx_L1_error)
  } else {
    __Pyx_GOTREF((PyObject *)__pyx_cur_scope);
  }
  __pyx_cur_scope->__pyx_v_self = __pyx_v_self;
  __Pyx_INCREF((PyObject *)__pyx_cur_scope->__pyx_v_self);
  __Pyx_GIVEREF((PyObject *)__pyx_cur_scope->__pyx_v_self);
  {
    __pyx_CoroutineObject *gen = __Pyx_Generator_New((__pyx_coroutine_body_t) __pyx_gb_5pysam_7libcbcf_19VariantRecordSample_28generator25, ((PyObject *)__pyx_mstate_global->__pyx_codeobj_tab[308]), (PyObject *) __pyx_cur_scope, __pyx_mstate_global->__pyx_n_u_iteritems, __pyx_mstate_global->__pyx_n_u_VariantRecordSample_iteritems, __pyx_mstate_global->__pyx_n_u_pysam_libcbcf); if (unlikely(!gen)) __PYX_ERR(0, 3593, __pyx_L1_error)
    __Pyx_DECREF(__pyx_cur_scope);
    __Pyx_RefNannyFinishContext();
    return (PyObject *) gen;
  }

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_AddTraceback("pysam.libcbcf.VariantRecordSample.iteritems", __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_5pysam_7libcbcf_19VariantRecordSample_28generator25(__pyx_CoroutineObject *__pyx_generator, CYTHON_UNUSED PyThreadState *__pyx_tstate, PyObject *__pyx_sent_value) /* generator body */
{
  struct __pyx_obj_5pysam_7libcbcf___pyx_scope_struct_35_iteritems *__pyx_cur_scope = ((struct __pyx_obj_5pysam_7libcbcf___pyx_scope_struct_35_iteritems *)__pyx_generator->closure);
  PyObject *__pyx_r = NULL;
  __Pyx_TraceDeclarationsGen
  PyObject *__pyx_t_1 = NULL;
  Py_ssize_t __pyx_t_2;
  PyObject *(*__pyx_t_3)(PyObject *);
  PyObject *__pyx_t_4 = NULL;
  PyObject *__pyx_t_5 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("iteritems", 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_TraceStartGen("iteritems", __pyx_f[0], 3593, 0, 0, 0, __PYX_ERR(0, 3593, __pyx_L1_error));
    __Pyx_TraceReturnValue(Py_None, 0, 0, __PYX_ERR(0, 3593, __pyx_L1_error));
    __Pyx_RefNannyFinishContext();
    return NULL;
  }
  __pyx_L3_first_run:;
  __Pyx_TraceStartGen("iteritems", __pyx_f[0], 3593, 0, 0, 0, __PYX_ERR(0, 3593, __pyx_L1_error));
  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, 3593, __pyx_L1_error)
  }

  /* "pysam/libcbcf.pyx":3595
 *     def iteritems(self):
 *         """D.iteritems() -> an iterator over the (key, value) items of D"""
 *         for key in self:             # <<<<<<<<<<<<<<
 *             yield (key, self[key])
 * 
*/
  if (likely(PyList_CheckExact(((PyObject *)__pyx_cur_scope->__pyx_v_self))) || PyTuple_CheckExact(((PyObject *)__pyx_cur_scope->__pyx_v_self))) {
    __pyx_t_1 = ((PyObject *)__pyx_cur_scope->__pyx_v_self); __Pyx_INCREF(__pyx_t_1);
    __pyx_t_2 = 0;
    __pyx_t_3 = NULL;
  } else {
    __pyx_t_2 = -1; __pyx_t_1 = PyObject_GetIter(((PyObject *)__pyx_cur_scope->__pyx_v_self)); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 3595, __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, 3595, __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, 3595, __pyx_L1_error)
          #endif
          if (__pyx_t_2 >= __pyx_temp) break;
        }
        __pyx_t_4 = __Pyx_PyList_GetItemRef(__pyx_t_1, __pyx_t_2);
        ++__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, 3595, __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, 3595, __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, 3595, __pyx_L1_error)
          PyErr_Clear();
        }
        break;
      }
    }
    __Pyx_GOTREF(__pyx_t_4);
    __Pyx_XGOTREF(__pyx_cur_scope->__pyx_v_key);
    __Pyx_XDECREF_SET(__pyx_cur_scope->__pyx_v_key, __pyx_t_4);
    __Pyx_GIVEREF(__pyx_t_4);
    __pyx_t_4 = 0;

    /* "pysam/libcbcf.pyx":3596
 *         """D.iteritems() -> an iterator over the (key, value) items of D"""
 *         for key in self:
 *             yield (key, self[key])             # <<<<<<<<<<<<<<
 * 
 *     def keys(self):
*/
    __pyx_t_4 = __Pyx_PyObject_GetItem(((PyObject *)__pyx_cur_scope->__pyx_v_self), __pyx_cur_scope->__pyx_v_key); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 3596, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
    __pyx_t_5 = PyTuple_New(2); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 3596, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_5);
    __Pyx_INCREF(__pyx_cur_scope->__pyx_v_key);
    __Pyx_GIVEREF(__pyx_cur_scope->__pyx_v_key);
    if (__Pyx_PyTuple_SET_ITEM(__pyx_t_5, 0, __pyx_cur_scope->__pyx_v_key) != (0)) __PYX_ERR(0, 3596, __pyx_L1_error);
    __Pyx_GIVEREF(__pyx_t_4);
    if (__Pyx_PyTuple_SET_ITEM(__pyx_t_5, 1, __pyx_t_4) != (0)) __PYX_ERR(0, 3596, __pyx_L1_error);
    __pyx_t_4 = 0;
    __pyx_r = __pyx_t_5;
    __pyx_t_5 = 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_TraceYield(__pyx_r, 0, __PYX_ERR(0, 3596, __pyx_L1_error));
    __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_TraceResumeGen("iteritems", __pyx_f[0], 3593, 0, __PYX_ERR(0, 3596, __pyx_L1_error));
    __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, 3596, __pyx_L1_error)

    /* "pysam/libcbcf.pyx":3595
 *     def iteritems(self):
 *         """D.iteritems() -> an iterator over the (key, value) items of D"""
 *         for key in self:             # <<<<<<<<<<<<<<
 *             yield (key, self[key])
 * 
*/
  }
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  CYTHON_MAYBE_UNUSED_VAR(__pyx_cur_scope);
  __Pyx_TraceReturnValue(Py_None, 0, 0, __PYX_ERR(0, 3593, __pyx_L1_error));

  /* "pysam/libcbcf.pyx":3593
 *             yield self[key]
 * 
 *     def iteritems(self):             # <<<<<<<<<<<<<<
 *         """D.iteritems() -> an iterator over the (key, value) items of D"""
 *         for key in self:
*/

  /* 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);
  if (__Pyx_PyErr_Occurred()) {
    __Pyx_TraceException(__pyx_lineno, 0, 0);
    __Pyx_Generator_Replace_StopIteration(0);
    __Pyx_AddTraceback("iteritems", __pyx_clineno, __pyx_lineno, __pyx_filename);
    __Pyx_TraceExceptionUnwind(0, 0);
  }
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_PyMonitoring_ExitScope(0);
  #if !CYTHON_USE_EXC_INFO_STACK
  __Pyx_Coroutine_ResetAndClearException(__pyx_generator);
  #endif
  __pyx_generator->resume_label = -1;
  __Pyx_Coroutine_clear((PyObject*)__pyx_generator);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "pysam/libcbcf.pyx":3598
 *             yield (key, self[key])
 * 
 *     def keys(self):             # <<<<<<<<<<<<<<
 *         """D.keys() -> list of D's keys"""
 *         return list(self)
*/

/* Python wrapper */
static PyObject *__pyx_pw_5pysam_7libcbcf_19VariantRecordSample_30keys(PyObject *__pyx_v_self, 
#if 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_5pysam_7libcbcf_19VariantRecordSample_29keys, "VariantRecordSample.keys(self)\n\nD.keys() -> list of D's keys");
static PyMethodDef __pyx_mdef_5pysam_7libcbcf_19VariantRecordSample_30keys = {"keys", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_5pysam_7libcbcf_19VariantRecordSample_30keys, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_5pysam_7libcbcf_19VariantRecordSample_29keys};
static PyObject *__pyx_pw_5pysam_7libcbcf_19VariantRecordSample_30keys(PyObject *__pyx_v_self, 
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
) {
  #if !CYTHON_METH_FASTCALL
  CYTHON_UNUSED Py_ssize_t __pyx_nargs;
  #endif
  CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("keys (wrapper)", 0);
  #if !CYTHON_METH_FASTCALL
  #if CYTHON_ASSUME_SAFE_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("keys", 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("keys", __pyx_kwds); return NULL;}
  __pyx_r = __pyx_pf_5pysam_7libcbcf_19VariantRecordSample_29keys(((struct __pyx_obj_5pysam_7libcbcf_VariantRecordSample *)__pyx_v_self));

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

static PyObject *__pyx_pf_5pysam_7libcbcf_19VariantRecordSample_29keys(struct __pyx_obj_5pysam_7libcbcf_VariantRecordSample *__pyx_v_self) {
  PyObject *__pyx_r = NULL;
  __Pyx_TraceDeclarationsFunc
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_TraceFrameInit(((PyObject *)__pyx_mstate_global->__pyx_codeobj_tab[309]))
  __Pyx_RefNannySetupContext("keys", 0);
  __Pyx_TraceStartFunc("keys", __pyx_f[0], 3598, 0, 0, 0, __PYX_ERR(0, 3598, __pyx_L1_error));

  /* "pysam/libcbcf.pyx":3600
 *     def keys(self):
 *         """D.keys() -> list of D's keys"""
 *         return list(self)             # <<<<<<<<<<<<<<
 * 
 *     def items(self):
*/
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = PySequence_List(((PyObject *)__pyx_v_self)); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 3600, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  __Pyx_TraceReturnValue(__pyx_r, 1, 0, __PYX_ERR(0, 3600, __pyx_L1_error));
  goto __pyx_L0;

  /* "pysam/libcbcf.pyx":3598
 *             yield (key, self[key])
 * 
 *     def keys(self):             # <<<<<<<<<<<<<<
 *         """D.keys() -> list of D's keys"""
 *         return list(self)
*/

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_TraceException(__pyx_lineno, 0, 0);
  #if CYTHON_USE_SYS_MONITORING
  __Pyx_TraceExceptionUnwind(0, 0);
  #else
  __Pyx_TraceReturnValue(NULL, 0, 0, __PYX_ERR(0, 3598, __pyx_L1_error));
  #endif
  __Pyx_AddTraceback("pysam.libcbcf.VariantRecordSample.keys", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_PyMonitoring_ExitScope(0);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "pysam/libcbcf.pyx":3602
 *         return list(self)
 * 
 *     def items(self):             # <<<<<<<<<<<<<<
 *         """D.items() -> list of D's (key, value) pairs, as 2-tuples"""
 *         return list(self.iteritems())
*/

/* Python wrapper */
static PyObject *__pyx_pw_5pysam_7libcbcf_19VariantRecordSample_32items(PyObject *__pyx_v_self, 
#if 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_5pysam_7libcbcf_19VariantRecordSample_31items, "VariantRecordSample.items(self)\n\nD.items() -> list of D's (key, value) pairs, as 2-tuples");
static PyMethodDef __pyx_mdef_5pysam_7libcbcf_19VariantRecordSample_32items = {"items", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_5pysam_7libcbcf_19VariantRecordSample_32items, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_5pysam_7libcbcf_19VariantRecordSample_31items};
static PyObject *__pyx_pw_5pysam_7libcbcf_19VariantRecordSample_32items(PyObject *__pyx_v_self, 
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
) {
  #if !CYTHON_METH_FASTCALL
  CYTHON_UNUSED Py_ssize_t __pyx_nargs;
  #endif
  CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("items (wrapper)", 0);
  #if !CYTHON_METH_FASTCALL
  #if CYTHON_ASSUME_SAFE_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("items", 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("items", __pyx_kwds); return NULL;}
  __pyx_r = __pyx_pf_5pysam_7libcbcf_19VariantRecordSample_31items(((struct __pyx_obj_5pysam_7libcbcf_VariantRecordSample *)__pyx_v_self));

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

static PyObject *__pyx_pf_5pysam_7libcbcf_19VariantRecordSample_31items(struct __pyx_obj_5pysam_7libcbcf_VariantRecordSample *__pyx_v_self) {
  PyObject *__pyx_r = NULL;
  __Pyx_TraceDeclarationsFunc
  __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_TraceFrameInit(((PyObject *)__pyx_mstate_global->__pyx_codeobj_tab[310]))
  __Pyx_RefNannySetupContext("items", 0);
  __Pyx_TraceStartFunc("items", __pyx_f[0], 3602, 0, 0, 0, __PYX_ERR(0, 3602, __pyx_L1_error));

  /* "pysam/libcbcf.pyx":3604
 *     def items(self):
 *         """D.items() -> list of D's (key, value) pairs, as 2-tuples"""
 *         return list(self.iteritems())             # <<<<<<<<<<<<<<
 * 
 *     def values(self):
*/
  __Pyx_XDECREF(__pyx_r);
  __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(__pyx_mstate_global->__pyx_n_u_iteritems, __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, 3604, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
  }
  __pyx_t_2 = __Pyx_PySequence_ListKeepNew(__pyx_t_1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 3604, __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;
  __Pyx_TraceReturnValue(__pyx_r, 1, 0, __PYX_ERR(0, 3604, __pyx_L1_error));
  goto __pyx_L0;

  /* "pysam/libcbcf.pyx":3602
 *         return list(self)
 * 
 *     def items(self):             # <<<<<<<<<<<<<<
 *         """D.items() -> list of D's (key, value) pairs, as 2-tuples"""
 *         return list(self.iteritems())
*/

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_TraceException(__pyx_lineno, 0, 0);
  #if CYTHON_USE_SYS_MONITORING
  __Pyx_TraceExceptionUnwind(0, 0);
  #else
  __Pyx_TraceReturnValue(NULL, 0, 0, __PYX_ERR(0, 3602, __pyx_L1_error));
  #endif
  __Pyx_AddTraceback("pysam.libcbcf.VariantRecordSample.items", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_PyMonitoring_ExitScope(0);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "pysam/libcbcf.pyx":3606
 *         return list(self.iteritems())
 * 
 *     def values(self):             # <<<<<<<<<<<<<<
 *         """D.values() -> list of D's values"""
 *         return list(self.itervalues())
*/

/* Python wrapper */
static PyObject *__pyx_pw_5pysam_7libcbcf_19VariantRecordSample_34values(PyObject *__pyx_v_self, 
#if 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_5pysam_7libcbcf_19VariantRecordSample_33values, "VariantRecordSample.values(self)\n\nD.values() -> list of D's values");
static PyMethodDef __pyx_mdef_5pysam_7libcbcf_19VariantRecordSample_34values = {"values", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_5pysam_7libcbcf_19VariantRecordSample_34values, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_5pysam_7libcbcf_19VariantRecordSample_33values};
static PyObject *__pyx_pw_5pysam_7libcbcf_19VariantRecordSample_34values(PyObject *__pyx_v_self, 
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
) {
  #if !CYTHON_METH_FASTCALL
  CYTHON_UNUSED Py_ssize_t __pyx_nargs;
  #endif
  CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("values (wrapper)", 0);
  #if !CYTHON_METH_FASTCALL
  #if CYTHON_ASSUME_SAFE_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("values", 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("values", __pyx_kwds); return NULL;}
  __pyx_r = __pyx_pf_5pysam_7libcbcf_19VariantRecordSample_33values(((struct __pyx_obj_5pysam_7libcbcf_VariantRecordSample *)__pyx_v_self));

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

static PyObject *__pyx_pf_5pysam_7libcbcf_19VariantRecordSample_33values(struct __pyx_obj_5pysam_7libcbcf_VariantRecordSample *__pyx_v_self) {
  PyObject *__pyx_r = NULL;
  __Pyx_TraceDeclarationsFunc
  __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_TraceFrameInit(((PyObject *)__pyx_mstate_global->__pyx_codeobj_tab[311]))
  __Pyx_RefNannySetupContext("values", 0);
  __Pyx_TraceStartFunc("values", __pyx_f[0], 3606, 0, 0, 0, __PYX_ERR(0, 3606, __pyx_L1_error));

  /* "pysam/libcbcf.pyx":3608
 *     def values(self):
 *         """D.values() -> list of D's values"""
 *         return list(self.itervalues())             # <<<<<<<<<<<<<<
 * 
 *     def update(self, items=None, **kwargs):
*/
  __Pyx_XDECREF(__pyx_r);
  __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(__pyx_mstate_global->__pyx_n_u_itervalues, __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, 3608, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
  }
  __pyx_t_2 = __Pyx_PySequence_ListKeepNew(__pyx_t_1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 3608, __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;
  __Pyx_TraceReturnValue(__pyx_r, 1, 0, __PYX_ERR(0, 3608, __pyx_L1_error));
  goto __pyx_L0;

  /* "pysam/libcbcf.pyx":3606
 *         return list(self.iteritems())
 * 
 *     def values(self):             # <<<<<<<<<<<<<<
 *         """D.values() -> list of D's values"""
 *         return list(self.itervalues())
*/

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_TraceException(__pyx_lineno, 0, 0);
  #if CYTHON_USE_SYS_MONITORING
  __Pyx_TraceExceptionUnwind(0, 0);
  #else
  __Pyx_TraceReturnValue(NULL, 0, 0, __PYX_ERR(0, 3606, __pyx_L1_error));
  #endif
  __Pyx_AddTraceback("pysam.libcbcf.VariantRecordSample.values", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_PyMonitoring_ExitScope(0);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "pysam/libcbcf.pyx":3610
 *         return list(self.itervalues())
 * 
 *     def update(self, items=None, **kwargs):             # <<<<<<<<<<<<<<
 *         """D.update([E, ]**F) -> None.
 * 
*/

/* Python wrapper */
static PyObject *__pyx_pw_5pysam_7libcbcf_19VariantRecordSample_36update(PyObject *__pyx_v_self, 
#if 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_5pysam_7libcbcf_19VariantRecordSample_35update, "VariantRecordSample.update(self, items=None, **kwargs)\n\nD.update([E, ]**F) -> None.\n\nUpdate D from dict/iterable E and F.");
static PyMethodDef __pyx_mdef_5pysam_7libcbcf_19VariantRecordSample_36update = {"update", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_5pysam_7libcbcf_19VariantRecordSample_36update, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_5pysam_7libcbcf_19VariantRecordSample_35update};
static PyObject *__pyx_pw_5pysam_7libcbcf_19VariantRecordSample_36update(PyObject *__pyx_v_self, 
#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_items = 0;
  PyObject *__pyx_v_kwargs = 0;
  #if !CYTHON_METH_FASTCALL
  CYTHON_UNUSED Py_ssize_t __pyx_nargs;
  #endif
  CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
  PyObject* values[1] = {0};
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("update (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_kwargs = PyDict_New(); if (unlikely(!__pyx_v_kwargs)) return NULL;
  __Pyx_GOTREF(__pyx_v_kwargs);
  {
    PyObject ** const __pyx_pyargnames[] = {&__pyx_mstate_global->__pyx_n_u_items,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, 3610, __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, 3610, __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, __pyx_v_kwargs, values, kwd_pos_args, __pyx_kwds_len, "update", 1) < 0) __PYX_ERR(0, 3610, __pyx_L3_error)
      if (!values[0]) values[0] = __Pyx_NewRef(((PyObject *)Py_None));
    } 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, 3610, __pyx_L3_error)
        CYTHON_FALLTHROUGH;
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      if (!values[0]) values[0] = __Pyx_NewRef(((PyObject *)Py_None));
    }
    __pyx_v_items = values[0];
  }
  goto __pyx_L6_skip;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("update", 0, 0, 1, __pyx_nargs); __PYX_ERR(0, 3610, __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_kwargs); __pyx_v_kwargs = 0;
  __Pyx_AddTraceback("pysam.libcbcf.VariantRecordSample.update", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_5pysam_7libcbcf_19VariantRecordSample_35update(((struct __pyx_obj_5pysam_7libcbcf_VariantRecordSample *)__pyx_v_self), __pyx_v_items, __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_kwargs);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_5pysam_7libcbcf_19VariantRecordSample_35update(struct __pyx_obj_5pysam_7libcbcf_VariantRecordSample *__pyx_v_self, PyObject *__pyx_v_items, PyObject *__pyx_v_kwargs) {
  PyObject *__pyx_v_k = NULL;
  PyObject *__pyx_v_v = NULL;
  PyObject *__pyx_r = NULL;
  __Pyx_TraceDeclarationsFunc
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  Py_ssize_t __pyx_t_2;
  Py_ssize_t __pyx_t_3;
  int __pyx_t_4;
  PyObject *__pyx_t_5 = NULL;
  PyObject *__pyx_t_6 = NULL;
  int __pyx_t_7;
  int __pyx_t_8;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_TraceFrameInit(((PyObject *)__pyx_mstate_global->__pyx_codeobj_tab[312]))
  __Pyx_RefNannySetupContext("update", 0);
  __Pyx_TraceStartFunc("update", __pyx_f[0], 3610, 0, 0, 0, __PYX_ERR(0, 3610, __pyx_L1_error));

  /* "pysam/libcbcf.pyx":3615
 *         Update D from dict/iterable E and F.
 *         """
 *         for k, v in items.items():             # <<<<<<<<<<<<<<
 *             self[k] = v
 * 
*/
  __pyx_t_2 = 0;
  if (unlikely(__pyx_v_items == Py_None)) {
    PyErr_Format(PyExc_AttributeError, "'NoneType' object has no attribute '%.30s'", "items");
    __PYX_ERR(0, 3615, __pyx_L1_error)
  }
  __pyx_t_5 = __Pyx_dict_iterator(__pyx_v_items, 0, __pyx_mstate_global->__pyx_n_u_items, (&__pyx_t_3), (&__pyx_t_4)); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 3615, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_5);
  __Pyx_XDECREF(__pyx_t_1);
  __pyx_t_1 = __pyx_t_5;
  __pyx_t_5 = 0;
  while (1) {
    __pyx_t_7 = __Pyx_dict_iter_next(__pyx_t_1, __pyx_t_3, &__pyx_t_2, &__pyx_t_5, &__pyx_t_6, NULL, __pyx_t_4);
    if (unlikely(__pyx_t_7 == 0)) break;
    if (unlikely(__pyx_t_7 == -1)) __PYX_ERR(0, 3615, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_5);
    __Pyx_GOTREF(__pyx_t_6);
    __Pyx_XDECREF_SET(__pyx_v_k, __pyx_t_5);
    __pyx_t_5 = 0;
    __Pyx_XDECREF_SET(__pyx_v_v, __pyx_t_6);
    __pyx_t_6 = 0;

    /* "pysam/libcbcf.pyx":3616
 *         """
 *         for k, v in items.items():
 *             self[k] = v             # <<<<<<<<<<<<<<
 * 
 *         if kwargs:
*/
    if (unlikely((PyObject_SetItem(((PyObject *)__pyx_v_self), __pyx_v_k, __pyx_v_v) < 0))) __PYX_ERR(0, 3616, __pyx_L1_error)
  }
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "pysam/libcbcf.pyx":3618
 *             self[k] = v
 * 
 *         if kwargs:             # <<<<<<<<<<<<<<
 *             for k, v in kwargs.items():
 *                 self[k] = v
*/
  __pyx_t_8 = __Pyx_PyObject_IsTrue(__pyx_v_kwargs); if (unlikely((__pyx_t_8 < 0))) __PYX_ERR(0, 3618, __pyx_L1_error)
  if (__pyx_t_8) {

    /* "pysam/libcbcf.pyx":3619
 * 
 *         if kwargs:
 *             for k, v in kwargs.items():             # <<<<<<<<<<<<<<
 *                 self[k] = v
 * 
*/
    __pyx_t_3 = 0;
    __pyx_t_6 = __Pyx_dict_iterator(__pyx_v_kwargs, 1, __pyx_mstate_global->__pyx_n_u_items, (&__pyx_t_2), (&__pyx_t_4)); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 3619, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_6);
    __Pyx_XDECREF(__pyx_t_1);
    __pyx_t_1 = __pyx_t_6;
    __pyx_t_6 = 0;
    while (1) {
      __pyx_t_7 = __Pyx_dict_iter_next(__pyx_t_1, __pyx_t_2, &__pyx_t_3, &__pyx_t_6, &__pyx_t_5, NULL, __pyx_t_4);
      if (unlikely(__pyx_t_7 == 0)) break;
      if (unlikely(__pyx_t_7 == -1)) __PYX_ERR(0, 3619, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_6);
      __Pyx_GOTREF(__pyx_t_5);
      __Pyx_XDECREF_SET(__pyx_v_k, __pyx_t_6);
      __pyx_t_6 = 0;
      __Pyx_XDECREF_SET(__pyx_v_v, __pyx_t_5);
      __pyx_t_5 = 0;

      /* "pysam/libcbcf.pyx":3620
 *         if kwargs:
 *             for k, v in kwargs.items():
 *                 self[k] = v             # <<<<<<<<<<<<<<
 * 
 *     def pop(self, key, default=_nothing):
*/
      if (unlikely((PyObject_SetItem(((PyObject *)__pyx_v_self), __pyx_v_k, __pyx_v_v) < 0))) __PYX_ERR(0, 3620, __pyx_L1_error)
    }
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

    /* "pysam/libcbcf.pyx":3618
 *             self[k] = v
 * 
 *         if kwargs:             # <<<<<<<<<<<<<<
 *             for k, v in kwargs.items():
 *                 self[k] = v
*/
  }

  /* "pysam/libcbcf.pyx":3610
 *         return list(self.itervalues())
 * 
 *     def update(self, items=None, **kwargs):             # <<<<<<<<<<<<<<
 *         """D.update([E, ]**F) -> None.
 * 
*/

  /* function exit code */
  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  __Pyx_TraceReturnValue(__pyx_r, 0, 0, __PYX_ERR(0, 3610, __pyx_L1_error));
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_5);
  __Pyx_XDECREF(__pyx_t_6);
  __Pyx_TraceException(__pyx_lineno, 0, 0);
  #if CYTHON_USE_SYS_MONITORING
  __Pyx_TraceExceptionUnwind(0, 0);
  #else
  __Pyx_TraceReturnValue(NULL, 0, 0, __PYX_ERR(0, 3610, __pyx_L1_error));
  #endif
  __Pyx_AddTraceback("pysam.libcbcf.VariantRecordSample.update", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_k);
  __Pyx_XDECREF(__pyx_v_v);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_PyMonitoring_ExitScope(0);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "pysam/libcbcf.pyx":3622
 *                 self[k] = v
 * 
 *     def pop(self, key, default=_nothing):             # <<<<<<<<<<<<<<
 *         try:
 *             value = self[key]
*/

/* Python wrapper */
static PyObject *__pyx_pw_5pysam_7libcbcf_19VariantRecordSample_38pop(PyObject *__pyx_v_self, 
#if 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_5pysam_7libcbcf_19VariantRecordSample_37pop, "VariantRecordSample.pop(self, key, default=_nothing)");
static PyMethodDef __pyx_mdef_5pysam_7libcbcf_19VariantRecordSample_38pop = {"pop", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_5pysam_7libcbcf_19VariantRecordSample_38pop, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_5pysam_7libcbcf_19VariantRecordSample_37pop};
static PyObject *__pyx_pw_5pysam_7libcbcf_19VariantRecordSample_38pop(PyObject *__pyx_v_self, 
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
) {
  PyObject *__pyx_v_key = 0;
  PyObject *__pyx_v_default = 0;
  #if !CYTHON_METH_FASTCALL
  CYTHON_UNUSED Py_ssize_t __pyx_nargs;
  #endif
  CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
  PyObject* values[2] = {0,0};
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("pop (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,&__pyx_mstate_global->__pyx_n_u_default,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, 3622, __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, 3622, __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, 3622, __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, "pop", 0) < 0) __PYX_ERR(0, 3622, __pyx_L3_error)
      if (!values[1]) values[1] = __Pyx_NewRef(__pyx_mstate_global->__pyx_k__9);
      for (Py_ssize_t i = __pyx_nargs; i < 1; i++) {
        if (unlikely(!values[i])) { __Pyx_RaiseArgtupleInvalid("pop", 0, 1, 2, i); __PYX_ERR(0, 3622, __pyx_L3_error) }
      }
    } 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, 3622, __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, 3622, __pyx_L3_error)
        break;
        default: goto __pyx_L5_argtuple_error;
      }
      if (!values[1]) values[1] = __Pyx_NewRef(__pyx_mstate_global->__pyx_k__9);
    }
    __pyx_v_key = values[0];
    __pyx_v_default = values[1];
  }
  goto __pyx_L6_skip;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("pop", 0, 1, 2, __pyx_nargs); __PYX_ERR(0, 3622, __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("pysam.libcbcf.VariantRecordSample.pop", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_5pysam_7libcbcf_19VariantRecordSample_37pop(((struct __pyx_obj_5pysam_7libcbcf_VariantRecordSample *)__pyx_v_self), __pyx_v_key, __pyx_v_default);

  /* 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_5pysam_7libcbcf_19VariantRecordSample_37pop(struct __pyx_obj_5pysam_7libcbcf_VariantRecordSample *__pyx_v_self, PyObject *__pyx_v_key, PyObject *__pyx_v_default) {
  PyObject *__pyx_v_value = NULL;
  PyObject *__pyx_r = NULL;
  __Pyx_TraceDeclarationsFunc
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  PyObject *__pyx_t_4 = NULL;
  int __pyx_t_5;
  PyObject *__pyx_t_6 = NULL;
  PyObject *__pyx_t_7 = NULL;
  int __pyx_t_8;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_TraceFrameInit(((PyObject *)__pyx_mstate_global->__pyx_codeobj_tab[313]))
  __Pyx_RefNannySetupContext("pop", 0);
  __Pyx_TraceStartFunc("pop", __pyx_f[0], 3622, 0, 0, 0, __PYX_ERR(0, 3622, __pyx_L1_error));

  /* "pysam/libcbcf.pyx":3623
 * 
 *     def pop(self, key, default=_nothing):
 *         try:             # <<<<<<<<<<<<<<
 *             value = self[key]
 *             del self[key]
*/
  {
    __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:*/ {

      /* "pysam/libcbcf.pyx":3624
 *     def pop(self, key, default=_nothing):
 *         try:
 *             value = self[key]             # <<<<<<<<<<<<<<
 *             del self[key]
 *             return value
*/
      __pyx_t_4 = __Pyx_PyObject_GetItem(((PyObject *)__pyx_v_self), __pyx_v_key); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 3624, __pyx_L3_error)
      __Pyx_GOTREF(__pyx_t_4);
      __pyx_v_value = __pyx_t_4;
      __pyx_t_4 = 0;

      /* "pysam/libcbcf.pyx":3625
 *         try:
 *             value = self[key]
 *             del self[key]             # <<<<<<<<<<<<<<
 *             return value
 *         except KeyError:
*/
      if (unlikely((PyObject_DelItem(((PyObject *)__pyx_v_self), __pyx_v_key) < 0))) __PYX_ERR(0, 3625, __pyx_L3_error)

      /* "pysam/libcbcf.pyx":3626
 *             value = self[key]
 *             del self[key]
 *             return value             # <<<<<<<<<<<<<<
 *         except KeyError:
 *             if default is not _nothing:
*/
      __Pyx_XDECREF(__pyx_r);
      __Pyx_INCREF(__pyx_v_value);
      __pyx_r = __pyx_v_value;
      __Pyx_TraceReturnValue(__pyx_r, 11, 0, __PYX_ERR(0, 3626, __pyx_L3_error));
      goto __pyx_L7_try_return;

      /* "pysam/libcbcf.pyx":3623
 * 
 *     def pop(self, key, default=_nothing):
 *         try:             # <<<<<<<<<<<<<<
 *             value = self[key]
 *             del self[key]
*/
    }
    __pyx_L3_error:;
    __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
    __Pyx_TraceException(__pyx_lineno, 0, 0);

    /* "pysam/libcbcf.pyx":3627
 *             del self[key]
 *             return value
 *         except KeyError:             # <<<<<<<<<<<<<<
 *             if default is not _nothing:
 *                 return default
*/
    __pyx_t_5 = __Pyx_PyErr_ExceptionMatches(__pyx_builtin_KeyError);
    if (__pyx_t_5) {
      __Pyx_AddTraceback("pysam.libcbcf.VariantRecordSample.pop", __pyx_clineno, __pyx_lineno, __pyx_filename);
      __Pyx_TraceExceptionHandled(0);
      if (__Pyx_GetException(&__pyx_t_4, &__pyx_t_6, &__pyx_t_7) < 0) __PYX_ERR(0, 3627, __pyx_L5_except_error)
      __Pyx_XGOTREF(__pyx_t_4);
      __Pyx_XGOTREF(__pyx_t_6);
      __Pyx_XGOTREF(__pyx_t_7);
      __Pyx_TraceExceptionDone();

      /* "pysam/libcbcf.pyx":3628
 *             return value
 *         except KeyError:
 *             if default is not _nothing:             # <<<<<<<<<<<<<<
 *                 return default
 *             raise
*/
      __pyx_t_8 = (__pyx_v_default != __pyx_v_5pysam_7libcbcf__nothing);
      if (__pyx_t_8) {

        /* "pysam/libcbcf.pyx":3629
 *         except KeyError:
 *             if default is not _nothing:
 *                 return default             # <<<<<<<<<<<<<<
 *             raise
 * 
*/
        __Pyx_XDECREF(__pyx_r);
        __Pyx_INCREF(__pyx_v_default);
        __pyx_r = __pyx_v_default;
        __Pyx_TraceReturnValue(__pyx_r, 18, 0, __PYX_ERR(0, 3629, __pyx_L5_except_error));
        __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;

        /* "pysam/libcbcf.pyx":3628
 *             return value
 *         except KeyError:
 *             if default is not _nothing:             # <<<<<<<<<<<<<<
 *                 return default
 *             raise
*/
      }

      /* "pysam/libcbcf.pyx":3630
 *             if default is not _nothing:
 *                 return default
 *             raise             # <<<<<<<<<<<<<<
 * 
 *     def __richcmp__(VariantRecordSample self not None, VariantRecordSample other not None, int op):
*/
      __Pyx_GIVEREF(__pyx_t_4);
      __Pyx_GIVEREF(__pyx_t_6);
      __Pyx_XGIVEREF(__pyx_t_7);
      __Pyx_ErrRestoreWithState(__pyx_t_4, __pyx_t_6, __pyx_t_7);
      __pyx_t_4 = 0;  __pyx_t_6 = 0;  __pyx_t_7 = 0; 
      __Pyx_TraceException(20, 1, 0);
      __PYX_ERR(0, 3630, __pyx_L5_except_error)
    }
    goto __pyx_L5_except_error;

    /* "pysam/libcbcf.pyx":3623
 * 
 *     def pop(self, key, default=_nothing):
 *         try:             # <<<<<<<<<<<<<<
 *             value = self[key]
 *             del self[key]
*/
    __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;
  }

  /* "pysam/libcbcf.pyx":3622
 *                 self[k] = v
 * 
 *     def pop(self, key, default=_nothing):             # <<<<<<<<<<<<<<
 *         try:
 *             value = self[key]
*/

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_XDECREF(__pyx_t_6);
  __Pyx_XDECREF(__pyx_t_7);
  __Pyx_TraceException(__pyx_lineno, 0, 0);
  #if CYTHON_USE_SYS_MONITORING
  __Pyx_TraceExceptionUnwind(0, 0);
  #else
  __Pyx_TraceReturnValue(NULL, 0, 0, __PYX_ERR(0, 3622, __pyx_L1_error));
  #endif
  __Pyx_AddTraceback("pysam.libcbcf.VariantRecordSample.pop", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_value);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_PyMonitoring_ExitScope(0);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "pysam/libcbcf.pyx":3632
 *             raise
 * 
 *     def __richcmp__(VariantRecordSample self not None, VariantRecordSample other not None, int op):             # <<<<<<<<<<<<<<
 *         if op != 2 and op != 3:
 *             return NotImplemented
*/

/* Python wrapper */
static PyObject *__pyx_pw_5pysam_7libcbcf_19VariantRecordSample_40__richcmp__(PyObject *__pyx_v_self, PyObject *__pyx_v_other, int __pyx_v_op); /*proto*/
static PyObject *__pyx_pw_5pysam_7libcbcf_19VariantRecordSample_40__richcmp__(PyObject *__pyx_v_self, PyObject *__pyx_v_other, int __pyx_v_op) {
  CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__richcmp__ (wrapper)", 0);
  __pyx_kwvalues = __Pyx_KwValues_VARARGS(__pyx_args, __pyx_nargs);
  if (unlikely(((PyObject *)__pyx_v_self) == Py_None)) {
    PyErr_Format(PyExc_TypeError, "Argument '%.200s' must not be None", "self"); __PYX_ERR(0, 3632, __pyx_L1_error)
  }
  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_other), __pyx_mstate_global->__pyx_ptype_5pysam_7libcbcf_VariantRecordSample, 0, "other", 0))) __PYX_ERR(0, 3632, __pyx_L1_error)
  __pyx_r = __pyx_pf_5pysam_7libcbcf_19VariantRecordSample_39__richcmp__(((struct __pyx_obj_5pysam_7libcbcf_VariantRecordSample *)__pyx_v_self), ((struct __pyx_obj_5pysam_7libcbcf_VariantRecordSample *)__pyx_v_other), ((int)__pyx_v_op));

  /* function exit code */
  goto __pyx_L0;
  __pyx_L1_error:;
  __pyx_r = NULL;
  goto __pyx_L5_cleaned_up;
  __pyx_L0:;
  __pyx_L5_cleaned_up:;
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_5pysam_7libcbcf_19VariantRecordSample_39__richcmp__(struct __pyx_obj_5pysam_7libcbcf_VariantRecordSample *__pyx_v_self, struct __pyx_obj_5pysam_7libcbcf_VariantRecordSample *__pyx_v_other, int __pyx_v_op) {
  int __pyx_v_cmp;
  PyObject *__pyx_r = NULL;
  __Pyx_TraceDeclarationsFunc
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  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_TraceFrameInit(((PyObject *)__pyx_mstate_global->__pyx_codeobj_tab[314]))
  __Pyx_RefNannySetupContext("__richcmp__", 0);
  __Pyx_TraceStartFunc("__richcmp__", __pyx_f[0], 3632, 0, 0, 0, __PYX_ERR(0, 3632, __pyx_L1_error));

  /* "pysam/libcbcf.pyx":3633
 * 
 *     def __richcmp__(VariantRecordSample self not None, VariantRecordSample other not None, int op):
 *         if op != 2 and op != 3:             # <<<<<<<<<<<<<<
 *             return NotImplemented
 * 
*/
  switch (__pyx_v_op) {
    case 2:
    case 3:
    __pyx_t_1 = 0;
    break;
    default:
    __pyx_t_1 = 1;
    break;
  }
  if (__pyx_t_1) {

    /* "pysam/libcbcf.pyx":3634
 *     def __richcmp__(VariantRecordSample self not None, VariantRecordSample other not None, int op):
 *         if op != 2 and op != 3:
 *             return NotImplemented             # <<<<<<<<<<<<<<
 * 
 *         cdef bint cmp = dict(self) == dict(other)
*/
    __Pyx_XDECREF(__pyx_r);
    __Pyx_INCREF(__pyx_builtin_NotImplemented);
    __pyx_r = __pyx_builtin_NotImplemented;
    __Pyx_TraceReturnValue(__pyx_r, 9, 0, __PYX_ERR(0, 3634, __pyx_L1_error));
    goto __pyx_L0;

    /* "pysam/libcbcf.pyx":3633
 * 
 *     def __richcmp__(VariantRecordSample self not None, VariantRecordSample other not None, int op):
 *         if op != 2 and op != 3:             # <<<<<<<<<<<<<<
 *             return NotImplemented
 * 
*/
  }

  /* "pysam/libcbcf.pyx":3636
 *             return NotImplemented
 * 
 *         cdef bint cmp = dict(self) == dict(other)             # <<<<<<<<<<<<<<
 * 
 *         if op == 3:
*/
  __pyx_t_3 = NULL;
  __Pyx_INCREF((PyObject *)(&PyDict_Type));
  __pyx_t_4 = ((PyObject *)(&PyDict_Type)); 
  __pyx_t_5 = 1;
  {
    PyObject *__pyx_callargs[2] = {__pyx_t_3, ((PyObject *)__pyx_v_self)};
    __pyx_t_2 = __Pyx_PyObject_FastCall(__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_2)) __PYX_ERR(0, 3636, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
  }
  __pyx_t_3 = NULL;
  __Pyx_INCREF((PyObject *)(&PyDict_Type));
  __pyx_t_6 = ((PyObject *)(&PyDict_Type)); 
  __pyx_t_5 = 1;
  {
    PyObject *__pyx_callargs[2] = {__pyx_t_3, ((PyObject *)__pyx_v_other)};
    __pyx_t_4 = __Pyx_PyObject_FastCall(__pyx_t_6, __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_6); __pyx_t_6 = 0;
    if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 3636, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
  }
  __pyx_t_6 = PyObject_RichCompare(__pyx_t_2, __pyx_t_4, Py_EQ); __Pyx_XGOTREF(__pyx_t_6); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 3636, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  __pyx_t_1 = __Pyx_PyObject_IsTrue(__pyx_t_6); if (unlikely((__pyx_t_1 == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 3636, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
  __pyx_v_cmp = __pyx_t_1;

  /* "pysam/libcbcf.pyx":3638
 *         cdef bint cmp = dict(self) == dict(other)
 * 
 *         if op == 3:             # <<<<<<<<<<<<<<
 *             cmp = not cmp
 * 
*/
  __pyx_t_1 = (__pyx_v_op == 3);
  if (__pyx_t_1) {

    /* "pysam/libcbcf.pyx":3639
 * 
 *         if op == 3:
 *             cmp = not cmp             # <<<<<<<<<<<<<<
 * 
 *         return cmp
*/
    __pyx_v_cmp = (!__pyx_v_cmp);

    /* "pysam/libcbcf.pyx":3638
 *         cdef bint cmp = dict(self) == dict(other)
 * 
 *         if op == 3:             # <<<<<<<<<<<<<<
 *             cmp = not cmp
 * 
*/
  }

  /* "pysam/libcbcf.pyx":3641
 *             cmp = not cmp
 * 
 *         return cmp             # <<<<<<<<<<<<<<
 * 
 *     # Mappings are not hashable by default, but subclasses can change this
*/
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_6 = __Pyx_PyBool_FromLong(__pyx_v_cmp); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 3641, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_6);
  __pyx_r = __pyx_t_6;
  __pyx_t_6 = 0;
  __Pyx_TraceReturnValue(__pyx_r, 26, 0, __PYX_ERR(0, 3641, __pyx_L1_error));
  goto __pyx_L0;

  /* "pysam/libcbcf.pyx":3632
 *             raise
 * 
 *     def __richcmp__(VariantRecordSample self not None, VariantRecordSample other not None, int op):             # <<<<<<<<<<<<<<
 *         if op != 2 and op != 3:
 *             return NotImplemented
*/

  /* 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_6);
  __Pyx_TraceException(__pyx_lineno, 0, 0);
  #if CYTHON_USE_SYS_MONITORING
  __Pyx_TraceExceptionUnwind(0, 0);
  #else
  __Pyx_TraceReturnValue(NULL, 0, 0, __PYX_ERR(0, 3632, __pyx_L1_error));
  #endif
  __Pyx_AddTraceback("pysam.libcbcf.VariantRecordSample.__richcmp__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_PyMonitoring_ExitScope(0);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "pysam/libcbcf.pxd":103
 * cdef class VariantRecordSample(object):
 *     cdef VariantRecord record
 *     cdef readonly int32_t index             # <<<<<<<<<<<<<<
 * 
 * 
*/

/* Python wrapper */
static PyObject *__pyx_pw_5pysam_7libcbcf_19VariantRecordSample_5index_1__get__(PyObject *__pyx_v_self); /*proto*/
static PyObject *__pyx_pw_5pysam_7libcbcf_19VariantRecordSample_5index_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_5pysam_7libcbcf_19VariantRecordSample_5index___get__(((struct __pyx_obj_5pysam_7libcbcf_VariantRecordSample *)__pyx_v_self));

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

static PyObject *__pyx_pf_5pysam_7libcbcf_19VariantRecordSample_5index___get__(struct __pyx_obj_5pysam_7libcbcf_VariantRecordSample *__pyx_v_self) {
  PyObject *__pyx_r = NULL;
  __Pyx_TraceDeclarationsFunc
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_TraceFrameInit(((PyObject *)__pyx_mstate_global->__pyx_codeobj_tab[315]))
  __Pyx_RefNannySetupContext("__get__", 0);
  __Pyx_TraceStartFunc("__get__", __pyx_f[3], 103, 0, 0, 0, __PYX_ERR(3, 103, __pyx_L1_error));
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = __Pyx_PyLong_From_int32_t(__pyx_v_self->index); if (unlikely(!__pyx_t_1)) __PYX_ERR(3, 103, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  __Pyx_TraceReturnValue(__pyx_r, 0, 0, __PYX_ERR(3, 103, __pyx_L1_error));
  goto __pyx_L0;

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_TraceException(__pyx_lineno, 0, 0);
  #if CYTHON_USE_SYS_MONITORING
  __Pyx_TraceExceptionUnwind(0, 0);
  #else
  __Pyx_TraceReturnValue(NULL, 0, 0, __PYX_ERR(3, 103, __pyx_L1_error));
  #endif
  __Pyx_AddTraceback("pysam.libcbcf.VariantRecordSample.index.__get__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_PyMonitoring_ExitScope(0);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

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

/* Python wrapper */
static PyObject *__pyx_pw_5pysam_7libcbcf_19VariantRecordSample_42__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*/
PyDoc_STRVAR(__pyx_doc_5pysam_7libcbcf_19VariantRecordSample_41__reduce_cython__, "VariantRecordSample.__reduce_cython__(self)");
static PyMethodDef __pyx_mdef_5pysam_7libcbcf_19VariantRecordSample_42__reduce_cython__ = {"__reduce_cython__", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_5pysam_7libcbcf_19VariantRecordSample_42__reduce_cython__, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_5pysam_7libcbcf_19VariantRecordSample_41__reduce_cython__};
static PyObject *__pyx_pw_5pysam_7libcbcf_19VariantRecordSample_42__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_5pysam_7libcbcf_19VariantRecordSample_41__reduce_cython__(((struct __pyx_obj_5pysam_7libcbcf_VariantRecordSample *)__pyx_v_self));

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

static PyObject *__pyx_pf_5pysam_7libcbcf_19VariantRecordSample_41__reduce_cython__(struct __pyx_obj_5pysam_7libcbcf_VariantRecordSample *__pyx_v_self) {
  PyObject *__pyx_v_state = 0;
  PyObject *__pyx_v__dict = 0;
  int __pyx_v_use_setstate;
  PyObject *__pyx_r = NULL;
  __Pyx_TraceDeclarationsFunc
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  int __pyx_t_3;
  PyObject *__pyx_t_4 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_TraceFrameInit(((PyObject *)__pyx_mstate_global->__pyx_codeobj_tab[316]))
  __Pyx_RefNannySetupContext("__reduce_cython__", 0);
  __Pyx_TraceStartFunc("__reduce_cython__", __pyx_f[4], 1, 0, 0, 0, __PYX_ERR(4, 1, __pyx_L1_error));

  /* "(tree fragment)":5
 *     cdef object _dict
 *     cdef bint use_setstate
 *     state = (self.index, self.record)             # <<<<<<<<<<<<<<
 *     _dict = getattr(self, '__dict__', None)
 *     if _dict is not None:
*/
  __pyx_t_1 = __Pyx_PyLong_From_int32_t(__pyx_v_self->index); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 5, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_2 = PyTuple_New(2); if (unlikely(!__pyx_t_2)) __PYX_ERR(4, 5, __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(4, 5, __pyx_L1_error);
  __Pyx_INCREF((PyObject *)__pyx_v_self->record);
  __Pyx_GIVEREF((PyObject *)__pyx_v_self->record);
  if (__Pyx_PyTuple_SET_ITEM(__pyx_t_2, 1, ((PyObject *)__pyx_v_self->record)) != (0)) __PYX_ERR(4, 5, __pyx_L1_error);
  __pyx_t_1 = 0;
  __pyx_v_state = ((PyObject*)__pyx_t_2);
  __pyx_t_2 = 0;

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

  /* "(tree fragment)":7
 *     state = (self.index, self.record)
 *     _dict = getattr(self, '__dict__', None)
 *     if _dict is not None:             # <<<<<<<<<<<<<<
 *         state += (_dict,)
 *         use_setstate = True
*/
  __pyx_t_3 = (__pyx_v__dict != Py_None);
  if (__pyx_t_3) {

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

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

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

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

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

    /* "(tree fragment)":13
 *         use_setstate = self.record is not None
 *     if use_setstate:
 *         return __pyx_unpickle_VariantRecordSample, (type(self), 0xeeb89f3, None), state             # <<<<<<<<<<<<<<
 *     else:
 *         return __pyx_unpickle_VariantRecordSample, (type(self), 0xeeb89f3, state)
*/
    __Pyx_XDECREF(__pyx_r);
    __Pyx_GetModuleGlobalName(__pyx_t_1, __pyx_mstate_global->__pyx_n_u_pyx_unpickle_VariantRecordSamp_2); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 13, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __pyx_t_2 = PyTuple_New(3); if (unlikely(!__pyx_t_2)) __PYX_ERR(4, 13, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __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_2, 0, ((PyObject *)Py_TYPE(((PyObject *)__pyx_v_self)))) != (0)) __PYX_ERR(4, 13, __pyx_L1_error);
    __Pyx_INCREF(__pyx_mstate_global->__pyx_int_250317299);
    __Pyx_GIVEREF(__pyx_mstate_global->__pyx_int_250317299);
    if (__Pyx_PyTuple_SET_ITEM(__pyx_t_2, 1, __pyx_mstate_global->__pyx_int_250317299) != (0)) __PYX_ERR(4, 13, __pyx_L1_error);
    __Pyx_INCREF(Py_None);
    __Pyx_GIVEREF(Py_None);
    if (__Pyx_PyTuple_SET_ITEM(__pyx_t_2, 2, Py_None) != (0)) __PYX_ERR(4, 13, __pyx_L1_error);
    __pyx_t_4 = PyTuple_New(3); if (unlikely(!__pyx_t_4)) __PYX_ERR(4, 13, __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(4, 13, __pyx_L1_error);
    __Pyx_GIVEREF(__pyx_t_2);
    if (__Pyx_PyTuple_SET_ITEM(__pyx_t_4, 1, __pyx_t_2) != (0)) __PYX_ERR(4, 13, __pyx_L1_error);
    __Pyx_INCREF(__pyx_v_state);
    __Pyx_GIVEREF(__pyx_v_state);
    if (__Pyx_PyTuple_SET_ITEM(__pyx_t_4, 2, __pyx_v_state) != (0)) __PYX_ERR(4, 13, __pyx_L1_error);
    __pyx_t_1 = 0;
    __pyx_t_2 = 0;
    __pyx_r = __pyx_t_4;
    __pyx_t_4 = 0;
    __Pyx_TraceReturnValue(__pyx_r, 27, 0, __PYX_ERR(4, 13, __pyx_L1_error));
    goto __pyx_L0;

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

  /* "(tree fragment)":15
 *         return __pyx_unpickle_VariantRecordSample, (type(self), 0xeeb89f3, None), state
 *     else:
 *         return __pyx_unpickle_VariantRecordSample, (type(self), 0xeeb89f3, state)             # <<<<<<<<<<<<<<
 * def __setstate_cython__(self, __pyx_state):
 *     __pyx_unpickle_VariantRecordSample__set_state(self, __pyx_state)
*/
  /*else*/ {
    __Pyx_XDECREF(__pyx_r);
    __Pyx_GetModuleGlobalName(__pyx_t_4, __pyx_mstate_global->__pyx_n_u_pyx_unpickle_VariantRecordSamp_2); if (unlikely(!__pyx_t_4)) __PYX_ERR(4, 15, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
    __pyx_t_2 = PyTuple_New(3); if (unlikely(!__pyx_t_2)) __PYX_ERR(4, 15, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __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_2, 0, ((PyObject *)Py_TYPE(((PyObject *)__pyx_v_self)))) != (0)) __PYX_ERR(4, 15, __pyx_L1_error);
    __Pyx_INCREF(__pyx_mstate_global->__pyx_int_250317299);
    __Pyx_GIVEREF(__pyx_mstate_global->__pyx_int_250317299);
    if (__Pyx_PyTuple_SET_ITEM(__pyx_t_2, 1, __pyx_mstate_global->__pyx_int_250317299) != (0)) __PYX_ERR(4, 15, __pyx_L1_error);
    __Pyx_INCREF(__pyx_v_state);
    __Pyx_GIVEREF(__pyx_v_state);
    if (__Pyx_PyTuple_SET_ITEM(__pyx_t_2, 2, __pyx_v_state) != (0)) __PYX_ERR(4, 15, __pyx_L1_error);
    __pyx_t_1 = PyTuple_New(2); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 15, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_GIVEREF(__pyx_t_4);
    if (__Pyx_PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_t_4) != (0)) __PYX_ERR(4, 15, __pyx_L1_error);
    __Pyx_GIVEREF(__pyx_t_2);
    if (__Pyx_PyTuple_SET_ITEM(__pyx_t_1, 1, __pyx_t_2) != (0)) __PYX_ERR(4, 15, __pyx_L1_error);
    __pyx_t_4 = 0;
    __pyx_t_2 = 0;
    __pyx_r = __pyx_t_1;
    __pyx_t_1 = 0;
    __Pyx_TraceReturnValue(__pyx_r, 35, 0, __PYX_ERR(4, 15, __pyx_L1_error));
    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_2);
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_TraceException(__pyx_lineno, 0, 0);
  #if CYTHON_USE_SYS_MONITORING
  __Pyx_TraceExceptionUnwind(0, 0);
  #else
  __Pyx_TraceReturnValue(NULL, 0, 0, __PYX_ERR(4, 1, __pyx_L1_error));
  #endif
  __Pyx_AddTraceback("pysam.libcbcf.VariantRecordSample.__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_PyMonitoring_ExitScope(0);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "(tree fragment)":16
 *     else:
 *         return __pyx_unpickle_VariantRecordSample, (type(self), 0xeeb89f3, state)
 * def __setstate_cython__(self, __pyx_state):             # <<<<<<<<<<<<<<
 *     __pyx_unpickle_VariantRecordSample__set_state(self, __pyx_state)
*/

/* Python wrapper */
static PyObject *__pyx_pw_5pysam_7libcbcf_19VariantRecordSample_44__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*/
PyDoc_STRVAR(__pyx_doc_5pysam_7libcbcf_19VariantRecordSample_43__setstate_cython__, "VariantRecordSample.__setstate_cython__(self, __pyx_state)");
static PyMethodDef __pyx_mdef_5pysam_7libcbcf_19VariantRecordSample_44__setstate_cython__ = {"__setstate_cython__", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_5pysam_7libcbcf_19VariantRecordSample_44__setstate_cython__, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_5pysam_7libcbcf_19VariantRecordSample_43__setstate_cython__};
static PyObject *__pyx_pw_5pysam_7libcbcf_19VariantRecordSample_44__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(4, 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(4, 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(4, 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(4, 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(4, 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(4, 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("pysam.libcbcf.VariantRecordSample.__setstate_cython__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_5pysam_7libcbcf_19VariantRecordSample_43__setstate_cython__(((struct __pyx_obj_5pysam_7libcbcf_VariantRecordSample *)__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_5pysam_7libcbcf_19VariantRecordSample_43__setstate_cython__(struct __pyx_obj_5pysam_7libcbcf_VariantRecordSample *__pyx_v_self, PyObject *__pyx_v___pyx_state) {
  PyObject *__pyx_r = NULL;
  __Pyx_TraceDeclarationsFunc
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_TraceFrameInit(((PyObject *)__pyx_mstate_global->__pyx_codeobj_tab[317]))
  __Pyx_RefNannySetupContext("__setstate_cython__", 0);
  __Pyx_TraceStartFunc("__setstate_cython__", __pyx_f[4], 16, 0, 0, 0, __PYX_ERR(4, 16, __pyx_L1_error));

  /* "(tree fragment)":17
 *         return __pyx_unpickle_VariantRecordSample, (type(self), 0xeeb89f3, state)
 * def __setstate_cython__(self, __pyx_state):
 *     __pyx_unpickle_VariantRecordSample__set_state(self, __pyx_state)             # <<<<<<<<<<<<<<
*/
  if (!(likely(PyTuple_CheckExact(__pyx_v___pyx_state))||((__pyx_v___pyx_state) == Py_None) || __Pyx_RaiseUnexpectedTypeError("tuple", __pyx_v___pyx_state))) __PYX_ERR(4, 17, __pyx_L1_error)
  __pyx_t_1 = __pyx_f_5pysam_7libcbcf___pyx_unpickle_VariantRecordSample__set_state(__pyx_v_self, ((PyObject*)__pyx_v___pyx_state)); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 17, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "(tree fragment)":16
 *     else:
 *         return __pyx_unpickle_VariantRecordSample, (type(self), 0xeeb89f3, state)
 * def __setstate_cython__(self, __pyx_state):             # <<<<<<<<<<<<<<
 *     __pyx_unpickle_VariantRecordSample__set_state(self, __pyx_state)
*/

  /* function exit code */
  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  __Pyx_TraceReturnValue(__pyx_r, 0, 0, __PYX_ERR(4, 16, __pyx_L1_error));
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_TraceException(__pyx_lineno, 0, 0);
  #if CYTHON_USE_SYS_MONITORING
  __Pyx_TraceExceptionUnwind(0, 0);
  #else
  __Pyx_TraceReturnValue(NULL, 0, 0, __PYX_ERR(4, 16, __pyx_L1_error));
  #endif
  __Pyx_AddTraceback("pysam.libcbcf.VariantRecordSample.__setstate_cython__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_PyMonitoring_ExitScope(0);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "pysam/libcbcf.pyx":3647
 * 
 * 
 * cdef VariantRecordSample makeVariantRecordSample(VariantRecord record, int32_t sample_index):             # <<<<<<<<<<<<<<
 *     if not record or sample_index < 0:
 *         raise ValueError('cannot create VariantRecordSample')
*/

static struct __pyx_obj_5pysam_7libcbcf_VariantRecordSample *__pyx_f_5pysam_7libcbcf_makeVariantRecordSample(struct __pyx_obj_5pysam_7libcbcf_VariantRecord *__pyx_v_record, int32_t __pyx_v_sample_index) {
  struct __pyx_obj_5pysam_7libcbcf_VariantRecordSample *__pyx_v_sample = 0;
  struct __pyx_obj_5pysam_7libcbcf_VariantRecordSample *__pyx_r = NULL;
  __Pyx_TraceDeclarationsFunc
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  int __pyx_t_2;
  int __pyx_t_3;
  PyObject *__pyx_t_4 = NULL;
  PyObject *__pyx_t_5 = NULL;
  PyObject *__pyx_t_6 = NULL;
  size_t __pyx_t_7;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_TraceFrameInit(((PyObject *)__pyx_mstate_global->__pyx_codeobj_tab[318]))
  __Pyx_RefNannySetupContext("makeVariantRecordSample", 0);
  __Pyx_TraceStartFunc("makeVariantRecordSample", __pyx_f[0], 3647, 0, 0, 0, __PYX_ERR(0, 3647, __pyx_L1_error));

  /* "pysam/libcbcf.pyx":3648
 * 
 * cdef VariantRecordSample makeVariantRecordSample(VariantRecord record, int32_t sample_index):
 *     if not record or sample_index < 0:             # <<<<<<<<<<<<<<
 *         raise ValueError('cannot create VariantRecordSample')
 * 
*/
  __pyx_t_2 = __Pyx_PyObject_IsTrue(((PyObject *)__pyx_v_record)); if (unlikely((__pyx_t_2 < 0))) __PYX_ERR(0, 3648, __pyx_L1_error)
  __pyx_t_3 = (!__pyx_t_2);
  if (!__pyx_t_3) {
  } else {
    __pyx_t_1 = __pyx_t_3;
    goto __pyx_L4_bool_binop_done;
  }
  __pyx_t_3 = (__pyx_v_sample_index < 0);
  __pyx_t_1 = __pyx_t_3;
  __pyx_L4_bool_binop_done:;
  if (unlikely(__pyx_t_1)) {

    /* "pysam/libcbcf.pyx":3649
 * cdef VariantRecordSample makeVariantRecordSample(VariantRecord record, int32_t sample_index):
 *     if not record or sample_index < 0:
 *         raise ValueError('cannot create VariantRecordSample')             # <<<<<<<<<<<<<<
 * 
 *     cdef VariantRecordSample sample = VariantRecordSample.__new__(VariantRecordSample)
*/
    __pyx_t_5 = NULL;
    __Pyx_INCREF(__pyx_builtin_ValueError);
    __pyx_t_6 = __pyx_builtin_ValueError; 
    __pyx_t_7 = 1;
    {
      PyObject *__pyx_callargs[2] = {__pyx_t_5, __pyx_mstate_global->__pyx_kp_u_cannot_create_VariantRecordSampl};
      __pyx_t_4 = __Pyx_PyObject_FastCall(__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, 3649, __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, 3649, __pyx_L1_error)

    /* "pysam/libcbcf.pyx":3648
 * 
 * cdef VariantRecordSample makeVariantRecordSample(VariantRecord record, int32_t sample_index):
 *     if not record or sample_index < 0:             # <<<<<<<<<<<<<<
 *         raise ValueError('cannot create VariantRecordSample')
 * 
*/
  }

  /* "pysam/libcbcf.pyx":3651
 *         raise ValueError('cannot create VariantRecordSample')
 * 
 *     cdef VariantRecordSample sample = VariantRecordSample.__new__(VariantRecordSample)             # <<<<<<<<<<<<<<
 *     sample.record = record
 *     sample.index = sample_index
*/
  __pyx_t_4 = ((PyObject *)__pyx_tp_new_5pysam_7libcbcf_VariantRecordSample(((PyTypeObject *)__pyx_mstate_global->__pyx_ptype_5pysam_7libcbcf_VariantRecordSample), __pyx_mstate_global->__pyx_empty_tuple, NULL)); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 3651, __pyx_L1_error)
  __Pyx_GOTREF((PyObject *)__pyx_t_4);
  __pyx_v_sample = ((struct __pyx_obj_5pysam_7libcbcf_VariantRecordSample *)__pyx_t_4);
  __pyx_t_4 = 0;

  /* "pysam/libcbcf.pyx":3652
 * 
 *     cdef VariantRecordSample sample = VariantRecordSample.__new__(VariantRecordSample)
 *     sample.record = record             # <<<<<<<<<<<<<<
 *     sample.index = sample_index
 * 
*/
  __Pyx_INCREF((PyObject *)__pyx_v_record);
  __Pyx_GIVEREF((PyObject *)__pyx_v_record);
  __Pyx_GOTREF((PyObject *)__pyx_v_sample->record);
  __Pyx_DECREF((PyObject *)__pyx_v_sample->record);
  __pyx_v_sample->record = __pyx_v_record;

  /* "pysam/libcbcf.pyx":3653
 *     cdef VariantRecordSample sample = VariantRecordSample.__new__(VariantRecordSample)
 *     sample.record = record
 *     sample.index = sample_index             # <<<<<<<<<<<<<<
 * 
 *     return sample
*/
  __pyx_v_sample->index = __pyx_v_sample_index;

  /* "pysam/libcbcf.pyx":3655
 *     sample.index = sample_index
 * 
 *     return sample             # <<<<<<<<<<<<<<
 * 
 * 
*/
  __Pyx_XDECREF((PyObject *)__pyx_r);
  __Pyx_INCREF((PyObject *)__pyx_v_sample);
  __pyx_r = __pyx_v_sample;
  __Pyx_TraceReturnValue((PyObject *)__pyx_r, 23, 0, __PYX_ERR(0, 3655, __pyx_L1_error));
  goto __pyx_L0;

  /* "pysam/libcbcf.pyx":3647
 * 
 * 
 * cdef VariantRecordSample makeVariantRecordSample(VariantRecord record, int32_t sample_index):             # <<<<<<<<<<<<<<
 *     if not record or sample_index < 0:
 *         raise ValueError('cannot create VariantRecordSample')
*/

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_XDECREF(__pyx_t_5);
  __Pyx_XDECREF(__pyx_t_6);
  __Pyx_TraceException(__pyx_lineno, 0, 0);
  #if CYTHON_USE_SYS_MONITORING
  __Pyx_TraceExceptionUnwind(0, 0);
  #else
  __Pyx_TraceReturnValue(NULL, 0, 0, __PYX_ERR(0, 3647, __pyx_L1_error));
  #endif
  __Pyx_AddTraceback("pysam.libcbcf.makeVariantRecordSample", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_XDECREF((PyObject *)__pyx_v_sample);
  __Pyx_XGIVEREF((PyObject *)__pyx_r);
  __Pyx_PyMonitoring_ExitScope(0);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "pysam/libcbcf.pyx":3665
 * 
 * cdef class BaseIndex(object):
 *     def __init__(self):             # <<<<<<<<<<<<<<
 *         self.refs = ()
 *         self.remap = {}
*/

/* Python wrapper */
static int __pyx_pw_5pysam_7libcbcf_9BaseIndex_1__init__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static int __pyx_pw_5pysam_7libcbcf_9BaseIndex_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_5pysam_7libcbcf_9BaseIndex___init__(((struct __pyx_obj_5pysam_7libcbcf_BaseIndex *)__pyx_v_self));

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

static int __pyx_pf_5pysam_7libcbcf_9BaseIndex___init__(struct __pyx_obj_5pysam_7libcbcf_BaseIndex *__pyx_v_self) {
  int __pyx_r;
  __Pyx_TraceDeclarationsFunc
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_TraceFrameInit(((PyObject *)__pyx_mstate_global->__pyx_codeobj_tab[319]))
  __Pyx_RefNannySetupContext("__init__", 0);
  __Pyx_TraceStartFunc("__init__", __pyx_f[0], 3665, 0, 0, 0, __PYX_ERR(0, 3665, __pyx_L1_error));

  /* "pysam/libcbcf.pyx":3666
 * cdef class BaseIndex(object):
 *     def __init__(self):
 *         self.refs = ()             # <<<<<<<<<<<<<<
 *         self.remap = {}
 * 
*/
  __Pyx_INCREF(__pyx_mstate_global->__pyx_empty_tuple);
  __Pyx_GIVEREF(__pyx_mstate_global->__pyx_empty_tuple);
  __Pyx_GOTREF(__pyx_v_self->refs);
  __Pyx_DECREF(__pyx_v_self->refs);
  __pyx_v_self->refs = __pyx_mstate_global->__pyx_empty_tuple;

  /* "pysam/libcbcf.pyx":3667
 *     def __init__(self):
 *         self.refs = ()
 *         self.remap = {}             # <<<<<<<<<<<<<<
 * 
 *     def __len__(self):
*/
  __pyx_t_1 = __Pyx_PyDict_NewPresized(0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 3667, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  if (__Pyx_PyObject_SetAttrStr(((PyObject *)__pyx_v_self), __pyx_mstate_global->__pyx_n_u_remap, __pyx_t_1) < 0) __PYX_ERR(0, 3667, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "pysam/libcbcf.pyx":3665
 * 
 * cdef class BaseIndex(object):
 *     def __init__(self):             # <<<<<<<<<<<<<<
 *         self.refs = ()
 *         self.remap = {}
*/

  /* function exit code */
  __pyx_r = 0;
  __Pyx_TraceReturnCValue(__pyx_r, __Pyx_Owned_Py_None, 0, 0, __PYX_ERR(0, 3665, __pyx_L1_error));
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_TraceException(__pyx_lineno, 0, 0);
  #if CYTHON_USE_SYS_MONITORING
  __Pyx_TraceExceptionUnwind(0, 0);
  #else
  __Pyx_TraceReturnValue(NULL, 0, 0, __PYX_ERR(0, 3665, __pyx_L1_error));
  #endif
  __Pyx_AddTraceback("pysam.libcbcf.BaseIndex.__init__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = -1;
  __pyx_L0:;
  __Pyx_PyMonitoring_ExitScope(0);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "pysam/libcbcf.pyx":3669
 *         self.remap = {}
 * 
 *     def __len__(self):             # <<<<<<<<<<<<<<
 *         return len(self.refs)
 * 
*/

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

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

static Py_ssize_t __pyx_pf_5pysam_7libcbcf_9BaseIndex_2__len__(struct __pyx_obj_5pysam_7libcbcf_BaseIndex *__pyx_v_self) {
  Py_ssize_t __pyx_r;
  __Pyx_TraceDeclarationsFunc
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  Py_ssize_t __pyx_t_2;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_TraceFrameInit(((PyObject *)__pyx_mstate_global->__pyx_codeobj_tab[320]))
  __Pyx_RefNannySetupContext("__len__", 0);
  __Pyx_TraceStartFunc("__len__", __pyx_f[0], 3669, 0, 0, 0, __PYX_ERR(0, 3669, __pyx_L1_error));

  /* "pysam/libcbcf.pyx":3670
 * 
 *     def __len__(self):
 *         return len(self.refs)             # <<<<<<<<<<<<<<
 * 
 *     def __bool__(self):
*/
  __pyx_t_1 = __pyx_v_self->refs;
  __Pyx_INCREF(__pyx_t_1);
  if (unlikely(__pyx_t_1 == Py_None)) {
    PyErr_SetString(PyExc_TypeError, "object of type 'NoneType' has no len()");
    __PYX_ERR(0, 3670, __pyx_L1_error)
  }
  __pyx_t_2 = __Pyx_PyTuple_GET_SIZE(__pyx_t_1); if (unlikely(__pyx_t_2 == ((Py_ssize_t)-1))) __PYX_ERR(0, 3670, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_r = __pyx_t_2;
  __Pyx_TraceReturnCValue(__pyx_r, PyLong_FromSsize_t, 1, 0, __PYX_ERR(0, 3670, __pyx_L1_error));
  goto __pyx_L0;

  /* "pysam/libcbcf.pyx":3669
 *         self.remap = {}
 * 
 *     def __len__(self):             # <<<<<<<<<<<<<<
 *         return len(self.refs)
 * 
*/

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_TraceException(__pyx_lineno, 0, 0);
  #if CYTHON_USE_SYS_MONITORING
  __Pyx_TraceExceptionUnwind(0, 0);
  #else
  __Pyx_TraceReturnValue(NULL, 0, 0, __PYX_ERR(0, 3669, __pyx_L1_error));
  #endif
  __Pyx_AddTraceback("pysam.libcbcf.BaseIndex.__len__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = -1;
  __pyx_L0:;
  __Pyx_PyMonitoring_ExitScope(0);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "pysam/libcbcf.pyx":3672
 *         return len(self.refs)
 * 
 *     def __bool__(self):             # <<<<<<<<<<<<<<
 *         return len(self.refs) != 0
 * 
*/

/* Python wrapper */
static int __pyx_pw_5pysam_7libcbcf_9BaseIndex_5__bool__(PyObject *__pyx_v_self); /*proto*/
static int __pyx_pw_5pysam_7libcbcf_9BaseIndex_5__bool__(PyObject *__pyx_v_self) {
  CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__bool__ (wrapper)", 0);
  __pyx_kwvalues = __Pyx_KwValues_VARARGS(__pyx_args, __pyx_nargs);
  __pyx_r = __pyx_pf_5pysam_7libcbcf_9BaseIndex_4__bool__(((struct __pyx_obj_5pysam_7libcbcf_BaseIndex *)__pyx_v_self));

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

static int __pyx_pf_5pysam_7libcbcf_9BaseIndex_4__bool__(struct __pyx_obj_5pysam_7libcbcf_BaseIndex *__pyx_v_self) {
  int __pyx_r;
  __Pyx_TraceDeclarationsFunc
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  Py_ssize_t __pyx_t_2;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_TraceFrameInit(((PyObject *)__pyx_mstate_global->__pyx_codeobj_tab[321]))
  __Pyx_RefNannySetupContext("__bool__", 0);
  __Pyx_TraceStartFunc("__bool__", __pyx_f[0], 3672, 0, 0, 0, __PYX_ERR(0, 3672, __pyx_L1_error));

  /* "pysam/libcbcf.pyx":3673
 * 
 *     def __bool__(self):
 *         return len(self.refs) != 0             # <<<<<<<<<<<<<<
 * 
 *     def __getitem__(self, key):
*/
  __pyx_t_1 = __pyx_v_self->refs;
  __Pyx_INCREF(__pyx_t_1);
  if (unlikely(__pyx_t_1 == Py_None)) {
    PyErr_SetString(PyExc_TypeError, "object of type 'NoneType' has no len()");
    __PYX_ERR(0, 3673, __pyx_L1_error)
  }
  __pyx_t_2 = __Pyx_PyTuple_GET_SIZE(__pyx_t_1); if (unlikely(__pyx_t_2 == ((Py_ssize_t)-1))) __PYX_ERR(0, 3673, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_r = (__pyx_t_2 != 0);
  __Pyx_TraceReturnCValue(__pyx_r, __Pyx_PyLong_From_int, 1, 0, __PYX_ERR(0, 3673, __pyx_L1_error));
  goto __pyx_L0;

  /* "pysam/libcbcf.pyx":3672
 *         return len(self.refs)
 * 
 *     def __bool__(self):             # <<<<<<<<<<<<<<
 *         return len(self.refs) != 0
 * 
*/

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_TraceException(__pyx_lineno, 0, 0);
  #if CYTHON_USE_SYS_MONITORING
  __Pyx_TraceExceptionUnwind(0, 0);
  #else
  __Pyx_TraceReturnValue(NULL, 0, 0, __PYX_ERR(0, 3672, __pyx_L1_error));
  #endif
  __Pyx_AddTraceback("pysam.libcbcf.BaseIndex.__bool__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = -1;
  __pyx_L0:;
  __Pyx_PyMonitoring_ExitScope(0);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "pysam/libcbcf.pyx":3675
 *         return len(self.refs) != 0
 * 
 *     def __getitem__(self, key):             # <<<<<<<<<<<<<<
 *         if isinstance(key, int):
 *             return self.refs[key]
*/

/* Python wrapper */
static PyObject *__pyx_pw_5pysam_7libcbcf_9BaseIndex_7__getitem__(PyObject *__pyx_v_self, PyObject *__pyx_v_key); /*proto*/
static PyObject *__pyx_pw_5pysam_7libcbcf_9BaseIndex_7__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_5pysam_7libcbcf_9BaseIndex_6__getitem__(((struct __pyx_obj_5pysam_7libcbcf_BaseIndex *)__pyx_v_self), ((PyObject *)__pyx_v_key));

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

static PyObject *__pyx_pf_5pysam_7libcbcf_9BaseIndex_6__getitem__(struct __pyx_obj_5pysam_7libcbcf_BaseIndex *__pyx_v_self, PyObject *__pyx_v_key) {
  PyObject *__pyx_r = NULL;
  __Pyx_TraceDeclarationsFunc
  __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_TraceFrameInit(((PyObject *)__pyx_mstate_global->__pyx_codeobj_tab[322]))
  __Pyx_RefNannySetupContext("__getitem__", 0);
  __Pyx_TraceStartFunc("__getitem__", __pyx_f[0], 3675, 0, 0, 0, __PYX_ERR(0, 3675, __pyx_L1_error));

  /* "pysam/libcbcf.pyx":3676
 * 
 *     def __getitem__(self, key):
 *         if isinstance(key, int):             # <<<<<<<<<<<<<<
 *             return self.refs[key]
 *         else:
*/
  __pyx_t_1 = PyLong_Check(__pyx_v_key); 
  if (__pyx_t_1) {

    /* "pysam/libcbcf.pyx":3677
 *     def __getitem__(self, key):
 *         if isinstance(key, int):
 *             return self.refs[key]             # <<<<<<<<<<<<<<
 *         else:
 *             return self.refmap[key]
*/
    __Pyx_XDECREF(__pyx_r);
    if (unlikely(__pyx_v_self->refs == Py_None)) {
      PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable");
      __PYX_ERR(0, 3677, __pyx_L1_error)
    }
    __pyx_t_2 = __Pyx_PyObject_GetItem(__pyx_v_self->refs, __pyx_v_key); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 3677, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __pyx_r = __pyx_t_2;
    __pyx_t_2 = 0;
    __Pyx_TraceReturnValue(__pyx_r, 6, 0, __PYX_ERR(0, 3677, __pyx_L1_error));
    goto __pyx_L0;

    /* "pysam/libcbcf.pyx":3676
 * 
 *     def __getitem__(self, key):
 *         if isinstance(key, int):             # <<<<<<<<<<<<<<
 *             return self.refs[key]
 *         else:
*/
  }

  /* "pysam/libcbcf.pyx":3679
 *             return self.refs[key]
 *         else:
 *             return self.refmap[key]             # <<<<<<<<<<<<<<
 * 
 *     def __iter__(self):
*/
  /*else*/ {
    __Pyx_XDECREF(__pyx_r);
    if (unlikely(__pyx_v_self->refmap == Py_None)) {
      PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable");
      __PYX_ERR(0, 3679, __pyx_L1_error)
    }
    __pyx_t_2 = __Pyx_PyDict_GetItem(__pyx_v_self->refmap, __pyx_v_key); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 3679, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __pyx_r = __pyx_t_2;
    __pyx_t_2 = 0;
    __Pyx_TraceReturnValue(__pyx_r, 11, 0, __PYX_ERR(0, 3679, __pyx_L1_error));
    goto __pyx_L0;
  }

  /* "pysam/libcbcf.pyx":3675
 *         return len(self.refs) != 0
 * 
 *     def __getitem__(self, key):             # <<<<<<<<<<<<<<
 *         if isinstance(key, int):
 *             return self.refs[key]
*/

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_TraceException(__pyx_lineno, 0, 0);
  #if CYTHON_USE_SYS_MONITORING
  __Pyx_TraceExceptionUnwind(0, 0);
  #else
  __Pyx_TraceReturnValue(NULL, 0, 0, __PYX_ERR(0, 3675, __pyx_L1_error));
  #endif
  __Pyx_AddTraceback("pysam.libcbcf.BaseIndex.__getitem__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_PyMonitoring_ExitScope(0);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "pysam/libcbcf.pyx":3681
 *             return self.refmap[key]
 * 
 *     def __iter__(self):             # <<<<<<<<<<<<<<
 *         return iter(self.refs)
 * 
*/

/* Python wrapper */
static PyObject *__pyx_pw_5pysam_7libcbcf_9BaseIndex_9__iter__(PyObject *__pyx_v_self); /*proto*/
static PyObject *__pyx_pw_5pysam_7libcbcf_9BaseIndex_9__iter__(PyObject *__pyx_v_self) {
  CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__iter__ (wrapper)", 0);
  __pyx_kwvalues = __Pyx_KwValues_VARARGS(__pyx_args, __pyx_nargs);
  __pyx_r = __pyx_pf_5pysam_7libcbcf_9BaseIndex_8__iter__(((struct __pyx_obj_5pysam_7libcbcf_BaseIndex *)__pyx_v_self));

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

static PyObject *__pyx_pf_5pysam_7libcbcf_9BaseIndex_8__iter__(struct __pyx_obj_5pysam_7libcbcf_BaseIndex *__pyx_v_self) {
  PyObject *__pyx_r = NULL;
  __Pyx_TraceDeclarationsFunc
  __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_TraceFrameInit(((PyObject *)__pyx_mstate_global->__pyx_codeobj_tab[323]))
  __Pyx_RefNannySetupContext("__iter__", 0);
  __Pyx_TraceStartFunc("__iter__", __pyx_f[0], 3681, 0, 0, 0, __PYX_ERR(0, 3681, __pyx_L1_error));

  /* "pysam/libcbcf.pyx":3682
 * 
 *     def __iter__(self):
 *         return iter(self.refs)             # <<<<<<<<<<<<<<
 * 
 *     def get(self, key, default=None):
*/
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = __pyx_v_self->refs;
  __Pyx_INCREF(__pyx_t_1);
  __pyx_t_2 = PyObject_GetIter(__pyx_t_1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 3682, __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;
  __Pyx_TraceReturnValue(__pyx_r, 1, 0, __PYX_ERR(0, 3682, __pyx_L1_error));
  goto __pyx_L0;

  /* "pysam/libcbcf.pyx":3681
 *             return self.refmap[key]
 * 
 *     def __iter__(self):             # <<<<<<<<<<<<<<
 *         return iter(self.refs)
 * 
*/

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_TraceException(__pyx_lineno, 0, 0);
  #if CYTHON_USE_SYS_MONITORING
  __Pyx_TraceExceptionUnwind(0, 0);
  #else
  __Pyx_TraceReturnValue(NULL, 0, 0, __PYX_ERR(0, 3681, __pyx_L1_error));
  #endif
  __Pyx_AddTraceback("pysam.libcbcf.BaseIndex.__iter__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_PyMonitoring_ExitScope(0);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "pysam/libcbcf.pyx":3684
 *         return iter(self.refs)
 * 
 *     def get(self, key, default=None):             # <<<<<<<<<<<<<<
 *         """D.get(k[,d]) -> D[k] if k in D, else d.  d defaults to None."""
 *         try:
*/

/* Python wrapper */
static PyObject *__pyx_pw_5pysam_7libcbcf_9BaseIndex_11get(PyObject *__pyx_v_self, 
#if 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_5pysam_7libcbcf_9BaseIndex_10get, "BaseIndex.get(self, key, default=None)\n\nD.get(k[,d]) -> D[k] if k in D, else d.  d defaults to None.");
static PyMethodDef __pyx_mdef_5pysam_7libcbcf_9BaseIndex_11get = {"get", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_5pysam_7libcbcf_9BaseIndex_11get, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_5pysam_7libcbcf_9BaseIndex_10get};
static PyObject *__pyx_pw_5pysam_7libcbcf_9BaseIndex_11get(PyObject *__pyx_v_self, 
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
) {
  PyObject *__pyx_v_key = 0;
  PyObject *__pyx_v_default = 0;
  #if !CYTHON_METH_FASTCALL
  CYTHON_UNUSED Py_ssize_t __pyx_nargs;
  #endif
  CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
  PyObject* values[2] = {0,0};
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("get (wrapper)", 0);
  #if !CYTHON_METH_FASTCALL
  #if CYTHON_ASSUME_SAFE_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,&__pyx_mstate_global->__pyx_n_u_default,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, 3684, __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, 3684, __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, 3684, __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, 3684, __pyx_L3_error)
      if (!values[1]) values[1] = __Pyx_NewRef(((PyObject *)Py_None));
      for (Py_ssize_t i = __pyx_nargs; i < 1; i++) {
        if (unlikely(!values[i])) { __Pyx_RaiseArgtupleInvalid("get", 0, 1, 2, i); __PYX_ERR(0, 3684, __pyx_L3_error) }
      }
    } 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, 3684, __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, 3684, __pyx_L3_error)
        break;
        default: goto __pyx_L5_argtuple_error;
      }
      if (!values[1]) values[1] = __Pyx_NewRef(((PyObject *)Py_None));
    }
    __pyx_v_key = values[0];
    __pyx_v_default = values[1];
  }
  goto __pyx_L6_skip;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("get", 0, 1, 2, __pyx_nargs); __PYX_ERR(0, 3684, __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("pysam.libcbcf.BaseIndex.get", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_5pysam_7libcbcf_9BaseIndex_10get(((struct __pyx_obj_5pysam_7libcbcf_BaseIndex *)__pyx_v_self), __pyx_v_key, __pyx_v_default);

  /* 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_5pysam_7libcbcf_9BaseIndex_10get(struct __pyx_obj_5pysam_7libcbcf_BaseIndex *__pyx_v_self, PyObject *__pyx_v_key, PyObject *__pyx_v_default) {
  PyObject *__pyx_r = NULL;
  __Pyx_TraceDeclarationsFunc
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  PyObject *__pyx_t_4 = NULL;
  int __pyx_t_5;
  PyObject *__pyx_t_6 = NULL;
  PyObject *__pyx_t_7 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_TraceFrameInit(((PyObject *)__pyx_mstate_global->__pyx_codeobj_tab[324]))
  __Pyx_RefNannySetupContext("get", 0);
  __Pyx_TraceStartFunc("get", __pyx_f[0], 3684, 0, 0, 0, __PYX_ERR(0, 3684, __pyx_L1_error));

  /* "pysam/libcbcf.pyx":3686
 *     def get(self, key, default=None):
 *         """D.get(k[,d]) -> D[k] if k in D, else d.  d defaults to None."""
 *         try:             # <<<<<<<<<<<<<<
 *             return self[key]
 *         except KeyError:
*/
  {
    __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:*/ {

      /* "pysam/libcbcf.pyx":3687
 *         """D.get(k[,d]) -> D[k] if k in D, else d.  d defaults to None."""
 *         try:
 *             return self[key]             # <<<<<<<<<<<<<<
 *         except KeyError:
 *             return default
*/
      __Pyx_XDECREF(__pyx_r);
      __pyx_t_4 = __Pyx_PyObject_GetItem(((PyObject *)__pyx_v_self), __pyx_v_key); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 3687, __pyx_L3_error)
      __Pyx_GOTREF(__pyx_t_4);
      __pyx_r = __pyx_t_4;
      __pyx_t_4 = 0;
      __Pyx_TraceReturnValue(__pyx_r, 3, 0, __PYX_ERR(0, 3687, __pyx_L3_error));
      goto __pyx_L7_try_return;

      /* "pysam/libcbcf.pyx":3686
 *     def get(self, key, default=None):
 *         """D.get(k[,d]) -> D[k] if k in D, else d.  d defaults to None."""
 *         try:             # <<<<<<<<<<<<<<
 *             return self[key]
 *         except KeyError:
*/
    }
    __pyx_L3_error:;
    __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
    __Pyx_TraceException(__pyx_lineno, 0, 0);

    /* "pysam/libcbcf.pyx":3688
 *         try:
 *             return self[key]
 *         except KeyError:             # <<<<<<<<<<<<<<
 *             return default
 * 
*/
    __pyx_t_5 = __Pyx_PyErr_ExceptionMatches(__pyx_builtin_KeyError);
    if (__pyx_t_5) {
      __Pyx_AddTraceback("pysam.libcbcf.BaseIndex.get", __pyx_clineno, __pyx_lineno, __pyx_filename);
      __Pyx_TraceExceptionHandled(0);
      if (__Pyx_GetException(&__pyx_t_4, &__pyx_t_6, &__pyx_t_7) < 0) __PYX_ERR(0, 3688, __pyx_L5_except_error)
      __Pyx_XGOTREF(__pyx_t_4);
      __Pyx_XGOTREF(__pyx_t_6);
      __Pyx_XGOTREF(__pyx_t_7);
      __Pyx_TraceExceptionDone();

      /* "pysam/libcbcf.pyx":3689
 *             return self[key]
 *         except KeyError:
 *             return default             # <<<<<<<<<<<<<<
 * 
 *     def __contains__(self, key):
*/
      __Pyx_XDECREF(__pyx_r);
      __Pyx_INCREF(__pyx_v_default);
      __pyx_r = __pyx_v_default;
      __Pyx_TraceReturnValue(__pyx_r, 8, 0, __PYX_ERR(0, 3689, __pyx_L5_except_error));
      __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;

    /* "pysam/libcbcf.pyx":3686
 *     def get(self, key, default=None):
 *         """D.get(k[,d]) -> D[k] if k in D, else d.  d defaults to None."""
 *         try:             # <<<<<<<<<<<<<<
 *             return self[key]
 *         except KeyError:
*/
    __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;
  }

  /* "pysam/libcbcf.pyx":3684
 *         return iter(self.refs)
 * 
 *     def get(self, key, default=None):             # <<<<<<<<<<<<<<
 *         """D.get(k[,d]) -> D[k] if k in D, else d.  d defaults to None."""
 *         try:
*/

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_XDECREF(__pyx_t_6);
  __Pyx_XDECREF(__pyx_t_7);
  __Pyx_TraceException(__pyx_lineno, 0, 0);
  #if CYTHON_USE_SYS_MONITORING
  __Pyx_TraceExceptionUnwind(0, 0);
  #else
  __Pyx_TraceReturnValue(NULL, 0, 0, __PYX_ERR(0, 3684, __pyx_L1_error));
  #endif
  __Pyx_AddTraceback("pysam.libcbcf.BaseIndex.get", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_PyMonitoring_ExitScope(0);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "pysam/libcbcf.pyx":3691
 *             return default
 * 
 *     def __contains__(self, key):             # <<<<<<<<<<<<<<
 *         try:
 *             self[key]
*/

/* Python wrapper */
static int __pyx_pw_5pysam_7libcbcf_9BaseIndex_13__contains__(PyObject *__pyx_v_self, PyObject *__pyx_v_key); /*proto*/
static int __pyx_pw_5pysam_7libcbcf_9BaseIndex_13__contains__(PyObject *__pyx_v_self, PyObject *__pyx_v_key) {
  CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__contains__ (wrapper)", 0);
  __pyx_kwvalues = __Pyx_KwValues_VARARGS(__pyx_args, __pyx_nargs);
  __pyx_r = __pyx_pf_5pysam_7libcbcf_9BaseIndex_12__contains__(((struct __pyx_obj_5pysam_7libcbcf_BaseIndex *)__pyx_v_self), ((PyObject *)__pyx_v_key));

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

static int __pyx_pf_5pysam_7libcbcf_9BaseIndex_12__contains__(struct __pyx_obj_5pysam_7libcbcf_BaseIndex *__pyx_v_self, PyObject *__pyx_v_key) {
  int __pyx_r;
  __Pyx_TraceDeclarationsFunc
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  PyObject *__pyx_t_4 = NULL;
  int __pyx_t_5;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_TraceFrameInit(((PyObject *)__pyx_mstate_global->__pyx_codeobj_tab[325]))
  __Pyx_RefNannySetupContext("__contains__", 0);
  __Pyx_TraceStartFunc("__contains__", __pyx_f[0], 3691, 0, 0, 0, __PYX_ERR(0, 3691, __pyx_L1_error));

  /* "pysam/libcbcf.pyx":3692
 * 
 *     def __contains__(self, key):
 *         try:             # <<<<<<<<<<<<<<
 *             self[key]
 *         except KeyError:
*/
  {
    __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:*/ {

      /* "pysam/libcbcf.pyx":3693
 *     def __contains__(self, key):
 *         try:
 *             self[key]             # <<<<<<<<<<<<<<
 *         except KeyError:
 *             return False
*/
      __pyx_t_4 = __Pyx_PyObject_GetItem(((PyObject *)__pyx_v_self), __pyx_v_key); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 3693, __pyx_L3_error)
      __Pyx_GOTREF(__pyx_t_4);
      __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;

      /* "pysam/libcbcf.pyx":3692
 * 
 *     def __contains__(self, key):
 *         try:             # <<<<<<<<<<<<<<
 *             self[key]
 *         except KeyError:
*/
    }

    /* "pysam/libcbcf.pyx":3697
 *             return False
 *         else:
 *             return True             # <<<<<<<<<<<<<<
 * 
 *     def iterkeys(self):
*/
    /*else:*/ {
      __pyx_r = 1;
      __Pyx_TraceReturnCValue(__pyx_r, __Pyx_PyLong_From_int, 8, 0, __PYX_ERR(0, 3697, __pyx_L5_except_error));
      goto __pyx_L6_except_return;
    }
    __pyx_L3_error:;
    __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
    __Pyx_TraceException(__pyx_lineno, 0, 0);

    /* "pysam/libcbcf.pyx":3694
 *         try:
 *             self[key]
 *         except KeyError:             # <<<<<<<<<<<<<<
 *             return False
 *         else:
*/
    __pyx_t_5 = __Pyx_PyErr_ExceptionMatches(__pyx_builtin_KeyError);
    if (__pyx_t_5) {
      __Pyx_AddTraceback("pysam.libcbcf.BaseIndex.__contains__", __pyx_clineno, __pyx_lineno, __pyx_filename);
      __Pyx_TraceExceptionHandled(0);
      __Pyx_ErrRestore(0,0,0);
      __Pyx_TraceExceptionDone();

      /* "pysam/libcbcf.pyx":3695
 *             self[key]
 *         except KeyError:
 *             return False             # <<<<<<<<<<<<<<
 *         else:
 *             return True
*/
      __pyx_r = 0;
      __Pyx_TraceReturnCValue(__pyx_r, __Pyx_PyLong_From_int, 6, 0, __PYX_ERR(0, 3695, __pyx_L5_except_error));
      goto __pyx_L6_except_return;
    }
    goto __pyx_L5_except_error;

    /* "pysam/libcbcf.pyx":3692
 * 
 *     def __contains__(self, key):
 *         try:             # <<<<<<<<<<<<<<
 *             self[key]
 *         except KeyError:
*/
    __pyx_L5_except_error:;
    __Pyx_XGIVEREF(__pyx_t_1);
    __Pyx_XGIVEREF(__pyx_t_2);
    __Pyx_XGIVEREF(__pyx_t_3);
    __Pyx_ExceptionReset(__pyx_t_1, __pyx_t_2, __pyx_t_3);
    goto __pyx_L1_error;
    __pyx_L6_except_return:;
    __Pyx_XGIVEREF(__pyx_t_1);
    __Pyx_XGIVEREF(__pyx_t_2);
    __Pyx_XGIVEREF(__pyx_t_3);
    __Pyx_ExceptionReset(__pyx_t_1, __pyx_t_2, __pyx_t_3);
    goto __pyx_L0;
  }

  /* "pysam/libcbcf.pyx":3691
 *             return default
 * 
 *     def __contains__(self, key):             # <<<<<<<<<<<<<<
 *         try:
 *             self[key]
*/

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_TraceException(__pyx_lineno, 0, 0);
  #if CYTHON_USE_SYS_MONITORING
  __Pyx_TraceExceptionUnwind(0, 0);
  #else
  __Pyx_TraceReturnValue(NULL, 0, 0, __PYX_ERR(0, 3691, __pyx_L1_error));
  #endif
  __Pyx_AddTraceback("pysam.libcbcf.BaseIndex.__contains__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = -1;
  __pyx_L0:;
  __Pyx_PyMonitoring_ExitScope(0);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "pysam/libcbcf.pyx":3699
 *             return True
 * 
 *     def iterkeys(self):             # <<<<<<<<<<<<<<
 *         """D.iterkeys() -> an iterator over the keys of D"""
 *         return iter(self)
*/

/* Python wrapper */
static PyObject *__pyx_pw_5pysam_7libcbcf_9BaseIndex_15iterkeys(PyObject *__pyx_v_self, 
#if 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_5pysam_7libcbcf_9BaseIndex_14iterkeys, "BaseIndex.iterkeys(self)\n\nD.iterkeys() -> an iterator over the keys of D");
static PyMethodDef __pyx_mdef_5pysam_7libcbcf_9BaseIndex_15iterkeys = {"iterkeys", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_5pysam_7libcbcf_9BaseIndex_15iterkeys, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_5pysam_7libcbcf_9BaseIndex_14iterkeys};
static PyObject *__pyx_pw_5pysam_7libcbcf_9BaseIndex_15iterkeys(PyObject *__pyx_v_self, 
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
) {
  #if !CYTHON_METH_FASTCALL
  CYTHON_UNUSED Py_ssize_t __pyx_nargs;
  #endif
  CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("iterkeys (wrapper)", 0);
  #if !CYTHON_METH_FASTCALL
  #if CYTHON_ASSUME_SAFE_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("iterkeys", 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("iterkeys", __pyx_kwds); return NULL;}
  __pyx_r = __pyx_pf_5pysam_7libcbcf_9BaseIndex_14iterkeys(((struct __pyx_obj_5pysam_7libcbcf_BaseIndex *)__pyx_v_self));

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

static PyObject *__pyx_pf_5pysam_7libcbcf_9BaseIndex_14iterkeys(struct __pyx_obj_5pysam_7libcbcf_BaseIndex *__pyx_v_self) {
  PyObject *__pyx_r = NULL;
  __Pyx_TraceDeclarationsFunc
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_TraceFrameInit(((PyObject *)__pyx_mstate_global->__pyx_codeobj_tab[326]))
  __Pyx_RefNannySetupContext("iterkeys", 0);
  __Pyx_TraceStartFunc("iterkeys", __pyx_f[0], 3699, 0, 0, 0, __PYX_ERR(0, 3699, __pyx_L1_error));

  /* "pysam/libcbcf.pyx":3701
 *     def iterkeys(self):
 *         """D.iterkeys() -> an iterator over the keys of D"""
 *         return iter(self)             # <<<<<<<<<<<<<<
 * 
 *     def itervalues(self):
*/
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = PyObject_GetIter(((PyObject *)__pyx_v_self)); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 3701, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  __Pyx_TraceReturnValue(__pyx_r, 1, 0, __PYX_ERR(0, 3701, __pyx_L1_error));
  goto __pyx_L0;

  /* "pysam/libcbcf.pyx":3699
 *             return True
 * 
 *     def iterkeys(self):             # <<<<<<<<<<<<<<
 *         """D.iterkeys() -> an iterator over the keys of D"""
 *         return iter(self)
*/

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_TraceException(__pyx_lineno, 0, 0);
  #if CYTHON_USE_SYS_MONITORING
  __Pyx_TraceExceptionUnwind(0, 0);
  #else
  __Pyx_TraceReturnValue(NULL, 0, 0, __PYX_ERR(0, 3699, __pyx_L1_error));
  #endif
  __Pyx_AddTraceback("pysam.libcbcf.BaseIndex.iterkeys", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_PyMonitoring_ExitScope(0);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}
static PyObject *__pyx_gb_5pysam_7libcbcf_9BaseIndex_18generator26(__pyx_CoroutineObject *__pyx_generator, CYTHON_UNUSED PyThreadState *__pyx_tstate, PyObject *__pyx_sent_value); /* proto */

/* "pysam/libcbcf.pyx":3703
 *         return iter(self)
 * 
 *     def itervalues(self):             # <<<<<<<<<<<<<<
 *         """D.itervalues() -> an iterator over the values of D"""
 *         for key in self:
*/

/* Python wrapper */
static PyObject *__pyx_pw_5pysam_7libcbcf_9BaseIndex_17itervalues(PyObject *__pyx_v_self, 
#if 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_5pysam_7libcbcf_9BaseIndex_16itervalues, "BaseIndex.itervalues(self)\n\nD.itervalues() -> an iterator over the values of D");
static PyMethodDef __pyx_mdef_5pysam_7libcbcf_9BaseIndex_17itervalues = {"itervalues", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_5pysam_7libcbcf_9BaseIndex_17itervalues, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_5pysam_7libcbcf_9BaseIndex_16itervalues};
static PyObject *__pyx_pw_5pysam_7libcbcf_9BaseIndex_17itervalues(PyObject *__pyx_v_self, 
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
) {
  #if !CYTHON_METH_FASTCALL
  CYTHON_UNUSED Py_ssize_t __pyx_nargs;
  #endif
  CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("itervalues (wrapper)", 0);
  #if !CYTHON_METH_FASTCALL
  #if CYTHON_ASSUME_SAFE_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("itervalues", 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("itervalues", __pyx_kwds); return NULL;}
  __pyx_r = __pyx_pf_5pysam_7libcbcf_9BaseIndex_16itervalues(((struct __pyx_obj_5pysam_7libcbcf_BaseIndex *)__pyx_v_self));

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

static PyObject *__pyx_pf_5pysam_7libcbcf_9BaseIndex_16itervalues(struct __pyx_obj_5pysam_7libcbcf_BaseIndex *__pyx_v_self) {
  struct __pyx_obj_5pysam_7libcbcf___pyx_scope_struct_36_itervalues *__pyx_cur_scope;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("itervalues", 0);
  __pyx_cur_scope = (struct __pyx_obj_5pysam_7libcbcf___pyx_scope_struct_36_itervalues *)__pyx_tp_new_5pysam_7libcbcf___pyx_scope_struct_36_itervalues(__pyx_mstate_global->__pyx_ptype_5pysam_7libcbcf___pyx_scope_struct_36_itervalues, __pyx_mstate_global->__pyx_empty_tuple, NULL);
  if (unlikely(!__pyx_cur_scope)) {
    __pyx_cur_scope = ((struct __pyx_obj_5pysam_7libcbcf___pyx_scope_struct_36_itervalues *)Py_None);
    __Pyx_INCREF(Py_None);
    __PYX_ERR(0, 3703, __pyx_L1_error)
  } else {
    __Pyx_GOTREF((PyObject *)__pyx_cur_scope);
  }
  __pyx_cur_scope->__pyx_v_self = __pyx_v_self;
  __Pyx_INCREF((PyObject *)__pyx_cur_scope->__pyx_v_self);
  __Pyx_GIVEREF((PyObject *)__pyx_cur_scope->__pyx_v_self);
  {
    __pyx_CoroutineObject *gen = __Pyx_Generator_New((__pyx_coroutine_body_t) __pyx_gb_5pysam_7libcbcf_9BaseIndex_18generator26, ((PyObject *)__pyx_mstate_global->__pyx_codeobj_tab[327]), (PyObject *) __pyx_cur_scope, __pyx_mstate_global->__pyx_n_u_itervalues, __pyx_mstate_global->__pyx_n_u_BaseIndex_itervalues, __pyx_mstate_global->__pyx_n_u_pysam_libcbcf); if (unlikely(!gen)) __PYX_ERR(0, 3703, __pyx_L1_error)
    __Pyx_DECREF(__pyx_cur_scope);
    __Pyx_RefNannyFinishContext();
    return (PyObject *) gen;
  }

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_AddTraceback("pysam.libcbcf.BaseIndex.itervalues", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __Pyx_DECREF((PyObject *)__pyx_cur_scope);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_gb_5pysam_7libcbcf_9BaseIndex_18generator26(__pyx_CoroutineObject *__pyx_generator, CYTHON_UNUSED PyThreadState *__pyx_tstate, PyObject *__pyx_sent_value) /* generator body */
{
  struct __pyx_obj_5pysam_7libcbcf___pyx_scope_struct_36_itervalues *__pyx_cur_scope = ((struct __pyx_obj_5pysam_7libcbcf___pyx_scope_struct_36_itervalues *)__pyx_generator->closure);
  PyObject *__pyx_r = NULL;
  __Pyx_TraceDeclarationsGen
  PyObject *__pyx_t_1 = NULL;
  Py_ssize_t __pyx_t_2;
  PyObject *(*__pyx_t_3)(PyObject *);
  PyObject *__pyx_t_4 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("itervalues", 0);
  switch (__pyx_generator->resume_label) {
    case 0: goto __pyx_L3_first_run;
    case 1: goto __pyx_L6_resume_from_yield;
    default: /* CPython raises the right error here */
    __Pyx_TraceStartGen("itervalues", __pyx_f[0], 3703, 0, 0, 0, __PYX_ERR(0, 3703, __pyx_L1_error));
    __Pyx_TraceReturnValue(Py_None, 0, 0, __PYX_ERR(0, 3703, __pyx_L1_error));
    __Pyx_RefNannyFinishContext();
    return NULL;
  }
  __pyx_L3_first_run:;
  __Pyx_TraceStartGen("itervalues", __pyx_f[0], 3703, 0, 0, 0, __PYX_ERR(0, 3703, __pyx_L1_error));
  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, 3703, __pyx_L1_error)
  }

  /* "pysam/libcbcf.pyx":3705
 *     def itervalues(self):
 *         """D.itervalues() -> an iterator over the values of D"""
 *         for key in self:             # <<<<<<<<<<<<<<
 *             yield self[key]
 * 
*/
  if (likely(PyList_CheckExact(((PyObject *)__pyx_cur_scope->__pyx_v_self))) || PyTuple_CheckExact(((PyObject *)__pyx_cur_scope->__pyx_v_self))) {
    __pyx_t_1 = ((PyObject *)__pyx_cur_scope->__pyx_v_self); __Pyx_INCREF(__pyx_t_1);
    __pyx_t_2 = 0;
    __pyx_t_3 = NULL;
  } else {
    __pyx_t_2 = -1; __pyx_t_1 = PyObject_GetIter(((PyObject *)__pyx_cur_scope->__pyx_v_self)); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 3705, __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, 3705, __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, 3705, __pyx_L1_error)
          #endif
          if (__pyx_t_2 >= __pyx_temp) break;
        }
        __pyx_t_4 = __Pyx_PyList_GetItemRef(__pyx_t_1, __pyx_t_2);
        ++__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, 3705, __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, 3705, __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, 3705, __pyx_L1_error)
          PyErr_Clear();
        }
        break;
      }
    }
    __Pyx_GOTREF(__pyx_t_4);
    __Pyx_XGOTREF(__pyx_cur_scope->__pyx_v_key);
    __Pyx_XDECREF_SET(__pyx_cur_scope->__pyx_v_key, __pyx_t_4);
    __Pyx_GIVEREF(__pyx_t_4);
    __pyx_t_4 = 0;

    /* "pysam/libcbcf.pyx":3706
 *         """D.itervalues() -> an iterator over the values of D"""
 *         for key in self:
 *             yield self[key]             # <<<<<<<<<<<<<<
 * 
 *     def iteritems(self):
*/
    __pyx_t_4 = __Pyx_PyObject_GetItem(((PyObject *)__pyx_cur_scope->__pyx_v_self), __pyx_cur_scope->__pyx_v_key); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 3706, __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_TraceYield(__pyx_r, 0, __PYX_ERR(0, 3706, __pyx_L1_error));
    __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_TraceResumeGen("itervalues", __pyx_f[0], 3703, 0, __PYX_ERR(0, 3706, __pyx_L1_error));
    __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, 3706, __pyx_L1_error)

    /* "pysam/libcbcf.pyx":3705
 *     def itervalues(self):
 *         """D.itervalues() -> an iterator over the values of D"""
 *         for key in self:             # <<<<<<<<<<<<<<
 *             yield self[key]
 * 
*/
  }
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  CYTHON_MAYBE_UNUSED_VAR(__pyx_cur_scope);
  __Pyx_TraceReturnValue(Py_None, 0, 0, __PYX_ERR(0, 3703, __pyx_L1_error));

  /* "pysam/libcbcf.pyx":3703
 *         return iter(self)
 * 
 *     def itervalues(self):             # <<<<<<<<<<<<<<
 *         """D.itervalues() -> an iterator over the values of D"""
 *         for key in self:
*/

  /* 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_TraceException(__pyx_lineno, 0, 0);
    __Pyx_Generator_Replace_StopIteration(0);
    __Pyx_AddTraceback("itervalues", __pyx_clineno, __pyx_lineno, __pyx_filename);
    __Pyx_TraceExceptionUnwind(0, 0);
  }
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_PyMonitoring_ExitScope(0);
  #if !CYTHON_USE_EXC_INFO_STACK
  __Pyx_Coroutine_ResetAndClearException(__pyx_generator);
  #endif
  __pyx_generator->resume_label = -1;
  __Pyx_Coroutine_clear((PyObject*)__pyx_generator);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}
static PyObject *__pyx_gb_5pysam_7libcbcf_9BaseIndex_21generator27(__pyx_CoroutineObject *__pyx_generator, CYTHON_UNUSED PyThreadState *__pyx_tstate, PyObject *__pyx_sent_value); /* proto */

/* "pysam/libcbcf.pyx":3708
 *             yield self[key]
 * 
 *     def iteritems(self):             # <<<<<<<<<<<<<<
 *         """D.iteritems() -> an iterator over the (key, value) items of D"""
 *         for key in self:
*/

/* Python wrapper */
static PyObject *__pyx_pw_5pysam_7libcbcf_9BaseIndex_20iteritems(PyObject *__pyx_v_self, 
#if 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_5pysam_7libcbcf_9BaseIndex_19iteritems, "BaseIndex.iteritems(self)\n\nD.iteritems() -> an iterator over the (key, value) items of D");
static PyMethodDef __pyx_mdef_5pysam_7libcbcf_9BaseIndex_20iteritems = {"iteritems", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_5pysam_7libcbcf_9BaseIndex_20iteritems, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_5pysam_7libcbcf_9BaseIndex_19iteritems};
static PyObject *__pyx_pw_5pysam_7libcbcf_9BaseIndex_20iteritems(PyObject *__pyx_v_self, 
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
) {
  #if !CYTHON_METH_FASTCALL
  CYTHON_UNUSED Py_ssize_t __pyx_nargs;
  #endif
  CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("iteritems (wrapper)", 0);
  #if !CYTHON_METH_FASTCALL
  #if CYTHON_ASSUME_SAFE_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("iteritems", 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("iteritems", __pyx_kwds); return NULL;}
  __pyx_r = __pyx_pf_5pysam_7libcbcf_9BaseIndex_19iteritems(((struct __pyx_obj_5pysam_7libcbcf_BaseIndex *)__pyx_v_self));

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

static PyObject *__pyx_pf_5pysam_7libcbcf_9BaseIndex_19iteritems(struct __pyx_obj_5pysam_7libcbcf_BaseIndex *__pyx_v_self) {
  struct __pyx_obj_5pysam_7libcbcf___pyx_scope_struct_37_iteritems *__pyx_cur_scope;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("iteritems", 0);
  __pyx_cur_scope = (struct __pyx_obj_5pysam_7libcbcf___pyx_scope_struct_37_iteritems *)__pyx_tp_new_5pysam_7libcbcf___pyx_scope_struct_37_iteritems(__pyx_mstate_global->__pyx_ptype_5pysam_7libcbcf___pyx_scope_struct_37_iteritems, __pyx_mstate_global->__pyx_empty_tuple, NULL);
  if (unlikely(!__pyx_cur_scope)) {
    __pyx_cur_scope = ((struct __pyx_obj_5pysam_7libcbcf___pyx_scope_struct_37_iteritems *)Py_None);
    __Pyx_INCREF(Py_None);
    __PYX_ERR(0, 3708, __pyx_L1_error)
  } else {
    __Pyx_GOTREF((PyObject *)__pyx_cur_scope);
  }
  __pyx_cur_scope->__pyx_v_self = __pyx_v_self;
  __Pyx_INCREF((PyObject *)__pyx_cur_scope->__pyx_v_self);
  __Pyx_GIVEREF((PyObject *)__pyx_cur_scope->__pyx_v_self);
  {
    __pyx_CoroutineObject *gen = __Pyx_Generator_New((__pyx_coroutine_body_t) __pyx_gb_5pysam_7libcbcf_9BaseIndex_21generator27, ((PyObject *)__pyx_mstate_global->__pyx_codeobj_tab[328]), (PyObject *) __pyx_cur_scope, __pyx_mstate_global->__pyx_n_u_iteritems, __pyx_mstate_global->__pyx_n_u_BaseIndex_iteritems, __pyx_mstate_global->__pyx_n_u_pysam_libcbcf); if (unlikely(!gen)) __PYX_ERR(0, 3708, __pyx_L1_error)
    __Pyx_DECREF(__pyx_cur_scope);
    __Pyx_RefNannyFinishContext();
    return (PyObject *) gen;
  }

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_AddTraceback("pysam.libcbcf.BaseIndex.iteritems", __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_5pysam_7libcbcf_9BaseIndex_21generator27(__pyx_CoroutineObject *__pyx_generator, CYTHON_UNUSED PyThreadState *__pyx_tstate, PyObject *__pyx_sent_value) /* generator body */
{
  struct __pyx_obj_5pysam_7libcbcf___pyx_scope_struct_37_iteritems *__pyx_cur_scope = ((struct __pyx_obj_5pysam_7libcbcf___pyx_scope_struct_37_iteritems *)__pyx_generator->closure);
  PyObject *__pyx_r = NULL;
  __Pyx_TraceDeclarationsGen
  PyObject *__pyx_t_1 = NULL;
  Py_ssize_t __pyx_t_2;
  PyObject *(*__pyx_t_3)(PyObject *);
  PyObject *__pyx_t_4 = NULL;
  PyObject *__pyx_t_5 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("iteritems", 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_TraceStartGen("iteritems", __pyx_f[0], 3708, 0, 0, 0, __PYX_ERR(0, 3708, __pyx_L1_error));
    __Pyx_TraceReturnValue(Py_None, 0, 0, __PYX_ERR(0, 3708, __pyx_L1_error));
    __Pyx_RefNannyFinishContext();
    return NULL;
  }
  __pyx_L3_first_run:;
  __Pyx_TraceStartGen("iteritems", __pyx_f[0], 3708, 0, 0, 0, __PYX_ERR(0, 3708, __pyx_L1_error));
  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, 3708, __pyx_L1_error)
  }

  /* "pysam/libcbcf.pyx":3710
 *     def iteritems(self):
 *         """D.iteritems() -> an iterator over the (key, value) items of D"""
 *         for key in self:             # <<<<<<<<<<<<<<
 *             yield (key, self[key])
 * 
*/
  if (likely(PyList_CheckExact(((PyObject *)__pyx_cur_scope->__pyx_v_self))) || PyTuple_CheckExact(((PyObject *)__pyx_cur_scope->__pyx_v_self))) {
    __pyx_t_1 = ((PyObject *)__pyx_cur_scope->__pyx_v_self); __Pyx_INCREF(__pyx_t_1);
    __pyx_t_2 = 0;
    __pyx_t_3 = NULL;
  } else {
    __pyx_t_2 = -1; __pyx_t_1 = PyObject_GetIter(((PyObject *)__pyx_cur_scope->__pyx_v_self)); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 3710, __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, 3710, __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, 3710, __pyx_L1_error)
          #endif
          if (__pyx_t_2 >= __pyx_temp) break;
        }
        __pyx_t_4 = __Pyx_PyList_GetItemRef(__pyx_t_1, __pyx_t_2);
        ++__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, 3710, __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, 3710, __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, 3710, __pyx_L1_error)
          PyErr_Clear();
        }
        break;
      }
    }
    __Pyx_GOTREF(__pyx_t_4);
    __Pyx_XGOTREF(__pyx_cur_scope->__pyx_v_key);
    __Pyx_XDECREF_SET(__pyx_cur_scope->__pyx_v_key, __pyx_t_4);
    __Pyx_GIVEREF(__pyx_t_4);
    __pyx_t_4 = 0;

    /* "pysam/libcbcf.pyx":3711
 *         """D.iteritems() -> an iterator over the (key, value) items of D"""
 *         for key in self:
 *             yield (key, self[key])             # <<<<<<<<<<<<<<
 * 
 *     def keys(self):
*/
    __pyx_t_4 = __Pyx_PyObject_GetItem(((PyObject *)__pyx_cur_scope->__pyx_v_self), __pyx_cur_scope->__pyx_v_key); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 3711, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
    __pyx_t_5 = PyTuple_New(2); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 3711, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_5);
    __Pyx_INCREF(__pyx_cur_scope->__pyx_v_key);
    __Pyx_GIVEREF(__pyx_cur_scope->__pyx_v_key);
    if (__Pyx_PyTuple_SET_ITEM(__pyx_t_5, 0, __pyx_cur_scope->__pyx_v_key) != (0)) __PYX_ERR(0, 3711, __pyx_L1_error);
    __Pyx_GIVEREF(__pyx_t_4);
    if (__Pyx_PyTuple_SET_ITEM(__pyx_t_5, 1, __pyx_t_4) != (0)) __PYX_ERR(0, 3711, __pyx_L1_error);
    __pyx_t_4 = 0;
    __pyx_r = __pyx_t_5;
    __pyx_t_5 = 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_TraceYield(__pyx_r, 0, __PYX_ERR(0, 3711, __pyx_L1_error));
    __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_TraceResumeGen("iteritems", __pyx_f[0], 3708, 0, __PYX_ERR(0, 3711, __pyx_L1_error));
    __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, 3711, __pyx_L1_error)

    /* "pysam/libcbcf.pyx":3710
 *     def iteritems(self):
 *         """D.iteritems() -> an iterator over the (key, value) items of D"""
 *         for key in self:             # <<<<<<<<<<<<<<
 *             yield (key, self[key])
 * 
*/
  }
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  CYTHON_MAYBE_UNUSED_VAR(__pyx_cur_scope);
  __Pyx_TraceReturnValue(Py_None, 0, 0, __PYX_ERR(0, 3708, __pyx_L1_error));

  /* "pysam/libcbcf.pyx":3708
 *             yield self[key]
 * 
 *     def iteritems(self):             # <<<<<<<<<<<<<<
 *         """D.iteritems() -> an iterator over the (key, value) items of D"""
 *         for key in self:
*/

  /* 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);
  if (__Pyx_PyErr_Occurred()) {
    __Pyx_TraceException(__pyx_lineno, 0, 0);
    __Pyx_Generator_Replace_StopIteration(0);
    __Pyx_AddTraceback("iteritems", __pyx_clineno, __pyx_lineno, __pyx_filename);
    __Pyx_TraceExceptionUnwind(0, 0);
  }
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_PyMonitoring_ExitScope(0);
  #if !CYTHON_USE_EXC_INFO_STACK
  __Pyx_Coroutine_ResetAndClearException(__pyx_generator);
  #endif
  __pyx_generator->resume_label = -1;
  __Pyx_Coroutine_clear((PyObject*)__pyx_generator);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "pysam/libcbcf.pyx":3713
 *             yield (key, self[key])
 * 
 *     def keys(self):             # <<<<<<<<<<<<<<
 *         """D.keys() -> list of D's keys"""
 *         return list(self)
*/

/* Python wrapper */
static PyObject *__pyx_pw_5pysam_7libcbcf_9BaseIndex_23keys(PyObject *__pyx_v_self, 
#if 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_5pysam_7libcbcf_9BaseIndex_22keys, "BaseIndex.keys(self)\n\nD.keys() -> list of D's keys");
static PyMethodDef __pyx_mdef_5pysam_7libcbcf_9BaseIndex_23keys = {"keys", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_5pysam_7libcbcf_9BaseIndex_23keys, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_5pysam_7libcbcf_9BaseIndex_22keys};
static PyObject *__pyx_pw_5pysam_7libcbcf_9BaseIndex_23keys(PyObject *__pyx_v_self, 
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
) {
  #if !CYTHON_METH_FASTCALL
  CYTHON_UNUSED Py_ssize_t __pyx_nargs;
  #endif
  CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("keys (wrapper)", 0);
  #if !CYTHON_METH_FASTCALL
  #if CYTHON_ASSUME_SAFE_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("keys", 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("keys", __pyx_kwds); return NULL;}
  __pyx_r = __pyx_pf_5pysam_7libcbcf_9BaseIndex_22keys(((struct __pyx_obj_5pysam_7libcbcf_BaseIndex *)__pyx_v_self));

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

static PyObject *__pyx_pf_5pysam_7libcbcf_9BaseIndex_22keys(struct __pyx_obj_5pysam_7libcbcf_BaseIndex *__pyx_v_self) {
  PyObject *__pyx_r = NULL;
  __Pyx_TraceDeclarationsFunc
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_TraceFrameInit(((PyObject *)__pyx_mstate_global->__pyx_codeobj_tab[329]))
  __Pyx_RefNannySetupContext("keys", 0);
  __Pyx_TraceStartFunc("keys", __pyx_f[0], 3713, 0, 0, 0, __PYX_ERR(0, 3713, __pyx_L1_error));

  /* "pysam/libcbcf.pyx":3715
 *     def keys(self):
 *         """D.keys() -> list of D's keys"""
 *         return list(self)             # <<<<<<<<<<<<<<
 * 
 *     def items(self):
*/
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = PySequence_List(((PyObject *)__pyx_v_self)); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 3715, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  __Pyx_TraceReturnValue(__pyx_r, 1, 0, __PYX_ERR(0, 3715, __pyx_L1_error));
  goto __pyx_L0;

  /* "pysam/libcbcf.pyx":3713
 *             yield (key, self[key])
 * 
 *     def keys(self):             # <<<<<<<<<<<<<<
 *         """D.keys() -> list of D's keys"""
 *         return list(self)
*/

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_TraceException(__pyx_lineno, 0, 0);
  #if CYTHON_USE_SYS_MONITORING
  __Pyx_TraceExceptionUnwind(0, 0);
  #else
  __Pyx_TraceReturnValue(NULL, 0, 0, __PYX_ERR(0, 3713, __pyx_L1_error));
  #endif
  __Pyx_AddTraceback("pysam.libcbcf.BaseIndex.keys", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_PyMonitoring_ExitScope(0);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "pysam/libcbcf.pyx":3717
 *         return list(self)
 * 
 *     def items(self):             # <<<<<<<<<<<<<<
 *         """D.items() -> list of D's (key, value) pairs, as 2-tuples"""
 *         return list(self.iteritems())
*/

/* Python wrapper */
static PyObject *__pyx_pw_5pysam_7libcbcf_9BaseIndex_25items(PyObject *__pyx_v_self, 
#if 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_5pysam_7libcbcf_9BaseIndex_24items, "BaseIndex.items(self)\n\nD.items() -> list of D's (key, value) pairs, as 2-tuples");
static PyMethodDef __pyx_mdef_5pysam_7libcbcf_9BaseIndex_25items = {"items", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_5pysam_7libcbcf_9BaseIndex_25items, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_5pysam_7libcbcf_9BaseIndex_24items};
static PyObject *__pyx_pw_5pysam_7libcbcf_9BaseIndex_25items(PyObject *__pyx_v_self, 
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
) {
  #if !CYTHON_METH_FASTCALL
  CYTHON_UNUSED Py_ssize_t __pyx_nargs;
  #endif
  CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("items (wrapper)", 0);
  #if !CYTHON_METH_FASTCALL
  #if CYTHON_ASSUME_SAFE_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("items", 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("items", __pyx_kwds); return NULL;}
  __pyx_r = __pyx_pf_5pysam_7libcbcf_9BaseIndex_24items(((struct __pyx_obj_5pysam_7libcbcf_BaseIndex *)__pyx_v_self));

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

static PyObject *__pyx_pf_5pysam_7libcbcf_9BaseIndex_24items(struct __pyx_obj_5pysam_7libcbcf_BaseIndex *__pyx_v_self) {
  PyObject *__pyx_r = NULL;
  __Pyx_TraceDeclarationsFunc
  __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_TraceFrameInit(((PyObject *)__pyx_mstate_global->__pyx_codeobj_tab[330]))
  __Pyx_RefNannySetupContext("items", 0);
  __Pyx_TraceStartFunc("items", __pyx_f[0], 3717, 0, 0, 0, __PYX_ERR(0, 3717, __pyx_L1_error));

  /* "pysam/libcbcf.pyx":3719
 *     def items(self):
 *         """D.items() -> list of D's (key, value) pairs, as 2-tuples"""
 *         return list(self.iteritems())             # <<<<<<<<<<<<<<
 * 
 *     def values(self):
*/
  __Pyx_XDECREF(__pyx_r);
  __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(__pyx_mstate_global->__pyx_n_u_iteritems, __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, 3719, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
  }
  __pyx_t_2 = __Pyx_PySequence_ListKeepNew(__pyx_t_1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 3719, __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;
  __Pyx_TraceReturnValue(__pyx_r, 1, 0, __PYX_ERR(0, 3719, __pyx_L1_error));
  goto __pyx_L0;

  /* "pysam/libcbcf.pyx":3717
 *         return list(self)
 * 
 *     def items(self):             # <<<<<<<<<<<<<<
 *         """D.items() -> list of D's (key, value) pairs, as 2-tuples"""
 *         return list(self.iteritems())
*/

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_TraceException(__pyx_lineno, 0, 0);
  #if CYTHON_USE_SYS_MONITORING
  __Pyx_TraceExceptionUnwind(0, 0);
  #else
  __Pyx_TraceReturnValue(NULL, 0, 0, __PYX_ERR(0, 3717, __pyx_L1_error));
  #endif
  __Pyx_AddTraceback("pysam.libcbcf.BaseIndex.items", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_PyMonitoring_ExitScope(0);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "pysam/libcbcf.pyx":3721
 *         return list(self.iteritems())
 * 
 *     def values(self):             # <<<<<<<<<<<<<<
 *         """D.values() -> list of D's values"""
 *         return list(self.itervalues())
*/

/* Python wrapper */
static PyObject *__pyx_pw_5pysam_7libcbcf_9BaseIndex_27values(PyObject *__pyx_v_self, 
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
); /*proto*/
PyDoc_STRVAR(__pyx_doc_5pysam_7libcbcf_9BaseIndex_26values, "BaseIndex.values(self)\n\nD.values() -> list of D's values");
static PyMethodDef __pyx_mdef_5pysam_7libcbcf_9BaseIndex_27values = {"values", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_5pysam_7libcbcf_9BaseIndex_27values, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_5pysam_7libcbcf_9BaseIndex_26values};
static PyObject *__pyx_pw_5pysam_7libcbcf_9BaseIndex_27values(PyObject *__pyx_v_self, 
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
) {
  #if !CYTHON_METH_FASTCALL
  CYTHON_UNUSED Py_ssize_t __pyx_nargs;
  #endif
  CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("values (wrapper)", 0);
  #if !CYTHON_METH_FASTCALL
  #if CYTHON_ASSUME_SAFE_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("values", 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("values", __pyx_kwds); return NULL;}
  __pyx_r = __pyx_pf_5pysam_7libcbcf_9BaseIndex_26values(((struct __pyx_obj_5pysam_7libcbcf_BaseIndex *)__pyx_v_self));

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

static PyObject *__pyx_pf_5pysam_7libcbcf_9BaseIndex_26values(struct __pyx_obj_5pysam_7libcbcf_BaseIndex *__pyx_v_self) {
  PyObject *__pyx_r = NULL;
  __Pyx_TraceDeclarationsFunc
  __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_TraceFrameInit(((PyObject *)__pyx_mstate_global->__pyx_codeobj_tab[331]))
  __Pyx_RefNannySetupContext("values", 0);
  __Pyx_TraceStartFunc("values", __pyx_f[0], 3721, 0, 0, 0, __PYX_ERR(0, 3721, __pyx_L1_error));

  /* "pysam/libcbcf.pyx":3723
 *     def values(self):
 *         """D.values() -> list of D's values"""
 *         return list(self.itervalues())             # <<<<<<<<<<<<<<
 * 
 *     def update(self, items=None, **kwargs):
*/
  __Pyx_XDECREF(__pyx_r);
  __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(__pyx_mstate_global->__pyx_n_u_itervalues, __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, 3723, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
  }
  __pyx_t_2 = __Pyx_PySequence_ListKeepNew(__pyx_t_1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 3723, __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;
  __Pyx_TraceReturnValue(__pyx_r, 1, 0, __PYX_ERR(0, 3723, __pyx_L1_error));
  goto __pyx_L0;

  /* "pysam/libcbcf.pyx":3721
 *         return list(self.iteritems())
 * 
 *     def values(self):             # <<<<<<<<<<<<<<
 *         """D.values() -> list of D's values"""
 *         return list(self.itervalues())
*/

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_TraceException(__pyx_lineno, 0, 0);
  #if CYTHON_USE_SYS_MONITORING
  __Pyx_TraceExceptionUnwind(0, 0);
  #else
  __Pyx_TraceReturnValue(NULL, 0, 0, __PYX_ERR(0, 3721, __pyx_L1_error));
  #endif
  __Pyx_AddTraceback("pysam.libcbcf.BaseIndex.values", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_PyMonitoring_ExitScope(0);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "pysam/libcbcf.pyx":3725
 *         return list(self.itervalues())
 * 
 *     def update(self, items=None, **kwargs):             # <<<<<<<<<<<<<<
 *         """D.update([E, ]**F) -> None.
 * 
*/

/* Python wrapper */
static PyObject *__pyx_pw_5pysam_7libcbcf_9BaseIndex_29update(PyObject *__pyx_v_self, 
#if 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_5pysam_7libcbcf_9BaseIndex_28update, "BaseIndex.update(self, items=None, **kwargs)\n\nD.update([E, ]**F) -> None.\n\nUpdate D from dict/iterable E and F.");
static PyMethodDef __pyx_mdef_5pysam_7libcbcf_9BaseIndex_29update = {"update", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_5pysam_7libcbcf_9BaseIndex_29update, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_5pysam_7libcbcf_9BaseIndex_28update};
static PyObject *__pyx_pw_5pysam_7libcbcf_9BaseIndex_29update(PyObject *__pyx_v_self, 
#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_items = 0;
  PyObject *__pyx_v_kwargs = 0;
  #if !CYTHON_METH_FASTCALL
  CYTHON_UNUSED Py_ssize_t __pyx_nargs;
  #endif
  CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
  PyObject* values[1] = {0};
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("update (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_kwargs = PyDict_New(); if (unlikely(!__pyx_v_kwargs)) return NULL;
  __Pyx_GOTREF(__pyx_v_kwargs);
  {
    PyObject ** const __pyx_pyargnames[] = {&__pyx_mstate_global->__pyx_n_u_items,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, 3725, __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, 3725, __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, __pyx_v_kwargs, values, kwd_pos_args, __pyx_kwds_len, "update", 1) < 0) __PYX_ERR(0, 3725, __pyx_L3_error)
      if (!values[0]) values[0] = __Pyx_NewRef(((PyObject *)Py_None));
    } 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, 3725, __pyx_L3_error)
        CYTHON_FALLTHROUGH;
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      if (!values[0]) values[0] = __Pyx_NewRef(((PyObject *)Py_None));
    }
    __pyx_v_items = values[0];
  }
  goto __pyx_L6_skip;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("update", 0, 0, 1, __pyx_nargs); __PYX_ERR(0, 3725, __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_kwargs); __pyx_v_kwargs = 0;
  __Pyx_AddTraceback("pysam.libcbcf.BaseIndex.update", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_5pysam_7libcbcf_9BaseIndex_28update(((struct __pyx_obj_5pysam_7libcbcf_BaseIndex *)__pyx_v_self), __pyx_v_items, __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_kwargs);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_5pysam_7libcbcf_9BaseIndex_28update(struct __pyx_obj_5pysam_7libcbcf_BaseIndex *__pyx_v_self, PyObject *__pyx_v_items, PyObject *__pyx_v_kwargs) {
  PyObject *__pyx_v_k = NULL;
  PyObject *__pyx_v_v = NULL;
  PyObject *__pyx_r = NULL;
  __Pyx_TraceDeclarationsFunc
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  Py_ssize_t __pyx_t_2;
  Py_ssize_t __pyx_t_3;
  int __pyx_t_4;
  PyObject *__pyx_t_5 = NULL;
  PyObject *__pyx_t_6 = NULL;
  int __pyx_t_7;
  int __pyx_t_8;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_TraceFrameInit(((PyObject *)__pyx_mstate_global->__pyx_codeobj_tab[332]))
  __Pyx_RefNannySetupContext("update", 0);
  __Pyx_TraceStartFunc("update", __pyx_f[0], 3725, 0, 0, 0, __PYX_ERR(0, 3725, __pyx_L1_error));

  /* "pysam/libcbcf.pyx":3730
 *         Update D from dict/iterable E and F.
 *         """
 *         for k, v in items.items():             # <<<<<<<<<<<<<<
 *             self[k] = v
 * 
*/
  __pyx_t_2 = 0;
  if (unlikely(__pyx_v_items == Py_None)) {
    PyErr_Format(PyExc_AttributeError, "'NoneType' object has no attribute '%.30s'", "items");
    __PYX_ERR(0, 3730, __pyx_L1_error)
  }
  __pyx_t_5 = __Pyx_dict_iterator(__pyx_v_items, 0, __pyx_mstate_global->__pyx_n_u_items, (&__pyx_t_3), (&__pyx_t_4)); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 3730, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_5);
  __Pyx_XDECREF(__pyx_t_1);
  __pyx_t_1 = __pyx_t_5;
  __pyx_t_5 = 0;
  while (1) {
    __pyx_t_7 = __Pyx_dict_iter_next(__pyx_t_1, __pyx_t_3, &__pyx_t_2, &__pyx_t_5, &__pyx_t_6, NULL, __pyx_t_4);
    if (unlikely(__pyx_t_7 == 0)) break;
    if (unlikely(__pyx_t_7 == -1)) __PYX_ERR(0, 3730, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_5);
    __Pyx_GOTREF(__pyx_t_6);
    __Pyx_XDECREF_SET(__pyx_v_k, __pyx_t_5);
    __pyx_t_5 = 0;
    __Pyx_XDECREF_SET(__pyx_v_v, __pyx_t_6);
    __pyx_t_6 = 0;

    /* "pysam/libcbcf.pyx":3731
 *         """
 *         for k, v in items.items():
 *             self[k] = v             # <<<<<<<<<<<<<<
 * 
 *         if kwargs:
*/
    if (unlikely((PyObject_SetItem(((PyObject *)__pyx_v_self), __pyx_v_k, __pyx_v_v) < 0))) __PYX_ERR(0, 3731, __pyx_L1_error)
  }
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "pysam/libcbcf.pyx":3733
 *             self[k] = v
 * 
 *         if kwargs:             # <<<<<<<<<<<<<<
 *             for k, v in kwargs.items():
 *                 self[k] = v
*/
  __pyx_t_8 = __Pyx_PyObject_IsTrue(__pyx_v_kwargs); if (unlikely((__pyx_t_8 < 0))) __PYX_ERR(0, 3733, __pyx_L1_error)
  if (__pyx_t_8) {

    /* "pysam/libcbcf.pyx":3734
 * 
 *         if kwargs:
 *             for k, v in kwargs.items():             # <<<<<<<<<<<<<<
 *                 self[k] = v
 * 
*/
    __pyx_t_3 = 0;
    __pyx_t_6 = __Pyx_dict_iterator(__pyx_v_kwargs, 1, __pyx_mstate_global->__pyx_n_u_items, (&__pyx_t_2), (&__pyx_t_4)); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 3734, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_6);
    __Pyx_XDECREF(__pyx_t_1);
    __pyx_t_1 = __pyx_t_6;
    __pyx_t_6 = 0;
    while (1) {
      __pyx_t_7 = __Pyx_dict_iter_next(__pyx_t_1, __pyx_t_2, &__pyx_t_3, &__pyx_t_6, &__pyx_t_5, NULL, __pyx_t_4);
      if (unlikely(__pyx_t_7 == 0)) break;
      if (unlikely(__pyx_t_7 == -1)) __PYX_ERR(0, 3734, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_6);
      __Pyx_GOTREF(__pyx_t_5);
      __Pyx_XDECREF_SET(__pyx_v_k, __pyx_t_6);
      __pyx_t_6 = 0;
      __Pyx_XDECREF_SET(__pyx_v_v, __pyx_t_5);
      __pyx_t_5 = 0;

      /* "pysam/libcbcf.pyx":3735
 *         if kwargs:
 *             for k, v in kwargs.items():
 *                 self[k] = v             # <<<<<<<<<<<<<<
 * 
 *     def pop(self, key, default=_nothing):
*/
      if (unlikely((PyObject_SetItem(((PyObject *)__pyx_v_self), __pyx_v_k, __pyx_v_v) < 0))) __PYX_ERR(0, 3735, __pyx_L1_error)
    }
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

    /* "pysam/libcbcf.pyx":3733
 *             self[k] = v
 * 
 *         if kwargs:             # <<<<<<<<<<<<<<
 *             for k, v in kwargs.items():
 *                 self[k] = v
*/
  }

  /* "pysam/libcbcf.pyx":3725
 *         return list(self.itervalues())
 * 
 *     def update(self, items=None, **kwargs):             # <<<<<<<<<<<<<<
 *         """D.update([E, ]**F) -> None.
 * 
*/

  /* function exit code */
  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  __Pyx_TraceReturnValue(__pyx_r, 0, 0, __PYX_ERR(0, 3725, __pyx_L1_error));
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_5);
  __Pyx_XDECREF(__pyx_t_6);
  __Pyx_TraceException(__pyx_lineno, 0, 0);
  #if CYTHON_USE_SYS_MONITORING
  __Pyx_TraceExceptionUnwind(0, 0);
  #else
  __Pyx_TraceReturnValue(NULL, 0, 0, __PYX_ERR(0, 3725, __pyx_L1_error));
  #endif
  __Pyx_AddTraceback("pysam.libcbcf.BaseIndex.update", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_k);
  __Pyx_XDECREF(__pyx_v_v);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_PyMonitoring_ExitScope(0);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "pysam/libcbcf.pyx":3737
 *                 self[k] = v
 * 
 *     def pop(self, key, default=_nothing):             # <<<<<<<<<<<<<<
 *         try:
 *             value = self[key]
*/

/* Python wrapper */
static PyObject *__pyx_pw_5pysam_7libcbcf_9BaseIndex_31pop(PyObject *__pyx_v_self, 
#if 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_5pysam_7libcbcf_9BaseIndex_30pop, "BaseIndex.pop(self, key, default=_nothing)");
static PyMethodDef __pyx_mdef_5pysam_7libcbcf_9BaseIndex_31pop = {"pop", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_5pysam_7libcbcf_9BaseIndex_31pop, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_5pysam_7libcbcf_9BaseIndex_30pop};
static PyObject *__pyx_pw_5pysam_7libcbcf_9BaseIndex_31pop(PyObject *__pyx_v_self, 
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
) {
  PyObject *__pyx_v_key = 0;
  PyObject *__pyx_v_default = 0;
  #if !CYTHON_METH_FASTCALL
  CYTHON_UNUSED Py_ssize_t __pyx_nargs;
  #endif
  CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
  PyObject* values[2] = {0,0};
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("pop (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,&__pyx_mstate_global->__pyx_n_u_default,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, 3737, __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, 3737, __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, 3737, __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, "pop", 0) < 0) __PYX_ERR(0, 3737, __pyx_L3_error)
      if (!values[1]) values[1] = __Pyx_NewRef(__pyx_mstate_global->__pyx_k__10);
      for (Py_ssize_t i = __pyx_nargs; i < 1; i++) {
        if (unlikely(!values[i])) { __Pyx_RaiseArgtupleInvalid("pop", 0, 1, 2, i); __PYX_ERR(0, 3737, __pyx_L3_error) }
      }
    } 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, 3737, __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, 3737, __pyx_L3_error)
        break;
        default: goto __pyx_L5_argtuple_error;
      }
      if (!values[1]) values[1] = __Pyx_NewRef(__pyx_mstate_global->__pyx_k__10);
    }
    __pyx_v_key = values[0];
    __pyx_v_default = values[1];
  }
  goto __pyx_L6_skip;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("pop", 0, 1, 2, __pyx_nargs); __PYX_ERR(0, 3737, __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("pysam.libcbcf.BaseIndex.pop", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_5pysam_7libcbcf_9BaseIndex_30pop(((struct __pyx_obj_5pysam_7libcbcf_BaseIndex *)__pyx_v_self), __pyx_v_key, __pyx_v_default);

  /* 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_5pysam_7libcbcf_9BaseIndex_30pop(struct __pyx_obj_5pysam_7libcbcf_BaseIndex *__pyx_v_self, PyObject *__pyx_v_key, PyObject *__pyx_v_default) {
  PyObject *__pyx_v_value = NULL;
  PyObject *__pyx_r = NULL;
  __Pyx_TraceDeclarationsFunc
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  PyObject *__pyx_t_4 = NULL;
  int __pyx_t_5;
  PyObject *__pyx_t_6 = NULL;
  PyObject *__pyx_t_7 = NULL;
  int __pyx_t_8;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_TraceFrameInit(((PyObject *)__pyx_mstate_global->__pyx_codeobj_tab[333]))
  __Pyx_RefNannySetupContext("pop", 0);
  __Pyx_TraceStartFunc("pop", __pyx_f[0], 3737, 0, 0, 0, __PYX_ERR(0, 3737, __pyx_L1_error));

  /* "pysam/libcbcf.pyx":3738
 * 
 *     def pop(self, key, default=_nothing):
 *         try:             # <<<<<<<<<<<<<<
 *             value = self[key]
 *             del self[key]
*/
  {
    __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:*/ {

      /* "pysam/libcbcf.pyx":3739
 *     def pop(self, key, default=_nothing):
 *         try:
 *             value = self[key]             # <<<<<<<<<<<<<<
 *             del self[key]
 *             return value
*/
      __pyx_t_4 = __Pyx_PyObject_GetItem(((PyObject *)__pyx_v_self), __pyx_v_key); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 3739, __pyx_L3_error)
      __Pyx_GOTREF(__pyx_t_4);
      __pyx_v_value = __pyx_t_4;
      __pyx_t_4 = 0;

      /* "pysam/libcbcf.pyx":3740
 *         try:
 *             value = self[key]
 *             del self[key]             # <<<<<<<<<<<<<<
 *             return value
 *         except KeyError:
*/
      if (unlikely((PyObject_DelItem(((PyObject *)__pyx_v_self), __pyx_v_key) < 0))) __PYX_ERR(0, 3740, __pyx_L3_error)

      /* "pysam/libcbcf.pyx":3741
 *             value = self[key]
 *             del self[key]
 *             return value             # <<<<<<<<<<<<<<
 *         except KeyError:
 *             if default is not _nothing:
*/
      __Pyx_XDECREF(__pyx_r);
      __Pyx_INCREF(__pyx_v_value);
      __pyx_r = __pyx_v_value;
      __Pyx_TraceReturnValue(__pyx_r, 11, 0, __PYX_ERR(0, 3741, __pyx_L3_error));
      goto __pyx_L7_try_return;

      /* "pysam/libcbcf.pyx":3738
 * 
 *     def pop(self, key, default=_nothing):
 *         try:             # <<<<<<<<<<<<<<
 *             value = self[key]
 *             del self[key]
*/
    }
    __pyx_L3_error:;
    __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
    __Pyx_TraceException(__pyx_lineno, 0, 0);

    /* "pysam/libcbcf.pyx":3742
 *             del self[key]
 *             return value
 *         except KeyError:             # <<<<<<<<<<<<<<
 *             if default is not _nothing:
 *                 return default
*/
    __pyx_t_5 = __Pyx_PyErr_ExceptionMatches(__pyx_builtin_KeyError);
    if (__pyx_t_5) {
      __Pyx_AddTraceback("pysam.libcbcf.BaseIndex.pop", __pyx_clineno, __pyx_lineno, __pyx_filename);
      __Pyx_TraceExceptionHandled(0);
      if (__Pyx_GetException(&__pyx_t_4, &__pyx_t_6, &__pyx_t_7) < 0) __PYX_ERR(0, 3742, __pyx_L5_except_error)
      __Pyx_XGOTREF(__pyx_t_4);
      __Pyx_XGOTREF(__pyx_t_6);
      __Pyx_XGOTREF(__pyx_t_7);
      __Pyx_TraceExceptionDone();

      /* "pysam/libcbcf.pyx":3743
 *             return value
 *         except KeyError:
 *             if default is not _nothing:             # <<<<<<<<<<<<<<
 *                 return default
 *             raise
*/
      __pyx_t_8 = (__pyx_v_default != __pyx_v_5pysam_7libcbcf__nothing);
      if (__pyx_t_8) {

        /* "pysam/libcbcf.pyx":3744
 *         except KeyError:
 *             if default is not _nothing:
 *                 return default             # <<<<<<<<<<<<<<
 *             raise
 * 
*/
        __Pyx_XDECREF(__pyx_r);
        __Pyx_INCREF(__pyx_v_default);
        __pyx_r = __pyx_v_default;
        __Pyx_TraceReturnValue(__pyx_r, 18, 0, __PYX_ERR(0, 3744, __pyx_L5_except_error));
        __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;

        /* "pysam/libcbcf.pyx":3743
 *             return value
 *         except KeyError:
 *             if default is not _nothing:             # <<<<<<<<<<<<<<
 *                 return default
 *             raise
*/
      }

      /* "pysam/libcbcf.pyx":3745
 *             if default is not _nothing:
 *                 return default
 *             raise             # <<<<<<<<<<<<<<
 * 
 *     # Mappings are not hashable by default, but subclasses can change this
*/
      __Pyx_GIVEREF(__pyx_t_4);
      __Pyx_GIVEREF(__pyx_t_6);
      __Pyx_XGIVEREF(__pyx_t_7);
      __Pyx_ErrRestoreWithState(__pyx_t_4, __pyx_t_6, __pyx_t_7);
      __pyx_t_4 = 0;  __pyx_t_6 = 0;  __pyx_t_7 = 0; 
      __Pyx_TraceException(20, 1, 0);
      __PYX_ERR(0, 3745, __pyx_L5_except_error)
    }
    goto __pyx_L5_except_error;

    /* "pysam/libcbcf.pyx":3738
 * 
 *     def pop(self, key, default=_nothing):
 *         try:             # <<<<<<<<<<<<<<
 *             value = self[key]
 *             del self[key]
*/
    __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;
  }

  /* "pysam/libcbcf.pyx":3737
 *                 self[k] = v
 * 
 *     def pop(self, key, default=_nothing):             # <<<<<<<<<<<<<<
 *         try:
 *             value = self[key]
*/

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_XDECREF(__pyx_t_6);
  __Pyx_XDECREF(__pyx_t_7);
  __Pyx_TraceException(__pyx_lineno, 0, 0);
  #if CYTHON_USE_SYS_MONITORING
  __Pyx_TraceExceptionUnwind(0, 0);
  #else
  __Pyx_TraceReturnValue(NULL, 0, 0, __PYX_ERR(0, 3737, __pyx_L1_error));
  #endif
  __Pyx_AddTraceback("pysam.libcbcf.BaseIndex.pop", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_value);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_PyMonitoring_ExitScope(0);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

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

/* Python wrapper */
static PyObject *__pyx_pw_5pysam_7libcbcf_9BaseIndex_33__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*/
PyDoc_STRVAR(__pyx_doc_5pysam_7libcbcf_9BaseIndex_32__reduce_cython__, "BaseIndex.__reduce_cython__(self)");
static PyMethodDef __pyx_mdef_5pysam_7libcbcf_9BaseIndex_33__reduce_cython__ = {"__reduce_cython__", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_5pysam_7libcbcf_9BaseIndex_33__reduce_cython__, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_5pysam_7libcbcf_9BaseIndex_32__reduce_cython__};
static PyObject *__pyx_pw_5pysam_7libcbcf_9BaseIndex_33__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_5pysam_7libcbcf_9BaseIndex_32__reduce_cython__(((struct __pyx_obj_5pysam_7libcbcf_BaseIndex *)__pyx_v_self));

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

static PyObject *__pyx_pf_5pysam_7libcbcf_9BaseIndex_32__reduce_cython__(struct __pyx_obj_5pysam_7libcbcf_BaseIndex *__pyx_v_self) {
  PyObject *__pyx_v_state = 0;
  PyObject *__pyx_v__dict = 0;
  int __pyx_v_use_setstate;
  PyObject *__pyx_r = NULL;
  __Pyx_TraceDeclarationsFunc
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_t_2;
  PyObject *__pyx_t_3 = NULL;
  int __pyx_t_4;
  PyObject *__pyx_t_5 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_TraceFrameInit(((PyObject *)__pyx_mstate_global->__pyx_codeobj_tab[334]))
  __Pyx_RefNannySetupContext("__reduce_cython__", 0);
  __Pyx_TraceStartFunc("__reduce_cython__", __pyx_f[4], 1, 0, 0, 0, __PYX_ERR(4, 1, __pyx_L1_error));

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

  /* "(tree fragment)":6
 *     cdef bint use_setstate
 *     state = (self.refmap, self.refs)
 *     _dict = getattr(self, '__dict__', None)             # <<<<<<<<<<<<<<
 *     if _dict is not None:
 *         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(4, 6, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_v__dict = __pyx_t_1;
  __pyx_t_1 = 0;

  /* "(tree fragment)":7
 *     state = (self.refmap, self.refs)
 *     _dict = getattr(self, '__dict__', None)
 *     if _dict is not None:             # <<<<<<<<<<<<<<
 *         state += (_dict,)
 *         use_setstate = True
*/
  __pyx_t_2 = (__pyx_v__dict != Py_None);
  if (__pyx_t_2) {

    /* "(tree fragment)":8
 *     _dict = getattr(self, '__dict__', None)
 *     if _dict is not None:
 *         state += (_dict,)             # <<<<<<<<<<<<<<
 *         use_setstate = True
 *     else:
*/
    __pyx_t_1 = PyTuple_New(1); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 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(4, 8, __pyx_L1_error);
    __pyx_t_3 = PyNumber_InPlaceAdd(__pyx_v_state, __pyx_t_1); if (unlikely(!__pyx_t_3)) __PYX_ERR(4, 8, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    __Pyx_DECREF_SET(__pyx_v_state, ((PyObject*)__pyx_t_3));
    __pyx_t_3 = 0;

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

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

  /* "(tree fragment)":11
 *         use_setstate = True
 *     else:
 *         use_setstate = self.refmap is not None or self.refs is not None             # <<<<<<<<<<<<<<
 *     if use_setstate:
 *         return __pyx_unpickle_BaseIndex, (type(self), 0x7898a51, None), state
*/
  /*else*/ {
    __pyx_t_4 = (__pyx_v_self->refmap != ((PyObject*)Py_None));
    if (!__pyx_t_4) {
    } else {
      __pyx_t_2 = __pyx_t_4;
      goto __pyx_L4_bool_binop_done;
    }
    __pyx_t_4 = (__pyx_v_self->refs != ((PyObject*)Py_None));
    __pyx_t_2 = __pyx_t_4;
    __pyx_L4_bool_binop_done:;
    __pyx_v_use_setstate = __pyx_t_2;
  }
  __pyx_L3:;

  /* "(tree fragment)":12
 *     else:
 *         use_setstate = self.refmap is not None or self.refs is not None
 *     if use_setstate:             # <<<<<<<<<<<<<<
 *         return __pyx_unpickle_BaseIndex, (type(self), 0x7898a51, None), state
 *     else:
*/
  if (__pyx_v_use_setstate) {

    /* "(tree fragment)":13
 *         use_setstate = self.refmap is not None or self.refs is not None
 *     if use_setstate:
 *         return __pyx_unpickle_BaseIndex, (type(self), 0x7898a51, None), state             # <<<<<<<<<<<<<<
 *     else:
 *         return __pyx_unpickle_BaseIndex, (type(self), 0x7898a51, state)
*/
    __Pyx_XDECREF(__pyx_r);
    __Pyx_GetModuleGlobalName(__pyx_t_3, __pyx_mstate_global->__pyx_n_u_pyx_unpickle_BaseIndex); if (unlikely(!__pyx_t_3)) __PYX_ERR(4, 13, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __pyx_t_1 = PyTuple_New(3); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 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(4, 13, __pyx_L1_error);
    __Pyx_INCREF(__pyx_mstate_global->__pyx_int_126454353);
    __Pyx_GIVEREF(__pyx_mstate_global->__pyx_int_126454353);
    if (__Pyx_PyTuple_SET_ITEM(__pyx_t_1, 1, __pyx_mstate_global->__pyx_int_126454353) != (0)) __PYX_ERR(4, 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(4, 13, __pyx_L1_error);
    __pyx_t_5 = PyTuple_New(3); if (unlikely(!__pyx_t_5)) __PYX_ERR(4, 13, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_5);
    __Pyx_GIVEREF(__pyx_t_3);
    if (__Pyx_PyTuple_SET_ITEM(__pyx_t_5, 0, __pyx_t_3) != (0)) __PYX_ERR(4, 13, __pyx_L1_error);
    __Pyx_GIVEREF(__pyx_t_1);
    if (__Pyx_PyTuple_SET_ITEM(__pyx_t_5, 1, __pyx_t_1) != (0)) __PYX_ERR(4, 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(4, 13, __pyx_L1_error);
    __pyx_t_3 = 0;
    __pyx_t_1 = 0;
    __pyx_r = __pyx_t_5;
    __pyx_t_5 = 0;
    __Pyx_TraceReturnValue(__pyx_r, 32, 0, __PYX_ERR(4, 13, __pyx_L1_error));
    goto __pyx_L0;

    /* "(tree fragment)":12
 *     else:
 *         use_setstate = self.refmap is not None or self.refs is not None
 *     if use_setstate:             # <<<<<<<<<<<<<<
 *         return __pyx_unpickle_BaseIndex, (type(self), 0x7898a51, None), state
 *     else:
*/
  }

  /* "(tree fragment)":15
 *         return __pyx_unpickle_BaseIndex, (type(self), 0x7898a51, None), state
 *     else:
 *         return __pyx_unpickle_BaseIndex, (type(self), 0x7898a51, state)             # <<<<<<<<<<<<<<
 * def __setstate_cython__(self, __pyx_state):
 *     __pyx_unpickle_BaseIndex__set_state(self, __pyx_state)
*/
  /*else*/ {
    __Pyx_XDECREF(__pyx_r);
    __Pyx_GetModuleGlobalName(__pyx_t_5, __pyx_mstate_global->__pyx_n_u_pyx_unpickle_BaseIndex); if (unlikely(!__pyx_t_5)) __PYX_ERR(4, 15, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_5);
    __pyx_t_1 = PyTuple_New(3); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 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(4, 15, __pyx_L1_error);
    __Pyx_INCREF(__pyx_mstate_global->__pyx_int_126454353);
    __Pyx_GIVEREF(__pyx_mstate_global->__pyx_int_126454353);
    if (__Pyx_PyTuple_SET_ITEM(__pyx_t_1, 1, __pyx_mstate_global->__pyx_int_126454353) != (0)) __PYX_ERR(4, 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(4, 15, __pyx_L1_error);
    __pyx_t_3 = PyTuple_New(2); if (unlikely(!__pyx_t_3)) __PYX_ERR(4, 15, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __Pyx_GIVEREF(__pyx_t_5);
    if (__Pyx_PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_t_5) != (0)) __PYX_ERR(4, 15, __pyx_L1_error);
    __Pyx_GIVEREF(__pyx_t_1);
    if (__Pyx_PyTuple_SET_ITEM(__pyx_t_3, 1, __pyx_t_1) != (0)) __PYX_ERR(4, 15, __pyx_L1_error);
    __pyx_t_5 = 0;
    __pyx_t_1 = 0;
    __pyx_r = __pyx_t_3;
    __pyx_t_3 = 0;
    __Pyx_TraceReturnValue(__pyx_r, 40, 0, __PYX_ERR(4, 15, __pyx_L1_error));
    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_3);
  __Pyx_XDECREF(__pyx_t_5);
  __Pyx_TraceException(__pyx_lineno, 0, 0);
  #if CYTHON_USE_SYS_MONITORING
  __Pyx_TraceExceptionUnwind(0, 0);
  #else
  __Pyx_TraceReturnValue(NULL, 0, 0, __PYX_ERR(4, 1, __pyx_L1_error));
  #endif
  __Pyx_AddTraceback("pysam.libcbcf.BaseIndex.__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_PyMonitoring_ExitScope(0);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "(tree fragment)":16
 *     else:
 *         return __pyx_unpickle_BaseIndex, (type(self), 0x7898a51, state)
 * def __setstate_cython__(self, __pyx_state):             # <<<<<<<<<<<<<<
 *     __pyx_unpickle_BaseIndex__set_state(self, __pyx_state)
*/

/* Python wrapper */
static PyObject *__pyx_pw_5pysam_7libcbcf_9BaseIndex_35__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*/
PyDoc_STRVAR(__pyx_doc_5pysam_7libcbcf_9BaseIndex_34__setstate_cython__, "BaseIndex.__setstate_cython__(self, __pyx_state)");
static PyMethodDef __pyx_mdef_5pysam_7libcbcf_9BaseIndex_35__setstate_cython__ = {"__setstate_cython__", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_5pysam_7libcbcf_9BaseIndex_35__setstate_cython__, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_5pysam_7libcbcf_9BaseIndex_34__setstate_cython__};
static PyObject *__pyx_pw_5pysam_7libcbcf_9BaseIndex_35__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(4, 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(4, 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(4, 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(4, 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(4, 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(4, 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("pysam.libcbcf.BaseIndex.__setstate_cython__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_5pysam_7libcbcf_9BaseIndex_34__setstate_cython__(((struct __pyx_obj_5pysam_7libcbcf_BaseIndex *)__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_5pysam_7libcbcf_9BaseIndex_34__setstate_cython__(struct __pyx_obj_5pysam_7libcbcf_BaseIndex *__pyx_v_self, PyObject *__pyx_v___pyx_state) {
  PyObject *__pyx_r = NULL;
  __Pyx_TraceDeclarationsFunc
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_TraceFrameInit(((PyObject *)__pyx_mstate_global->__pyx_codeobj_tab[335]))
  __Pyx_RefNannySetupContext("__setstate_cython__", 0);
  __Pyx_TraceStartFunc("__setstate_cython__", __pyx_f[4], 16, 0, 0, 0, __PYX_ERR(4, 16, __pyx_L1_error));

  /* "(tree fragment)":17
 *         return __pyx_unpickle_BaseIndex, (type(self), 0x7898a51, state)
 * def __setstate_cython__(self, __pyx_state):
 *     __pyx_unpickle_BaseIndex__set_state(self, __pyx_state)             # <<<<<<<<<<<<<<
*/
  if (!(likely(PyTuple_CheckExact(__pyx_v___pyx_state))||((__pyx_v___pyx_state) == Py_None) || __Pyx_RaiseUnexpectedTypeError("tuple", __pyx_v___pyx_state))) __PYX_ERR(4, 17, __pyx_L1_error)
  __pyx_t_1 = __pyx_f_5pysam_7libcbcf___pyx_unpickle_BaseIndex__set_state(__pyx_v_self, ((PyObject*)__pyx_v___pyx_state)); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 17, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "(tree fragment)":16
 *     else:
 *         return __pyx_unpickle_BaseIndex, (type(self), 0x7898a51, state)
 * def __setstate_cython__(self, __pyx_state):             # <<<<<<<<<<<<<<
 *     __pyx_unpickle_BaseIndex__set_state(self, __pyx_state)
*/

  /* function exit code */
  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  __Pyx_TraceReturnValue(__pyx_r, 0, 0, __PYX_ERR(4, 16, __pyx_L1_error));
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_TraceException(__pyx_lineno, 0, 0);
  #if CYTHON_USE_SYS_MONITORING
  __Pyx_TraceExceptionUnwind(0, 0);
  #else
  __Pyx_TraceReturnValue(NULL, 0, 0, __PYX_ERR(4, 16, __pyx_L1_error));
  #endif
  __Pyx_AddTraceback("pysam.libcbcf.BaseIndex.__setstate_cython__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_PyMonitoring_ExitScope(0);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "pysam/libcbcf.pyx":3755
 * cdef class BCFIndex(object):
 *     """CSI index data structure for BCF files"""
 *     def __init__(self):             # <<<<<<<<<<<<<<
 *         self.refs = ()
 *         self.refmap = {}
*/

/* Python wrapper */
static int __pyx_pw_5pysam_7libcbcf_8BCFIndex_1__init__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static int __pyx_pw_5pysam_7libcbcf_8BCFIndex_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_5pysam_7libcbcf_8BCFIndex___init__(((struct __pyx_obj_5pysam_7libcbcf_BCFIndex *)__pyx_v_self));

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

static int __pyx_pf_5pysam_7libcbcf_8BCFIndex___init__(struct __pyx_obj_5pysam_7libcbcf_BCFIndex *__pyx_v_self) {
  int __pyx_v_n;
  char const **__pyx_v_refs;
  PyObject *__pyx_9genexpr11__pyx_v_i = NULL;
  PyObject *__pyx_9genexpr11__pyx_v_r = NULL;
  int __pyx_r;
  __Pyx_TraceDeclarationsFunc
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_t_2;
  PyObject *__pyx_t_3 = NULL;
  PyObject *__pyx_t_4 = NULL;
  size_t __pyx_t_5;
  struct __pyx_opt_args_5pysam_7libcbcf_char_array_to_tuple __pyx_t_6;
  Py_ssize_t __pyx_t_7;
  PyObject *__pyx_t_8 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_TraceFrameInit(((PyObject *)__pyx_mstate_global->__pyx_codeobj_tab[336]))
  __Pyx_RefNannySetupContext("__init__", 0);
  __Pyx_TraceStartFunc("__init__", __pyx_f[0], 3755, 0, 0, 0, __PYX_ERR(0, 3755, __pyx_L1_error));

  /* "pysam/libcbcf.pyx":3756
 *     """CSI index data structure for BCF files"""
 *     def __init__(self):
 *         self.refs = ()             # <<<<<<<<<<<<<<
 *         self.refmap = {}
 * 
*/
  __Pyx_INCREF(__pyx_mstate_global->__pyx_empty_tuple);
  __Pyx_GIVEREF(__pyx_mstate_global->__pyx_empty_tuple);
  __Pyx_GOTREF(__pyx_v_self->__pyx_base.refs);
  __Pyx_DECREF(__pyx_v_self->__pyx_base.refs);
  __pyx_v_self->__pyx_base.refs = __pyx_mstate_global->__pyx_empty_tuple;

  /* "pysam/libcbcf.pyx":3757
 *     def __init__(self):
 *         self.refs = ()
 *         self.refmap = {}             # <<<<<<<<<<<<<<
 * 
 *         if not self.ptr:
*/
  __pyx_t_1 = __Pyx_PyDict_NewPresized(0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 3757, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_GIVEREF(__pyx_t_1);
  __Pyx_GOTREF(__pyx_v_self->__pyx_base.refmap);
  __Pyx_DECREF(__pyx_v_self->__pyx_base.refmap);
  __pyx_v_self->__pyx_base.refmap = ((PyObject*)__pyx_t_1);
  __pyx_t_1 = 0;

  /* "pysam/libcbcf.pyx":3759
 *         self.refmap = {}
 * 
 *         if not self.ptr:             # <<<<<<<<<<<<<<
 *             raise ValueError('Invalid index object')
 * 
*/
  __pyx_t_2 = (!(__pyx_v_self->ptr != 0));
  if (unlikely(__pyx_t_2)) {

    /* "pysam/libcbcf.pyx":3760
 * 
 *         if not self.ptr:
 *             raise ValueError('Invalid index object')             # <<<<<<<<<<<<<<
 * 
 *         cdef int n
*/
    __pyx_t_3 = NULL;
    __Pyx_INCREF(__pyx_builtin_ValueError);
    __pyx_t_4 = __pyx_builtin_ValueError; 
    __pyx_t_5 = 1;
    {
      PyObject *__pyx_callargs[2] = {__pyx_t_3, __pyx_mstate_global->__pyx_kp_u_Invalid_index_object};
      __pyx_t_1 = __Pyx_PyObject_FastCall(__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, 3760, __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, 3760, __pyx_L1_error)

    /* "pysam/libcbcf.pyx":3759
 *         self.refmap = {}
 * 
 *         if not self.ptr:             # <<<<<<<<<<<<<<
 *             raise ValueError('Invalid index object')
 * 
*/
  }

  /* "pysam/libcbcf.pyx":3763
 * 
 *         cdef int n
 *         cdef const char **refs = bcf_index_seqnames(self.ptr, self.header.ptr, &n)             # <<<<<<<<<<<<<<
 * 
 *         self.refs = char_array_to_tuple(refs, n, free_after=1) if refs else ()
*/
  __pyx_v_refs = bcf_index_seqnames(__pyx_v_self->ptr, __pyx_v_self->header->ptr, (&__pyx_v_n));

  /* "pysam/libcbcf.pyx":3765
 *         cdef const char **refs = bcf_index_seqnames(self.ptr, self.header.ptr, &n)
 * 
 *         self.refs = char_array_to_tuple(refs, n, free_after=1) if refs else ()             # <<<<<<<<<<<<<<
 *         self.refmap = { r:i for i,r in enumerate(self.refs) }
 * 
*/
  __pyx_t_2 = (__pyx_v_refs != 0);
  if (__pyx_t_2) {
    __pyx_t_6.__pyx_n = 1;
    __pyx_t_6.free_after = 1;
    __pyx_t_4 = __pyx_f_5pysam_7libcbcf_char_array_to_tuple(__pyx_v_refs, __pyx_v_n, &__pyx_t_6); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 3765, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
    __pyx_t_1 = __pyx_t_4;
    __pyx_t_4 = 0;
  } else {
    __Pyx_INCREF(__pyx_mstate_global->__pyx_empty_tuple);
    __pyx_t_1 = __pyx_mstate_global->__pyx_empty_tuple;
  }
  __Pyx_GIVEREF(__pyx_t_1);
  __Pyx_GOTREF(__pyx_v_self->__pyx_base.refs);
  __Pyx_DECREF(__pyx_v_self->__pyx_base.refs);
  __pyx_v_self->__pyx_base.refs = ((PyObject*)__pyx_t_1);
  __pyx_t_1 = 0;

  /* "pysam/libcbcf.pyx":3766
 * 
 *         self.refs = char_array_to_tuple(refs, n, free_after=1) if refs else ()
 *         self.refmap = { r:i for i,r in enumerate(self.refs) }             # <<<<<<<<<<<<<<
 * 
 *     def __dealloc__(self):
*/
  { /* enter inner scope */
    __pyx_t_1 = PyDict_New(); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 3766, __pyx_L6_error)
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_INCREF(__pyx_mstate_global->__pyx_int_0);
    __pyx_t_4 = __pyx_mstate_global->__pyx_int_0;
    __pyx_t_3 = __pyx_v_self->__pyx_base.refs; __Pyx_INCREF(__pyx_t_3);
    __pyx_t_7 = 0;
    for (;;) {
      {
        Py_ssize_t __pyx_temp = __Pyx_PyTuple_GET_SIZE(__pyx_t_3);
        #if !CYTHON_ASSUME_SAFE_SIZE
        if (unlikely((__pyx_temp < 0))) __PYX_ERR(0, 3766, __pyx_L6_error)
        #endif
        if (__pyx_t_7 >= __pyx_temp) break;
      }
      #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
      __pyx_t_8 = __Pyx_NewRef(PyTuple_GET_ITEM(__pyx_t_3, __pyx_t_7));
      #else
      __pyx_t_8 = __Pyx_PySequence_ITEM(__pyx_t_3, __pyx_t_7);
      #endif
      ++__pyx_t_7;
      if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 3766, __pyx_L6_error)
      __Pyx_GOTREF(__pyx_t_8);
      __Pyx_XDECREF_SET(__pyx_9genexpr11__pyx_v_r, __pyx_t_8);
      __pyx_t_8 = 0;
      __Pyx_INCREF(__pyx_t_4);
      __Pyx_XDECREF_SET(__pyx_9genexpr11__pyx_v_i, __pyx_t_4);
      __pyx_t_8 = __Pyx_PyLong_AddObjC(__pyx_t_4, __pyx_mstate_global->__pyx_int_1, 1, 0, 0); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 3766, __pyx_L6_error)
      __Pyx_GOTREF(__pyx_t_8);
      __Pyx_DECREF(__pyx_t_4);
      __pyx_t_4 = __pyx_t_8;
      __pyx_t_8 = 0;
      if (unlikely(PyDict_SetItem(__pyx_t_1, (PyObject*)__pyx_9genexpr11__pyx_v_r, (PyObject*)__pyx_9genexpr11__pyx_v_i))) __PYX_ERR(0, 3766, __pyx_L6_error)
    }
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    __Pyx_XDECREF(__pyx_9genexpr11__pyx_v_i); __pyx_9genexpr11__pyx_v_i = 0;
    __Pyx_XDECREF(__pyx_9genexpr11__pyx_v_r); __pyx_9genexpr11__pyx_v_r = 0;
    goto __pyx_L10_exit_scope;
    __pyx_L6_error:;
    __Pyx_XDECREF(__pyx_9genexpr11__pyx_v_i); __pyx_9genexpr11__pyx_v_i = 0;
    __Pyx_XDECREF(__pyx_9genexpr11__pyx_v_r); __pyx_9genexpr11__pyx_v_r = 0;
    goto __pyx_L1_error;
    __pyx_L10_exit_scope:;
  } /* exit inner scope */
  __Pyx_GIVEREF(__pyx_t_1);
  __Pyx_GOTREF(__pyx_v_self->__pyx_base.refmap);
  __Pyx_DECREF(__pyx_v_self->__pyx_base.refmap);
  __pyx_v_self->__pyx_base.refmap = ((PyObject*)__pyx_t_1);
  __pyx_t_1 = 0;

  /* "pysam/libcbcf.pyx":3755
 * cdef class BCFIndex(object):
 *     """CSI index data structure for BCF files"""
 *     def __init__(self):             # <<<<<<<<<<<<<<
 *         self.refs = ()
 *         self.refmap = {}
*/

  /* function exit code */
  __pyx_r = 0;
  __Pyx_TraceReturnCValue(__pyx_r, __Pyx_Owned_Py_None, 0, 0, __PYX_ERR(0, 3755, __pyx_L1_error));
  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_8);
  __Pyx_TraceException(__pyx_lineno, 0, 0);
  #if CYTHON_USE_SYS_MONITORING
  __Pyx_TraceExceptionUnwind(0, 0);
  #else
  __Pyx_TraceReturnValue(NULL, 0, 0, __PYX_ERR(0, 3755, __pyx_L1_error));
  #endif
  __Pyx_AddTraceback("pysam.libcbcf.BCFIndex.__init__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = -1;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_9genexpr11__pyx_v_i);
  __Pyx_XDECREF(__pyx_9genexpr11__pyx_v_r);
  __Pyx_PyMonitoring_ExitScope(0);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "pysam/libcbcf.pyx":3768
 *         self.refmap = { r:i for i,r in enumerate(self.refs) }
 * 
 *     def __dealloc__(self):             # <<<<<<<<<<<<<<
 *         if self.ptr:
 *             hts_idx_destroy(self.ptr)
*/

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

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

static void __pyx_pf_5pysam_7libcbcf_8BCFIndex_2__dealloc__(struct __pyx_obj_5pysam_7libcbcf_BCFIndex *__pyx_v_self) {
  __Pyx_TraceDeclarationsFunc
  int __pyx_t_1;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_TraceFrameInit(((PyObject *)__pyx_mstate_global->__pyx_codeobj_tab[337]))
  __Pyx_TraceStartFunc("__dealloc__", __pyx_f[0], 3768, 0, 0, 0, __PYX_ERR(0, 3768, __pyx_L1_error));

  /* "pysam/libcbcf.pyx":3769
 * 
 *     def __dealloc__(self):
 *         if self.ptr:             # <<<<<<<<<<<<<<
 *             hts_idx_destroy(self.ptr)
 *             self.ptr = NULL
*/
  __pyx_t_1 = (__pyx_v_self->ptr != 0);
  if (__pyx_t_1) {

    /* "pysam/libcbcf.pyx":3770
 *     def __dealloc__(self):
 *         if self.ptr:
 *             hts_idx_destroy(self.ptr)             # <<<<<<<<<<<<<<
 *             self.ptr = NULL
 * 
*/
    hts_idx_destroy(__pyx_v_self->ptr);

    /* "pysam/libcbcf.pyx":3771
 *         if self.ptr:
 *             hts_idx_destroy(self.ptr)
 *             self.ptr = NULL             # <<<<<<<<<<<<<<
 * 
 *     def fetch(self, bcf, contig, start, stop, reopen):
*/
    __pyx_v_self->ptr = NULL;

    /* "pysam/libcbcf.pyx":3769
 * 
 *     def __dealloc__(self):
 *         if self.ptr:             # <<<<<<<<<<<<<<
 *             hts_idx_destroy(self.ptr)
 *             self.ptr = NULL
*/
  }

  /* "pysam/libcbcf.pyx":3768
 *         self.refmap = { r:i for i,r in enumerate(self.refs) }
 * 
 *     def __dealloc__(self):             # <<<<<<<<<<<<<<
 *         if self.ptr:
 *             hts_idx_destroy(self.ptr)
*/

  /* function exit code */
  __Pyx_TraceReturnValue(Py_None, 0, 0, __PYX_ERR(0, 3768, __pyx_L1_error));
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_TraceException(__pyx_lineno, 0, 0);
  #if CYTHON_USE_SYS_MONITORING
  __Pyx_TraceExceptionUnwind(0, 0);
  #else
  __Pyx_TraceReturnValue(NULL, 0, 0, __PYX_ERR(0, 3768, __pyx_L1_error));
  #endif
  __Pyx_WriteUnraisable("pysam.libcbcf.BCFIndex.__dealloc__", __pyx_clineno, __pyx_lineno, __pyx_filename, 1, 0);
  __pyx_L0:;
  __Pyx_PyMonitoring_ExitScope(0);
}

/* "pysam/libcbcf.pyx":3773
 *             self.ptr = NULL
 * 
 *     def fetch(self, bcf, contig, start, stop, reopen):             # <<<<<<<<<<<<<<
 *         return BCFIterator(bcf, contig, start, stop, reopen)
 * 
*/

/* Python wrapper */
static PyObject *__pyx_pw_5pysam_7libcbcf_8BCFIndex_5fetch(PyObject *__pyx_v_self, 
#if 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_5pysam_7libcbcf_8BCFIndex_4fetch, "BCFIndex.fetch(self, bcf, contig, start, stop, reopen)");
static PyMethodDef __pyx_mdef_5pysam_7libcbcf_8BCFIndex_5fetch = {"fetch", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_5pysam_7libcbcf_8BCFIndex_5fetch, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_5pysam_7libcbcf_8BCFIndex_4fetch};
static PyObject *__pyx_pw_5pysam_7libcbcf_8BCFIndex_5fetch(PyObject *__pyx_v_self, 
#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_bcf = 0;
  PyObject *__pyx_v_contig = 0;
  PyObject *__pyx_v_start = 0;
  PyObject *__pyx_v_stop = 0;
  PyObject *__pyx_v_reopen = 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("fetch (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_bcf,&__pyx_mstate_global->__pyx_n_u_contig,&__pyx_mstate_global->__pyx_n_u_start,&__pyx_mstate_global->__pyx_n_u_stop,&__pyx_mstate_global->__pyx_n_u_reopen,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, 3773, __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, 3773, __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, 3773, __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, 3773, __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, 3773, __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, 3773, __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, "fetch", 0) < 0) __PYX_ERR(0, 3773, __pyx_L3_error)
      for (Py_ssize_t i = __pyx_nargs; i < 5; i++) {
        if (unlikely(!values[i])) { __Pyx_RaiseArgtupleInvalid("fetch", 1, 5, 5, i); __PYX_ERR(0, 3773, __pyx_L3_error) }
      }
    } else if (unlikely(__pyx_nargs != 5)) {
      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, 3773, __pyx_L3_error)
      values[1] = __Pyx_ArgRef_FASTCALL(__pyx_args, 1);
      if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[1])) __PYX_ERR(0, 3773, __pyx_L3_error)
      values[2] = __Pyx_ArgRef_FASTCALL(__pyx_args, 2);
      if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[2])) __PYX_ERR(0, 3773, __pyx_L3_error)
      values[3] = __Pyx_ArgRef_FASTCALL(__pyx_args, 3);
      if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[3])) __PYX_ERR(0, 3773, __pyx_L3_error)
      values[4] = __Pyx_ArgRef_FASTCALL(__pyx_args, 4);
      if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[4])) __PYX_ERR(0, 3773, __pyx_L3_error)
    }
    __pyx_v_bcf = values[0];
    __pyx_v_contig = values[1];
    __pyx_v_start = values[2];
    __pyx_v_stop = values[3];
    __pyx_v_reopen = values[4];
  }
  goto __pyx_L6_skip;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("fetch", 1, 5, 5, __pyx_nargs); __PYX_ERR(0, 3773, __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("pysam.libcbcf.BCFIndex.fetch", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_5pysam_7libcbcf_8BCFIndex_4fetch(((struct __pyx_obj_5pysam_7libcbcf_BCFIndex *)__pyx_v_self), __pyx_v_bcf, __pyx_v_contig, __pyx_v_start, __pyx_v_stop, __pyx_v_reopen);

  /* 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_5pysam_7libcbcf_8BCFIndex_4fetch(CYTHON_UNUSED struct __pyx_obj_5pysam_7libcbcf_BCFIndex *__pyx_v_self, PyObject *__pyx_v_bcf, PyObject *__pyx_v_contig, PyObject *__pyx_v_start, PyObject *__pyx_v_stop, PyObject *__pyx_v_reopen) {
  PyObject *__pyx_r = NULL;
  __Pyx_TraceDeclarationsFunc
  __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_TraceFrameInit(((PyObject *)__pyx_mstate_global->__pyx_codeobj_tab[338]))
  __Pyx_RefNannySetupContext("fetch", 0);
  __Pyx_TraceStartFunc("fetch", __pyx_f[0], 3773, 0, 0, 0, __PYX_ERR(0, 3773, __pyx_L1_error));

  /* "pysam/libcbcf.pyx":3774
 * 
 *     def fetch(self, bcf, contig, start, stop, reopen):
 *         return BCFIterator(bcf, contig, start, stop, reopen)             # <<<<<<<<<<<<<<
 * 
 * 
*/
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_2 = NULL;
  __Pyx_INCREF((PyObject *)__pyx_mstate_global->__pyx_ptype_5pysam_7libcbcf_BCFIterator);
  __pyx_t_3 = ((PyObject *)__pyx_mstate_global->__pyx_ptype_5pysam_7libcbcf_BCFIterator); 
  __pyx_t_4 = 1;
  {
    PyObject *__pyx_callargs[6] = {__pyx_t_2, __pyx_v_bcf, __pyx_v_contig, __pyx_v_start, __pyx_v_stop, __pyx_v_reopen};
    __pyx_t_1 = __Pyx_PyObject_FastCall(__pyx_t_3, __pyx_callargs+__pyx_t_4, (6-__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, 3774, __pyx_L1_error)
    __Pyx_GOTREF((PyObject *)__pyx_t_1);
  }
  __pyx_r = ((PyObject *)__pyx_t_1);
  __pyx_t_1 = 0;
  __Pyx_TraceReturnValue(__pyx_r, 1, 0, __PYX_ERR(0, 3774, __pyx_L1_error));
  goto __pyx_L0;

  /* "pysam/libcbcf.pyx":3773
 *             self.ptr = NULL
 * 
 *     def fetch(self, bcf, contig, start, stop, reopen):             # <<<<<<<<<<<<<<
 *         return BCFIterator(bcf, contig, start, stop, reopen)
 * 
*/

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_TraceException(__pyx_lineno, 0, 0);
  #if CYTHON_USE_SYS_MONITORING
  __Pyx_TraceExceptionUnwind(0, 0);
  #else
  __Pyx_TraceReturnValue(NULL, 0, 0, __PYX_ERR(0, 3773, __pyx_L1_error));
  #endif
  __Pyx_AddTraceback("pysam.libcbcf.BCFIndex.fetch", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_PyMonitoring_ExitScope(0);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "pysam/libcbcf.pxd":112
 * 
 * cdef class BCFIndex(BaseIndex):
 *     cdef readonly VariantHeader header             # <<<<<<<<<<<<<<
 *     cdef hts_idx_t *ptr
 * 
*/

/* Python wrapper */
static PyObject *__pyx_pw_5pysam_7libcbcf_8BCFIndex_6header_1__get__(PyObject *__pyx_v_self); /*proto*/
static PyObject *__pyx_pw_5pysam_7libcbcf_8BCFIndex_6header_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_5pysam_7libcbcf_8BCFIndex_6header___get__(((struct __pyx_obj_5pysam_7libcbcf_BCFIndex *)__pyx_v_self));

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

static PyObject *__pyx_pf_5pysam_7libcbcf_8BCFIndex_6header___get__(struct __pyx_obj_5pysam_7libcbcf_BCFIndex *__pyx_v_self) {
  PyObject *__pyx_r = NULL;
  __Pyx_TraceDeclarationsFunc
  __Pyx_RefNannyDeclarations
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_TraceFrameInit(((PyObject *)__pyx_mstate_global->__pyx_codeobj_tab[339]))
  __Pyx_RefNannySetupContext("__get__", 0);
  __Pyx_TraceStartFunc("__get__", __pyx_f[3], 112, 0, 0, 0, __PYX_ERR(3, 112, __pyx_L1_error));
  __Pyx_XDECREF(__pyx_r);
  __Pyx_INCREF((PyObject *)__pyx_v_self->header);
  __pyx_r = ((PyObject *)__pyx_v_self->header);
  __Pyx_TraceReturnValue(__pyx_r, 0, 0, __PYX_ERR(3, 112, __pyx_L1_error));
  goto __pyx_L0;

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_TraceException(__pyx_lineno, 0, 0);
  #if CYTHON_USE_SYS_MONITORING
  __Pyx_TraceExceptionUnwind(0, 0);
  #else
  __Pyx_TraceReturnValue(NULL, 0, 0, __PYX_ERR(3, 112, __pyx_L1_error));
  #endif
  __Pyx_AddTraceback("pysam.libcbcf.BCFIndex.header.__get__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_PyMonitoring_ExitScope(0);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "(tree fragment)":1
 * def __reduce_cython__(self):             # <<<<<<<<<<<<<<
 *     raise TypeError, "self.ptr cannot be converted to a Python object for pickling"
 * def __setstate_cython__(self, __pyx_state):
*/

/* Python wrapper */
static PyObject *__pyx_pw_5pysam_7libcbcf_8BCFIndex_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*/
PyDoc_STRVAR(__pyx_doc_5pysam_7libcbcf_8BCFIndex_6__reduce_cython__, "BCFIndex.__reduce_cython__(self)");
static PyMethodDef __pyx_mdef_5pysam_7libcbcf_8BCFIndex_7__reduce_cython__ = {"__reduce_cython__", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_5pysam_7libcbcf_8BCFIndex_7__reduce_cython__, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_5pysam_7libcbcf_8BCFIndex_6__reduce_cython__};
static PyObject *__pyx_pw_5pysam_7libcbcf_8BCFIndex_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_5pysam_7libcbcf_8BCFIndex_6__reduce_cython__(((struct __pyx_obj_5pysam_7libcbcf_BCFIndex *)__pyx_v_self));

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

static PyObject *__pyx_pf_5pysam_7libcbcf_8BCFIndex_6__reduce_cython__(CYTHON_UNUSED struct __pyx_obj_5pysam_7libcbcf_BCFIndex *__pyx_v_self) {
  PyObject *__pyx_r = NULL;
  __Pyx_TraceDeclarationsFunc
  __Pyx_RefNannyDeclarations
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_TraceFrameInit(((PyObject *)__pyx_mstate_global->__pyx_codeobj_tab[340]))
  __Pyx_RefNannySetupContext("__reduce_cython__", 0);
  __Pyx_TraceStartFunc("__reduce_cython__", __pyx_f[4], 1, 0, 0, 0, __PYX_ERR(4, 1, __pyx_L1_error));

  /* "(tree fragment)":2
 * def __reduce_cython__(self):
 *     raise TypeError, "self.ptr cannot be converted to a Python object for pickling"             # <<<<<<<<<<<<<<
 * def __setstate_cython__(self, __pyx_state):
 *     raise TypeError, "self.ptr cannot be converted to a Python object for pickling"
*/
  __Pyx_Raise(__pyx_builtin_TypeError, __pyx_mstate_global->__pyx_kp_u_self_ptr_cannot_be_converted_to, 0, 0);
  __PYX_ERR(4, 2, __pyx_L1_error)

  /* "(tree fragment)":1
 * def __reduce_cython__(self):             # <<<<<<<<<<<<<<
 *     raise TypeError, "self.ptr cannot be converted to a Python object for pickling"
 * def __setstate_cython__(self, __pyx_state):
*/

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_TraceException(__pyx_lineno, 0, 0);
  #if CYTHON_USE_SYS_MONITORING
  __Pyx_TraceExceptionUnwind(0, 0);
  #else
  __Pyx_TraceReturnValue(NULL, 0, 0, __PYX_ERR(4, 1, __pyx_L1_error));
  #endif
  __Pyx_AddTraceback("pysam.libcbcf.BCFIndex.__reduce_cython__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_PyMonitoring_ExitScope(0);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "(tree fragment)":3
 * def __reduce_cython__(self):
 *     raise TypeError, "self.ptr cannot be converted to a Python object for pickling"
 * def __setstate_cython__(self, __pyx_state):             # <<<<<<<<<<<<<<
 *     raise TypeError, "self.ptr cannot be converted to a Python object for pickling"
*/

/* Python wrapper */
static PyObject *__pyx_pw_5pysam_7libcbcf_8BCFIndex_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*/
PyDoc_STRVAR(__pyx_doc_5pysam_7libcbcf_8BCFIndex_8__setstate_cython__, "BCFIndex.__setstate_cython__(self, __pyx_state)");
static PyMethodDef __pyx_mdef_5pysam_7libcbcf_8BCFIndex_9__setstate_cython__ = {"__setstate_cython__", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_5pysam_7libcbcf_8BCFIndex_9__setstate_cython__, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_5pysam_7libcbcf_8BCFIndex_8__setstate_cython__};
static PyObject *__pyx_pw_5pysam_7libcbcf_8BCFIndex_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(4, 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(4, 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(4, 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(4, 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(4, 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(4, 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("pysam.libcbcf.BCFIndex.__setstate_cython__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_5pysam_7libcbcf_8BCFIndex_8__setstate_cython__(((struct __pyx_obj_5pysam_7libcbcf_BCFIndex *)__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_5pysam_7libcbcf_8BCFIndex_8__setstate_cython__(CYTHON_UNUSED struct __pyx_obj_5pysam_7libcbcf_BCFIndex *__pyx_v_self, CYTHON_UNUSED PyObject *__pyx_v___pyx_state) {
  PyObject *__pyx_r = NULL;
  __Pyx_TraceDeclarationsFunc
  __Pyx_RefNannyDeclarations
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_TraceFrameInit(((PyObject *)__pyx_mstate_global->__pyx_codeobj_tab[341]))
  __Pyx_RefNannySetupContext("__setstate_cython__", 0);
  __Pyx_TraceStartFunc("__setstate_cython__", __pyx_f[4], 3, 0, 0, 0, __PYX_ERR(4, 3, __pyx_L1_error));

  /* "(tree fragment)":4
 *     raise TypeError, "self.ptr cannot be converted to a Python object for pickling"
 * def __setstate_cython__(self, __pyx_state):
 *     raise TypeError, "self.ptr cannot be converted to a Python object for pickling"             # <<<<<<<<<<<<<<
*/
  __Pyx_Raise(__pyx_builtin_TypeError, __pyx_mstate_global->__pyx_kp_u_self_ptr_cannot_be_converted_to, 0, 0);
  __PYX_ERR(4, 4, __pyx_L1_error)

  /* "(tree fragment)":3
 * def __reduce_cython__(self):
 *     raise TypeError, "self.ptr cannot be converted to a Python object for pickling"
 * def __setstate_cython__(self, __pyx_state):             # <<<<<<<<<<<<<<
 *     raise TypeError, "self.ptr cannot be converted to a Python object for pickling"
*/

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_TraceException(__pyx_lineno, 0, 0);
  #if CYTHON_USE_SYS_MONITORING
  __Pyx_TraceExceptionUnwind(0, 0);
  #else
  __Pyx_TraceReturnValue(NULL, 0, 0, __PYX_ERR(4, 3, __pyx_L1_error));
  #endif
  __Pyx_AddTraceback("pysam.libcbcf.BCFIndex.__setstate_cython__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_PyMonitoring_ExitScope(0);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "pysam/libcbcf.pyx":3777
 * 
 * 
 * cdef BCFIndex makeBCFIndex(VariantHeader header, hts_idx_t *idx):             # <<<<<<<<<<<<<<
 *     if not idx:
 *         return None
*/

static struct __pyx_obj_5pysam_7libcbcf_BCFIndex *__pyx_f_5pysam_7libcbcf_makeBCFIndex(struct __pyx_obj_5pysam_7libcbcf_VariantHeader *__pyx_v_header, hts_idx_t *__pyx_v_idx) {
  struct __pyx_obj_5pysam_7libcbcf_BCFIndex *__pyx_v_index = 0;
  struct __pyx_obj_5pysam_7libcbcf_BCFIndex *__pyx_r = NULL;
  __Pyx_TraceDeclarationsFunc
  __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_TraceFrameInit(((PyObject *)__pyx_mstate_global->__pyx_codeobj_tab[342]))
  __Pyx_RefNannySetupContext("makeBCFIndex", 0);
  __Pyx_TraceStartFunc("makeBCFIndex", __pyx_f[0], 3777, 0, 0, 0, __PYX_ERR(0, 3777, __pyx_L1_error));

  /* "pysam/libcbcf.pyx":3778
 * 
 * cdef BCFIndex makeBCFIndex(VariantHeader header, hts_idx_t *idx):
 *     if not idx:             # <<<<<<<<<<<<<<
 *         return None
 * 
*/
  __pyx_t_1 = (!(__pyx_v_idx != 0));
  if (__pyx_t_1) {

    /* "pysam/libcbcf.pyx":3779
 * cdef BCFIndex makeBCFIndex(VariantHeader header, hts_idx_t *idx):
 *     if not idx:
 *         return None             # <<<<<<<<<<<<<<
 * 
 *     if not header:
*/
    __Pyx_XDECREF((PyObject *)__pyx_r);
    __pyx_r = ((struct __pyx_obj_5pysam_7libcbcf_BCFIndex *)Py_None); __Pyx_INCREF(Py_None);
    goto __pyx_L0;

    /* "pysam/libcbcf.pyx":3778
 * 
 * cdef BCFIndex makeBCFIndex(VariantHeader header, hts_idx_t *idx):
 *     if not idx:             # <<<<<<<<<<<<<<
 *         return None
 * 
*/
  }

  /* "pysam/libcbcf.pyx":3781
 *         return None
 * 
 *     if not header:             # <<<<<<<<<<<<<<
 *         raise ValueError('invalid VariantHeader')
 * 
*/
  __pyx_t_1 = __Pyx_PyObject_IsTrue(((PyObject *)__pyx_v_header)); if (unlikely((__pyx_t_1 < 0))) __PYX_ERR(0, 3781, __pyx_L1_error)
  __pyx_t_2 = (!__pyx_t_1);
  if (unlikely(__pyx_t_2)) {

    /* "pysam/libcbcf.pyx":3782
 * 
 *     if not header:
 *         raise ValueError('invalid VariantHeader')             # <<<<<<<<<<<<<<
 * 
 *     cdef BCFIndex index = BCFIndex.__new__(BCFIndex)
*/
    __pyx_t_4 = NULL;
    __Pyx_INCREF(__pyx_builtin_ValueError);
    __pyx_t_5 = __pyx_builtin_ValueError; 
    __pyx_t_6 = 1;
    {
      PyObject *__pyx_callargs[2] = {__pyx_t_4, __pyx_mstate_global->__pyx_kp_u_invalid_VariantHeader};
      __pyx_t_3 = __Pyx_PyObject_FastCall(__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, 3782, __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, 3782, __pyx_L1_error)

    /* "pysam/libcbcf.pyx":3781
 *         return None
 * 
 *     if not header:             # <<<<<<<<<<<<<<
 *         raise ValueError('invalid VariantHeader')
 * 
*/
  }

  /* "pysam/libcbcf.pyx":3784
 *         raise ValueError('invalid VariantHeader')
 * 
 *     cdef BCFIndex index = BCFIndex.__new__(BCFIndex)             # <<<<<<<<<<<<<<
 *     index.header = header
 *     index.ptr = idx
*/
  __pyx_t_3 = ((PyObject *)__pyx_tp_new_5pysam_7libcbcf_BCFIndex(((PyTypeObject *)__pyx_mstate_global->__pyx_ptype_5pysam_7libcbcf_BCFIndex), __pyx_mstate_global->__pyx_empty_tuple, NULL)); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 3784, __pyx_L1_error)
  __Pyx_GOTREF((PyObject *)__pyx_t_3);
  __pyx_v_index = ((struct __pyx_obj_5pysam_7libcbcf_BCFIndex *)__pyx_t_3);
  __pyx_t_3 = 0;

  /* "pysam/libcbcf.pyx":3785
 * 
 *     cdef BCFIndex index = BCFIndex.__new__(BCFIndex)
 *     index.header = header             # <<<<<<<<<<<<<<
 *     index.ptr = idx
 *     index.__init__()
*/
  __Pyx_INCREF((PyObject *)__pyx_v_header);
  __Pyx_GIVEREF((PyObject *)__pyx_v_header);
  __Pyx_GOTREF((PyObject *)__pyx_v_index->header);
  __Pyx_DECREF((PyObject *)__pyx_v_index->header);
  __pyx_v_index->header = __pyx_v_header;

  /* "pysam/libcbcf.pyx":3786
 *     cdef BCFIndex index = BCFIndex.__new__(BCFIndex)
 *     index.header = header
 *     index.ptr = idx             # <<<<<<<<<<<<<<
 *     index.__init__()
 * 
*/
  __pyx_v_index->ptr = __pyx_v_idx;

  /* "pysam/libcbcf.pyx":3787
 *     index.header = header
 *     index.ptr = idx
 *     index.__init__()             # <<<<<<<<<<<<<<
 * 
 *     return index
*/
  __pyx_t_5 = ((PyObject *)__pyx_v_index);
  __Pyx_INCREF(__pyx_t_5);
  __pyx_t_6 = 0;
  {
    PyObject *__pyx_callargs[2] = {__pyx_t_5, NULL};
    __pyx_t_3 = __Pyx_PyObject_FastCallMethod(__pyx_mstate_global->__pyx_n_u_init, __pyx_callargs+__pyx_t_6, (1-__pyx_t_6) | (1*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
    __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
    if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 3787, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
  }
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;

  /* "pysam/libcbcf.pyx":3789
 *     index.__init__()
 * 
 *     return index             # <<<<<<<<<<<<<<
 * 
 * 
*/
  __Pyx_XDECREF((PyObject *)__pyx_r);
  __Pyx_INCREF((PyObject *)__pyx_v_index);
  __pyx_r = __pyx_v_index;
  __Pyx_TraceReturnValue((PyObject *)__pyx_r, 27, 0, __PYX_ERR(0, 3789, __pyx_L1_error));
  goto __pyx_L0;

  /* "pysam/libcbcf.pyx":3777
 * 
 * 
 * cdef BCFIndex makeBCFIndex(VariantHeader header, hts_idx_t *idx):             # <<<<<<<<<<<<<<
 *     if not idx:
 *         return None
*/

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_XDECREF(__pyx_t_5);
  __Pyx_TraceException(__pyx_lineno, 0, 0);
  #if CYTHON_USE_SYS_MONITORING
  __Pyx_TraceExceptionUnwind(0, 0);
  #else
  __Pyx_TraceReturnValue(NULL, 0, 0, __PYX_ERR(0, 3777, __pyx_L1_error));
  #endif
  __Pyx_AddTraceback("pysam.libcbcf.makeBCFIndex", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_XDECREF((PyObject *)__pyx_v_index);
  __Pyx_XGIVEREF((PyObject *)__pyx_r);
  __Pyx_PyMonitoring_ExitScope(0);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "pysam/libcbcf.pyx":3794
 * cdef class TabixIndex(BaseIndex):
 *     """Tabix index data structure for VCF files"""
 *     def __init__(self):             # <<<<<<<<<<<<<<
 *         self.refs = ()
 *         self.refmap = {}
*/

/* Python wrapper */
static int __pyx_pw_5pysam_7libcbcf_10TabixIndex_1__init__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static int __pyx_pw_5pysam_7libcbcf_10TabixIndex_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_5pysam_7libcbcf_10TabixIndex___init__(((struct __pyx_obj_5pysam_7libcbcf_TabixIndex *)__pyx_v_self));

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

static int __pyx_pf_5pysam_7libcbcf_10TabixIndex___init__(struct __pyx_obj_5pysam_7libcbcf_TabixIndex *__pyx_v_self) {
  int __pyx_v_n;
  char const **__pyx_v_refs;
  PyObject *__pyx_9genexpr12__pyx_v_i = NULL;
  PyObject *__pyx_9genexpr12__pyx_v_r = NULL;
  int __pyx_r;
  __Pyx_TraceDeclarationsFunc
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_t_2;
  PyObject *__pyx_t_3 = NULL;
  PyObject *__pyx_t_4 = NULL;
  size_t __pyx_t_5;
  struct __pyx_opt_args_5pysam_7libcbcf_char_array_to_tuple __pyx_t_6;
  Py_ssize_t __pyx_t_7;
  PyObject *__pyx_t_8 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_TraceFrameInit(((PyObject *)__pyx_mstate_global->__pyx_codeobj_tab[343]))
  __Pyx_RefNannySetupContext("__init__", 0);
  __Pyx_TraceStartFunc("__init__", __pyx_f[0], 3794, 0, 0, 0, __PYX_ERR(0, 3794, __pyx_L1_error));

  /* "pysam/libcbcf.pyx":3795
 *     """Tabix index data structure for VCF files"""
 *     def __init__(self):
 *         self.refs = ()             # <<<<<<<<<<<<<<
 *         self.refmap = {}
 * 
*/
  __Pyx_INCREF(__pyx_mstate_global->__pyx_empty_tuple);
  __Pyx_GIVEREF(__pyx_mstate_global->__pyx_empty_tuple);
  __Pyx_GOTREF(__pyx_v_self->__pyx_base.refs);
  __Pyx_DECREF(__pyx_v_self->__pyx_base.refs);
  __pyx_v_self->__pyx_base.refs = __pyx_mstate_global->__pyx_empty_tuple;

  /* "pysam/libcbcf.pyx":3796
 *     def __init__(self):
 *         self.refs = ()
 *         self.refmap = {}             # <<<<<<<<<<<<<<
 * 
 *         if not self.ptr:
*/
  __pyx_t_1 = __Pyx_PyDict_NewPresized(0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 3796, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_GIVEREF(__pyx_t_1);
  __Pyx_GOTREF(__pyx_v_self->__pyx_base.refmap);
  __Pyx_DECREF(__pyx_v_self->__pyx_base.refmap);
  __pyx_v_self->__pyx_base.refmap = ((PyObject*)__pyx_t_1);
  __pyx_t_1 = 0;

  /* "pysam/libcbcf.pyx":3798
 *         self.refmap = {}
 * 
 *         if not self.ptr:             # <<<<<<<<<<<<<<
 *             raise ValueError('Invalid index object')
 * 
*/
  __pyx_t_2 = (!(__pyx_v_self->ptr != 0));
  if (unlikely(__pyx_t_2)) {

    /* "pysam/libcbcf.pyx":3799
 * 
 *         if not self.ptr:
 *             raise ValueError('Invalid index object')             # <<<<<<<<<<<<<<
 * 
 *         cdef int n
*/
    __pyx_t_3 = NULL;
    __Pyx_INCREF(__pyx_builtin_ValueError);
    __pyx_t_4 = __pyx_builtin_ValueError; 
    __pyx_t_5 = 1;
    {
      PyObject *__pyx_callargs[2] = {__pyx_t_3, __pyx_mstate_global->__pyx_kp_u_Invalid_index_object};
      __pyx_t_1 = __Pyx_PyObject_FastCall(__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, 3799, __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, 3799, __pyx_L1_error)

    /* "pysam/libcbcf.pyx":3798
 *         self.refmap = {}
 * 
 *         if not self.ptr:             # <<<<<<<<<<<<<<
 *             raise ValueError('Invalid index object')
 * 
*/
  }

  /* "pysam/libcbcf.pyx":3802
 * 
 *         cdef int n
 *         cdef const char **refs = tbx_seqnames(self.ptr, &n)             # <<<<<<<<<<<<<<
 * 
 *         self.refs = char_array_to_tuple(refs, n, free_after=1) if refs else ()
*/
  __pyx_v_refs = tbx_seqnames(__pyx_v_self->ptr, (&__pyx_v_n));

  /* "pysam/libcbcf.pyx":3804
 *         cdef const char **refs = tbx_seqnames(self.ptr, &n)
 * 
 *         self.refs = char_array_to_tuple(refs, n, free_after=1) if refs else ()             # <<<<<<<<<<<<<<
 *         self.refmap = { r:i for i,r in enumerate(self.refs) }
 * 
*/
  __pyx_t_2 = (__pyx_v_refs != 0);
  if (__pyx_t_2) {
    __pyx_t_6.__pyx_n = 1;
    __pyx_t_6.free_after = 1;
    __pyx_t_4 = __pyx_f_5pysam_7libcbcf_char_array_to_tuple(__pyx_v_refs, __pyx_v_n, &__pyx_t_6); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 3804, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
    __pyx_t_1 = __pyx_t_4;
    __pyx_t_4 = 0;
  } else {
    __Pyx_INCREF(__pyx_mstate_global->__pyx_empty_tuple);
    __pyx_t_1 = __pyx_mstate_global->__pyx_empty_tuple;
  }
  __Pyx_GIVEREF(__pyx_t_1);
  __Pyx_GOTREF(__pyx_v_self->__pyx_base.refs);
  __Pyx_DECREF(__pyx_v_self->__pyx_base.refs);
  __pyx_v_self->__pyx_base.refs = ((PyObject*)__pyx_t_1);
  __pyx_t_1 = 0;

  /* "pysam/libcbcf.pyx":3805
 * 
 *         self.refs = char_array_to_tuple(refs, n, free_after=1) if refs else ()
 *         self.refmap = { r:i for i,r in enumerate(self.refs) }             # <<<<<<<<<<<<<<
 * 
 *     def __dealloc__(self):
*/
  { /* enter inner scope */
    __pyx_t_1 = PyDict_New(); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 3805, __pyx_L6_error)
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_INCREF(__pyx_mstate_global->__pyx_int_0);
    __pyx_t_4 = __pyx_mstate_global->__pyx_int_0;
    __pyx_t_3 = __pyx_v_self->__pyx_base.refs; __Pyx_INCREF(__pyx_t_3);
    __pyx_t_7 = 0;
    for (;;) {
      {
        Py_ssize_t __pyx_temp = __Pyx_PyTuple_GET_SIZE(__pyx_t_3);
        #if !CYTHON_ASSUME_SAFE_SIZE
        if (unlikely((__pyx_temp < 0))) __PYX_ERR(0, 3805, __pyx_L6_error)
        #endif
        if (__pyx_t_7 >= __pyx_temp) break;
      }
      #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
      __pyx_t_8 = __Pyx_NewRef(PyTuple_GET_ITEM(__pyx_t_3, __pyx_t_7));
      #else
      __pyx_t_8 = __Pyx_PySequence_ITEM(__pyx_t_3, __pyx_t_7);
      #endif
      ++__pyx_t_7;
      if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 3805, __pyx_L6_error)
      __Pyx_GOTREF(__pyx_t_8);
      __Pyx_XDECREF_SET(__pyx_9genexpr12__pyx_v_r, __pyx_t_8);
      __pyx_t_8 = 0;
      __Pyx_INCREF(__pyx_t_4);
      __Pyx_XDECREF_SET(__pyx_9genexpr12__pyx_v_i, __pyx_t_4);
      __pyx_t_8 = __Pyx_PyLong_AddObjC(__pyx_t_4, __pyx_mstate_global->__pyx_int_1, 1, 0, 0); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 3805, __pyx_L6_error)
      __Pyx_GOTREF(__pyx_t_8);
      __Pyx_DECREF(__pyx_t_4);
      __pyx_t_4 = __pyx_t_8;
      __pyx_t_8 = 0;
      if (unlikely(PyDict_SetItem(__pyx_t_1, (PyObject*)__pyx_9genexpr12__pyx_v_r, (PyObject*)__pyx_9genexpr12__pyx_v_i))) __PYX_ERR(0, 3805, __pyx_L6_error)
    }
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    __Pyx_XDECREF(__pyx_9genexpr12__pyx_v_i); __pyx_9genexpr12__pyx_v_i = 0;
    __Pyx_XDECREF(__pyx_9genexpr12__pyx_v_r); __pyx_9genexpr12__pyx_v_r = 0;
    goto __pyx_L10_exit_scope;
    __pyx_L6_error:;
    __Pyx_XDECREF(__pyx_9genexpr12__pyx_v_i); __pyx_9genexpr12__pyx_v_i = 0;
    __Pyx_XDECREF(__pyx_9genexpr12__pyx_v_r); __pyx_9genexpr12__pyx_v_r = 0;
    goto __pyx_L1_error;
    __pyx_L10_exit_scope:;
  } /* exit inner scope */
  __Pyx_GIVEREF(__pyx_t_1);
  __Pyx_GOTREF(__pyx_v_self->__pyx_base.refmap);
  __Pyx_DECREF(__pyx_v_self->__pyx_base.refmap);
  __pyx_v_self->__pyx_base.refmap = ((PyObject*)__pyx_t_1);
  __pyx_t_1 = 0;

  /* "pysam/libcbcf.pyx":3794
 * cdef class TabixIndex(BaseIndex):
 *     """Tabix index data structure for VCF files"""
 *     def __init__(self):             # <<<<<<<<<<<<<<
 *         self.refs = ()
 *         self.refmap = {}
*/

  /* function exit code */
  __pyx_r = 0;
  __Pyx_TraceReturnCValue(__pyx_r, __Pyx_Owned_Py_None, 0, 0, __PYX_ERR(0, 3794, __pyx_L1_error));
  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_8);
  __Pyx_TraceException(__pyx_lineno, 0, 0);
  #if CYTHON_USE_SYS_MONITORING
  __Pyx_TraceExceptionUnwind(0, 0);
  #else
  __Pyx_TraceReturnValue(NULL, 0, 0, __PYX_ERR(0, 3794, __pyx_L1_error));
  #endif
  __Pyx_AddTraceback("pysam.libcbcf.TabixIndex.__init__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = -1;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_9genexpr12__pyx_v_i);
  __Pyx_XDECREF(__pyx_9genexpr12__pyx_v_r);
  __Pyx_PyMonitoring_ExitScope(0);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "pysam/libcbcf.pyx":3807
 *         self.refmap = { r:i for i,r in enumerate(self.refs) }
 * 
 *     def __dealloc__(self):             # <<<<<<<<<<<<<<
 *         if self.ptr:
 *             tbx_destroy(self.ptr)
*/

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

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

static void __pyx_pf_5pysam_7libcbcf_10TabixIndex_2__dealloc__(struct __pyx_obj_5pysam_7libcbcf_TabixIndex *__pyx_v_self) {
  __Pyx_TraceDeclarationsFunc
  int __pyx_t_1;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_TraceFrameInit(((PyObject *)__pyx_mstate_global->__pyx_codeobj_tab[344]))
  __Pyx_TraceStartFunc("__dealloc__", __pyx_f[0], 3807, 0, 0, 0, __PYX_ERR(0, 3807, __pyx_L1_error));

  /* "pysam/libcbcf.pyx":3808
 * 
 *     def __dealloc__(self):
 *         if self.ptr:             # <<<<<<<<<<<<<<
 *             tbx_destroy(self.ptr)
 *             self.ptr = NULL
*/
  __pyx_t_1 = (__pyx_v_self->ptr != 0);
  if (__pyx_t_1) {

    /* "pysam/libcbcf.pyx":3809
 *     def __dealloc__(self):
 *         if self.ptr:
 *             tbx_destroy(self.ptr)             # <<<<<<<<<<<<<<
 *             self.ptr = NULL
 * 
*/
    tbx_destroy(__pyx_v_self->ptr);

    /* "pysam/libcbcf.pyx":3810
 *         if self.ptr:
 *             tbx_destroy(self.ptr)
 *             self.ptr = NULL             # <<<<<<<<<<<<<<
 * 
 *     def fetch(self, bcf, contig, start, stop, reopen):
*/
    __pyx_v_self->ptr = NULL;

    /* "pysam/libcbcf.pyx":3808
 * 
 *     def __dealloc__(self):
 *         if self.ptr:             # <<<<<<<<<<<<<<
 *             tbx_destroy(self.ptr)
 *             self.ptr = NULL
*/
  }

  /* "pysam/libcbcf.pyx":3807
 *         self.refmap = { r:i for i,r in enumerate(self.refs) }
 * 
 *     def __dealloc__(self):             # <<<<<<<<<<<<<<
 *         if self.ptr:
 *             tbx_destroy(self.ptr)
*/

  /* function exit code */
  __Pyx_TraceReturnValue(Py_None, 0, 0, __PYX_ERR(0, 3807, __pyx_L1_error));
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_TraceException(__pyx_lineno, 0, 0);
  #if CYTHON_USE_SYS_MONITORING
  __Pyx_TraceExceptionUnwind(0, 0);
  #else
  __Pyx_TraceReturnValue(NULL, 0, 0, __PYX_ERR(0, 3807, __pyx_L1_error));
  #endif
  __Pyx_WriteUnraisable("pysam.libcbcf.TabixIndex.__dealloc__", __pyx_clineno, __pyx_lineno, __pyx_filename, 1, 0);
  __pyx_L0:;
  __Pyx_PyMonitoring_ExitScope(0);
}

/* "pysam/libcbcf.pyx":3812
 *             self.ptr = NULL
 * 
 *     def fetch(self, bcf, contig, start, stop, reopen):             # <<<<<<<<<<<<<<
 *         return TabixIterator(bcf, contig, start, stop, reopen)
 * 
*/

/* Python wrapper */
static PyObject *__pyx_pw_5pysam_7libcbcf_10TabixIndex_5fetch(PyObject *__pyx_v_self, 
#if 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_5pysam_7libcbcf_10TabixIndex_4fetch, "TabixIndex.fetch(self, bcf, contig, start, stop, reopen)");
static PyMethodDef __pyx_mdef_5pysam_7libcbcf_10TabixIndex_5fetch = {"fetch", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_5pysam_7libcbcf_10TabixIndex_5fetch, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_5pysam_7libcbcf_10TabixIndex_4fetch};
static PyObject *__pyx_pw_5pysam_7libcbcf_10TabixIndex_5fetch(PyObject *__pyx_v_self, 
#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_bcf = 0;
  PyObject *__pyx_v_contig = 0;
  PyObject *__pyx_v_start = 0;
  PyObject *__pyx_v_stop = 0;
  PyObject *__pyx_v_reopen = 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("fetch (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_bcf,&__pyx_mstate_global->__pyx_n_u_contig,&__pyx_mstate_global->__pyx_n_u_start,&__pyx_mstate_global->__pyx_n_u_stop,&__pyx_mstate_global->__pyx_n_u_reopen,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, 3812, __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, 3812, __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, 3812, __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, 3812, __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, 3812, __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, 3812, __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, "fetch", 0) < 0) __PYX_ERR(0, 3812, __pyx_L3_error)
      for (Py_ssize_t i = __pyx_nargs; i < 5; i++) {
        if (unlikely(!values[i])) { __Pyx_RaiseArgtupleInvalid("fetch", 1, 5, 5, i); __PYX_ERR(0, 3812, __pyx_L3_error) }
      }
    } else if (unlikely(__pyx_nargs != 5)) {
      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, 3812, __pyx_L3_error)
      values[1] = __Pyx_ArgRef_FASTCALL(__pyx_args, 1);
      if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[1])) __PYX_ERR(0, 3812, __pyx_L3_error)
      values[2] = __Pyx_ArgRef_FASTCALL(__pyx_args, 2);
      if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[2])) __PYX_ERR(0, 3812, __pyx_L3_error)
      values[3] = __Pyx_ArgRef_FASTCALL(__pyx_args, 3);
      if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[3])) __PYX_ERR(0, 3812, __pyx_L3_error)
      values[4] = __Pyx_ArgRef_FASTCALL(__pyx_args, 4);
      if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[4])) __PYX_ERR(0, 3812, __pyx_L3_error)
    }
    __pyx_v_bcf = values[0];
    __pyx_v_contig = values[1];
    __pyx_v_start = values[2];
    __pyx_v_stop = values[3];
    __pyx_v_reopen = values[4];
  }
  goto __pyx_L6_skip;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("fetch", 1, 5, 5, __pyx_nargs); __PYX_ERR(0, 3812, __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("pysam.libcbcf.TabixIndex.fetch", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_5pysam_7libcbcf_10TabixIndex_4fetch(((struct __pyx_obj_5pysam_7libcbcf_TabixIndex *)__pyx_v_self), __pyx_v_bcf, __pyx_v_contig, __pyx_v_start, __pyx_v_stop, __pyx_v_reopen);

  /* 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_5pysam_7libcbcf_10TabixIndex_4fetch(CYTHON_UNUSED struct __pyx_obj_5pysam_7libcbcf_TabixIndex *__pyx_v_self, PyObject *__pyx_v_bcf, PyObject *__pyx_v_contig, PyObject *__pyx_v_start, PyObject *__pyx_v_stop, PyObject *__pyx_v_reopen) {
  PyObject *__pyx_r = NULL;
  __Pyx_TraceDeclarationsFunc
  __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_TraceFrameInit(((PyObject *)__pyx_mstate_global->__pyx_codeobj_tab[345]))
  __Pyx_RefNannySetupContext("fetch", 0);
  __Pyx_TraceStartFunc("fetch", __pyx_f[0], 3812, 0, 0, 0, __PYX_ERR(0, 3812, __pyx_L1_error));

  /* "pysam/libcbcf.pyx":3813
 * 
 *     def fetch(self, bcf, contig, start, stop, reopen):
 *         return TabixIterator(bcf, contig, start, stop, reopen)             # <<<<<<<<<<<<<<
 * 
 * 
*/
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_2 = NULL;
  __Pyx_INCREF((PyObject *)__pyx_mstate_global->__pyx_ptype_5pysam_7libcbcf_TabixIterator);
  __pyx_t_3 = ((PyObject *)__pyx_mstate_global->__pyx_ptype_5pysam_7libcbcf_TabixIterator); 
  __pyx_t_4 = 1;
  {
    PyObject *__pyx_callargs[6] = {__pyx_t_2, __pyx_v_bcf, __pyx_v_contig, __pyx_v_start, __pyx_v_stop, __pyx_v_reopen};
    __pyx_t_1 = __Pyx_PyObject_FastCall(__pyx_t_3, __pyx_callargs+__pyx_t_4, (6-__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, 3813, __pyx_L1_error)
    __Pyx_GOTREF((PyObject *)__pyx_t_1);
  }
  __pyx_r = ((PyObject *)__pyx_t_1);
  __pyx_t_1 = 0;
  __Pyx_TraceReturnValue(__pyx_r, 1, 0, __PYX_ERR(0, 3813, __pyx_L1_error));
  goto __pyx_L0;

  /* "pysam/libcbcf.pyx":3812
 *             self.ptr = NULL
 * 
 *     def fetch(self, bcf, contig, start, stop, reopen):             # <<<<<<<<<<<<<<
 *         return TabixIterator(bcf, contig, start, stop, reopen)
 * 
*/

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_TraceException(__pyx_lineno, 0, 0);
  #if CYTHON_USE_SYS_MONITORING
  __Pyx_TraceExceptionUnwind(0, 0);
  #else
  __Pyx_TraceReturnValue(NULL, 0, 0, __PYX_ERR(0, 3812, __pyx_L1_error));
  #endif
  __Pyx_AddTraceback("pysam.libcbcf.TabixIndex.fetch", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_PyMonitoring_ExitScope(0);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "(tree fragment)":1
 * def __reduce_cython__(self):             # <<<<<<<<<<<<<<
 *     raise TypeError, "self.ptr cannot be converted to a Python object for pickling"
 * def __setstate_cython__(self, __pyx_state):
*/

/* Python wrapper */
static PyObject *__pyx_pw_5pysam_7libcbcf_10TabixIndex_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*/
PyDoc_STRVAR(__pyx_doc_5pysam_7libcbcf_10TabixIndex_6__reduce_cython__, "TabixIndex.__reduce_cython__(self)");
static PyMethodDef __pyx_mdef_5pysam_7libcbcf_10TabixIndex_7__reduce_cython__ = {"__reduce_cython__", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_5pysam_7libcbcf_10TabixIndex_7__reduce_cython__, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_5pysam_7libcbcf_10TabixIndex_6__reduce_cython__};
static PyObject *__pyx_pw_5pysam_7libcbcf_10TabixIndex_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_5pysam_7libcbcf_10TabixIndex_6__reduce_cython__(((struct __pyx_obj_5pysam_7libcbcf_TabixIndex *)__pyx_v_self));

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

static PyObject *__pyx_pf_5pysam_7libcbcf_10TabixIndex_6__reduce_cython__(CYTHON_UNUSED struct __pyx_obj_5pysam_7libcbcf_TabixIndex *__pyx_v_self) {
  PyObject *__pyx_r = NULL;
  __Pyx_TraceDeclarationsFunc
  __Pyx_RefNannyDeclarations
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_TraceFrameInit(((PyObject *)__pyx_mstate_global->__pyx_codeobj_tab[346]))
  __Pyx_RefNannySetupContext("__reduce_cython__", 0);
  __Pyx_TraceStartFunc("__reduce_cython__", __pyx_f[4], 1, 0, 0, 0, __PYX_ERR(4, 1, __pyx_L1_error));

  /* "(tree fragment)":2
 * def __reduce_cython__(self):
 *     raise TypeError, "self.ptr cannot be converted to a Python object for pickling"             # <<<<<<<<<<<<<<
 * def __setstate_cython__(self, __pyx_state):
 *     raise TypeError, "self.ptr cannot be converted to a Python object for pickling"
*/
  __Pyx_Raise(__pyx_builtin_TypeError, __pyx_mstate_global->__pyx_kp_u_self_ptr_cannot_be_converted_to, 0, 0);
  __PYX_ERR(4, 2, __pyx_L1_error)

  /* "(tree fragment)":1
 * def __reduce_cython__(self):             # <<<<<<<<<<<<<<
 *     raise TypeError, "self.ptr cannot be converted to a Python object for pickling"
 * def __setstate_cython__(self, __pyx_state):
*/

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_TraceException(__pyx_lineno, 0, 0);
  #if CYTHON_USE_SYS_MONITORING
  __Pyx_TraceExceptionUnwind(0, 0);
  #else
  __Pyx_TraceReturnValue(NULL, 0, 0, __PYX_ERR(4, 1, __pyx_L1_error));
  #endif
  __Pyx_AddTraceback("pysam.libcbcf.TabixIndex.__reduce_cython__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_PyMonitoring_ExitScope(0);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "(tree fragment)":3
 * def __reduce_cython__(self):
 *     raise TypeError, "self.ptr cannot be converted to a Python object for pickling"
 * def __setstate_cython__(self, __pyx_state):             # <<<<<<<<<<<<<<
 *     raise TypeError, "self.ptr cannot be converted to a Python object for pickling"
*/

/* Python wrapper */
static PyObject *__pyx_pw_5pysam_7libcbcf_10TabixIndex_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*/
PyDoc_STRVAR(__pyx_doc_5pysam_7libcbcf_10TabixIndex_8__setstate_cython__, "TabixIndex.__setstate_cython__(self, __pyx_state)");
static PyMethodDef __pyx_mdef_5pysam_7libcbcf_10TabixIndex_9__setstate_cython__ = {"__setstate_cython__", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_5pysam_7libcbcf_10TabixIndex_9__setstate_cython__, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_5pysam_7libcbcf_10TabixIndex_8__setstate_cython__};
static PyObject *__pyx_pw_5pysam_7libcbcf_10TabixIndex_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(4, 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(4, 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(4, 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(4, 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(4, 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(4, 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("pysam.libcbcf.TabixIndex.__setstate_cython__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_5pysam_7libcbcf_10TabixIndex_8__setstate_cython__(((struct __pyx_obj_5pysam_7libcbcf_TabixIndex *)__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_5pysam_7libcbcf_10TabixIndex_8__setstate_cython__(CYTHON_UNUSED struct __pyx_obj_5pysam_7libcbcf_TabixIndex *__pyx_v_self, CYTHON_UNUSED PyObject *__pyx_v___pyx_state) {
  PyObject *__pyx_r = NULL;
  __Pyx_TraceDeclarationsFunc
  __Pyx_RefNannyDeclarations
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_TraceFrameInit(((PyObject *)__pyx_mstate_global->__pyx_codeobj_tab[347]))
  __Pyx_RefNannySetupContext("__setstate_cython__", 0);
  __Pyx_TraceStartFunc("__setstate_cython__", __pyx_f[4], 3, 0, 0, 0, __PYX_ERR(4, 3, __pyx_L1_error));

  /* "(tree fragment)":4
 *     raise TypeError, "self.ptr cannot be converted to a Python object for pickling"
 * def __setstate_cython__(self, __pyx_state):
 *     raise TypeError, "self.ptr cannot be converted to a Python object for pickling"             # <<<<<<<<<<<<<<
*/
  __Pyx_Raise(__pyx_builtin_TypeError, __pyx_mstate_global->__pyx_kp_u_self_ptr_cannot_be_converted_to, 0, 0);
  __PYX_ERR(4, 4, __pyx_L1_error)

  /* "(tree fragment)":3
 * def __reduce_cython__(self):
 *     raise TypeError, "self.ptr cannot be converted to a Python object for pickling"
 * def __setstate_cython__(self, __pyx_state):             # <<<<<<<<<<<<<<
 *     raise TypeError, "self.ptr cannot be converted to a Python object for pickling"
*/

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_TraceException(__pyx_lineno, 0, 0);
  #if CYTHON_USE_SYS_MONITORING
  __Pyx_TraceExceptionUnwind(0, 0);
  #else
  __Pyx_TraceReturnValue(NULL, 0, 0, __PYX_ERR(4, 3, __pyx_L1_error));
  #endif
  __Pyx_AddTraceback("pysam.libcbcf.TabixIndex.__setstate_cython__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_PyMonitoring_ExitScope(0);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "pysam/libcbcf.pyx":3816
 * 
 * 
 * cdef TabixIndex makeTabixIndex(tbx_t *idx):             # <<<<<<<<<<<<<<
 *     if not idx:
 *         return None
*/

static struct __pyx_obj_5pysam_7libcbcf_TabixIndex *__pyx_f_5pysam_7libcbcf_makeTabixIndex(tbx_t *__pyx_v_idx) {
  struct __pyx_obj_5pysam_7libcbcf_TabixIndex *__pyx_v_index = 0;
  struct __pyx_obj_5pysam_7libcbcf_TabixIndex *__pyx_r = NULL;
  __Pyx_TraceDeclarationsFunc
  __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_TraceFrameInit(((PyObject *)__pyx_mstate_global->__pyx_codeobj_tab[348]))
  __Pyx_RefNannySetupContext("makeTabixIndex", 0);
  __Pyx_TraceStartFunc("makeTabixIndex", __pyx_f[0], 3816, 0, 0, 0, __PYX_ERR(0, 3816, __pyx_L1_error));

  /* "pysam/libcbcf.pyx":3817
 * 
 * cdef TabixIndex makeTabixIndex(tbx_t *idx):
 *     if not idx:             # <<<<<<<<<<<<<<
 *         return None
 * 
*/
  __pyx_t_1 = (!(__pyx_v_idx != 0));
  if (__pyx_t_1) {

    /* "pysam/libcbcf.pyx":3818
 * cdef TabixIndex makeTabixIndex(tbx_t *idx):
 *     if not idx:
 *         return None             # <<<<<<<<<<<<<<
 * 
 *     cdef TabixIndex index = TabixIndex.__new__(TabixIndex)
*/
    __Pyx_XDECREF((PyObject *)__pyx_r);
    __pyx_r = ((struct __pyx_obj_5pysam_7libcbcf_TabixIndex *)Py_None); __Pyx_INCREF(Py_None);
    goto __pyx_L0;

    /* "pysam/libcbcf.pyx":3817
 * 
 * cdef TabixIndex makeTabixIndex(tbx_t *idx):
 *     if not idx:             # <<<<<<<<<<<<<<
 *         return None
 * 
*/
  }

  /* "pysam/libcbcf.pyx":3820
 *         return None
 * 
 *     cdef TabixIndex index = TabixIndex.__new__(TabixIndex)             # <<<<<<<<<<<<<<
 *     index.ptr = idx
 *     index.__init__()
*/
  __pyx_t_2 = ((PyObject *)__pyx_tp_new_5pysam_7libcbcf_BaseIndex(((PyTypeObject *)__pyx_mstate_global->__pyx_ptype_5pysam_7libcbcf_TabixIndex), __pyx_mstate_global->__pyx_empty_tuple, NULL)); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 3820, __pyx_L1_error)
  __Pyx_GOTREF((PyObject *)__pyx_t_2);
  __pyx_v_index = ((struct __pyx_obj_5pysam_7libcbcf_TabixIndex *)__pyx_t_2);
  __pyx_t_2 = 0;

  /* "pysam/libcbcf.pyx":3821
 * 
 *     cdef TabixIndex index = TabixIndex.__new__(TabixIndex)
 *     index.ptr = idx             # <<<<<<<<<<<<<<
 *     index.__init__()
 * 
*/
  __pyx_v_index->ptr = __pyx_v_idx;

  /* "pysam/libcbcf.pyx":3822
 *     cdef TabixIndex index = TabixIndex.__new__(TabixIndex)
 *     index.ptr = idx
 *     index.__init__()             # <<<<<<<<<<<<<<
 * 
 *     return index
*/
  __pyx_t_3 = ((PyObject *)__pyx_v_index);
  __Pyx_INCREF(__pyx_t_3);
  __pyx_t_4 = 0;
  {
    PyObject *__pyx_callargs[2] = {__pyx_t_3, NULL};
    __pyx_t_2 = __Pyx_PyObject_FastCallMethod(__pyx_mstate_global->__pyx_n_u_init, __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, 3822, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
  }
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

  /* "pysam/libcbcf.pyx":3824
 *     index.__init__()
 * 
 *     return index             # <<<<<<<<<<<<<<
 * 
 * 
*/
  __Pyx_XDECREF((PyObject *)__pyx_r);
  __Pyx_INCREF((PyObject *)__pyx_v_index);
  __pyx_r = __pyx_v_index;
  __Pyx_TraceReturnValue((PyObject *)__pyx_r, 17, 0, __PYX_ERR(0, 3824, __pyx_L1_error));
  goto __pyx_L0;

  /* "pysam/libcbcf.pyx":3816
 * 
 * 
 * cdef TabixIndex makeTabixIndex(tbx_t *idx):             # <<<<<<<<<<<<<<
 *     if not idx:
 *         return None
*/

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_TraceException(__pyx_lineno, 0, 0);
  #if CYTHON_USE_SYS_MONITORING
  __Pyx_TraceExceptionUnwind(0, 0);
  #else
  __Pyx_TraceReturnValue(NULL, 0, 0, __PYX_ERR(0, 3816, __pyx_L1_error));
  #endif
  __Pyx_AddTraceback("pysam.libcbcf.makeTabixIndex", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_XDECREF((PyObject *)__pyx_v_index);
  __Pyx_XGIVEREF((PyObject *)__pyx_r);
  __Pyx_PyMonitoring_ExitScope(0);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "(tree fragment)":1
 * def __reduce_cython__(self):             # <<<<<<<<<<<<<<
 *     raise TypeError, "self.iter cannot be converted to a Python object for pickling"
 * def __setstate_cython__(self, __pyx_state):
*/

/* Python wrapper */
static PyObject *__pyx_pw_5pysam_7libcbcf_12BaseIterator_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*/
PyDoc_STRVAR(__pyx_doc_5pysam_7libcbcf_12BaseIterator___reduce_cython__, "BaseIterator.__reduce_cython__(self)");
static PyMethodDef __pyx_mdef_5pysam_7libcbcf_12BaseIterator_1__reduce_cython__ = {"__reduce_cython__", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_5pysam_7libcbcf_12BaseIterator_1__reduce_cython__, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_5pysam_7libcbcf_12BaseIterator___reduce_cython__};
static PyObject *__pyx_pw_5pysam_7libcbcf_12BaseIterator_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_5pysam_7libcbcf_12BaseIterator___reduce_cython__(((struct __pyx_obj_5pysam_7libcbcf_BaseIterator *)__pyx_v_self));

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

static PyObject *__pyx_pf_5pysam_7libcbcf_12BaseIterator___reduce_cython__(CYTHON_UNUSED struct __pyx_obj_5pysam_7libcbcf_BaseIterator *__pyx_v_self) {
  PyObject *__pyx_r = NULL;
  __Pyx_TraceDeclarationsFunc
  __Pyx_RefNannyDeclarations
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_TraceFrameInit(((PyObject *)__pyx_mstate_global->__pyx_codeobj_tab[349]))
  __Pyx_RefNannySetupContext("__reduce_cython__", 0);
  __Pyx_TraceStartFunc("__reduce_cython__", __pyx_f[4], 1, 0, 0, 0, __PYX_ERR(4, 1, __pyx_L1_error));

  /* "(tree fragment)":2
 * def __reduce_cython__(self):
 *     raise TypeError, "self.iter cannot be converted to a Python object for pickling"             # <<<<<<<<<<<<<<
 * def __setstate_cython__(self, __pyx_state):
 *     raise TypeError, "self.iter cannot be converted to a Python object for pickling"
*/
  __Pyx_Raise(__pyx_builtin_TypeError, __pyx_mstate_global->__pyx_kp_u_self_iter_cannot_be_converted_to, 0, 0);
  __PYX_ERR(4, 2, __pyx_L1_error)

  /* "(tree fragment)":1
 * def __reduce_cython__(self):             # <<<<<<<<<<<<<<
 *     raise TypeError, "self.iter cannot be converted to a Python object for pickling"
 * def __setstate_cython__(self, __pyx_state):
*/

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_TraceException(__pyx_lineno, 0, 0);
  #if CYTHON_USE_SYS_MONITORING
  __Pyx_TraceExceptionUnwind(0, 0);
  #else
  __Pyx_TraceReturnValue(NULL, 0, 0, __PYX_ERR(4, 1, __pyx_L1_error));
  #endif
  __Pyx_AddTraceback("pysam.libcbcf.BaseIterator.__reduce_cython__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_PyMonitoring_ExitScope(0);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "(tree fragment)":3
 * def __reduce_cython__(self):
 *     raise TypeError, "self.iter cannot be converted to a Python object for pickling"
 * def __setstate_cython__(self, __pyx_state):             # <<<<<<<<<<<<<<
 *     raise TypeError, "self.iter cannot be converted to a Python object for pickling"
*/

/* Python wrapper */
static PyObject *__pyx_pw_5pysam_7libcbcf_12BaseIterator_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*/
PyDoc_STRVAR(__pyx_doc_5pysam_7libcbcf_12BaseIterator_2__setstate_cython__, "BaseIterator.__setstate_cython__(self, __pyx_state)");
static PyMethodDef __pyx_mdef_5pysam_7libcbcf_12BaseIterator_3__setstate_cython__ = {"__setstate_cython__", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_5pysam_7libcbcf_12BaseIterator_3__setstate_cython__, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_5pysam_7libcbcf_12BaseIterator_2__setstate_cython__};
static PyObject *__pyx_pw_5pysam_7libcbcf_12BaseIterator_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(4, 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(4, 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(4, 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(4, 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(4, 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(4, 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("pysam.libcbcf.BaseIterator.__setstate_cython__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_5pysam_7libcbcf_12BaseIterator_2__setstate_cython__(((struct __pyx_obj_5pysam_7libcbcf_BaseIterator *)__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_5pysam_7libcbcf_12BaseIterator_2__setstate_cython__(CYTHON_UNUSED struct __pyx_obj_5pysam_7libcbcf_BaseIterator *__pyx_v_self, CYTHON_UNUSED PyObject *__pyx_v___pyx_state) {
  PyObject *__pyx_r = NULL;
  __Pyx_TraceDeclarationsFunc
  __Pyx_RefNannyDeclarations
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_TraceFrameInit(((PyObject *)__pyx_mstate_global->__pyx_codeobj_tab[350]))
  __Pyx_RefNannySetupContext("__setstate_cython__", 0);
  __Pyx_TraceStartFunc("__setstate_cython__", __pyx_f[4], 3, 0, 0, 0, __PYX_ERR(4, 3, __pyx_L1_error));

  /* "(tree fragment)":4
 *     raise TypeError, "self.iter cannot be converted to a Python object for pickling"
 * def __setstate_cython__(self, __pyx_state):
 *     raise TypeError, "self.iter cannot be converted to a Python object for pickling"             # <<<<<<<<<<<<<<
*/
  __Pyx_Raise(__pyx_builtin_TypeError, __pyx_mstate_global->__pyx_kp_u_self_iter_cannot_be_converted_to, 0, 0);
  __PYX_ERR(4, 4, __pyx_L1_error)

  /* "(tree fragment)":3
 * def __reduce_cython__(self):
 *     raise TypeError, "self.iter cannot be converted to a Python object for pickling"
 * def __setstate_cython__(self, __pyx_state):             # <<<<<<<<<<<<<<
 *     raise TypeError, "self.iter cannot be converted to a Python object for pickling"
*/

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_TraceException(__pyx_lineno, 0, 0);
  #if CYTHON_USE_SYS_MONITORING
  __Pyx_TraceExceptionUnwind(0, 0);
  #else
  __Pyx_TraceReturnValue(NULL, 0, 0, __PYX_ERR(4, 3, __pyx_L1_error));
  #endif
  __Pyx_AddTraceback("pysam.libcbcf.BaseIterator.__setstate_cython__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_PyMonitoring_ExitScope(0);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "pysam/libcbcf.pyx":3839
 * # Internal function to clean up after iteration stop or failure.
 * # This would be a nested function if it weren't a cdef function.
 * cdef void _stop_BCFIterator(BCFIterator self, bcf1_t *record):             # <<<<<<<<<<<<<<
 *     bcf_destroy1(record)
 * 
*/

static void __pyx_f_5pysam_7libcbcf__stop_BCFIterator(struct __pyx_obj_5pysam_7libcbcf_BCFIterator *__pyx_v_self, bcf1_t *__pyx_v_record) {
  __Pyx_TraceDeclarationsFunc
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_TraceFrameInit(((PyObject *)__pyx_mstate_global->__pyx_codeobj_tab[351]))
  __Pyx_TraceStartFunc("_stop_BCFIterator", __pyx_f[0], 3839, 0, 0, 0, __PYX_ERR(0, 3839, __pyx_L1_error));

  /* "pysam/libcbcf.pyx":3840
 * # This would be a nested function if it weren't a cdef function.
 * cdef void _stop_BCFIterator(BCFIterator self, bcf1_t *record):
 *     bcf_destroy1(record)             # <<<<<<<<<<<<<<
 * 
 *     # destroy iter so future calls to __next__ raise StopIteration
*/
  bcf_destroy1(__pyx_v_record);

  /* "pysam/libcbcf.pyx":3843
 * 
 *     # destroy iter so future calls to __next__ raise StopIteration
 *     bcf_itr_destroy(self.iter)             # <<<<<<<<<<<<<<
 *     self.iter = NULL
 * 
*/
  bcf_itr_destroy(__pyx_v_self->__pyx_base.iter);

  /* "pysam/libcbcf.pyx":3844
 *     # destroy iter so future calls to __next__ raise StopIteration
 *     bcf_itr_destroy(self.iter)
 *     self.iter = NULL             # <<<<<<<<<<<<<<
 * 
 * 
*/
  __pyx_v_self->__pyx_base.iter = NULL;

  /* "pysam/libcbcf.pyx":3839
 * # Internal function to clean up after iteration stop or failure.
 * # This would be a nested function if it weren't a cdef function.
 * cdef void _stop_BCFIterator(BCFIterator self, bcf1_t *record):             # <<<<<<<<<<<<<<
 *     bcf_destroy1(record)
 * 
*/

  /* function exit code */
  __Pyx_TraceReturnValue(Py_None, 0, 0, __PYX_ERR(0, 3839, __pyx_L1_error));
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_TraceException(__pyx_lineno, 0, 0);
  #if CYTHON_USE_SYS_MONITORING
  __Pyx_TraceExceptionUnwind(0, 0);
  #else
  __Pyx_TraceReturnValue(NULL, 0, 0, __PYX_ERR(0, 3839, __pyx_L1_error));
  #endif
  __Pyx_AddTraceback("pysam.libcbcf._stop_BCFIterator", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_L0:;
  __Pyx_PyMonitoring_ExitScope(0);
}

/* "pysam/libcbcf.pyx":3848
 * 
 * cdef class BCFIterator(BaseIterator):
 *     def __init__(self, VariantFile bcf, contig=None, start=None, stop=None, reopen=True):             # <<<<<<<<<<<<<<
 *         if bcf is None:
 *             raise ValueError('bcf must not be None')
*/

/* Python wrapper */
static int __pyx_pw_5pysam_7libcbcf_11BCFIterator_1__init__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static int __pyx_pw_5pysam_7libcbcf_11BCFIterator_1__init__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  struct __pyx_obj_5pysam_7libcbcf_VariantFile *__pyx_v_bcf = 0;
  PyObject *__pyx_v_contig = 0;
  PyObject *__pyx_v_start = 0;
  PyObject *__pyx_v_stop = 0;
  PyObject *__pyx_v_reopen = 0;
  CYTHON_UNUSED Py_ssize_t __pyx_nargs;
  CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
  PyObject* values[5] = {0,0,0,0,0};
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__init__ (wrapper)", 0);
  #if CYTHON_ASSUME_SAFE_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_bcf,&__pyx_mstate_global->__pyx_n_u_contig,&__pyx_mstate_global->__pyx_n_u_start,&__pyx_mstate_global->__pyx_n_u_stop,&__pyx_mstate_global->__pyx_n_u_reopen,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, 3848, __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(0, 3848, __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(0, 3848, __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, 3848, __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, 3848, __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, 3848, __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, 3848, __pyx_L3_error)
      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 *)Py_None));
      if (!values[4]) values[4] = __Pyx_NewRef(((PyObject *)Py_True));
      for (Py_ssize_t i = __pyx_nargs; i < 1; i++) {
        if (unlikely(!values[i])) { __Pyx_RaiseArgtupleInvalid("__init__", 0, 1, 5, i); __PYX_ERR(0, 3848, __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(0, 3848, __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(0, 3848, __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, 3848, __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, 3848, __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, 3848, __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));
      if (!values[3]) values[3] = __Pyx_NewRef(((PyObject *)Py_None));
      if (!values[4]) values[4] = __Pyx_NewRef(((PyObject *)Py_True));
    }
    __pyx_v_bcf = ((struct __pyx_obj_5pysam_7libcbcf_VariantFile *)values[0]);
    __pyx_v_contig = values[1];
    __pyx_v_start = values[2];
    __pyx_v_stop = values[3];
    __pyx_v_reopen = values[4];
  }
  goto __pyx_L6_skip;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("__init__", 0, 1, 5, __pyx_nargs); __PYX_ERR(0, 3848, __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("pysam.libcbcf.BCFIterator.__init__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return -1;
  __pyx_L4_argument_unpacking_done:;
  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_bcf), __pyx_mstate_global->__pyx_ptype_5pysam_7libcbcf_VariantFile, 1, "bcf", 0))) __PYX_ERR(0, 3848, __pyx_L1_error)
  __pyx_r = __pyx_pf_5pysam_7libcbcf_11BCFIterator___init__(((struct __pyx_obj_5pysam_7libcbcf_BCFIterator *)__pyx_v_self), __pyx_v_bcf, __pyx_v_contig, __pyx_v_start, __pyx_v_stop, __pyx_v_reopen);

  /* 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_pf_5pysam_7libcbcf_11BCFIterator___init__(struct __pyx_obj_5pysam_7libcbcf_BCFIterator *__pyx_v_self, struct __pyx_obj_5pysam_7libcbcf_VariantFile *__pyx_v_bcf, PyObject *__pyx_v_contig, PyObject *__pyx_v_start, PyObject *__pyx_v_stop, PyObject *__pyx_v_reopen) {
  struct __pyx_obj_5pysam_7libcbcf_BCFIndex *__pyx_v_index = 0;
  int __pyx_v_rid;
  int __pyx_v_cstart;
  int __pyx_v_cstop;
  int __pyx_r;
  __Pyx_TraceDeclarationsFunc
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  PyObject *__pyx_t_4 = NULL;
  size_t __pyx_t_5;
  int __pyx_t_6;
  PyObject *__pyx_t_7 = NULL;
  PyObject *__pyx_t_8 = NULL;
  PyObject *__pyx_t_9 = NULL;
  int __pyx_t_10;
  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_TraceFrameInit(((PyObject *)__pyx_mstate_global->__pyx_codeobj_tab[352]))
  __Pyx_RefNannySetupContext("__init__", 0);
  __Pyx_TraceStartFunc("__init__", __pyx_f[0], 3848, 0, 0, 0, __PYX_ERR(0, 3848, __pyx_L1_error));

  /* "pysam/libcbcf.pyx":3849
 * cdef class BCFIterator(BaseIterator):
 *     def __init__(self, VariantFile bcf, contig=None, start=None, stop=None, reopen=True):
 *         if bcf is None:             # <<<<<<<<<<<<<<
 *             raise ValueError('bcf must not be None')
 * 
*/
  __pyx_t_1 = (((PyObject *)__pyx_v_bcf) == Py_None);
  if (unlikely(__pyx_t_1)) {

    /* "pysam/libcbcf.pyx":3850
 *     def __init__(self, VariantFile bcf, contig=None, start=None, stop=None, reopen=True):
 *         if bcf is None:
 *             raise ValueError('bcf must not be None')             # <<<<<<<<<<<<<<
 * 
 *         if contig is None:
*/
    __pyx_t_3 = NULL;
    __Pyx_INCREF(__pyx_builtin_ValueError);
    __pyx_t_4 = __pyx_builtin_ValueError; 
    __pyx_t_5 = 1;
    {
      PyObject *__pyx_callargs[2] = {__pyx_t_3, __pyx_mstate_global->__pyx_kp_u_bcf_must_not_be_None};
      __pyx_t_2 = __Pyx_PyObject_FastCall(__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_2)) __PYX_ERR(0, 3850, __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, 3850, __pyx_L1_error)

    /* "pysam/libcbcf.pyx":3849
 * cdef class BCFIterator(BaseIterator):
 *     def __init__(self, VariantFile bcf, contig=None, start=None, stop=None, reopen=True):
 *         if bcf is None:             # <<<<<<<<<<<<<<
 *             raise ValueError('bcf must not be None')
 * 
*/
  }

  /* "pysam/libcbcf.pyx":3852
 *             raise ValueError('bcf must not be None')
 * 
 *         if contig is None:             # <<<<<<<<<<<<<<
 *             raise ValueError('contig must be specified')
 * 
*/
  __pyx_t_1 = (__pyx_v_contig == Py_None);
  if (unlikely(__pyx_t_1)) {

    /* "pysam/libcbcf.pyx":3853
 * 
 *         if contig is None:
 *             raise ValueError('contig must be specified')             # <<<<<<<<<<<<<<
 * 
 *         if not isinstance(bcf.index, BCFIndex):
*/
    __pyx_t_4 = NULL;
    __Pyx_INCREF(__pyx_builtin_ValueError);
    __pyx_t_3 = __pyx_builtin_ValueError; 
    __pyx_t_5 = 1;
    {
      PyObject *__pyx_callargs[2] = {__pyx_t_4, __pyx_mstate_global->__pyx_kp_u_contig_must_be_specified};
      __pyx_t_2 = __Pyx_PyObject_FastCall(__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_2)) __PYX_ERR(0, 3853, __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, 3853, __pyx_L1_error)

    /* "pysam/libcbcf.pyx":3852
 *             raise ValueError('bcf must not be None')
 * 
 *         if contig is None:             # <<<<<<<<<<<<<<
 *             raise ValueError('contig must be specified')
 * 
*/
  }

  /* "pysam/libcbcf.pyx":3855
 *             raise ValueError('contig must be specified')
 * 
 *         if not isinstance(bcf.index, BCFIndex):             # <<<<<<<<<<<<<<
 *             raise ValueError('bcf index required')
 * 
*/
  __pyx_t_2 = ((PyObject *)__pyx_v_bcf->index);
  __Pyx_INCREF(__pyx_t_2);
  __pyx_t_1 = __Pyx_TypeCheck(__pyx_t_2, __pyx_mstate_global->__pyx_ptype_5pysam_7libcbcf_BCFIndex); 
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __pyx_t_6 = (!__pyx_t_1);
  if (unlikely(__pyx_t_6)) {

    /* "pysam/libcbcf.pyx":3856
 * 
 *         if not isinstance(bcf.index, BCFIndex):
 *             raise ValueError('bcf index required')             # <<<<<<<<<<<<<<
 * 
 *         cdef BCFIndex index = bcf.index
*/
    __pyx_t_3 = NULL;
    __Pyx_INCREF(__pyx_builtin_ValueError);
    __pyx_t_4 = __pyx_builtin_ValueError; 
    __pyx_t_5 = 1;
    {
      PyObject *__pyx_callargs[2] = {__pyx_t_3, __pyx_mstate_global->__pyx_kp_u_bcf_index_required};
      __pyx_t_2 = __Pyx_PyObject_FastCall(__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_2)) __PYX_ERR(0, 3856, __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, 3856, __pyx_L1_error)

    /* "pysam/libcbcf.pyx":3855
 *             raise ValueError('contig must be specified')
 * 
 *         if not isinstance(bcf.index, BCFIndex):             # <<<<<<<<<<<<<<
 *             raise ValueError('bcf index required')
 * 
*/
  }

  /* "pysam/libcbcf.pyx":3858
 *             raise ValueError('bcf index required')
 * 
 *         cdef BCFIndex index = bcf.index             # <<<<<<<<<<<<<<
 * 
 *         self.bcf = bcf
*/
  __pyx_t_2 = ((PyObject *)__pyx_v_bcf->index);
  __Pyx_INCREF(__pyx_t_2);
  if (!(likely(((__pyx_t_2) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_2, __pyx_mstate_global->__pyx_ptype_5pysam_7libcbcf_BCFIndex))))) __PYX_ERR(0, 3858, __pyx_L1_error)
  __pyx_v_index = ((struct __pyx_obj_5pysam_7libcbcf_BCFIndex *)__pyx_t_2);
  __pyx_t_2 = 0;

  /* "pysam/libcbcf.pyx":3860
 *         cdef BCFIndex index = bcf.index
 * 
 *         self.bcf = bcf             # <<<<<<<<<<<<<<
 *         self.index = index
 * 
*/
  __Pyx_INCREF((PyObject *)__pyx_v_bcf);
  __Pyx_GIVEREF((PyObject *)__pyx_v_bcf);
  __Pyx_GOTREF((PyObject *)__pyx_v_self->__pyx_base.bcf);
  __Pyx_DECREF((PyObject *)__pyx_v_self->__pyx_base.bcf);
  __pyx_v_self->__pyx_base.bcf = __pyx_v_bcf;

  /* "pysam/libcbcf.pyx":3861
 * 
 *         self.bcf = bcf
 *         self.index = index             # <<<<<<<<<<<<<<
 * 
 *         cdef int rid, cstart, cstop
*/
  __Pyx_INCREF((PyObject *)__pyx_v_index);
  __Pyx_GIVEREF((PyObject *)__pyx_v_index);
  __Pyx_GOTREF((PyObject *)__pyx_v_self->index);
  __Pyx_DECREF((PyObject *)__pyx_v_self->index);
  __pyx_v_self->index = __pyx_v_index;

  /* "pysam/libcbcf.pyx":3865
 *         cdef int rid, cstart, cstop
 * 
 *         try:             # <<<<<<<<<<<<<<
 *             rid = index.refmap[contig]
 *         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:*/ {

      /* "pysam/libcbcf.pyx":3866
 * 
 *         try:
 *             rid = index.refmap[contig]             # <<<<<<<<<<<<<<
 *         except KeyError:
 *             # A query for a non-existent contig yields an empty iterator, does not raise an error
*/
      if (unlikely(__pyx_v_index->__pyx_base.refmap == Py_None)) {
        PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable");
        __PYX_ERR(0, 3866, __pyx_L6_error)
      }
      __pyx_t_2 = __Pyx_PyDict_GetItem(__pyx_v_index->__pyx_base.refmap, __pyx_v_contig); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 3866, __pyx_L6_error)
      __Pyx_GOTREF(__pyx_t_2);
      __pyx_t_10 = __Pyx_PyLong_As_int(__pyx_t_2); if (unlikely((__pyx_t_10 == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 3866, __pyx_L6_error)
      __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
      __pyx_v_rid = __pyx_t_10;

      /* "pysam/libcbcf.pyx":3865
 *         cdef int rid, cstart, cstop
 * 
 *         try:             # <<<<<<<<<<<<<<
 *             rid = index.refmap[contig]
 *         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_2); __pyx_t_2 = 0;
    __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
    __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
    __Pyx_TraceException(__pyx_lineno, 0, 0);

    /* "pysam/libcbcf.pyx":3867
 *         try:
 *             rid = index.refmap[contig]
 *         except KeyError:             # <<<<<<<<<<<<<<
 *             # A query for a non-existent contig yields an empty iterator, does not raise an error
 *             self.iter = NULL
*/
    __pyx_t_10 = __Pyx_PyErr_ExceptionMatches(__pyx_builtin_KeyError);
    if (__pyx_t_10) {
      __Pyx_AddTraceback("pysam.libcbcf.BCFIterator.__init__", __pyx_clineno, __pyx_lineno, __pyx_filename);
      __Pyx_TraceExceptionHandled(0);
      if (__Pyx_GetException(&__pyx_t_2, &__pyx_t_4, &__pyx_t_3) < 0) __PYX_ERR(0, 3867, __pyx_L8_except_error)
      __Pyx_XGOTREF(__pyx_t_2);
      __Pyx_XGOTREF(__pyx_t_4);
      __Pyx_XGOTREF(__pyx_t_3);
      __Pyx_TraceExceptionDone();

      /* "pysam/libcbcf.pyx":3869
 *         except KeyError:
 *             # A query for a non-existent contig yields an empty iterator, does not raise an error
 *             self.iter = NULL             # <<<<<<<<<<<<<<
 *             return
 * 
*/
      __pyx_v_self->__pyx_base.iter = NULL;

      /* "pysam/libcbcf.pyx":3870
 *             # A query for a non-existent contig yields an empty iterator, does not raise an error
 *             self.iter = NULL
 *             return             # <<<<<<<<<<<<<<
 * 
 *         if reopen:
*/
      __pyx_r = 0;
      __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
      __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
      __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
      goto __pyx_L9_except_return;
    }
    goto __pyx_L8_except_error;

    /* "pysam/libcbcf.pyx":3865
 *         cdef int rid, cstart, cstop
 * 
 *         try:             # <<<<<<<<<<<<<<
 *             rid = index.refmap[contig]
 *         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_L9_except_return:;
    __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_L0;
    __pyx_L11_try_end:;
  }

  /* "pysam/libcbcf.pyx":3872
 *             return
 * 
 *         if reopen:             # <<<<<<<<<<<<<<
 *             self.bcf = self.bcf.copy()
 * 
*/
  __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_v_reopen); if (unlikely((__pyx_t_6 < 0))) __PYX_ERR(0, 3872, __pyx_L1_error)
  if (__pyx_t_6) {

    /* "pysam/libcbcf.pyx":3873
 * 
 *         if reopen:
 *             self.bcf = self.bcf.copy()             # <<<<<<<<<<<<<<
 * 
 *         cstart = start if start is not None else 0
*/
    __pyx_t_4 = ((PyObject *)__pyx_v_self->__pyx_base.bcf);
    __Pyx_INCREF(__pyx_t_4);
    __pyx_t_5 = 0;
    {
      PyObject *__pyx_callargs[2] = {__pyx_t_4, NULL};
      __pyx_t_3 = __Pyx_PyObject_FastCallMethod(__pyx_mstate_global->__pyx_n_u_copy, __pyx_callargs+__pyx_t_5, (1-__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, 3873, __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_5pysam_7libcbcf_VariantFile))))) __PYX_ERR(0, 3873, __pyx_L1_error)
    __Pyx_GIVEREF(__pyx_t_3);
    __Pyx_GOTREF((PyObject *)__pyx_v_self->__pyx_base.bcf);
    __Pyx_DECREF((PyObject *)__pyx_v_self->__pyx_base.bcf);
    __pyx_v_self->__pyx_base.bcf = ((struct __pyx_obj_5pysam_7libcbcf_VariantFile *)__pyx_t_3);
    __pyx_t_3 = 0;

    /* "pysam/libcbcf.pyx":3872
 *             return
 * 
 *         if reopen:             # <<<<<<<<<<<<<<
 *             self.bcf = self.bcf.copy()
 * 
*/
  }

  /* "pysam/libcbcf.pyx":3875
 *             self.bcf = self.bcf.copy()
 * 
 *         cstart = start if start is not None else 0             # <<<<<<<<<<<<<<
 *         cstop  = stop  if stop  is not None else MAX_POS
 * 
*/
  __pyx_t_6 = (__pyx_v_start != Py_None);
  if (__pyx_t_6) {
    __pyx_t_11 = __Pyx_PyLong_As_int(__pyx_v_start); if (unlikely((__pyx_t_11 == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 3875, __pyx_L1_error)
    __pyx_t_10 = __pyx_t_11;
  } else {
    __pyx_t_10 = 0;
  }
  __pyx_v_cstart = __pyx_t_10;

  /* "pysam/libcbcf.pyx":3876
 * 
 *         cstart = start if start is not None else 0
 *         cstop  = stop  if stop  is not None else MAX_POS             # <<<<<<<<<<<<<<
 * 
 *         with nogil:
*/
  __pyx_t_6 = (__pyx_v_stop != Py_None);
  if (__pyx_t_6) {
    __pyx_t_11 = __Pyx_PyLong_As_int(__pyx_v_stop); if (unlikely((__pyx_t_11 == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 3876, __pyx_L1_error)
    __pyx_t_10 = __pyx_t_11;
  } else {
    __pyx_t_10 = __pyx_v_5pysam_7libcbcf_MAX_POS;
  }
  __pyx_v_cstop = __pyx_t_10;

  /* "pysam/libcbcf.pyx":3878
 *         cstop  = stop  if stop  is not None else MAX_POS
 * 
 *         with nogil:             # <<<<<<<<<<<<<<
 *             self.iter = bcf_itr_queryi(index.ptr, rid, cstart, cstop)
 * 
*/
  {
      PyThreadState *_save;
      _save = NULL;
      Py_UNBLOCK_THREADS
      __Pyx_FastGIL_Remember();
      /*try:*/ {

        /* "pysam/libcbcf.pyx":3879
 * 
 *         with nogil:
 *             self.iter = bcf_itr_queryi(index.ptr, rid, cstart, cstop)             # <<<<<<<<<<<<<<
 * 
 *         if not self.iter:
*/
        __pyx_v_self->__pyx_base.iter = bcf_itr_queryi(__pyx_v_index->ptr, __pyx_v_rid, __pyx_v_cstart, __pyx_v_cstop);
      }

      /* "pysam/libcbcf.pyx":3878
 *         cstop  = stop  if stop  is not None else MAX_POS
 * 
 *         with nogil:             # <<<<<<<<<<<<<<
 *             self.iter = bcf_itr_queryi(index.ptr, rid, cstart, cstop)
 * 
*/
      /*finally:*/ {
        /*normal exit:*/{
          __Pyx_FastGIL_Forget();
          Py_BLOCK_THREADS
          goto __pyx_L17;
        }
        __pyx_L17:;
      }
  }

  /* "pysam/libcbcf.pyx":3881
 *             self.iter = bcf_itr_queryi(index.ptr, rid, cstart, cstop)
 * 
 *         if not self.iter:             # <<<<<<<<<<<<<<
 *             if errno:
 *                 raise IOError(errno, strerror(errno))
*/
  __pyx_t_6 = (!(__pyx_v_self->__pyx_base.iter != 0));
  if (__pyx_t_6) {

    /* "pysam/libcbcf.pyx":3882
 * 
 *         if not self.iter:
 *             if errno:             # <<<<<<<<<<<<<<
 *                 raise IOError(errno, strerror(errno))
 *             else:
*/
    __pyx_t_6 = (errno != 0);
    if (unlikely(__pyx_t_6)) {

      /* "pysam/libcbcf.pyx":3883
 *         if not self.iter:
 *             if errno:
 *                 raise IOError(errno, strerror(errno))             # <<<<<<<<<<<<<<
 *             else:
 *                 raise IOError('unable to fetch {}:{}-{}'.format(contig, start+1, stop))
*/
      __pyx_t_4 = NULL;
      __Pyx_INCREF(__pyx_builtin_IOError);
      __pyx_t_2 = __pyx_builtin_IOError; 
      __pyx_t_12 = __Pyx_PyLong_From_int(errno); if (unlikely(!__pyx_t_12)) __PYX_ERR(0, 3883, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_12);
      __pyx_t_13 = __Pyx_PyBytes_FromString(strerror(errno)); if (unlikely(!__pyx_t_13)) __PYX_ERR(0, 3883, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_13);
      __pyx_t_5 = 1;
      {
        PyObject *__pyx_callargs[3] = {__pyx_t_4, __pyx_t_12, __pyx_t_13};
        __pyx_t_3 = __Pyx_PyObject_FastCall(__pyx_t_2, __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;
        __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0;
        __Pyx_DECREF(__pyx_t_13); __pyx_t_13 = 0;
        __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
        if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 3883, __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, 3883, __pyx_L1_error)

      /* "pysam/libcbcf.pyx":3882
 * 
 *         if not self.iter:
 *             if errno:             # <<<<<<<<<<<<<<
 *                 raise IOError(errno, strerror(errno))
 *             else:
*/
    }

    /* "pysam/libcbcf.pyx":3885
 *                 raise IOError(errno, strerror(errno))
 *             else:
 *                 raise IOError('unable to fetch {}:{}-{}'.format(contig, start+1, stop))             # <<<<<<<<<<<<<<
 * 
 *     def __dealloc__(self):
*/
    /*else*/ {
      __pyx_t_2 = NULL;
      __Pyx_INCREF(__pyx_builtin_IOError);
      __pyx_t_13 = __pyx_builtin_IOError; 
      __pyx_t_4 = __pyx_mstate_global->__pyx_kp_u_unable_to_fetch;
      __Pyx_INCREF(__pyx_t_4);
      __pyx_t_14 = __Pyx_PyLong_AddObjC(__pyx_v_start, __pyx_mstate_global->__pyx_int_1, 1, 0, 0); if (unlikely(!__pyx_t_14)) __PYX_ERR(0, 3885, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_14);
      __pyx_t_5 = 0;
      {
        PyObject *__pyx_callargs[4] = {__pyx_t_4, __pyx_v_contig, __pyx_t_14, __pyx_v_stop};
        __pyx_t_12 = __Pyx_PyObject_FastCallMethod(__pyx_mstate_global->__pyx_n_u_format, __pyx_callargs+__pyx_t_5, (4-__pyx_t_5) | (1*__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_12)) __PYX_ERR(0, 3885, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_12);
      }
      __pyx_t_5 = 1;
      {
        PyObject *__pyx_callargs[2] = {__pyx_t_2, __pyx_t_12};
        __pyx_t_3 = __Pyx_PyObject_FastCall(__pyx_t_13, __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_12); __pyx_t_12 = 0;
        __Pyx_DECREF(__pyx_t_13); __pyx_t_13 = 0;
        if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 3885, __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, 3885, __pyx_L1_error)
    }

    /* "pysam/libcbcf.pyx":3881
 *             self.iter = bcf_itr_queryi(index.ptr, rid, cstart, cstop)
 * 
 *         if not self.iter:             # <<<<<<<<<<<<<<
 *             if errno:
 *                 raise IOError(errno, strerror(errno))
*/
  }

  /* "pysam/libcbcf.pyx":3848
 * 
 * cdef class BCFIterator(BaseIterator):
 *     def __init__(self, VariantFile bcf, contig=None, start=None, stop=None, reopen=True):             # <<<<<<<<<<<<<<
 *         if bcf is None:
 *             raise ValueError('bcf must not be None')
*/

  /* function exit code */
  __pyx_r = 0;
  __Pyx_TraceReturnCValue(__pyx_r, __Pyx_Owned_Py_None, 0, 0, __PYX_ERR(0, 3848, __pyx_L1_error));
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_XDECREF(__pyx_t_12);
  __Pyx_XDECREF(__pyx_t_13);
  __Pyx_XDECREF(__pyx_t_14);
  __Pyx_TraceException(__pyx_lineno, 0, 0);
  #if CYTHON_USE_SYS_MONITORING
  __Pyx_TraceExceptionUnwind(0, 0);
  #else
  __Pyx_TraceReturnValue(NULL, 0, 0, __PYX_ERR(0, 3848, __pyx_L1_error));
  #endif
  __Pyx_AddTraceback("pysam.libcbcf.BCFIterator.__init__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = -1;
  __pyx_L0:;
  __Pyx_XDECREF((PyObject *)__pyx_v_index);
  __Pyx_PyMonitoring_ExitScope(0);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "pysam/libcbcf.pyx":3887
 *                 raise IOError('unable to fetch {}:{}-{}'.format(contig, start+1, stop))
 * 
 *     def __dealloc__(self):             # <<<<<<<<<<<<<<
 *         if self.iter:
 *             bcf_itr_destroy(self.iter)
*/

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

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

static void __pyx_pf_5pysam_7libcbcf_11BCFIterator_2__dealloc__(struct __pyx_obj_5pysam_7libcbcf_BCFIterator *__pyx_v_self) {
  __Pyx_TraceDeclarationsFunc
  int __pyx_t_1;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_TraceFrameInit(((PyObject *)__pyx_mstate_global->__pyx_codeobj_tab[353]))
  __Pyx_TraceStartFunc("__dealloc__", __pyx_f[0], 3887, 0, 0, 0, __PYX_ERR(0, 3887, __pyx_L1_error));

  /* "pysam/libcbcf.pyx":3888
 * 
 *     def __dealloc__(self):
 *         if self.iter:             # <<<<<<<<<<<<<<
 *             bcf_itr_destroy(self.iter)
 *             self.iter = NULL
*/
  __pyx_t_1 = (__pyx_v_self->__pyx_base.iter != 0);
  if (__pyx_t_1) {

    /* "pysam/libcbcf.pyx":3889
 *     def __dealloc__(self):
 *         if self.iter:
 *             bcf_itr_destroy(self.iter)             # <<<<<<<<<<<<<<
 *             self.iter = NULL
 * 
*/
    bcf_itr_destroy(__pyx_v_self->__pyx_base.iter);

    /* "pysam/libcbcf.pyx":3890
 *         if self.iter:
 *             bcf_itr_destroy(self.iter)
 *             self.iter = NULL             # <<<<<<<<<<<<<<
 * 
 *     def __iter__(self):
*/
    __pyx_v_self->__pyx_base.iter = NULL;

    /* "pysam/libcbcf.pyx":3888
 * 
 *     def __dealloc__(self):
 *         if self.iter:             # <<<<<<<<<<<<<<
 *             bcf_itr_destroy(self.iter)
 *             self.iter = NULL
*/
  }

  /* "pysam/libcbcf.pyx":3887
 *                 raise IOError('unable to fetch {}:{}-{}'.format(contig, start+1, stop))
 * 
 *     def __dealloc__(self):             # <<<<<<<<<<<<<<
 *         if self.iter:
 *             bcf_itr_destroy(self.iter)
*/

  /* function exit code */
  __Pyx_TraceReturnValue(Py_None, 0, 0, __PYX_ERR(0, 3887, __pyx_L1_error));
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_TraceException(__pyx_lineno, 0, 0);
  #if CYTHON_USE_SYS_MONITORING
  __Pyx_TraceExceptionUnwind(0, 0);
  #else
  __Pyx_TraceReturnValue(NULL, 0, 0, __PYX_ERR(0, 3887, __pyx_L1_error));
  #endif
  __Pyx_WriteUnraisable("pysam.libcbcf.BCFIterator.__dealloc__", __pyx_clineno, __pyx_lineno, __pyx_filename, 1, 0);
  __pyx_L0:;
  __Pyx_PyMonitoring_ExitScope(0);
}

/* "pysam/libcbcf.pyx":3892
 *             self.iter = NULL
 * 
 *     def __iter__(self):             # <<<<<<<<<<<<<<
 *         return self
 * 
*/

/* Python wrapper */
static PyObject *__pyx_pw_5pysam_7libcbcf_11BCFIterator_5__iter__(PyObject *__pyx_v_self); /*proto*/
static PyObject *__pyx_pw_5pysam_7libcbcf_11BCFIterator_5__iter__(PyObject *__pyx_v_self) {
  CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__iter__ (wrapper)", 0);
  __pyx_kwvalues = __Pyx_KwValues_VARARGS(__pyx_args, __pyx_nargs);
  __pyx_r = __pyx_pf_5pysam_7libcbcf_11BCFIterator_4__iter__(((struct __pyx_obj_5pysam_7libcbcf_BCFIterator *)__pyx_v_self));

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

static PyObject *__pyx_pf_5pysam_7libcbcf_11BCFIterator_4__iter__(struct __pyx_obj_5pysam_7libcbcf_BCFIterator *__pyx_v_self) {
  PyObject *__pyx_r = NULL;
  __Pyx_TraceDeclarationsFunc
  __Pyx_RefNannyDeclarations
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_TraceFrameInit(((PyObject *)__pyx_mstate_global->__pyx_codeobj_tab[354]))
  __Pyx_RefNannySetupContext("__iter__", 0);
  __Pyx_TraceStartFunc("__iter__", __pyx_f[0], 3892, 0, 0, 0, __PYX_ERR(0, 3892, __pyx_L1_error));

  /* "pysam/libcbcf.pyx":3893
 * 
 *     def __iter__(self):
 *         return self             # <<<<<<<<<<<<<<
 * 
 *     def __next__(self):
*/
  __Pyx_XDECREF(__pyx_r);
  __Pyx_INCREF((PyObject *)__pyx_v_self);
  __pyx_r = ((PyObject *)__pyx_v_self);
  __Pyx_TraceReturnValue(__pyx_r, 1, 0, __PYX_ERR(0, 3893, __pyx_L1_error));
  goto __pyx_L0;

  /* "pysam/libcbcf.pyx":3892
 *             self.iter = NULL
 * 
 *     def __iter__(self):             # <<<<<<<<<<<<<<
 *         return self
 * 
*/

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_TraceException(__pyx_lineno, 0, 0);
  #if CYTHON_USE_SYS_MONITORING
  __Pyx_TraceExceptionUnwind(0, 0);
  #else
  __Pyx_TraceReturnValue(NULL, 0, 0, __PYX_ERR(0, 3892, __pyx_L1_error));
  #endif
  __Pyx_AddTraceback("pysam.libcbcf.BCFIterator.__iter__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_PyMonitoring_ExitScope(0);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "pysam/libcbcf.pyx":3895
 *         return self
 * 
 *     def __next__(self):             # <<<<<<<<<<<<<<
 *         if not self.iter:
 *             raise StopIteration
*/

/* Python wrapper */
static PyObject *__pyx_pw_5pysam_7libcbcf_11BCFIterator_7__next__(PyObject *__pyx_v_self); /*proto*/
static PyObject *__pyx_pw_5pysam_7libcbcf_11BCFIterator_7__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_5pysam_7libcbcf_11BCFIterator_6__next__(((struct __pyx_obj_5pysam_7libcbcf_BCFIterator *)__pyx_v_self));

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

static PyObject *__pyx_pf_5pysam_7libcbcf_11BCFIterator_6__next__(struct __pyx_obj_5pysam_7libcbcf_BCFIterator *__pyx_v_self) {
  bcf1_t *__pyx_v_record;
  int __pyx_v_ret;
  PyObject *__pyx_r = NULL;
  __Pyx_TraceDeclarationsFunc
  __Pyx_RefNannyDeclarations
  int __pyx_error_without_exception = 0; /* StopIteration */
  int __pyx_t_1;
  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;
  PyObject *__pyx_t_7 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_TraceFrameInit(((PyObject *)__pyx_mstate_global->__pyx_codeobj_tab[355]))
  __Pyx_RefNannySetupContext("__next__", 0);
  __Pyx_TraceStartFunc("__next__", __pyx_f[0], 3895, 0, 0, 0, __PYX_ERR(0, 3895, __pyx_L1_error));

  /* "pysam/libcbcf.pyx":3896
 * 
 *     def __next__(self):
 *         if not self.iter:             # <<<<<<<<<<<<<<
 *             raise StopIteration
 * 
*/
  __pyx_t_1 = (!(__pyx_v_self->__pyx_base.iter != 0));
  if (unlikely(__pyx_t_1)) {

    /* "pysam/libcbcf.pyx":3897
 *     def __next__(self):
 *         if not self.iter:
 *             raise StopIteration             # <<<<<<<<<<<<<<
 * 
 *         cdef bcf1_t *record = bcf_init1()
*/
    __pyx_error_without_exception = 1;
    goto __pyx_L1_error;;

    /* "pysam/libcbcf.pyx":3896
 * 
 *     def __next__(self):
 *         if not self.iter:             # <<<<<<<<<<<<<<
 *             raise StopIteration
 * 
*/
  }

  /* "pysam/libcbcf.pyx":3899
 *             raise StopIteration
 * 
 *         cdef bcf1_t *record = bcf_init1()             # <<<<<<<<<<<<<<
 * 
 *         if not record:
*/
  __pyx_v_record = bcf_init1();

  /* "pysam/libcbcf.pyx":3901
 *         cdef bcf1_t *record = bcf_init1()
 * 
 *         if not record:             # <<<<<<<<<<<<<<
 *             raise MemoryError('unable to allocate BCF record')
 * 
*/
  __pyx_t_1 = (!(__pyx_v_record != 0));
  if (unlikely(__pyx_t_1)) {

    /* "pysam/libcbcf.pyx":3902
 * 
 *         if not record:
 *             raise MemoryError('unable to allocate BCF record')             # <<<<<<<<<<<<<<
 * 
 *         record.pos = -1
*/
    __pyx_t_3 = NULL;
    __Pyx_INCREF(__pyx_builtin_MemoryError);
    __pyx_t_4 = __pyx_builtin_MemoryError; 
    __pyx_t_5 = 1;
    {
      PyObject *__pyx_callargs[2] = {__pyx_t_3, __pyx_mstate_global->__pyx_kp_u_unable_to_allocate_BCF_record};
      __pyx_t_2 = __Pyx_PyObject_FastCall(__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_2)) __PYX_ERR(0, 3902, __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, 3902, __pyx_L1_error)

    /* "pysam/libcbcf.pyx":3901
 *         cdef bcf1_t *record = bcf_init1()
 * 
 *         if not record:             # <<<<<<<<<<<<<<
 *             raise MemoryError('unable to allocate BCF record')
 * 
*/
  }

  /* "pysam/libcbcf.pyx":3904
 *             raise MemoryError('unable to allocate BCF record')
 * 
 *         record.pos = -1             # <<<<<<<<<<<<<<
 *         if self.bcf.drop_samples:
 *             record.max_unpack = BCF_UN_SHR
*/
  __pyx_v_record->pos = -1;

  /* "pysam/libcbcf.pyx":3905
 * 
 *         record.pos = -1
 *         if self.bcf.drop_samples:             # <<<<<<<<<<<<<<
 *             record.max_unpack = BCF_UN_SHR
 * 
*/
  if (__pyx_v_self->__pyx_base.bcf->drop_samples) {

    /* "pysam/libcbcf.pyx":3906
 *         record.pos = -1
 *         if self.bcf.drop_samples:
 *             record.max_unpack = BCF_UN_SHR             # <<<<<<<<<<<<<<
 * 
 *         cdef int ret
*/
    __pyx_v_record->max_unpack = BCF_UN_SHR;

    /* "pysam/libcbcf.pyx":3905
 * 
 *         record.pos = -1
 *         if self.bcf.drop_samples:             # <<<<<<<<<<<<<<
 *             record.max_unpack = BCF_UN_SHR
 * 
*/
  }

  /* "pysam/libcbcf.pyx":3910
 *         cdef int ret
 * 
 *         with nogil:             # <<<<<<<<<<<<<<
 *             ret = bcf_itr_next(self.bcf.htsfile, self.iter, record)
 * 
*/
  {
      PyThreadState *_save;
      _save = NULL;
      Py_UNBLOCK_THREADS
      __Pyx_FastGIL_Remember();
      /*try:*/ {

        /* "pysam/libcbcf.pyx":3911
 * 
 *         with nogil:
 *             ret = bcf_itr_next(self.bcf.htsfile, self.iter, record)             # <<<<<<<<<<<<<<
 * 
 *         if ret < 0:
*/
        __pyx_v_ret = bcf_itr_next(__pyx_v_self->__pyx_base.bcf->__pyx_base.htsfile, __pyx_v_self->__pyx_base.iter, __pyx_v_record);
      }

      /* "pysam/libcbcf.pyx":3910
 *         cdef int ret
 * 
 *         with nogil:             # <<<<<<<<<<<<<<
 *             ret = bcf_itr_next(self.bcf.htsfile, self.iter, record)
 * 
*/
      /*finally:*/ {
        /*normal exit:*/{
          __Pyx_FastGIL_Forget();
          Py_BLOCK_THREADS
          goto __pyx_L8;
        }
        __pyx_L8:;
      }
  }

  /* "pysam/libcbcf.pyx":3913
 *             ret = bcf_itr_next(self.bcf.htsfile, self.iter, record)
 * 
 *         if ret < 0:             # <<<<<<<<<<<<<<
 *             _stop_BCFIterator(self, record)
 *             if ret == -1:
*/
  __pyx_t_1 = (__pyx_v_ret < 0);
  if (__pyx_t_1) {

    /* "pysam/libcbcf.pyx":3914
 * 
 *         if ret < 0:
 *             _stop_BCFIterator(self, record)             # <<<<<<<<<<<<<<
 *             if ret == -1:
 *                 raise StopIteration
*/
    __pyx_f_5pysam_7libcbcf__stop_BCFIterator(__pyx_v_self, __pyx_v_record); if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 3914, __pyx_L1_error)

    /* "pysam/libcbcf.pyx":3915
 *         if ret < 0:
 *             _stop_BCFIterator(self, record)
 *             if ret == -1:             # <<<<<<<<<<<<<<
 *                 raise StopIteration
 *             elif ret == -2:
*/
    __pyx_t_1 = (__pyx_v_ret == -1L);
    if (unlikely(__pyx_t_1)) {

      /* "pysam/libcbcf.pyx":3916
 *             _stop_BCFIterator(self, record)
 *             if ret == -1:
 *                 raise StopIteration             # <<<<<<<<<<<<<<
 *             elif ret == -2:
 *                 raise IOError('truncated file')
*/
      __pyx_error_without_exception = 1;
      goto __pyx_L1_error;;

      /* "pysam/libcbcf.pyx":3915
 *         if ret < 0:
 *             _stop_BCFIterator(self, record)
 *             if ret == -1:             # <<<<<<<<<<<<<<
 *                 raise StopIteration
 *             elif ret == -2:
*/
    }

    /* "pysam/libcbcf.pyx":3917
 *             if ret == -1:
 *                 raise StopIteration
 *             elif ret == -2:             # <<<<<<<<<<<<<<
 *                 raise IOError('truncated file')
 *             elif errno:
*/
    __pyx_t_1 = (__pyx_v_ret == -2L);
    if (unlikely(__pyx_t_1)) {

      /* "pysam/libcbcf.pyx":3918
 *                 raise StopIteration
 *             elif ret == -2:
 *                 raise IOError('truncated file')             # <<<<<<<<<<<<<<
 *             elif errno:
 *                 raise IOError(errno, strerror(errno))
*/
      __pyx_t_4 = NULL;
      __Pyx_INCREF(__pyx_builtin_IOError);
      __pyx_t_3 = __pyx_builtin_IOError; 
      __pyx_t_5 = 1;
      {
        PyObject *__pyx_callargs[2] = {__pyx_t_4, __pyx_mstate_global->__pyx_kp_u_truncated_file};
        __pyx_t_2 = __Pyx_PyObject_FastCall(__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_2)) __PYX_ERR(0, 3918, __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, 3918, __pyx_L1_error)

      /* "pysam/libcbcf.pyx":3917
 *             if ret == -1:
 *                 raise StopIteration
 *             elif ret == -2:             # <<<<<<<<<<<<<<
 *                 raise IOError('truncated file')
 *             elif errno:
*/
    }

    /* "pysam/libcbcf.pyx":3919
 *             elif ret == -2:
 *                 raise IOError('truncated file')
 *             elif errno:             # <<<<<<<<<<<<<<
 *                 raise IOError(errno, strerror(errno))
 *             else:
*/
    __pyx_t_1 = (errno != 0);
    if (unlikely(__pyx_t_1)) {

      /* "pysam/libcbcf.pyx":3920
 *                 raise IOError('truncated file')
 *             elif errno:
 *                 raise IOError(errno, strerror(errno))             # <<<<<<<<<<<<<<
 *             else:
 *                 raise IOError('unable to fetch next record')
*/
      __pyx_t_3 = NULL;
      __Pyx_INCREF(__pyx_builtin_IOError);
      __pyx_t_4 = __pyx_builtin_IOError; 
      __pyx_t_6 = __Pyx_PyLong_From_int(errno); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 3920, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_6);
      __pyx_t_7 = __Pyx_PyBytes_FromString(strerror(errno)); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 3920, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_7);
      __pyx_t_5 = 1;
      {
        PyObject *__pyx_callargs[3] = {__pyx_t_3, __pyx_t_6, __pyx_t_7};
        __pyx_t_2 = __Pyx_PyObject_FastCall(__pyx_t_4, __pyx_callargs+__pyx_t_5, (3-__pyx_t_5) | (__pyx_t_5*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
        __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
        __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
        __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
        __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
        if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 3920, __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, 3920, __pyx_L1_error)

      /* "pysam/libcbcf.pyx":3919
 *             elif ret == -2:
 *                 raise IOError('truncated file')
 *             elif errno:             # <<<<<<<<<<<<<<
 *                 raise IOError(errno, strerror(errno))
 *             else:
*/
    }

    /* "pysam/libcbcf.pyx":3922
 *                 raise IOError(errno, strerror(errno))
 *             else:
 *                 raise IOError('unable to fetch next record')             # <<<<<<<<<<<<<<
 * 
 *         ret = bcf_subset_format(self.bcf.header.ptr, record)
*/
    /*else*/ {
      __pyx_t_4 = NULL;
      __Pyx_INCREF(__pyx_builtin_IOError);
      __pyx_t_7 = __pyx_builtin_IOError; 
      __pyx_t_5 = 1;
      {
        PyObject *__pyx_callargs[2] = {__pyx_t_4, __pyx_mstate_global->__pyx_kp_u_unable_to_fetch_next_record};
        __pyx_t_2 = __Pyx_PyObject_FastCall(__pyx_t_7, __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_7); __pyx_t_7 = 0;
        if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 3922, __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, 3922, __pyx_L1_error)
    }

    /* "pysam/libcbcf.pyx":3913
 *             ret = bcf_itr_next(self.bcf.htsfile, self.iter, record)
 * 
 *         if ret < 0:             # <<<<<<<<<<<<<<
 *             _stop_BCFIterator(self, record)
 *             if ret == -1:
*/
  }

  /* "pysam/libcbcf.pyx":3924
 *                 raise IOError('unable to fetch next record')
 * 
 *         ret = bcf_subset_format(self.bcf.header.ptr, record)             # <<<<<<<<<<<<<<
 * 
 *         if ret < 0:
*/
  __pyx_v_ret = bcf_subset_format(__pyx_v_self->__pyx_base.bcf->header->ptr, __pyx_v_record);

  /* "pysam/libcbcf.pyx":3926
 *         ret = bcf_subset_format(self.bcf.header.ptr, record)
 * 
 *         if ret < 0:             # <<<<<<<<<<<<<<
 *             _stop_BCFIterator(self, record)
 *             raise ValueError('error in bcf_subset_format')
*/
  __pyx_t_1 = (__pyx_v_ret < 0);
  if (unlikely(__pyx_t_1)) {

    /* "pysam/libcbcf.pyx":3927
 * 
 *         if ret < 0:
 *             _stop_BCFIterator(self, record)             # <<<<<<<<<<<<<<
 *             raise ValueError('error in bcf_subset_format')
 * 
*/
    __pyx_f_5pysam_7libcbcf__stop_BCFIterator(__pyx_v_self, __pyx_v_record); if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 3927, __pyx_L1_error)

    /* "pysam/libcbcf.pyx":3928
 *         if ret < 0:
 *             _stop_BCFIterator(self, record)
 *             raise ValueError('error in bcf_subset_format')             # <<<<<<<<<<<<<<
 * 
 *         return makeVariantRecord(self.bcf.header, record)
*/
    __pyx_t_7 = NULL;
    __Pyx_INCREF(__pyx_builtin_ValueError);
    __pyx_t_4 = __pyx_builtin_ValueError; 
    __pyx_t_5 = 1;
    {
      PyObject *__pyx_callargs[2] = {__pyx_t_7, __pyx_mstate_global->__pyx_kp_u_error_in_bcf_subset_format};
      __pyx_t_2 = __Pyx_PyObject_FastCall(__pyx_t_4, __pyx_callargs+__pyx_t_5, (2-__pyx_t_5) | (__pyx_t_5*__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_2)) __PYX_ERR(0, 3928, __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, 3928, __pyx_L1_error)

    /* "pysam/libcbcf.pyx":3926
 *         ret = bcf_subset_format(self.bcf.header.ptr, record)
 * 
 *         if ret < 0:             # <<<<<<<<<<<<<<
 *             _stop_BCFIterator(self, record)
 *             raise ValueError('error in bcf_subset_format')
*/
  }

  /* "pysam/libcbcf.pyx":3930
 *             raise ValueError('error in bcf_subset_format')
 * 
 *         return makeVariantRecord(self.bcf.header, record)             # <<<<<<<<<<<<<<
 * 
 * 
*/
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_2 = ((PyObject *)__pyx_v_self->__pyx_base.bcf->header);
  __Pyx_INCREF(__pyx_t_2);
  __pyx_t_4 = ((PyObject *)__pyx_f_5pysam_7libcbcf_makeVariantRecord(((struct __pyx_obj_5pysam_7libcbcf_VariantHeader *)__pyx_t_2), __pyx_v_record)); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 3930, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __pyx_r = __pyx_t_4;
  __pyx_t_4 = 0;
  __Pyx_TraceReturnValue(__pyx_r, 88, 0, __PYX_ERR(0, 3930, __pyx_L1_error));
  goto __pyx_L0;

  /* "pysam/libcbcf.pyx":3895
 *         return self
 * 
 *     def __next__(self):             # <<<<<<<<<<<<<<
 *         if not self.iter:
 *             raise StopIteration
*/

  /* 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_6);
  __Pyx_XDECREF(__pyx_t_7);
  __Pyx_TraceException(__pyx_lineno, 0, 0);
  #if CYTHON_USE_SYS_MONITORING
  __Pyx_TraceExceptionUnwind(0, 0);
  #else
  __Pyx_TraceReturnValue(NULL, 0, 0, __PYX_ERR(0, 3895, __pyx_L1_error));
  #endif
  if (!__pyx_error_without_exception) {
    __Pyx_AddTraceback("pysam.libcbcf.BCFIterator.__next__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  }
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_PyMonitoring_ExitScope(0);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "(tree fragment)":1
 * def __reduce_cython__(self):             # <<<<<<<<<<<<<<
 *     raise TypeError, "self.iter cannot be converted to a Python object for pickling"
 * def __setstate_cython__(self, __pyx_state):
*/

/* Python wrapper */
static PyObject *__pyx_pw_5pysam_7libcbcf_11BCFIterator_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*/
PyDoc_STRVAR(__pyx_doc_5pysam_7libcbcf_11BCFIterator_8__reduce_cython__, "BCFIterator.__reduce_cython__(self)");
static PyMethodDef __pyx_mdef_5pysam_7libcbcf_11BCFIterator_9__reduce_cython__ = {"__reduce_cython__", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_5pysam_7libcbcf_11BCFIterator_9__reduce_cython__, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_5pysam_7libcbcf_11BCFIterator_8__reduce_cython__};
static PyObject *__pyx_pw_5pysam_7libcbcf_11BCFIterator_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_5pysam_7libcbcf_11BCFIterator_8__reduce_cython__(((struct __pyx_obj_5pysam_7libcbcf_BCFIterator *)__pyx_v_self));

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

static PyObject *__pyx_pf_5pysam_7libcbcf_11BCFIterator_8__reduce_cython__(CYTHON_UNUSED struct __pyx_obj_5pysam_7libcbcf_BCFIterator *__pyx_v_self) {
  PyObject *__pyx_r = NULL;
  __Pyx_TraceDeclarationsFunc
  __Pyx_RefNannyDeclarations
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_TraceFrameInit(((PyObject *)__pyx_mstate_global->__pyx_codeobj_tab[356]))
  __Pyx_RefNannySetupContext("__reduce_cython__", 0);
  __Pyx_TraceStartFunc("__reduce_cython__", __pyx_f[4], 1, 0, 0, 0, __PYX_ERR(4, 1, __pyx_L1_error));

  /* "(tree fragment)":2
 * def __reduce_cython__(self):
 *     raise TypeError, "self.iter cannot be converted to a Python object for pickling"             # <<<<<<<<<<<<<<
 * def __setstate_cython__(self, __pyx_state):
 *     raise TypeError, "self.iter cannot be converted to a Python object for pickling"
*/
  __Pyx_Raise(__pyx_builtin_TypeError, __pyx_mstate_global->__pyx_kp_u_self_iter_cannot_be_converted_to, 0, 0);
  __PYX_ERR(4, 2, __pyx_L1_error)

  /* "(tree fragment)":1
 * def __reduce_cython__(self):             # <<<<<<<<<<<<<<
 *     raise TypeError, "self.iter cannot be converted to a Python object for pickling"
 * def __setstate_cython__(self, __pyx_state):
*/

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_TraceException(__pyx_lineno, 0, 0);
  #if CYTHON_USE_SYS_MONITORING
  __Pyx_TraceExceptionUnwind(0, 0);
  #else
  __Pyx_TraceReturnValue(NULL, 0, 0, __PYX_ERR(4, 1, __pyx_L1_error));
  #endif
  __Pyx_AddTraceback("pysam.libcbcf.BCFIterator.__reduce_cython__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_PyMonitoring_ExitScope(0);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "(tree fragment)":3
 * def __reduce_cython__(self):
 *     raise TypeError, "self.iter cannot be converted to a Python object for pickling"
 * def __setstate_cython__(self, __pyx_state):             # <<<<<<<<<<<<<<
 *     raise TypeError, "self.iter cannot be converted to a Python object for pickling"
*/

/* Python wrapper */
static PyObject *__pyx_pw_5pysam_7libcbcf_11BCFIterator_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*/
PyDoc_STRVAR(__pyx_doc_5pysam_7libcbcf_11BCFIterator_10__setstate_cython__, "BCFIterator.__setstate_cython__(self, __pyx_state)");
static PyMethodDef __pyx_mdef_5pysam_7libcbcf_11BCFIterator_11__setstate_cython__ = {"__setstate_cython__", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_5pysam_7libcbcf_11BCFIterator_11__setstate_cython__, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_5pysam_7libcbcf_11BCFIterator_10__setstate_cython__};
static PyObject *__pyx_pw_5pysam_7libcbcf_11BCFIterator_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(4, 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(4, 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(4, 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(4, 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(4, 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(4, 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("pysam.libcbcf.BCFIterator.__setstate_cython__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_5pysam_7libcbcf_11BCFIterator_10__setstate_cython__(((struct __pyx_obj_5pysam_7libcbcf_BCFIterator *)__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_5pysam_7libcbcf_11BCFIterator_10__setstate_cython__(CYTHON_UNUSED struct __pyx_obj_5pysam_7libcbcf_BCFIterator *__pyx_v_self, CYTHON_UNUSED PyObject *__pyx_v___pyx_state) {
  PyObject *__pyx_r = NULL;
  __Pyx_TraceDeclarationsFunc
  __Pyx_RefNannyDeclarations
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_TraceFrameInit(((PyObject *)__pyx_mstate_global->__pyx_codeobj_tab[357]))
  __Pyx_RefNannySetupContext("__setstate_cython__", 0);
  __Pyx_TraceStartFunc("__setstate_cython__", __pyx_f[4], 3, 0, 0, 0, __PYX_ERR(4, 3, __pyx_L1_error));

  /* "(tree fragment)":4
 *     raise TypeError, "self.iter cannot be converted to a Python object for pickling"
 * def __setstate_cython__(self, __pyx_state):
 *     raise TypeError, "self.iter cannot be converted to a Python object for pickling"             # <<<<<<<<<<<<<<
*/
  __Pyx_Raise(__pyx_builtin_TypeError, __pyx_mstate_global->__pyx_kp_u_self_iter_cannot_be_converted_to, 0, 0);
  __PYX_ERR(4, 4, __pyx_L1_error)

  /* "(tree fragment)":3
 * def __reduce_cython__(self):
 *     raise TypeError, "self.iter cannot be converted to a Python object for pickling"
 * def __setstate_cython__(self, __pyx_state):             # <<<<<<<<<<<<<<
 *     raise TypeError, "self.iter cannot be converted to a Python object for pickling"
*/

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_TraceException(__pyx_lineno, 0, 0);
  #if CYTHON_USE_SYS_MONITORING
  __Pyx_TraceExceptionUnwind(0, 0);
  #else
  __Pyx_TraceReturnValue(NULL, 0, 0, __PYX_ERR(4, 3, __pyx_L1_error));
  #endif
  __Pyx_AddTraceback("pysam.libcbcf.BCFIterator.__setstate_cython__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_PyMonitoring_ExitScope(0);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "pysam/libcbcf.pyx":3934
 * 
 * cdef class TabixIterator(BaseIterator):
 *     def __cinit__(self, *args, **kwargs):             # <<<<<<<<<<<<<<
 *         self.line_buffer.l = 0
 *         self.line_buffer.m = 0
*/

/* Python wrapper */
static int __pyx_pw_5pysam_7libcbcf_13TabixIterator_1__cinit__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static int __pyx_pw_5pysam_7libcbcf_13TabixIterator_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_5pysam_7libcbcf_13TabixIterator___cinit__(((struct __pyx_obj_5pysam_7libcbcf_TabixIterator *)__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_5pysam_7libcbcf_13TabixIterator___cinit__(struct __pyx_obj_5pysam_7libcbcf_TabixIterator *__pyx_v_self, CYTHON_UNUSED PyObject *__pyx_v_args, CYTHON_UNUSED PyObject *__pyx_v_kwargs) {
  int __pyx_r;
  __Pyx_TraceDeclarationsFunc
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_TraceFrameInit(((PyObject *)__pyx_mstate_global->__pyx_codeobj_tab[358]))
  __Pyx_TraceStartFunc("__cinit__", __pyx_f[0], 3934, 0, 0, 0, __PYX_ERR(0, 3934, __pyx_L1_error));

  /* "pysam/libcbcf.pyx":3935
 * cdef class TabixIterator(BaseIterator):
 *     def __cinit__(self, *args, **kwargs):
 *         self.line_buffer.l = 0             # <<<<<<<<<<<<<<
 *         self.line_buffer.m = 0
 *         self.line_buffer.s = NULL
*/
  __pyx_v_self->line_buffer.l = 0;

  /* "pysam/libcbcf.pyx":3936
 *     def __cinit__(self, *args, **kwargs):
 *         self.line_buffer.l = 0
 *         self.line_buffer.m = 0             # <<<<<<<<<<<<<<
 *         self.line_buffer.s = NULL
 * 
*/
  __pyx_v_self->line_buffer.m = 0;

  /* "pysam/libcbcf.pyx":3937
 *         self.line_buffer.l = 0
 *         self.line_buffer.m = 0
 *         self.line_buffer.s = NULL             # <<<<<<<<<<<<<<
 * 
 *     def __init__(self, VariantFile bcf, contig=None, start=None, stop=None, reopen=True):
*/
  __pyx_v_self->line_buffer.s = NULL;

  /* "pysam/libcbcf.pyx":3934
 * 
 * cdef class TabixIterator(BaseIterator):
 *     def __cinit__(self, *args, **kwargs):             # <<<<<<<<<<<<<<
 *         self.line_buffer.l = 0
 *         self.line_buffer.m = 0
*/

  /* function exit code */
  __pyx_r = 0;
  __Pyx_TraceReturnCValue(__pyx_r, __Pyx_Owned_Py_None, 0, 0, __PYX_ERR(0, 3934, __pyx_L1_error));
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_TraceException(__pyx_lineno, 0, 0);
  #if CYTHON_USE_SYS_MONITORING
  __Pyx_TraceExceptionUnwind(0, 0);
  #else
  __Pyx_TraceReturnValue(NULL, 0, 0, __PYX_ERR(0, 3934, __pyx_L1_error));
  #endif
  __Pyx_AddTraceback("pysam.libcbcf.TabixIterator.__cinit__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = -1;
  __pyx_L0:;
  __Pyx_PyMonitoring_ExitScope(0);
  return __pyx_r;
}

/* "pysam/libcbcf.pyx":3939
 *         self.line_buffer.s = NULL
 * 
 *     def __init__(self, VariantFile bcf, contig=None, start=None, stop=None, reopen=True):             # <<<<<<<<<<<<<<
 *         if bcf is None:
 *             raise ValueError('bcf must not be None')
*/

/* Python wrapper */
static int __pyx_pw_5pysam_7libcbcf_13TabixIterator_3__init__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static int __pyx_pw_5pysam_7libcbcf_13TabixIterator_3__init__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  struct __pyx_obj_5pysam_7libcbcf_VariantFile *__pyx_v_bcf = 0;
  PyObject *__pyx_v_contig = 0;
  PyObject *__pyx_v_start = 0;
  PyObject *__pyx_v_stop = 0;
  PyObject *__pyx_v_reopen = 0;
  CYTHON_UNUSED Py_ssize_t __pyx_nargs;
  CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
  PyObject* values[5] = {0,0,0,0,0};
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__init__ (wrapper)", 0);
  #if CYTHON_ASSUME_SAFE_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_bcf,&__pyx_mstate_global->__pyx_n_u_contig,&__pyx_mstate_global->__pyx_n_u_start,&__pyx_mstate_global->__pyx_n_u_stop,&__pyx_mstate_global->__pyx_n_u_reopen,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, 3939, __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(0, 3939, __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(0, 3939, __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, 3939, __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, 3939, __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, 3939, __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, 3939, __pyx_L3_error)
      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 *)Py_None));
      if (!values[4]) values[4] = __Pyx_NewRef(((PyObject *)Py_True));
      for (Py_ssize_t i = __pyx_nargs; i < 1; i++) {
        if (unlikely(!values[i])) { __Pyx_RaiseArgtupleInvalid("__init__", 0, 1, 5, i); __PYX_ERR(0, 3939, __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(0, 3939, __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(0, 3939, __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, 3939, __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, 3939, __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, 3939, __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));
      if (!values[3]) values[3] = __Pyx_NewRef(((PyObject *)Py_None));
      if (!values[4]) values[4] = __Pyx_NewRef(((PyObject *)Py_True));
    }
    __pyx_v_bcf = ((struct __pyx_obj_5pysam_7libcbcf_VariantFile *)values[0]);
    __pyx_v_contig = values[1];
    __pyx_v_start = values[2];
    __pyx_v_stop = values[3];
    __pyx_v_reopen = values[4];
  }
  goto __pyx_L6_skip;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("__init__", 0, 1, 5, __pyx_nargs); __PYX_ERR(0, 3939, __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("pysam.libcbcf.TabixIterator.__init__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return -1;
  __pyx_L4_argument_unpacking_done:;
  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_bcf), __pyx_mstate_global->__pyx_ptype_5pysam_7libcbcf_VariantFile, 1, "bcf", 0))) __PYX_ERR(0, 3939, __pyx_L1_error)
  __pyx_r = __pyx_pf_5pysam_7libcbcf_13TabixIterator_2__init__(((struct __pyx_obj_5pysam_7libcbcf_TabixIterator *)__pyx_v_self), __pyx_v_bcf, __pyx_v_contig, __pyx_v_start, __pyx_v_stop, __pyx_v_reopen);

  /* 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_pf_5pysam_7libcbcf_13TabixIterator_2__init__(struct __pyx_obj_5pysam_7libcbcf_TabixIterator *__pyx_v_self, struct __pyx_obj_5pysam_7libcbcf_VariantFile *__pyx_v_bcf, PyObject *__pyx_v_contig, PyObject *__pyx_v_start, PyObject *__pyx_v_stop, PyObject *__pyx_v_reopen) {
  struct __pyx_obj_5pysam_7libcbcf_TabixIndex *__pyx_v_index = 0;
  int __pyx_v_rid;
  CYTHON_UNUSED int __pyx_v_cstart;
  CYTHON_UNUSED int __pyx_v_cstop;
  int __pyx_r;
  __Pyx_TraceDeclarationsFunc
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  PyObject *__pyx_t_4 = NULL;
  size_t __pyx_t_5;
  int __pyx_t_6;
  PyObject *__pyx_t_7 = NULL;
  PyObject *__pyx_t_8 = NULL;
  PyObject *__pyx_t_9 = NULL;
  int __pyx_t_10;
  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_TraceFrameInit(((PyObject *)__pyx_mstate_global->__pyx_codeobj_tab[359]))
  __Pyx_RefNannySetupContext("__init__", 0);
  __Pyx_TraceStartFunc("__init__", __pyx_f[0], 3939, 0, 0, 0, __PYX_ERR(0, 3939, __pyx_L1_error));

  /* "pysam/libcbcf.pyx":3940
 * 
 *     def __init__(self, VariantFile bcf, contig=None, start=None, stop=None, reopen=True):
 *         if bcf is None:             # <<<<<<<<<<<<<<
 *             raise ValueError('bcf must not be None')
 * 
*/
  __pyx_t_1 = (((PyObject *)__pyx_v_bcf) == Py_None);
  if (unlikely(__pyx_t_1)) {

    /* "pysam/libcbcf.pyx":3941
 *     def __init__(self, VariantFile bcf, contig=None, start=None, stop=None, reopen=True):
 *         if bcf is None:
 *             raise ValueError('bcf must not be None')             # <<<<<<<<<<<<<<
 * 
 *         if not isinstance(bcf.index, TabixIndex):
*/
    __pyx_t_3 = NULL;
    __Pyx_INCREF(__pyx_builtin_ValueError);
    __pyx_t_4 = __pyx_builtin_ValueError; 
    __pyx_t_5 = 1;
    {
      PyObject *__pyx_callargs[2] = {__pyx_t_3, __pyx_mstate_global->__pyx_kp_u_bcf_must_not_be_None};
      __pyx_t_2 = __Pyx_PyObject_FastCall(__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_2)) __PYX_ERR(0, 3941, __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, 3941, __pyx_L1_error)

    /* "pysam/libcbcf.pyx":3940
 * 
 *     def __init__(self, VariantFile bcf, contig=None, start=None, stop=None, reopen=True):
 *         if bcf is None:             # <<<<<<<<<<<<<<
 *             raise ValueError('bcf must not be None')
 * 
*/
  }

  /* "pysam/libcbcf.pyx":3943
 *             raise ValueError('bcf must not be None')
 * 
 *         if not isinstance(bcf.index, TabixIndex):             # <<<<<<<<<<<<<<
 *             raise ValueError('tabix index required')
 * 
*/
  __pyx_t_2 = ((PyObject *)__pyx_v_bcf->index);
  __Pyx_INCREF(__pyx_t_2);
  __pyx_t_1 = __Pyx_TypeCheck(__pyx_t_2, __pyx_mstate_global->__pyx_ptype_5pysam_7libcbcf_TabixIndex); 
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __pyx_t_6 = (!__pyx_t_1);
  if (unlikely(__pyx_t_6)) {

    /* "pysam/libcbcf.pyx":3944
 * 
 *         if not isinstance(bcf.index, TabixIndex):
 *             raise ValueError('tabix index required')             # <<<<<<<<<<<<<<
 * 
 *         cdef TabixIndex index = bcf.index
*/
    __pyx_t_4 = NULL;
    __Pyx_INCREF(__pyx_builtin_ValueError);
    __pyx_t_3 = __pyx_builtin_ValueError; 
    __pyx_t_5 = 1;
    {
      PyObject *__pyx_callargs[2] = {__pyx_t_4, __pyx_mstate_global->__pyx_kp_u_tabix_index_required};
      __pyx_t_2 = __Pyx_PyObject_FastCall(__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_2)) __PYX_ERR(0, 3944, __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, 3944, __pyx_L1_error)

    /* "pysam/libcbcf.pyx":3943
 *             raise ValueError('bcf must not be None')
 * 
 *         if not isinstance(bcf.index, TabixIndex):             # <<<<<<<<<<<<<<
 *             raise ValueError('tabix index required')
 * 
*/
  }

  /* "pysam/libcbcf.pyx":3946
 *             raise ValueError('tabix index required')
 * 
 *         cdef TabixIndex index = bcf.index             # <<<<<<<<<<<<<<
 * 
 *         self.bcf = bcf
*/
  __pyx_t_2 = ((PyObject *)__pyx_v_bcf->index);
  __Pyx_INCREF(__pyx_t_2);
  if (!(likely(((__pyx_t_2) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_2, __pyx_mstate_global->__pyx_ptype_5pysam_7libcbcf_TabixIndex))))) __PYX_ERR(0, 3946, __pyx_L1_error)
  __pyx_v_index = ((struct __pyx_obj_5pysam_7libcbcf_TabixIndex *)__pyx_t_2);
  __pyx_t_2 = 0;

  /* "pysam/libcbcf.pyx":3948
 *         cdef TabixIndex index = bcf.index
 * 
 *         self.bcf = bcf             # <<<<<<<<<<<<<<
 *         self.index = index
 * 
*/
  __Pyx_INCREF((PyObject *)__pyx_v_bcf);
  __Pyx_GIVEREF((PyObject *)__pyx_v_bcf);
  __Pyx_GOTREF((PyObject *)__pyx_v_self->__pyx_base.bcf);
  __Pyx_DECREF((PyObject *)__pyx_v_self->__pyx_base.bcf);
  __pyx_v_self->__pyx_base.bcf = __pyx_v_bcf;

  /* "pysam/libcbcf.pyx":3949
 * 
 *         self.bcf = bcf
 *         self.index = index             # <<<<<<<<<<<<<<
 * 
 *         cdef int rid, cstart, cstop
*/
  __Pyx_INCREF((PyObject *)__pyx_v_index);
  __Pyx_GIVEREF((PyObject *)__pyx_v_index);
  __Pyx_GOTREF((PyObject *)__pyx_v_self->index);
  __Pyx_DECREF((PyObject *)__pyx_v_self->index);
  __pyx_v_self->index = __pyx_v_index;

  /* "pysam/libcbcf.pyx":3953
 *         cdef int rid, cstart, cstop
 * 
 *         try:             # <<<<<<<<<<<<<<
 *             rid = index.refmap[contig]
 *         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:*/ {

      /* "pysam/libcbcf.pyx":3954
 * 
 *         try:
 *             rid = index.refmap[contig]             # <<<<<<<<<<<<<<
 *         except KeyError:
 *             # A query for a non-existent contig yields an empty iterator, does not raise an error
*/
      if (unlikely(__pyx_v_index->__pyx_base.refmap == Py_None)) {
        PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable");
        __PYX_ERR(0, 3954, __pyx_L5_error)
      }
      __pyx_t_2 = __Pyx_PyDict_GetItem(__pyx_v_index->__pyx_base.refmap, __pyx_v_contig); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 3954, __pyx_L5_error)
      __Pyx_GOTREF(__pyx_t_2);
      __pyx_t_10 = __Pyx_PyLong_As_int(__pyx_t_2); if (unlikely((__pyx_t_10 == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 3954, __pyx_L5_error)
      __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
      __pyx_v_rid = __pyx_t_10;

      /* "pysam/libcbcf.pyx":3953
 *         cdef int rid, cstart, cstop
 * 
 *         try:             # <<<<<<<<<<<<<<
 *             rid = index.refmap[contig]
 *         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_L10_try_end;
    __pyx_L5_error:;
    __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
    __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
    __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
    __Pyx_TraceException(__pyx_lineno, 0, 0);

    /* "pysam/libcbcf.pyx":3955
 *         try:
 *             rid = index.refmap[contig]
 *         except KeyError:             # <<<<<<<<<<<<<<
 *             # A query for a non-existent contig yields an empty iterator, does not raise an error
 *             self.iter = NULL
*/
    __pyx_t_10 = __Pyx_PyErr_ExceptionMatches(__pyx_builtin_KeyError);
    if (__pyx_t_10) {
      __Pyx_AddTraceback("pysam.libcbcf.TabixIterator.__init__", __pyx_clineno, __pyx_lineno, __pyx_filename);
      __Pyx_TraceExceptionHandled(0);
      if (__Pyx_GetException(&__pyx_t_2, &__pyx_t_3, &__pyx_t_4) < 0) __PYX_ERR(0, 3955, __pyx_L7_except_error)
      __Pyx_XGOTREF(__pyx_t_2);
      __Pyx_XGOTREF(__pyx_t_3);
      __Pyx_XGOTREF(__pyx_t_4);
      __Pyx_TraceExceptionDone();

      /* "pysam/libcbcf.pyx":3957
 *         except KeyError:
 *             # A query for a non-existent contig yields an empty iterator, does not raise an error
 *             self.iter = NULL             # <<<<<<<<<<<<<<
 *             return
 * 
*/
      __pyx_v_self->__pyx_base.iter = NULL;

      /* "pysam/libcbcf.pyx":3958
 *             # A query for a non-existent contig yields an empty iterator, does not raise an error
 *             self.iter = NULL
 *             return             # <<<<<<<<<<<<<<
 * 
 *         if reopen:
*/
      __pyx_r = 0;
      __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
      __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
      __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
      goto __pyx_L8_except_return;
    }
    goto __pyx_L7_except_error;

    /* "pysam/libcbcf.pyx":3953
 *         cdef int rid, cstart, cstop
 * 
 *         try:             # <<<<<<<<<<<<<<
 *             rid = index.refmap[contig]
 *         except KeyError:
*/
    __pyx_L7_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_L8_except_return:;
    __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_L0;
    __pyx_L10_try_end:;
  }

  /* "pysam/libcbcf.pyx":3960
 *             return
 * 
 *         if reopen:             # <<<<<<<<<<<<<<
 *             self.bcf = self.bcf.copy()
 * 
*/
  __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_v_reopen); if (unlikely((__pyx_t_6 < 0))) __PYX_ERR(0, 3960, __pyx_L1_error)
  if (__pyx_t_6) {

    /* "pysam/libcbcf.pyx":3961
 * 
 *         if reopen:
 *             self.bcf = self.bcf.copy()             # <<<<<<<<<<<<<<
 * 
 *         cstart = start if start is not None else 0
*/
    __pyx_t_3 = ((PyObject *)__pyx_v_self->__pyx_base.bcf);
    __Pyx_INCREF(__pyx_t_3);
    __pyx_t_5 = 0;
    {
      PyObject *__pyx_callargs[2] = {__pyx_t_3, NULL};
      __pyx_t_4 = __Pyx_PyObject_FastCallMethod(__pyx_mstate_global->__pyx_n_u_copy, __pyx_callargs+__pyx_t_5, (1-__pyx_t_5) | (1*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
      __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
      if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 3961, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_4);
    }
    if (!(likely(((__pyx_t_4) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_4, __pyx_mstate_global->__pyx_ptype_5pysam_7libcbcf_VariantFile))))) __PYX_ERR(0, 3961, __pyx_L1_error)
    __Pyx_GIVEREF(__pyx_t_4);
    __Pyx_GOTREF((PyObject *)__pyx_v_self->__pyx_base.bcf);
    __Pyx_DECREF((PyObject *)__pyx_v_self->__pyx_base.bcf);
    __pyx_v_self->__pyx_base.bcf = ((struct __pyx_obj_5pysam_7libcbcf_VariantFile *)__pyx_t_4);
    __pyx_t_4 = 0;

    /* "pysam/libcbcf.pyx":3960
 *             return
 * 
 *         if reopen:             # <<<<<<<<<<<<<<
 *             self.bcf = self.bcf.copy()
 * 
*/
  }

  /* "pysam/libcbcf.pyx":3963
 *             self.bcf = self.bcf.copy()
 * 
 *         cstart = start if start is not None else 0             # <<<<<<<<<<<<<<
 *         cstop  = stop  if stop  is not None else MAX_POS
 * 
*/
  __pyx_t_6 = (__pyx_v_start != Py_None);
  if (__pyx_t_6) {
    __pyx_t_11 = __Pyx_PyLong_As_int(__pyx_v_start); if (unlikely((__pyx_t_11 == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 3963, __pyx_L1_error)
    __pyx_t_10 = __pyx_t_11;
  } else {
    __pyx_t_10 = 0;
  }
  __pyx_v_cstart = __pyx_t_10;

  /* "pysam/libcbcf.pyx":3964
 * 
 *         cstart = start if start is not None else 0
 *         cstop  = stop  if stop  is not None else MAX_POS             # <<<<<<<<<<<<<<
 * 
 *         self.iter = tbx_itr_queryi(index.ptr, rid, start, stop)
*/
  __pyx_t_6 = (__pyx_v_stop != Py_None);
  if (__pyx_t_6) {
    __pyx_t_11 = __Pyx_PyLong_As_int(__pyx_v_stop); if (unlikely((__pyx_t_11 == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 3964, __pyx_L1_error)
    __pyx_t_10 = __pyx_t_11;
  } else {
    __pyx_t_10 = __pyx_v_5pysam_7libcbcf_MAX_POS;
  }
  __pyx_v_cstop = __pyx_t_10;

  /* "pysam/libcbcf.pyx":3966
 *         cstop  = stop  if stop  is not None else MAX_POS
 * 
 *         self.iter = tbx_itr_queryi(index.ptr, rid, start, stop)             # <<<<<<<<<<<<<<
 * 
 *         if not self.iter:
*/
  __pyx_t_10 = __Pyx_PyLong_As_int(__pyx_v_start); if (unlikely((__pyx_t_10 == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 3966, __pyx_L1_error)
  __pyx_t_11 = __Pyx_PyLong_As_int(__pyx_v_stop); if (unlikely((__pyx_t_11 == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 3966, __pyx_L1_error)
  __pyx_v_self->__pyx_base.iter = tbx_itr_queryi(__pyx_v_index->ptr, __pyx_v_rid, __pyx_t_10, __pyx_t_11);

  /* "pysam/libcbcf.pyx":3968
 *         self.iter = tbx_itr_queryi(index.ptr, rid, start, stop)
 * 
 *         if not self.iter:             # <<<<<<<<<<<<<<
 *             if errno:
 *                 raise IOError(errno, strerror(errno))
*/
  __pyx_t_6 = (!(__pyx_v_self->__pyx_base.iter != 0));
  if (__pyx_t_6) {

    /* "pysam/libcbcf.pyx":3969
 * 
 *         if not self.iter:
 *             if errno:             # <<<<<<<<<<<<<<
 *                 raise IOError(errno, strerror(errno))
 *             else:
*/
    __pyx_t_6 = (errno != 0);
    if (unlikely(__pyx_t_6)) {

      /* "pysam/libcbcf.pyx":3970
 *         if not self.iter:
 *             if errno:
 *                 raise IOError(errno, strerror(errno))             # <<<<<<<<<<<<<<
 *             else:
 *                 raise IOError('unable to fetch {}:{}-{}'.format(contig, start+1, stop))
*/
      __pyx_t_3 = NULL;
      __Pyx_INCREF(__pyx_builtin_IOError);
      __pyx_t_2 = __pyx_builtin_IOError; 
      __pyx_t_12 = __Pyx_PyLong_From_int(errno); if (unlikely(!__pyx_t_12)) __PYX_ERR(0, 3970, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_12);
      __pyx_t_13 = __Pyx_PyBytes_FromString(strerror(errno)); if (unlikely(!__pyx_t_13)) __PYX_ERR(0, 3970, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_13);
      __pyx_t_5 = 1;
      {
        PyObject *__pyx_callargs[3] = {__pyx_t_3, __pyx_t_12, __pyx_t_13};
        __pyx_t_4 = __Pyx_PyObject_FastCall(__pyx_t_2, __pyx_callargs+__pyx_t_5, (3-__pyx_t_5) | (__pyx_t_5*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
        __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
        __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0;
        __Pyx_DECREF(__pyx_t_13); __pyx_t_13 = 0;
        __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
        if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 3970, __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, 3970, __pyx_L1_error)

      /* "pysam/libcbcf.pyx":3969
 * 
 *         if not self.iter:
 *             if errno:             # <<<<<<<<<<<<<<
 *                 raise IOError(errno, strerror(errno))
 *             else:
*/
    }

    /* "pysam/libcbcf.pyx":3972
 *                 raise IOError(errno, strerror(errno))
 *             else:
 *                 raise IOError('unable to fetch {}:{}-{}'.format(contig, start+1, stop))             # <<<<<<<<<<<<<<
 * 
 *     def __dealloc__(self):
*/
    /*else*/ {
      __pyx_t_2 = NULL;
      __Pyx_INCREF(__pyx_builtin_IOError);
      __pyx_t_13 = __pyx_builtin_IOError; 
      __pyx_t_3 = __pyx_mstate_global->__pyx_kp_u_unable_to_fetch;
      __Pyx_INCREF(__pyx_t_3);
      __pyx_t_14 = __Pyx_PyLong_AddObjC(__pyx_v_start, __pyx_mstate_global->__pyx_int_1, 1, 0, 0); if (unlikely(!__pyx_t_14)) __PYX_ERR(0, 3972, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_14);
      __pyx_t_5 = 0;
      {
        PyObject *__pyx_callargs[4] = {__pyx_t_3, __pyx_v_contig, __pyx_t_14, __pyx_v_stop};
        __pyx_t_12 = __Pyx_PyObject_FastCallMethod(__pyx_mstate_global->__pyx_n_u_format, __pyx_callargs+__pyx_t_5, (4-__pyx_t_5) | (1*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
        __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
        __Pyx_DECREF(__pyx_t_14); __pyx_t_14 = 0;
        if (unlikely(!__pyx_t_12)) __PYX_ERR(0, 3972, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_12);
      }
      __pyx_t_5 = 1;
      {
        PyObject *__pyx_callargs[2] = {__pyx_t_2, __pyx_t_12};
        __pyx_t_4 = __Pyx_PyObject_FastCall(__pyx_t_13, __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_12); __pyx_t_12 = 0;
        __Pyx_DECREF(__pyx_t_13); __pyx_t_13 = 0;
        if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 3972, __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, 3972, __pyx_L1_error)
    }

    /* "pysam/libcbcf.pyx":3968
 *         self.iter = tbx_itr_queryi(index.ptr, rid, start, stop)
 * 
 *         if not self.iter:             # <<<<<<<<<<<<<<
 *             if errno:
 *                 raise IOError(errno, strerror(errno))
*/
  }

  /* "pysam/libcbcf.pyx":3939
 *         self.line_buffer.s = NULL
 * 
 *     def __init__(self, VariantFile bcf, contig=None, start=None, stop=None, reopen=True):             # <<<<<<<<<<<<<<
 *         if bcf is None:
 *             raise ValueError('bcf must not be None')
*/

  /* function exit code */
  __pyx_r = 0;
  __Pyx_TraceReturnCValue(__pyx_r, __Pyx_Owned_Py_None, 0, 0, __PYX_ERR(0, 3939, __pyx_L1_error));
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_XDECREF(__pyx_t_12);
  __Pyx_XDECREF(__pyx_t_13);
  __Pyx_XDECREF(__pyx_t_14);
  __Pyx_TraceException(__pyx_lineno, 0, 0);
  #if CYTHON_USE_SYS_MONITORING
  __Pyx_TraceExceptionUnwind(0, 0);
  #else
  __Pyx_TraceReturnValue(NULL, 0, 0, __PYX_ERR(0, 3939, __pyx_L1_error));
  #endif
  __Pyx_AddTraceback("pysam.libcbcf.TabixIterator.__init__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = -1;
  __pyx_L0:;
  __Pyx_XDECREF((PyObject *)__pyx_v_index);
  __Pyx_PyMonitoring_ExitScope(0);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "pysam/libcbcf.pyx":3974
 *                 raise IOError('unable to fetch {}:{}-{}'.format(contig, start+1, stop))
 * 
 *     def __dealloc__(self):             # <<<<<<<<<<<<<<
 *         if self.iter:
 *             tbx_itr_destroy(self.iter)
*/

/* Python wrapper */
static void __pyx_pw_5pysam_7libcbcf_13TabixIterator_5__dealloc__(PyObject *__pyx_v_self); /*proto*/
static void __pyx_pw_5pysam_7libcbcf_13TabixIterator_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_5pysam_7libcbcf_13TabixIterator_4__dealloc__(((struct __pyx_obj_5pysam_7libcbcf_TabixIterator *)__pyx_v_self));

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

static void __pyx_pf_5pysam_7libcbcf_13TabixIterator_4__dealloc__(struct __pyx_obj_5pysam_7libcbcf_TabixIterator *__pyx_v_self) {
  __Pyx_TraceDeclarationsFunc
  int __pyx_t_1;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_TraceFrameInit(((PyObject *)__pyx_mstate_global->__pyx_codeobj_tab[360]))
  __Pyx_TraceStartFunc("__dealloc__", __pyx_f[0], 3974, 0, 0, 0, __PYX_ERR(0, 3974, __pyx_L1_error));

  /* "pysam/libcbcf.pyx":3975
 * 
 *     def __dealloc__(self):
 *         if self.iter:             # <<<<<<<<<<<<<<
 *             tbx_itr_destroy(self.iter)
 *             self.iter = NULL
*/
  __pyx_t_1 = (__pyx_v_self->__pyx_base.iter != 0);
  if (__pyx_t_1) {

    /* "pysam/libcbcf.pyx":3976
 *     def __dealloc__(self):
 *         if self.iter:
 *             tbx_itr_destroy(self.iter)             # <<<<<<<<<<<<<<
 *             self.iter = NULL
 * 
*/
    tbx_itr_destroy(__pyx_v_self->__pyx_base.iter);

    /* "pysam/libcbcf.pyx":3977
 *         if self.iter:
 *             tbx_itr_destroy(self.iter)
 *             self.iter = NULL             # <<<<<<<<<<<<<<
 * 
 *         if self.line_buffer.m:
*/
    __pyx_v_self->__pyx_base.iter = NULL;

    /* "pysam/libcbcf.pyx":3975
 * 
 *     def __dealloc__(self):
 *         if self.iter:             # <<<<<<<<<<<<<<
 *             tbx_itr_destroy(self.iter)
 *             self.iter = NULL
*/
  }

  /* "pysam/libcbcf.pyx":3979
 *             self.iter = NULL
 * 
 *         if self.line_buffer.m:             # <<<<<<<<<<<<<<
 *             free(self.line_buffer.s)
 * 
*/
  __pyx_t_1 = (__pyx_v_self->line_buffer.m != 0);
  if (__pyx_t_1) {

    /* "pysam/libcbcf.pyx":3980
 * 
 *         if self.line_buffer.m:
 *             free(self.line_buffer.s)             # <<<<<<<<<<<<<<
 * 
 *         self.line_buffer.l = 0
*/
    free(__pyx_v_self->line_buffer.s);

    /* "pysam/libcbcf.pyx":3979
 *             self.iter = NULL
 * 
 *         if self.line_buffer.m:             # <<<<<<<<<<<<<<
 *             free(self.line_buffer.s)
 * 
*/
  }

  /* "pysam/libcbcf.pyx":3982
 *             free(self.line_buffer.s)
 * 
 *         self.line_buffer.l = 0             # <<<<<<<<<<<<<<
 *         self.line_buffer.m = 0
 *         self.line_buffer.s = NULL
*/
  __pyx_v_self->line_buffer.l = 0;

  /* "pysam/libcbcf.pyx":3983
 * 
 *         self.line_buffer.l = 0
 *         self.line_buffer.m = 0             # <<<<<<<<<<<<<<
 *         self.line_buffer.s = NULL
 * 
*/
  __pyx_v_self->line_buffer.m = 0;

  /* "pysam/libcbcf.pyx":3984
 *         self.line_buffer.l = 0
 *         self.line_buffer.m = 0
 *         self.line_buffer.s = NULL             # <<<<<<<<<<<<<<
 * 
 *     def __iter__(self):
*/
  __pyx_v_self->line_buffer.s = NULL;

  /* "pysam/libcbcf.pyx":3974
 *                 raise IOError('unable to fetch {}:{}-{}'.format(contig, start+1, stop))
 * 
 *     def __dealloc__(self):             # <<<<<<<<<<<<<<
 *         if self.iter:
 *             tbx_itr_destroy(self.iter)
*/

  /* function exit code */
  __Pyx_TraceReturnValue(Py_None, 0, 0, __PYX_ERR(0, 3974, __pyx_L1_error));
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_TraceException(__pyx_lineno, 0, 0);
  #if CYTHON_USE_SYS_MONITORING
  __Pyx_TraceExceptionUnwind(0, 0);
  #else
  __Pyx_TraceReturnValue(NULL, 0, 0, __PYX_ERR(0, 3974, __pyx_L1_error));
  #endif
  __Pyx_WriteUnraisable("pysam.libcbcf.TabixIterator.__dealloc__", __pyx_clineno, __pyx_lineno, __pyx_filename, 1, 0);
  __pyx_L0:;
  __Pyx_PyMonitoring_ExitScope(0);
}

/* "pysam/libcbcf.pyx":3986
 *         self.line_buffer.s = NULL
 * 
 *     def __iter__(self):             # <<<<<<<<<<<<<<
 *         return self
 * 
*/

/* Python wrapper */
static PyObject *__pyx_pw_5pysam_7libcbcf_13TabixIterator_7__iter__(PyObject *__pyx_v_self); /*proto*/
static PyObject *__pyx_pw_5pysam_7libcbcf_13TabixIterator_7__iter__(PyObject *__pyx_v_self) {
  CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__iter__ (wrapper)", 0);
  __pyx_kwvalues = __Pyx_KwValues_VARARGS(__pyx_args, __pyx_nargs);
  __pyx_r = __pyx_pf_5pysam_7libcbcf_13TabixIterator_6__iter__(((struct __pyx_obj_5pysam_7libcbcf_TabixIterator *)__pyx_v_self));

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

static PyObject *__pyx_pf_5pysam_7libcbcf_13TabixIterator_6__iter__(struct __pyx_obj_5pysam_7libcbcf_TabixIterator *__pyx_v_self) {
  PyObject *__pyx_r = NULL;
  __Pyx_TraceDeclarationsFunc
  __Pyx_RefNannyDeclarations
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_TraceFrameInit(((PyObject *)__pyx_mstate_global->__pyx_codeobj_tab[361]))
  __Pyx_RefNannySetupContext("__iter__", 0);
  __Pyx_TraceStartFunc("__iter__", __pyx_f[0], 3986, 0, 0, 0, __PYX_ERR(0, 3986, __pyx_L1_error));

  /* "pysam/libcbcf.pyx":3987
 * 
 *     def __iter__(self):
 *         return self             # <<<<<<<<<<<<<<
 * 
 *     def __next__(self):
*/
  __Pyx_XDECREF(__pyx_r);
  __Pyx_INCREF((PyObject *)__pyx_v_self);
  __pyx_r = ((PyObject *)__pyx_v_self);
  __Pyx_TraceReturnValue(__pyx_r, 1, 0, __PYX_ERR(0, 3987, __pyx_L1_error));
  goto __pyx_L0;

  /* "pysam/libcbcf.pyx":3986
 *         self.line_buffer.s = NULL
 * 
 *     def __iter__(self):             # <<<<<<<<<<<<<<
 *         return self
 * 
*/

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_TraceException(__pyx_lineno, 0, 0);
  #if CYTHON_USE_SYS_MONITORING
  __Pyx_TraceExceptionUnwind(0, 0);
  #else
  __Pyx_TraceReturnValue(NULL, 0, 0, __PYX_ERR(0, 3986, __pyx_L1_error));
  #endif
  __Pyx_AddTraceback("pysam.libcbcf.TabixIterator.__iter__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_PyMonitoring_ExitScope(0);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "pysam/libcbcf.pyx":3989
 *         return self
 * 
 *     def __next__(self):             # <<<<<<<<<<<<<<
 *         if not self.iter:
 *             raise StopIteration
*/

/* Python wrapper */
static PyObject *__pyx_pw_5pysam_7libcbcf_13TabixIterator_9__next__(PyObject *__pyx_v_self); /*proto*/
static PyObject *__pyx_pw_5pysam_7libcbcf_13TabixIterator_9__next__(PyObject *__pyx_v_self) {
  CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__next__ (wrapper)", 0);
  __pyx_kwvalues = __Pyx_KwValues_VARARGS(__pyx_args, __pyx_nargs);
  __pyx_r = __pyx_pf_5pysam_7libcbcf_13TabixIterator_8__next__(((struct __pyx_obj_5pysam_7libcbcf_TabixIterator *)__pyx_v_self));

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

static PyObject *__pyx_pf_5pysam_7libcbcf_13TabixIterator_8__next__(struct __pyx_obj_5pysam_7libcbcf_TabixIterator *__pyx_v_self) {
  int __pyx_v_ret;
  bcf1_t *__pyx_v_record;
  PyObject *__pyx_r = NULL;
  __Pyx_TraceDeclarationsFunc
  __Pyx_RefNannyDeclarations
  int __pyx_error_without_exception = 0; /* StopIteration */
  int __pyx_t_1;
  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;
  PyObject *__pyx_t_7 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_TraceFrameInit(((PyObject *)__pyx_mstate_global->__pyx_codeobj_tab[362]))
  __Pyx_RefNannySetupContext("__next__", 0);
  __Pyx_TraceStartFunc("__next__", __pyx_f[0], 3989, 0, 0, 0, __PYX_ERR(0, 3989, __pyx_L1_error));

  /* "pysam/libcbcf.pyx":3990
 * 
 *     def __next__(self):
 *         if not self.iter:             # <<<<<<<<<<<<<<
 *             raise StopIteration
 * 
*/
  __pyx_t_1 = (!(__pyx_v_self->__pyx_base.iter != 0));
  if (unlikely(__pyx_t_1)) {

    /* "pysam/libcbcf.pyx":3991
 *     def __next__(self):
 *         if not self.iter:
 *             raise StopIteration             # <<<<<<<<<<<<<<
 * 
 *         cdef int ret
*/
    __pyx_error_without_exception = 1;
    goto __pyx_L1_error;;

    /* "pysam/libcbcf.pyx":3990
 * 
 *     def __next__(self):
 *         if not self.iter:             # <<<<<<<<<<<<<<
 *             raise StopIteration
 * 
*/
  }

  /* "pysam/libcbcf.pyx":3995
 *         cdef int ret
 * 
 *         with nogil:             # <<<<<<<<<<<<<<
 *             ret = tbx_itr_next(self.bcf.htsfile, self.index.ptr, self.iter, &self.line_buffer)
 * 
*/
  {
      PyThreadState *_save;
      _save = NULL;
      Py_UNBLOCK_THREADS
      __Pyx_FastGIL_Remember();
      /*try:*/ {

        /* "pysam/libcbcf.pyx":3996
 * 
 *         with nogil:
 *             ret = tbx_itr_next(self.bcf.htsfile, self.index.ptr, self.iter, &self.line_buffer)             # <<<<<<<<<<<<<<
 * 
 *         if ret < 0:
*/
        __pyx_v_ret = tbx_itr_next(__pyx_v_self->__pyx_base.bcf->__pyx_base.htsfile, __pyx_v_self->index->ptr, __pyx_v_self->__pyx_base.iter, (&__pyx_v_self->line_buffer));
      }

      /* "pysam/libcbcf.pyx":3995
 *         cdef int ret
 * 
 *         with nogil:             # <<<<<<<<<<<<<<
 *             ret = tbx_itr_next(self.bcf.htsfile, self.index.ptr, self.iter, &self.line_buffer)
 * 
*/
      /*finally:*/ {
        /*normal exit:*/{
          __Pyx_FastGIL_Forget();
          Py_BLOCK_THREADS
          goto __pyx_L6;
        }
        __pyx_L6:;
      }
  }

  /* "pysam/libcbcf.pyx":3998
 *             ret = tbx_itr_next(self.bcf.htsfile, self.index.ptr, self.iter, &self.line_buffer)
 * 
 *         if ret < 0:             # <<<<<<<<<<<<<<
 *             tbx_itr_destroy(self.iter)
 *             self.iter = NULL
*/
  __pyx_t_1 = (__pyx_v_ret < 0);
  if (__pyx_t_1) {

    /* "pysam/libcbcf.pyx":3999
 * 
 *         if ret < 0:
 *             tbx_itr_destroy(self.iter)             # <<<<<<<<<<<<<<
 *             self.iter = NULL
 *             if ret == -1:
*/
    tbx_itr_destroy(__pyx_v_self->__pyx_base.iter);

    /* "pysam/libcbcf.pyx":4000
 *         if ret < 0:
 *             tbx_itr_destroy(self.iter)
 *             self.iter = NULL             # <<<<<<<<<<<<<<
 *             if ret == -1:
 *                 raise StopIteration
*/
    __pyx_v_self->__pyx_base.iter = NULL;

    /* "pysam/libcbcf.pyx":4001
 *             tbx_itr_destroy(self.iter)
 *             self.iter = NULL
 *             if ret == -1:             # <<<<<<<<<<<<<<
 *                 raise StopIteration
 *             elif ret == -2:
*/
    __pyx_t_1 = (__pyx_v_ret == -1L);
    if (unlikely(__pyx_t_1)) {

      /* "pysam/libcbcf.pyx":4002
 *             self.iter = NULL
 *             if ret == -1:
 *                 raise StopIteration             # <<<<<<<<<<<<<<
 *             elif ret == -2:
 *                 raise IOError('truncated file')
*/
      __pyx_error_without_exception = 1;
      goto __pyx_L1_error;;

      /* "pysam/libcbcf.pyx":4001
 *             tbx_itr_destroy(self.iter)
 *             self.iter = NULL
 *             if ret == -1:             # <<<<<<<<<<<<<<
 *                 raise StopIteration
 *             elif ret == -2:
*/
    }

    /* "pysam/libcbcf.pyx":4003
 *             if ret == -1:
 *                 raise StopIteration
 *             elif ret == -2:             # <<<<<<<<<<<<<<
 *                 raise IOError('truncated file')
 *             elif errno:
*/
    __pyx_t_1 = (__pyx_v_ret == -2L);
    if (unlikely(__pyx_t_1)) {

      /* "pysam/libcbcf.pyx":4004
 *                 raise StopIteration
 *             elif ret == -2:
 *                 raise IOError('truncated file')             # <<<<<<<<<<<<<<
 *             elif errno:
 *                 raise IOError(errno, strerror(errno))
*/
      __pyx_t_3 = NULL;
      __Pyx_INCREF(__pyx_builtin_IOError);
      __pyx_t_4 = __pyx_builtin_IOError; 
      __pyx_t_5 = 1;
      {
        PyObject *__pyx_callargs[2] = {__pyx_t_3, __pyx_mstate_global->__pyx_kp_u_truncated_file};
        __pyx_t_2 = __Pyx_PyObject_FastCall(__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_2)) __PYX_ERR(0, 4004, __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, 4004, __pyx_L1_error)

      /* "pysam/libcbcf.pyx":4003
 *             if ret == -1:
 *                 raise StopIteration
 *             elif ret == -2:             # <<<<<<<<<<<<<<
 *                 raise IOError('truncated file')
 *             elif errno:
*/
    }

    /* "pysam/libcbcf.pyx":4005
 *             elif ret == -2:
 *                 raise IOError('truncated file')
 *             elif errno:             # <<<<<<<<<<<<<<
 *                 raise IOError(errno, strerror(errno))
 *             else:
*/
    __pyx_t_1 = (errno != 0);
    if (unlikely(__pyx_t_1)) {

      /* "pysam/libcbcf.pyx":4006
 *                 raise IOError('truncated file')
 *             elif errno:
 *                 raise IOError(errno, strerror(errno))             # <<<<<<<<<<<<<<
 *             else:
 *                 raise IOError('unable to fetch next record')
*/
      __pyx_t_4 = NULL;
      __Pyx_INCREF(__pyx_builtin_IOError);
      __pyx_t_3 = __pyx_builtin_IOError; 
      __pyx_t_6 = __Pyx_PyLong_From_int(errno); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 4006, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_6);
      __pyx_t_7 = __Pyx_PyBytes_FromString(strerror(errno)); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 4006, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_7);
      __pyx_t_5 = 1;
      {
        PyObject *__pyx_callargs[3] = {__pyx_t_4, __pyx_t_6, __pyx_t_7};
        __pyx_t_2 = __Pyx_PyObject_FastCall(__pyx_t_3, __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;
        __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
        __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
        __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
        if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 4006, __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, 4006, __pyx_L1_error)

      /* "pysam/libcbcf.pyx":4005
 *             elif ret == -2:
 *                 raise IOError('truncated file')
 *             elif errno:             # <<<<<<<<<<<<<<
 *                 raise IOError(errno, strerror(errno))
 *             else:
*/
    }

    /* "pysam/libcbcf.pyx":4008
 *                 raise IOError(errno, strerror(errno))
 *             else:
 *                 raise IOError('unable to fetch next record')             # <<<<<<<<<<<<<<
 * 
 *         cdef bcf1_t *record = bcf_init1()
*/
    /*else*/ {
      __pyx_t_3 = NULL;
      __Pyx_INCREF(__pyx_builtin_IOError);
      __pyx_t_7 = __pyx_builtin_IOError; 
      __pyx_t_5 = 1;
      {
        PyObject *__pyx_callargs[2] = {__pyx_t_3, __pyx_mstate_global->__pyx_kp_u_unable_to_fetch_next_record};
        __pyx_t_2 = __Pyx_PyObject_FastCall(__pyx_t_7, __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_7); __pyx_t_7 = 0;
        if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 4008, __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, 4008, __pyx_L1_error)
    }

    /* "pysam/libcbcf.pyx":3998
 *             ret = tbx_itr_next(self.bcf.htsfile, self.index.ptr, self.iter, &self.line_buffer)
 * 
 *         if ret < 0:             # <<<<<<<<<<<<<<
 *             tbx_itr_destroy(self.iter)
 *             self.iter = NULL
*/
  }

  /* "pysam/libcbcf.pyx":4010
 *                 raise IOError('unable to fetch next record')
 * 
 *         cdef bcf1_t *record = bcf_init1()             # <<<<<<<<<<<<<<
 * 
 *         if not record:
*/
  __pyx_v_record = bcf_init1();

  /* "pysam/libcbcf.pyx":4012
 *         cdef bcf1_t *record = bcf_init1()
 * 
 *         if not record:             # <<<<<<<<<<<<<<
 *             raise MemoryError('unable to allocate BCF record')
 * 
*/
  __pyx_t_1 = (!(__pyx_v_record != 0));
  if (unlikely(__pyx_t_1)) {

    /* "pysam/libcbcf.pyx":4013
 * 
 *         if not record:
 *             raise MemoryError('unable to allocate BCF record')             # <<<<<<<<<<<<<<
 * 
 *         record.pos = -1
*/
    __pyx_t_7 = NULL;
    __Pyx_INCREF(__pyx_builtin_MemoryError);
    __pyx_t_3 = __pyx_builtin_MemoryError; 
    __pyx_t_5 = 1;
    {
      PyObject *__pyx_callargs[2] = {__pyx_t_7, __pyx_mstate_global->__pyx_kp_u_unable_to_allocate_BCF_record};
      __pyx_t_2 = __Pyx_PyObject_FastCall(__pyx_t_3, __pyx_callargs+__pyx_t_5, (2-__pyx_t_5) | (__pyx_t_5*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
      __Pyx_XDECREF(__pyx_t_7); __pyx_t_7 = 0;
      __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
      if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 4013, __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, 4013, __pyx_L1_error)

    /* "pysam/libcbcf.pyx":4012
 *         cdef bcf1_t *record = bcf_init1()
 * 
 *         if not record:             # <<<<<<<<<<<<<<
 *             raise MemoryError('unable to allocate BCF record')
 * 
*/
  }

  /* "pysam/libcbcf.pyx":4015
 *             raise MemoryError('unable to allocate BCF record')
 * 
 *         record.pos = -1             # <<<<<<<<<<<<<<
 *         if self.bcf.drop_samples:
 *             record.max_unpack = BCF_UN_SHR
*/
  __pyx_v_record->pos = -1;

  /* "pysam/libcbcf.pyx":4016
 * 
 *         record.pos = -1
 *         if self.bcf.drop_samples:             # <<<<<<<<<<<<<<
 *             record.max_unpack = BCF_UN_SHR
 * 
*/
  if (__pyx_v_self->__pyx_base.bcf->drop_samples) {

    /* "pysam/libcbcf.pyx":4017
 *         record.pos = -1
 *         if self.bcf.drop_samples:
 *             record.max_unpack = BCF_UN_SHR             # <<<<<<<<<<<<<<
 * 
 *         ret = vcf_parse1(&self.line_buffer, self.bcf.header.ptr, record)
*/
    __pyx_v_record->max_unpack = BCF_UN_SHR;

    /* "pysam/libcbcf.pyx":4016
 * 
 *         record.pos = -1
 *         if self.bcf.drop_samples:             # <<<<<<<<<<<<<<
 *             record.max_unpack = BCF_UN_SHR
 * 
*/
  }

  /* "pysam/libcbcf.pyx":4019
 *             record.max_unpack = BCF_UN_SHR
 * 
 *         ret = vcf_parse1(&self.line_buffer, self.bcf.header.ptr, record)             # <<<<<<<<<<<<<<
 * 
 *         # FIXME: stop iteration on parse failure?
*/
  __pyx_v_ret = vcf_parse1((&__pyx_v_self->line_buffer), __pyx_v_self->__pyx_base.bcf->header->ptr, __pyx_v_record);

  /* "pysam/libcbcf.pyx":4022
 * 
 *         # FIXME: stop iteration on parse failure?
 *         if ret < 0:             # <<<<<<<<<<<<<<
 *             bcf_destroy1(record)
 *             raise ValueError('error in vcf_parse')
*/
  __pyx_t_1 = (__pyx_v_ret < 0);
  if (unlikely(__pyx_t_1)) {

    /* "pysam/libcbcf.pyx":4023
 *         # FIXME: stop iteration on parse failure?
 *         if ret < 0:
 *             bcf_destroy1(record)             # <<<<<<<<<<<<<<
 *             raise ValueError('error in vcf_parse')
 * 
*/
    bcf_destroy1(__pyx_v_record);

    /* "pysam/libcbcf.pyx":4024
 *         if ret < 0:
 *             bcf_destroy1(record)
 *             raise ValueError('error in vcf_parse')             # <<<<<<<<<<<<<<
 * 
 *         return makeVariantRecord(self.bcf.header, record)
*/
    __pyx_t_3 = NULL;
    __Pyx_INCREF(__pyx_builtin_ValueError);
    __pyx_t_7 = __pyx_builtin_ValueError; 
    __pyx_t_5 = 1;
    {
      PyObject *__pyx_callargs[2] = {__pyx_t_3, __pyx_mstate_global->__pyx_kp_u_error_in_vcf_parse};
      __pyx_t_2 = __Pyx_PyObject_FastCall(__pyx_t_7, __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_7); __pyx_t_7 = 0;
      if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 4024, __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, 4024, __pyx_L1_error)

    /* "pysam/libcbcf.pyx":4022
 * 
 *         # FIXME: stop iteration on parse failure?
 *         if ret < 0:             # <<<<<<<<<<<<<<
 *             bcf_destroy1(record)
 *             raise ValueError('error in vcf_parse')
*/
  }

  /* "pysam/libcbcf.pyx":4026
 *             raise ValueError('error in vcf_parse')
 * 
 *         return makeVariantRecord(self.bcf.header, record)             # <<<<<<<<<<<<<<
 * 
 * 
*/
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_2 = ((PyObject *)__pyx_v_self->__pyx_base.bcf->header);
  __Pyx_INCREF(__pyx_t_2);
  __pyx_t_7 = ((PyObject *)__pyx_f_5pysam_7libcbcf_makeVariantRecord(((struct __pyx_obj_5pysam_7libcbcf_VariantHeader *)__pyx_t_2), __pyx_v_record)); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 4026, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_7);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __pyx_r = __pyx_t_7;
  __pyx_t_7 = 0;
  __Pyx_TraceReturnValue(__pyx_r, 98, 0, __PYX_ERR(0, 4026, __pyx_L1_error));
  goto __pyx_L0;

  /* "pysam/libcbcf.pyx":3989
 *         return self
 * 
 *     def __next__(self):             # <<<<<<<<<<<<<<
 *         if not self.iter:
 *             raise StopIteration
*/

  /* 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_6);
  __Pyx_XDECREF(__pyx_t_7);
  __Pyx_TraceException(__pyx_lineno, 0, 0);
  #if CYTHON_USE_SYS_MONITORING
  __Pyx_TraceExceptionUnwind(0, 0);
  #else
  __Pyx_TraceReturnValue(NULL, 0, 0, __PYX_ERR(0, 3989, __pyx_L1_error));
  #endif
  if (!__pyx_error_without_exception) {
    __Pyx_AddTraceback("pysam.libcbcf.TabixIterator.__next__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  }
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_PyMonitoring_ExitScope(0);
  __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_5pysam_7libcbcf_13TabixIterator_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*/
PyDoc_STRVAR(__pyx_doc_5pysam_7libcbcf_13TabixIterator_10__reduce_cython__, "TabixIterator.__reduce_cython__(self)");
static PyMethodDef __pyx_mdef_5pysam_7libcbcf_13TabixIterator_11__reduce_cython__ = {"__reduce_cython__", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_5pysam_7libcbcf_13TabixIterator_11__reduce_cython__, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_5pysam_7libcbcf_13TabixIterator_10__reduce_cython__};
static PyObject *__pyx_pw_5pysam_7libcbcf_13TabixIterator_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_5pysam_7libcbcf_13TabixIterator_10__reduce_cython__(((struct __pyx_obj_5pysam_7libcbcf_TabixIterator *)__pyx_v_self));

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

static PyObject *__pyx_pf_5pysam_7libcbcf_13TabixIterator_10__reduce_cython__(CYTHON_UNUSED struct __pyx_obj_5pysam_7libcbcf_TabixIterator *__pyx_v_self) {
  PyObject *__pyx_r = NULL;
  __Pyx_TraceDeclarationsFunc
  __Pyx_RefNannyDeclarations
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_TraceFrameInit(((PyObject *)__pyx_mstate_global->__pyx_codeobj_tab[363]))
  __Pyx_RefNannySetupContext("__reduce_cython__", 0);
  __Pyx_TraceStartFunc("__reduce_cython__", __pyx_f[4], 1, 0, 0, 0, __PYX_ERR(4, 1, __pyx_L1_error));

  /* "(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(__pyx_builtin_TypeError, __pyx_mstate_global->__pyx_kp_u_no_default___reduce___due_to_non, 0, 0);
  __PYX_ERR(4, 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_TraceException(__pyx_lineno, 0, 0);
  #if CYTHON_USE_SYS_MONITORING
  __Pyx_TraceExceptionUnwind(0, 0);
  #else
  __Pyx_TraceReturnValue(NULL, 0, 0, __PYX_ERR(4, 1, __pyx_L1_error));
  #endif
  __Pyx_AddTraceback("pysam.libcbcf.TabixIterator.__reduce_cython__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_PyMonitoring_ExitScope(0);
  __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_5pysam_7libcbcf_13TabixIterator_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*/
PyDoc_STRVAR(__pyx_doc_5pysam_7libcbcf_13TabixIterator_12__setstate_cython__, "TabixIterator.__setstate_cython__(self, __pyx_state)");
static PyMethodDef __pyx_mdef_5pysam_7libcbcf_13TabixIterator_13__setstate_cython__ = {"__setstate_cython__", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_5pysam_7libcbcf_13TabixIterator_13__setstate_cython__, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_5pysam_7libcbcf_13TabixIterator_12__setstate_cython__};
static PyObject *__pyx_pw_5pysam_7libcbcf_13TabixIterator_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(4, 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(4, 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(4, 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(4, 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(4, 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(4, 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("pysam.libcbcf.TabixIterator.__setstate_cython__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_5pysam_7libcbcf_13TabixIterator_12__setstate_cython__(((struct __pyx_obj_5pysam_7libcbcf_TabixIterator *)__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_5pysam_7libcbcf_13TabixIterator_12__setstate_cython__(CYTHON_UNUSED struct __pyx_obj_5pysam_7libcbcf_TabixIterator *__pyx_v_self, CYTHON_UNUSED PyObject *__pyx_v___pyx_state) {
  PyObject *__pyx_r = NULL;
  __Pyx_TraceDeclarationsFunc
  __Pyx_RefNannyDeclarations
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_TraceFrameInit(((PyObject *)__pyx_mstate_global->__pyx_codeobj_tab[364]))
  __Pyx_RefNannySetupContext("__setstate_cython__", 0);
  __Pyx_TraceStartFunc("__setstate_cython__", __pyx_f[4], 3, 0, 0, 0, __PYX_ERR(4, 3, __pyx_L1_error));

  /* "(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(__pyx_builtin_TypeError, __pyx_mstate_global->__pyx_kp_u_no_default___reduce___due_to_non, 0, 0);
  __PYX_ERR(4, 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_TraceException(__pyx_lineno, 0, 0);
  #if CYTHON_USE_SYS_MONITORING
  __Pyx_TraceExceptionUnwind(0, 0);
  #else
  __Pyx_TraceReturnValue(NULL, 0, 0, __PYX_ERR(4, 3, __pyx_L1_error));
  #endif
  __Pyx_AddTraceback("pysam.libcbcf.TabixIterator.__setstate_cython__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_PyMonitoring_ExitScope(0);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "pysam/libcbcf.pyx":4098
 * 
 *     """
 *     def __cinit__(self, *args, **kwargs):             # <<<<<<<<<<<<<<
 *         self.htsfile = NULL
 * 
*/

/* Python wrapper */
static int __pyx_pw_5pysam_7libcbcf_11VariantFile_1__cinit__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static int __pyx_pw_5pysam_7libcbcf_11VariantFile_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_5pysam_7libcbcf_11VariantFile___cinit__(((struct __pyx_obj_5pysam_7libcbcf_VariantFile *)__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_5pysam_7libcbcf_11VariantFile___cinit__(struct __pyx_obj_5pysam_7libcbcf_VariantFile *__pyx_v_self, CYTHON_UNUSED PyObject *__pyx_v_args, CYTHON_UNUSED PyObject *__pyx_v_kwargs) {
  int __pyx_r;
  __Pyx_TraceDeclarationsFunc
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_TraceFrameInit(((PyObject *)__pyx_mstate_global->__pyx_codeobj_tab[365]))
  __Pyx_TraceStartFunc("__cinit__", __pyx_f[0], 4098, 0, 0, 0, __PYX_ERR(0, 4098, __pyx_L1_error));

  /* "pysam/libcbcf.pyx":4099
 *     """
 *     def __cinit__(self, *args, **kwargs):
 *         self.htsfile = NULL             # <<<<<<<<<<<<<<
 * 
 *     def __init__(self, *args, **kwargs):
*/
  __pyx_v_self->__pyx_base.htsfile = NULL;

  /* "pysam/libcbcf.pyx":4098
 * 
 *     """
 *     def __cinit__(self, *args, **kwargs):             # <<<<<<<<<<<<<<
 *         self.htsfile = NULL
 * 
*/

  /* function exit code */
  __pyx_r = 0;
  __Pyx_TraceReturnCValue(__pyx_r, __Pyx_Owned_Py_None, 0, 0, __PYX_ERR(0, 4098, __pyx_L1_error));
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_TraceException(__pyx_lineno, 0, 0);
  #if CYTHON_USE_SYS_MONITORING
  __Pyx_TraceExceptionUnwind(0, 0);
  #else
  __Pyx_TraceReturnValue(NULL, 0, 0, __PYX_ERR(0, 4098, __pyx_L1_error));
  #endif
  __Pyx_AddTraceback("pysam.libcbcf.VariantFile.__cinit__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = -1;
  __pyx_L0:;
  __Pyx_PyMonitoring_ExitScope(0);
  return __pyx_r;
}

/* "pysam/libcbcf.pyx":4101
 *         self.htsfile = NULL
 * 
 *     def __init__(self, *args, **kwargs):             # <<<<<<<<<<<<<<
 *         self.header         = None
 *         self.index          = None
*/

/* Python wrapper */
static int __pyx_pw_5pysam_7libcbcf_11VariantFile_3__init__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static int __pyx_pw_5pysam_7libcbcf_11VariantFile_3__init__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_args = 0;
  PyObject *__pyx_v_kwargs = 0;
  CYTHON_UNUSED Py_ssize_t __pyx_nargs;
  CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__init__ (wrapper)", 0);
  #if CYTHON_ASSUME_SAFE_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("__init__", __pyx_kwds) == -1)) return -1;
    __pyx_v_kwargs = __Pyx_KwargsAsDict_VARARGS(__pyx_kwds, __pyx_kwvalues);
    if (unlikely(!__pyx_v_kwargs)) return -1;
    __Pyx_GOTREF(__pyx_v_kwargs);
  } else {
    __pyx_v_kwargs = PyDict_New();
    if (unlikely(!__pyx_v_kwargs)) return -1;
    __Pyx_GOTREF(__pyx_v_kwargs);
  }
  __Pyx_INCREF(__pyx_args);
  __pyx_v_args = __pyx_args;
  __pyx_r = __pyx_pf_5pysam_7libcbcf_11VariantFile_2__init__(((struct __pyx_obj_5pysam_7libcbcf_VariantFile *)__pyx_v_self), __pyx_v_args, __pyx_v_kwargs);

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

static int __pyx_pf_5pysam_7libcbcf_11VariantFile_2__init__(struct __pyx_obj_5pysam_7libcbcf_VariantFile *__pyx_v_self, PyObject *__pyx_v_args, PyObject *__pyx_v_kwargs) {
  int __pyx_r;
  __Pyx_TraceDeclarationsFunc
  __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_TraceFrameInit(((PyObject *)__pyx_mstate_global->__pyx_codeobj_tab[366]))
  __Pyx_RefNannySetupContext("__init__", 0);
  __Pyx_TraceStartFunc("__init__", __pyx_f[0], 4101, 0, 0, 0, __PYX_ERR(0, 4101, __pyx_L1_error));

  /* "pysam/libcbcf.pyx":4102
 * 
 *     def __init__(self, *args, **kwargs):
 *         self.header         = None             # <<<<<<<<<<<<<<
 *         self.index          = None
 *         self.filename       = None
*/
  __Pyx_INCREF(Py_None);
  __Pyx_GIVEREF(Py_None);
  __Pyx_GOTREF((PyObject *)__pyx_v_self->header);
  __Pyx_DECREF((PyObject *)__pyx_v_self->header);
  __pyx_v_self->header = ((struct __pyx_obj_5pysam_7libcbcf_VariantHeader *)Py_None);

  /* "pysam/libcbcf.pyx":4103
 *     def __init__(self, *args, **kwargs):
 *         self.header         = None
 *         self.index          = None             # <<<<<<<<<<<<<<
 *         self.filename       = None
 *         self.mode           = None
*/
  __Pyx_INCREF(Py_None);
  __Pyx_GIVEREF(Py_None);
  __Pyx_GOTREF((PyObject *)__pyx_v_self->index);
  __Pyx_DECREF((PyObject *)__pyx_v_self->index);
  __pyx_v_self->index = ((struct __pyx_obj_5pysam_7libcbcf_BaseIndex *)Py_None);

  /* "pysam/libcbcf.pyx":4104
 *         self.header         = None
 *         self.index          = None
 *         self.filename       = None             # <<<<<<<<<<<<<<
 *         self.mode           = None
 *         self.threads        = 1
*/
  __Pyx_INCREF(Py_None);
  __Pyx_GIVEREF(Py_None);
  __Pyx_GOTREF(__pyx_v_self->__pyx_base.filename);
  __Pyx_DECREF(__pyx_v_self->__pyx_base.filename);
  __pyx_v_self->__pyx_base.filename = Py_None;

  /* "pysam/libcbcf.pyx":4105
 *         self.index          = None
 *         self.filename       = None
 *         self.mode           = None             # <<<<<<<<<<<<<<
 *         self.threads        = 1
 *         self.index_filename = None
*/
  __Pyx_INCREF(Py_None);
  __Pyx_GIVEREF(Py_None);
  __Pyx_GOTREF(__pyx_v_self->__pyx_base.mode);
  __Pyx_DECREF(__pyx_v_self->__pyx_base.mode);
  __pyx_v_self->__pyx_base.mode = Py_None;

  /* "pysam/libcbcf.pyx":4106
 *         self.filename       = None
 *         self.mode           = None
 *         self.threads        = 1             # <<<<<<<<<<<<<<
 *         self.index_filename = None
 *         self.is_stream      = False
*/
  __Pyx_INCREF(__pyx_mstate_global->__pyx_int_1);
  __Pyx_GIVEREF(__pyx_mstate_global->__pyx_int_1);
  __Pyx_GOTREF(__pyx_v_self->__pyx_base.threads);
  __Pyx_DECREF(__pyx_v_self->__pyx_base.threads);
  __pyx_v_self->__pyx_base.threads = __pyx_mstate_global->__pyx_int_1;

  /* "pysam/libcbcf.pyx":4107
 *         self.mode           = None
 *         self.threads        = 1
 *         self.index_filename = None             # <<<<<<<<<<<<<<
 *         self.is_stream      = False
 *         self.is_remote      = False
*/
  __Pyx_INCREF(Py_None);
  __Pyx_GIVEREF(Py_None);
  __Pyx_GOTREF(__pyx_v_self->__pyx_base.index_filename);
  __Pyx_DECREF(__pyx_v_self->__pyx_base.index_filename);
  __pyx_v_self->__pyx_base.index_filename = Py_None;

  /* "pysam/libcbcf.pyx":4108
 *         self.threads        = 1
 *         self.index_filename = None
 *         self.is_stream      = False             # <<<<<<<<<<<<<<
 *         self.is_remote      = False
 *         self.is_reading     = False
*/
  __pyx_v_self->__pyx_base.is_stream = 0;

  /* "pysam/libcbcf.pyx":4109
 *         self.index_filename = None
 *         self.is_stream      = False
 *         self.is_remote      = False             # <<<<<<<<<<<<<<
 *         self.is_reading     = False
 *         self.drop_samples   = False
*/
  __pyx_v_self->__pyx_base.is_remote = 0;

  /* "pysam/libcbcf.pyx":4110
 *         self.is_stream      = False
 *         self.is_remote      = False
 *         self.is_reading     = False             # <<<<<<<<<<<<<<
 *         self.drop_samples   = False
 *         self.header_written = False
*/
  __pyx_v_self->is_reading = 0;

  /* "pysam/libcbcf.pyx":4111
 *         self.is_remote      = False
 *         self.is_reading     = False
 *         self.drop_samples   = False             # <<<<<<<<<<<<<<
 *         self.header_written = False
 *         self.start_offset   = -1
*/
  __pyx_v_self->drop_samples = 0;

  /* "pysam/libcbcf.pyx":4112
 *         self.is_reading     = False
 *         self.drop_samples   = False
 *         self.header_written = False             # <<<<<<<<<<<<<<
 *         self.start_offset   = -1
 * 
*/
  __pyx_v_self->header_written = 0;

  /* "pysam/libcbcf.pyx":4113
 *         self.drop_samples   = False
 *         self.header_written = False
 *         self.start_offset   = -1             # <<<<<<<<<<<<<<
 * 
 *         self.open(*args, **kwargs)
*/
  __pyx_v_self->__pyx_base.start_offset = -1L;

  /* "pysam/libcbcf.pyx":4115
 *         self.start_offset   = -1
 * 
 *         self.open(*args, **kwargs)             # <<<<<<<<<<<<<<
 * 
 *     def __dealloc__(self):
*/
  __pyx_t_1 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_mstate_global->__pyx_n_u_open); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 4115, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_2 = PyDict_Copy(__pyx_v_kwargs); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 4115, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_3 = __Pyx_PyObject_Call(__pyx_t_1, __pyx_v_args, __pyx_t_2); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 4115, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;

  /* "pysam/libcbcf.pyx":4101
 *         self.htsfile = NULL
 * 
 *     def __init__(self, *args, **kwargs):             # <<<<<<<<<<<<<<
 *         self.header         = None
 *         self.index          = None
*/

  /* function exit code */
  __pyx_r = 0;
  __Pyx_TraceReturnCValue(__pyx_r, __Pyx_Owned_Py_None, 0, 0, __PYX_ERR(0, 4101, __pyx_L1_error));
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_TraceException(__pyx_lineno, 0, 0);
  #if CYTHON_USE_SYS_MONITORING
  __Pyx_TraceExceptionUnwind(0, 0);
  #else
  __Pyx_TraceReturnValue(NULL, 0, 0, __PYX_ERR(0, 4101, __pyx_L1_error));
  #endif
  __Pyx_AddTraceback("pysam.libcbcf.VariantFile.__init__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = -1;
  __pyx_L0:;
  __Pyx_PyMonitoring_ExitScope(0);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "pysam/libcbcf.pyx":4117
 *         self.open(*args, **kwargs)
 * 
 *     def __dealloc__(self):             # <<<<<<<<<<<<<<
 *         if not self.htsfile or not self.header:
 *             return
*/

/* Python wrapper */
static void __pyx_pw_5pysam_7libcbcf_11VariantFile_5__dealloc__(PyObject *__pyx_v_self); /*proto*/
static void __pyx_pw_5pysam_7libcbcf_11VariantFile_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_5pysam_7libcbcf_11VariantFile_4__dealloc__(((struct __pyx_obj_5pysam_7libcbcf_VariantFile *)__pyx_v_self));

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

static void __pyx_pf_5pysam_7libcbcf_11VariantFile_4__dealloc__(struct __pyx_obj_5pysam_7libcbcf_VariantFile *__pyx_v_self) {
  int __pyx_v_ret;
  __Pyx_TraceDeclarationsFunc
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  int __pyx_t_2;
  int __pyx_t_3;
  PyObject *__pyx_t_4 = NULL;
  PyObject *__pyx_t_5 = NULL;
  struct __pyx_opt_args_5pysam_9libcutils_OSError_from_errno __pyx_t_6;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_TraceFrameInit(((PyObject *)__pyx_mstate_global->__pyx_codeobj_tab[367]))
  __Pyx_RefNannySetupContext("__dealloc__", 0);
  __Pyx_TraceStartFunc("__dealloc__", __pyx_f[0], 4117, 0, 0, 0, __PYX_ERR(0, 4117, __pyx_L1_error));

  /* "pysam/libcbcf.pyx":4118
 * 
 *     def __dealloc__(self):
 *         if not self.htsfile or not self.header:             # <<<<<<<<<<<<<<
 *             return
 * 
*/
  __pyx_t_2 = (!(__pyx_v_self->__pyx_base.htsfile != 0));
  if (!__pyx_t_2) {
  } else {
    __pyx_t_1 = __pyx_t_2;
    goto __pyx_L4_bool_binop_done;
  }
  __pyx_t_2 = __Pyx_PyObject_IsTrue(((PyObject *)__pyx_v_self->header)); if (unlikely((__pyx_t_2 < 0))) __PYX_ERR(0, 4118, __pyx_L1_error)
  __pyx_t_3 = (!__pyx_t_2);
  __pyx_t_1 = __pyx_t_3;
  __pyx_L4_bool_binop_done:;
  if (__pyx_t_1) {

    /* "pysam/libcbcf.pyx":4119
 *     def __dealloc__(self):
 *         if not self.htsfile or not self.header:
 *             return             # <<<<<<<<<<<<<<
 * 
 *         cdef int ret
*/
    goto __pyx_L0;

    /* "pysam/libcbcf.pyx":4118
 * 
 *     def __dealloc__(self):
 *         if not self.htsfile or not self.header:             # <<<<<<<<<<<<<<
 *             return
 * 
*/
  }

  /* "pysam/libcbcf.pyx":4124
 * 
 *         # Write header if no records were written
 *         if self.htsfile.is_write and not self.header_written:             # <<<<<<<<<<<<<<
 *             with nogil:
 *                 ret = bcf_hdr_write(self.htsfile, self.header.ptr)
*/
  __pyx_t_3 = (__pyx_v_self->__pyx_base.htsfile->is_write != 0);
  if (__pyx_t_3) {
  } else {
    __pyx_t_1 = __pyx_t_3;
    goto __pyx_L7_bool_binop_done;
  }
  __pyx_t_3 = (!__pyx_v_self->header_written);
  __pyx_t_1 = __pyx_t_3;
  __pyx_L7_bool_binop_done:;
  if (__pyx_t_1) {

    /* "pysam/libcbcf.pyx":4125
 *         # Write header if no records were written
 *         if self.htsfile.is_write and not self.header_written:
 *             with nogil:             # <<<<<<<<<<<<<<
 *                 ret = bcf_hdr_write(self.htsfile, self.header.ptr)
 *             if ret < 0 and errno != EPIPE:
*/
    {
        PyThreadState *_save;
        _save = NULL;
        Py_UNBLOCK_THREADS
        __Pyx_FastGIL_Remember();
        /*try:*/ {

          /* "pysam/libcbcf.pyx":4126
 *         if self.htsfile.is_write and not self.header_written:
 *             with nogil:
 *                 ret = bcf_hdr_write(self.htsfile, self.header.ptr)             # <<<<<<<<<<<<<<
 *             if ret < 0 and errno != EPIPE:
 *                 raise OSError_from_errno("Can't write headers", self.filename)
*/
          __pyx_v_ret = bcf_hdr_write(__pyx_v_self->__pyx_base.htsfile, __pyx_v_self->header->ptr);
        }

        /* "pysam/libcbcf.pyx":4125
 *         # Write header if no records were written
 *         if self.htsfile.is_write and not self.header_written:
 *             with nogil:             # <<<<<<<<<<<<<<
 *                 ret = bcf_hdr_write(self.htsfile, self.header.ptr)
 *             if ret < 0 and errno != EPIPE:
*/
        /*finally:*/ {
          /*normal exit:*/{
            __Pyx_FastGIL_Forget();
            Py_BLOCK_THREADS
            goto __pyx_L11;
          }
          __pyx_L11:;
        }
    }

    /* "pysam/libcbcf.pyx":4127
 *             with nogil:
 *                 ret = bcf_hdr_write(self.htsfile, self.header.ptr)
 *             if ret < 0 and errno != EPIPE:             # <<<<<<<<<<<<<<
 *                 raise OSError_from_errno("Can't write headers", self.filename)
 * 
*/
    __pyx_t_3 = (__pyx_v_ret < 0);
    if (__pyx_t_3) {
    } else {
      __pyx_t_1 = __pyx_t_3;
      goto __pyx_L13_bool_binop_done;
    }
    __pyx_t_3 = (errno != EPIPE);
    __pyx_t_1 = __pyx_t_3;
    __pyx_L13_bool_binop_done:;
    if (unlikely(__pyx_t_1)) {

      /* "pysam/libcbcf.pyx":4128
 *                 ret = bcf_hdr_write(self.htsfile, self.header.ptr)
 *             if ret < 0 and errno != EPIPE:
 *                 raise OSError_from_errno("Can't write headers", self.filename)             # <<<<<<<<<<<<<<
 * 
 *         ret = hts_close(self.htsfile)
*/
      __pyx_t_4 = __pyx_v_self->__pyx_base.filename;
      __Pyx_INCREF(__pyx_t_4);
      __pyx_t_6.__pyx_n = 1;
      __pyx_t_6.filename = __pyx_t_4;
      __pyx_t_5 = __pyx_f_5pysam_9libcutils_OSError_from_errno(__pyx_mstate_global->__pyx_kp_u_Can_t_write_headers, &__pyx_t_6); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 4128, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_5);
      __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
      __Pyx_Raise(__pyx_t_5, 0, 0, 0);
      __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
      __PYX_ERR(0, 4128, __pyx_L1_error)

      /* "pysam/libcbcf.pyx":4127
 *             with nogil:
 *                 ret = bcf_hdr_write(self.htsfile, self.header.ptr)
 *             if ret < 0 and errno != EPIPE:             # <<<<<<<<<<<<<<
 *                 raise OSError_from_errno("Can't write headers", self.filename)
 * 
*/
    }

    /* "pysam/libcbcf.pyx":4124
 * 
 *         # Write header if no records were written
 *         if self.htsfile.is_write and not self.header_written:             # <<<<<<<<<<<<<<
 *             with nogil:
 *                 ret = bcf_hdr_write(self.htsfile, self.header.ptr)
*/
  }

  /* "pysam/libcbcf.pyx":4130
 *                 raise OSError_from_errno("Can't write headers", self.filename)
 * 
 *         ret = hts_close(self.htsfile)             # <<<<<<<<<<<<<<
 *         self.htsfile = NULL
 *         self.header = self.index = None
*/
  __pyx_v_ret = hts_close(__pyx_v_self->__pyx_base.htsfile);

  /* "pysam/libcbcf.pyx":4131
 * 
 *         ret = hts_close(self.htsfile)
 *         self.htsfile = NULL             # <<<<<<<<<<<<<<
 *         self.header = self.index = None
 * 
*/
  __pyx_v_self->__pyx_base.htsfile = NULL;

  /* "pysam/libcbcf.pyx":4132
 *         ret = hts_close(self.htsfile)
 *         self.htsfile = NULL
 *         self.header = self.index = None             # <<<<<<<<<<<<<<
 * 
 *         if ret < 0 and errno != EPIPE:
*/
  __Pyx_INCREF(Py_None);
  __Pyx_GIVEREF(Py_None);
  __Pyx_GOTREF((PyObject *)__pyx_v_self->header);
  __Pyx_DECREF((PyObject *)__pyx_v_self->header);
  __pyx_v_self->header = ((struct __pyx_obj_5pysam_7libcbcf_VariantHeader *)Py_None);
  __Pyx_INCREF(Py_None);
  __Pyx_GIVEREF(Py_None);
  __Pyx_GOTREF((PyObject *)__pyx_v_self->index);
  __Pyx_DECREF((PyObject *)__pyx_v_self->index);
  __pyx_v_self->index = ((struct __pyx_obj_5pysam_7libcbcf_BaseIndex *)Py_None);

  /* "pysam/libcbcf.pyx":4134
 *         self.header = self.index = None
 * 
 *         if ret < 0 and errno != EPIPE:             # <<<<<<<<<<<<<<
 *             raise OSError_from_errno("Closing failed", self.filename)
 * 
*/
  __pyx_t_3 = (__pyx_v_ret < 0);
  if (__pyx_t_3) {
  } else {
    __pyx_t_1 = __pyx_t_3;
    goto __pyx_L16_bool_binop_done;
  }
  __pyx_t_3 = (errno != EPIPE);
  __pyx_t_1 = __pyx_t_3;
  __pyx_L16_bool_binop_done:;
  if (unlikely(__pyx_t_1)) {

    /* "pysam/libcbcf.pyx":4135
 * 
 *         if ret < 0 and errno != EPIPE:
 *             raise OSError_from_errno("Closing failed", self.filename)             # <<<<<<<<<<<<<<
 * 
 *     def close(self):
*/
    __pyx_t_5 = __pyx_v_self->__pyx_base.filename;
    __Pyx_INCREF(__pyx_t_5);
    __pyx_t_6.__pyx_n = 1;
    __pyx_t_6.filename = __pyx_t_5;
    __pyx_t_4 = __pyx_f_5pysam_9libcutils_OSError_from_errno(__pyx_mstate_global->__pyx_kp_u_Closing_failed, &__pyx_t_6); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 4135, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
    __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
    __Pyx_Raise(__pyx_t_4, 0, 0, 0);
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    __PYX_ERR(0, 4135, __pyx_L1_error)

    /* "pysam/libcbcf.pyx":4134
 *         self.header = self.index = None
 * 
 *         if ret < 0 and errno != EPIPE:             # <<<<<<<<<<<<<<
 *             raise OSError_from_errno("Closing failed", self.filename)
 * 
*/
  }

  /* "pysam/libcbcf.pyx":4117
 *         self.open(*args, **kwargs)
 * 
 *     def __dealloc__(self):             # <<<<<<<<<<<<<<
 *         if not self.htsfile or not self.header:
 *             return
*/

  /* function exit code */
  __Pyx_TraceReturnValue(Py_None, 0, 0, __PYX_ERR(0, 4117, __pyx_L1_error));
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_XDECREF(__pyx_t_5);
  __Pyx_TraceException(__pyx_lineno, 0, 0);
  #if CYTHON_USE_SYS_MONITORING
  __Pyx_TraceExceptionUnwind(0, 0);
  #else
  __Pyx_TraceReturnValue(NULL, 0, 0, __PYX_ERR(0, 4117, __pyx_L1_error));
  #endif
  __Pyx_WriteUnraisable("pysam.libcbcf.VariantFile.__dealloc__", __pyx_clineno, __pyx_lineno, __pyx_filename, 1, 0);
  __pyx_L0:;
  __Pyx_PyMonitoring_ExitScope(0);
  __Pyx_RefNannyFinishContext();
}

/* "pysam/libcbcf.pyx":4137
 *             raise OSError_from_errno("Closing failed", self.filename)
 * 
 *     def close(self):             # <<<<<<<<<<<<<<
 *         """closes the :class:`pysam.VariantFile`."""
 *         if not self.htsfile:
*/

/* Python wrapper */
static PyObject *__pyx_pw_5pysam_7libcbcf_11VariantFile_7close(PyObject *__pyx_v_self, 
#if 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_5pysam_7libcbcf_11VariantFile_6close, "VariantFile.close(self)\n\ncloses the :class:`pysam.VariantFile`.");
static PyMethodDef __pyx_mdef_5pysam_7libcbcf_11VariantFile_7close = {"close", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_5pysam_7libcbcf_11VariantFile_7close, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_5pysam_7libcbcf_11VariantFile_6close};
static PyObject *__pyx_pw_5pysam_7libcbcf_11VariantFile_7close(PyObject *__pyx_v_self, 
#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_5pysam_7libcbcf_11VariantFile_6close(((struct __pyx_obj_5pysam_7libcbcf_VariantFile *)__pyx_v_self));

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

static PyObject *__pyx_pf_5pysam_7libcbcf_11VariantFile_6close(struct __pyx_obj_5pysam_7libcbcf_VariantFile *__pyx_v_self) {
  int __pyx_v_ret;
  PyObject *__pyx_r = NULL;
  __Pyx_TraceDeclarationsFunc
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  int __pyx_t_2;
  PyObject *__pyx_t_3 = NULL;
  PyObject *__pyx_t_4 = NULL;
  struct __pyx_opt_args_5pysam_9libcutils_OSError_from_errno __pyx_t_5;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_TraceFrameInit(((PyObject *)__pyx_mstate_global->__pyx_codeobj_tab[368]))
  __Pyx_RefNannySetupContext("close", 0);
  __Pyx_TraceStartFunc("close", __pyx_f[0], 4137, 0, 0, 0, __PYX_ERR(0, 4137, __pyx_L1_error));

  /* "pysam/libcbcf.pyx":4139
 *     def close(self):
 *         """closes the :class:`pysam.VariantFile`."""
 *         if not self.htsfile:             # <<<<<<<<<<<<<<
 *             return
 * 
*/
  __pyx_t_1 = (!(__pyx_v_self->__pyx_base.htsfile != 0));
  if (__pyx_t_1) {

    /* "pysam/libcbcf.pyx":4140
 *         """closes the :class:`pysam.VariantFile`."""
 *         if not self.htsfile:
 *             return             # <<<<<<<<<<<<<<
 * 
 *         cdef int ret
*/
    __Pyx_XDECREF(__pyx_r);
    __pyx_r = Py_None; __Pyx_INCREF(Py_None);
    goto __pyx_L0;

    /* "pysam/libcbcf.pyx":4139
 *     def close(self):
 *         """closes the :class:`pysam.VariantFile`."""
 *         if not self.htsfile:             # <<<<<<<<<<<<<<
 *             return
 * 
*/
  }

  /* "pysam/libcbcf.pyx":4145
 * 
 *         # Write header if no records were written
 *         if self.htsfile.is_write and not self.header_written:             # <<<<<<<<<<<<<<
 *             with nogil:
 *                 ret = bcf_hdr_write(self.htsfile, self.header.ptr)
*/
  __pyx_t_2 = (__pyx_v_self->__pyx_base.htsfile->is_write != 0);
  if (__pyx_t_2) {
  } else {
    __pyx_t_1 = __pyx_t_2;
    goto __pyx_L5_bool_binop_done;
  }
  __pyx_t_2 = (!__pyx_v_self->header_written);
  __pyx_t_1 = __pyx_t_2;
  __pyx_L5_bool_binop_done:;
  if (__pyx_t_1) {

    /* "pysam/libcbcf.pyx":4146
 *         # Write header if no records were written
 *         if self.htsfile.is_write and not self.header_written:
 *             with nogil:             # <<<<<<<<<<<<<<
 *                 ret = bcf_hdr_write(self.htsfile, self.header.ptr)
 *             if ret < 0 and errno != EPIPE:
*/
    {
        PyThreadState *_save;
        _save = NULL;
        Py_UNBLOCK_THREADS
        __Pyx_FastGIL_Remember();
        /*try:*/ {

          /* "pysam/libcbcf.pyx":4147
 *         if self.htsfile.is_write and not self.header_written:
 *             with nogil:
 *                 ret = bcf_hdr_write(self.htsfile, self.header.ptr)             # <<<<<<<<<<<<<<
 *             if ret < 0 and errno != EPIPE:
 *                 raise OSError_from_errno("Can't write headers", self.filename)
*/
          __pyx_v_ret = bcf_hdr_write(__pyx_v_self->__pyx_base.htsfile, __pyx_v_self->header->ptr);
        }

        /* "pysam/libcbcf.pyx":4146
 *         # Write header if no records were written
 *         if self.htsfile.is_write and not self.header_written:
 *             with nogil:             # <<<<<<<<<<<<<<
 *                 ret = bcf_hdr_write(self.htsfile, self.header.ptr)
 *             if ret < 0 and errno != EPIPE:
*/
        /*finally:*/ {
          /*normal exit:*/{
            __Pyx_FastGIL_Forget();
            Py_BLOCK_THREADS
            goto __pyx_L9;
          }
          __pyx_L9:;
        }
    }

    /* "pysam/libcbcf.pyx":4148
 *             with nogil:
 *                 ret = bcf_hdr_write(self.htsfile, self.header.ptr)
 *             if ret < 0 and errno != EPIPE:             # <<<<<<<<<<<<<<
 *                 raise OSError_from_errno("Can't write headers", self.filename)
 * 
*/
    __pyx_t_2 = (__pyx_v_ret < 0);
    if (__pyx_t_2) {
    } else {
      __pyx_t_1 = __pyx_t_2;
      goto __pyx_L11_bool_binop_done;
    }
    __pyx_t_2 = (errno != EPIPE);
    __pyx_t_1 = __pyx_t_2;
    __pyx_L11_bool_binop_done:;
    if (unlikely(__pyx_t_1)) {

      /* "pysam/libcbcf.pyx":4149
 *                 ret = bcf_hdr_write(self.htsfile, self.header.ptr)
 *             if ret < 0 and errno != EPIPE:
 *                 raise OSError_from_errno("Can't write headers", self.filename)             # <<<<<<<<<<<<<<
 * 
 *         ret = hts_close(self.htsfile)
*/
      __pyx_t_3 = __pyx_v_self->__pyx_base.filename;
      __Pyx_INCREF(__pyx_t_3);
      __pyx_t_5.__pyx_n = 1;
      __pyx_t_5.filename = __pyx_t_3;
      __pyx_t_4 = __pyx_f_5pysam_9libcutils_OSError_from_errno(__pyx_mstate_global->__pyx_kp_u_Can_t_write_headers, &__pyx_t_5); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 4149, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_4);
      __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
      __Pyx_Raise(__pyx_t_4, 0, 0, 0);
      __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
      __PYX_ERR(0, 4149, __pyx_L1_error)

      /* "pysam/libcbcf.pyx":4148
 *             with nogil:
 *                 ret = bcf_hdr_write(self.htsfile, self.header.ptr)
 *             if ret < 0 and errno != EPIPE:             # <<<<<<<<<<<<<<
 *                 raise OSError_from_errno("Can't write headers", self.filename)
 * 
*/
    }

    /* "pysam/libcbcf.pyx":4145
 * 
 *         # Write header if no records were written
 *         if self.htsfile.is_write and not self.header_written:             # <<<<<<<<<<<<<<
 *             with nogil:
 *                 ret = bcf_hdr_write(self.htsfile, self.header.ptr)
*/
  }

  /* "pysam/libcbcf.pyx":4151
 *                 raise OSError_from_errno("Can't write headers", self.filename)
 * 
 *         ret = hts_close(self.htsfile)             # <<<<<<<<<<<<<<
 *         self.htsfile = NULL
 *         self.header = self.index = None
*/
  __pyx_v_ret = hts_close(__pyx_v_self->__pyx_base.htsfile);

  /* "pysam/libcbcf.pyx":4152
 * 
 *         ret = hts_close(self.htsfile)
 *         self.htsfile = NULL             # <<<<<<<<<<<<<<
 *         self.header = self.index = None
 * 
*/
  __pyx_v_self->__pyx_base.htsfile = NULL;

  /* "pysam/libcbcf.pyx":4153
 *         ret = hts_close(self.htsfile)
 *         self.htsfile = NULL
 *         self.header = self.index = None             # <<<<<<<<<<<<<<
 * 
 *         if ret < 0 and errno != EPIPE:
*/
  __Pyx_INCREF(Py_None);
  __Pyx_GIVEREF(Py_None);
  __Pyx_GOTREF((PyObject *)__pyx_v_self->header);
  __Pyx_DECREF((PyObject *)__pyx_v_self->header);
  __pyx_v_self->header = ((struct __pyx_obj_5pysam_7libcbcf_VariantHeader *)Py_None);
  __Pyx_INCREF(Py_None);
  __Pyx_GIVEREF(Py_None);
  __Pyx_GOTREF((PyObject *)__pyx_v_self->index);
  __Pyx_DECREF((PyObject *)__pyx_v_self->index);
  __pyx_v_self->index = ((struct __pyx_obj_5pysam_7libcbcf_BaseIndex *)Py_None);

  /* "pysam/libcbcf.pyx":4155
 *         self.header = self.index = None
 * 
 *         if ret < 0 and errno != EPIPE:             # <<<<<<<<<<<<<<
 *             raise OSError_from_errno("Closing failed", self.filename)
 * 
*/
  __pyx_t_2 = (__pyx_v_ret < 0);
  if (__pyx_t_2) {
  } else {
    __pyx_t_1 = __pyx_t_2;
    goto __pyx_L14_bool_binop_done;
  }
  __pyx_t_2 = (errno != EPIPE);
  __pyx_t_1 = __pyx_t_2;
  __pyx_L14_bool_binop_done:;
  if (unlikely(__pyx_t_1)) {

    /* "pysam/libcbcf.pyx":4156
 * 
 *         if ret < 0 and errno != EPIPE:
 *             raise OSError_from_errno("Closing failed", self.filename)             # <<<<<<<<<<<<<<
 * 
 *     def __iter__(self):
*/
    __pyx_t_4 = __pyx_v_self->__pyx_base.filename;
    __Pyx_INCREF(__pyx_t_4);
    __pyx_t_5.__pyx_n = 1;
    __pyx_t_5.filename = __pyx_t_4;
    __pyx_t_3 = __pyx_f_5pysam_9libcutils_OSError_from_errno(__pyx_mstate_global->__pyx_kp_u_Closing_failed, &__pyx_t_5); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 4156, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    __Pyx_Raise(__pyx_t_3, 0, 0, 0);
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    __PYX_ERR(0, 4156, __pyx_L1_error)

    /* "pysam/libcbcf.pyx":4155
 *         self.header = self.index = None
 * 
 *         if ret < 0 and errno != EPIPE:             # <<<<<<<<<<<<<<
 *             raise OSError_from_errno("Closing failed", self.filename)
 * 
*/
  }

  /* "pysam/libcbcf.pyx":4137
 *             raise OSError_from_errno("Closing failed", self.filename)
 * 
 *     def close(self):             # <<<<<<<<<<<<<<
 *         """closes the :class:`pysam.VariantFile`."""
 *         if not self.htsfile:
*/

  /* function exit code */
  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  __Pyx_TraceReturnValue(__pyx_r, 0, 0, __PYX_ERR(0, 4137, __pyx_L1_error));
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_TraceException(__pyx_lineno, 0, 0);
  #if CYTHON_USE_SYS_MONITORING
  __Pyx_TraceExceptionUnwind(0, 0);
  #else
  __Pyx_TraceReturnValue(NULL, 0, 0, __PYX_ERR(0, 4137, __pyx_L1_error));
  #endif
  __Pyx_AddTraceback("pysam.libcbcf.VariantFile.close", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_PyMonitoring_ExitScope(0);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "pysam/libcbcf.pyx":4158
 *             raise OSError_from_errno("Closing failed", self.filename)
 * 
 *     def __iter__(self):             # <<<<<<<<<<<<<<
 *         if not self.is_open:
 *             raise ValueError('I/O operation on closed file')
*/

/* Python wrapper */
static PyObject *__pyx_pw_5pysam_7libcbcf_11VariantFile_9__iter__(PyObject *__pyx_v_self); /*proto*/
static PyObject *__pyx_pw_5pysam_7libcbcf_11VariantFile_9__iter__(PyObject *__pyx_v_self) {
  CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__iter__ (wrapper)", 0);
  __pyx_kwvalues = __Pyx_KwValues_VARARGS(__pyx_args, __pyx_nargs);
  __pyx_r = __pyx_pf_5pysam_7libcbcf_11VariantFile_8__iter__(((struct __pyx_obj_5pysam_7libcbcf_VariantFile *)__pyx_v_self));

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

static PyObject *__pyx_pf_5pysam_7libcbcf_11VariantFile_8__iter__(struct __pyx_obj_5pysam_7libcbcf_VariantFile *__pyx_v_self) {
  PyObject *__pyx_r = NULL;
  __Pyx_TraceDeclarationsFunc
  __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_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_TraceFrameInit(((PyObject *)__pyx_mstate_global->__pyx_codeobj_tab[369]))
  __Pyx_RefNannySetupContext("__iter__", 0);
  __Pyx_TraceStartFunc("__iter__", __pyx_f[0], 4158, 0, 0, 0, __PYX_ERR(0, 4158, __pyx_L1_error));

  /* "pysam/libcbcf.pyx":4159
 * 
 *     def __iter__(self):
 *         if not self.is_open:             # <<<<<<<<<<<<<<
 *             raise ValueError('I/O operation on closed file')
 * 
*/
  __pyx_t_1 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_mstate_global->__pyx_n_u_is_open); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 4159, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_2 = __Pyx_PyObject_IsTrue(__pyx_t_1); if (unlikely((__pyx_t_2 < 0))) __PYX_ERR(0, 4159, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_t_3 = (!__pyx_t_2);
  if (unlikely(__pyx_t_3)) {

    /* "pysam/libcbcf.pyx":4160
 *     def __iter__(self):
 *         if not self.is_open:
 *             raise ValueError('I/O operation on closed file')             # <<<<<<<<<<<<<<
 * 
 *         if self.htsfile.is_write:
*/
    __pyx_t_4 = NULL;
    __Pyx_INCREF(__pyx_builtin_ValueError);
    __pyx_t_5 = __pyx_builtin_ValueError; 
    __pyx_t_6 = 1;
    {
      PyObject *__pyx_callargs[2] = {__pyx_t_4, __pyx_mstate_global->__pyx_kp_u_I_O_operation_on_closed_file};
      __pyx_t_1 = __Pyx_PyObject_FastCall(__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, 4160, __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, 4160, __pyx_L1_error)

    /* "pysam/libcbcf.pyx":4159
 * 
 *     def __iter__(self):
 *         if not self.is_open:             # <<<<<<<<<<<<<<
 *             raise ValueError('I/O operation on closed file')
 * 
*/
  }

  /* "pysam/libcbcf.pyx":4162
 *             raise ValueError('I/O operation on closed file')
 * 
 *         if self.htsfile.is_write:             # <<<<<<<<<<<<<<
 *             raise ValueError('cannot iterate over Variantfile opened for writing')
 * 
*/
  __pyx_t_3 = (__pyx_v_self->__pyx_base.htsfile->is_write != 0);
  if (unlikely(__pyx_t_3)) {

    /* "pysam/libcbcf.pyx":4163
 * 
 *         if self.htsfile.is_write:
 *             raise ValueError('cannot iterate over Variantfile opened for writing')             # <<<<<<<<<<<<<<
 * 
 *         self.is_reading = 1
*/
    __pyx_t_5 = NULL;
    __Pyx_INCREF(__pyx_builtin_ValueError);
    __pyx_t_4 = __pyx_builtin_ValueError; 
    __pyx_t_6 = 1;
    {
      PyObject *__pyx_callargs[2] = {__pyx_t_5, __pyx_mstate_global->__pyx_kp_u_cannot_iterate_over_Variantfile};
      __pyx_t_1 = __Pyx_PyObject_FastCall(__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, 4163, __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, 4163, __pyx_L1_error)

    /* "pysam/libcbcf.pyx":4162
 *             raise ValueError('I/O operation on closed file')
 * 
 *         if self.htsfile.is_write:             # <<<<<<<<<<<<<<
 *             raise ValueError('cannot iterate over Variantfile opened for writing')
 * 
*/
  }

  /* "pysam/libcbcf.pyx":4165
 *             raise ValueError('cannot iterate over Variantfile opened for writing')
 * 
 *         self.is_reading = 1             # <<<<<<<<<<<<<<
 *         return self
 * 
*/
  __pyx_v_self->is_reading = 1;

  /* "pysam/libcbcf.pyx":4166
 * 
 *         self.is_reading = 1
 *         return self             # <<<<<<<<<<<<<<
 * 
 *     def __next__(self):
*/
  __Pyx_XDECREF(__pyx_r);
  __Pyx_INCREF((PyObject *)__pyx_v_self);
  __pyx_r = ((PyObject *)__pyx_v_self);
  __Pyx_TraceReturnValue(__pyx_r, 20, 0, __PYX_ERR(0, 4166, __pyx_L1_error));
  goto __pyx_L0;

  /* "pysam/libcbcf.pyx":4158
 *             raise OSError_from_errno("Closing failed", self.filename)
 * 
 *     def __iter__(self):             # <<<<<<<<<<<<<<
 *         if not self.is_open:
 *             raise ValueError('I/O operation on closed file')
*/

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_XDECREF(__pyx_t_5);
  __Pyx_TraceException(__pyx_lineno, 0, 0);
  #if CYTHON_USE_SYS_MONITORING
  __Pyx_TraceExceptionUnwind(0, 0);
  #else
  __Pyx_TraceReturnValue(NULL, 0, 0, __PYX_ERR(0, 4158, __pyx_L1_error));
  #endif
  __Pyx_AddTraceback("pysam.libcbcf.VariantFile.__iter__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_PyMonitoring_ExitScope(0);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "pysam/libcbcf.pyx":4168
 *         return self
 * 
 *     def __next__(self):             # <<<<<<<<<<<<<<
 *         cdef int ret
 *         cdef int errcode
*/

/* Python wrapper */
static PyObject *__pyx_pw_5pysam_7libcbcf_11VariantFile_11__next__(PyObject *__pyx_v_self); /*proto*/
static PyObject *__pyx_pw_5pysam_7libcbcf_11VariantFile_11__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_5pysam_7libcbcf_11VariantFile_10__next__(((struct __pyx_obj_5pysam_7libcbcf_VariantFile *)__pyx_v_self));

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

static PyObject *__pyx_pf_5pysam_7libcbcf_11VariantFile_10__next__(struct __pyx_obj_5pysam_7libcbcf_VariantFile *__pyx_v_self) {
  int __pyx_v_ret;
  int __pyx_v_errcode;
  bcf1_t *__pyx_v_record;
  PyObject *__pyx_r = NULL;
  __Pyx_TraceDeclarationsFunc
  __Pyx_RefNannyDeclarations
  int __pyx_error_without_exception = 0; /* StopIteration */
  int __pyx_t_1;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  PyObject *__pyx_t_4 = NULL;
  size_t __pyx_t_5;
  int __pyx_t_6;
  struct __pyx_opt_args_5pysam_9libcutils_OSError_from_errno __pyx_t_7;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_TraceFrameInit(((PyObject *)__pyx_mstate_global->__pyx_codeobj_tab[370]))
  __Pyx_RefNannySetupContext("__next__", 0);
  __Pyx_TraceStartFunc("__next__", __pyx_f[0], 4168, 0, 0, 0, __PYX_ERR(0, 4168, __pyx_L1_error));

  /* "pysam/libcbcf.pyx":4171
 *         cdef int ret
 *         cdef int errcode
 *         cdef bcf1_t *record = bcf_init1()             # <<<<<<<<<<<<<<
 * 
 *         if not record:
*/
  __pyx_v_record = bcf_init1();

  /* "pysam/libcbcf.pyx":4173
 *         cdef bcf1_t *record = bcf_init1()
 * 
 *         if not record:             # <<<<<<<<<<<<<<
 *             raise MemoryError('unable to allocate BCF record')
 * 
*/
  __pyx_t_1 = (!(__pyx_v_record != 0));
  if (unlikely(__pyx_t_1)) {

    /* "pysam/libcbcf.pyx":4174
 * 
 *         if not record:
 *             raise MemoryError('unable to allocate BCF record')             # <<<<<<<<<<<<<<
 * 
 *         record.pos = -1
*/
    __pyx_t_3 = NULL;
    __Pyx_INCREF(__pyx_builtin_MemoryError);
    __pyx_t_4 = __pyx_builtin_MemoryError; 
    __pyx_t_5 = 1;
    {
      PyObject *__pyx_callargs[2] = {__pyx_t_3, __pyx_mstate_global->__pyx_kp_u_unable_to_allocate_BCF_record};
      __pyx_t_2 = __Pyx_PyObject_FastCall(__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_2)) __PYX_ERR(0, 4174, __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, 4174, __pyx_L1_error)

    /* "pysam/libcbcf.pyx":4173
 *         cdef bcf1_t *record = bcf_init1()
 * 
 *         if not record:             # <<<<<<<<<<<<<<
 *             raise MemoryError('unable to allocate BCF record')
 * 
*/
  }

  /* "pysam/libcbcf.pyx":4176
 *             raise MemoryError('unable to allocate BCF record')
 * 
 *         record.pos = -1             # <<<<<<<<<<<<<<
 *         if self.drop_samples:
 *             record.max_unpack = BCF_UN_SHR
*/
  __pyx_v_record->pos = -1;

  /* "pysam/libcbcf.pyx":4177
 * 
 *         record.pos = -1
 *         if self.drop_samples:             # <<<<<<<<<<<<<<
 *             record.max_unpack = BCF_UN_SHR
 * 
*/
  if (__pyx_v_self->drop_samples) {

    /* "pysam/libcbcf.pyx":4178
 *         record.pos = -1
 *         if self.drop_samples:
 *             record.max_unpack = BCF_UN_SHR             # <<<<<<<<<<<<<<
 * 
 *         with nogil:
*/
    __pyx_v_record->max_unpack = BCF_UN_SHR;

    /* "pysam/libcbcf.pyx":4177
 * 
 *         record.pos = -1
 *         if self.drop_samples:             # <<<<<<<<<<<<<<
 *             record.max_unpack = BCF_UN_SHR
 * 
*/
  }

  /* "pysam/libcbcf.pyx":4180
 *             record.max_unpack = BCF_UN_SHR
 * 
 *         with nogil:             # <<<<<<<<<<<<<<
 *             ret = bcf_read1(self.htsfile, self.header.ptr, record)
 * 
*/
  {
      PyThreadState *_save;
      _save = NULL;
      Py_UNBLOCK_THREADS
      __Pyx_FastGIL_Remember();
      /*try:*/ {

        /* "pysam/libcbcf.pyx":4181
 * 
 *         with nogil:
 *             ret = bcf_read1(self.htsfile, self.header.ptr, record)             # <<<<<<<<<<<<<<
 * 
 *         if ret < 0:
*/
        __pyx_v_ret = bcf_read1(__pyx_v_self->__pyx_base.htsfile, __pyx_v_self->header->ptr, __pyx_v_record);
      }

      /* "pysam/libcbcf.pyx":4180
 *             record.max_unpack = BCF_UN_SHR
 * 
 *         with nogil:             # <<<<<<<<<<<<<<
 *             ret = bcf_read1(self.htsfile, self.header.ptr, record)
 * 
*/
      /*finally:*/ {
        /*normal exit:*/{
          __Pyx_FastGIL_Forget();
          Py_BLOCK_THREADS
          goto __pyx_L7;
        }
        __pyx_L7:;
      }
  }

  /* "pysam/libcbcf.pyx":4183
 *             ret = bcf_read1(self.htsfile, self.header.ptr, record)
 * 
 *         if ret < 0:             # <<<<<<<<<<<<<<
 *             errcode = record.errcode
 *             bcf_destroy1(record)
*/
  __pyx_t_1 = (__pyx_v_ret < 0);
  if (__pyx_t_1) {

    /* "pysam/libcbcf.pyx":4184
 * 
 *         if ret < 0:
 *             errcode = record.errcode             # <<<<<<<<<<<<<<
 *             bcf_destroy1(record)
 *             if errcode:
*/
    __pyx_t_6 = __pyx_v_record->errcode;
    __pyx_v_errcode = __pyx_t_6;

    /* "pysam/libcbcf.pyx":4185
 *         if ret < 0:
 *             errcode = record.errcode
 *             bcf_destroy1(record)             # <<<<<<<<<<<<<<
 *             if errcode:
 *                 raise IOError('unable to parse next record')
*/
    bcf_destroy1(__pyx_v_record);

    /* "pysam/libcbcf.pyx":4186
 *             errcode = record.errcode
 *             bcf_destroy1(record)
 *             if errcode:             # <<<<<<<<<<<<<<
 *                 raise IOError('unable to parse next record')
 *             if ret == -1:
*/
    __pyx_t_1 = (__pyx_v_errcode != 0);
    if (unlikely(__pyx_t_1)) {

      /* "pysam/libcbcf.pyx":4187
 *             bcf_destroy1(record)
 *             if errcode:
 *                 raise IOError('unable to parse next record')             # <<<<<<<<<<<<<<
 *             if ret == -1:
 *                 raise StopIteration
*/
      __pyx_t_4 = NULL;
      __Pyx_INCREF(__pyx_builtin_IOError);
      __pyx_t_3 = __pyx_builtin_IOError; 
      __pyx_t_5 = 1;
      {
        PyObject *__pyx_callargs[2] = {__pyx_t_4, __pyx_mstate_global->__pyx_kp_u_unable_to_parse_next_record};
        __pyx_t_2 = __Pyx_PyObject_FastCall(__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_2)) __PYX_ERR(0, 4187, __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, 4187, __pyx_L1_error)

      /* "pysam/libcbcf.pyx":4186
 *             errcode = record.errcode
 *             bcf_destroy1(record)
 *             if errcode:             # <<<<<<<<<<<<<<
 *                 raise IOError('unable to parse next record')
 *             if ret == -1:
*/
    }

    /* "pysam/libcbcf.pyx":4188
 *             if errcode:
 *                 raise IOError('unable to parse next record')
 *             if ret == -1:             # <<<<<<<<<<<<<<
 *                 raise StopIteration
 *             elif ret == -2:
*/
    __pyx_t_1 = (__pyx_v_ret == -1L);
    if (unlikely(__pyx_t_1)) {

      /* "pysam/libcbcf.pyx":4189
 *                 raise IOError('unable to parse next record')
 *             if ret == -1:
 *                 raise StopIteration             # <<<<<<<<<<<<<<
 *             elif ret == -2:
 *                 raise IOError('truncated file')
*/
      __pyx_error_without_exception = 1;
      goto __pyx_L1_error;;

      /* "pysam/libcbcf.pyx":4188
 *             if errcode:
 *                 raise IOError('unable to parse next record')
 *             if ret == -1:             # <<<<<<<<<<<<<<
 *                 raise StopIteration
 *             elif ret == -2:
*/
    }

    /* "pysam/libcbcf.pyx":4190
 *             if ret == -1:
 *                 raise StopIteration
 *             elif ret == -2:             # <<<<<<<<<<<<<<
 *                 raise IOError('truncated file')
 *             elif errno:
*/
    __pyx_t_1 = (__pyx_v_ret == -2L);
    if (unlikely(__pyx_t_1)) {

      /* "pysam/libcbcf.pyx":4191
 *                 raise StopIteration
 *             elif ret == -2:
 *                 raise IOError('truncated file')             # <<<<<<<<<<<<<<
 *             elif errno:
 *                 raise OSError_from_errno("Unable to fetch next record", self.filename)
*/
      __pyx_t_3 = NULL;
      __Pyx_INCREF(__pyx_builtin_IOError);
      __pyx_t_4 = __pyx_builtin_IOError; 
      __pyx_t_5 = 1;
      {
        PyObject *__pyx_callargs[2] = {__pyx_t_3, __pyx_mstate_global->__pyx_kp_u_truncated_file};
        __pyx_t_2 = __Pyx_PyObject_FastCall(__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_2)) __PYX_ERR(0, 4191, __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, 4191, __pyx_L1_error)

      /* "pysam/libcbcf.pyx":4190
 *             if ret == -1:
 *                 raise StopIteration
 *             elif ret == -2:             # <<<<<<<<<<<<<<
 *                 raise IOError('truncated file')
 *             elif errno:
*/
    }

    /* "pysam/libcbcf.pyx":4192
 *             elif ret == -2:
 *                 raise IOError('truncated file')
 *             elif errno:             # <<<<<<<<<<<<<<
 *                 raise OSError_from_errno("Unable to fetch next record", self.filename)
 *             else:
*/
    __pyx_t_1 = (errno != 0);
    if (unlikely(__pyx_t_1)) {

      /* "pysam/libcbcf.pyx":4193
 *                 raise IOError('truncated file')
 *             elif errno:
 *                 raise OSError_from_errno("Unable to fetch next record", self.filename)             # <<<<<<<<<<<<<<
 *             else:
 *                 raise IOError('unable to fetch next record')
*/
      __pyx_t_2 = __pyx_v_self->__pyx_base.filename;
      __Pyx_INCREF(__pyx_t_2);
      __pyx_t_7.__pyx_n = 1;
      __pyx_t_7.filename = __pyx_t_2;
      __pyx_t_4 = __pyx_f_5pysam_9libcutils_OSError_from_errno(__pyx_mstate_global->__pyx_kp_u_Unable_to_fetch_next_record, &__pyx_t_7); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 4193, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_4);
      __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
      __Pyx_Raise(__pyx_t_4, 0, 0, 0);
      __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
      __PYX_ERR(0, 4193, __pyx_L1_error)

      /* "pysam/libcbcf.pyx":4192
 *             elif ret == -2:
 *                 raise IOError('truncated file')
 *             elif errno:             # <<<<<<<<<<<<<<
 *                 raise OSError_from_errno("Unable to fetch next record", self.filename)
 *             else:
*/
    }

    /* "pysam/libcbcf.pyx":4195
 *                 raise OSError_from_errno("Unable to fetch next record", self.filename)
 *             else:
 *                 raise IOError('unable to fetch next record')             # <<<<<<<<<<<<<<
 * 
 *         return makeVariantRecord(self.header, record)
*/
    /*else*/ {
      __pyx_t_2 = NULL;
      __Pyx_INCREF(__pyx_builtin_IOError);
      __pyx_t_3 = __pyx_builtin_IOError; 
      __pyx_t_5 = 1;
      {
        PyObject *__pyx_callargs[2] = {__pyx_t_2, __pyx_mstate_global->__pyx_kp_u_unable_to_fetch_next_record};
        __pyx_t_4 = __Pyx_PyObject_FastCall(__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_3); __pyx_t_3 = 0;
        if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 4195, __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, 4195, __pyx_L1_error)
    }

    /* "pysam/libcbcf.pyx":4183
 *             ret = bcf_read1(self.htsfile, self.header.ptr, record)
 * 
 *         if ret < 0:             # <<<<<<<<<<<<<<
 *             errcode = record.errcode
 *             bcf_destroy1(record)
*/
  }

  /* "pysam/libcbcf.pyx":4197
 *                 raise IOError('unable to fetch next record')
 * 
 *         return makeVariantRecord(self.header, record)             # <<<<<<<<<<<<<<
 * 
 *     def copy(self):
*/
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_4 = ((PyObject *)__pyx_v_self->header);
  __Pyx_INCREF(__pyx_t_4);
  __pyx_t_3 = ((PyObject *)__pyx_f_5pysam_7libcbcf_makeVariantRecord(((struct __pyx_obj_5pysam_7libcbcf_VariantHeader *)__pyx_t_4), __pyx_v_record)); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 4197, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  __pyx_r = __pyx_t_3;
  __pyx_t_3 = 0;
  __Pyx_TraceReturnValue(__pyx_r, 69, 0, __PYX_ERR(0, 4197, __pyx_L1_error));
  goto __pyx_L0;

  /* "pysam/libcbcf.pyx":4168
 *         return self
 * 
 *     def __next__(self):             # <<<<<<<<<<<<<<
 *         cdef int ret
 *         cdef int errcode
*/

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_TraceException(__pyx_lineno, 0, 0);
  #if CYTHON_USE_SYS_MONITORING
  __Pyx_TraceExceptionUnwind(0, 0);
  #else
  __Pyx_TraceReturnValue(NULL, 0, 0, __PYX_ERR(0, 4168, __pyx_L1_error));
  #endif
  if (!__pyx_error_without_exception) {
    __Pyx_AddTraceback("pysam.libcbcf.VariantFile.__next__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  }
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_PyMonitoring_ExitScope(0);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "pysam/libcbcf.pyx":4199
 *         return makeVariantRecord(self.header, record)
 * 
 *     def copy(self):             # <<<<<<<<<<<<<<
 *         if not self.is_open:
 *             raise ValueError
*/

/* Python wrapper */
static PyObject *__pyx_pw_5pysam_7libcbcf_11VariantFile_13copy(PyObject *__pyx_v_self, 
#if 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_5pysam_7libcbcf_11VariantFile_12copy, "VariantFile.copy(self)");
static PyMethodDef __pyx_mdef_5pysam_7libcbcf_11VariantFile_13copy = {"copy", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_5pysam_7libcbcf_11VariantFile_13copy, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_5pysam_7libcbcf_11VariantFile_12copy};
static PyObject *__pyx_pw_5pysam_7libcbcf_11VariantFile_13copy(PyObject *__pyx_v_self, 
#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_pf_5pysam_7libcbcf_11VariantFile_12copy(((struct __pyx_obj_5pysam_7libcbcf_VariantFile *)__pyx_v_self));

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

static PyObject *__pyx_pf_5pysam_7libcbcf_11VariantFile_12copy(struct __pyx_obj_5pysam_7libcbcf_VariantFile *__pyx_v_self) {
  struct __pyx_obj_5pysam_7libcbcf_VariantFile *__pyx_v_vars = 0;
  bcf_hdr_t *__pyx_v_hdr;
  PyObject *__pyx_r = NULL;
  __Pyx_TraceDeclarationsFunc
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_t_2;
  int __pyx_t_3;
  htsFile *__pyx_t_4;
  PyObject *__pyx_t_5 = NULL;
  PyObject *__pyx_t_6 = NULL;
  size_t __pyx_t_7;
  int64_t __pyx_t_8;
  PyObject *__pyx_t_9 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_TraceFrameInit(((PyObject *)__pyx_mstate_global->__pyx_codeobj_tab[371]))
  __Pyx_RefNannySetupContext("copy", 0);
  __Pyx_TraceStartFunc("copy", __pyx_f[0], 4199, 0, 0, 0, __PYX_ERR(0, 4199, __pyx_L1_error));

  /* "pysam/libcbcf.pyx":4200
 * 
 *     def copy(self):
 *         if not self.is_open:             # <<<<<<<<<<<<<<
 *             raise ValueError
 * 
*/
  __pyx_t_1 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_mstate_global->__pyx_n_u_is_open); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 4200, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_2 = __Pyx_PyObject_IsTrue(__pyx_t_1); if (unlikely((__pyx_t_2 < 0))) __PYX_ERR(0, 4200, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_t_3 = (!__pyx_t_2);
  if (unlikely(__pyx_t_3)) {

    /* "pysam/libcbcf.pyx":4201
 *     def copy(self):
 *         if not self.is_open:
 *             raise ValueError             # <<<<<<<<<<<<<<
 * 
 *         cdef VariantFile vars = VariantFile.__new__(VariantFile)
*/
    __Pyx_Raise(__pyx_builtin_ValueError, 0, 0, 0);
    __PYX_ERR(0, 4201, __pyx_L1_error)

    /* "pysam/libcbcf.pyx":4200
 * 
 *     def copy(self):
 *         if not self.is_open:             # <<<<<<<<<<<<<<
 *             raise ValueError
 * 
*/
  }

  /* "pysam/libcbcf.pyx":4203
 *             raise ValueError
 * 
 *         cdef VariantFile vars = VariantFile.__new__(VariantFile)             # <<<<<<<<<<<<<<
 *         cdef bcf_hdr_t *hdr
 * 
*/
  __pyx_t_1 = ((PyObject *)__pyx_tp_new_5pysam_7libcbcf_VariantFile(((PyTypeObject *)__pyx_mstate_global->__pyx_ptype_5pysam_7libcbcf_VariantFile), __pyx_mstate_global->__pyx_empty_tuple, NULL)); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 4203, __pyx_L1_error)
  __Pyx_GOTREF((PyObject *)__pyx_t_1);
  __pyx_v_vars = ((struct __pyx_obj_5pysam_7libcbcf_VariantFile *)__pyx_t_1);
  __pyx_t_1 = 0;

  /* "pysam/libcbcf.pyx":4207
 * 
 *         # FIXME: re-open using fd or else header and index could be invalid
 *         vars.htsfile = self._open_htsfile()             # <<<<<<<<<<<<<<
 * 
 *         if not vars.htsfile:
*/
  __pyx_t_4 = ((struct __pyx_vtabstruct_5pysam_7libcbcf_VariantFile *)__pyx_v_self->__pyx_base.__pyx_vtab)->__pyx_base._open_htsfile(((struct __pyx_obj_5pysam_10libchtslib_HTSFile *)__pyx_v_self)); if (unlikely(__pyx_t_4 == ((htsFile *)0) && PyErr_Occurred())) __PYX_ERR(0, 4207, __pyx_L1_error)
  __pyx_v_vars->__pyx_base.htsfile = __pyx_t_4;

  /* "pysam/libcbcf.pyx":4209
 *         vars.htsfile = self._open_htsfile()
 * 
 *         if not vars.htsfile:             # <<<<<<<<<<<<<<
 *             raise ValueError('Cannot re-open htsfile')
 * 
*/
  __pyx_t_3 = (!(__pyx_v_vars->__pyx_base.htsfile != 0));
  if (unlikely(__pyx_t_3)) {

    /* "pysam/libcbcf.pyx":4210
 * 
 *         if not vars.htsfile:
 *             raise ValueError('Cannot re-open htsfile')             # <<<<<<<<<<<<<<
 * 
 *         # minimize overhead by re-using header and index.  This approach is
*/
    __pyx_t_5 = NULL;
    __Pyx_INCREF(__pyx_builtin_ValueError);
    __pyx_t_6 = __pyx_builtin_ValueError; 
    __pyx_t_7 = 1;
    {
      PyObject *__pyx_callargs[2] = {__pyx_t_5, __pyx_mstate_global->__pyx_kp_u_Cannot_re_open_htsfile};
      __pyx_t_1 = __Pyx_PyObject_FastCall(__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_1)) __PYX_ERR(0, 4210, __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, 4210, __pyx_L1_error)

    /* "pysam/libcbcf.pyx":4209
 *         vars.htsfile = self._open_htsfile()
 * 
 *         if not vars.htsfile:             # <<<<<<<<<<<<<<
 *             raise ValueError('Cannot re-open htsfile')
 * 
*/
  }

  /* "pysam/libcbcf.pyx":4214
 *         # minimize overhead by re-using header and index.  This approach is
 *         # currently risky, but see above for how this can be mitigated.
 *         vars.header         = self.header             # <<<<<<<<<<<<<<
 *         vars.index          = self.index
 * 
*/
  __pyx_t_1 = ((PyObject *)__pyx_v_self->header);
  __Pyx_INCREF(__pyx_t_1);
  __Pyx_GIVEREF(__pyx_t_1);
  __Pyx_GOTREF((PyObject *)__pyx_v_vars->header);
  __Pyx_DECREF((PyObject *)__pyx_v_vars->header);
  __pyx_v_vars->header = ((struct __pyx_obj_5pysam_7libcbcf_VariantHeader *)__pyx_t_1);
  __pyx_t_1 = 0;

  /* "pysam/libcbcf.pyx":4215
 *         # currently risky, but see above for how this can be mitigated.
 *         vars.header         = self.header
 *         vars.index          = self.index             # <<<<<<<<<<<<<<
 * 
 *         vars.filename       = self.filename
*/
  __pyx_t_1 = ((PyObject *)__pyx_v_self->index);
  __Pyx_INCREF(__pyx_t_1);
  __Pyx_GIVEREF(__pyx_t_1);
  __Pyx_GOTREF((PyObject *)__pyx_v_vars->index);
  __Pyx_DECREF((PyObject *)__pyx_v_vars->index);
  __pyx_v_vars->index = ((struct __pyx_obj_5pysam_7libcbcf_BaseIndex *)__pyx_t_1);
  __pyx_t_1 = 0;

  /* "pysam/libcbcf.pyx":4217
 *         vars.index          = self.index
 * 
 *         vars.filename       = self.filename             # <<<<<<<<<<<<<<
 *         vars.mode           = self.mode
 *         vars.threads        = self.threads
*/
  __pyx_t_1 = __pyx_v_self->__pyx_base.filename;
  __Pyx_INCREF(__pyx_t_1);
  __Pyx_GIVEREF(__pyx_t_1);
  __Pyx_GOTREF(__pyx_v_vars->__pyx_base.filename);
  __Pyx_DECREF(__pyx_v_vars->__pyx_base.filename);
  __pyx_v_vars->__pyx_base.filename = __pyx_t_1;
  __pyx_t_1 = 0;

  /* "pysam/libcbcf.pyx":4218
 * 
 *         vars.filename       = self.filename
 *         vars.mode           = self.mode             # <<<<<<<<<<<<<<
 *         vars.threads        = self.threads
 *         vars.index_filename = self.index_filename
*/
  __pyx_t_1 = __pyx_v_self->__pyx_base.mode;
  __Pyx_INCREF(__pyx_t_1);
  __Pyx_GIVEREF(__pyx_t_1);
  __Pyx_GOTREF(__pyx_v_vars->__pyx_base.mode);
  __Pyx_DECREF(__pyx_v_vars->__pyx_base.mode);
  __pyx_v_vars->__pyx_base.mode = __pyx_t_1;
  __pyx_t_1 = 0;

  /* "pysam/libcbcf.pyx":4219
 *         vars.filename       = self.filename
 *         vars.mode           = self.mode
 *         vars.threads        = self.threads             # <<<<<<<<<<<<<<
 *         vars.index_filename = self.index_filename
 *         vars.drop_samples   = self.drop_samples
*/
  __pyx_t_1 = __pyx_v_self->__pyx_base.threads;
  __Pyx_INCREF(__pyx_t_1);
  __Pyx_GIVEREF(__pyx_t_1);
  __Pyx_GOTREF(__pyx_v_vars->__pyx_base.threads);
  __Pyx_DECREF(__pyx_v_vars->__pyx_base.threads);
  __pyx_v_vars->__pyx_base.threads = __pyx_t_1;
  __pyx_t_1 = 0;

  /* "pysam/libcbcf.pyx":4220
 *         vars.mode           = self.mode
 *         vars.threads        = self.threads
 *         vars.index_filename = self.index_filename             # <<<<<<<<<<<<<<
 *         vars.drop_samples   = self.drop_samples
 *         vars.is_stream      = self.is_stream
*/
  __pyx_t_1 = __pyx_v_self->__pyx_base.index_filename;
  __Pyx_INCREF(__pyx_t_1);
  __Pyx_GIVEREF(__pyx_t_1);
  __Pyx_GOTREF(__pyx_v_vars->__pyx_base.index_filename);
  __Pyx_DECREF(__pyx_v_vars->__pyx_base.index_filename);
  __pyx_v_vars->__pyx_base.index_filename = __pyx_t_1;
  __pyx_t_1 = 0;

  /* "pysam/libcbcf.pyx":4221
 *         vars.threads        = self.threads
 *         vars.index_filename = self.index_filename
 *         vars.drop_samples   = self.drop_samples             # <<<<<<<<<<<<<<
 *         vars.is_stream      = self.is_stream
 *         vars.is_remote      = self.is_remote
*/
  __pyx_t_3 = __pyx_v_self->drop_samples;
  __pyx_v_vars->drop_samples = __pyx_t_3;

  /* "pysam/libcbcf.pyx":4222
 *         vars.index_filename = self.index_filename
 *         vars.drop_samples   = self.drop_samples
 *         vars.is_stream      = self.is_stream             # <<<<<<<<<<<<<<
 *         vars.is_remote      = self.is_remote
 *         vars.is_reading     = self.is_reading
*/
  __pyx_t_3 = __pyx_v_self->__pyx_base.is_stream;
  __pyx_v_vars->__pyx_base.is_stream = __pyx_t_3;

  /* "pysam/libcbcf.pyx":4223
 *         vars.drop_samples   = self.drop_samples
 *         vars.is_stream      = self.is_stream
 *         vars.is_remote      = self.is_remote             # <<<<<<<<<<<<<<
 *         vars.is_reading     = self.is_reading
 *         vars.start_offset   = self.start_offset
*/
  __pyx_t_3 = __pyx_v_self->__pyx_base.is_remote;
  __pyx_v_vars->__pyx_base.is_remote = __pyx_t_3;

  /* "pysam/libcbcf.pyx":4224
 *         vars.is_stream      = self.is_stream
 *         vars.is_remote      = self.is_remote
 *         vars.is_reading     = self.is_reading             # <<<<<<<<<<<<<<
 *         vars.start_offset   = self.start_offset
 *         vars.header_written = self.header_written
*/
  __pyx_t_3 = __pyx_v_self->is_reading;
  __pyx_v_vars->is_reading = __pyx_t_3;

  /* "pysam/libcbcf.pyx":4225
 *         vars.is_remote      = self.is_remote
 *         vars.is_reading     = self.is_reading
 *         vars.start_offset   = self.start_offset             # <<<<<<<<<<<<<<
 *         vars.header_written = self.header_written
 * 
*/
  __pyx_t_8 = __pyx_v_self->__pyx_base.start_offset;
  __pyx_v_vars->__pyx_base.start_offset = __pyx_t_8;

  /* "pysam/libcbcf.pyx":4226
 *         vars.is_reading     = self.is_reading
 *         vars.start_offset   = self.start_offset
 *         vars.header_written = self.header_written             # <<<<<<<<<<<<<<
 * 
 *         if self.htsfile.is_bin:
*/
  __pyx_t_3 = __pyx_v_self->header_written;
  __pyx_v_vars->header_written = __pyx_t_3;

  /* "pysam/libcbcf.pyx":4228
 *         vars.header_written = self.header_written
 * 
 *         if self.htsfile.is_bin:             # <<<<<<<<<<<<<<
 *             vars.seek(self.tell())
 *         else:
*/
  __pyx_t_3 = (__pyx_v_self->__pyx_base.htsfile->is_bin != 0);
  if (__pyx_t_3) {

    /* "pysam/libcbcf.pyx":4229
 * 
 *         if self.htsfile.is_bin:
 *             vars.seek(self.tell())             # <<<<<<<<<<<<<<
 *         else:
 *             with nogil:
*/
    __pyx_t_6 = ((PyObject *)__pyx_v_vars);
    __Pyx_INCREF(__pyx_t_6);
    __pyx_t_9 = ((PyObject *)__pyx_v_self);
    __Pyx_INCREF(__pyx_t_9);
    __pyx_t_7 = 0;
    {
      PyObject *__pyx_callargs[2] = {__pyx_t_9, NULL};
      __pyx_t_5 = __Pyx_PyObject_FastCallMethod(__pyx_mstate_global->__pyx_n_u_tell, __pyx_callargs+__pyx_t_7, (1-__pyx_t_7) | (1*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
      __Pyx_XDECREF(__pyx_t_9); __pyx_t_9 = 0;
      if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 4229, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_5);
    }
    __pyx_t_7 = 0;
    {
      PyObject *__pyx_callargs[2] = {__pyx_t_6, __pyx_t_5};
      __pyx_t_1 = __Pyx_PyObject_FastCallMethod(__pyx_mstate_global->__pyx_n_u_seek, __pyx_callargs+__pyx_t_7, (2-__pyx_t_7) | (1*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
      __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0;
      __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
      if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 4229, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_1);
    }
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

    /* "pysam/libcbcf.pyx":4228
 *         vars.header_written = self.header_written
 * 
 *         if self.htsfile.is_bin:             # <<<<<<<<<<<<<<
 *             vars.seek(self.tell())
 *         else:
*/
    goto __pyx_L5;
  }

  /* "pysam/libcbcf.pyx":4231
 *             vars.seek(self.tell())
 *         else:
 *             with nogil:             # <<<<<<<<<<<<<<
 *                 hdr = bcf_hdr_read(vars.htsfile)
 *             makeVariantHeader(hdr)
*/
  /*else*/ {
    {
        PyThreadState *_save;
        _save = NULL;
        Py_UNBLOCK_THREADS
        __Pyx_FastGIL_Remember();
        /*try:*/ {

          /* "pysam/libcbcf.pyx":4232
 *         else:
 *             with nogil:
 *                 hdr = bcf_hdr_read(vars.htsfile)             # <<<<<<<<<<<<<<
 *             makeVariantHeader(hdr)
 * 
*/
          __pyx_v_hdr = bcf_hdr_read(__pyx_v_vars->__pyx_base.htsfile);
        }

        /* "pysam/libcbcf.pyx":4231
 *             vars.seek(self.tell())
 *         else:
 *             with nogil:             # <<<<<<<<<<<<<<
 *                 hdr = bcf_hdr_read(vars.htsfile)
 *             makeVariantHeader(hdr)
*/
        /*finally:*/ {
          /*normal exit:*/{
            __Pyx_FastGIL_Forget();
            Py_BLOCK_THREADS
            goto __pyx_L8;
          }
          __pyx_L8:;
        }
    }

    /* "pysam/libcbcf.pyx":4233
 *             with nogil:
 *                 hdr = bcf_hdr_read(vars.htsfile)
 *             makeVariantHeader(hdr)             # <<<<<<<<<<<<<<
 * 
 *         return vars
*/
    __pyx_t_1 = ((PyObject *)__pyx_f_5pysam_7libcbcf_makeVariantHeader(__pyx_v_hdr)); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 4233, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  }
  __pyx_L5:;

  /* "pysam/libcbcf.pyx":4235
 *             makeVariantHeader(hdr)
 * 
 *         return vars             # <<<<<<<<<<<<<<
 * 
 *     def open(self, filename, mode='r',
*/
  __Pyx_XDECREF(__pyx_r);
  __Pyx_INCREF((PyObject *)__pyx_v_vars);
  __pyx_r = ((PyObject *)__pyx_v_vars);
  __Pyx_TraceReturnValue(__pyx_r, 92, 0, __PYX_ERR(0, 4235, __pyx_L1_error));
  goto __pyx_L0;

  /* "pysam/libcbcf.pyx":4199
 *         return makeVariantRecord(self.header, record)
 * 
 *     def copy(self):             # <<<<<<<<<<<<<<
 *         if not self.is_open:
 *             raise ValueError
*/

  /* 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_9);
  __Pyx_TraceException(__pyx_lineno, 0, 0);
  #if CYTHON_USE_SYS_MONITORING
  __Pyx_TraceExceptionUnwind(0, 0);
  #else
  __Pyx_TraceReturnValue(NULL, 0, 0, __PYX_ERR(0, 4199, __pyx_L1_error));
  #endif
  __Pyx_AddTraceback("pysam.libcbcf.VariantFile.copy", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF((PyObject *)__pyx_v_vars);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_PyMonitoring_ExitScope(0);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "pysam/libcbcf.pyx":4237
 *         return vars
 * 
 *     def open(self, filename, mode='r',             # <<<<<<<<<<<<<<
 *              index_filename=None,
 *              VariantHeader header=None,
*/

/* Python wrapper */
static PyObject *__pyx_pw_5pysam_7libcbcf_11VariantFile_15open(PyObject *__pyx_v_self, 
#if 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_5pysam_7libcbcf_11VariantFile_14open, "VariantFile.open(self, filename, mode='r', index_filename=None, VariantHeader header=None, drop_samples=False, duplicate_filehandle=True, ignore_truncation=False, threads=1)\n\nopen a vcf/bcf file.\n\nIf open is called on an existing VariantFile, the current file will be\nclosed and a new file will be opened.");
static PyMethodDef __pyx_mdef_5pysam_7libcbcf_11VariantFile_15open = {"open", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_5pysam_7libcbcf_11VariantFile_15open, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_5pysam_7libcbcf_11VariantFile_14open};
static PyObject *__pyx_pw_5pysam_7libcbcf_11VariantFile_15open(PyObject *__pyx_v_self, 
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
) {
  PyObject *__pyx_v_filename = 0;
  PyObject *__pyx_v_mode = 0;
  PyObject *__pyx_v_index_filename = 0;
  struct __pyx_obj_5pysam_7libcbcf_VariantHeader *__pyx_v_header = 0;
  PyObject *__pyx_v_drop_samples = 0;
  PyObject *__pyx_v_duplicate_filehandle = 0;
  PyObject *__pyx_v_ignore_truncation = 0;
  PyObject *__pyx_v_threads = 0;
  #if !CYTHON_METH_FASTCALL
  CYTHON_UNUSED Py_ssize_t __pyx_nargs;
  #endif
  CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
  PyObject* values[8] = {0,0,0,0,0,0,0,0};
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  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_filename,&__pyx_mstate_global->__pyx_n_u_mode,&__pyx_mstate_global->__pyx_n_u_index_filename,&__pyx_mstate_global->__pyx_n_u_header,&__pyx_mstate_global->__pyx_n_u_drop_samples,&__pyx_mstate_global->__pyx_n_u_duplicate_filehandle,&__pyx_mstate_global->__pyx_n_u_ignore_truncation,&__pyx_mstate_global->__pyx_n_u_threads,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, 4237, __pyx_L3_error)
    if (__pyx_kwds_len > 0) {
      switch (__pyx_nargs) {
        case  8:
        values[7] = __Pyx_ArgRef_FASTCALL(__pyx_args, 7);
        if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[7])) __PYX_ERR(0, 4237, __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, 4237, __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, 4237, __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, 4237, __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, 4237, __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, 4237, __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, 4237, __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, 4237, __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, 4237, __pyx_L3_error)
      if (!values[1]) values[1] = __Pyx_NewRef(((PyObject *)__pyx_mstate_global->__pyx_n_u_r));

      /* "pysam/libcbcf.pyx":4238
 * 
 *     def open(self, filename, mode='r',
 *              index_filename=None,             # <<<<<<<<<<<<<<
 *              VariantHeader header=None,
 *              drop_samples=False,
*/
      if (!values[2]) values[2] = __Pyx_NewRef(((PyObject *)Py_None));

      /* "pysam/libcbcf.pyx":4239
 *     def open(self, filename, mode='r',
 *              index_filename=None,
 *              VariantHeader header=None,             # <<<<<<<<<<<<<<
 *              drop_samples=False,
 *              duplicate_filehandle=True,
*/
      if (!values[3]) values[3] = __Pyx_NewRef((PyObject *)((struct __pyx_obj_5pysam_7libcbcf_VariantHeader *)Py_None));

      /* "pysam/libcbcf.pyx":4240
 *              index_filename=None,
 *              VariantHeader header=None,
 *              drop_samples=False,             # <<<<<<<<<<<<<<
 *              duplicate_filehandle=True,
 *              ignore_truncation=False,
*/
      if (!values[4]) values[4] = __Pyx_NewRef(((PyObject *)Py_False));

      /* "pysam/libcbcf.pyx":4241
 *              VariantHeader header=None,
 *              drop_samples=False,
 *              duplicate_filehandle=True,             # <<<<<<<<<<<<<<
 *              ignore_truncation=False,
 *              threads=1):
*/
      if (!values[5]) values[5] = __Pyx_NewRef(((PyObject *)Py_True));

      /* "pysam/libcbcf.pyx":4242
 *              drop_samples=False,
 *              duplicate_filehandle=True,
 *              ignore_truncation=False,             # <<<<<<<<<<<<<<
 *              threads=1):
 *         """open a vcf/bcf file.
*/
      if (!values[6]) values[6] = __Pyx_NewRef(((PyObject *)Py_False));
      if (!values[7]) values[7] = __Pyx_NewRef(((PyObject *)__pyx_mstate_global->__pyx_int_1));
      for (Py_ssize_t i = __pyx_nargs; i < 1; i++) {
        if (unlikely(!values[i])) { __Pyx_RaiseArgtupleInvalid("open", 0, 1, 8, i); __PYX_ERR(0, 4237, __pyx_L3_error) }
      }
    } else {
      switch (__pyx_nargs) {
        case  8:
        values[7] = __Pyx_ArgRef_FASTCALL(__pyx_args, 7);
        if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[7])) __PYX_ERR(0, 4237, __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, 4237, __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, 4237, __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, 4237, __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, 4237, __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, 4237, __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, 4237, __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, 4237, __pyx_L3_error)
        break;
        default: goto __pyx_L5_argtuple_error;
      }
      if (!values[1]) values[1] = __Pyx_NewRef(((PyObject *)__pyx_mstate_global->__pyx_n_u_r));

      /* "pysam/libcbcf.pyx":4238
 * 
 *     def open(self, filename, mode='r',
 *              index_filename=None,             # <<<<<<<<<<<<<<
 *              VariantHeader header=None,
 *              drop_samples=False,
*/
      if (!values[2]) values[2] = __Pyx_NewRef(((PyObject *)Py_None));

      /* "pysam/libcbcf.pyx":4239
 *     def open(self, filename, mode='r',
 *              index_filename=None,
 *              VariantHeader header=None,             # <<<<<<<<<<<<<<
 *              drop_samples=False,
 *              duplicate_filehandle=True,
*/
      if (!values[3]) values[3] = __Pyx_NewRef((PyObject *)((struct __pyx_obj_5pysam_7libcbcf_VariantHeader *)Py_None));

      /* "pysam/libcbcf.pyx":4240
 *              index_filename=None,
 *              VariantHeader header=None,
 *              drop_samples=False,             # <<<<<<<<<<<<<<
 *              duplicate_filehandle=True,
 *              ignore_truncation=False,
*/
      if (!values[4]) values[4] = __Pyx_NewRef(((PyObject *)Py_False));

      /* "pysam/libcbcf.pyx":4241
 *              VariantHeader header=None,
 *              drop_samples=False,
 *              duplicate_filehandle=True,             # <<<<<<<<<<<<<<
 *              ignore_truncation=False,
 *              threads=1):
*/
      if (!values[5]) values[5] = __Pyx_NewRef(((PyObject *)Py_True));

      /* "pysam/libcbcf.pyx":4242
 *              drop_samples=False,
 *              duplicate_filehandle=True,
 *              ignore_truncation=False,             # <<<<<<<<<<<<<<
 *              threads=1):
 *         """open a vcf/bcf file.
*/
      if (!values[6]) values[6] = __Pyx_NewRef(((PyObject *)Py_False));
      if (!values[7]) values[7] = __Pyx_NewRef(((PyObject *)__pyx_mstate_global->__pyx_int_1));
    }
    __pyx_v_filename = values[0];
    __pyx_v_mode = values[1];
    __pyx_v_index_filename = values[2];
    __pyx_v_header = ((struct __pyx_obj_5pysam_7libcbcf_VariantHeader *)values[3]);
    __pyx_v_drop_samples = values[4];
    __pyx_v_duplicate_filehandle = values[5];
    __pyx_v_ignore_truncation = values[6];
    __pyx_v_threads = values[7];
  }
  goto __pyx_L6_skip;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("open", 0, 1, 8, __pyx_nargs); __PYX_ERR(0, 4237, __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("pysam.libcbcf.VariantFile.open", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_header), __pyx_mstate_global->__pyx_ptype_5pysam_7libcbcf_VariantHeader, 1, "header", 0))) __PYX_ERR(0, 4239, __pyx_L1_error)
  __pyx_r = __pyx_pf_5pysam_7libcbcf_11VariantFile_14open(((struct __pyx_obj_5pysam_7libcbcf_VariantFile *)__pyx_v_self), __pyx_v_filename, __pyx_v_mode, __pyx_v_index_filename, __pyx_v_header, __pyx_v_drop_samples, __pyx_v_duplicate_filehandle, __pyx_v_ignore_truncation, __pyx_v_threads);

  /* "pysam/libcbcf.pyx":4237
 *         return vars
 * 
 *     def open(self, filename, mode='r',             # <<<<<<<<<<<<<<
 *              index_filename=None,
 *              VariantHeader header=None,
*/

  /* 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_5pysam_7libcbcf_11VariantFile_14open(struct __pyx_obj_5pysam_7libcbcf_VariantFile *__pyx_v_self, PyObject *__pyx_v_filename, PyObject *__pyx_v_mode, PyObject *__pyx_v_index_filename, struct __pyx_obj_5pysam_7libcbcf_VariantHeader *__pyx_v_header, PyObject *__pyx_v_drop_samples, PyObject *__pyx_v_duplicate_filehandle, PyObject *__pyx_v_ignore_truncation, PyObject *__pyx_v_threads) {
  bcf_hdr_t *__pyx_v_hdr;
  hts_idx_t *__pyx_v_idx;
  tbx_t *__pyx_v_tidx;
  char *__pyx_v_cfilename;
  char *__pyx_v_cindex_filename;
  PyObject *__pyx_v_format_modes = NULL;
  PyObject *__pyx_v_invalid_modes = NULL;
  PyObject *__pyx_9genexpr13__pyx_v_m = NULL;
  PyObject *__pyx_9genexpr14__pyx_v_m = NULL;
  PyObject *__pyx_r = NULL;
  __Pyx_TraceDeclarationsFunc
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  PyObject *__pyx_t_2 = NULL;
  int __pyx_t_3;
  PyObject *__pyx_t_4 = NULL;
  PyObject *__pyx_t_5 = NULL;
  size_t __pyx_t_6;
  int __pyx_t_7;
  Py_ssize_t __pyx_t_8;
  PyObject *(*__pyx_t_9)(PyObject *);
  PyObject *__pyx_t_10 = NULL;
  PyObject *__pyx_t_11 = NULL;
  PyObject *__pyx_t_12 = NULL;
  PyObject *__pyx_t_13 = NULL;
  PyObject *__pyx_t_14 = NULL;
  PyObject *__pyx_t_15 = NULL;
  char const *__pyx_t_16;
  int __pyx_t_17;
  htsFile *__pyx_t_18;
  struct __pyx_opt_args_5pysam_9libcutils_OSError_from_errno __pyx_t_19;
  PyObject *__pyx_t_20 = NULL;
  PyObject *__pyx_t_21 = NULL;
  char *__pyx_t_22;
  int64_t __pyx_t_23;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_TraceFrameInit(((PyObject *)__pyx_mstate_global->__pyx_codeobj_tab[372]))
  __Pyx_RefNannySetupContext("open", 0);
  __Pyx_TraceStartFunc("open", __pyx_f[0], 4237, 0, 0, 0, __PYX_ERR(0, 4237, __pyx_L1_error));
  __Pyx_INCREF(__pyx_v_filename);
  __Pyx_INCREF(__pyx_v_mode);
  __Pyx_INCREF(__pyx_v_index_filename);

  /* "pysam/libcbcf.pyx":4254
 *         cdef tbx_t *tidx
 *         cdef char *cfilename
 *         cdef char *cindex_filename = NULL             # <<<<<<<<<<<<<<
 *         cdef char *cmode
 * 
*/
  __pyx_v_cindex_filename = NULL;

  /* "pysam/libcbcf.pyx":4257
 *         cdef char *cmode
 * 
 *         if threads > 1 and ignore_truncation:             # <<<<<<<<<<<<<<
 *             # This won't raise errors if reaching a truncated alignment,
 *             # because bgzf_mt_reader in htslib does not deal with
*/
  __pyx_t_2 = PyObject_RichCompare(__pyx_v_threads, __pyx_mstate_global->__pyx_int_1, Py_GT); __Pyx_XGOTREF(__pyx_t_2); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 4257, __pyx_L1_error)
  __pyx_t_3 = __Pyx_PyObject_IsTrue(__pyx_t_2); if (unlikely((__pyx_t_3 < 0))) __PYX_ERR(0, 4257, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  if (__pyx_t_3) {
  } else {
    __pyx_t_1 = __pyx_t_3;
    goto __pyx_L4_bool_binop_done;
  }
  __pyx_t_3 = __Pyx_PyObject_IsTrue(__pyx_v_ignore_truncation); if (unlikely((__pyx_t_3 < 0))) __PYX_ERR(0, 4257, __pyx_L1_error)
  __pyx_t_1 = __pyx_t_3;
  __pyx_L4_bool_binop_done:;
  if (unlikely(__pyx_t_1)) {

    /* "pysam/libcbcf.pyx":4263
 *             # to bgzf_read (https://github.com/samtools/htslib/blob/1.7/bgzf.c#L888)
 *             # Better to avoid this (for now) than to produce seemingly correct results.
 *             raise ValueError('Cannot add extra threads when "ignore_truncation" is True')             # <<<<<<<<<<<<<<
 *         self.threads = threads
 * 
*/
    __pyx_t_4 = NULL;
    __Pyx_INCREF(__pyx_builtin_ValueError);
    __pyx_t_5 = __pyx_builtin_ValueError; 
    __pyx_t_6 = 1;
    {
      PyObject *__pyx_callargs[2] = {__pyx_t_4, __pyx_mstate_global->__pyx_kp_u_Cannot_add_extra_threads_when_ig};
      __pyx_t_2 = __Pyx_PyObject_FastCall(__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_2)) __PYX_ERR(0, 4263, __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, 4263, __pyx_L1_error)

    /* "pysam/libcbcf.pyx":4257
 *         cdef char *cmode
 * 
 *         if threads > 1 and ignore_truncation:             # <<<<<<<<<<<<<<
 *             # This won't raise errors if reaching a truncated alignment,
 *             # because bgzf_mt_reader in htslib does not deal with
*/
  }

  /* "pysam/libcbcf.pyx":4264
 *             # Better to avoid this (for now) than to produce seemingly correct results.
 *             raise ValueError('Cannot add extra threads when "ignore_truncation" is True')
 *         self.threads = threads             # <<<<<<<<<<<<<<
 * 
 *         # close a previously opened file
*/
  __Pyx_INCREF(__pyx_v_threads);
  __Pyx_GIVEREF(__pyx_v_threads);
  __Pyx_GOTREF(__pyx_v_self->__pyx_base.threads);
  __Pyx_DECREF(__pyx_v_self->__pyx_base.threads);
  __pyx_v_self->__pyx_base.threads = __pyx_v_threads;

  /* "pysam/libcbcf.pyx":4267
 * 
 *         # close a previously opened file
 *         if self.is_open:             # <<<<<<<<<<<<<<
 *             self.close()
 * 
*/
  __pyx_t_2 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_mstate_global->__pyx_n_u_is_open); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 4267, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_1 = __Pyx_PyObject_IsTrue(__pyx_t_2); if (unlikely((__pyx_t_1 < 0))) __PYX_ERR(0, 4267, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  if (__pyx_t_1) {

    /* "pysam/libcbcf.pyx":4268
 *         # close a previously opened file
 *         if self.is_open:
 *             self.close()             # <<<<<<<<<<<<<<
 * 
 *         if not mode or mode[0] not in 'rwa':
*/
    __pyx_t_5 = ((PyObject *)__pyx_v_self);
    __Pyx_INCREF(__pyx_t_5);
    __pyx_t_6 = 0;
    {
      PyObject *__pyx_callargs[2] = {__pyx_t_5, NULL};
      __pyx_t_2 = __Pyx_PyObject_FastCallMethod(__pyx_mstate_global->__pyx_n_u_close, __pyx_callargs+__pyx_t_6, (1-__pyx_t_6) | (1*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
      __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
      if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 4268, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_2);
    }
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

    /* "pysam/libcbcf.pyx":4267
 * 
 *         # close a previously opened file
 *         if self.is_open:             # <<<<<<<<<<<<<<
 *             self.close()
 * 
*/
  }

  /* "pysam/libcbcf.pyx":4270
 *             self.close()
 * 
 *         if not mode or mode[0] not in 'rwa':             # <<<<<<<<<<<<<<
 *             raise ValueError('mode must begin with r, w or a')
 * 
*/
  __pyx_t_3 = __Pyx_PyObject_IsTrue(__pyx_v_mode); if (unlikely((__pyx_t_3 < 0))) __PYX_ERR(0, 4270, __pyx_L1_error)
  __pyx_t_7 = (!__pyx_t_3);
  if (!__pyx_t_7) {
  } else {
    __pyx_t_1 = __pyx_t_7;
    goto __pyx_L8_bool_binop_done;
  }
  __pyx_t_2 = __Pyx_GetItemInt(__pyx_v_mode, 0, long, 1, __Pyx_PyLong_From_long, 0, 0, 1, 1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 4270, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_7 = (__Pyx_PyUnicode_ContainsTF(__pyx_t_2, __pyx_mstate_global->__pyx_n_u_rwa, Py_NE)); if (unlikely((__pyx_t_7 < 0))) __PYX_ERR(0, 4270, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __pyx_t_1 = __pyx_t_7;
  __pyx_L8_bool_binop_done:;
  if (unlikely(__pyx_t_1)) {

    /* "pysam/libcbcf.pyx":4271
 * 
 *         if not mode or mode[0] not in 'rwa':
 *             raise ValueError('mode must begin with r, w or a')             # <<<<<<<<<<<<<<
 * 
 *         self.duplicate_filehandle = duplicate_filehandle
*/
    __pyx_t_5 = NULL;
    __Pyx_INCREF(__pyx_builtin_ValueError);
    __pyx_t_4 = __pyx_builtin_ValueError; 
    __pyx_t_6 = 1;
    {
      PyObject *__pyx_callargs[2] = {__pyx_t_5, __pyx_mstate_global->__pyx_kp_u_mode_must_begin_with_r_w_or_a};
      __pyx_t_2 = __Pyx_PyObject_FastCall(__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_2)) __PYX_ERR(0, 4271, __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, 4271, __pyx_L1_error)

    /* "pysam/libcbcf.pyx":4270
 *             self.close()
 * 
 *         if not mode or mode[0] not in 'rwa':             # <<<<<<<<<<<<<<
 *             raise ValueError('mode must begin with r, w or a')
 * 
*/
  }

  /* "pysam/libcbcf.pyx":4273
 *             raise ValueError('mode must begin with r, w or a')
 * 
 *         self.duplicate_filehandle = duplicate_filehandle             # <<<<<<<<<<<<<<
 * 
 *         format_modes = [m for m in mode[1:] if m in 'bcguz']
*/
  __pyx_t_1 = __Pyx_PyObject_IsTrue(__pyx_v_duplicate_filehandle); if (unlikely((__pyx_t_1 == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 4273, __pyx_L1_error)
  __pyx_v_self->__pyx_base.duplicate_filehandle = __pyx_t_1;

  /* "pysam/libcbcf.pyx":4275
 *         self.duplicate_filehandle = duplicate_filehandle
 * 
 *         format_modes = [m for m in mode[1:] if m in 'bcguz']             # <<<<<<<<<<<<<<
 *         if len(format_modes) > 1:
 *             raise ValueError('mode contains conflicting format specifiers: {}'.format(''.join(format_modes)))
*/
  { /* enter inner scope */
    __pyx_t_2 = PyList_New(0); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 4275, __pyx_L12_error)
    __Pyx_GOTREF(__pyx_t_2);
    __pyx_t_4 = __Pyx_PyObject_GetSlice(__pyx_v_mode, 1, 0, NULL, NULL, &__pyx_mstate_global->__pyx_slice[0], 1, 0, 1); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 4275, __pyx_L12_error)
    __Pyx_GOTREF(__pyx_t_4);
    if (likely(PyList_CheckExact(__pyx_t_4)) || PyTuple_CheckExact(__pyx_t_4)) {
      __pyx_t_5 = __pyx_t_4; __Pyx_INCREF(__pyx_t_5);
      __pyx_t_8 = 0;
      __pyx_t_9 = NULL;
    } else {
      __pyx_t_8 = -1; __pyx_t_5 = PyObject_GetIter(__pyx_t_4); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 4275, __pyx_L12_error)
      __Pyx_GOTREF(__pyx_t_5);
      __pyx_t_9 = (CYTHON_COMPILING_IN_LIMITED_API) ? PyIter_Next : __Pyx_PyObject_GetIterNextFunc(__pyx_t_5); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 4275, __pyx_L12_error)
    }
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    for (;;) {
      if (likely(!__pyx_t_9)) {
        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, 4275, __pyx_L12_error)
            #endif
            if (__pyx_t_8 >= __pyx_temp) break;
          }
          __pyx_t_4 = __Pyx_PyList_GetItemRef(__pyx_t_5, __pyx_t_8);
          ++__pyx_t_8;
        } 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, 4275, __pyx_L12_error)
            #endif
            if (__pyx_t_8 >= __pyx_temp) break;
          }
          #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
          __pyx_t_4 = __Pyx_NewRef(PyTuple_GET_ITEM(__pyx_t_5, __pyx_t_8));
          #else
          __pyx_t_4 = __Pyx_PySequence_ITEM(__pyx_t_5, __pyx_t_8);
          #endif
          ++__pyx_t_8;
        }
        if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 4275, __pyx_L12_error)
      } else {
        __pyx_t_4 = __pyx_t_9(__pyx_t_5);
        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, 4275, __pyx_L12_error)
            PyErr_Clear();
          }
          break;
        }
      }
      __Pyx_GOTREF(__pyx_t_4);
      __Pyx_XDECREF_SET(__pyx_9genexpr13__pyx_v_m, __pyx_t_4);
      __pyx_t_4 = 0;
      __pyx_t_1 = (__Pyx_PyUnicode_ContainsTF(__pyx_9genexpr13__pyx_v_m, __pyx_mstate_global->__pyx_n_u_bcguz, Py_EQ)); if (unlikely((__pyx_t_1 < 0))) __PYX_ERR(0, 4275, __pyx_L12_error)
      if (__pyx_t_1) {
        if (unlikely(__Pyx_ListComp_Append(__pyx_t_2, (PyObject*)__pyx_9genexpr13__pyx_v_m))) __PYX_ERR(0, 4275, __pyx_L12_error)
      }
    }
    __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
    __Pyx_XDECREF(__pyx_9genexpr13__pyx_v_m); __pyx_9genexpr13__pyx_v_m = 0;
    goto __pyx_L17_exit_scope;
    __pyx_L12_error:;
    __Pyx_XDECREF(__pyx_9genexpr13__pyx_v_m); __pyx_9genexpr13__pyx_v_m = 0;
    goto __pyx_L1_error;
    __pyx_L17_exit_scope:;
  } /* exit inner scope */
  __pyx_v_format_modes = ((PyObject*)__pyx_t_2);
  __pyx_t_2 = 0;

  /* "pysam/libcbcf.pyx":4276
 * 
 *         format_modes = [m for m in mode[1:] if m in 'bcguz']
 *         if len(format_modes) > 1:             # <<<<<<<<<<<<<<
 *             raise ValueError('mode contains conflicting format specifiers: {}'.format(''.join(format_modes)))
 * 
*/
  __pyx_t_8 = __Pyx_PyList_GET_SIZE(__pyx_v_format_modes); if (unlikely(__pyx_t_8 == ((Py_ssize_t)-1))) __PYX_ERR(0, 4276, __pyx_L1_error)
  __pyx_t_1 = (__pyx_t_8 > 1);
  if (unlikely(__pyx_t_1)) {

    /* "pysam/libcbcf.pyx":4277
 *         format_modes = [m for m in mode[1:] if m in 'bcguz']
 *         if len(format_modes) > 1:
 *             raise ValueError('mode contains conflicting format specifiers: {}'.format(''.join(format_modes)))             # <<<<<<<<<<<<<<
 * 
 *         invalid_modes = [m for m in mode[1:] if m not in 'bcguz0123456789ex']
*/
    __pyx_t_5 = NULL;
    __Pyx_INCREF(__pyx_builtin_ValueError);
    __pyx_t_4 = __pyx_builtin_ValueError; 
    __pyx_t_11 = __pyx_mstate_global->__pyx_kp_u_mode_contains_conflicting_format;
    __Pyx_INCREF(__pyx_t_11);
    __pyx_t_12 = PyUnicode_Join(__pyx_mstate_global->__pyx_kp_u__2, __pyx_v_format_modes); if (unlikely(!__pyx_t_12)) __PYX_ERR(0, 4277, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_12);
    __pyx_t_6 = 0;
    {
      PyObject *__pyx_callargs[2] = {__pyx_t_11, __pyx_t_12};
      __pyx_t_10 = __Pyx_PyObject_FastCallMethod(__pyx_mstate_global->__pyx_n_u_format, __pyx_callargs+__pyx_t_6, (2-__pyx_t_6) | (1*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
      __Pyx_XDECREF(__pyx_t_11); __pyx_t_11 = 0;
      __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0;
      if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 4277, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_10);
    }
    __pyx_t_6 = 1;
    {
      PyObject *__pyx_callargs[2] = {__pyx_t_5, __pyx_t_10};
      __pyx_t_2 = __Pyx_PyObject_FastCall(__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_10); __pyx_t_10 = 0;
      __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
      if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 4277, __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, 4277, __pyx_L1_error)

    /* "pysam/libcbcf.pyx":4276
 * 
 *         format_modes = [m for m in mode[1:] if m in 'bcguz']
 *         if len(format_modes) > 1:             # <<<<<<<<<<<<<<
 *             raise ValueError('mode contains conflicting format specifiers: {}'.format(''.join(format_modes)))
 * 
*/
  }

  /* "pysam/libcbcf.pyx":4279
 *             raise ValueError('mode contains conflicting format specifiers: {}'.format(''.join(format_modes)))
 * 
 *         invalid_modes = [m for m in mode[1:] if m not in 'bcguz0123456789ex']             # <<<<<<<<<<<<<<
 *         if invalid_modes:
 *             raise ValueError('invalid mode options: {}'.format(''.join(invalid_modes)))
*/
  { /* enter inner scope */
    __pyx_t_2 = PyList_New(0); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 4279, __pyx_L21_error)
    __Pyx_GOTREF(__pyx_t_2);
    __pyx_t_4 = __Pyx_PyObject_GetSlice(__pyx_v_mode, 1, 0, NULL, NULL, &__pyx_mstate_global->__pyx_slice[0], 1, 0, 1); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 4279, __pyx_L21_error)
    __Pyx_GOTREF(__pyx_t_4);
    if (likely(PyList_CheckExact(__pyx_t_4)) || PyTuple_CheckExact(__pyx_t_4)) {
      __pyx_t_10 = __pyx_t_4; __Pyx_INCREF(__pyx_t_10);
      __pyx_t_8 = 0;
      __pyx_t_9 = NULL;
    } else {
      __pyx_t_8 = -1; __pyx_t_10 = PyObject_GetIter(__pyx_t_4); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 4279, __pyx_L21_error)
      __Pyx_GOTREF(__pyx_t_10);
      __pyx_t_9 = (CYTHON_COMPILING_IN_LIMITED_API) ? PyIter_Next : __Pyx_PyObject_GetIterNextFunc(__pyx_t_10); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 4279, __pyx_L21_error)
    }
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    for (;;) {
      if (likely(!__pyx_t_9)) {
        if (likely(PyList_CheckExact(__pyx_t_10))) {
          {
            Py_ssize_t __pyx_temp = __Pyx_PyList_GET_SIZE(__pyx_t_10);
            #if !CYTHON_ASSUME_SAFE_SIZE
            if (unlikely((__pyx_temp < 0))) __PYX_ERR(0, 4279, __pyx_L21_error)
            #endif
            if (__pyx_t_8 >= __pyx_temp) break;
          }
          __pyx_t_4 = __Pyx_PyList_GetItemRef(__pyx_t_10, __pyx_t_8);
          ++__pyx_t_8;
        } else {
          {
            Py_ssize_t __pyx_temp = __Pyx_PyTuple_GET_SIZE(__pyx_t_10);
            #if !CYTHON_ASSUME_SAFE_SIZE
            if (unlikely((__pyx_temp < 0))) __PYX_ERR(0, 4279, __pyx_L21_error)
            #endif
            if (__pyx_t_8 >= __pyx_temp) break;
          }
          #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
          __pyx_t_4 = __Pyx_NewRef(PyTuple_GET_ITEM(__pyx_t_10, __pyx_t_8));
          #else
          __pyx_t_4 = __Pyx_PySequence_ITEM(__pyx_t_10, __pyx_t_8);
          #endif
          ++__pyx_t_8;
        }
        if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 4279, __pyx_L21_error)
      } else {
        __pyx_t_4 = __pyx_t_9(__pyx_t_10);
        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, 4279, __pyx_L21_error)
            PyErr_Clear();
          }
          break;
        }
      }
      __Pyx_GOTREF(__pyx_t_4);
      __Pyx_XDECREF_SET(__pyx_9genexpr14__pyx_v_m, __pyx_t_4);
      __pyx_t_4 = 0;
      __pyx_t_1 = (__Pyx_PyUnicode_ContainsTF(__pyx_9genexpr14__pyx_v_m, __pyx_mstate_global->__pyx_n_u_bcguz0123456789ex, Py_NE)); if (unlikely((__pyx_t_1 < 0))) __PYX_ERR(0, 4279, __pyx_L21_error)
      if (__pyx_t_1) {
        if (unlikely(__Pyx_ListComp_Append(__pyx_t_2, (PyObject*)__pyx_9genexpr14__pyx_v_m))) __PYX_ERR(0, 4279, __pyx_L21_error)
      }
    }
    __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
    __Pyx_XDECREF(__pyx_9genexpr14__pyx_v_m); __pyx_9genexpr14__pyx_v_m = 0;
    goto __pyx_L26_exit_scope;
    __pyx_L21_error:;
    __Pyx_XDECREF(__pyx_9genexpr14__pyx_v_m); __pyx_9genexpr14__pyx_v_m = 0;
    goto __pyx_L1_error;
    __pyx_L26_exit_scope:;
  } /* exit inner scope */
  __pyx_v_invalid_modes = ((PyObject*)__pyx_t_2);
  __pyx_t_2 = 0;

  /* "pysam/libcbcf.pyx":4280
 * 
 *         invalid_modes = [m for m in mode[1:] if m not in 'bcguz0123456789ex']
 *         if invalid_modes:             # <<<<<<<<<<<<<<
 *             raise ValueError('invalid mode options: {}'.format(''.join(invalid_modes)))
 * 
*/
  __pyx_t_1 = (__Pyx_PyList_GET_SIZE(__pyx_v_invalid_modes) != 0);
  if (unlikely(((!CYTHON_ASSUME_SAFE_MACROS) && __pyx_t_1 < 0))) __PYX_ERR(0, 4280, __pyx_L1_error)
  if (unlikely(__pyx_t_1)) {

    /* "pysam/libcbcf.pyx":4281
 *         invalid_modes = [m for m in mode[1:] if m not in 'bcguz0123456789ex']
 *         if invalid_modes:
 *             raise ValueError('invalid mode options: {}'.format(''.join(invalid_modes)))             # <<<<<<<<<<<<<<
 * 
 *         # Autodetect mode from filename
*/
    __pyx_t_10 = NULL;
    __Pyx_INCREF(__pyx_builtin_ValueError);
    __pyx_t_4 = __pyx_builtin_ValueError; 
    __pyx_t_12 = __pyx_mstate_global->__pyx_kp_u_invalid_mode_options;
    __Pyx_INCREF(__pyx_t_12);
    __pyx_t_11 = PyUnicode_Join(__pyx_mstate_global->__pyx_kp_u__2, __pyx_v_invalid_modes); if (unlikely(!__pyx_t_11)) __PYX_ERR(0, 4281, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_11);
    __pyx_t_6 = 0;
    {
      PyObject *__pyx_callargs[2] = {__pyx_t_12, __pyx_t_11};
      __pyx_t_5 = __Pyx_PyObject_FastCallMethod(__pyx_mstate_global->__pyx_n_u_format, __pyx_callargs+__pyx_t_6, (2-__pyx_t_6) | (1*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
      __Pyx_XDECREF(__pyx_t_12); __pyx_t_12 = 0;
      __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0;
      if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 4281, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_5);
    }
    __pyx_t_6 = 1;
    {
      PyObject *__pyx_callargs[2] = {__pyx_t_10, __pyx_t_5};
      __pyx_t_2 = __Pyx_PyObject_FastCall(__pyx_t_4, __pyx_callargs+__pyx_t_6, (2-__pyx_t_6) | (__pyx_t_6*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
      __Pyx_XDECREF(__pyx_t_10); __pyx_t_10 = 0;
      __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
      __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
      if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 4281, __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, 4281, __pyx_L1_error)

    /* "pysam/libcbcf.pyx":4280
 * 
 *         invalid_modes = [m for m in mode[1:] if m not in 'bcguz0123456789ex']
 *         if invalid_modes:             # <<<<<<<<<<<<<<
 *             raise ValueError('invalid mode options: {}'.format(''.join(invalid_modes)))
 * 
*/
  }

  /* "pysam/libcbcf.pyx":4284
 * 
 *         # Autodetect mode from filename
 *         if mode == 'w' and isinstance(filename, str):             # <<<<<<<<<<<<<<
 *             if filename.endswith('.gz'):
 *                 mode = 'wz'
*/
  __pyx_t_7 = (__Pyx_PyUnicode_Equals(__pyx_v_mode, __pyx_mstate_global->__pyx_n_u_w, Py_EQ)); if (unlikely((__pyx_t_7 < 0))) __PYX_ERR(0, 4284, __pyx_L1_error)
  if (__pyx_t_7) {
  } else {
    __pyx_t_1 = __pyx_t_7;
    goto __pyx_L29_bool_binop_done;
  }
  __pyx_t_7 = PyUnicode_Check(__pyx_v_filename); 
  __pyx_t_1 = __pyx_t_7;
  __pyx_L29_bool_binop_done:;
  if (__pyx_t_1) {

    /* "pysam/libcbcf.pyx":4285
 *         # Autodetect mode from filename
 *         if mode == 'w' and isinstance(filename, str):
 *             if filename.endswith('.gz'):             # <<<<<<<<<<<<<<
 *                 mode = 'wz'
 *             elif filename.endswith('.bcf'):
*/
    __pyx_t_4 = __pyx_v_filename;
    __Pyx_INCREF(__pyx_t_4);
    __pyx_t_6 = 0;
    {
      PyObject *__pyx_callargs[2] = {__pyx_t_4, __pyx_mstate_global->__pyx_kp_u_gz};
      __pyx_t_2 = __Pyx_PyObject_FastCallMethod(__pyx_mstate_global->__pyx_n_u_endswith, __pyx_callargs+__pyx_t_6, (2-__pyx_t_6) | (1*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
      __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
      if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 4285, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_2);
    }
    __pyx_t_1 = __Pyx_PyObject_IsTrue(__pyx_t_2); if (unlikely((__pyx_t_1 < 0))) __PYX_ERR(0, 4285, __pyx_L1_error)
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    if (__pyx_t_1) {

      /* "pysam/libcbcf.pyx":4286
 *         if mode == 'w' and isinstance(filename, str):
 *             if filename.endswith('.gz'):
 *                 mode = 'wz'             # <<<<<<<<<<<<<<
 *             elif filename.endswith('.bcf'):
 *                 mode = 'wb'
*/
      __Pyx_INCREF(__pyx_mstate_global->__pyx_n_u_wz);
      __Pyx_DECREF_SET(__pyx_v_mode, __pyx_mstate_global->__pyx_n_u_wz);

      /* "pysam/libcbcf.pyx":4285
 *         # Autodetect mode from filename
 *         if mode == 'w' and isinstance(filename, str):
 *             if filename.endswith('.gz'):             # <<<<<<<<<<<<<<
 *                 mode = 'wz'
 *             elif filename.endswith('.bcf'):
*/
      goto __pyx_L31;
    }

    /* "pysam/libcbcf.pyx":4287
 *             if filename.endswith('.gz'):
 *                 mode = 'wz'
 *             elif filename.endswith('.bcf'):             # <<<<<<<<<<<<<<
 *                 mode = 'wb'
 * 
*/
    __pyx_t_4 = __pyx_v_filename;
    __Pyx_INCREF(__pyx_t_4);
    __pyx_t_6 = 0;
    {
      PyObject *__pyx_callargs[2] = {__pyx_t_4, __pyx_mstate_global->__pyx_kp_u_bcf_2};
      __pyx_t_2 = __Pyx_PyObject_FastCallMethod(__pyx_mstate_global->__pyx_n_u_endswith, __pyx_callargs+__pyx_t_6, (2-__pyx_t_6) | (1*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
      __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
      if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 4287, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_2);
    }
    __pyx_t_1 = __Pyx_PyObject_IsTrue(__pyx_t_2); if (unlikely((__pyx_t_1 < 0))) __PYX_ERR(0, 4287, __pyx_L1_error)
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    if (__pyx_t_1) {

      /* "pysam/libcbcf.pyx":4288
 *                 mode = 'wz'
 *             elif filename.endswith('.bcf'):
 *                 mode = 'wb'             # <<<<<<<<<<<<<<
 * 
 *         # for htslib, wbu seems to not work
*/
      __Pyx_INCREF(__pyx_mstate_global->__pyx_n_u_wb);
      __Pyx_DECREF_SET(__pyx_v_mode, __pyx_mstate_global->__pyx_n_u_wb);

      /* "pysam/libcbcf.pyx":4287
 *             if filename.endswith('.gz'):
 *                 mode = 'wz'
 *             elif filename.endswith('.bcf'):             # <<<<<<<<<<<<<<
 *                 mode = 'wb'
 * 
*/
    }
    __pyx_L31:;

    /* "pysam/libcbcf.pyx":4284
 * 
 *         # Autodetect mode from filename
 *         if mode == 'w' and isinstance(filename, str):             # <<<<<<<<<<<<<<
 *             if filename.endswith('.gz'):
 *                 mode = 'wz'
*/
  }

  /* "pysam/libcbcf.pyx":4291
 * 
 *         # for htslib, wbu seems to not work
 *         if mode == 'wbu':             # <<<<<<<<<<<<<<
 *             mode = 'wb0'
 * 
*/
  __pyx_t_1 = (__Pyx_PyUnicode_Equals(__pyx_v_mode, __pyx_mstate_global->__pyx_n_u_wbu, Py_EQ)); if (unlikely((__pyx_t_1 < 0))) __PYX_ERR(0, 4291, __pyx_L1_error)
  if (__pyx_t_1) {

    /* "pysam/libcbcf.pyx":4292
 *         # for htslib, wbu seems to not work
 *         if mode == 'wbu':
 *             mode = 'wb0'             # <<<<<<<<<<<<<<
 * 
 *         self.mode = mode = force_bytes(mode)
*/
    __Pyx_INCREF(__pyx_mstate_global->__pyx_n_u_wb0);
    __Pyx_DECREF_SET(__pyx_v_mode, __pyx_mstate_global->__pyx_n_u_wb0);

    /* "pysam/libcbcf.pyx":4291
 * 
 *         # for htslib, wbu seems to not work
 *         if mode == 'wbu':             # <<<<<<<<<<<<<<
 *             mode = 'wb0'
 * 
*/
  }

  /* "pysam/libcbcf.pyx":4294
 *             mode = 'wb0'
 * 
 *         self.mode = mode = force_bytes(mode)             # <<<<<<<<<<<<<<
 *         try:
 *             filename = encode_filename(filename)
*/
  __pyx_t_2 = __pyx_f_5pysam_9libcutils_force_bytes(__pyx_v_mode, NULL); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 4294, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_INCREF(__pyx_t_2);
  __Pyx_GIVEREF(__pyx_t_2);
  __Pyx_GOTREF(__pyx_v_self->__pyx_base.mode);
  __Pyx_DECREF(__pyx_v_self->__pyx_base.mode);
  __pyx_v_self->__pyx_base.mode = __pyx_t_2;
  __Pyx_INCREF(__pyx_t_2);
  __Pyx_DECREF_SET(__pyx_v_mode, __pyx_t_2);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

  /* "pysam/libcbcf.pyx":4295
 * 
 *         self.mode = mode = force_bytes(mode)
 *         try:             # <<<<<<<<<<<<<<
 *             filename = encode_filename(filename)
 *             self.is_remote = hisremote(filename)
*/
  {
    __Pyx_PyThreadState_declare
    __Pyx_PyThreadState_assign
    __Pyx_ExceptionSave(&__pyx_t_13, &__pyx_t_14, &__pyx_t_15);
    __Pyx_XGOTREF(__pyx_t_13);
    __Pyx_XGOTREF(__pyx_t_14);
    __Pyx_XGOTREF(__pyx_t_15);
    /*try:*/ {

      /* "pysam/libcbcf.pyx":4296
 *         self.mode = mode = force_bytes(mode)
 *         try:
 *             filename = encode_filename(filename)             # <<<<<<<<<<<<<<
 *             self.is_remote = hisremote(filename)
 *             self.is_stream = filename == b'-'
*/
      __pyx_t_2 = __pyx_f_5pysam_9libcutils_encode_filename(__pyx_v_filename); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 4296, __pyx_L33_error)
      __Pyx_GOTREF(__pyx_t_2);
      __Pyx_DECREF_SET(__pyx_v_filename, __pyx_t_2);
      __pyx_t_2 = 0;

      /* "pysam/libcbcf.pyx":4297
 *         try:
 *             filename = encode_filename(filename)
 *             self.is_remote = hisremote(filename)             # <<<<<<<<<<<<<<
 *             self.is_stream = filename == b'-'
 *         except TypeError:
*/
      __pyx_t_16 = __Pyx_PyObject_AsString(__pyx_v_filename); if (unlikely((!__pyx_t_16) && PyErr_Occurred())) __PYX_ERR(0, 4297, __pyx_L33_error)
      __pyx_v_self->__pyx_base.is_remote = hisremote(__pyx_t_16);

      /* "pysam/libcbcf.pyx":4298
 *             filename = encode_filename(filename)
 *             self.is_remote = hisremote(filename)
 *             self.is_stream = filename == b'-'             # <<<<<<<<<<<<<<
 *         except TypeError:
 *             filename = filename
*/
      __pyx_t_2 = PyObject_RichCompare(__pyx_v_filename, __pyx_mstate_global->__pyx_kp_b__11, Py_EQ); __Pyx_XGOTREF(__pyx_t_2); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 4298, __pyx_L33_error)
      __pyx_t_1 = __Pyx_PyObject_IsTrue(__pyx_t_2); if (unlikely((__pyx_t_1 == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 4298, __pyx_L33_error)
      __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
      __pyx_v_self->__pyx_base.is_stream = __pyx_t_1;

      /* "pysam/libcbcf.pyx":4295
 * 
 *         self.mode = mode = force_bytes(mode)
 *         try:             # <<<<<<<<<<<<<<
 *             filename = encode_filename(filename)
 *             self.is_remote = hisremote(filename)
*/
    }
    __Pyx_XDECREF(__pyx_t_13); __pyx_t_13 = 0;
    __Pyx_XDECREF(__pyx_t_14); __pyx_t_14 = 0;
    __Pyx_XDECREF(__pyx_t_15); __pyx_t_15 = 0;
    goto __pyx_L38_try_end;
    __pyx_L33_error:;
    __Pyx_XDECREF(__pyx_t_10); __pyx_t_10 = 0;
    __Pyx_XDECREF(__pyx_t_11); __pyx_t_11 = 0;
    __Pyx_XDECREF(__pyx_t_12); __pyx_t_12 = 0;
    __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
    __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
    __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
    __Pyx_TraceException(__pyx_lineno, 0, 0);

    /* "pysam/libcbcf.pyx":4299
 *             self.is_remote = hisremote(filename)
 *             self.is_stream = filename == b'-'
 *         except TypeError:             # <<<<<<<<<<<<<<
 *             filename = filename
 *             self.is_remote = False
*/
    __pyx_t_17 = __Pyx_PyErr_ExceptionMatches(__pyx_builtin_TypeError);
    if (__pyx_t_17) {
      __Pyx_AddTraceback("pysam.libcbcf.VariantFile.open", __pyx_clineno, __pyx_lineno, __pyx_filename);
      __Pyx_TraceExceptionHandled(0);
      if (__Pyx_GetException(&__pyx_t_2, &__pyx_t_4, &__pyx_t_5) < 0) __PYX_ERR(0, 4299, __pyx_L35_except_error)
      __Pyx_XGOTREF(__pyx_t_2);
      __Pyx_XGOTREF(__pyx_t_4);
      __Pyx_XGOTREF(__pyx_t_5);
      __Pyx_TraceExceptionDone();

      /* "pysam/libcbcf.pyx":4300
 *             self.is_stream = filename == b'-'
 *         except TypeError:
 *             filename = filename             # <<<<<<<<<<<<<<
 *             self.is_remote = False
 *             self.is_stream = True
*/
      __Pyx_INCREF(__pyx_v_filename);
      __Pyx_DECREF_SET(__pyx_v_filename, __pyx_v_filename);

      /* "pysam/libcbcf.pyx":4301
 *         except TypeError:
 *             filename = filename
 *             self.is_remote = False             # <<<<<<<<<<<<<<
 *             self.is_stream = True
 * 
*/
      __pyx_v_self->__pyx_base.is_remote = 0;

      /* "pysam/libcbcf.pyx":4302
 *             filename = filename
 *             self.is_remote = False
 *             self.is_stream = True             # <<<<<<<<<<<<<<
 * 
 *         self.filename = filename
*/
      __pyx_v_self->__pyx_base.is_stream = 1;
      __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
      __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
      __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
      goto __pyx_L34_exception_handled;
    }
    goto __pyx_L35_except_error;

    /* "pysam/libcbcf.pyx":4295
 * 
 *         self.mode = mode = force_bytes(mode)
 *         try:             # <<<<<<<<<<<<<<
 *             filename = encode_filename(filename)
 *             self.is_remote = hisremote(filename)
*/
    __pyx_L35_except_error:;
    __Pyx_XGIVEREF(__pyx_t_13);
    __Pyx_XGIVEREF(__pyx_t_14);
    __Pyx_XGIVEREF(__pyx_t_15);
    __Pyx_ExceptionReset(__pyx_t_13, __pyx_t_14, __pyx_t_15);
    goto __pyx_L1_error;
    __pyx_L34_exception_handled:;
    __Pyx_XGIVEREF(__pyx_t_13);
    __Pyx_XGIVEREF(__pyx_t_14);
    __Pyx_XGIVEREF(__pyx_t_15);
    __Pyx_ExceptionReset(__pyx_t_13, __pyx_t_14, __pyx_t_15);
    __pyx_L38_try_end:;
  }

  /* "pysam/libcbcf.pyx":4304
 *             self.is_stream = True
 * 
 *         self.filename = filename             # <<<<<<<<<<<<<<
 * 
 *         if index_filename is not None:
*/
  __Pyx_INCREF(__pyx_v_filename);
  __Pyx_GIVEREF(__pyx_v_filename);
  __Pyx_GOTREF(__pyx_v_self->__pyx_base.filename);
  __Pyx_DECREF(__pyx_v_self->__pyx_base.filename);
  __pyx_v_self->__pyx_base.filename = __pyx_v_filename;

  /* "pysam/libcbcf.pyx":4306
 *         self.filename = filename
 * 
 *         if index_filename is not None:             # <<<<<<<<<<<<<<
 *             self.index_filename = index_filename = encode_filename(index_filename)
 *         else:
*/
  __pyx_t_1 = (__pyx_v_index_filename != Py_None);
  if (__pyx_t_1) {

    /* "pysam/libcbcf.pyx":4307
 * 
 *         if index_filename is not None:
 *             self.index_filename = index_filename = encode_filename(index_filename)             # <<<<<<<<<<<<<<
 *         else:
 *             self.index_filename = None
*/
    __pyx_t_5 = __pyx_f_5pysam_9libcutils_encode_filename(__pyx_v_index_filename); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 4307, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_5);
    __Pyx_INCREF(__pyx_t_5);
    __Pyx_GIVEREF(__pyx_t_5);
    __Pyx_GOTREF(__pyx_v_self->__pyx_base.index_filename);
    __Pyx_DECREF(__pyx_v_self->__pyx_base.index_filename);
    __pyx_v_self->__pyx_base.index_filename = __pyx_t_5;
    __Pyx_INCREF(__pyx_t_5);
    __Pyx_DECREF_SET(__pyx_v_index_filename, __pyx_t_5);
    __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;

    /* "pysam/libcbcf.pyx":4306
 *         self.filename = filename
 * 
 *         if index_filename is not None:             # <<<<<<<<<<<<<<
 *             self.index_filename = index_filename = encode_filename(index_filename)
 *         else:
*/
    goto __pyx_L41;
  }

  /* "pysam/libcbcf.pyx":4309
 *             self.index_filename = index_filename = encode_filename(index_filename)
 *         else:
 *             self.index_filename = None             # <<<<<<<<<<<<<<
 * 
 *         self.drop_samples = bool(drop_samples)
*/
  /*else*/ {
    __Pyx_INCREF(Py_None);
    __Pyx_GIVEREF(Py_None);
    __Pyx_GOTREF(__pyx_v_self->__pyx_base.index_filename);
    __Pyx_DECREF(__pyx_v_self->__pyx_base.index_filename);
    __pyx_v_self->__pyx_base.index_filename = Py_None;
  }
  __pyx_L41:;

  /* "pysam/libcbcf.pyx":4311
 *             self.index_filename = None
 * 
 *         self.drop_samples = bool(drop_samples)             # <<<<<<<<<<<<<<
 *         self.header = None
 * 
*/
  __pyx_t_1 = __Pyx_PyObject_IsTrue(__pyx_v_drop_samples); if (unlikely((__pyx_t_1 < 0))) __PYX_ERR(0, 4311, __pyx_L1_error)
  __pyx_v_self->drop_samples = (!(!__pyx_t_1));

  /* "pysam/libcbcf.pyx":4312
 * 
 *         self.drop_samples = bool(drop_samples)
 *         self.header = None             # <<<<<<<<<<<<<<
 * 
 *         self.header_written = False
*/
  __Pyx_INCREF(Py_None);
  __Pyx_GIVEREF(Py_None);
  __Pyx_GOTREF((PyObject *)__pyx_v_self->header);
  __Pyx_DECREF((PyObject *)__pyx_v_self->header);
  __pyx_v_self->header = ((struct __pyx_obj_5pysam_7libcbcf_VariantHeader *)Py_None);

  /* "pysam/libcbcf.pyx":4314
 *         self.header = None
 * 
 *         self.header_written = False             # <<<<<<<<<<<<<<
 * 
 *         if mode.startswith(b'w'):
*/
  __pyx_v_self->header_written = 0;

  /* "pysam/libcbcf.pyx":4316
 *         self.header_written = False
 * 
 *         if mode.startswith(b'w'):             # <<<<<<<<<<<<<<
 *             # open file for writing
 *             if index_filename is not None:
*/
  __pyx_t_4 = __pyx_v_mode;
  __Pyx_INCREF(__pyx_t_4);
  __pyx_t_6 = 0;
  {
    PyObject *__pyx_callargs[2] = {__pyx_t_4, __pyx_mstate_global->__pyx_n_b_w};
    __pyx_t_5 = __Pyx_PyObject_FastCallMethod(__pyx_mstate_global->__pyx_n_u_startswith, __pyx_callargs+__pyx_t_6, (2-__pyx_t_6) | (1*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
    __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
    if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 4316, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_5);
  }
  __pyx_t_1 = __Pyx_PyObject_IsTrue(__pyx_t_5); if (unlikely((__pyx_t_1 < 0))) __PYX_ERR(0, 4316, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  if (__pyx_t_1) {

    /* "pysam/libcbcf.pyx":4318
 *         if mode.startswith(b'w'):
 *             # open file for writing
 *             if index_filename is not None:             # <<<<<<<<<<<<<<
 *                 raise ValueError('Cannot specify an index filename when writing a VCF/BCF file')
 * 
*/
    __pyx_t_1 = (__pyx_v_index_filename != Py_None);
    if (unlikely(__pyx_t_1)) {

      /* "pysam/libcbcf.pyx":4319
 *             # open file for writing
 *             if index_filename is not None:
 *                 raise ValueError('Cannot specify an index filename when writing a VCF/BCF file')             # <<<<<<<<<<<<<<
 * 
 *             # header structure (used for writing)
*/
      __pyx_t_4 = NULL;
      __Pyx_INCREF(__pyx_builtin_ValueError);
      __pyx_t_2 = __pyx_builtin_ValueError; 
      __pyx_t_6 = 1;
      {
        PyObject *__pyx_callargs[2] = {__pyx_t_4, __pyx_mstate_global->__pyx_kp_u_Cannot_specify_an_index_filename};
        __pyx_t_5 = __Pyx_PyObject_FastCall(__pyx_t_2, __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_2); __pyx_t_2 = 0;
        if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 4319, __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, 4319, __pyx_L1_error)

      /* "pysam/libcbcf.pyx":4318
 *         if mode.startswith(b'w'):
 *             # open file for writing
 *             if index_filename is not None:             # <<<<<<<<<<<<<<
 *                 raise ValueError('Cannot specify an index filename when writing a VCF/BCF file')
 * 
*/
    }

    /* "pysam/libcbcf.pyx":4322
 * 
 *             # header structure (used for writing)
 *             if header:             # <<<<<<<<<<<<<<
 *                 self.header = header.copy()
 *             else:
*/
    __pyx_t_1 = __Pyx_PyObject_IsTrue(((PyObject *)__pyx_v_header)); if (unlikely((__pyx_t_1 < 0))) __PYX_ERR(0, 4322, __pyx_L1_error)
    if (__pyx_t_1) {

      /* "pysam/libcbcf.pyx":4323
 *             # header structure (used for writing)
 *             if header:
 *                 self.header = header.copy()             # <<<<<<<<<<<<<<
 *             else:
 *                 self.header = VariantHeader()
*/
      __pyx_t_2 = ((PyObject *)__pyx_v_header);
      __Pyx_INCREF(__pyx_t_2);
      __pyx_t_6 = 0;
      {
        PyObject *__pyx_callargs[2] = {__pyx_t_2, NULL};
        __pyx_t_5 = __Pyx_PyObject_FastCallMethod(__pyx_mstate_global->__pyx_n_u_copy, __pyx_callargs+__pyx_t_6, (1-__pyx_t_6) | (1*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
        __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
        if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 4323, __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_5pysam_7libcbcf_VariantHeader))))) __PYX_ERR(0, 4323, __pyx_L1_error)
      __Pyx_GIVEREF(__pyx_t_5);
      __Pyx_GOTREF((PyObject *)__pyx_v_self->header);
      __Pyx_DECREF((PyObject *)__pyx_v_self->header);
      __pyx_v_self->header = ((struct __pyx_obj_5pysam_7libcbcf_VariantHeader *)__pyx_t_5);
      __pyx_t_5 = 0;

      /* "pysam/libcbcf.pyx":4322
 * 
 *             # header structure (used for writing)
 *             if header:             # <<<<<<<<<<<<<<
 *                 self.header = header.copy()
 *             else:
*/
      goto __pyx_L44;
    }

    /* "pysam/libcbcf.pyx":4325
 *                 self.header = header.copy()
 *             else:
 *                 self.header = VariantHeader()             # <<<<<<<<<<<<<<
 *                 #raise ValueError('a VariantHeader must be specified')
 * 
*/
    /*else*/ {
      __pyx_t_2 = NULL;
      __Pyx_INCREF((PyObject *)__pyx_mstate_global->__pyx_ptype_5pysam_7libcbcf_VariantHeader);
      __pyx_t_4 = ((PyObject *)__pyx_mstate_global->__pyx_ptype_5pysam_7libcbcf_VariantHeader); 
      __pyx_t_6 = 1;
      {
        PyObject *__pyx_callargs[2] = {__pyx_t_2, NULL};
        __pyx_t_5 = __Pyx_PyObject_FastCall(__pyx_t_4, __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_4); __pyx_t_4 = 0;
        if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 4325, __pyx_L1_error)
        __Pyx_GOTREF((PyObject *)__pyx_t_5);
      }
      __Pyx_GIVEREF((PyObject *)__pyx_t_5);
      __Pyx_GOTREF((PyObject *)__pyx_v_self->header);
      __Pyx_DECREF((PyObject *)__pyx_v_self->header);
      __pyx_v_self->header = ((struct __pyx_obj_5pysam_7libcbcf_VariantHeader *)__pyx_t_5);
      __pyx_t_5 = 0;
    }
    __pyx_L44:;

    /* "pysam/libcbcf.pyx":4329
 * 
 *             # Header is not written until the first write or on close
 *             self.htsfile = self._open_htsfile()             # <<<<<<<<<<<<<<
 * 
 *             if not self.htsfile:
*/
    __pyx_t_18 = ((struct __pyx_vtabstruct_5pysam_7libcbcf_VariantFile *)__pyx_v_self->__pyx_base.__pyx_vtab)->__pyx_base._open_htsfile(((struct __pyx_obj_5pysam_10libchtslib_HTSFile *)__pyx_v_self)); if (unlikely(__pyx_t_18 == ((htsFile *)0) && PyErr_Occurred())) __PYX_ERR(0, 4329, __pyx_L1_error)
    __pyx_v_self->__pyx_base.htsfile = __pyx_t_18;

    /* "pysam/libcbcf.pyx":4331
 *             self.htsfile = self._open_htsfile()
 * 
 *             if not self.htsfile:             # <<<<<<<<<<<<<<
 *                 raise ValueError("could not open file `{}` (mode='{}')".format(filename, mode))
 * 
*/
    __pyx_t_1 = (!(__pyx_v_self->__pyx_base.htsfile != 0));
    if (unlikely(__pyx_t_1)) {

      /* "pysam/libcbcf.pyx":4332
 * 
 *             if not self.htsfile:
 *                 raise ValueError("could not open file `{}` (mode='{}')".format(filename, mode))             # <<<<<<<<<<<<<<
 * 
 *         elif mode.startswith(b'r'):
*/
      __pyx_t_4 = NULL;
      __Pyx_INCREF(__pyx_builtin_ValueError);
      __pyx_t_2 = __pyx_builtin_ValueError; 
      __pyx_t_11 = __pyx_mstate_global->__pyx_kp_u_could_not_open_file_mode;
      __Pyx_INCREF(__pyx_t_11);
      __pyx_t_6 = 0;
      {
        PyObject *__pyx_callargs[3] = {__pyx_t_11, __pyx_v_filename, __pyx_v_mode};
        __pyx_t_10 = __Pyx_PyObject_FastCallMethod(__pyx_mstate_global->__pyx_n_u_format, __pyx_callargs+__pyx_t_6, (3-__pyx_t_6) | (1*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
        __Pyx_XDECREF(__pyx_t_11); __pyx_t_11 = 0;
        if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 4332, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_10);
      }
      __pyx_t_6 = 1;
      {
        PyObject *__pyx_callargs[2] = {__pyx_t_4, __pyx_t_10};
        __pyx_t_5 = __Pyx_PyObject_FastCall(__pyx_t_2, __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_10); __pyx_t_10 = 0;
        __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
        if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 4332, __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, 4332, __pyx_L1_error)

      /* "pysam/libcbcf.pyx":4331
 *             self.htsfile = self._open_htsfile()
 * 
 *             if not self.htsfile:             # <<<<<<<<<<<<<<
 *                 raise ValueError("could not open file `{}` (mode='{}')".format(filename, mode))
 * 
*/
    }

    /* "pysam/libcbcf.pyx":4316
 *         self.header_written = False
 * 
 *         if mode.startswith(b'w'):             # <<<<<<<<<<<<<<
 *             # open file for writing
 *             if index_filename is not None:
*/
    goto __pyx_L42;
  }

  /* "pysam/libcbcf.pyx":4334
 *                 raise ValueError("could not open file `{}` (mode='{}')".format(filename, mode))
 * 
 *         elif mode.startswith(b'r'):             # <<<<<<<<<<<<<<
 *             # open file for reading
 *             self.htsfile = self._open_htsfile()
*/
  __pyx_t_2 = __pyx_v_mode;
  __Pyx_INCREF(__pyx_t_2);
  __pyx_t_6 = 0;
  {
    PyObject *__pyx_callargs[2] = {__pyx_t_2, __pyx_mstate_global->__pyx_n_b_r};
    __pyx_t_5 = __Pyx_PyObject_FastCallMethod(__pyx_mstate_global->__pyx_n_u_startswith, __pyx_callargs+__pyx_t_6, (2-__pyx_t_6) | (1*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
    __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
    if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 4334, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_5);
  }
  __pyx_t_1 = __Pyx_PyObject_IsTrue(__pyx_t_5); if (unlikely((__pyx_t_1 < 0))) __PYX_ERR(0, 4334, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  if (likely(__pyx_t_1)) {

    /* "pysam/libcbcf.pyx":4336
 *         elif mode.startswith(b'r'):
 *             # open file for reading
 *             self.htsfile = self._open_htsfile()             # <<<<<<<<<<<<<<
 * 
 *             if not self.htsfile:
*/
    __pyx_t_18 = ((struct __pyx_vtabstruct_5pysam_7libcbcf_VariantFile *)__pyx_v_self->__pyx_base.__pyx_vtab)->__pyx_base._open_htsfile(((struct __pyx_obj_5pysam_10libchtslib_HTSFile *)__pyx_v_self)); if (unlikely(__pyx_t_18 == ((htsFile *)0) && PyErr_Occurred())) __PYX_ERR(0, 4336, __pyx_L1_error)
    __pyx_v_self->__pyx_base.htsfile = __pyx_t_18;

    /* "pysam/libcbcf.pyx":4338
 *             self.htsfile = self._open_htsfile()
 * 
 *             if not self.htsfile:             # <<<<<<<<<<<<<<
 *                 if errno:
 *                     raise OSError_from_errno("Could not open variant file", filename)
*/
    __pyx_t_1 = (!(__pyx_v_self->__pyx_base.htsfile != 0));
    if (__pyx_t_1) {

      /* "pysam/libcbcf.pyx":4339
 * 
 *             if not self.htsfile:
 *                 if errno:             # <<<<<<<<<<<<<<
 *                     raise OSError_from_errno("Could not open variant file", filename)
 *                 else:
*/
      __pyx_t_1 = (errno != 0);
      if (unlikely(__pyx_t_1)) {

        /* "pysam/libcbcf.pyx":4340
 *             if not self.htsfile:
 *                 if errno:
 *                     raise OSError_from_errno("Could not open variant file", filename)             # <<<<<<<<<<<<<<
 *                 else:
 *                     raise ValueError('could not open variant file `{}`'.format(filename))
*/
        __pyx_t_19.__pyx_n = 1;
        __pyx_t_19.filename = __pyx_v_filename;
        __pyx_t_5 = __pyx_f_5pysam_9libcutils_OSError_from_errno(__pyx_mstate_global->__pyx_kp_u_Could_not_open_variant_file, &__pyx_t_19); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 4340, __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, 4340, __pyx_L1_error)

        /* "pysam/libcbcf.pyx":4339
 * 
 *             if not self.htsfile:
 *                 if errno:             # <<<<<<<<<<<<<<
 *                     raise OSError_from_errno("Could not open variant file", filename)
 *                 else:
*/
      }

      /* "pysam/libcbcf.pyx":4342
 *                     raise OSError_from_errno("Could not open variant file", filename)
 *                 else:
 *                     raise ValueError('could not open variant file `{}`'.format(filename))             # <<<<<<<<<<<<<<
 * 
 *             if self.htsfile.format.format not in (bcf, vcf):
*/
      /*else*/ {
        __pyx_t_2 = NULL;
        __Pyx_INCREF(__pyx_builtin_ValueError);
        __pyx_t_10 = __pyx_builtin_ValueError; 
        __pyx_t_11 = __pyx_mstate_global->__pyx_kp_u_could_not_open_variant_file;
        __Pyx_INCREF(__pyx_t_11);
        __pyx_t_6 = 0;
        {
          PyObject *__pyx_callargs[2] = {__pyx_t_11, __pyx_v_filename};
          __pyx_t_4 = __Pyx_PyObject_FastCallMethod(__pyx_mstate_global->__pyx_n_u_format, __pyx_callargs+__pyx_t_6, (2-__pyx_t_6) | (1*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
          __Pyx_XDECREF(__pyx_t_11); __pyx_t_11 = 0;
          if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 4342, __pyx_L1_error)
          __Pyx_GOTREF(__pyx_t_4);
        }
        __pyx_t_6 = 1;
        {
          PyObject *__pyx_callargs[2] = {__pyx_t_2, __pyx_t_4};
          __pyx_t_5 = __Pyx_PyObject_FastCall(__pyx_t_10, __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_4); __pyx_t_4 = 0;
          __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
          if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 4342, __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, 4342, __pyx_L1_error)
      }

      /* "pysam/libcbcf.pyx":4338
 *             self.htsfile = self._open_htsfile()
 * 
 *             if not self.htsfile:             # <<<<<<<<<<<<<<
 *                 if errno:
 *                     raise OSError_from_errno("Could not open variant file", filename)
*/
    }

    /* "pysam/libcbcf.pyx":4344
 *                     raise ValueError('could not open variant file `{}`'.format(filename))
 * 
 *             if self.htsfile.format.format not in (bcf, vcf):             # <<<<<<<<<<<<<<
 *                 raise ValueError('invalid file `{}` (mode=`{}`) - is it VCF/BCF format?'.format(filename, mode))
 * 
*/
    switch (__pyx_v_self->__pyx_base.htsfile->format.format) {
      case bcf:
      case vcf:
      __pyx_t_1 = 0;
      break;
      default:
      __pyx_t_1 = 1;
      break;
    }
    __pyx_t_7 = __pyx_t_1;
    if (unlikely(__pyx_t_7)) {

      /* "pysam/libcbcf.pyx":4345
 * 
 *             if self.htsfile.format.format not in (bcf, vcf):
 *                 raise ValueError('invalid file `{}` (mode=`{}`) - is it VCF/BCF format?'.format(filename, mode))             # <<<<<<<<<<<<<<
 * 
 *             self.check_truncation(ignore_truncation)
*/
      __pyx_t_10 = NULL;
      __Pyx_INCREF(__pyx_builtin_ValueError);
      __pyx_t_4 = __pyx_builtin_ValueError; 
      __pyx_t_11 = __pyx_mstate_global->__pyx_kp_u_invalid_file_mode_is_it_VCF_BCF;
      __Pyx_INCREF(__pyx_t_11);
      __pyx_t_6 = 0;
      {
        PyObject *__pyx_callargs[3] = {__pyx_t_11, __pyx_v_filename, __pyx_v_mode};
        __pyx_t_2 = __Pyx_PyObject_FastCallMethod(__pyx_mstate_global->__pyx_n_u_format, __pyx_callargs+__pyx_t_6, (3-__pyx_t_6) | (1*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
        __Pyx_XDECREF(__pyx_t_11); __pyx_t_11 = 0;
        if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 4345, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_2);
      }
      __pyx_t_6 = 1;
      {
        PyObject *__pyx_callargs[2] = {__pyx_t_10, __pyx_t_2};
        __pyx_t_5 = __Pyx_PyObject_FastCall(__pyx_t_4, __pyx_callargs+__pyx_t_6, (2-__pyx_t_6) | (__pyx_t_6*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
        __Pyx_XDECREF(__pyx_t_10); __pyx_t_10 = 0;
        __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
        __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
        if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 4345, __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, 4345, __pyx_L1_error)

      /* "pysam/libcbcf.pyx":4344
 *                     raise ValueError('could not open variant file `{}`'.format(filename))
 * 
 *             if self.htsfile.format.format not in (bcf, vcf):             # <<<<<<<<<<<<<<
 *                 raise ValueError('invalid file `{}` (mode=`{}`) - is it VCF/BCF format?'.format(filename, mode))
 * 
*/
    }

    /* "pysam/libcbcf.pyx":4347
 *                 raise ValueError('invalid file `{}` (mode=`{}`) - is it VCF/BCF format?'.format(filename, mode))
 * 
 *             self.check_truncation(ignore_truncation)             # <<<<<<<<<<<<<<
 * 
 *             with nogil:
*/
    __pyx_t_4 = ((PyObject *)__pyx_v_self);
    __Pyx_INCREF(__pyx_t_4);
    __pyx_t_6 = 0;
    {
      PyObject *__pyx_callargs[2] = {__pyx_t_4, __pyx_v_ignore_truncation};
      __pyx_t_5 = __Pyx_PyObject_FastCallMethod(__pyx_mstate_global->__pyx_n_u_check_truncation, __pyx_callargs+__pyx_t_6, (2-__pyx_t_6) | (1*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
      __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
      if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 4347, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_5);
    }
    __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;

    /* "pysam/libcbcf.pyx":4349
 *             self.check_truncation(ignore_truncation)
 * 
 *             with nogil:             # <<<<<<<<<<<<<<
 *                 hdr = bcf_hdr_read(self.htsfile)
 * 
*/
    {
        PyThreadState *_save;
        _save = NULL;
        Py_UNBLOCK_THREADS
        __Pyx_FastGIL_Remember();
        /*try:*/ {

          /* "pysam/libcbcf.pyx":4350
 * 
 *             with nogil:
 *                 hdr = bcf_hdr_read(self.htsfile)             # <<<<<<<<<<<<<<
 * 
 *             try:
*/
          __pyx_v_hdr = bcf_hdr_read(__pyx_v_self->__pyx_base.htsfile);
        }

        /* "pysam/libcbcf.pyx":4349
 *             self.check_truncation(ignore_truncation)
 * 
 *             with nogil:             # <<<<<<<<<<<<<<
 *                 hdr = bcf_hdr_read(self.htsfile)
 * 
*/
        /*finally:*/ {
          /*normal exit:*/{
            __Pyx_FastGIL_Forget();
            Py_BLOCK_THREADS
            goto __pyx_L51;
          }
          __pyx_L51:;
        }
    }

    /* "pysam/libcbcf.pyx":4352
 *                 hdr = bcf_hdr_read(self.htsfile)
 * 
 *             try:             # <<<<<<<<<<<<<<
 *                 self.header = makeVariantHeader(hdr)
 *             except ValueError:
*/
    {
      __Pyx_PyThreadState_declare
      __Pyx_PyThreadState_assign
      __Pyx_ExceptionSave(&__pyx_t_15, &__pyx_t_14, &__pyx_t_13);
      __Pyx_XGOTREF(__pyx_t_15);
      __Pyx_XGOTREF(__pyx_t_14);
      __Pyx_XGOTREF(__pyx_t_13);
      /*try:*/ {

        /* "pysam/libcbcf.pyx":4353
 * 
 *             try:
 *                 self.header = makeVariantHeader(hdr)             # <<<<<<<<<<<<<<
 *             except ValueError:
 *                 raise ValueError('file `{}` does not have valid header (mode=`{}`) - is it VCF/BCF format?'.format(filename, mode))
*/
        __pyx_t_5 = ((PyObject *)__pyx_f_5pysam_7libcbcf_makeVariantHeader(__pyx_v_hdr)); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 4353, __pyx_L52_error)
        __Pyx_GOTREF(__pyx_t_5);
        __Pyx_GIVEREF(__pyx_t_5);
        __Pyx_GOTREF((PyObject *)__pyx_v_self->header);
        __Pyx_DECREF((PyObject *)__pyx_v_self->header);
        __pyx_v_self->header = ((struct __pyx_obj_5pysam_7libcbcf_VariantHeader *)__pyx_t_5);
        __pyx_t_5 = 0;

        /* "pysam/libcbcf.pyx":4352
 *                 hdr = bcf_hdr_read(self.htsfile)
 * 
 *             try:             # <<<<<<<<<<<<<<
 *                 self.header = makeVariantHeader(hdr)
 *             except ValueError:
*/
      }
      __Pyx_XDECREF(__pyx_t_15); __pyx_t_15 = 0;
      __Pyx_XDECREF(__pyx_t_14); __pyx_t_14 = 0;
      __Pyx_XDECREF(__pyx_t_13); __pyx_t_13 = 0;
      goto __pyx_L57_try_end;
      __pyx_L52_error:;
      __Pyx_XDECREF(__pyx_t_10); __pyx_t_10 = 0;
      __Pyx_XDECREF(__pyx_t_11); __pyx_t_11 = 0;
      __Pyx_XDECREF(__pyx_t_12); __pyx_t_12 = 0;
      __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
      __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
      __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
      __Pyx_TraceException(__pyx_lineno, 0, 0);

      /* "pysam/libcbcf.pyx":4354
 *             try:
 *                 self.header = makeVariantHeader(hdr)
 *             except ValueError:             # <<<<<<<<<<<<<<
 *                 raise ValueError('file `{}` does not have valid header (mode=`{}`) - is it VCF/BCF format?'.format(filename, mode))
 * 
*/
      __pyx_t_17 = __Pyx_PyErr_ExceptionMatches(__pyx_builtin_ValueError);
      if (__pyx_t_17) {
        __Pyx_AddTraceback("pysam.libcbcf.VariantFile.open", __pyx_clineno, __pyx_lineno, __pyx_filename);
        __Pyx_TraceExceptionHandled(0);
        if (__Pyx_GetException(&__pyx_t_5, &__pyx_t_4, &__pyx_t_2) < 0) __PYX_ERR(0, 4354, __pyx_L54_except_error)
        __Pyx_XGOTREF(__pyx_t_5);
        __Pyx_XGOTREF(__pyx_t_4);
        __Pyx_XGOTREF(__pyx_t_2);
        __Pyx_TraceExceptionDone();

        /* "pysam/libcbcf.pyx":4355
 *                 self.header = makeVariantHeader(hdr)
 *             except ValueError:
 *                 raise ValueError('file `{}` does not have valid header (mode=`{}`) - is it VCF/BCF format?'.format(filename, mode))             # <<<<<<<<<<<<<<
 * 
 *             if isinstance(self.filename, bytes):
*/
        __pyx_t_11 = NULL;
        __Pyx_INCREF(__pyx_builtin_ValueError);
        __pyx_t_12 = __pyx_builtin_ValueError; 
        __pyx_t_21 = __pyx_mstate_global->__pyx_kp_u_file_does_not_have_valid_header;
        __Pyx_INCREF(__pyx_t_21);
        __pyx_t_6 = 0;
        {
          PyObject *__pyx_callargs[3] = {__pyx_t_21, __pyx_v_filename, __pyx_v_mode};
          __pyx_t_20 = __Pyx_PyObject_FastCallMethod(__pyx_mstate_global->__pyx_n_u_format, __pyx_callargs+__pyx_t_6, (3-__pyx_t_6) | (1*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
          __Pyx_XDECREF(__pyx_t_21); __pyx_t_21 = 0;
          if (unlikely(!__pyx_t_20)) __PYX_ERR(0, 4355, __pyx_L54_except_error)
          __Pyx_GOTREF(__pyx_t_20);
        }
        __pyx_t_6 = 1;
        {
          PyObject *__pyx_callargs[2] = {__pyx_t_11, __pyx_t_20};
          __pyx_t_10 = __Pyx_PyObject_FastCall(__pyx_t_12, __pyx_callargs+__pyx_t_6, (2-__pyx_t_6) | (__pyx_t_6*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
          __Pyx_XDECREF(__pyx_t_11); __pyx_t_11 = 0;
          __Pyx_DECREF(__pyx_t_20); __pyx_t_20 = 0;
          __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0;
          if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 4355, __pyx_L54_except_error)
          __Pyx_GOTREF(__pyx_t_10);
        }
        __Pyx_Raise(__pyx_t_10, 0, 0, 0);
        __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
        __PYX_ERR(0, 4355, __pyx_L54_except_error)
      }
      goto __pyx_L54_except_error;

      /* "pysam/libcbcf.pyx":4352
 *                 hdr = bcf_hdr_read(self.htsfile)
 * 
 *             try:             # <<<<<<<<<<<<<<
 *                 self.header = makeVariantHeader(hdr)
 *             except ValueError:
*/
      __pyx_L54_except_error:;
      __Pyx_XGIVEREF(__pyx_t_15);
      __Pyx_XGIVEREF(__pyx_t_14);
      __Pyx_XGIVEREF(__pyx_t_13);
      __Pyx_ExceptionReset(__pyx_t_15, __pyx_t_14, __pyx_t_13);
      goto __pyx_L1_error;
      __pyx_L57_try_end:;
    }

    /* "pysam/libcbcf.pyx":4357
 *                 raise ValueError('file `{}` does not have valid header (mode=`{}`) - is it VCF/BCF format?'.format(filename, mode))
 * 
 *             if isinstance(self.filename, bytes):             # <<<<<<<<<<<<<<
 *                 cfilename = self.filename
 *             else:
*/
    __pyx_t_2 = __pyx_v_self->__pyx_base.filename;
    __Pyx_INCREF(__pyx_t_2);
    __pyx_t_7 = PyBytes_Check(__pyx_t_2); 
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    if (__pyx_t_7) {

      /* "pysam/libcbcf.pyx":4358
 * 
 *             if isinstance(self.filename, bytes):
 *                 cfilename = self.filename             # <<<<<<<<<<<<<<
 *             else:
 *                 cfilename = NULL
*/
      __pyx_t_22 = __Pyx_PyObject_AsWritableString(__pyx_v_self->__pyx_base.filename); if (unlikely((!__pyx_t_22) && PyErr_Occurred())) __PYX_ERR(0, 4358, __pyx_L1_error)
      __pyx_v_cfilename = __pyx_t_22;

      /* "pysam/libcbcf.pyx":4357
 *                 raise ValueError('file `{}` does not have valid header (mode=`{}`) - is it VCF/BCF format?'.format(filename, mode))
 * 
 *             if isinstance(self.filename, bytes):             # <<<<<<<<<<<<<<
 *                 cfilename = self.filename
 *             else:
*/
      goto __pyx_L60;
    }

    /* "pysam/libcbcf.pyx":4360
 *                 cfilename = self.filename
 *             else:
 *                 cfilename = NULL             # <<<<<<<<<<<<<<
 * 
 *             # check for index and open if present
*/
    /*else*/ {
      __pyx_v_cfilename = NULL;
    }
    __pyx_L60:;

    /* "pysam/libcbcf.pyx":4363
 * 
 *             # check for index and open if present
 *             if self.htsfile.format.format == bcf and cfilename:             # <<<<<<<<<<<<<<
 *                 if index_filename is not None:
 *                     cindex_filename = index_filename
*/
    __pyx_t_1 = (__pyx_v_self->__pyx_base.htsfile->format.format == bcf);
    if (__pyx_t_1) {
    } else {
      __pyx_t_7 = __pyx_t_1;
      goto __pyx_L62_bool_binop_done;
    }
    __pyx_t_1 = (__pyx_v_cfilename != 0);
    __pyx_t_7 = __pyx_t_1;
    __pyx_L62_bool_binop_done:;
    if (__pyx_t_7) {

      /* "pysam/libcbcf.pyx":4364
 *             # check for index and open if present
 *             if self.htsfile.format.format == bcf and cfilename:
 *                 if index_filename is not None:             # <<<<<<<<<<<<<<
 *                     cindex_filename = index_filename
 *                 with nogil:
*/
      __pyx_t_7 = (__pyx_v_index_filename != Py_None);
      if (__pyx_t_7) {

        /* "pysam/libcbcf.pyx":4365
 *             if self.htsfile.format.format == bcf and cfilename:
 *                 if index_filename is not None:
 *                     cindex_filename = index_filename             # <<<<<<<<<<<<<<
 *                 with nogil:
 *                     idx = bcf_index_load2(cfilename, cindex_filename)
*/
        __pyx_t_22 = __Pyx_PyObject_AsWritableString(__pyx_v_index_filename); if (unlikely((!__pyx_t_22) && PyErr_Occurred())) __PYX_ERR(0, 4365, __pyx_L1_error)
        __pyx_v_cindex_filename = __pyx_t_22;

        /* "pysam/libcbcf.pyx":4364
 *             # check for index and open if present
 *             if self.htsfile.format.format == bcf and cfilename:
 *                 if index_filename is not None:             # <<<<<<<<<<<<<<
 *                     cindex_filename = index_filename
 *                 with nogil:
*/
      }

      /* "pysam/libcbcf.pyx":4366
 *                 if index_filename is not None:
 *                     cindex_filename = index_filename
 *                 with nogil:             # <<<<<<<<<<<<<<
 *                     idx = bcf_index_load2(cfilename, cindex_filename)
 *                 self.index = makeBCFIndex(self.header, idx)
*/
      {
          PyThreadState *_save;
          _save = NULL;
          Py_UNBLOCK_THREADS
          __Pyx_FastGIL_Remember();
          /*try:*/ {

            /* "pysam/libcbcf.pyx":4367
 *                     cindex_filename = index_filename
 *                 with nogil:
 *                     idx = bcf_index_load2(cfilename, cindex_filename)             # <<<<<<<<<<<<<<
 *                 self.index = makeBCFIndex(self.header, idx)
 * 
*/
            __pyx_v_idx = bcf_index_load2(__pyx_v_cfilename, __pyx_v_cindex_filename);
          }

          /* "pysam/libcbcf.pyx":4366
 *                 if index_filename is not None:
 *                     cindex_filename = index_filename
 *                 with nogil:             # <<<<<<<<<<<<<<
 *                     idx = bcf_index_load2(cfilename, cindex_filename)
 *                 self.index = makeBCFIndex(self.header, idx)
*/
          /*finally:*/ {
            /*normal exit:*/{
              __Pyx_FastGIL_Forget();
              Py_BLOCK_THREADS
              goto __pyx_L67;
            }
            __pyx_L67:;
          }
      }

      /* "pysam/libcbcf.pyx":4368
 *                 with nogil:
 *                     idx = bcf_index_load2(cfilename, cindex_filename)
 *                 self.index = makeBCFIndex(self.header, idx)             # <<<<<<<<<<<<<<
 * 
 *             elif self.htsfile.format.compression == bgzf and cfilename:
*/
      __pyx_t_2 = ((PyObject *)__pyx_v_self->header);
      __Pyx_INCREF(__pyx_t_2);
      __pyx_t_4 = ((PyObject *)__pyx_f_5pysam_7libcbcf_makeBCFIndex(((struct __pyx_obj_5pysam_7libcbcf_VariantHeader *)__pyx_t_2), __pyx_v_idx)); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 4368, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_4);
      __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
      __Pyx_GIVEREF(__pyx_t_4);
      __Pyx_GOTREF((PyObject *)__pyx_v_self->index);
      __Pyx_DECREF((PyObject *)__pyx_v_self->index);
      __pyx_v_self->index = ((struct __pyx_obj_5pysam_7libcbcf_BaseIndex *)__pyx_t_4);
      __pyx_t_4 = 0;

      /* "pysam/libcbcf.pyx":4363
 * 
 *             # check for index and open if present
 *             if self.htsfile.format.format == bcf and cfilename:             # <<<<<<<<<<<<<<
 *                 if index_filename is not None:
 *                     cindex_filename = index_filename
*/
      goto __pyx_L61;
    }

    /* "pysam/libcbcf.pyx":4370
 *                 self.index = makeBCFIndex(self.header, idx)
 * 
 *             elif self.htsfile.format.compression == bgzf and cfilename:             # <<<<<<<<<<<<<<
 *                 if index_filename is not None:
 *                     cindex_filename = index_filename
*/
    __pyx_t_1 = (__pyx_v_self->__pyx_base.htsfile->format.compression == bgzf);
    if (__pyx_t_1) {
    } else {
      __pyx_t_7 = __pyx_t_1;
      goto __pyx_L68_bool_binop_done;
    }
    __pyx_t_1 = (__pyx_v_cfilename != 0);
    __pyx_t_7 = __pyx_t_1;
    __pyx_L68_bool_binop_done:;
    if (__pyx_t_7) {

      /* "pysam/libcbcf.pyx":4371
 * 
 *             elif self.htsfile.format.compression == bgzf and cfilename:
 *                 if index_filename is not None:             # <<<<<<<<<<<<<<
 *                     cindex_filename = index_filename
 *                 with nogil:
*/
      __pyx_t_7 = (__pyx_v_index_filename != Py_None);
      if (__pyx_t_7) {

        /* "pysam/libcbcf.pyx":4372
 *             elif self.htsfile.format.compression == bgzf and cfilename:
 *                 if index_filename is not None:
 *                     cindex_filename = index_filename             # <<<<<<<<<<<<<<
 *                 with nogil:
 *                     tidx = tbx_index_load2(cfilename, cindex_filename)
*/
        __pyx_t_22 = __Pyx_PyObject_AsWritableString(__pyx_v_index_filename); if (unlikely((!__pyx_t_22) && PyErr_Occurred())) __PYX_ERR(0, 4372, __pyx_L1_error)
        __pyx_v_cindex_filename = __pyx_t_22;

        /* "pysam/libcbcf.pyx":4371
 * 
 *             elif self.htsfile.format.compression == bgzf and cfilename:
 *                 if index_filename is not None:             # <<<<<<<<<<<<<<
 *                     cindex_filename = index_filename
 *                 with nogil:
*/
      }

      /* "pysam/libcbcf.pyx":4373
 *                 if index_filename is not None:
 *                     cindex_filename = index_filename
 *                 with nogil:             # <<<<<<<<<<<<<<
 *                     tidx = tbx_index_load2(cfilename, cindex_filename)
 *                 self.index = makeTabixIndex(tidx)
*/
      {
          PyThreadState *_save;
          _save = NULL;
          Py_UNBLOCK_THREADS
          __Pyx_FastGIL_Remember();
          /*try:*/ {

            /* "pysam/libcbcf.pyx":4374
 *                     cindex_filename = index_filename
 *                 with nogil:
 *                     tidx = tbx_index_load2(cfilename, cindex_filename)             # <<<<<<<<<<<<<<
 *                 self.index = makeTabixIndex(tidx)
 * 
*/
            __pyx_v_tidx = tbx_index_load2(__pyx_v_cfilename, __pyx_v_cindex_filename);
          }

          /* "pysam/libcbcf.pyx":4373
 *                 if index_filename is not None:
 *                     cindex_filename = index_filename
 *                 with nogil:             # <<<<<<<<<<<<<<
 *                     tidx = tbx_index_load2(cfilename, cindex_filename)
 *                 self.index = makeTabixIndex(tidx)
*/
          /*finally:*/ {
            /*normal exit:*/{
              __Pyx_FastGIL_Forget();
              Py_BLOCK_THREADS
              goto __pyx_L73;
            }
            __pyx_L73:;
          }
      }

      /* "pysam/libcbcf.pyx":4375
 *                 with nogil:
 *                     tidx = tbx_index_load2(cfilename, cindex_filename)
 *                 self.index = makeTabixIndex(tidx)             # <<<<<<<<<<<<<<
 * 
 *             if not self.is_stream:
*/
      __pyx_t_4 = ((PyObject *)__pyx_f_5pysam_7libcbcf_makeTabixIndex(__pyx_v_tidx)); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 4375, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_4);
      __Pyx_GIVEREF(__pyx_t_4);
      __Pyx_GOTREF((PyObject *)__pyx_v_self->index);
      __Pyx_DECREF((PyObject *)__pyx_v_self->index);
      __pyx_v_self->index = ((struct __pyx_obj_5pysam_7libcbcf_BaseIndex *)__pyx_t_4);
      __pyx_t_4 = 0;

      /* "pysam/libcbcf.pyx":4370
 *                 self.index = makeBCFIndex(self.header, idx)
 * 
 *             elif self.htsfile.format.compression == bgzf and cfilename:             # <<<<<<<<<<<<<<
 *                 if index_filename is not None:
 *                     cindex_filename = index_filename
*/
    }
    __pyx_L61:;

    /* "pysam/libcbcf.pyx":4377
 *                 self.index = makeTabixIndex(tidx)
 * 
 *             if not self.is_stream:             # <<<<<<<<<<<<<<
 *                 self.start_offset = self.tell()
 *         else:
*/
    __pyx_t_7 = (!__pyx_v_self->__pyx_base.is_stream);
    if (__pyx_t_7) {

      /* "pysam/libcbcf.pyx":4378
 * 
 *             if not self.is_stream:
 *                 self.start_offset = self.tell()             # <<<<<<<<<<<<<<
 *         else:
 *             raise ValueError('unknown mode {}'.format(mode))
*/
      __pyx_t_2 = ((PyObject *)__pyx_v_self);
      __Pyx_INCREF(__pyx_t_2);
      __pyx_t_6 = 0;
      {
        PyObject *__pyx_callargs[2] = {__pyx_t_2, NULL};
        __pyx_t_4 = __Pyx_PyObject_FastCallMethod(__pyx_mstate_global->__pyx_n_u_tell, __pyx_callargs+__pyx_t_6, (1-__pyx_t_6) | (1*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
        __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
        if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 4378, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_4);
      }
      __pyx_t_23 = __Pyx_PyLong_As_int64_t(__pyx_t_4); if (unlikely((__pyx_t_23 == ((int64_t)-1)) && PyErr_Occurred())) __PYX_ERR(0, 4378, __pyx_L1_error)
      __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
      __pyx_v_self->__pyx_base.start_offset = __pyx_t_23;

      /* "pysam/libcbcf.pyx":4377
 *                 self.index = makeTabixIndex(tidx)
 * 
 *             if not self.is_stream:             # <<<<<<<<<<<<<<
 *                 self.start_offset = self.tell()
 *         else:
*/
    }

    /* "pysam/libcbcf.pyx":4334
 *                 raise ValueError("could not open file `{}` (mode='{}')".format(filename, mode))
 * 
 *         elif mode.startswith(b'r'):             # <<<<<<<<<<<<<<
 *             # open file for reading
 *             self.htsfile = self._open_htsfile()
*/
    goto __pyx_L42;
  }

  /* "pysam/libcbcf.pyx":4380
 *                 self.start_offset = self.tell()
 *         else:
 *             raise ValueError('unknown mode {}'.format(mode))             # <<<<<<<<<<<<<<
 * 
 *     def reset(self):
*/
  /*else*/ {
    __pyx_t_2 = NULL;
    __Pyx_INCREF(__pyx_builtin_ValueError);
    __pyx_t_5 = __pyx_builtin_ValueError; 
    __pyx_t_12 = __pyx_mstate_global->__pyx_kp_u_unknown_mode;
    __Pyx_INCREF(__pyx_t_12);
    __pyx_t_6 = 0;
    {
      PyObject *__pyx_callargs[2] = {__pyx_t_12, __pyx_v_mode};
      __pyx_t_10 = __Pyx_PyObject_FastCallMethod(__pyx_mstate_global->__pyx_n_u_format, __pyx_callargs+__pyx_t_6, (2-__pyx_t_6) | (1*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
      __Pyx_XDECREF(__pyx_t_12); __pyx_t_12 = 0;
      if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 4380, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_10);
    }
    __pyx_t_6 = 1;
    {
      PyObject *__pyx_callargs[2] = {__pyx_t_2, __pyx_t_10};
      __pyx_t_4 = __Pyx_PyObject_FastCall(__pyx_t_5, __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_10); __pyx_t_10 = 0;
      __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
      if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 4380, __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, 4380, __pyx_L1_error)
  }
  __pyx_L42:;

  /* "pysam/libcbcf.pyx":4237
 *         return vars
 * 
 *     def open(self, filename, mode='r',             # <<<<<<<<<<<<<<
 *              index_filename=None,
 *              VariantHeader header=None,
*/

  /* function exit code */
  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  __Pyx_TraceReturnValue(__pyx_r, 0, 0, __PYX_ERR(0, 4237, __pyx_L1_error));
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_XDECREF(__pyx_t_5);
  __Pyx_XDECREF(__pyx_t_10);
  __Pyx_XDECREF(__pyx_t_11);
  __Pyx_XDECREF(__pyx_t_12);
  __Pyx_XDECREF(__pyx_t_20);
  __Pyx_XDECREF(__pyx_t_21);
  __Pyx_TraceException(__pyx_lineno, 0, 0);
  #if CYTHON_USE_SYS_MONITORING
  __Pyx_TraceExceptionUnwind(0, 0);
  #else
  __Pyx_TraceReturnValue(NULL, 0, 0, __PYX_ERR(0, 4237, __pyx_L1_error));
  #endif
  __Pyx_AddTraceback("pysam.libcbcf.VariantFile.open", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_format_modes);
  __Pyx_XDECREF(__pyx_v_invalid_modes);
  __Pyx_XDECREF(__pyx_9genexpr13__pyx_v_m);
  __Pyx_XDECREF(__pyx_9genexpr14__pyx_v_m);
  __Pyx_XDECREF(__pyx_v_filename);
  __Pyx_XDECREF(__pyx_v_mode);
  __Pyx_XDECREF(__pyx_v_index_filename);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_PyMonitoring_ExitScope(0);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "pysam/libcbcf.pyx":4382
 *             raise ValueError('unknown mode {}'.format(mode))
 * 
 *     def reset(self):             # <<<<<<<<<<<<<<
 *         """reset file position to beginning of file just after the header."""
 *         return self.seek(self.start_offset)
*/

/* Python wrapper */
static PyObject *__pyx_pw_5pysam_7libcbcf_11VariantFile_17reset(PyObject *__pyx_v_self, 
#if 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_5pysam_7libcbcf_11VariantFile_16reset, "VariantFile.reset(self)\n\nreset file position to beginning of file just after the header.");
static PyMethodDef __pyx_mdef_5pysam_7libcbcf_11VariantFile_17reset = {"reset", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_5pysam_7libcbcf_11VariantFile_17reset, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_5pysam_7libcbcf_11VariantFile_16reset};
static PyObject *__pyx_pw_5pysam_7libcbcf_11VariantFile_17reset(PyObject *__pyx_v_self, 
#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("reset (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("reset", 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("reset", __pyx_kwds); return NULL;}
  __pyx_r = __pyx_pf_5pysam_7libcbcf_11VariantFile_16reset(((struct __pyx_obj_5pysam_7libcbcf_VariantFile *)__pyx_v_self));

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

static PyObject *__pyx_pf_5pysam_7libcbcf_11VariantFile_16reset(struct __pyx_obj_5pysam_7libcbcf_VariantFile *__pyx_v_self) {
  PyObject *__pyx_r = NULL;
  __Pyx_TraceDeclarationsFunc
  __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_TraceFrameInit(((PyObject *)__pyx_mstate_global->__pyx_codeobj_tab[373]))
  __Pyx_RefNannySetupContext("reset", 0);
  __Pyx_TraceStartFunc("reset", __pyx_f[0], 4382, 0, 0, 0, __PYX_ERR(0, 4382, __pyx_L1_error));

  /* "pysam/libcbcf.pyx":4384
 *     def reset(self):
 *         """reset file position to beginning of file just after the header."""
 *         return self.seek(self.start_offset)             # <<<<<<<<<<<<<<
 * 
 *     def is_valid_tid(self, tid):
*/
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_2 = ((PyObject *)__pyx_v_self);
  __Pyx_INCREF(__pyx_t_2);
  __pyx_t_3 = __Pyx_PyLong_From_int64_t(__pyx_v_self->__pyx_base.start_offset); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 4384, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __pyx_t_4 = 0;
  {
    PyObject *__pyx_callargs[2] = {__pyx_t_2, __pyx_t_3};
    __pyx_t_1 = __Pyx_PyObject_FastCallMethod(__pyx_mstate_global->__pyx_n_u_seek, __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, 4384, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
  }
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  __Pyx_TraceReturnValue(__pyx_r, 1, 0, __PYX_ERR(0, 4384, __pyx_L1_error));
  goto __pyx_L0;

  /* "pysam/libcbcf.pyx":4382
 *             raise ValueError('unknown mode {}'.format(mode))
 * 
 *     def reset(self):             # <<<<<<<<<<<<<<
 *         """reset file position to beginning of file just after the header."""
 *         return self.seek(self.start_offset)
*/

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_TraceException(__pyx_lineno, 0, 0);
  #if CYTHON_USE_SYS_MONITORING
  __Pyx_TraceExceptionUnwind(0, 0);
  #else
  __Pyx_TraceReturnValue(NULL, 0, 0, __PYX_ERR(0, 4382, __pyx_L1_error));
  #endif
  __Pyx_AddTraceback("pysam.libcbcf.VariantFile.reset", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_PyMonitoring_ExitScope(0);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "pysam/libcbcf.pyx":4386
 *         return self.seek(self.start_offset)
 * 
 *     def is_valid_tid(self, tid):             # <<<<<<<<<<<<<<
 *         """
 *         return True if the numerical :term:`tid` is valid; False otherwise.
*/

/* Python wrapper */
static PyObject *__pyx_pw_5pysam_7libcbcf_11VariantFile_19is_valid_tid(PyObject *__pyx_v_self, 
#if 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_5pysam_7libcbcf_11VariantFile_18is_valid_tid, "VariantFile.is_valid_tid(self, tid)\n\nreturn True if the numerical :term:`tid` is valid; False otherwise.\n\nreturns -1 if reference is not known.");
static PyMethodDef __pyx_mdef_5pysam_7libcbcf_11VariantFile_19is_valid_tid = {"is_valid_tid", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_5pysam_7libcbcf_11VariantFile_19is_valid_tid, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_5pysam_7libcbcf_11VariantFile_18is_valid_tid};
static PyObject *__pyx_pw_5pysam_7libcbcf_11VariantFile_19is_valid_tid(PyObject *__pyx_v_self, 
#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_tid = 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("is_valid_tid (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_tid,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, 4386, __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, 4386, __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, "is_valid_tid", 0) < 0) __PYX_ERR(0, 4386, __pyx_L3_error)
      for (Py_ssize_t i = __pyx_nargs; i < 1; i++) {
        if (unlikely(!values[i])) { __Pyx_RaiseArgtupleInvalid("is_valid_tid", 1, 1, 1, i); __PYX_ERR(0, 4386, __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, 4386, __pyx_L3_error)
    }
    __pyx_v_tid = values[0];
  }
  goto __pyx_L6_skip;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("is_valid_tid", 1, 1, 1, __pyx_nargs); __PYX_ERR(0, 4386, __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("pysam.libcbcf.VariantFile.is_valid_tid", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_5pysam_7libcbcf_11VariantFile_18is_valid_tid(((struct __pyx_obj_5pysam_7libcbcf_VariantFile *)__pyx_v_self), __pyx_v_tid);

  /* 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_5pysam_7libcbcf_11VariantFile_18is_valid_tid(struct __pyx_obj_5pysam_7libcbcf_VariantFile *__pyx_v_self, PyObject *__pyx_v_tid) {
  bcf_hdr_t *__pyx_v_hdr;
  int __pyx_v_rid;
  PyObject *__pyx_r = NULL;
  __Pyx_TraceDeclarationsFunc
  __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;
  bcf_hdr_t *__pyx_t_7;
  int __pyx_t_8;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_TraceFrameInit(((PyObject *)__pyx_mstate_global->__pyx_codeobj_tab[374]))
  __Pyx_RefNannySetupContext("is_valid_tid", 0);
  __Pyx_TraceStartFunc("is_valid_tid", __pyx_f[0], 4386, 0, 0, 0, __PYX_ERR(0, 4386, __pyx_L1_error));

  /* "pysam/libcbcf.pyx":4392
 *         returns -1 if reference is not known.
 *         """
 *         if not self.is_open:             # <<<<<<<<<<<<<<
 *             raise ValueError('I/O operation on closed file')
 * 
*/
  __pyx_t_1 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_mstate_global->__pyx_n_u_is_open); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 4392, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_2 = __Pyx_PyObject_IsTrue(__pyx_t_1); if (unlikely((__pyx_t_2 < 0))) __PYX_ERR(0, 4392, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_t_3 = (!__pyx_t_2);
  if (unlikely(__pyx_t_3)) {

    /* "pysam/libcbcf.pyx":4393
 *         """
 *         if not self.is_open:
 *             raise ValueError('I/O operation on closed file')             # <<<<<<<<<<<<<<
 * 
 *         cdef bcf_hdr_t *hdr = self.header.ptr
*/
    __pyx_t_4 = NULL;
    __Pyx_INCREF(__pyx_builtin_ValueError);
    __pyx_t_5 = __pyx_builtin_ValueError; 
    __pyx_t_6 = 1;
    {
      PyObject *__pyx_callargs[2] = {__pyx_t_4, __pyx_mstate_global->__pyx_kp_u_I_O_operation_on_closed_file};
      __pyx_t_1 = __Pyx_PyObject_FastCall(__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, 4393, __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, 4393, __pyx_L1_error)

    /* "pysam/libcbcf.pyx":4392
 *         returns -1 if reference is not known.
 *         """
 *         if not self.is_open:             # <<<<<<<<<<<<<<
 *             raise ValueError('I/O operation on closed file')
 * 
*/
  }

  /* "pysam/libcbcf.pyx":4395
 *             raise ValueError('I/O operation on closed file')
 * 
 *         cdef bcf_hdr_t *hdr = self.header.ptr             # <<<<<<<<<<<<<<
 *         cdef int rid = tid
 *         return 0 <= rid < hdr.n[BCF_DT_CTG]
*/
  __pyx_t_7 = __pyx_v_self->header->ptr;
  __pyx_v_hdr = __pyx_t_7;

  /* "pysam/libcbcf.pyx":4396
 * 
 *         cdef bcf_hdr_t *hdr = self.header.ptr
 *         cdef int rid = tid             # <<<<<<<<<<<<<<
 *         return 0 <= rid < hdr.n[BCF_DT_CTG]
 * 
*/
  __pyx_t_8 = __Pyx_PyLong_As_int(__pyx_v_tid); if (unlikely((__pyx_t_8 == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 4396, __pyx_L1_error)
  __pyx_v_rid = __pyx_t_8;

  /* "pysam/libcbcf.pyx":4397
 *         cdef bcf_hdr_t *hdr = self.header.ptr
 *         cdef int rid = tid
 *         return 0 <= rid < hdr.n[BCF_DT_CTG]             # <<<<<<<<<<<<<<
 * 
 *     def get_tid(self, reference):
*/
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_3 = (0 <= __pyx_v_rid);
  if (__pyx_t_3) {
    __pyx_t_3 = (__pyx_v_rid < (__pyx_v_hdr->n[BCF_DT_CTG]));
  }
  __pyx_t_1 = __Pyx_PyBool_FromLong(__pyx_t_3); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 4397, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  __Pyx_TraceReturnValue(__pyx_r, 15, 0, __PYX_ERR(0, 4397, __pyx_L1_error));
  goto __pyx_L0;

  /* "pysam/libcbcf.pyx":4386
 *         return self.seek(self.start_offset)
 * 
 *     def is_valid_tid(self, tid):             # <<<<<<<<<<<<<<
 *         """
 *         return True if the numerical :term:`tid` is valid; False otherwise.
*/

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_XDECREF(__pyx_t_5);
  __Pyx_TraceException(__pyx_lineno, 0, 0);
  #if CYTHON_USE_SYS_MONITORING
  __Pyx_TraceExceptionUnwind(0, 0);
  #else
  __Pyx_TraceReturnValue(NULL, 0, 0, __PYX_ERR(0, 4386, __pyx_L1_error));
  #endif
  __Pyx_AddTraceback("pysam.libcbcf.VariantFile.is_valid_tid", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_PyMonitoring_ExitScope(0);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "pysam/libcbcf.pyx":4399
 *         return 0 <= rid < hdr.n[BCF_DT_CTG]
 * 
 *     def get_tid(self, reference):             # <<<<<<<<<<<<<<
 *         """
 *         return the numerical :term:`tid` corresponding to
*/

/* Python wrapper */
static PyObject *__pyx_pw_5pysam_7libcbcf_11VariantFile_21get_tid(PyObject *__pyx_v_self, 
#if 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_5pysam_7libcbcf_11VariantFile_20get_tid, "VariantFile.get_tid(self, reference)\n\nreturn the numerical :term:`tid` corresponding to\n:term:`reference`\n\nreturns -1 if reference is not known.");
static PyMethodDef __pyx_mdef_5pysam_7libcbcf_11VariantFile_21get_tid = {"get_tid", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_5pysam_7libcbcf_11VariantFile_21get_tid, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_5pysam_7libcbcf_11VariantFile_20get_tid};
static PyObject *__pyx_pw_5pysam_7libcbcf_11VariantFile_21get_tid(PyObject *__pyx_v_self, 
#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_reference = 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_tid (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_reference,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, 4399, __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, 4399, __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_tid", 0) < 0) __PYX_ERR(0, 4399, __pyx_L3_error)
      for (Py_ssize_t i = __pyx_nargs; i < 1; i++) {
        if (unlikely(!values[i])) { __Pyx_RaiseArgtupleInvalid("get_tid", 1, 1, 1, i); __PYX_ERR(0, 4399, __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, 4399, __pyx_L3_error)
    }
    __pyx_v_reference = values[0];
  }
  goto __pyx_L6_skip;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("get_tid", 1, 1, 1, __pyx_nargs); __PYX_ERR(0, 4399, __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("pysam.libcbcf.VariantFile.get_tid", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_5pysam_7libcbcf_11VariantFile_20get_tid(((struct __pyx_obj_5pysam_7libcbcf_VariantFile *)__pyx_v_self), __pyx_v_reference);

  /* 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_5pysam_7libcbcf_11VariantFile_20get_tid(struct __pyx_obj_5pysam_7libcbcf_VariantFile *__pyx_v_self, PyObject *__pyx_v_reference) {
  vdict_t *__pyx_v_d;
  khint_t __pyx_v_k;
  PyObject *__pyx_r = NULL;
  __Pyx_TraceDeclarationsFunc
  __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;
  char const *__pyx_t_7;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_TraceFrameInit(((PyObject *)__pyx_mstate_global->__pyx_codeobj_tab[375]))
  __Pyx_RefNannySetupContext("get_tid", 0);
  __Pyx_TraceStartFunc("get_tid", __pyx_f[0], 4399, 0, 0, 0, __PYX_ERR(0, 4399, __pyx_L1_error));
  __Pyx_INCREF(__pyx_v_reference);

  /* "pysam/libcbcf.pyx":4406
 *         returns -1 if reference is not known.
 *         """
 *         if not self.is_open:             # <<<<<<<<<<<<<<
 *             raise ValueError('I/O operation on closed file')
 * 
*/
  __pyx_t_1 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_mstate_global->__pyx_n_u_is_open); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 4406, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_2 = __Pyx_PyObject_IsTrue(__pyx_t_1); if (unlikely((__pyx_t_2 < 0))) __PYX_ERR(0, 4406, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_t_3 = (!__pyx_t_2);
  if (unlikely(__pyx_t_3)) {

    /* "pysam/libcbcf.pyx":4407
 *         """
 *         if not self.is_open:
 *             raise ValueError('I/O operation on closed file')             # <<<<<<<<<<<<<<
 * 
 *         cdef vdict_t *d = <vdict_t*>self.header.ptr.dict[BCF_DT_CTG]
*/
    __pyx_t_4 = NULL;
    __Pyx_INCREF(__pyx_builtin_ValueError);
    __pyx_t_5 = __pyx_builtin_ValueError; 
    __pyx_t_6 = 1;
    {
      PyObject *__pyx_callargs[2] = {__pyx_t_4, __pyx_mstate_global->__pyx_kp_u_I_O_operation_on_closed_file};
      __pyx_t_1 = __Pyx_PyObject_FastCall(__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, 4407, __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, 4407, __pyx_L1_error)

    /* "pysam/libcbcf.pyx":4406
 *         returns -1 if reference is not known.
 *         """
 *         if not self.is_open:             # <<<<<<<<<<<<<<
 *             raise ValueError('I/O operation on closed file')
 * 
*/
  }

  /* "pysam/libcbcf.pyx":4409
 *             raise ValueError('I/O operation on closed file')
 * 
 *         cdef vdict_t *d = <vdict_t*>self.header.ptr.dict[BCF_DT_CTG]             # <<<<<<<<<<<<<<
 *         reference = force_bytes(reference)
 *         cdef khint_t k = kh_get_vdict(d, reference)
*/
  __pyx_v_d = ((vdict_t *)(__pyx_v_self->header->ptr->dict[BCF_DT_CTG]));

  /* "pysam/libcbcf.pyx":4410
 * 
 *         cdef vdict_t *d = <vdict_t*>self.header.ptr.dict[BCF_DT_CTG]
 *         reference = force_bytes(reference)             # <<<<<<<<<<<<<<
 *         cdef khint_t k = kh_get_vdict(d, reference)
 *         return kh_val_vdict(d, k).id if k != kh_end(d) else -1
*/
  __pyx_t_1 = __pyx_f_5pysam_9libcutils_force_bytes(__pyx_v_reference, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 4410, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF_SET(__pyx_v_reference, __pyx_t_1);
  __pyx_t_1 = 0;

  /* "pysam/libcbcf.pyx":4411
 *         cdef vdict_t *d = <vdict_t*>self.header.ptr.dict[BCF_DT_CTG]
 *         reference = force_bytes(reference)
 *         cdef khint_t k = kh_get_vdict(d, reference)             # <<<<<<<<<<<<<<
 *         return kh_val_vdict(d, k).id if k != kh_end(d) else -1
 * 
*/
  __pyx_t_7 = __Pyx_PyObject_AsString(__pyx_v_reference); if (unlikely((!__pyx_t_7) && PyErr_Occurred())) __PYX_ERR(0, 4411, __pyx_L1_error)
  __pyx_v_k = kh_get_vdict(__pyx_v_d, __pyx_t_7);

  /* "pysam/libcbcf.pyx":4412
 *         reference = force_bytes(reference)
 *         cdef khint_t k = kh_get_vdict(d, reference)
 *         return kh_val_vdict(d, k).id if k != kh_end(d) else -1             # <<<<<<<<<<<<<<
 * 
 *     def get_reference_name(self, tid):
*/
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_3 = (__pyx_v_k != kh_end(__pyx_v_d));
  if (__pyx_t_3) {
    __pyx_t_5 = __Pyx_PyLong_From_int(kh_val(__pyx_v_d, __pyx_v_k).id); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 4412, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_5);
    __pyx_t_1 = __pyx_t_5;
    __pyx_t_5 = 0;
  } else {
    __Pyx_INCREF(__pyx_mstate_global->__pyx_int_neg_1);
    __pyx_t_1 = __pyx_mstate_global->__pyx_int_neg_1;
  }
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  __Pyx_TraceReturnValue(__pyx_r, 26, 0, __PYX_ERR(0, 4412, __pyx_L1_error));
  goto __pyx_L0;

  /* "pysam/libcbcf.pyx":4399
 *         return 0 <= rid < hdr.n[BCF_DT_CTG]
 * 
 *     def get_tid(self, reference):             # <<<<<<<<<<<<<<
 *         """
 *         return the numerical :term:`tid` corresponding to
*/

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_XDECREF(__pyx_t_5);
  __Pyx_TraceException(__pyx_lineno, 0, 0);
  #if CYTHON_USE_SYS_MONITORING
  __Pyx_TraceExceptionUnwind(0, 0);
  #else
  __Pyx_TraceReturnValue(NULL, 0, 0, __PYX_ERR(0, 4399, __pyx_L1_error));
  #endif
  __Pyx_AddTraceback("pysam.libcbcf.VariantFile.get_tid", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_reference);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_PyMonitoring_ExitScope(0);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "pysam/libcbcf.pyx":4414
 *         return kh_val_vdict(d, k).id if k != kh_end(d) else -1
 * 
 *     def get_reference_name(self, tid):             # <<<<<<<<<<<<<<
 *         """
 *         return :term:`reference` name corresponding to numerical :term:`tid`
*/

/* Python wrapper */
static PyObject *__pyx_pw_5pysam_7libcbcf_11VariantFile_23get_reference_name(PyObject *__pyx_v_self, 
#if 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_5pysam_7libcbcf_11VariantFile_22get_reference_name, "VariantFile.get_reference_name(self, tid)\n\nreturn :term:`reference` name corresponding to numerical :term:`tid`");
static PyMethodDef __pyx_mdef_5pysam_7libcbcf_11VariantFile_23get_reference_name = {"get_reference_name", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_5pysam_7libcbcf_11VariantFile_23get_reference_name, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_5pysam_7libcbcf_11VariantFile_22get_reference_name};
static PyObject *__pyx_pw_5pysam_7libcbcf_11VariantFile_23get_reference_name(PyObject *__pyx_v_self, 
#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_tid = 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_reference_name (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_tid,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, 4414, __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, 4414, __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_reference_name", 0) < 0) __PYX_ERR(0, 4414, __pyx_L3_error)
      for (Py_ssize_t i = __pyx_nargs; i < 1; i++) {
        if (unlikely(!values[i])) { __Pyx_RaiseArgtupleInvalid("get_reference_name", 1, 1, 1, i); __PYX_ERR(0, 4414, __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, 4414, __pyx_L3_error)
    }
    __pyx_v_tid = values[0];
  }
  goto __pyx_L6_skip;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("get_reference_name", 1, 1, 1, __pyx_nargs); __PYX_ERR(0, 4414, __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("pysam.libcbcf.VariantFile.get_reference_name", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_5pysam_7libcbcf_11VariantFile_22get_reference_name(((struct __pyx_obj_5pysam_7libcbcf_VariantFile *)__pyx_v_self), __pyx_v_tid);

  /* 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_5pysam_7libcbcf_11VariantFile_22get_reference_name(struct __pyx_obj_5pysam_7libcbcf_VariantFile *__pyx_v_self, PyObject *__pyx_v_tid) {
  bcf_hdr_t *__pyx_v_hdr;
  int __pyx_v_rid;
  PyObject *__pyx_r = NULL;
  __Pyx_TraceDeclarationsFunc
  __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;
  bcf_hdr_t *__pyx_t_7;
  int __pyx_t_8;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_TraceFrameInit(((PyObject *)__pyx_mstate_global->__pyx_codeobj_tab[376]))
  __Pyx_RefNannySetupContext("get_reference_name", 0);
  __Pyx_TraceStartFunc("get_reference_name", __pyx_f[0], 4414, 0, 0, 0, __PYX_ERR(0, 4414, __pyx_L1_error));

  /* "pysam/libcbcf.pyx":4418
 *         return :term:`reference` name corresponding to numerical :term:`tid`
 *         """
 *         if not self.is_open:             # <<<<<<<<<<<<<<
 *             raise ValueError('I/O operation on closed file')
 * 
*/
  __pyx_t_1 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_mstate_global->__pyx_n_u_is_open); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 4418, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_2 = __Pyx_PyObject_IsTrue(__pyx_t_1); if (unlikely((__pyx_t_2 < 0))) __PYX_ERR(0, 4418, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_t_3 = (!__pyx_t_2);
  if (unlikely(__pyx_t_3)) {

    /* "pysam/libcbcf.pyx":4419
 *         """
 *         if not self.is_open:
 *             raise ValueError('I/O operation on closed file')             # <<<<<<<<<<<<<<
 * 
 *         cdef bcf_hdr_t *hdr = self.header.ptr
*/
    __pyx_t_4 = NULL;
    __Pyx_INCREF(__pyx_builtin_ValueError);
    __pyx_t_5 = __pyx_builtin_ValueError; 
    __pyx_t_6 = 1;
    {
      PyObject *__pyx_callargs[2] = {__pyx_t_4, __pyx_mstate_global->__pyx_kp_u_I_O_operation_on_closed_file};
      __pyx_t_1 = __Pyx_PyObject_FastCall(__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, 4419, __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, 4419, __pyx_L1_error)

    /* "pysam/libcbcf.pyx":4418
 *         return :term:`reference` name corresponding to numerical :term:`tid`
 *         """
 *         if not self.is_open:             # <<<<<<<<<<<<<<
 *             raise ValueError('I/O operation on closed file')
 * 
*/
  }

  /* "pysam/libcbcf.pyx":4421
 *             raise ValueError('I/O operation on closed file')
 * 
 *         cdef bcf_hdr_t *hdr = self.header.ptr             # <<<<<<<<<<<<<<
 *         cdef int rid = tid
 *         if rid < 0 or rid >= hdr.n[BCF_DT_CTG]:
*/
  __pyx_t_7 = __pyx_v_self->header->ptr;
  __pyx_v_hdr = __pyx_t_7;

  /* "pysam/libcbcf.pyx":4422
 * 
 *         cdef bcf_hdr_t *hdr = self.header.ptr
 *         cdef int rid = tid             # <<<<<<<<<<<<<<
 *         if rid < 0 or rid >= hdr.n[BCF_DT_CTG]:
 *             raise ValueError('Invalid tid')
*/
  __pyx_t_8 = __Pyx_PyLong_As_int(__pyx_v_tid); if (unlikely((__pyx_t_8 == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 4422, __pyx_L1_error)
  __pyx_v_rid = __pyx_t_8;

  /* "pysam/libcbcf.pyx":4423
 *         cdef bcf_hdr_t *hdr = self.header.ptr
 *         cdef int rid = tid
 *         if rid < 0 or rid >= hdr.n[BCF_DT_CTG]:             # <<<<<<<<<<<<<<
 *             raise ValueError('Invalid tid')
 *         return bcf_str_cache_get_charptr(bcf_hdr_id2name(hdr, rid))
*/
  __pyx_t_2 = (__pyx_v_rid < 0);
  if (!__pyx_t_2) {
  } else {
    __pyx_t_3 = __pyx_t_2;
    goto __pyx_L5_bool_binop_done;
  }
  __pyx_t_2 = (__pyx_v_rid >= (__pyx_v_hdr->n[BCF_DT_CTG]));
  __pyx_t_3 = __pyx_t_2;
  __pyx_L5_bool_binop_done:;
  if (unlikely(__pyx_t_3)) {

    /* "pysam/libcbcf.pyx":4424
 *         cdef int rid = tid
 *         if rid < 0 or rid >= hdr.n[BCF_DT_CTG]:
 *             raise ValueError('Invalid tid')             # <<<<<<<<<<<<<<
 *         return bcf_str_cache_get_charptr(bcf_hdr_id2name(hdr, rid))
 * 
*/
    __pyx_t_5 = NULL;
    __Pyx_INCREF(__pyx_builtin_ValueError);
    __pyx_t_4 = __pyx_builtin_ValueError; 
    __pyx_t_6 = 1;
    {
      PyObject *__pyx_callargs[2] = {__pyx_t_5, __pyx_mstate_global->__pyx_kp_u_Invalid_tid};
      __pyx_t_1 = __Pyx_PyObject_FastCall(__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, 4424, __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, 4424, __pyx_L1_error)

    /* "pysam/libcbcf.pyx":4423
 *         cdef bcf_hdr_t *hdr = self.header.ptr
 *         cdef int rid = tid
 *         if rid < 0 or rid >= hdr.n[BCF_DT_CTG]:             # <<<<<<<<<<<<<<
 *             raise ValueError('Invalid tid')
 *         return bcf_str_cache_get_charptr(bcf_hdr_id2name(hdr, rid))
*/
  }

  /* "pysam/libcbcf.pyx":4425
 *         if rid < 0 or rid >= hdr.n[BCF_DT_CTG]:
 *             raise ValueError('Invalid tid')
 *         return bcf_str_cache_get_charptr(bcf_hdr_id2name(hdr, rid))             # <<<<<<<<<<<<<<
 * 
 *     def fetch(self, contig=None, start=None, stop=None, region=None, reopen=False, end=None, reference=None):
*/
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = __pyx_f_5pysam_7libcbcf_bcf_str_cache_get_charptr(bcf_hdr_id2name(__pyx_v_hdr, __pyx_v_rid)); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 4425, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  __Pyx_TraceReturnValue(__pyx_r, 30, 0, __PYX_ERR(0, 4425, __pyx_L1_error));
  goto __pyx_L0;

  /* "pysam/libcbcf.pyx":4414
 *         return kh_val_vdict(d, k).id if k != kh_end(d) else -1
 * 
 *     def get_reference_name(self, tid):             # <<<<<<<<<<<<<<
 *         """
 *         return :term:`reference` name corresponding to numerical :term:`tid`
*/

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_XDECREF(__pyx_t_5);
  __Pyx_TraceException(__pyx_lineno, 0, 0);
  #if CYTHON_USE_SYS_MONITORING
  __Pyx_TraceExceptionUnwind(0, 0);
  #else
  __Pyx_TraceReturnValue(NULL, 0, 0, __PYX_ERR(0, 4414, __pyx_L1_error));
  #endif
  __Pyx_AddTraceback("pysam.libcbcf.VariantFile.get_reference_name", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_PyMonitoring_ExitScope(0);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "pysam/libcbcf.pyx":4427
 *         return bcf_str_cache_get_charptr(bcf_hdr_id2name(hdr, rid))
 * 
 *     def fetch(self, contig=None, start=None, stop=None, region=None, reopen=False, end=None, reference=None):             # <<<<<<<<<<<<<<
 *         """fetch records in a :term:`region`, specified either by
 *         :term:`contig`, *start*, and *end* (which are 0-based, half-open);
*/

/* Python wrapper */
static PyObject *__pyx_pw_5pysam_7libcbcf_11VariantFile_25fetch(PyObject *__pyx_v_self, 
#if 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_5pysam_7libcbcf_11VariantFile_24fetch, "VariantFile.fetch(self, contig=None, start=None, stop=None, region=None, reopen=False, end=None, reference=None)\n\nfetch records in a :term:`region`, specified either by\n:term:`contig`, *start*, and *end* (which are 0-based, half-open);\nor alternatively by a samtools :term:`region` string (which is\n1-based inclusive).\n\nWithout *contig* or *region* all mapped records will be fetched.  The\nrecords will be returned ordered by contig, which will not necessarily\nbe the order within the file.\n\nSet *reopen* to true if you will be using multiple iterators on the\nsame file at the same time.  The iterator returned will receive its\nown copy of a filehandle to the file effectively re-opening the\nfile.  Re-opening a file incurrs some overhead, so use with care.\n\nIf only *contig* is set, all records on *contig* will be fetched.\nIf both *region* and *contig* are given, an exception is raised.\n\nNote that a bgzipped :term:`VCF`.gz file without a tabix/CSI index\n(.tbi/.csi) or a :term:`BCF` file without a CSI index can only be\nread sequentially.");
static PyMethodDef __pyx_mdef_5pysam_7libcbcf_11VariantFile_25fetch = {"fetch", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_5pysam_7libcbcf_11VariantFile_25fetch, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_5pysam_7libcbcf_11VariantFile_24fetch};
static PyObject *__pyx_pw_5pysam_7libcbcf_11VariantFile_25fetch(PyObject *__pyx_v_self, 
#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_contig = 0;
  PyObject *__pyx_v_start = 0;
  PyObject *__pyx_v_stop = 0;
  PyObject *__pyx_v_region = 0;
  PyObject *__pyx_v_reopen = 0;
  PyObject *__pyx_v_end = 0;
  PyObject *__pyx_v_reference = 0;
  #if !CYTHON_METH_FASTCALL
  CYTHON_UNUSED Py_ssize_t __pyx_nargs;
  #endif
  CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
  PyObject* values[7] = {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("fetch (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_contig,&__pyx_mstate_global->__pyx_n_u_start,&__pyx_mstate_global->__pyx_n_u_stop,&__pyx_mstate_global->__pyx_n_u_region,&__pyx_mstate_global->__pyx_n_u_reopen,&__pyx_mstate_global->__pyx_n_u_end,&__pyx_mstate_global->__pyx_n_u_reference,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, 4427, __pyx_L3_error)
    if (__pyx_kwds_len > 0) {
      switch (__pyx_nargs) {
        case  7:
        values[6] = __Pyx_ArgRef_FASTCALL(__pyx_args, 6);
        if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[6])) __PYX_ERR(0, 4427, __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, 4427, __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, 4427, __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, 4427, __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, 4427, __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, 4427, __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, 4427, __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, "fetch", 0) < 0) __PYX_ERR(0, 4427, __pyx_L3_error)
      if (!values[0]) values[0] = __Pyx_NewRef(((PyObject *)Py_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 *)Py_None));
      if (!values[4]) values[4] = __Pyx_NewRef(((PyObject *)Py_False));
      if (!values[5]) values[5] = __Pyx_NewRef(((PyObject *)Py_None));
      if (!values[6]) values[6] = __Pyx_NewRef(((PyObject *)Py_None));
    } else {
      switch (__pyx_nargs) {
        case  7:
        values[6] = __Pyx_ArgRef_FASTCALL(__pyx_args, 6);
        if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[6])) __PYX_ERR(0, 4427, __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, 4427, __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, 4427, __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, 4427, __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, 4427, __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, 4427, __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, 4427, __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 *)Py_None));
      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_False));
      if (!values[5]) values[5] = __Pyx_NewRef(((PyObject *)Py_None));
      if (!values[6]) values[6] = __Pyx_NewRef(((PyObject *)Py_None));
    }
    __pyx_v_contig = values[0];
    __pyx_v_start = values[1];
    __pyx_v_stop = values[2];
    __pyx_v_region = values[3];
    __pyx_v_reopen = values[4];
    __pyx_v_end = values[5];
    __pyx_v_reference = values[6];
  }
  goto __pyx_L6_skip;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("fetch", 0, 0, 7, __pyx_nargs); __PYX_ERR(0, 4427, __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("pysam.libcbcf.VariantFile.fetch", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_5pysam_7libcbcf_11VariantFile_24fetch(((struct __pyx_obj_5pysam_7libcbcf_VariantFile *)__pyx_v_self), __pyx_v_contig, __pyx_v_start, __pyx_v_stop, __pyx_v_region, __pyx_v_reopen, __pyx_v_end, __pyx_v_reference);

  /* 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_5pysam_7libcbcf_11VariantFile_24fetch(struct __pyx_obj_5pysam_7libcbcf_VariantFile *__pyx_v_self, PyObject *__pyx_v_contig, PyObject *__pyx_v_start, PyObject *__pyx_v_stop, PyObject *__pyx_v_region, PyObject *__pyx_v_reopen, PyObject *__pyx_v_end, PyObject *__pyx_v_reference) {
  PyObject *__pyx_v_bcf = NULL;
  CYTHON_UNUSED PyObject *__pyx_v__ = NULL;
  PyObject *__pyx_v_tid = NULL;
  PyObject *__pyx_r = NULL;
  __Pyx_TraceDeclarationsFunc
  __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;
  PyObject *(*__pyx_t_10)(PyObject *);
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_TraceFrameInit(((PyObject *)__pyx_mstate_global->__pyx_codeobj_tab[377]))
  __Pyx_RefNannySetupContext("fetch", 0);
  __Pyx_TraceStartFunc("fetch", __pyx_f[0], 4427, 0, 0, 0, __PYX_ERR(0, 4427, __pyx_L1_error));
  __Pyx_INCREF(__pyx_v_contig);
  __Pyx_INCREF(__pyx_v_start);
  __Pyx_INCREF(__pyx_v_stop);

  /* "pysam/libcbcf.pyx":4449
 *         read sequentially.
 *         """
 *         if not self.is_open:             # <<<<<<<<<<<<<<
 *             raise ValueError('I/O operation on closed file')
 * 
*/
  __pyx_t_1 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_mstate_global->__pyx_n_u_is_open); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 4449, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_2 = __Pyx_PyObject_IsTrue(__pyx_t_1); if (unlikely((__pyx_t_2 < 0))) __PYX_ERR(0, 4449, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_t_3 = (!__pyx_t_2);
  if (unlikely(__pyx_t_3)) {

    /* "pysam/libcbcf.pyx":4450
 *         """
 *         if not self.is_open:
 *             raise ValueError('I/O operation on closed file')             # <<<<<<<<<<<<<<
 * 
 *         if self.htsfile.is_write:
*/
    __pyx_t_4 = NULL;
    __Pyx_INCREF(__pyx_builtin_ValueError);
    __pyx_t_5 = __pyx_builtin_ValueError; 
    __pyx_t_6 = 1;
    {
      PyObject *__pyx_callargs[2] = {__pyx_t_4, __pyx_mstate_global->__pyx_kp_u_I_O_operation_on_closed_file};
      __pyx_t_1 = __Pyx_PyObject_FastCall(__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, 4450, __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, 4450, __pyx_L1_error)

    /* "pysam/libcbcf.pyx":4449
 *         read sequentially.
 *         """
 *         if not self.is_open:             # <<<<<<<<<<<<<<
 *             raise ValueError('I/O operation on closed file')
 * 
*/
  }

  /* "pysam/libcbcf.pyx":4452
 *             raise ValueError('I/O operation on closed file')
 * 
 *         if self.htsfile.is_write:             # <<<<<<<<<<<<<<
 *             raise ValueError('cannot fetch from Variantfile opened for writing')
 * 
*/
  __pyx_t_3 = (__pyx_v_self->__pyx_base.htsfile->is_write != 0);
  if (unlikely(__pyx_t_3)) {

    /* "pysam/libcbcf.pyx":4453
 * 
 *         if self.htsfile.is_write:
 *             raise ValueError('cannot fetch from Variantfile opened for writing')             # <<<<<<<<<<<<<<
 * 
 *         if contig is None and region is None:
*/
    __pyx_t_5 = NULL;
    __Pyx_INCREF(__pyx_builtin_ValueError);
    __pyx_t_4 = __pyx_builtin_ValueError; 
    __pyx_t_6 = 1;
    {
      PyObject *__pyx_callargs[2] = {__pyx_t_5, __pyx_mstate_global->__pyx_kp_u_cannot_fetch_from_Variantfile_op};
      __pyx_t_1 = __Pyx_PyObject_FastCall(__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, 4453, __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, 4453, __pyx_L1_error)

    /* "pysam/libcbcf.pyx":4452
 *             raise ValueError('I/O operation on closed file')
 * 
 *         if self.htsfile.is_write:             # <<<<<<<<<<<<<<
 *             raise ValueError('cannot fetch from Variantfile opened for writing')
 * 
*/
  }

  /* "pysam/libcbcf.pyx":4455
 *             raise ValueError('cannot fetch from Variantfile opened for writing')
 * 
 *         if contig is None and region is None:             # <<<<<<<<<<<<<<
 *             self.is_reading = 1
 *             bcf = self.copy() if reopen else self
*/
  __pyx_t_2 = (__pyx_v_contig == Py_None);
  if (__pyx_t_2) {
  } else {
    __pyx_t_3 = __pyx_t_2;
    goto __pyx_L6_bool_binop_done;
  }
  __pyx_t_2 = (__pyx_v_region == Py_None);
  __pyx_t_3 = __pyx_t_2;
  __pyx_L6_bool_binop_done:;
  if (__pyx_t_3) {

    /* "pysam/libcbcf.pyx":4456
 * 
 *         if contig is None and region is None:
 *             self.is_reading = 1             # <<<<<<<<<<<<<<
 *             bcf = self.copy() if reopen else self
 *             bcf.seek(self.start_offset)
*/
    __pyx_v_self->is_reading = 1;

    /* "pysam/libcbcf.pyx":4457
 *         if contig is None and region is None:
 *             self.is_reading = 1
 *             bcf = self.copy() if reopen else self             # <<<<<<<<<<<<<<
 *             bcf.seek(self.start_offset)
 *             return iter(bcf)
*/
    __pyx_t_3 = __Pyx_PyObject_IsTrue(__pyx_v_reopen); if (unlikely((__pyx_t_3 < 0))) __PYX_ERR(0, 4457, __pyx_L1_error)
    if (__pyx_t_3) {
      __pyx_t_5 = ((PyObject *)__pyx_v_self);
      __Pyx_INCREF(__pyx_t_5);
      __pyx_t_6 = 0;
      {
        PyObject *__pyx_callargs[2] = {__pyx_t_5, NULL};
        __pyx_t_4 = __Pyx_PyObject_FastCallMethod(__pyx_mstate_global->__pyx_n_u_copy, __pyx_callargs+__pyx_t_6, (1-__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(0, 4457, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_4);
      }
      __pyx_t_1 = __pyx_t_4;
      __pyx_t_4 = 0;
    } else {
      __Pyx_INCREF((PyObject *)__pyx_v_self);
      __pyx_t_1 = ((PyObject *)__pyx_v_self);
    }
    __pyx_v_bcf = __pyx_t_1;
    __pyx_t_1 = 0;

    /* "pysam/libcbcf.pyx":4458
 *             self.is_reading = 1
 *             bcf = self.copy() if reopen else self
 *             bcf.seek(self.start_offset)             # <<<<<<<<<<<<<<
 *             return iter(bcf)
 * 
*/
    __pyx_t_4 = __pyx_v_bcf;
    __Pyx_INCREF(__pyx_t_4);
    __pyx_t_5 = __Pyx_PyLong_From_int64_t(__pyx_v_self->__pyx_base.start_offset); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 4458, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_5);
    __pyx_t_6 = 0;
    {
      PyObject *__pyx_callargs[2] = {__pyx_t_4, __pyx_t_5};
      __pyx_t_1 = __Pyx_PyObject_FastCallMethod(__pyx_mstate_global->__pyx_n_u_seek, __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, 4458, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_1);
    }
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

    /* "pysam/libcbcf.pyx":4459
 *             bcf = self.copy() if reopen else self
 *             bcf.seek(self.start_offset)
 *             return iter(bcf)             # <<<<<<<<<<<<<<
 * 
 *         if self.index is None:
*/
    __Pyx_XDECREF(__pyx_r);
    __pyx_t_1 = PyObject_GetIter(__pyx_v_bcf); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 4459, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __pyx_r = __pyx_t_1;
    __pyx_t_1 = 0;
    __Pyx_TraceReturnValue(__pyx_r, 46, 0, __PYX_ERR(0, 4459, __pyx_L1_error));
    goto __pyx_L0;

    /* "pysam/libcbcf.pyx":4455
 *             raise ValueError('cannot fetch from Variantfile opened for writing')
 * 
 *         if contig is None and region is None:             # <<<<<<<<<<<<<<
 *             self.is_reading = 1
 *             bcf = self.copy() if reopen else self
*/
  }

  /* "pysam/libcbcf.pyx":4461
 *             return iter(bcf)
 * 
 *         if self.index is None:             # <<<<<<<<<<<<<<
 *             raise ValueError('fetch requires an index')
 * 
*/
  __pyx_t_3 = (((PyObject *)__pyx_v_self->index) == Py_None);
  if (unlikely(__pyx_t_3)) {

    /* "pysam/libcbcf.pyx":4462
 * 
 *         if self.index is None:
 *             raise ValueError('fetch requires an index')             # <<<<<<<<<<<<<<
 * 
 *         _, tid, start, stop = self.parse_region(contig, start, stop, region,
*/
    __pyx_t_5 = NULL;
    __Pyx_INCREF(__pyx_builtin_ValueError);
    __pyx_t_4 = __pyx_builtin_ValueError; 
    __pyx_t_6 = 1;
    {
      PyObject *__pyx_callargs[2] = {__pyx_t_5, __pyx_mstate_global->__pyx_kp_u_fetch_requires_an_index};
      __pyx_t_1 = __Pyx_PyObject_FastCall(__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, 4462, __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, 4462, __pyx_L1_error)

    /* "pysam/libcbcf.pyx":4461
 *             return iter(bcf)
 * 
 *         if self.index is None:             # <<<<<<<<<<<<<<
 *             raise ValueError('fetch requires an index')
 * 
*/
  }

  /* "pysam/libcbcf.pyx":4464
 *             raise ValueError('fetch requires an index')
 * 
 *         _, tid, start, stop = self.parse_region(contig, start, stop, region,             # <<<<<<<<<<<<<<
 *                                                 None, end=end, reference=reference)
 * 
*/
  __pyx_t_4 = ((PyObject *)__pyx_v_self);
  __Pyx_INCREF(__pyx_t_4);

  /* "pysam/libcbcf.pyx":4465
 * 
 *         _, tid, start, stop = self.parse_region(contig, start, stop, region,
 *                                                 None, end=end, reference=reference)             # <<<<<<<<<<<<<<
 * 
 *         if contig is None:
*/
  __pyx_t_6 = 0;
  {
    PyObject *__pyx_callargs[6 + ((CYTHON_VECTORCALL) ? 2 : 0)] = {__pyx_t_4, __pyx_v_contig, __pyx_v_start, __pyx_v_stop, __pyx_v_region, Py_None};
    __pyx_t_5 = __Pyx_MakeVectorcallBuilderKwds(2); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 4464, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_5);
    if (__Pyx_VectorcallBuilder_AddArg(__pyx_mstate_global->__pyx_n_u_end, __pyx_v_end, __pyx_t_5, __pyx_callargs+6, 0) < 0) __PYX_ERR(0, 4464, __pyx_L1_error)
    if (__Pyx_VectorcallBuilder_AddArg(__pyx_mstate_global->__pyx_n_u_reference, __pyx_v_reference, __pyx_t_5, __pyx_callargs+6, 1) < 0) __PYX_ERR(0, 4464, __pyx_L1_error)
    __pyx_t_1 = __Pyx_Object_VectorcallMethod_CallFromBuilder(__pyx_mstate_global->__pyx_n_u_parse_region, __pyx_callargs+__pyx_t_6, (6-__pyx_t_6) | (1*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET), __pyx_t_5);
    __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, 4464, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
  }
  if ((likely(PyTuple_CheckExact(__pyx_t_1))) || (PyList_CheckExact(__pyx_t_1))) {
    PyObject* sequence = __pyx_t_1;
    Py_ssize_t size = __Pyx_PySequence_SIZE(sequence);
    if (unlikely(size != 4)) {
      if (size > 4) __Pyx_RaiseTooManyValuesError(4);
      else if (size >= 0) __Pyx_RaiseNeedMoreValuesError(size);
      __PYX_ERR(0, 4464, __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_4 = PyTuple_GET_ITEM(sequence, 1);
      __Pyx_INCREF(__pyx_t_4);
      __pyx_t_7 = PyTuple_GET_ITEM(sequence, 2);
      __Pyx_INCREF(__pyx_t_7);
      __pyx_t_8 = PyTuple_GET_ITEM(sequence, 3);
      __Pyx_INCREF(__pyx_t_8);
    } else {
      __pyx_t_5 = __Pyx_PyList_GetItemRef(sequence, 0);
      if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 4464, __pyx_L1_error)
      __Pyx_XGOTREF(__pyx_t_5);
      __pyx_t_4 = __Pyx_PyList_GetItemRef(sequence, 1);
      if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 4464, __pyx_L1_error)
      __Pyx_XGOTREF(__pyx_t_4);
      __pyx_t_7 = __Pyx_PyList_GetItemRef(sequence, 2);
      if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 4464, __pyx_L1_error)
      __Pyx_XGOTREF(__pyx_t_7);
      __pyx_t_8 = __Pyx_PyList_GetItemRef(sequence, 3);
      if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 4464, __pyx_L1_error)
      __Pyx_XGOTREF(__pyx_t_8);
    }
    #else
    {
      Py_ssize_t i;
      PyObject** temps[4] = {&__pyx_t_5,&__pyx_t_4,&__pyx_t_7,&__pyx_t_8};
      for (i=0; i < 4; i++) {
        PyObject* item = __Pyx_PySequence_ITEM(sequence, i); if (unlikely(!item)) __PYX_ERR(0, 4464, __pyx_L1_error)
        __Pyx_GOTREF(item);
        *(temps[i]) = item;
      }
    }
    #endif
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  } else {
    Py_ssize_t index = -1;
    PyObject** temps[4] = {&__pyx_t_5,&__pyx_t_4,&__pyx_t_7,&__pyx_t_8};
    __pyx_t_9 = PyObject_GetIter(__pyx_t_1); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 4464, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_9);
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    __pyx_t_10 = (CYTHON_COMPILING_IN_LIMITED_API) ? PyIter_Next : __Pyx_PyObject_GetIterNextFunc(__pyx_t_9);
    for (index=0; index < 4; index++) {
      PyObject* item = __pyx_t_10(__pyx_t_9); if (unlikely(!item)) goto __pyx_L9_unpacking_failed;
      __Pyx_GOTREF(item);
      *(temps[index]) = item;
    }
    if (__Pyx_IternextUnpackEndCheck(__pyx_t_10(__pyx_t_9), 4) < 0) __PYX_ERR(0, 4464, __pyx_L1_error)
    __pyx_t_10 = NULL;
    __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
    goto __pyx_L10_unpacking_done;
    __pyx_L9_unpacking_failed:;
    __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
    __pyx_t_10 = NULL;
    if (__Pyx_IterFinish() == 0) __Pyx_RaiseNeedMoreValuesError(index);
    __PYX_ERR(0, 4464, __pyx_L1_error)
    __pyx_L10_unpacking_done:;
  }

  /* "pysam/libcbcf.pyx":4464
 *             raise ValueError('fetch requires an index')
 * 
 *         _, tid, start, stop = self.parse_region(contig, start, stop, region,             # <<<<<<<<<<<<<<
 *                                                 None, end=end, reference=reference)
 * 
*/
  __pyx_v__ = __pyx_t_5;
  __pyx_t_5 = 0;
  __pyx_v_tid = __pyx_t_4;
  __pyx_t_4 = 0;
  __Pyx_DECREF_SET(__pyx_v_start, __pyx_t_7);
  __pyx_t_7 = 0;
  __Pyx_DECREF_SET(__pyx_v_stop, __pyx_t_8);
  __pyx_t_8 = 0;

  /* "pysam/libcbcf.pyx":4467
 *                                                 None, end=end, reference=reference)
 * 
 *         if contig is None:             # <<<<<<<<<<<<<<
 *             contig = self.get_reference_name(tid)
 * 
*/
  __pyx_t_3 = (__pyx_v_contig == Py_None);
  if (__pyx_t_3) {

    /* "pysam/libcbcf.pyx":4468
 * 
 *         if contig is None:
 *             contig = self.get_reference_name(tid)             # <<<<<<<<<<<<<<
 * 
 *         self.is_reading = 1
*/
    __pyx_t_8 = ((PyObject *)__pyx_v_self);
    __Pyx_INCREF(__pyx_t_8);
    __pyx_t_6 = 0;
    {
      PyObject *__pyx_callargs[2] = {__pyx_t_8, __pyx_v_tid};
      __pyx_t_1 = __Pyx_PyObject_FastCallMethod(__pyx_mstate_global->__pyx_n_u_get_reference_name, __pyx_callargs+__pyx_t_6, (2-__pyx_t_6) | (1*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
      __Pyx_XDECREF(__pyx_t_8); __pyx_t_8 = 0;
      if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 4468, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_1);
    }
    __Pyx_DECREF_SET(__pyx_v_contig, __pyx_t_1);
    __pyx_t_1 = 0;

    /* "pysam/libcbcf.pyx":4467
 *                                                 None, end=end, reference=reference)
 * 
 *         if contig is None:             # <<<<<<<<<<<<<<
 *             contig = self.get_reference_name(tid)
 * 
*/
  }

  /* "pysam/libcbcf.pyx":4470
 *             contig = self.get_reference_name(tid)
 * 
 *         self.is_reading = 1             # <<<<<<<<<<<<<<
 *         return self.index.fetch(self, contig, start, stop, reopen)
 * 
*/
  __pyx_v_self->is_reading = 1;

  /* "pysam/libcbcf.pyx":4471
 * 
 *         self.is_reading = 1
 *         return self.index.fetch(self, contig, start, stop, reopen)             # <<<<<<<<<<<<<<
 * 
 *     def new_record(self, *args, **kwargs):
*/
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_8 = ((PyObject *)__pyx_v_self->index);
  __Pyx_INCREF(__pyx_t_8);
  __pyx_t_6 = 0;
  {
    PyObject *__pyx_callargs[6] = {__pyx_t_8, ((PyObject *)__pyx_v_self), __pyx_v_contig, __pyx_v_start, __pyx_v_stop, __pyx_v_reopen};
    __pyx_t_1 = __Pyx_PyObject_FastCallMethod(__pyx_mstate_global->__pyx_n_u_fetch, __pyx_callargs+__pyx_t_6, (6-__pyx_t_6) | (1*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
    __Pyx_XDECREF(__pyx_t_8); __pyx_t_8 = 0;
    if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 4471, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
  }
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  __Pyx_TraceReturnValue(__pyx_r, 87, 0, __PYX_ERR(0, 4471, __pyx_L1_error));
  goto __pyx_L0;

  /* "pysam/libcbcf.pyx":4427
 *         return bcf_str_cache_get_charptr(bcf_hdr_id2name(hdr, rid))
 * 
 *     def fetch(self, contig=None, start=None, stop=None, region=None, reopen=False, end=None, reference=None):             # <<<<<<<<<<<<<<
 *         """fetch records in a :term:`region`, specified either by
 *         :term:`contig`, *start*, and *end* (which are 0-based, half-open);
*/

  /* 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_XDECREF(__pyx_t_8);
  __Pyx_XDECREF(__pyx_t_9);
  __Pyx_TraceException(__pyx_lineno, 0, 0);
  #if CYTHON_USE_SYS_MONITORING
  __Pyx_TraceExceptionUnwind(0, 0);
  #else
  __Pyx_TraceReturnValue(NULL, 0, 0, __PYX_ERR(0, 4427, __pyx_L1_error));
  #endif
  __Pyx_AddTraceback("pysam.libcbcf.VariantFile.fetch", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_bcf);
  __Pyx_XDECREF(__pyx_v__);
  __Pyx_XDECREF(__pyx_v_tid);
  __Pyx_XDECREF(__pyx_v_contig);
  __Pyx_XDECREF(__pyx_v_start);
  __Pyx_XDECREF(__pyx_v_stop);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_PyMonitoring_ExitScope(0);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "pysam/libcbcf.pyx":4473
 *         return self.index.fetch(self, contig, start, stop, reopen)
 * 
 *     def new_record(self, *args, **kwargs):             # <<<<<<<<<<<<<<
 *         """Create a new empty :class:`VariantRecord`.
 * 
*/

/* Python wrapper */
static PyObject *__pyx_pw_5pysam_7libcbcf_11VariantFile_27new_record(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
PyDoc_STRVAR(__pyx_doc_5pysam_7libcbcf_11VariantFile_26new_record, "VariantFile.new_record(self, *args, **kwargs)\n\nCreate a new empty :class:`VariantRecord`.\n\nSee :meth:`VariantHeader.new_record`");
static PyMethodDef __pyx_mdef_5pysam_7libcbcf_11VariantFile_27new_record = {"new_record", (PyCFunction)(void(*)(void))(PyCFunctionWithKeywords)__pyx_pw_5pysam_7libcbcf_11VariantFile_27new_record, METH_VARARGS|METH_KEYWORDS, __pyx_doc_5pysam_7libcbcf_11VariantFile_26new_record};
static PyObject *__pyx_pw_5pysam_7libcbcf_11VariantFile_27new_record(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_args = 0;
  PyObject *__pyx_v_kwargs = 0;
  CYTHON_UNUSED Py_ssize_t __pyx_nargs;
  CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("new_record (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 NULL;
  #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 NULL;
  if (__pyx_kwds_len > 0) {
    if (unlikely(__Pyx_CheckKeywordStrings("new_record", __pyx_kwds) == -1)) return NULL;
    __pyx_v_kwargs = __Pyx_KwargsAsDict_VARARGS(__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_INCREF(__pyx_args);
  __pyx_v_args = __pyx_args;
  __pyx_r = __pyx_pf_5pysam_7libcbcf_11VariantFile_26new_record(((struct __pyx_obj_5pysam_7libcbcf_VariantFile *)__pyx_v_self), __pyx_v_args, __pyx_v_kwargs);

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

static PyObject *__pyx_pf_5pysam_7libcbcf_11VariantFile_26new_record(struct __pyx_obj_5pysam_7libcbcf_VariantFile *__pyx_v_self, PyObject *__pyx_v_args, PyObject *__pyx_v_kwargs) {
  PyObject *__pyx_r = NULL;
  __Pyx_TraceDeclarationsFunc
  __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_TraceFrameInit(((PyObject *)__pyx_mstate_global->__pyx_codeobj_tab[378]))
  __Pyx_RefNannySetupContext("new_record", 0);
  __Pyx_TraceStartFunc("new_record", __pyx_f[0], 4473, 0, 0, 0, __PYX_ERR(0, 4473, __pyx_L1_error));

  /* "pysam/libcbcf.pyx":4478
 *         See :meth:`VariantHeader.new_record`
 *         """
 *         return self.header.new_record(*args, **kwargs)             # <<<<<<<<<<<<<<
 * 
 *     cpdef int write(self, VariantRecord record) except -1:
*/
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self->header), __pyx_mstate_global->__pyx_n_u_new_record); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 4478, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_2 = PyDict_Copy(__pyx_v_kwargs); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 4478, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_3 = __Pyx_PyObject_Call(__pyx_t_1, __pyx_v_args, __pyx_t_2); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 4478, __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;
  __Pyx_TraceReturnValue(__pyx_r, 1, 0, __PYX_ERR(0, 4478, __pyx_L1_error));
  goto __pyx_L0;

  /* "pysam/libcbcf.pyx":4473
 *         return self.index.fetch(self, contig, start, stop, reopen)
 * 
 *     def new_record(self, *args, **kwargs):             # <<<<<<<<<<<<<<
 *         """Create a new empty :class:`VariantRecord`.
 * 
*/

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_TraceException(__pyx_lineno, 0, 0);
  #if CYTHON_USE_SYS_MONITORING
  __Pyx_TraceExceptionUnwind(0, 0);
  #else
  __Pyx_TraceReturnValue(NULL, 0, 0, __PYX_ERR(0, 4473, __pyx_L1_error));
  #endif
  __Pyx_AddTraceback("pysam.libcbcf.VariantFile.new_record", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_PyMonitoring_ExitScope(0);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "pysam/libcbcf.pyx":4480
 *         return self.header.new_record(*args, **kwargs)
 * 
 *     cpdef int write(self, VariantRecord record) except -1:             # <<<<<<<<<<<<<<
 *         """
 *         write a single :class:`pysam.VariantRecord` to disk.
*/

static PyObject *__pyx_pw_5pysam_7libcbcf_11VariantFile_29write(PyObject *__pyx_v_self, 
#if 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 int __pyx_f_5pysam_7libcbcf_11VariantFile_write(struct __pyx_obj_5pysam_7libcbcf_VariantFile *__pyx_v_self, struct __pyx_obj_5pysam_7libcbcf_VariantRecord *__pyx_v_record, int __pyx_skip_dispatch) {
  int __pyx_v_ret;
  PyObject *__pyx_v_msg = NULL;
  int __pyx_r;
  __Pyx_TraceDeclarationsFunc
  __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_t_8;
  struct __pyx_opt_args_5pysam_9libcutils_OSError_from_errno __pyx_t_9;
  PyObject *__pyx_t_10 = NULL;
  PyObject *__pyx_t_11 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_TraceFrameInit(((PyObject *)__pyx_mstate_global->__pyx_codeobj_tab[379]))
  __Pyx_RefNannySetupContext("write", 0);
  __Pyx_TraceStartFunc("write", __pyx_f[0], 4480, 0, 0, __pyx_skip_dispatch, __PYX_ERR(0, 4480, __pyx_L1_error));
  /* 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_5pysam_7libcbcf_VariantFile &&
  __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_write); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 4480, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_1);
      if (!__Pyx_IsSameCFunction(__pyx_t_1, (void(*)(void)) __pyx_pw_5pysam_7libcbcf_11VariantFile_29write)) {
        __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, ((PyObject *)__pyx_v_record)};
          __pyx_t_2 = __Pyx_PyObject_FastCall(__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_2)) __PYX_ERR(0, 4480, __pyx_L1_error)
          __Pyx_GOTREF(__pyx_t_2);
        }
        __pyx_t_6 = __Pyx_PyLong_As_int(__pyx_t_2); if (unlikely((__pyx_t_6 == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 4480, __pyx_L1_error)
        __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
        __pyx_r = __pyx_t_6;
        __Pyx_TraceReturnCValue(__pyx_r, __Pyx_PyLong_From_int, 0, 0, __PYX_ERR(0, 4480, __pyx_L1_error));
        __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
  }

  /* "pysam/libcbcf.pyx":4486
 *         returns the number of bytes written.
 *         """
 *         if record is None:             # <<<<<<<<<<<<<<
 *             raise ValueError('record must not be None')
 * 
*/
  __pyx_t_7 = (((PyObject *)__pyx_v_record) == Py_None);
  if (unlikely(__pyx_t_7)) {

    /* "pysam/libcbcf.pyx":4487
 *         """
 *         if record is None:
 *             raise ValueError('record must not be None')             # <<<<<<<<<<<<<<
 * 
 *         if not self.is_open:
*/
    __pyx_t_2 = NULL;
    __Pyx_INCREF(__pyx_builtin_ValueError);
    __pyx_t_4 = __pyx_builtin_ValueError; 
    __pyx_t_5 = 1;
    {
      PyObject *__pyx_callargs[2] = {__pyx_t_2, __pyx_mstate_global->__pyx_kp_u_record_must_not_be_None};
      __pyx_t_1 = __Pyx_PyObject_FastCall(__pyx_t_4, __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;
      if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 4487, __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, 4487, __pyx_L1_error)

    /* "pysam/libcbcf.pyx":4486
 *         returns the number of bytes written.
 *         """
 *         if record is None:             # <<<<<<<<<<<<<<
 *             raise ValueError('record must not be None')
 * 
*/
  }

  /* "pysam/libcbcf.pyx":4489
 *             raise ValueError('record must not be None')
 * 
 *         if not self.is_open:             # <<<<<<<<<<<<<<
 *             raise ValueError('I/O operation on closed file')
 * 
*/
  __pyx_t_1 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_mstate_global->__pyx_n_u_is_open); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 4489, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_7 = __Pyx_PyObject_IsTrue(__pyx_t_1); if (unlikely((__pyx_t_7 < 0))) __PYX_ERR(0, 4489, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_t_8 = (!__pyx_t_7);
  if (unlikely(__pyx_t_8)) {

    /* "pysam/libcbcf.pyx":4490
 * 
 *         if not self.is_open:
 *             raise ValueError('I/O operation on closed file')             # <<<<<<<<<<<<<<
 * 
 *         if not self.htsfile.is_write:
*/
    __pyx_t_4 = NULL;
    __Pyx_INCREF(__pyx_builtin_ValueError);
    __pyx_t_2 = __pyx_builtin_ValueError; 
    __pyx_t_5 = 1;
    {
      PyObject *__pyx_callargs[2] = {__pyx_t_4, __pyx_mstate_global->__pyx_kp_u_I_O_operation_on_closed_file};
      __pyx_t_1 = __Pyx_PyObject_FastCall(__pyx_t_2, __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_2); __pyx_t_2 = 0;
      if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 4490, __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, 4490, __pyx_L1_error)

    /* "pysam/libcbcf.pyx":4489
 *             raise ValueError('record must not be None')
 * 
 *         if not self.is_open:             # <<<<<<<<<<<<<<
 *             raise ValueError('I/O operation on closed file')
 * 
*/
  }

  /* "pysam/libcbcf.pyx":4492
 *             raise ValueError('I/O operation on closed file')
 * 
 *         if not self.htsfile.is_write:             # <<<<<<<<<<<<<<
 *             raise ValueError('cannot write to a Variantfile opened for reading')
 * 
*/
  __pyx_t_8 = (!(__pyx_v_self->__pyx_base.htsfile->is_write != 0));
  if (unlikely(__pyx_t_8)) {

    /* "pysam/libcbcf.pyx":4493
 * 
 *         if not self.htsfile.is_write:
 *             raise ValueError('cannot write to a Variantfile opened for reading')             # <<<<<<<<<<<<<<
 * 
 *         cdef int ret
*/
    __pyx_t_2 = NULL;
    __Pyx_INCREF(__pyx_builtin_ValueError);
    __pyx_t_4 = __pyx_builtin_ValueError; 
    __pyx_t_5 = 1;
    {
      PyObject *__pyx_callargs[2] = {__pyx_t_2, __pyx_mstate_global->__pyx_kp_u_cannot_write_to_a_Variantfile_op};
      __pyx_t_1 = __Pyx_PyObject_FastCall(__pyx_t_4, __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;
      if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 4493, __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, 4493, __pyx_L1_error)

    /* "pysam/libcbcf.pyx":4492
 *             raise ValueError('I/O operation on closed file')
 * 
 *         if not self.htsfile.is_write:             # <<<<<<<<<<<<<<
 *             raise ValueError('cannot write to a Variantfile opened for reading')
 * 
*/
  }

  /* "pysam/libcbcf.pyx":4497
 *         cdef int ret
 * 
 *         if not self.header_written:             # <<<<<<<<<<<<<<
 *             self.header_written = True
 *             with nogil:
*/
  __pyx_t_8 = (!__pyx_v_self->header_written);
  if (__pyx_t_8) {

    /* "pysam/libcbcf.pyx":4498
 * 
 *         if not self.header_written:
 *             self.header_written = True             # <<<<<<<<<<<<<<
 *             with nogil:
 *                 ret = bcf_hdr_write(self.htsfile, self.header.ptr)
*/
    __pyx_v_self->header_written = 1;

    /* "pysam/libcbcf.pyx":4499
 *         if not self.header_written:
 *             self.header_written = True
 *             with nogil:             # <<<<<<<<<<<<<<
 *                 ret = bcf_hdr_write(self.htsfile, self.header.ptr)
 *             if ret < 0:
*/
    {
        PyThreadState *_save;
        _save = NULL;
        Py_UNBLOCK_THREADS
        __Pyx_FastGIL_Remember();
        /*try:*/ {

          /* "pysam/libcbcf.pyx":4500
 *             self.header_written = True
 *             with nogil:
 *                 ret = bcf_hdr_write(self.htsfile, self.header.ptr)             # <<<<<<<<<<<<<<
 *             if ret < 0:
 *                 raise OSError_from_errno("Can't write headers", self.filename)
*/
          __pyx_v_ret = bcf_hdr_write(__pyx_v_self->__pyx_base.htsfile, __pyx_v_self->header->ptr);
        }

        /* "pysam/libcbcf.pyx":4499
 *         if not self.header_written:
 *             self.header_written = True
 *             with nogil:             # <<<<<<<<<<<<<<
 *                 ret = bcf_hdr_write(self.htsfile, self.header.ptr)
 *             if ret < 0:
*/
        /*finally:*/ {
          /*normal exit:*/{
            __Pyx_FastGIL_Forget();
            Py_BLOCK_THREADS
            goto __pyx_L9;
          }
          __pyx_L9:;
        }
    }

    /* "pysam/libcbcf.pyx":4501
 *             with nogil:
 *                 ret = bcf_hdr_write(self.htsfile, self.header.ptr)
 *             if ret < 0:             # <<<<<<<<<<<<<<
 *                 raise OSError_from_errno("Can't write headers", self.filename)
 * 
*/
    __pyx_t_8 = (__pyx_v_ret < 0);
    if (unlikely(__pyx_t_8)) {

      /* "pysam/libcbcf.pyx":4502
 *                 ret = bcf_hdr_write(self.htsfile, self.header.ptr)
 *             if ret < 0:
 *                 raise OSError_from_errno("Can't write headers", self.filename)             # <<<<<<<<<<<<<<
 * 
 *         #if record.header is not self.header:
*/
      __pyx_t_1 = __pyx_v_self->__pyx_base.filename;
      __Pyx_INCREF(__pyx_t_1);
      __pyx_t_9.__pyx_n = 1;
      __pyx_t_9.filename = __pyx_t_1;
      __pyx_t_4 = __pyx_f_5pysam_9libcutils_OSError_from_errno(__pyx_mstate_global->__pyx_kp_u_Can_t_write_headers, &__pyx_t_9); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 4502, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_4);
      __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
      __Pyx_Raise(__pyx_t_4, 0, 0, 0);
      __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
      __PYX_ERR(0, 4502, __pyx_L1_error)

      /* "pysam/libcbcf.pyx":4501
 *             with nogil:
 *                 ret = bcf_hdr_write(self.htsfile, self.header.ptr)
 *             if ret < 0:             # <<<<<<<<<<<<<<
 *                 raise OSError_from_errno("Can't write headers", self.filename)
 * 
*/
    }

    /* "pysam/libcbcf.pyx":4497
 *         cdef int ret
 * 
 *         if not self.header_written:             # <<<<<<<<<<<<<<
 *             self.header_written = True
 *             with nogil:
*/
  }

  /* "pysam/libcbcf.pyx":4508
 *         #    raise ValueError('Writing records from a different VariantFile is not yet supported')
 * 
 *         if record.ptr.n_sample != bcf_hdr_nsamples(self.header.ptr):             # <<<<<<<<<<<<<<
 *             msg = 'Invalid VariantRecord.  Number of samples does not match header ({} vs {})'
 *             raise ValueError(msg.format(record.ptr.n_sample, bcf_hdr_nsamples(self.header.ptr)))
*/
  __pyx_t_8 = (__pyx_v_record->ptr->n_sample != bcf_hdr_nsamples(__pyx_v_self->header->ptr));
  if (unlikely(__pyx_t_8)) {

    /* "pysam/libcbcf.pyx":4509
 * 
 *         if record.ptr.n_sample != bcf_hdr_nsamples(self.header.ptr):
 *             msg = 'Invalid VariantRecord.  Number of samples does not match header ({} vs {})'             # <<<<<<<<<<<<<<
 *             raise ValueError(msg.format(record.ptr.n_sample, bcf_hdr_nsamples(self.header.ptr)))
 * 
*/
    __Pyx_INCREF(__pyx_mstate_global->__pyx_kp_u_Invalid_VariantRecord_Number_of);
    __pyx_v_msg = __pyx_mstate_global->__pyx_kp_u_Invalid_VariantRecord_Number_of;

    /* "pysam/libcbcf.pyx":4510
 *         if record.ptr.n_sample != bcf_hdr_nsamples(self.header.ptr):
 *             msg = 'Invalid VariantRecord.  Number of samples does not match header ({} vs {})'
 *             raise ValueError(msg.format(record.ptr.n_sample, bcf_hdr_nsamples(self.header.ptr)))             # <<<<<<<<<<<<<<
 * 
 *         # Sync END annotation before writing
*/
    __pyx_t_1 = NULL;
    __Pyx_INCREF(__pyx_builtin_ValueError);
    __pyx_t_2 = __pyx_builtin_ValueError; 
    __pyx_t_3 = __Pyx_PyLong_From_uint32_t(__pyx_v_record->ptr->n_sample); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 4510, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __pyx_t_10 = __Pyx_PyLong_From_int32_t(bcf_hdr_nsamples(__pyx_v_self->header->ptr)); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 4510, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_10);
    __pyx_t_11 = __Pyx_CallUnboundCMethod2(&__pyx_mstate_global->__pyx_umethod_PyUnicode_Type__format, __pyx_v_msg, __pyx_t_3, __pyx_t_10); if (unlikely(!__pyx_t_11)) __PYX_ERR(0, 4510, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_11);
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
    __pyx_t_5 = 1;
    {
      PyObject *__pyx_callargs[2] = {__pyx_t_1, __pyx_t_11};
      __pyx_t_4 = __Pyx_PyObject_FastCall(__pyx_t_2, __pyx_callargs+__pyx_t_5, (2-__pyx_t_5) | (__pyx_t_5*__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET));
      __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0;
      __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0;
      __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
      if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 4510, __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, 4510, __pyx_L1_error)

    /* "pysam/libcbcf.pyx":4508
 *         #    raise ValueError('Writing records from a different VariantFile is not yet supported')
 * 
 *         if record.ptr.n_sample != bcf_hdr_nsamples(self.header.ptr):             # <<<<<<<<<<<<<<
 *             msg = 'Invalid VariantRecord.  Number of samples does not match header ({} vs {})'
 *             raise ValueError(msg.format(record.ptr.n_sample, bcf_hdr_nsamples(self.header.ptr)))
*/
  }

  /* "pysam/libcbcf.pyx":4513
 * 
 *         # Sync END annotation before writing
 *         bcf_sync_end(record)             # <<<<<<<<<<<<<<
 * 
 *         with nogil:
*/
  __pyx_t_4 = __pyx_f_5pysam_7libcbcf_bcf_sync_end(__pyx_v_record); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 4513, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;

  /* "pysam/libcbcf.pyx":4515
 *         bcf_sync_end(record)
 * 
 *         with nogil:             # <<<<<<<<<<<<<<
 *             ret = bcf_write1(self.htsfile, self.header.ptr, record.ptr)
 * 
*/
  {
      PyThreadState *_save;
      _save = NULL;
      Py_UNBLOCK_THREADS
      __Pyx_FastGIL_Remember();
      /*try:*/ {

        /* "pysam/libcbcf.pyx":4516
 * 
 *         with nogil:
 *             ret = bcf_write1(self.htsfile, self.header.ptr, record.ptr)             # <<<<<<<<<<<<<<
 * 
 *         if ret < 0:
*/
        __pyx_v_ret = bcf_write1(__pyx_v_self->__pyx_base.htsfile, __pyx_v_self->header->ptr, __pyx_v_record->ptr);
      }

      /* "pysam/libcbcf.pyx":4515
 *         bcf_sync_end(record)
 * 
 *         with nogil:             # <<<<<<<<<<<<<<
 *             ret = bcf_write1(self.htsfile, self.header.ptr, record.ptr)
 * 
*/
      /*finally:*/ {
        /*normal exit:*/{
          __Pyx_FastGIL_Forget();
          Py_BLOCK_THREADS
          goto __pyx_L14;
        }
        __pyx_L14:;
      }
  }

  /* "pysam/libcbcf.pyx":4518
 *             ret = bcf_write1(self.htsfile, self.header.ptr, record.ptr)
 * 
 *         if ret < 0:             # <<<<<<<<<<<<<<
 *             raise OSError_from_errno("Can't write record", self.filename)
 * 
*/
  __pyx_t_8 = (__pyx_v_ret < 0);
  if (unlikely(__pyx_t_8)) {

    /* "pysam/libcbcf.pyx":4519
 * 
 *         if ret < 0:
 *             raise OSError_from_errno("Can't write record", self.filename)             # <<<<<<<<<<<<<<
 * 
 *         return ret
*/
    __pyx_t_4 = __pyx_v_self->__pyx_base.filename;
    __Pyx_INCREF(__pyx_t_4);
    __pyx_t_9.__pyx_n = 1;
    __pyx_t_9.filename = __pyx_t_4;
    __pyx_t_2 = __pyx_f_5pysam_9libcutils_OSError_from_errno(__pyx_mstate_global->__pyx_kp_u_Can_t_write_record, &__pyx_t_9); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 4519, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    __Pyx_Raise(__pyx_t_2, 0, 0, 0);
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    __PYX_ERR(0, 4519, __pyx_L1_error)

    /* "pysam/libcbcf.pyx":4518
 *             ret = bcf_write1(self.htsfile, self.header.ptr, record.ptr)
 * 
 *         if ret < 0:             # <<<<<<<<<<<<<<
 *             raise OSError_from_errno("Can't write record", self.filename)
 * 
*/
  }

  /* "pysam/libcbcf.pyx":4521
 *             raise OSError_from_errno("Can't write record", self.filename)
 * 
 *         return ret             # <<<<<<<<<<<<<<
 * 
 *     def subset_samples(self, include_samples):
*/
  __pyx_r = __pyx_v_ret;
  __Pyx_TraceReturnCValue(__pyx_r, __Pyx_PyLong_From_int, 103, 0, __PYX_ERR(0, 4521, __pyx_L1_error));
  goto __pyx_L0;

  /* "pysam/libcbcf.pyx":4480
 *         return self.header.new_record(*args, **kwargs)
 * 
 *     cpdef int write(self, VariantRecord record) except -1:             # <<<<<<<<<<<<<<
 *         """
 *         write a single :class:`pysam.VariantRecord` to disk.
*/

  /* 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_10);
  __Pyx_XDECREF(__pyx_t_11);
  __Pyx_TraceException(__pyx_lineno, 0, 0);
  #if CYTHON_USE_SYS_MONITORING
  __Pyx_TraceExceptionUnwind(0, 0);
  #else
  __Pyx_TraceReturnValue(NULL, 0, 0, __PYX_ERR(0, 4480, __pyx_L1_error));
  #endif
  __Pyx_AddTraceback("pysam.libcbcf.VariantFile.write", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = -1;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_msg);
  __Pyx_PyMonitoring_ExitScope(0);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* Python wrapper */
static PyObject *__pyx_pw_5pysam_7libcbcf_11VariantFile_29write(PyObject *__pyx_v_self, 
#if 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_5pysam_7libcbcf_11VariantFile_28write, "VariantFile.write(self, VariantRecord record) -> int\n\nwrite a single :class:`pysam.VariantRecord` to disk.\n\nreturns the number of bytes written.");
static PyMethodDef __pyx_mdef_5pysam_7libcbcf_11VariantFile_29write = {"write", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_5pysam_7libcbcf_11VariantFile_29write, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_5pysam_7libcbcf_11VariantFile_28write};
static PyObject *__pyx_pw_5pysam_7libcbcf_11VariantFile_29write(PyObject *__pyx_v_self, 
#if CYTHON_METH_FASTCALL
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
#else
PyObject *__pyx_args, PyObject *__pyx_kwds
#endif
) {
  struct __pyx_obj_5pysam_7libcbcf_VariantRecord *__pyx_v_record = 0;
  #if !CYTHON_METH_FASTCALL
  CYTHON_UNUSED Py_ssize_t __pyx_nargs;
  #endif
  CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
  PyObject* values[1] = {0};
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("write (wrapper)", 0);
  #if !CYTHON_METH_FASTCALL
  #if CYTHON_ASSUME_SAFE_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_record,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, 4480, __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, 4480, __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, "write", 0) < 0) __PYX_ERR(0, 4480, __pyx_L3_error)
      for (Py_ssize_t i = __pyx_nargs; i < 1; i++) {
        if (unlikely(!values[i])) { __Pyx_RaiseArgtupleInvalid("write", 1, 1, 1, i); __PYX_ERR(0, 4480, __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, 4480, __pyx_L3_error)
    }
    __pyx_v_record = ((struct __pyx_obj_5pysam_7libcbcf_VariantRecord *)values[0]);
  }
  goto __pyx_L6_skip;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("write", 1, 1, 1, __pyx_nargs); __PYX_ERR(0, 4480, __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("pysam.libcbcf.VariantFile.write", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_record), __pyx_mstate_global->__pyx_ptype_5pysam_7libcbcf_VariantRecord, 1, "record", 0))) __PYX_ERR(0, 4480, __pyx_L1_error)
  __pyx_r = __pyx_pf_5pysam_7libcbcf_11VariantFile_28write(((struct __pyx_obj_5pysam_7libcbcf_VariantFile *)__pyx_v_self), __pyx_v_record);

  /* 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_5pysam_7libcbcf_11VariantFile_28write(struct __pyx_obj_5pysam_7libcbcf_VariantFile *__pyx_v_self, struct __pyx_obj_5pysam_7libcbcf_VariantRecord *__pyx_v_record) {
  PyObject *__pyx_r = NULL;
  __Pyx_TraceDeclarationsFunc
  __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_TraceFrameInit(((PyObject *)__pyx_mstate_global->__pyx_codeobj_tab[379]))
  __Pyx_RefNannySetupContext("write", 0);
  __Pyx_TraceStartFunc("write (wrapper)", __pyx_f[0], 4480, 0, 0, 0, __PYX_ERR(0, 4480, __pyx_L1_error));
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = __pyx_f_5pysam_7libcbcf_11VariantFile_write(__pyx_v_self, __pyx_v_record, 1); if (unlikely(__pyx_t_1 == ((int)-1))) __PYX_ERR(0, 4480, __pyx_L1_error)
  __pyx_t_2 = __Pyx_PyLong_From_int(__pyx_t_1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 4480, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_r = __pyx_t_2;
  __pyx_t_2 = 0;
  goto __pyx_L0;

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_TraceException(__pyx_lineno, 0, 0);
  #if CYTHON_USE_SYS_MONITORING
  __Pyx_TraceExceptionUnwind(0, 0);
  #else
  __Pyx_TraceReturnValue(NULL, 0, 0, __PYX_ERR(0, 4480, __pyx_L1_error));
  #endif
  __Pyx_AddTraceback("pysam.libcbcf.VariantFile.write", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_PyMonitoring_ExitScope(0);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "pysam/libcbcf.pyx":4523
 *         return ret
 * 
 *     def subset_samples(self, include_samples):             # <<<<<<<<<<<<<<
 *         """
 *         Read only a subset of samples to reduce processing time and memory.
*/

/* Python wrapper */
static PyObject *__pyx_pw_5pysam_7libcbcf_11VariantFile_31subset_samples(PyObject *__pyx_v_self, 
#if 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_5pysam_7libcbcf_11VariantFile_30subset_samples, "VariantFile.subset_samples(self, include_samples)\n\nRead only a subset of samples to reduce processing time and memory.\nMust be called prior to retrieving records.");
static PyMethodDef __pyx_mdef_5pysam_7libcbcf_11VariantFile_31subset_samples = {"subset_samples", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_5pysam_7libcbcf_11VariantFile_31subset_samples, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_5pysam_7libcbcf_11VariantFile_30subset_samples};
static PyObject *__pyx_pw_5pysam_7libcbcf_11VariantFile_31subset_samples(PyObject *__pyx_v_self, 
#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_include_samples = 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("subset_samples (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_include_samples,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, 4523, __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, 4523, __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, "subset_samples", 0) < 0) __PYX_ERR(0, 4523, __pyx_L3_error)
      for (Py_ssize_t i = __pyx_nargs; i < 1; i++) {
        if (unlikely(!values[i])) { __Pyx_RaiseArgtupleInvalid("subset_samples", 1, 1, 1, i); __PYX_ERR(0, 4523, __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, 4523, __pyx_L3_error)
    }
    __pyx_v_include_samples = values[0];
  }
  goto __pyx_L6_skip;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("subset_samples", 1, 1, 1, __pyx_nargs); __PYX_ERR(0, 4523, __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("pysam.libcbcf.VariantFile.subset_samples", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_5pysam_7libcbcf_11VariantFile_30subset_samples(((struct __pyx_obj_5pysam_7libcbcf_VariantFile *)__pyx_v_self), __pyx_v_include_samples);

  /* 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_5pysam_7libcbcf_11VariantFile_30subset_samples(struct __pyx_obj_5pysam_7libcbcf_VariantFile *__pyx_v_self, PyObject *__pyx_v_include_samples) {
  PyObject *__pyx_r = NULL;
  __Pyx_TraceDeclarationsFunc
  __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_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_TraceFrameInit(((PyObject *)__pyx_mstate_global->__pyx_codeobj_tab[380]))
  __Pyx_RefNannySetupContext("subset_samples", 0);
  __Pyx_TraceStartFunc("subset_samples", __pyx_f[0], 4523, 0, 0, 0, __PYX_ERR(0, 4523, __pyx_L1_error));

  /* "pysam/libcbcf.pyx":4528
 *         Must be called prior to retrieving records.
 *         """
 *         if not self.is_open:             # <<<<<<<<<<<<<<
 *             raise ValueError('I/O operation on closed file')
 * 
*/
  __pyx_t_1 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_mstate_global->__pyx_n_u_is_open); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 4528, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_2 = __Pyx_PyObject_IsTrue(__pyx_t_1); if (unlikely((__pyx_t_2 < 0))) __PYX_ERR(0, 4528, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_t_3 = (!__pyx_t_2);
  if (unlikely(__pyx_t_3)) {

    /* "pysam/libcbcf.pyx":4529
 *         """
 *         if not self.is_open:
 *             raise ValueError('I/O operation on closed file')             # <<<<<<<<<<<<<<
 * 
 *         if self.htsfile.is_write:
*/
    __pyx_t_4 = NULL;
    __Pyx_INCREF(__pyx_builtin_ValueError);
    __pyx_t_5 = __pyx_builtin_ValueError; 
    __pyx_t_6 = 1;
    {
      PyObject *__pyx_callargs[2] = {__pyx_t_4, __pyx_mstate_global->__pyx_kp_u_I_O_operation_on_closed_file};
      __pyx_t_1 = __Pyx_PyObject_FastCall(__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, 4529, __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, 4529, __pyx_L1_error)

    /* "pysam/libcbcf.pyx":4528
 *         Must be called prior to retrieving records.
 *         """
 *         if not self.is_open:             # <<<<<<<<<<<<<<
 *             raise ValueError('I/O operation on closed file')
 * 
*/
  }

  /* "pysam/libcbcf.pyx":4531
 *             raise ValueError('I/O operation on closed file')
 * 
 *         if self.htsfile.is_write:             # <<<<<<<<<<<<<<
 *             raise ValueError('cannot subset samples from Variantfile opened for writing')
 * 
*/
  __pyx_t_3 = (__pyx_v_self->__pyx_base.htsfile->is_write != 0);
  if (unlikely(__pyx_t_3)) {

    /* "pysam/libcbcf.pyx":4532
 * 
 *         if self.htsfile.is_write:
 *             raise ValueError('cannot subset samples from Variantfile opened for writing')             # <<<<<<<<<<<<<<
 * 
 *         if self.is_reading:
*/
    __pyx_t_5 = NULL;
    __Pyx_INCREF(__pyx_builtin_ValueError);
    __pyx_t_4 = __pyx_builtin_ValueError; 
    __pyx_t_6 = 1;
    {
      PyObject *__pyx_callargs[2] = {__pyx_t_5, __pyx_mstate_global->__pyx_kp_u_cannot_subset_samples_from_Varia};
      __pyx_t_1 = __Pyx_PyObject_FastCall(__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, 4532, __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, 4532, __pyx_L1_error)

    /* "pysam/libcbcf.pyx":4531
 *             raise ValueError('I/O operation on closed file')
 * 
 *         if self.htsfile.is_write:             # <<<<<<<<<<<<<<
 *             raise ValueError('cannot subset samples from Variantfile opened for writing')
 * 
*/
  }

  /* "pysam/libcbcf.pyx":4534
 *             raise ValueError('cannot subset samples from Variantfile opened for writing')
 * 
 *         if self.is_reading:             # <<<<<<<<<<<<<<
 *             raise ValueError('cannot subset samples after fetching records')
 * 
*/
  if (unlikely(__pyx_v_self->is_reading)) {

    /* "pysam/libcbcf.pyx":4535
 * 
 *         if self.is_reading:
 *             raise ValueError('cannot subset samples after fetching records')             # <<<<<<<<<<<<<<
 * 
 *         self.header._subset_samples(include_samples)
*/
    __pyx_t_4 = NULL;
    __Pyx_INCREF(__pyx_builtin_ValueError);
    __pyx_t_5 = __pyx_builtin_ValueError; 
    __pyx_t_6 = 1;
    {
      PyObject *__pyx_callargs[2] = {__pyx_t_4, __pyx_mstate_global->__pyx_kp_u_cannot_subset_samples_after_fetc};
      __pyx_t_1 = __Pyx_PyObject_FastCall(__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, 4535, __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, 4535, __pyx_L1_error)

    /* "pysam/libcbcf.pyx":4534
 *             raise ValueError('cannot subset samples from Variantfile opened for writing')
 * 
 *         if self.is_reading:             # <<<<<<<<<<<<<<
 *             raise ValueError('cannot subset samples after fetching records')
 * 
*/
  }

  /* "pysam/libcbcf.pyx":4537
 *             raise ValueError('cannot subset samples after fetching records')
 * 
 *         self.header._subset_samples(include_samples)             # <<<<<<<<<<<<<<
 * 
 *         # potentially unnecessary optimization that also sets max_unpack
*/
  __pyx_t_1 = ((struct __pyx_vtabstruct_5pysam_7libcbcf_VariantHeader *)__pyx_v_self->header->__pyx_vtab)->_subset_samples(__pyx_v_self->header, __pyx_v_include_samples); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 4537, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "pysam/libcbcf.pyx":4540
 * 
 *         # potentially unnecessary optimization that also sets max_unpack
 *         if not include_samples:             # <<<<<<<<<<<<<<
 *             self.drop_samples = True
 * 
*/
  __pyx_t_3 = __Pyx_PyObject_IsTrue(__pyx_v_include_samples); if (unlikely((__pyx_t_3 < 0))) __PYX_ERR(0, 4540, __pyx_L1_error)
  __pyx_t_2 = (!__pyx_t_3);
  if (__pyx_t_2) {

    /* "pysam/libcbcf.pyx":4541
 *         # potentially unnecessary optimization that also sets max_unpack
 *         if not include_samples:
 *             self.drop_samples = True             # <<<<<<<<<<<<<<
 * 
*/
    __pyx_v_self->drop_samples = 1;

    /* "pysam/libcbcf.pyx":4540
 * 
 *         # potentially unnecessary optimization that also sets max_unpack
 *         if not include_samples:             # <<<<<<<<<<<<<<
 *             self.drop_samples = True
 * 
*/
  }

  /* "pysam/libcbcf.pyx":4523
 *         return ret
 * 
 *     def subset_samples(self, include_samples):             # <<<<<<<<<<<<<<
 *         """
 *         Read only a subset of samples to reduce processing time and memory.
*/

  /* function exit code */
  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  __Pyx_TraceReturnValue(__pyx_r, 0, 0, __PYX_ERR(0, 4523, __pyx_L1_error));
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_XDECREF(__pyx_t_5);
  __Pyx_TraceException(__pyx_lineno, 0, 0);
  #if CYTHON_USE_SYS_MONITORING
  __Pyx_TraceExceptionUnwind(0, 0);
  #else
  __Pyx_TraceReturnValue(NULL, 0, 0, __PYX_ERR(0, 4523, __pyx_L1_error));
  #endif
  __Pyx_AddTraceback("pysam.libcbcf.VariantFile.subset_samples", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_PyMonitoring_ExitScope(0);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "pysam/libcbcf.pxd":135
 * 
 * cdef class VariantFile(HTSFile):
 *     cdef readonly VariantHeader  header             # <<<<<<<<<<<<<<
 *     cdef readonly BaseIndex      index
 * 
*/

/* Python wrapper */
static PyObject *__pyx_pw_5pysam_7libcbcf_11VariantFile_6header_1__get__(PyObject *__pyx_v_self); /*proto*/
static PyObject *__pyx_pw_5pysam_7libcbcf_11VariantFile_6header_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_5pysam_7libcbcf_11VariantFile_6header___get__(((struct __pyx_obj_5pysam_7libcbcf_VariantFile *)__pyx_v_self));

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

static PyObject *__pyx_pf_5pysam_7libcbcf_11VariantFile_6header___get__(struct __pyx_obj_5pysam_7libcbcf_VariantFile *__pyx_v_self) {
  PyObject *__pyx_r = NULL;
  __Pyx_TraceDeclarationsFunc
  __Pyx_RefNannyDeclarations
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_TraceFrameInit(((PyObject *)__pyx_mstate_global->__pyx_codeobj_tab[381]))
  __Pyx_RefNannySetupContext("__get__", 0);
  __Pyx_TraceStartFunc("__get__", __pyx_f[3], 135, 0, 0, 0, __PYX_ERR(3, 135, __pyx_L1_error));
  __Pyx_XDECREF(__pyx_r);
  __Pyx_INCREF((PyObject *)__pyx_v_self->header);
  __pyx_r = ((PyObject *)__pyx_v_self->header);
  __Pyx_TraceReturnValue(__pyx_r, 0, 0, __PYX_ERR(3, 135, __pyx_L1_error));
  goto __pyx_L0;

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_TraceException(__pyx_lineno, 0, 0);
  #if CYTHON_USE_SYS_MONITORING
  __Pyx_TraceExceptionUnwind(0, 0);
  #else
  __Pyx_TraceReturnValue(NULL, 0, 0, __PYX_ERR(3, 135, __pyx_L1_error));
  #endif
  __Pyx_AddTraceback("pysam.libcbcf.VariantFile.header.__get__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_PyMonitoring_ExitScope(0);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "pysam/libcbcf.pxd":136
 * cdef class VariantFile(HTSFile):
 *     cdef readonly VariantHeader  header
 *     cdef readonly BaseIndex      index             # <<<<<<<<<<<<<<
 * 
 *     cdef readonly bint           drop_samples  # true if sample information is to be ignored
*/

/* Python wrapper */
static PyObject *__pyx_pw_5pysam_7libcbcf_11VariantFile_5index_1__get__(PyObject *__pyx_v_self); /*proto*/
static PyObject *__pyx_pw_5pysam_7libcbcf_11VariantFile_5index_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_5pysam_7libcbcf_11VariantFile_5index___get__(((struct __pyx_obj_5pysam_7libcbcf_VariantFile *)__pyx_v_self));

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

static PyObject *__pyx_pf_5pysam_7libcbcf_11VariantFile_5index___get__(struct __pyx_obj_5pysam_7libcbcf_VariantFile *__pyx_v_self) {
  PyObject *__pyx_r = NULL;
  __Pyx_TraceDeclarationsFunc
  __Pyx_RefNannyDeclarations
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_TraceFrameInit(((PyObject *)__pyx_mstate_global->__pyx_codeobj_tab[382]))
  __Pyx_RefNannySetupContext("__get__", 0);
  __Pyx_TraceStartFunc("__get__", __pyx_f[3], 136, 0, 0, 0, __PYX_ERR(3, 136, __pyx_L1_error));
  __Pyx_XDECREF(__pyx_r);
  __Pyx_INCREF((PyObject *)__pyx_v_self->index);
  __pyx_r = ((PyObject *)__pyx_v_self->index);
  __Pyx_TraceReturnValue(__pyx_r, 0, 0, __PYX_ERR(3, 136, __pyx_L1_error));
  goto __pyx_L0;

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_TraceException(__pyx_lineno, 0, 0);
  #if CYTHON_USE_SYS_MONITORING
  __Pyx_TraceExceptionUnwind(0, 0);
  #else
  __Pyx_TraceReturnValue(NULL, 0, 0, __PYX_ERR(3, 136, __pyx_L1_error));
  #endif
  __Pyx_AddTraceback("pysam.libcbcf.VariantFile.index.__get__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_PyMonitoring_ExitScope(0);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "pysam/libcbcf.pxd":138
 *     cdef readonly BaseIndex      index
 * 
 *     cdef readonly bint           drop_samples  # true if sample information is to be ignored             # <<<<<<<<<<<<<<
 * 
 *     # FIXME: Temporary, use htsFormat when it is available
*/

/* Python wrapper */
static PyObject *__pyx_pw_5pysam_7libcbcf_11VariantFile_12drop_samples_1__get__(PyObject *__pyx_v_self); /*proto*/
static PyObject *__pyx_pw_5pysam_7libcbcf_11VariantFile_12drop_samples_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_5pysam_7libcbcf_11VariantFile_12drop_samples___get__(((struct __pyx_obj_5pysam_7libcbcf_VariantFile *)__pyx_v_self));

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

static PyObject *__pyx_pf_5pysam_7libcbcf_11VariantFile_12drop_samples___get__(struct __pyx_obj_5pysam_7libcbcf_VariantFile *__pyx_v_self) {
  PyObject *__pyx_r = NULL;
  __Pyx_TraceDeclarationsFunc
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_TraceFrameInit(((PyObject *)__pyx_mstate_global->__pyx_codeobj_tab[383]))
  __Pyx_RefNannySetupContext("__get__", 0);
  __Pyx_TraceStartFunc("__get__", __pyx_f[3], 138, 0, 0, 0, __PYX_ERR(3, 138, __pyx_L1_error));
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = __Pyx_PyBool_FromLong(__pyx_v_self->drop_samples); if (unlikely(!__pyx_t_1)) __PYX_ERR(3, 138, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  __Pyx_TraceReturnValue(__pyx_r, 0, 0, __PYX_ERR(3, 138, __pyx_L1_error));
  goto __pyx_L0;

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_TraceException(__pyx_lineno, 0, 0);
  #if CYTHON_USE_SYS_MONITORING
  __Pyx_TraceExceptionUnwind(0, 0);
  #else
  __Pyx_TraceReturnValue(NULL, 0, 0, __PYX_ERR(3, 138, __pyx_L1_error));
  #endif
  __Pyx_AddTraceback("pysam.libcbcf.VariantFile.drop_samples.__get__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_PyMonitoring_ExitScope(0);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "pysam/libcbcf.pxd":141
 * 
 *     # FIXME: Temporary, use htsFormat when it is available
 *     cdef readonly bint       is_reading     # true if file has begun reading records             # <<<<<<<<<<<<<<
 *     cdef readonly bint       header_written # true if header has already been written
 * 
*/

/* Python wrapper */
static PyObject *__pyx_pw_5pysam_7libcbcf_11VariantFile_10is_reading_1__get__(PyObject *__pyx_v_self); /*proto*/
static PyObject *__pyx_pw_5pysam_7libcbcf_11VariantFile_10is_reading_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_5pysam_7libcbcf_11VariantFile_10is_reading___get__(((struct __pyx_obj_5pysam_7libcbcf_VariantFile *)__pyx_v_self));

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

static PyObject *__pyx_pf_5pysam_7libcbcf_11VariantFile_10is_reading___get__(struct __pyx_obj_5pysam_7libcbcf_VariantFile *__pyx_v_self) {
  PyObject *__pyx_r = NULL;
  __Pyx_TraceDeclarationsFunc
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_TraceFrameInit(((PyObject *)__pyx_mstate_global->__pyx_codeobj_tab[384]))
  __Pyx_RefNannySetupContext("__get__", 0);
  __Pyx_TraceStartFunc("__get__", __pyx_f[3], 141, 0, 0, 0, __PYX_ERR(3, 141, __pyx_L1_error));
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = __Pyx_PyBool_FromLong(__pyx_v_self->is_reading); if (unlikely(!__pyx_t_1)) __PYX_ERR(3, 141, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  __Pyx_TraceReturnValue(__pyx_r, 0, 0, __PYX_ERR(3, 141, __pyx_L1_error));
  goto __pyx_L0;

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_TraceException(__pyx_lineno, 0, 0);
  #if CYTHON_USE_SYS_MONITORING
  __Pyx_TraceExceptionUnwind(0, 0);
  #else
  __Pyx_TraceReturnValue(NULL, 0, 0, __PYX_ERR(3, 141, __pyx_L1_error));
  #endif
  __Pyx_AddTraceback("pysam.libcbcf.VariantFile.is_reading.__get__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_PyMonitoring_ExitScope(0);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "pysam/libcbcf.pxd":142
 *     # FIXME: Temporary, use htsFormat when it is available
 *     cdef readonly bint       is_reading     # true if file has begun reading records
 *     cdef readonly bint       header_written # true if header has already been written             # <<<<<<<<<<<<<<
 * 
 *     cpdef int write(self, VariantRecord record) except -1
*/

/* Python wrapper */
static PyObject *__pyx_pw_5pysam_7libcbcf_11VariantFile_14header_written_1__get__(PyObject *__pyx_v_self); /*proto*/
static PyObject *__pyx_pw_5pysam_7libcbcf_11VariantFile_14header_written_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_5pysam_7libcbcf_11VariantFile_14header_written___get__(((struct __pyx_obj_5pysam_7libcbcf_VariantFile *)__pyx_v_self));

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

static PyObject *__pyx_pf_5pysam_7libcbcf_11VariantFile_14header_written___get__(struct __pyx_obj_5pysam_7libcbcf_VariantFile *__pyx_v_self) {
  PyObject *__pyx_r = NULL;
  __Pyx_TraceDeclarationsFunc
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_TraceFrameInit(((PyObject *)__pyx_mstate_global->__pyx_codeobj_tab[385]))
  __Pyx_RefNannySetupContext("__get__", 0);
  __Pyx_TraceStartFunc("__get__", __pyx_f[3], 142, 0, 0, 0, __PYX_ERR(3, 142, __pyx_L1_error));
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = __Pyx_PyBool_FromLong(__pyx_v_self->header_written); if (unlikely(!__pyx_t_1)) __PYX_ERR(3, 142, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  __Pyx_TraceReturnValue(__pyx_r, 0, 0, __PYX_ERR(3, 142, __pyx_L1_error));
  goto __pyx_L0;

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_TraceException(__pyx_lineno, 0, 0);
  #if CYTHON_USE_SYS_MONITORING
  __Pyx_TraceExceptionUnwind(0, 0);
  #else
  __Pyx_TraceReturnValue(NULL, 0, 0, __PYX_ERR(3, 142, __pyx_L1_error));
  #endif
  __Pyx_AddTraceback("pysam.libcbcf.VariantFile.header_written.__get__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_PyMonitoring_ExitScope(0);
  __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_5pysam_7libcbcf_11VariantFile_33__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*/
PyDoc_STRVAR(__pyx_doc_5pysam_7libcbcf_11VariantFile_32__reduce_cython__, "VariantFile.__reduce_cython__(self)");
static PyMethodDef __pyx_mdef_5pysam_7libcbcf_11VariantFile_33__reduce_cython__ = {"__reduce_cython__", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_5pysam_7libcbcf_11VariantFile_33__reduce_cython__, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_5pysam_7libcbcf_11VariantFile_32__reduce_cython__};
static PyObject *__pyx_pw_5pysam_7libcbcf_11VariantFile_33__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_5pysam_7libcbcf_11VariantFile_32__reduce_cython__(((struct __pyx_obj_5pysam_7libcbcf_VariantFile *)__pyx_v_self));

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

static PyObject *__pyx_pf_5pysam_7libcbcf_11VariantFile_32__reduce_cython__(CYTHON_UNUSED struct __pyx_obj_5pysam_7libcbcf_VariantFile *__pyx_v_self) {
  PyObject *__pyx_r = NULL;
  __Pyx_TraceDeclarationsFunc
  __Pyx_RefNannyDeclarations
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_TraceFrameInit(((PyObject *)__pyx_mstate_global->__pyx_codeobj_tab[386]))
  __Pyx_RefNannySetupContext("__reduce_cython__", 0);
  __Pyx_TraceStartFunc("__reduce_cython__", __pyx_f[4], 1, 0, 0, 0, __PYX_ERR(4, 1, __pyx_L1_error));

  /* "(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(__pyx_builtin_TypeError, __pyx_mstate_global->__pyx_kp_u_no_default___reduce___due_to_non, 0, 0);
  __PYX_ERR(4, 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_TraceException(__pyx_lineno, 0, 0);
  #if CYTHON_USE_SYS_MONITORING
  __Pyx_TraceExceptionUnwind(0, 0);
  #else
  __Pyx_TraceReturnValue(NULL, 0, 0, __PYX_ERR(4, 1, __pyx_L1_error));
  #endif
  __Pyx_AddTraceback("pysam.libcbcf.VariantFile.__reduce_cython__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_PyMonitoring_ExitScope(0);
  __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_5pysam_7libcbcf_11VariantFile_35__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*/
PyDoc_STRVAR(__pyx_doc_5pysam_7libcbcf_11VariantFile_34__setstate_cython__, "VariantFile.__setstate_cython__(self, __pyx_state)");
static PyMethodDef __pyx_mdef_5pysam_7libcbcf_11VariantFile_35__setstate_cython__ = {"__setstate_cython__", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_5pysam_7libcbcf_11VariantFile_35__setstate_cython__, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_5pysam_7libcbcf_11VariantFile_34__setstate_cython__};
static PyObject *__pyx_pw_5pysam_7libcbcf_11VariantFile_35__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(4, 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(4, 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(4, 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(4, 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(4, 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(4, 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("pysam.libcbcf.VariantFile.__setstate_cython__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_5pysam_7libcbcf_11VariantFile_34__setstate_cython__(((struct __pyx_obj_5pysam_7libcbcf_VariantFile *)__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_5pysam_7libcbcf_11VariantFile_34__setstate_cython__(CYTHON_UNUSED struct __pyx_obj_5pysam_7libcbcf_VariantFile *__pyx_v_self, CYTHON_UNUSED PyObject *__pyx_v___pyx_state) {
  PyObject *__pyx_r = NULL;
  __Pyx_TraceDeclarationsFunc
  __Pyx_RefNannyDeclarations
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_TraceFrameInit(((PyObject *)__pyx_mstate_global->__pyx_codeobj_tab[387]))
  __Pyx_RefNannySetupContext("__setstate_cython__", 0);
  __Pyx_TraceStartFunc("__setstate_cython__", __pyx_f[4], 3, 0, 0, 0, __PYX_ERR(4, 3, __pyx_L1_error));

  /* "(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(__pyx_builtin_TypeError, __pyx_mstate_global->__pyx_kp_u_no_default___reduce___due_to_non, 0, 0);
  __PYX_ERR(4, 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_TraceException(__pyx_lineno, 0, 0);
  #if CYTHON_USE_SYS_MONITORING
  __Pyx_TraceExceptionUnwind(0, 0);
  #else
  __Pyx_TraceReturnValue(NULL, 0, 0, __PYX_ERR(4, 3, __pyx_L1_error));
  #endif
  __Pyx_AddTraceback("pysam.libcbcf.VariantFile.__setstate_cython__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_PyMonitoring_ExitScope(0);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "(tree fragment)":1
 * def __pyx_unpickle_VariantHeaderRecords(__pyx_type, long __pyx_checksum, __pyx_state):             # <<<<<<<<<<<<<<
 *     cdef object __pyx_PickleError
 *     cdef object __pyx_result
*/

/* Python wrapper */
static PyObject *__pyx_pw_5pysam_7libcbcf_1__pyx_unpickle_VariantHeaderRecords(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_5pysam_7libcbcf___pyx_unpickle_VariantHeaderRecords, "__pyx_unpickle_VariantHeaderRecords(__pyx_type, long __pyx_checksum, __pyx_state)");
static PyMethodDef __pyx_mdef_5pysam_7libcbcf_1__pyx_unpickle_VariantHeaderRecords = {"__pyx_unpickle_VariantHeaderRecords", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_5pysam_7libcbcf_1__pyx_unpickle_VariantHeaderRecords, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_5pysam_7libcbcf___pyx_unpickle_VariantHeaderRecords};
static PyObject *__pyx_pw_5pysam_7libcbcf_1__pyx_unpickle_VariantHeaderRecords(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_VariantHeaderRecords (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(4, 1, __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(4, 1, __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(4, 1, __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(4, 1, __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_VariantHeaderRecords", 0) < 0) __PYX_ERR(4, 1, __pyx_L3_error)
      for (Py_ssize_t i = __pyx_nargs; i < 3; i++) {
        if (unlikely(!values[i])) { __Pyx_RaiseArgtupleInvalid("__pyx_unpickle_VariantHeaderRecords", 1, 3, 3, i); __PYX_ERR(4, 1, __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(4, 1, __pyx_L3_error)
      values[1] = __Pyx_ArgRef_FASTCALL(__pyx_args, 1);
      if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[1])) __PYX_ERR(4, 1, __pyx_L3_error)
      values[2] = __Pyx_ArgRef_FASTCALL(__pyx_args, 2);
      if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[2])) __PYX_ERR(4, 1, __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(4, 1, __pyx_L3_error)
    __pyx_v___pyx_state = values[2];
  }
  goto __pyx_L6_skip;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("__pyx_unpickle_VariantHeaderRecords", 1, 3, 3, __pyx_nargs); __PYX_ERR(4, 1, __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("pysam.libcbcf.__pyx_unpickle_VariantHeaderRecords", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_5pysam_7libcbcf___pyx_unpickle_VariantHeaderRecords(__pyx_self, __pyx_v___pyx_type, __pyx_v___pyx_checksum, __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_5pysam_7libcbcf___pyx_unpickle_VariantHeaderRecords(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v___pyx_type, long __pyx_v___pyx_checksum, PyObject *__pyx_v___pyx_state) {
  PyObject *__pyx_v___pyx_PickleError = 0;
  PyObject *__pyx_v___pyx_result = 0;
  PyObject *__pyx_r = NULL;
  __Pyx_TraceDeclarationsFunc
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_t_2;
  PyObject *__pyx_t_3 = NULL;
  size_t __pyx_t_4;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_TraceFrameInit(((PyObject *)__pyx_mstate_global->__pyx_codeobj_tab[388]))
  __Pyx_RefNannySetupContext("__pyx_unpickle_VariantHeaderRecords", 0);
  __Pyx_TraceStartFunc("__pyx_unpickle_VariantHeaderRecords", __pyx_f[4], 1, 0, 0, 0, __PYX_ERR(4, 1, __pyx_L1_error));

  /* "(tree fragment)":4
 *     cdef object __pyx_PickleError
 *     cdef object __pyx_result
 *     if __pyx_checksum not in (0x1e0584a, 0x594fd16, 0x099fb99):             # <<<<<<<<<<<<<<
 *         from pickle import PickleError as __pyx_PickleError
 *         raise __pyx_PickleError, "Incompatible checksums (0x%x vs (0x1e0584a, 0x594fd16, 0x099fb99) = (header))" % __pyx_checksum
*/
  __pyx_t_1 = __Pyx_PyLong_From_long(__pyx_v___pyx_checksum); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 4, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_2 = (__Pyx_PySequence_ContainsTF(__pyx_t_1, __pyx_mstate_global->__pyx_tuple[1], Py_NE)); if (unlikely((__pyx_t_2 < 0))) __PYX_ERR(4, 4, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  if (__pyx_t_2) {

    /* "(tree fragment)":5
 *     cdef object __pyx_result
 *     if __pyx_checksum not in (0x1e0584a, 0x594fd16, 0x099fb99):
 *         from pickle import PickleError as __pyx_PickleError             # <<<<<<<<<<<<<<
 *         raise __pyx_PickleError, "Incompatible checksums (0x%x vs (0x1e0584a, 0x594fd16, 0x099fb99) = (header))" % __pyx_checksum
 *     __pyx_result = VariantHeaderRecords.__new__(__pyx_type)
*/
    __pyx_t_1 = PyList_New(1); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 5, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_INCREF(__pyx_mstate_global->__pyx_n_u_PickleError);
    __Pyx_GIVEREF(__pyx_mstate_global->__pyx_n_u_PickleError);
    if (__Pyx_PyList_SET_ITEM(__pyx_t_1, 0, __pyx_mstate_global->__pyx_n_u_PickleError) != (0)) __PYX_ERR(4, 5, __pyx_L1_error);
    __pyx_t_3 = __Pyx_Import(__pyx_mstate_global->__pyx_n_u_pickle, __pyx_t_1, 0); if (unlikely(!__pyx_t_3)) __PYX_ERR(4, 5, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    __pyx_t_1 = __Pyx_ImportFrom(__pyx_t_3, __pyx_mstate_global->__pyx_n_u_PickleError); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 5, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_INCREF(__pyx_t_1);
    __pyx_v___pyx_PickleError = __pyx_t_1;
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;

    /* "(tree fragment)":6
 *     if __pyx_checksum not in (0x1e0584a, 0x594fd16, 0x099fb99):
 *         from pickle import PickleError as __pyx_PickleError
 *         raise __pyx_PickleError, "Incompatible checksums (0x%x vs (0x1e0584a, 0x594fd16, 0x099fb99) = (header))" % __pyx_checksum             # <<<<<<<<<<<<<<
 *     __pyx_result = VariantHeaderRecords.__new__(__pyx_type)
 *     if __pyx_state is not None:
*/
    __pyx_t_3 = __Pyx_PyLong_From_long(__pyx_v___pyx_checksum); if (unlikely(!__pyx_t_3)) __PYX_ERR(4, 6, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __pyx_t_1 = PyUnicode_Format(__pyx_mstate_global->__pyx_kp_u_Incompatible_checksums_0x_x_vs_0, __pyx_t_3); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 6, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    __Pyx_Raise(__pyx_v___pyx_PickleError, __pyx_t_1, 0, 0);
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    __PYX_ERR(4, 6, __pyx_L1_error)

    /* "(tree fragment)":4
 *     cdef object __pyx_PickleError
 *     cdef object __pyx_result
 *     if __pyx_checksum not in (0x1e0584a, 0x594fd16, 0x099fb99):             # <<<<<<<<<<<<<<
 *         from pickle import PickleError as __pyx_PickleError
 *         raise __pyx_PickleError, "Incompatible checksums (0x%x vs (0x1e0584a, 0x594fd16, 0x099fb99) = (header))" % __pyx_checksum
*/
  }

  /* "(tree fragment)":7
 *         from pickle import PickleError as __pyx_PickleError
 *         raise __pyx_PickleError, "Incompatible checksums (0x%x vs (0x1e0584a, 0x594fd16, 0x099fb99) = (header))" % __pyx_checksum
 *     __pyx_result = VariantHeaderRecords.__new__(__pyx_type)             # <<<<<<<<<<<<<<
 *     if __pyx_state is not None:
 *         __pyx_unpickle_VariantHeaderRecords__set_state(<VariantHeaderRecords> __pyx_result, __pyx_state)
*/
  __pyx_t_3 = ((PyObject *)__pyx_mstate_global->__pyx_ptype_5pysam_7libcbcf_VariantHeaderRecords);
  __Pyx_INCREF(__pyx_t_3);
  __pyx_t_4 = 0;
  {
    PyObject *__pyx_callargs[2] = {__pyx_t_3, __pyx_v___pyx_type};
    __pyx_t_1 = __Pyx_PyObject_FastCallMethod(__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_1)) __PYX_ERR(4, 7, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
  }
  __pyx_v___pyx_result = __pyx_t_1;
  __pyx_t_1 = 0;

  /* "(tree fragment)":8
 *         raise __pyx_PickleError, "Incompatible checksums (0x%x vs (0x1e0584a, 0x594fd16, 0x099fb99) = (header))" % __pyx_checksum
 *     __pyx_result = VariantHeaderRecords.__new__(__pyx_type)
 *     if __pyx_state is not None:             # <<<<<<<<<<<<<<
 *         __pyx_unpickle_VariantHeaderRecords__set_state(<VariantHeaderRecords> __pyx_result, __pyx_state)
 *     return __pyx_result
*/
  __pyx_t_2 = (__pyx_v___pyx_state != Py_None);
  if (__pyx_t_2) {

    /* "(tree fragment)":9
 *     __pyx_result = VariantHeaderRecords.__new__(__pyx_type)
 *     if __pyx_state is not None:
 *         __pyx_unpickle_VariantHeaderRecords__set_state(<VariantHeaderRecords> __pyx_result, __pyx_state)             # <<<<<<<<<<<<<<
 *     return __pyx_result
 * cdef __pyx_unpickle_VariantHeaderRecords__set_state(VariantHeaderRecords __pyx_result, tuple __pyx_state):
*/
    if (!(likely(PyTuple_CheckExact(__pyx_v___pyx_state))||((__pyx_v___pyx_state) == Py_None) || __Pyx_RaiseUnexpectedTypeError("tuple", __pyx_v___pyx_state))) __PYX_ERR(4, 9, __pyx_L1_error)
    __pyx_t_1 = __pyx_f_5pysam_7libcbcf___pyx_unpickle_VariantHeaderRecords__set_state(((struct __pyx_obj_5pysam_7libcbcf_VariantHeaderRecords *)__pyx_v___pyx_result), ((PyObject*)__pyx_v___pyx_state)); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 9, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

    /* "(tree fragment)":8
 *         raise __pyx_PickleError, "Incompatible checksums (0x%x vs (0x1e0584a, 0x594fd16, 0x099fb99) = (header))" % __pyx_checksum
 *     __pyx_result = VariantHeaderRecords.__new__(__pyx_type)
 *     if __pyx_state is not None:             # <<<<<<<<<<<<<<
 *         __pyx_unpickle_VariantHeaderRecords__set_state(<VariantHeaderRecords> __pyx_result, __pyx_state)
 *     return __pyx_result
*/
  }

  /* "(tree fragment)":10
 *     if __pyx_state is not None:
 *         __pyx_unpickle_VariantHeaderRecords__set_state(<VariantHeaderRecords> __pyx_result, __pyx_state)
 *     return __pyx_result             # <<<<<<<<<<<<<<
 * cdef __pyx_unpickle_VariantHeaderRecords__set_state(VariantHeaderRecords __pyx_result, tuple __pyx_state):
 *     __pyx_result.header = __pyx_state[0]
*/
  __Pyx_XDECREF(__pyx_r);
  __Pyx_INCREF(__pyx_v___pyx_result);
  __pyx_r = __pyx_v___pyx_result;
  __Pyx_TraceReturnValue(__pyx_r, 29, 0, __PYX_ERR(4, 10, __pyx_L1_error));
  goto __pyx_L0;

  /* "(tree fragment)":1
 * def __pyx_unpickle_VariantHeaderRecords(__pyx_type, long __pyx_checksum, __pyx_state):             # <<<<<<<<<<<<<<
 *     cdef object __pyx_PickleError
 *     cdef object __pyx_result
*/

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_TraceException(__pyx_lineno, 0, 0);
  #if CYTHON_USE_SYS_MONITORING
  __Pyx_TraceExceptionUnwind(0, 0);
  #else
  __Pyx_TraceReturnValue(NULL, 0, 0, __PYX_ERR(4, 1, __pyx_L1_error));
  #endif
  __Pyx_AddTraceback("pysam.libcbcf.__pyx_unpickle_VariantHeaderRecords", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v___pyx_PickleError);
  __Pyx_XDECREF(__pyx_v___pyx_result);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_PyMonitoring_ExitScope(0);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "(tree fragment)":11
 *         __pyx_unpickle_VariantHeaderRecords__set_state(<VariantHeaderRecords> __pyx_result, __pyx_state)
 *     return __pyx_result
 * cdef __pyx_unpickle_VariantHeaderRecords__set_state(VariantHeaderRecords __pyx_result, tuple __pyx_state):             # <<<<<<<<<<<<<<
 *     __pyx_result.header = __pyx_state[0]
 *     if len(__pyx_state) > 1 and hasattr(__pyx_result, '__dict__'):
*/

static PyObject *__pyx_f_5pysam_7libcbcf___pyx_unpickle_VariantHeaderRecords__set_state(struct __pyx_obj_5pysam_7libcbcf_VariantHeaderRecords *__pyx_v___pyx_result, PyObject *__pyx_v___pyx_state) {
  PyObject *__pyx_r = NULL;
  __Pyx_TraceDeclarationsFunc
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_t_2;
  Py_ssize_t __pyx_t_3;
  int __pyx_t_4;
  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_TraceFrameInit(((PyObject *)__pyx_mstate_global->__pyx_codeobj_tab[389]))
  __Pyx_RefNannySetupContext("__pyx_unpickle_VariantHeaderRecords__set_state", 0);
  __Pyx_TraceStartFunc("__pyx_unpickle_VariantHeaderRecords__set_state", __pyx_f[4], 11, 0, 0, 0, __PYX_ERR(4, 11, __pyx_L1_error));

  /* "(tree fragment)":12
 *     return __pyx_result
 * cdef __pyx_unpickle_VariantHeaderRecords__set_state(VariantHeaderRecords __pyx_result, tuple __pyx_state):
 *     __pyx_result.header = __pyx_state[0]             # <<<<<<<<<<<<<<
 *     if len(__pyx_state) > 1 and hasattr(__pyx_result, '__dict__'):
 *         __pyx_result.__dict__.update(__pyx_state[1])
*/
  if (unlikely(__pyx_v___pyx_state == Py_None)) {
    PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable");
    __PYX_ERR(4, 12, __pyx_L1_error)
  }
  __pyx_t_1 = __Pyx_GetItemInt_Tuple(__pyx_v___pyx_state, 0, long, 1, __Pyx_PyLong_From_long, 0, 0, 1, 1); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 12, __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_5pysam_7libcbcf_VariantHeader))))) __PYX_ERR(4, 12, __pyx_L1_error)
  __Pyx_GIVEREF(__pyx_t_1);
  __Pyx_GOTREF((PyObject *)__pyx_v___pyx_result->header);
  __Pyx_DECREF((PyObject *)__pyx_v___pyx_result->header);
  __pyx_v___pyx_result->header = ((struct __pyx_obj_5pysam_7libcbcf_VariantHeader *)__pyx_t_1);
  __pyx_t_1 = 0;

  /* "(tree fragment)":13
 * cdef __pyx_unpickle_VariantHeaderRecords__set_state(VariantHeaderRecords __pyx_result, tuple __pyx_state):
 *     __pyx_result.header = __pyx_state[0]
 *     if len(__pyx_state) > 1 and hasattr(__pyx_result, '__dict__'):             # <<<<<<<<<<<<<<
 *         __pyx_result.__dict__.update(__pyx_state[1])
*/
  if (unlikely(__pyx_v___pyx_state == Py_None)) {
    PyErr_SetString(PyExc_TypeError, "object of type 'NoneType' has no len()");
    __PYX_ERR(4, 13, __pyx_L1_error)
  }
  __pyx_t_3 = __Pyx_PyTuple_GET_SIZE(__pyx_v___pyx_state); if (unlikely(__pyx_t_3 == ((Py_ssize_t)-1))) __PYX_ERR(4, 13, __pyx_L1_error)
  __pyx_t_4 = (__pyx_t_3 > 1);
  if (__pyx_t_4) {
  } else {
    __pyx_t_2 = __pyx_t_4;
    goto __pyx_L4_bool_binop_done;
  }
  __pyx_t_4 = __Pyx_HasAttr(((PyObject *)__pyx_v___pyx_result), __pyx_mstate_global->__pyx_n_u_dict); if (unlikely(__pyx_t_4 == ((int)-1))) __PYX_ERR(4, 13, __pyx_L1_error)
  __pyx_t_2 = __pyx_t_4;
  __pyx_L4_bool_binop_done:;
  if (__pyx_t_2) {

    /* "(tree fragment)":14
 *     __pyx_result.header = __pyx_state[0]
 *     if len(__pyx_state) > 1 and hasattr(__pyx_result, '__dict__'):
 *         __pyx_result.__dict__.update(__pyx_state[1])             # <<<<<<<<<<<<<<
*/
    __pyx_t_6 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v___pyx_result), __pyx_mstate_global->__pyx_n_u_dict); if (unlikely(!__pyx_t_6)) __PYX_ERR(4, 14, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_6);
    __pyx_t_5 = __pyx_t_6;
    __Pyx_INCREF(__pyx_t_5);
    if (unlikely(__pyx_v___pyx_state == Py_None)) {
      PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable");
      __PYX_ERR(4, 14, __pyx_L1_error)
    }
    __pyx_t_7 = __Pyx_GetItemInt_Tuple(__pyx_v___pyx_state, 1, long, 1, __Pyx_PyLong_From_long, 0, 0, 1, 1); if (unlikely(!__pyx_t_7)) __PYX_ERR(4, 14, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_7);
    __pyx_t_8 = 0;
    {
      PyObject *__pyx_callargs[2] = {__pyx_t_5, __pyx_t_7};
      __pyx_t_1 = __Pyx_PyObject_FastCallMethod(__pyx_mstate_global->__pyx_n_u_update, __pyx_callargs+__pyx_t_8, (2-__pyx_t_8) | (1*__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_1)) __PYX_ERR(4, 14, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_1);
    }
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

    /* "(tree fragment)":13
 * cdef __pyx_unpickle_VariantHeaderRecords__set_state(VariantHeaderRecords __pyx_result, tuple __pyx_state):
 *     __pyx_result.header = __pyx_state[0]
 *     if len(__pyx_state) > 1 and hasattr(__pyx_result, '__dict__'):             # <<<<<<<<<<<<<<
 *         __pyx_result.__dict__.update(__pyx_state[1])
*/
  }

  /* "(tree fragment)":11
 *         __pyx_unpickle_VariantHeaderRecords__set_state(<VariantHeaderRecords> __pyx_result, __pyx_state)
 *     return __pyx_result
 * cdef __pyx_unpickle_VariantHeaderRecords__set_state(VariantHeaderRecords __pyx_result, tuple __pyx_state):             # <<<<<<<<<<<<<<
 *     __pyx_result.header = __pyx_state[0]
 *     if len(__pyx_state) > 1 and hasattr(__pyx_result, '__dict__'):
*/

  /* function exit code */
  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  __Pyx_TraceReturnValue(__pyx_r, 0, 0, __PYX_ERR(4, 11, __pyx_L1_error));
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_5);
  __Pyx_XDECREF(__pyx_t_6);
  __Pyx_XDECREF(__pyx_t_7);
  __Pyx_TraceException(__pyx_lineno, 0, 0);
  #if CYTHON_USE_SYS_MONITORING
  __Pyx_TraceExceptionUnwind(0, 0);
  #else
  __Pyx_TraceReturnValue(NULL, 0, 0, __PYX_ERR(4, 11, __pyx_L1_error));
  #endif
  __Pyx_AddTraceback("pysam.libcbcf.__pyx_unpickle_VariantHeaderRecords__set_state", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_PyMonitoring_ExitScope(0);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "(tree fragment)":1
 * def __pyx_unpickle_VariantMetadata(__pyx_type, long __pyx_checksum, __pyx_state):             # <<<<<<<<<<<<<<
 *     cdef object __pyx_PickleError
 *     cdef object __pyx_result
*/

/* Python wrapper */
static PyObject *__pyx_pw_5pysam_7libcbcf_3__pyx_unpickle_VariantMetadata(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_5pysam_7libcbcf_2__pyx_unpickle_VariantMetadata, "__pyx_unpickle_VariantMetadata(__pyx_type, long __pyx_checksum, __pyx_state)");
static PyMethodDef __pyx_mdef_5pysam_7libcbcf_3__pyx_unpickle_VariantMetadata = {"__pyx_unpickle_VariantMetadata", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_5pysam_7libcbcf_3__pyx_unpickle_VariantMetadata, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_5pysam_7libcbcf_2__pyx_unpickle_VariantMetadata};
static PyObject *__pyx_pw_5pysam_7libcbcf_3__pyx_unpickle_VariantMetadata(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_VariantMetadata (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(4, 1, __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(4, 1, __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(4, 1, __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(4, 1, __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_VariantMetadata", 0) < 0) __PYX_ERR(4, 1, __pyx_L3_error)
      for (Py_ssize_t i = __pyx_nargs; i < 3; i++) {
        if (unlikely(!values[i])) { __Pyx_RaiseArgtupleInvalid("__pyx_unpickle_VariantMetadata", 1, 3, 3, i); __PYX_ERR(4, 1, __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(4, 1, __pyx_L3_error)
      values[1] = __Pyx_ArgRef_FASTCALL(__pyx_args, 1);
      if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[1])) __PYX_ERR(4, 1, __pyx_L3_error)
      values[2] = __Pyx_ArgRef_FASTCALL(__pyx_args, 2);
      if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[2])) __PYX_ERR(4, 1, __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(4, 1, __pyx_L3_error)
    __pyx_v___pyx_state = values[2];
  }
  goto __pyx_L6_skip;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("__pyx_unpickle_VariantMetadata", 1, 3, 3, __pyx_nargs); __PYX_ERR(4, 1, __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("pysam.libcbcf.__pyx_unpickle_VariantMetadata", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_5pysam_7libcbcf_2__pyx_unpickle_VariantMetadata(__pyx_self, __pyx_v___pyx_type, __pyx_v___pyx_checksum, __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_5pysam_7libcbcf_2__pyx_unpickle_VariantMetadata(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v___pyx_type, long __pyx_v___pyx_checksum, PyObject *__pyx_v___pyx_state) {
  PyObject *__pyx_v___pyx_PickleError = 0;
  PyObject *__pyx_v___pyx_result = 0;
  PyObject *__pyx_r = NULL;
  __Pyx_TraceDeclarationsFunc
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_t_2;
  PyObject *__pyx_t_3 = NULL;
  size_t __pyx_t_4;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_TraceFrameInit(((PyObject *)__pyx_mstate_global->__pyx_codeobj_tab[390]))
  __Pyx_RefNannySetupContext("__pyx_unpickle_VariantMetadata", 0);
  __Pyx_TraceStartFunc("__pyx_unpickle_VariantMetadata", __pyx_f[4], 1, 0, 0, 0, __PYX_ERR(4, 1, __pyx_L1_error));

  /* "(tree fragment)":4
 *     cdef object __pyx_PickleError
 *     cdef object __pyx_result
 *     if __pyx_checksum not in (0xcd1335f, 0xa03cdd6, 0x9d0a56c):             # <<<<<<<<<<<<<<
 *         from pickle import PickleError as __pyx_PickleError
 *         raise __pyx_PickleError, "Incompatible checksums (0x%x vs (0xcd1335f, 0xa03cdd6, 0x9d0a56c) = (header, id, type))" % __pyx_checksum
*/
  __pyx_t_1 = __Pyx_PyLong_From_long(__pyx_v___pyx_checksum); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 4, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_2 = (__Pyx_PySequence_ContainsTF(__pyx_t_1, __pyx_mstate_global->__pyx_tuple[2], Py_NE)); if (unlikely((__pyx_t_2 < 0))) __PYX_ERR(4, 4, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  if (__pyx_t_2) {

    /* "(tree fragment)":5
 *     cdef object __pyx_result
 *     if __pyx_checksum not in (0xcd1335f, 0xa03cdd6, 0x9d0a56c):
 *         from pickle import PickleError as __pyx_PickleError             # <<<<<<<<<<<<<<
 *         raise __pyx_PickleError, "Incompatible checksums (0x%x vs (0xcd1335f, 0xa03cdd6, 0x9d0a56c) = (header, id, type))" % __pyx_checksum
 *     __pyx_result = VariantMetadata.__new__(__pyx_type)
*/
    __pyx_t_1 = PyList_New(1); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 5, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_INCREF(__pyx_mstate_global->__pyx_n_u_PickleError);
    __Pyx_GIVEREF(__pyx_mstate_global->__pyx_n_u_PickleError);
    if (__Pyx_PyList_SET_ITEM(__pyx_t_1, 0, __pyx_mstate_global->__pyx_n_u_PickleError) != (0)) __PYX_ERR(4, 5, __pyx_L1_error);
    __pyx_t_3 = __Pyx_Import(__pyx_mstate_global->__pyx_n_u_pickle, __pyx_t_1, 0); if (unlikely(!__pyx_t_3)) __PYX_ERR(4, 5, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    __pyx_t_1 = __Pyx_ImportFrom(__pyx_t_3, __pyx_mstate_global->__pyx_n_u_PickleError); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 5, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_INCREF(__pyx_t_1);
    __pyx_v___pyx_PickleError = __pyx_t_1;
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;

    /* "(tree fragment)":6
 *     if __pyx_checksum not in (0xcd1335f, 0xa03cdd6, 0x9d0a56c):
 *         from pickle import PickleError as __pyx_PickleError
 *         raise __pyx_PickleError, "Incompatible checksums (0x%x vs (0xcd1335f, 0xa03cdd6, 0x9d0a56c) = (header, id, type))" % __pyx_checksum             # <<<<<<<<<<<<<<
 *     __pyx_result = VariantMetadata.__new__(__pyx_type)
 *     if __pyx_state is not None:
*/
    __pyx_t_3 = __Pyx_PyLong_From_long(__pyx_v___pyx_checksum); if (unlikely(!__pyx_t_3)) __PYX_ERR(4, 6, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __pyx_t_1 = PyUnicode_Format(__pyx_mstate_global->__pyx_kp_u_Incompatible_checksums_0x_x_vs_0_2, __pyx_t_3); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 6, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    __Pyx_Raise(__pyx_v___pyx_PickleError, __pyx_t_1, 0, 0);
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    __PYX_ERR(4, 6, __pyx_L1_error)

    /* "(tree fragment)":4
 *     cdef object __pyx_PickleError
 *     cdef object __pyx_result
 *     if __pyx_checksum not in (0xcd1335f, 0xa03cdd6, 0x9d0a56c):             # <<<<<<<<<<<<<<
 *         from pickle import PickleError as __pyx_PickleError
 *         raise __pyx_PickleError, "Incompatible checksums (0x%x vs (0xcd1335f, 0xa03cdd6, 0x9d0a56c) = (header, id, type))" % __pyx_checksum
*/
  }

  /* "(tree fragment)":7
 *         from pickle import PickleError as __pyx_PickleError
 *         raise __pyx_PickleError, "Incompatible checksums (0x%x vs (0xcd1335f, 0xa03cdd6, 0x9d0a56c) = (header, id, type))" % __pyx_checksum
 *     __pyx_result = VariantMetadata.__new__(__pyx_type)             # <<<<<<<<<<<<<<
 *     if __pyx_state is not None:
 *         __pyx_unpickle_VariantMetadata__set_state(<VariantMetadata> __pyx_result, __pyx_state)
*/
  __pyx_t_3 = ((PyObject *)__pyx_mstate_global->__pyx_ptype_5pysam_7libcbcf_VariantMetadata);
  __Pyx_INCREF(__pyx_t_3);
  __pyx_t_4 = 0;
  {
    PyObject *__pyx_callargs[2] = {__pyx_t_3, __pyx_v___pyx_type};
    __pyx_t_1 = __Pyx_PyObject_FastCallMethod(__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_1)) __PYX_ERR(4, 7, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
  }
  __pyx_v___pyx_result = __pyx_t_1;
  __pyx_t_1 = 0;

  /* "(tree fragment)":8
 *         raise __pyx_PickleError, "Incompatible checksums (0x%x vs (0xcd1335f, 0xa03cdd6, 0x9d0a56c) = (header, id, type))" % __pyx_checksum
 *     __pyx_result = VariantMetadata.__new__(__pyx_type)
 *     if __pyx_state is not None:             # <<<<<<<<<<<<<<
 *         __pyx_unpickle_VariantMetadata__set_state(<VariantMetadata> __pyx_result, __pyx_state)
 *     return __pyx_result
*/
  __pyx_t_2 = (__pyx_v___pyx_state != Py_None);
  if (__pyx_t_2) {

    /* "(tree fragment)":9
 *     __pyx_result = VariantMetadata.__new__(__pyx_type)
 *     if __pyx_state is not None:
 *         __pyx_unpickle_VariantMetadata__set_state(<VariantMetadata> __pyx_result, __pyx_state)             # <<<<<<<<<<<<<<
 *     return __pyx_result
 * cdef __pyx_unpickle_VariantMetadata__set_state(VariantMetadata __pyx_result, tuple __pyx_state):
*/
    if (!(likely(PyTuple_CheckExact(__pyx_v___pyx_state))||((__pyx_v___pyx_state) == Py_None) || __Pyx_RaiseUnexpectedTypeError("tuple", __pyx_v___pyx_state))) __PYX_ERR(4, 9, __pyx_L1_error)
    __pyx_t_1 = __pyx_f_5pysam_7libcbcf___pyx_unpickle_VariantMetadata__set_state(((struct __pyx_obj_5pysam_7libcbcf_VariantMetadata *)__pyx_v___pyx_result), ((PyObject*)__pyx_v___pyx_state)); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 9, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

    /* "(tree fragment)":8
 *         raise __pyx_PickleError, "Incompatible checksums (0x%x vs (0xcd1335f, 0xa03cdd6, 0x9d0a56c) = (header, id, type))" % __pyx_checksum
 *     __pyx_result = VariantMetadata.__new__(__pyx_type)
 *     if __pyx_state is not None:             # <<<<<<<<<<<<<<
 *         __pyx_unpickle_VariantMetadata__set_state(<VariantMetadata> __pyx_result, __pyx_state)
 *     return __pyx_result
*/
  }

  /* "(tree fragment)":10
 *     if __pyx_state is not None:
 *         __pyx_unpickle_VariantMetadata__set_state(<VariantMetadata> __pyx_result, __pyx_state)
 *     return __pyx_result             # <<<<<<<<<<<<<<
 * cdef __pyx_unpickle_VariantMetadata__set_state(VariantMetadata __pyx_result, tuple __pyx_state):
 *     __pyx_result.header = __pyx_state[0]; __pyx_result.id = __pyx_state[1]; __pyx_result.type = __pyx_state[2]
*/
  __Pyx_XDECREF(__pyx_r);
  __Pyx_INCREF(__pyx_v___pyx_result);
  __pyx_r = __pyx_v___pyx_result;
  __Pyx_TraceReturnValue(__pyx_r, 29, 0, __PYX_ERR(4, 10, __pyx_L1_error));
  goto __pyx_L0;

  /* "(tree fragment)":1
 * def __pyx_unpickle_VariantMetadata(__pyx_type, long __pyx_checksum, __pyx_state):             # <<<<<<<<<<<<<<
 *     cdef object __pyx_PickleError
 *     cdef object __pyx_result
*/

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_TraceException(__pyx_lineno, 0, 0);
  #if CYTHON_USE_SYS_MONITORING
  __Pyx_TraceExceptionUnwind(0, 0);
  #else
  __Pyx_TraceReturnValue(NULL, 0, 0, __PYX_ERR(4, 1, __pyx_L1_error));
  #endif
  __Pyx_AddTraceback("pysam.libcbcf.__pyx_unpickle_VariantMetadata", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v___pyx_PickleError);
  __Pyx_XDECREF(__pyx_v___pyx_result);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_PyMonitoring_ExitScope(0);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "(tree fragment)":11
 *         __pyx_unpickle_VariantMetadata__set_state(<VariantMetadata> __pyx_result, __pyx_state)
 *     return __pyx_result
 * cdef __pyx_unpickle_VariantMetadata__set_state(VariantMetadata __pyx_result, tuple __pyx_state):             # <<<<<<<<<<<<<<
 *     __pyx_result.header = __pyx_state[0]; __pyx_result.id = __pyx_state[1]; __pyx_result.type = __pyx_state[2]
 *     if len(__pyx_state) > 3 and hasattr(__pyx_result, '__dict__'):
*/

static PyObject *__pyx_f_5pysam_7libcbcf___pyx_unpickle_VariantMetadata__set_state(struct __pyx_obj_5pysam_7libcbcf_VariantMetadata *__pyx_v___pyx_result, PyObject *__pyx_v___pyx_state) {
  PyObject *__pyx_r = NULL;
  __Pyx_TraceDeclarationsFunc
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_t_2;
  int __pyx_t_3;
  Py_ssize_t __pyx_t_4;
  int __pyx_t_5;
  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_TraceFrameInit(((PyObject *)__pyx_mstate_global->__pyx_codeobj_tab[391]))
  __Pyx_RefNannySetupContext("__pyx_unpickle_VariantMetadata__set_state", 0);
  __Pyx_TraceStartFunc("__pyx_unpickle_VariantMetadata__set_state", __pyx_f[4], 11, 0, 0, 0, __PYX_ERR(4, 11, __pyx_L1_error));

  /* "(tree fragment)":12
 *     return __pyx_result
 * cdef __pyx_unpickle_VariantMetadata__set_state(VariantMetadata __pyx_result, tuple __pyx_state):
 *     __pyx_result.header = __pyx_state[0]; __pyx_result.id = __pyx_state[1]; __pyx_result.type = __pyx_state[2]             # <<<<<<<<<<<<<<
 *     if len(__pyx_state) > 3 and hasattr(__pyx_result, '__dict__'):
 *         __pyx_result.__dict__.update(__pyx_state[3])
*/
  if (unlikely(__pyx_v___pyx_state == Py_None)) {
    PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable");
    __PYX_ERR(4, 12, __pyx_L1_error)
  }
  __pyx_t_1 = __Pyx_GetItemInt_Tuple(__pyx_v___pyx_state, 0, long, 1, __Pyx_PyLong_From_long, 0, 0, 1, 1); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 12, __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_5pysam_7libcbcf_VariantHeader))))) __PYX_ERR(4, 12, __pyx_L1_error)
  __Pyx_GIVEREF(__pyx_t_1);
  __Pyx_GOTREF((PyObject *)__pyx_v___pyx_result->header);
  __Pyx_DECREF((PyObject *)__pyx_v___pyx_result->header);
  __pyx_v___pyx_result->header = ((struct __pyx_obj_5pysam_7libcbcf_VariantHeader *)__pyx_t_1);
  __pyx_t_1 = 0;
  if (unlikely(__pyx_v___pyx_state == Py_None)) {
    PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable");
    __PYX_ERR(4, 12, __pyx_L1_error)
  }
  __pyx_t_1 = __Pyx_GetItemInt_Tuple(__pyx_v___pyx_state, 1, long, 1, __Pyx_PyLong_From_long, 0, 0, 1, 1); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 12, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_2 = __Pyx_PyLong_As_int(__pyx_t_1); if (unlikely((__pyx_t_2 == (int)-1) && PyErr_Occurred())) __PYX_ERR(4, 12, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_v___pyx_result->id = __pyx_t_2;
  if (unlikely(__pyx_v___pyx_state == Py_None)) {
    PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable");
    __PYX_ERR(4, 12, __pyx_L1_error)
  }
  __pyx_t_1 = __Pyx_GetItemInt_Tuple(__pyx_v___pyx_state, 2, long, 1, __Pyx_PyLong_From_long, 0, 0, 1, 1); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 12, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_2 = __Pyx_PyLong_As_int(__pyx_t_1); if (unlikely((__pyx_t_2 == (int)-1) && PyErr_Occurred())) __PYX_ERR(4, 12, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_v___pyx_result->type = __pyx_t_2;

  /* "(tree fragment)":13
 * cdef __pyx_unpickle_VariantMetadata__set_state(VariantMetadata __pyx_result, tuple __pyx_state):
 *     __pyx_result.header = __pyx_state[0]; __pyx_result.id = __pyx_state[1]; __pyx_result.type = __pyx_state[2]
 *     if len(__pyx_state) > 3 and hasattr(__pyx_result, '__dict__'):             # <<<<<<<<<<<<<<
 *         __pyx_result.__dict__.update(__pyx_state[3])
*/
  if (unlikely(__pyx_v___pyx_state == Py_None)) {
    PyErr_SetString(PyExc_TypeError, "object of type 'NoneType' has no len()");
    __PYX_ERR(4, 13, __pyx_L1_error)
  }
  __pyx_t_4 = __Pyx_PyTuple_GET_SIZE(__pyx_v___pyx_state); if (unlikely(__pyx_t_4 == ((Py_ssize_t)-1))) __PYX_ERR(4, 13, __pyx_L1_error)
  __pyx_t_5 = (__pyx_t_4 > 3);
  if (__pyx_t_5) {
  } else {
    __pyx_t_3 = __pyx_t_5;
    goto __pyx_L4_bool_binop_done;
  }
  __pyx_t_5 = __Pyx_HasAttr(((PyObject *)__pyx_v___pyx_result), __pyx_mstate_global->__pyx_n_u_dict); if (unlikely(__pyx_t_5 == ((int)-1))) __PYX_ERR(4, 13, __pyx_L1_error)
  __pyx_t_3 = __pyx_t_5;
  __pyx_L4_bool_binop_done:;
  if (__pyx_t_3) {

    /* "(tree fragment)":14
 *     __pyx_result.header = __pyx_state[0]; __pyx_result.id = __pyx_state[1]; __pyx_result.type = __pyx_state[2]
 *     if len(__pyx_state) > 3 and hasattr(__pyx_result, '__dict__'):
 *         __pyx_result.__dict__.update(__pyx_state[3])             # <<<<<<<<<<<<<<
*/
    __pyx_t_7 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v___pyx_result), __pyx_mstate_global->__pyx_n_u_dict); if (unlikely(!__pyx_t_7)) __PYX_ERR(4, 14, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_7);
    __pyx_t_6 = __pyx_t_7;
    __Pyx_INCREF(__pyx_t_6);
    if (unlikely(__pyx_v___pyx_state == Py_None)) {
      PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable");
      __PYX_ERR(4, 14, __pyx_L1_error)
    }
    __pyx_t_8 = __Pyx_GetItemInt_Tuple(__pyx_v___pyx_state, 3, long, 1, __Pyx_PyLong_From_long, 0, 0, 1, 1); if (unlikely(!__pyx_t_8)) __PYX_ERR(4, 14, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_8);
    __pyx_t_9 = 0;
    {
      PyObject *__pyx_callargs[2] = {__pyx_t_6, __pyx_t_8};
      __pyx_t_1 = __Pyx_PyObject_FastCallMethod(__pyx_mstate_global->__pyx_n_u_update, __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;
      __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
      if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 14, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_1);
    }
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

    /* "(tree fragment)":13
 * cdef __pyx_unpickle_VariantMetadata__set_state(VariantMetadata __pyx_result, tuple __pyx_state):
 *     __pyx_result.header = __pyx_state[0]; __pyx_result.id = __pyx_state[1]; __pyx_result.type = __pyx_state[2]
 *     if len(__pyx_state) > 3 and hasattr(__pyx_result, '__dict__'):             # <<<<<<<<<<<<<<
 *         __pyx_result.__dict__.update(__pyx_state[3])
*/
  }

  /* "(tree fragment)":11
 *         __pyx_unpickle_VariantMetadata__set_state(<VariantMetadata> __pyx_result, __pyx_state)
 *     return __pyx_result
 * cdef __pyx_unpickle_VariantMetadata__set_state(VariantMetadata __pyx_result, tuple __pyx_state):             # <<<<<<<<<<<<<<
 *     __pyx_result.header = __pyx_state[0]; __pyx_result.id = __pyx_state[1]; __pyx_result.type = __pyx_state[2]
 *     if len(__pyx_state) > 3 and hasattr(__pyx_result, '__dict__'):
*/

  /* function exit code */
  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  __Pyx_TraceReturnValue(__pyx_r, 0, 0, __PYX_ERR(4, 11, __pyx_L1_error));
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_6);
  __Pyx_XDECREF(__pyx_t_7);
  __Pyx_XDECREF(__pyx_t_8);
  __Pyx_TraceException(__pyx_lineno, 0, 0);
  #if CYTHON_USE_SYS_MONITORING
  __Pyx_TraceExceptionUnwind(0, 0);
  #else
  __Pyx_TraceReturnValue(NULL, 0, 0, __PYX_ERR(4, 11, __pyx_L1_error));
  #endif
  __Pyx_AddTraceback("pysam.libcbcf.__pyx_unpickle_VariantMetadata__set_state", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_PyMonitoring_ExitScope(0);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "(tree fragment)":1
 * def __pyx_unpickle_VariantHeaderMetadata(__pyx_type, long __pyx_checksum, __pyx_state):             # <<<<<<<<<<<<<<
 *     cdef object __pyx_PickleError
 *     cdef object __pyx_result
*/

/* Python wrapper */
static PyObject *__pyx_pw_5pysam_7libcbcf_5__pyx_unpickle_VariantHeaderMetadata(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_5pysam_7libcbcf_4__pyx_unpickle_VariantHeaderMetadata, "__pyx_unpickle_VariantHeaderMetadata(__pyx_type, long __pyx_checksum, __pyx_state)");
static PyMethodDef __pyx_mdef_5pysam_7libcbcf_5__pyx_unpickle_VariantHeaderMetadata = {"__pyx_unpickle_VariantHeaderMetadata", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_5pysam_7libcbcf_5__pyx_unpickle_VariantHeaderMetadata, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_5pysam_7libcbcf_4__pyx_unpickle_VariantHeaderMetadata};
static PyObject *__pyx_pw_5pysam_7libcbcf_5__pyx_unpickle_VariantHeaderMetadata(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_VariantHeaderMetadata (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(4, 1, __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(4, 1, __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(4, 1, __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(4, 1, __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_VariantHeaderMetadata", 0) < 0) __PYX_ERR(4, 1, __pyx_L3_error)
      for (Py_ssize_t i = __pyx_nargs; i < 3; i++) {
        if (unlikely(!values[i])) { __Pyx_RaiseArgtupleInvalid("__pyx_unpickle_VariantHeaderMetadata", 1, 3, 3, i); __PYX_ERR(4, 1, __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(4, 1, __pyx_L3_error)
      values[1] = __Pyx_ArgRef_FASTCALL(__pyx_args, 1);
      if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[1])) __PYX_ERR(4, 1, __pyx_L3_error)
      values[2] = __Pyx_ArgRef_FASTCALL(__pyx_args, 2);
      if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[2])) __PYX_ERR(4, 1, __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(4, 1, __pyx_L3_error)
    __pyx_v___pyx_state = values[2];
  }
  goto __pyx_L6_skip;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("__pyx_unpickle_VariantHeaderMetadata", 1, 3, 3, __pyx_nargs); __PYX_ERR(4, 1, __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("pysam.libcbcf.__pyx_unpickle_VariantHeaderMetadata", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_5pysam_7libcbcf_4__pyx_unpickle_VariantHeaderMetadata(__pyx_self, __pyx_v___pyx_type, __pyx_v___pyx_checksum, __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_5pysam_7libcbcf_4__pyx_unpickle_VariantHeaderMetadata(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v___pyx_type, long __pyx_v___pyx_checksum, PyObject *__pyx_v___pyx_state) {
  PyObject *__pyx_v___pyx_PickleError = 0;
  PyObject *__pyx_v___pyx_result = 0;
  PyObject *__pyx_r = NULL;
  __Pyx_TraceDeclarationsFunc
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_t_2;
  PyObject *__pyx_t_3 = NULL;
  size_t __pyx_t_4;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_TraceFrameInit(((PyObject *)__pyx_mstate_global->__pyx_codeobj_tab[392]))
  __Pyx_RefNannySetupContext("__pyx_unpickle_VariantHeaderMetadata", 0);
  __Pyx_TraceStartFunc("__pyx_unpickle_VariantHeaderMetadata", __pyx_f[4], 1, 0, 0, 0, __PYX_ERR(4, 1, __pyx_L1_error));

  /* "(tree fragment)":4
 *     cdef object __pyx_PickleError
 *     cdef object __pyx_result
 *     if __pyx_checksum not in (0x816ca43, 0x0a33d30, 0xed5e66b):             # <<<<<<<<<<<<<<
 *         from pickle import PickleError as __pyx_PickleError
 *         raise __pyx_PickleError, "Incompatible checksums (0x%x vs (0x816ca43, 0x0a33d30, 0xed5e66b) = (header, type))" % __pyx_checksum
*/
  __pyx_t_1 = __Pyx_PyLong_From_long(__pyx_v___pyx_checksum); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 4, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_2 = (__Pyx_PySequence_ContainsTF(__pyx_t_1, __pyx_mstate_global->__pyx_tuple[3], Py_NE)); if (unlikely((__pyx_t_2 < 0))) __PYX_ERR(4, 4, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  if (__pyx_t_2) {

    /* "(tree fragment)":5
 *     cdef object __pyx_result
 *     if __pyx_checksum not in (0x816ca43, 0x0a33d30, 0xed5e66b):
 *         from pickle import PickleError as __pyx_PickleError             # <<<<<<<<<<<<<<
 *         raise __pyx_PickleError, "Incompatible checksums (0x%x vs (0x816ca43, 0x0a33d30, 0xed5e66b) = (header, type))" % __pyx_checksum
 *     __pyx_result = VariantHeaderMetadata.__new__(__pyx_type)
*/
    __pyx_t_1 = PyList_New(1); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 5, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_INCREF(__pyx_mstate_global->__pyx_n_u_PickleError);
    __Pyx_GIVEREF(__pyx_mstate_global->__pyx_n_u_PickleError);
    if (__Pyx_PyList_SET_ITEM(__pyx_t_1, 0, __pyx_mstate_global->__pyx_n_u_PickleError) != (0)) __PYX_ERR(4, 5, __pyx_L1_error);
    __pyx_t_3 = __Pyx_Import(__pyx_mstate_global->__pyx_n_u_pickle, __pyx_t_1, 0); if (unlikely(!__pyx_t_3)) __PYX_ERR(4, 5, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    __pyx_t_1 = __Pyx_ImportFrom(__pyx_t_3, __pyx_mstate_global->__pyx_n_u_PickleError); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 5, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_INCREF(__pyx_t_1);
    __pyx_v___pyx_PickleError = __pyx_t_1;
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;

    /* "(tree fragment)":6
 *     if __pyx_checksum not in (0x816ca43, 0x0a33d30, 0xed5e66b):
 *         from pickle import PickleError as __pyx_PickleError
 *         raise __pyx_PickleError, "Incompatible checksums (0x%x vs (0x816ca43, 0x0a33d30, 0xed5e66b) = (header, type))" % __pyx_checksum             # <<<<<<<<<<<<<<
 *     __pyx_result = VariantHeaderMetadata.__new__(__pyx_type)
 *     if __pyx_state is not None:
*/
    __pyx_t_3 = __Pyx_PyLong_From_long(__pyx_v___pyx_checksum); if (unlikely(!__pyx_t_3)) __PYX_ERR(4, 6, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __pyx_t_1 = PyUnicode_Format(__pyx_mstate_global->__pyx_kp_u_Incompatible_checksums_0x_x_vs_0_3, __pyx_t_3); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 6, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    __Pyx_Raise(__pyx_v___pyx_PickleError, __pyx_t_1, 0, 0);
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    __PYX_ERR(4, 6, __pyx_L1_error)

    /* "(tree fragment)":4
 *     cdef object __pyx_PickleError
 *     cdef object __pyx_result
 *     if __pyx_checksum not in (0x816ca43, 0x0a33d30, 0xed5e66b):             # <<<<<<<<<<<<<<
 *         from pickle import PickleError as __pyx_PickleError
 *         raise __pyx_PickleError, "Incompatible checksums (0x%x vs (0x816ca43, 0x0a33d30, 0xed5e66b) = (header, type))" % __pyx_checksum
*/
  }

  /* "(tree fragment)":7
 *         from pickle import PickleError as __pyx_PickleError
 *         raise __pyx_PickleError, "Incompatible checksums (0x%x vs (0x816ca43, 0x0a33d30, 0xed5e66b) = (header, type))" % __pyx_checksum
 *     __pyx_result = VariantHeaderMetadata.__new__(__pyx_type)             # <<<<<<<<<<<<<<
 *     if __pyx_state is not None:
 *         __pyx_unpickle_VariantHeaderMetadata__set_state(<VariantHeaderMetadata> __pyx_result, __pyx_state)
*/
  __pyx_t_3 = ((PyObject *)__pyx_mstate_global->__pyx_ptype_5pysam_7libcbcf_VariantHeaderMetadata);
  __Pyx_INCREF(__pyx_t_3);
  __pyx_t_4 = 0;
  {
    PyObject *__pyx_callargs[2] = {__pyx_t_3, __pyx_v___pyx_type};
    __pyx_t_1 = __Pyx_PyObject_FastCallMethod(__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_1)) __PYX_ERR(4, 7, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
  }
  __pyx_v___pyx_result = __pyx_t_1;
  __pyx_t_1 = 0;

  /* "(tree fragment)":8
 *         raise __pyx_PickleError, "Incompatible checksums (0x%x vs (0x816ca43, 0x0a33d30, 0xed5e66b) = (header, type))" % __pyx_checksum
 *     __pyx_result = VariantHeaderMetadata.__new__(__pyx_type)
 *     if __pyx_state is not None:             # <<<<<<<<<<<<<<
 *         __pyx_unpickle_VariantHeaderMetadata__set_state(<VariantHeaderMetadata> __pyx_result, __pyx_state)
 *     return __pyx_result
*/
  __pyx_t_2 = (__pyx_v___pyx_state != Py_None);
  if (__pyx_t_2) {

    /* "(tree fragment)":9
 *     __pyx_result = VariantHeaderMetadata.__new__(__pyx_type)
 *     if __pyx_state is not None:
 *         __pyx_unpickle_VariantHeaderMetadata__set_state(<VariantHeaderMetadata> __pyx_result, __pyx_state)             # <<<<<<<<<<<<<<
 *     return __pyx_result
 * cdef __pyx_unpickle_VariantHeaderMetadata__set_state(VariantHeaderMetadata __pyx_result, tuple __pyx_state):
*/
    if (!(likely(PyTuple_CheckExact(__pyx_v___pyx_state))||((__pyx_v___pyx_state) == Py_None) || __Pyx_RaiseUnexpectedTypeError("tuple", __pyx_v___pyx_state))) __PYX_ERR(4, 9, __pyx_L1_error)
    __pyx_t_1 = __pyx_f_5pysam_7libcbcf___pyx_unpickle_VariantHeaderMetadata__set_state(((struct __pyx_obj_5pysam_7libcbcf_VariantHeaderMetadata *)__pyx_v___pyx_result), ((PyObject*)__pyx_v___pyx_state)); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 9, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

    /* "(tree fragment)":8
 *         raise __pyx_PickleError, "Incompatible checksums (0x%x vs (0x816ca43, 0x0a33d30, 0xed5e66b) = (header, type))" % __pyx_checksum
 *     __pyx_result = VariantHeaderMetadata.__new__(__pyx_type)
 *     if __pyx_state is not None:             # <<<<<<<<<<<<<<
 *         __pyx_unpickle_VariantHeaderMetadata__set_state(<VariantHeaderMetadata> __pyx_result, __pyx_state)
 *     return __pyx_result
*/
  }

  /* "(tree fragment)":10
 *     if __pyx_state is not None:
 *         __pyx_unpickle_VariantHeaderMetadata__set_state(<VariantHeaderMetadata> __pyx_result, __pyx_state)
 *     return __pyx_result             # <<<<<<<<<<<<<<
 * cdef __pyx_unpickle_VariantHeaderMetadata__set_state(VariantHeaderMetadata __pyx_result, tuple __pyx_state):
 *     __pyx_result.header = __pyx_state[0]; __pyx_result.type = __pyx_state[1]
*/
  __Pyx_XDECREF(__pyx_r);
  __Pyx_INCREF(__pyx_v___pyx_result);
  __pyx_r = __pyx_v___pyx_result;
  __Pyx_TraceReturnValue(__pyx_r, 29, 0, __PYX_ERR(4, 10, __pyx_L1_error));
  goto __pyx_L0;

  /* "(tree fragment)":1
 * def __pyx_unpickle_VariantHeaderMetadata(__pyx_type, long __pyx_checksum, __pyx_state):             # <<<<<<<<<<<<<<
 *     cdef object __pyx_PickleError
 *     cdef object __pyx_result
*/

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_TraceException(__pyx_lineno, 0, 0);
  #if CYTHON_USE_SYS_MONITORING
  __Pyx_TraceExceptionUnwind(0, 0);
  #else
  __Pyx_TraceReturnValue(NULL, 0, 0, __PYX_ERR(4, 1, __pyx_L1_error));
  #endif
  __Pyx_AddTraceback("pysam.libcbcf.__pyx_unpickle_VariantHeaderMetadata", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v___pyx_PickleError);
  __Pyx_XDECREF(__pyx_v___pyx_result);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_PyMonitoring_ExitScope(0);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "(tree fragment)":11
 *         __pyx_unpickle_VariantHeaderMetadata__set_state(<VariantHeaderMetadata> __pyx_result, __pyx_state)
 *     return __pyx_result
 * cdef __pyx_unpickle_VariantHeaderMetadata__set_state(VariantHeaderMetadata __pyx_result, tuple __pyx_state):             # <<<<<<<<<<<<<<
 *     __pyx_result.header = __pyx_state[0]; __pyx_result.type = __pyx_state[1]
 *     if len(__pyx_state) > 2 and hasattr(__pyx_result, '__dict__'):
*/

static PyObject *__pyx_f_5pysam_7libcbcf___pyx_unpickle_VariantHeaderMetadata__set_state(struct __pyx_obj_5pysam_7libcbcf_VariantHeaderMetadata *__pyx_v___pyx_result, PyObject *__pyx_v___pyx_state) {
  PyObject *__pyx_r = NULL;
  __Pyx_TraceDeclarationsFunc
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int32_t __pyx_t_2;
  int __pyx_t_3;
  Py_ssize_t __pyx_t_4;
  int __pyx_t_5;
  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_TraceFrameInit(((PyObject *)__pyx_mstate_global->__pyx_codeobj_tab[393]))
  __Pyx_RefNannySetupContext("__pyx_unpickle_VariantHeaderMetadata__set_state", 0);
  __Pyx_TraceStartFunc("__pyx_unpickle_VariantHeaderMetadata__set_state", __pyx_f[4], 11, 0, 0, 0, __PYX_ERR(4, 11, __pyx_L1_error));

  /* "(tree fragment)":12
 *     return __pyx_result
 * cdef __pyx_unpickle_VariantHeaderMetadata__set_state(VariantHeaderMetadata __pyx_result, tuple __pyx_state):
 *     __pyx_result.header = __pyx_state[0]; __pyx_result.type = __pyx_state[1]             # <<<<<<<<<<<<<<
 *     if len(__pyx_state) > 2 and hasattr(__pyx_result, '__dict__'):
 *         __pyx_result.__dict__.update(__pyx_state[2])
*/
  if (unlikely(__pyx_v___pyx_state == Py_None)) {
    PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable");
    __PYX_ERR(4, 12, __pyx_L1_error)
  }
  __pyx_t_1 = __Pyx_GetItemInt_Tuple(__pyx_v___pyx_state, 0, long, 1, __Pyx_PyLong_From_long, 0, 0, 1, 1); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 12, __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_5pysam_7libcbcf_VariantHeader))))) __PYX_ERR(4, 12, __pyx_L1_error)
  __Pyx_GIVEREF(__pyx_t_1);
  __Pyx_GOTREF((PyObject *)__pyx_v___pyx_result->header);
  __Pyx_DECREF((PyObject *)__pyx_v___pyx_result->header);
  __pyx_v___pyx_result->header = ((struct __pyx_obj_5pysam_7libcbcf_VariantHeader *)__pyx_t_1);
  __pyx_t_1 = 0;
  if (unlikely(__pyx_v___pyx_state == Py_None)) {
    PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable");
    __PYX_ERR(4, 12, __pyx_L1_error)
  }
  __pyx_t_1 = __Pyx_GetItemInt_Tuple(__pyx_v___pyx_state, 1, long, 1, __Pyx_PyLong_From_long, 0, 0, 1, 1); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 12, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_2 = __Pyx_PyLong_As_int32_t(__pyx_t_1); if (unlikely((__pyx_t_2 == ((int32_t)-1)) && PyErr_Occurred())) __PYX_ERR(4, 12, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_v___pyx_result->type = __pyx_t_2;

  /* "(tree fragment)":13
 * cdef __pyx_unpickle_VariantHeaderMetadata__set_state(VariantHeaderMetadata __pyx_result, tuple __pyx_state):
 *     __pyx_result.header = __pyx_state[0]; __pyx_result.type = __pyx_state[1]
 *     if len(__pyx_state) > 2 and hasattr(__pyx_result, '__dict__'):             # <<<<<<<<<<<<<<
 *         __pyx_result.__dict__.update(__pyx_state[2])
*/
  if (unlikely(__pyx_v___pyx_state == Py_None)) {
    PyErr_SetString(PyExc_TypeError, "object of type 'NoneType' has no len()");
    __PYX_ERR(4, 13, __pyx_L1_error)
  }
  __pyx_t_4 = __Pyx_PyTuple_GET_SIZE(__pyx_v___pyx_state); if (unlikely(__pyx_t_4 == ((Py_ssize_t)-1))) __PYX_ERR(4, 13, __pyx_L1_error)
  __pyx_t_5 = (__pyx_t_4 > 2);
  if (__pyx_t_5) {
  } else {
    __pyx_t_3 = __pyx_t_5;
    goto __pyx_L4_bool_binop_done;
  }
  __pyx_t_5 = __Pyx_HasAttr(((PyObject *)__pyx_v___pyx_result), __pyx_mstate_global->__pyx_n_u_dict); if (unlikely(__pyx_t_5 == ((int)-1))) __PYX_ERR(4, 13, __pyx_L1_error)
  __pyx_t_3 = __pyx_t_5;
  __pyx_L4_bool_binop_done:;
  if (__pyx_t_3) {

    /* "(tree fragment)":14
 *     __pyx_result.header = __pyx_state[0]; __pyx_result.type = __pyx_state[1]
 *     if len(__pyx_state) > 2 and hasattr(__pyx_result, '__dict__'):
 *         __pyx_result.__dict__.update(__pyx_state[2])             # <<<<<<<<<<<<<<
*/
    __pyx_t_7 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v___pyx_result), __pyx_mstate_global->__pyx_n_u_dict); if (unlikely(!__pyx_t_7)) __PYX_ERR(4, 14, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_7);
    __pyx_t_6 = __pyx_t_7;
    __Pyx_INCREF(__pyx_t_6);
    if (unlikely(__pyx_v___pyx_state == Py_None)) {
      PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable");
      __PYX_ERR(4, 14, __pyx_L1_error)
    }
    __pyx_t_8 = __Pyx_GetItemInt_Tuple(__pyx_v___pyx_state, 2, long, 1, __Pyx_PyLong_From_long, 0, 0, 1, 1); if (unlikely(!__pyx_t_8)) __PYX_ERR(4, 14, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_8);
    __pyx_t_9 = 0;
    {
      PyObject *__pyx_callargs[2] = {__pyx_t_6, __pyx_t_8};
      __pyx_t_1 = __Pyx_PyObject_FastCallMethod(__pyx_mstate_global->__pyx_n_u_update, __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;
      __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
      if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 14, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_1);
    }
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

    /* "(tree fragment)":13
 * cdef __pyx_unpickle_VariantHeaderMetadata__set_state(VariantHeaderMetadata __pyx_result, tuple __pyx_state):
 *     __pyx_result.header = __pyx_state[0]; __pyx_result.type = __pyx_state[1]
 *     if len(__pyx_state) > 2 and hasattr(__pyx_result, '__dict__'):             # <<<<<<<<<<<<<<
 *         __pyx_result.__dict__.update(__pyx_state[2])
*/
  }

  /* "(tree fragment)":11
 *         __pyx_unpickle_VariantHeaderMetadata__set_state(<VariantHeaderMetadata> __pyx_result, __pyx_state)
 *     return __pyx_result
 * cdef __pyx_unpickle_VariantHeaderMetadata__set_state(VariantHeaderMetadata __pyx_result, tuple __pyx_state):             # <<<<<<<<<<<<<<
 *     __pyx_result.header = __pyx_state[0]; __pyx_result.type = __pyx_state[1]
 *     if len(__pyx_state) > 2 and hasattr(__pyx_result, '__dict__'):
*/

  /* function exit code */
  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  __Pyx_TraceReturnValue(__pyx_r, 0, 0, __PYX_ERR(4, 11, __pyx_L1_error));
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_6);
  __Pyx_XDECREF(__pyx_t_7);
  __Pyx_XDECREF(__pyx_t_8);
  __Pyx_TraceException(__pyx_lineno, 0, 0);
  #if CYTHON_USE_SYS_MONITORING
  __Pyx_TraceExceptionUnwind(0, 0);
  #else
  __Pyx_TraceReturnValue(NULL, 0, 0, __PYX_ERR(4, 11, __pyx_L1_error));
  #endif
  __Pyx_AddTraceback("pysam.libcbcf.__pyx_unpickle_VariantHeaderMetadata__set_state", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_PyMonitoring_ExitScope(0);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "(tree fragment)":1
 * def __pyx_unpickle_VariantContig(__pyx_type, long __pyx_checksum, __pyx_state):             # <<<<<<<<<<<<<<
 *     cdef object __pyx_PickleError
 *     cdef object __pyx_result
*/

/* Python wrapper */
static PyObject *__pyx_pw_5pysam_7libcbcf_7__pyx_unpickle_VariantContig(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_5pysam_7libcbcf_6__pyx_unpickle_VariantContig, "__pyx_unpickle_VariantContig(__pyx_type, long __pyx_checksum, __pyx_state)");
static PyMethodDef __pyx_mdef_5pysam_7libcbcf_7__pyx_unpickle_VariantContig = {"__pyx_unpickle_VariantContig", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_5pysam_7libcbcf_7__pyx_unpickle_VariantContig, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_5pysam_7libcbcf_6__pyx_unpickle_VariantContig};
static PyObject *__pyx_pw_5pysam_7libcbcf_7__pyx_unpickle_VariantContig(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_VariantContig (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(4, 1, __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(4, 1, __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(4, 1, __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(4, 1, __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_VariantContig", 0) < 0) __PYX_ERR(4, 1, __pyx_L3_error)
      for (Py_ssize_t i = __pyx_nargs; i < 3; i++) {
        if (unlikely(!values[i])) { __Pyx_RaiseArgtupleInvalid("__pyx_unpickle_VariantContig", 1, 3, 3, i); __PYX_ERR(4, 1, __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(4, 1, __pyx_L3_error)
      values[1] = __Pyx_ArgRef_FASTCALL(__pyx_args, 1);
      if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[1])) __PYX_ERR(4, 1, __pyx_L3_error)
      values[2] = __Pyx_ArgRef_FASTCALL(__pyx_args, 2);
      if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[2])) __PYX_ERR(4, 1, __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(4, 1, __pyx_L3_error)
    __pyx_v___pyx_state = values[2];
  }
  goto __pyx_L6_skip;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("__pyx_unpickle_VariantContig", 1, 3, 3, __pyx_nargs); __PYX_ERR(4, 1, __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("pysam.libcbcf.__pyx_unpickle_VariantContig", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_5pysam_7libcbcf_6__pyx_unpickle_VariantContig(__pyx_self, __pyx_v___pyx_type, __pyx_v___pyx_checksum, __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_5pysam_7libcbcf_6__pyx_unpickle_VariantContig(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v___pyx_type, long __pyx_v___pyx_checksum, PyObject *__pyx_v___pyx_state) {
  PyObject *__pyx_v___pyx_PickleError = 0;
  PyObject *__pyx_v___pyx_result = 0;
  PyObject *__pyx_r = NULL;
  __Pyx_TraceDeclarationsFunc
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_t_2;
  PyObject *__pyx_t_3 = NULL;
  size_t __pyx_t_4;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_TraceFrameInit(((PyObject *)__pyx_mstate_global->__pyx_codeobj_tab[394]))
  __Pyx_RefNannySetupContext("__pyx_unpickle_VariantContig", 0);
  __Pyx_TraceStartFunc("__pyx_unpickle_VariantContig", __pyx_f[4], 1, 0, 0, 0, __PYX_ERR(4, 1, __pyx_L1_error));

  /* "(tree fragment)":4
 *     cdef object __pyx_PickleError
 *     cdef object __pyx_result
 *     if __pyx_checksum not in (0x2572060, 0x8ae1160, 0xbe66ecb):             # <<<<<<<<<<<<<<
 *         from pickle import PickleError as __pyx_PickleError
 *         raise __pyx_PickleError, "Incompatible checksums (0x%x vs (0x2572060, 0x8ae1160, 0xbe66ecb) = (header, id))" % __pyx_checksum
*/
  __pyx_t_1 = __Pyx_PyLong_From_long(__pyx_v___pyx_checksum); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 4, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_2 = (__Pyx_PySequence_ContainsTF(__pyx_t_1, __pyx_mstate_global->__pyx_tuple[4], Py_NE)); if (unlikely((__pyx_t_2 < 0))) __PYX_ERR(4, 4, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  if (__pyx_t_2) {

    /* "(tree fragment)":5
 *     cdef object __pyx_result
 *     if __pyx_checksum not in (0x2572060, 0x8ae1160, 0xbe66ecb):
 *         from pickle import PickleError as __pyx_PickleError             # <<<<<<<<<<<<<<
 *         raise __pyx_PickleError, "Incompatible checksums (0x%x vs (0x2572060, 0x8ae1160, 0xbe66ecb) = (header, id))" % __pyx_checksum
 *     __pyx_result = VariantContig.__new__(__pyx_type)
*/
    __pyx_t_1 = PyList_New(1); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 5, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_INCREF(__pyx_mstate_global->__pyx_n_u_PickleError);
    __Pyx_GIVEREF(__pyx_mstate_global->__pyx_n_u_PickleError);
    if (__Pyx_PyList_SET_ITEM(__pyx_t_1, 0, __pyx_mstate_global->__pyx_n_u_PickleError) != (0)) __PYX_ERR(4, 5, __pyx_L1_error);
    __pyx_t_3 = __Pyx_Import(__pyx_mstate_global->__pyx_n_u_pickle, __pyx_t_1, 0); if (unlikely(!__pyx_t_3)) __PYX_ERR(4, 5, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    __pyx_t_1 = __Pyx_ImportFrom(__pyx_t_3, __pyx_mstate_global->__pyx_n_u_PickleError); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 5, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_INCREF(__pyx_t_1);
    __pyx_v___pyx_PickleError = __pyx_t_1;
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;

    /* "(tree fragment)":6
 *     if __pyx_checksum not in (0x2572060, 0x8ae1160, 0xbe66ecb):
 *         from pickle import PickleError as __pyx_PickleError
 *         raise __pyx_PickleError, "Incompatible checksums (0x%x vs (0x2572060, 0x8ae1160, 0xbe66ecb) = (header, id))" % __pyx_checksum             # <<<<<<<<<<<<<<
 *     __pyx_result = VariantContig.__new__(__pyx_type)
 *     if __pyx_state is not None:
*/
    __pyx_t_3 = __Pyx_PyLong_From_long(__pyx_v___pyx_checksum); if (unlikely(!__pyx_t_3)) __PYX_ERR(4, 6, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __pyx_t_1 = PyUnicode_Format(__pyx_mstate_global->__pyx_kp_u_Incompatible_checksums_0x_x_vs_0_4, __pyx_t_3); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 6, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    __Pyx_Raise(__pyx_v___pyx_PickleError, __pyx_t_1, 0, 0);
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    __PYX_ERR(4, 6, __pyx_L1_error)

    /* "(tree fragment)":4
 *     cdef object __pyx_PickleError
 *     cdef object __pyx_result
 *     if __pyx_checksum not in (0x2572060, 0x8ae1160, 0xbe66ecb):             # <<<<<<<<<<<<<<
 *         from pickle import PickleError as __pyx_PickleError
 *         raise __pyx_PickleError, "Incompatible checksums (0x%x vs (0x2572060, 0x8ae1160, 0xbe66ecb) = (header, id))" % __pyx_checksum
*/
  }

  /* "(tree fragment)":7
 *         from pickle import PickleError as __pyx_PickleError
 *         raise __pyx_PickleError, "Incompatible checksums (0x%x vs (0x2572060, 0x8ae1160, 0xbe66ecb) = (header, id))" % __pyx_checksum
 *     __pyx_result = VariantContig.__new__(__pyx_type)             # <<<<<<<<<<<<<<
 *     if __pyx_state is not None:
 *         __pyx_unpickle_VariantContig__set_state(<VariantContig> __pyx_result, __pyx_state)
*/
  __pyx_t_3 = ((PyObject *)__pyx_mstate_global->__pyx_ptype_5pysam_7libcbcf_VariantContig);
  __Pyx_INCREF(__pyx_t_3);
  __pyx_t_4 = 0;
  {
    PyObject *__pyx_callargs[2] = {__pyx_t_3, __pyx_v___pyx_type};
    __pyx_t_1 = __Pyx_PyObject_FastCallMethod(__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_1)) __PYX_ERR(4, 7, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
  }
  __pyx_v___pyx_result = __pyx_t_1;
  __pyx_t_1 = 0;

  /* "(tree fragment)":8
 *         raise __pyx_PickleError, "Incompatible checksums (0x%x vs (0x2572060, 0x8ae1160, 0xbe66ecb) = (header, id))" % __pyx_checksum
 *     __pyx_result = VariantContig.__new__(__pyx_type)
 *     if __pyx_state is not None:             # <<<<<<<<<<<<<<
 *         __pyx_unpickle_VariantContig__set_state(<VariantContig> __pyx_result, __pyx_state)
 *     return __pyx_result
*/
  __pyx_t_2 = (__pyx_v___pyx_state != Py_None);
  if (__pyx_t_2) {

    /* "(tree fragment)":9
 *     __pyx_result = VariantContig.__new__(__pyx_type)
 *     if __pyx_state is not None:
 *         __pyx_unpickle_VariantContig__set_state(<VariantContig> __pyx_result, __pyx_state)             # <<<<<<<<<<<<<<
 *     return __pyx_result
 * cdef __pyx_unpickle_VariantContig__set_state(VariantContig __pyx_result, tuple __pyx_state):
*/
    if (!(likely(PyTuple_CheckExact(__pyx_v___pyx_state))||((__pyx_v___pyx_state) == Py_None) || __Pyx_RaiseUnexpectedTypeError("tuple", __pyx_v___pyx_state))) __PYX_ERR(4, 9, __pyx_L1_error)
    __pyx_t_1 = __pyx_f_5pysam_7libcbcf___pyx_unpickle_VariantContig__set_state(((struct __pyx_obj_5pysam_7libcbcf_VariantContig *)__pyx_v___pyx_result), ((PyObject*)__pyx_v___pyx_state)); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 9, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

    /* "(tree fragment)":8
 *         raise __pyx_PickleError, "Incompatible checksums (0x%x vs (0x2572060, 0x8ae1160, 0xbe66ecb) = (header, id))" % __pyx_checksum
 *     __pyx_result = VariantContig.__new__(__pyx_type)
 *     if __pyx_state is not None:             # <<<<<<<<<<<<<<
 *         __pyx_unpickle_VariantContig__set_state(<VariantContig> __pyx_result, __pyx_state)
 *     return __pyx_result
*/
  }

  /* "(tree fragment)":10
 *     if __pyx_state is not None:
 *         __pyx_unpickle_VariantContig__set_state(<VariantContig> __pyx_result, __pyx_state)
 *     return __pyx_result             # <<<<<<<<<<<<<<
 * cdef __pyx_unpickle_VariantContig__set_state(VariantContig __pyx_result, tuple __pyx_state):
 *     __pyx_result.header = __pyx_state[0]; __pyx_result.id = __pyx_state[1]
*/
  __Pyx_XDECREF(__pyx_r);
  __Pyx_INCREF(__pyx_v___pyx_result);
  __pyx_r = __pyx_v___pyx_result;
  __Pyx_TraceReturnValue(__pyx_r, 29, 0, __PYX_ERR(4, 10, __pyx_L1_error));
  goto __pyx_L0;

  /* "(tree fragment)":1
 * def __pyx_unpickle_VariantContig(__pyx_type, long __pyx_checksum, __pyx_state):             # <<<<<<<<<<<<<<
 *     cdef object __pyx_PickleError
 *     cdef object __pyx_result
*/

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_TraceException(__pyx_lineno, 0, 0);
  #if CYTHON_USE_SYS_MONITORING
  __Pyx_TraceExceptionUnwind(0, 0);
  #else
  __Pyx_TraceReturnValue(NULL, 0, 0, __PYX_ERR(4, 1, __pyx_L1_error));
  #endif
  __Pyx_AddTraceback("pysam.libcbcf.__pyx_unpickle_VariantContig", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v___pyx_PickleError);
  __Pyx_XDECREF(__pyx_v___pyx_result);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_PyMonitoring_ExitScope(0);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "(tree fragment)":11
 *         __pyx_unpickle_VariantContig__set_state(<VariantContig> __pyx_result, __pyx_state)
 *     return __pyx_result
 * cdef __pyx_unpickle_VariantContig__set_state(VariantContig __pyx_result, tuple __pyx_state):             # <<<<<<<<<<<<<<
 *     __pyx_result.header = __pyx_state[0]; __pyx_result.id = __pyx_state[1]
 *     if len(__pyx_state) > 2 and hasattr(__pyx_result, '__dict__'):
*/

static PyObject *__pyx_f_5pysam_7libcbcf___pyx_unpickle_VariantContig__set_state(struct __pyx_obj_5pysam_7libcbcf_VariantContig *__pyx_v___pyx_result, PyObject *__pyx_v___pyx_state) {
  PyObject *__pyx_r = NULL;
  __Pyx_TraceDeclarationsFunc
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_t_2;
  int __pyx_t_3;
  Py_ssize_t __pyx_t_4;
  int __pyx_t_5;
  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_TraceFrameInit(((PyObject *)__pyx_mstate_global->__pyx_codeobj_tab[395]))
  __Pyx_RefNannySetupContext("__pyx_unpickle_VariantContig__set_state", 0);
  __Pyx_TraceStartFunc("__pyx_unpickle_VariantContig__set_state", __pyx_f[4], 11, 0, 0, 0, __PYX_ERR(4, 11, __pyx_L1_error));

  /* "(tree fragment)":12
 *     return __pyx_result
 * cdef __pyx_unpickle_VariantContig__set_state(VariantContig __pyx_result, tuple __pyx_state):
 *     __pyx_result.header = __pyx_state[0]; __pyx_result.id = __pyx_state[1]             # <<<<<<<<<<<<<<
 *     if len(__pyx_state) > 2 and hasattr(__pyx_result, '__dict__'):
 *         __pyx_result.__dict__.update(__pyx_state[2])
*/
  if (unlikely(__pyx_v___pyx_state == Py_None)) {
    PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable");
    __PYX_ERR(4, 12, __pyx_L1_error)
  }
  __pyx_t_1 = __Pyx_GetItemInt_Tuple(__pyx_v___pyx_state, 0, long, 1, __Pyx_PyLong_From_long, 0, 0, 1, 1); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 12, __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_5pysam_7libcbcf_VariantHeader))))) __PYX_ERR(4, 12, __pyx_L1_error)
  __Pyx_GIVEREF(__pyx_t_1);
  __Pyx_GOTREF((PyObject *)__pyx_v___pyx_result->header);
  __Pyx_DECREF((PyObject *)__pyx_v___pyx_result->header);
  __pyx_v___pyx_result->header = ((struct __pyx_obj_5pysam_7libcbcf_VariantHeader *)__pyx_t_1);
  __pyx_t_1 = 0;
  if (unlikely(__pyx_v___pyx_state == Py_None)) {
    PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable");
    __PYX_ERR(4, 12, __pyx_L1_error)
  }
  __pyx_t_1 = __Pyx_GetItemInt_Tuple(__pyx_v___pyx_state, 1, long, 1, __Pyx_PyLong_From_long, 0, 0, 1, 1); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 12, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_2 = __Pyx_PyLong_As_int(__pyx_t_1); if (unlikely((__pyx_t_2 == (int)-1) && PyErr_Occurred())) __PYX_ERR(4, 12, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_v___pyx_result->id = __pyx_t_2;

  /* "(tree fragment)":13
 * cdef __pyx_unpickle_VariantContig__set_state(VariantContig __pyx_result, tuple __pyx_state):
 *     __pyx_result.header = __pyx_state[0]; __pyx_result.id = __pyx_state[1]
 *     if len(__pyx_state) > 2 and hasattr(__pyx_result, '__dict__'):             # <<<<<<<<<<<<<<
 *         __pyx_result.__dict__.update(__pyx_state[2])
*/
  if (unlikely(__pyx_v___pyx_state == Py_None)) {
    PyErr_SetString(PyExc_TypeError, "object of type 'NoneType' has no len()");
    __PYX_ERR(4, 13, __pyx_L1_error)
  }
  __pyx_t_4 = __Pyx_PyTuple_GET_SIZE(__pyx_v___pyx_state); if (unlikely(__pyx_t_4 == ((Py_ssize_t)-1))) __PYX_ERR(4, 13, __pyx_L1_error)
  __pyx_t_5 = (__pyx_t_4 > 2);
  if (__pyx_t_5) {
  } else {
    __pyx_t_3 = __pyx_t_5;
    goto __pyx_L4_bool_binop_done;
  }
  __pyx_t_5 = __Pyx_HasAttr(((PyObject *)__pyx_v___pyx_result), __pyx_mstate_global->__pyx_n_u_dict); if (unlikely(__pyx_t_5 == ((int)-1))) __PYX_ERR(4, 13, __pyx_L1_error)
  __pyx_t_3 = __pyx_t_5;
  __pyx_L4_bool_binop_done:;
  if (__pyx_t_3) {

    /* "(tree fragment)":14
 *     __pyx_result.header = __pyx_state[0]; __pyx_result.id = __pyx_state[1]
 *     if len(__pyx_state) > 2 and hasattr(__pyx_result, '__dict__'):
 *         __pyx_result.__dict__.update(__pyx_state[2])             # <<<<<<<<<<<<<<
*/
    __pyx_t_7 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v___pyx_result), __pyx_mstate_global->__pyx_n_u_dict); if (unlikely(!__pyx_t_7)) __PYX_ERR(4, 14, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_7);
    __pyx_t_6 = __pyx_t_7;
    __Pyx_INCREF(__pyx_t_6);
    if (unlikely(__pyx_v___pyx_state == Py_None)) {
      PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable");
      __PYX_ERR(4, 14, __pyx_L1_error)
    }
    __pyx_t_8 = __Pyx_GetItemInt_Tuple(__pyx_v___pyx_state, 2, long, 1, __Pyx_PyLong_From_long, 0, 0, 1, 1); if (unlikely(!__pyx_t_8)) __PYX_ERR(4, 14, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_8);
    __pyx_t_9 = 0;
    {
      PyObject *__pyx_callargs[2] = {__pyx_t_6, __pyx_t_8};
      __pyx_t_1 = __Pyx_PyObject_FastCallMethod(__pyx_mstate_global->__pyx_n_u_update, __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;
      __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
      if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 14, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_1);
    }
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

    /* "(tree fragment)":13
 * cdef __pyx_unpickle_VariantContig__set_state(VariantContig __pyx_result, tuple __pyx_state):
 *     __pyx_result.header = __pyx_state[0]; __pyx_result.id = __pyx_state[1]
 *     if len(__pyx_state) > 2 and hasattr(__pyx_result, '__dict__'):             # <<<<<<<<<<<<<<
 *         __pyx_result.__dict__.update(__pyx_state[2])
*/
  }

  /* "(tree fragment)":11
 *         __pyx_unpickle_VariantContig__set_state(<VariantContig> __pyx_result, __pyx_state)
 *     return __pyx_result
 * cdef __pyx_unpickle_VariantContig__set_state(VariantContig __pyx_result, tuple __pyx_state):             # <<<<<<<<<<<<<<
 *     __pyx_result.header = __pyx_state[0]; __pyx_result.id = __pyx_state[1]
 *     if len(__pyx_state) > 2 and hasattr(__pyx_result, '__dict__'):
*/

  /* function exit code */
  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  __Pyx_TraceReturnValue(__pyx_r, 0, 0, __PYX_ERR(4, 11, __pyx_L1_error));
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_6);
  __Pyx_XDECREF(__pyx_t_7);
  __Pyx_XDECREF(__pyx_t_8);
  __Pyx_TraceException(__pyx_lineno, 0, 0);
  #if CYTHON_USE_SYS_MONITORING
  __Pyx_TraceExceptionUnwind(0, 0);
  #else
  __Pyx_TraceReturnValue(NULL, 0, 0, __PYX_ERR(4, 11, __pyx_L1_error));
  #endif
  __Pyx_AddTraceback("pysam.libcbcf.__pyx_unpickle_VariantContig__set_state", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_PyMonitoring_ExitScope(0);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "(tree fragment)":1
 * def __pyx_unpickle_VariantHeaderContigs(__pyx_type, long __pyx_checksum, __pyx_state):             # <<<<<<<<<<<<<<
 *     cdef object __pyx_PickleError
 *     cdef object __pyx_result
*/

/* Python wrapper */
static PyObject *__pyx_pw_5pysam_7libcbcf_9__pyx_unpickle_VariantHeaderContigs(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_5pysam_7libcbcf_8__pyx_unpickle_VariantHeaderContigs, "__pyx_unpickle_VariantHeaderContigs(__pyx_type, long __pyx_checksum, __pyx_state)");
static PyMethodDef __pyx_mdef_5pysam_7libcbcf_9__pyx_unpickle_VariantHeaderContigs = {"__pyx_unpickle_VariantHeaderContigs", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_5pysam_7libcbcf_9__pyx_unpickle_VariantHeaderContigs, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_5pysam_7libcbcf_8__pyx_unpickle_VariantHeaderContigs};
static PyObject *__pyx_pw_5pysam_7libcbcf_9__pyx_unpickle_VariantHeaderContigs(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_VariantHeaderContigs (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(4, 1, __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(4, 1, __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(4, 1, __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(4, 1, __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_VariantHeaderContigs", 0) < 0) __PYX_ERR(4, 1, __pyx_L3_error)
      for (Py_ssize_t i = __pyx_nargs; i < 3; i++) {
        if (unlikely(!values[i])) { __Pyx_RaiseArgtupleInvalid("__pyx_unpickle_VariantHeaderContigs", 1, 3, 3, i); __PYX_ERR(4, 1, __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(4, 1, __pyx_L3_error)
      values[1] = __Pyx_ArgRef_FASTCALL(__pyx_args, 1);
      if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[1])) __PYX_ERR(4, 1, __pyx_L3_error)
      values[2] = __Pyx_ArgRef_FASTCALL(__pyx_args, 2);
      if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[2])) __PYX_ERR(4, 1, __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(4, 1, __pyx_L3_error)
    __pyx_v___pyx_state = values[2];
  }
  goto __pyx_L6_skip;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("__pyx_unpickle_VariantHeaderContigs", 1, 3, 3, __pyx_nargs); __PYX_ERR(4, 1, __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("pysam.libcbcf.__pyx_unpickle_VariantHeaderContigs", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_5pysam_7libcbcf_8__pyx_unpickle_VariantHeaderContigs(__pyx_self, __pyx_v___pyx_type, __pyx_v___pyx_checksum, __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_5pysam_7libcbcf_8__pyx_unpickle_VariantHeaderContigs(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v___pyx_type, long __pyx_v___pyx_checksum, PyObject *__pyx_v___pyx_state) {
  PyObject *__pyx_v___pyx_PickleError = 0;
  PyObject *__pyx_v___pyx_result = 0;
  PyObject *__pyx_r = NULL;
  __Pyx_TraceDeclarationsFunc
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_t_2;
  PyObject *__pyx_t_3 = NULL;
  size_t __pyx_t_4;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_TraceFrameInit(((PyObject *)__pyx_mstate_global->__pyx_codeobj_tab[396]))
  __Pyx_RefNannySetupContext("__pyx_unpickle_VariantHeaderContigs", 0);
  __Pyx_TraceStartFunc("__pyx_unpickle_VariantHeaderContigs", __pyx_f[4], 1, 0, 0, 0, __PYX_ERR(4, 1, __pyx_L1_error));

  /* "(tree fragment)":4
 *     cdef object __pyx_PickleError
 *     cdef object __pyx_result
 *     if __pyx_checksum not in (0x1e0584a, 0x594fd16, 0x099fb99):             # <<<<<<<<<<<<<<
 *         from pickle import PickleError as __pyx_PickleError
 *         raise __pyx_PickleError, "Incompatible checksums (0x%x vs (0x1e0584a, 0x594fd16, 0x099fb99) = (header))" % __pyx_checksum
*/
  __pyx_t_1 = __Pyx_PyLong_From_long(__pyx_v___pyx_checksum); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 4, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_2 = (__Pyx_PySequence_ContainsTF(__pyx_t_1, __pyx_mstate_global->__pyx_tuple[1], Py_NE)); if (unlikely((__pyx_t_2 < 0))) __PYX_ERR(4, 4, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  if (__pyx_t_2) {

    /* "(tree fragment)":5
 *     cdef object __pyx_result
 *     if __pyx_checksum not in (0x1e0584a, 0x594fd16, 0x099fb99):
 *         from pickle import PickleError as __pyx_PickleError             # <<<<<<<<<<<<<<
 *         raise __pyx_PickleError, "Incompatible checksums (0x%x vs (0x1e0584a, 0x594fd16, 0x099fb99) = (header))" % __pyx_checksum
 *     __pyx_result = VariantHeaderContigs.__new__(__pyx_type)
*/
    __pyx_t_1 = PyList_New(1); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 5, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_INCREF(__pyx_mstate_global->__pyx_n_u_PickleError);
    __Pyx_GIVEREF(__pyx_mstate_global->__pyx_n_u_PickleError);
    if (__Pyx_PyList_SET_ITEM(__pyx_t_1, 0, __pyx_mstate_global->__pyx_n_u_PickleError) != (0)) __PYX_ERR(4, 5, __pyx_L1_error);
    __pyx_t_3 = __Pyx_Import(__pyx_mstate_global->__pyx_n_u_pickle, __pyx_t_1, 0); if (unlikely(!__pyx_t_3)) __PYX_ERR(4, 5, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    __pyx_t_1 = __Pyx_ImportFrom(__pyx_t_3, __pyx_mstate_global->__pyx_n_u_PickleError); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 5, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_INCREF(__pyx_t_1);
    __pyx_v___pyx_PickleError = __pyx_t_1;
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;

    /* "(tree fragment)":6
 *     if __pyx_checksum not in (0x1e0584a, 0x594fd16, 0x099fb99):
 *         from pickle import PickleError as __pyx_PickleError
 *         raise __pyx_PickleError, "Incompatible checksums (0x%x vs (0x1e0584a, 0x594fd16, 0x099fb99) = (header))" % __pyx_checksum             # <<<<<<<<<<<<<<
 *     __pyx_result = VariantHeaderContigs.__new__(__pyx_type)
 *     if __pyx_state is not None:
*/
    __pyx_t_3 = __Pyx_PyLong_From_long(__pyx_v___pyx_checksum); if (unlikely(!__pyx_t_3)) __PYX_ERR(4, 6, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __pyx_t_1 = PyUnicode_Format(__pyx_mstate_global->__pyx_kp_u_Incompatible_checksums_0x_x_vs_0, __pyx_t_3); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 6, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    __Pyx_Raise(__pyx_v___pyx_PickleError, __pyx_t_1, 0, 0);
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    __PYX_ERR(4, 6, __pyx_L1_error)

    /* "(tree fragment)":4
 *     cdef object __pyx_PickleError
 *     cdef object __pyx_result
 *     if __pyx_checksum not in (0x1e0584a, 0x594fd16, 0x099fb99):             # <<<<<<<<<<<<<<
 *         from pickle import PickleError as __pyx_PickleError
 *         raise __pyx_PickleError, "Incompatible checksums (0x%x vs (0x1e0584a, 0x594fd16, 0x099fb99) = (header))" % __pyx_checksum
*/
  }

  /* "(tree fragment)":7
 *         from pickle import PickleError as __pyx_PickleError
 *         raise __pyx_PickleError, "Incompatible checksums (0x%x vs (0x1e0584a, 0x594fd16, 0x099fb99) = (header))" % __pyx_checksum
 *     __pyx_result = VariantHeaderContigs.__new__(__pyx_type)             # <<<<<<<<<<<<<<
 *     if __pyx_state is not None:
 *         __pyx_unpickle_VariantHeaderContigs__set_state(<VariantHeaderContigs> __pyx_result, __pyx_state)
*/
  __pyx_t_3 = ((PyObject *)__pyx_mstate_global->__pyx_ptype_5pysam_7libcbcf_VariantHeaderContigs);
  __Pyx_INCREF(__pyx_t_3);
  __pyx_t_4 = 0;
  {
    PyObject *__pyx_callargs[2] = {__pyx_t_3, __pyx_v___pyx_type};
    __pyx_t_1 = __Pyx_PyObject_FastCallMethod(__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_1)) __PYX_ERR(4, 7, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
  }
  __pyx_v___pyx_result = __pyx_t_1;
  __pyx_t_1 = 0;

  /* "(tree fragment)":8
 *         raise __pyx_PickleError, "Incompatible checksums (0x%x vs (0x1e0584a, 0x594fd16, 0x099fb99) = (header))" % __pyx_checksum
 *     __pyx_result = VariantHeaderContigs.__new__(__pyx_type)
 *     if __pyx_state is not None:             # <<<<<<<<<<<<<<
 *         __pyx_unpickle_VariantHeaderContigs__set_state(<VariantHeaderContigs> __pyx_result, __pyx_state)
 *     return __pyx_result
*/
  __pyx_t_2 = (__pyx_v___pyx_state != Py_None);
  if (__pyx_t_2) {

    /* "(tree fragment)":9
 *     __pyx_result = VariantHeaderContigs.__new__(__pyx_type)
 *     if __pyx_state is not None:
 *         __pyx_unpickle_VariantHeaderContigs__set_state(<VariantHeaderContigs> __pyx_result, __pyx_state)             # <<<<<<<<<<<<<<
 *     return __pyx_result
 * cdef __pyx_unpickle_VariantHeaderContigs__set_state(VariantHeaderContigs __pyx_result, tuple __pyx_state):
*/
    if (!(likely(PyTuple_CheckExact(__pyx_v___pyx_state))||((__pyx_v___pyx_state) == Py_None) || __Pyx_RaiseUnexpectedTypeError("tuple", __pyx_v___pyx_state))) __PYX_ERR(4, 9, __pyx_L1_error)
    __pyx_t_1 = __pyx_f_5pysam_7libcbcf___pyx_unpickle_VariantHeaderContigs__set_state(((struct __pyx_obj_5pysam_7libcbcf_VariantHeaderContigs *)__pyx_v___pyx_result), ((PyObject*)__pyx_v___pyx_state)); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 9, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

    /* "(tree fragment)":8
 *         raise __pyx_PickleError, "Incompatible checksums (0x%x vs (0x1e0584a, 0x594fd16, 0x099fb99) = (header))" % __pyx_checksum
 *     __pyx_result = VariantHeaderContigs.__new__(__pyx_type)
 *     if __pyx_state is not None:             # <<<<<<<<<<<<<<
 *         __pyx_unpickle_VariantHeaderContigs__set_state(<VariantHeaderContigs> __pyx_result, __pyx_state)
 *     return __pyx_result
*/
  }

  /* "(tree fragment)":10
 *     if __pyx_state is not None:
 *         __pyx_unpickle_VariantHeaderContigs__set_state(<VariantHeaderContigs> __pyx_result, __pyx_state)
 *     return __pyx_result             # <<<<<<<<<<<<<<
 * cdef __pyx_unpickle_VariantHeaderContigs__set_state(VariantHeaderContigs __pyx_result, tuple __pyx_state):
 *     __pyx_result.header = __pyx_state[0]
*/
  __Pyx_XDECREF(__pyx_r);
  __Pyx_INCREF(__pyx_v___pyx_result);
  __pyx_r = __pyx_v___pyx_result;
  __Pyx_TraceReturnValue(__pyx_r, 29, 0, __PYX_ERR(4, 10, __pyx_L1_error));
  goto __pyx_L0;

  /* "(tree fragment)":1
 * def __pyx_unpickle_VariantHeaderContigs(__pyx_type, long __pyx_checksum, __pyx_state):             # <<<<<<<<<<<<<<
 *     cdef object __pyx_PickleError
 *     cdef object __pyx_result
*/

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_TraceException(__pyx_lineno, 0, 0);
  #if CYTHON_USE_SYS_MONITORING
  __Pyx_TraceExceptionUnwind(0, 0);
  #else
  __Pyx_TraceReturnValue(NULL, 0, 0, __PYX_ERR(4, 1, __pyx_L1_error));
  #endif
  __Pyx_AddTraceback("pysam.libcbcf.__pyx_unpickle_VariantHeaderContigs", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v___pyx_PickleError);
  __Pyx_XDECREF(__pyx_v___pyx_result);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_PyMonitoring_ExitScope(0);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "(tree fragment)":11
 *         __pyx_unpickle_VariantHeaderContigs__set_state(<VariantHeaderContigs> __pyx_result, __pyx_state)
 *     return __pyx_result
 * cdef __pyx_unpickle_VariantHeaderContigs__set_state(VariantHeaderContigs __pyx_result, tuple __pyx_state):             # <<<<<<<<<<<<<<
 *     __pyx_result.header = __pyx_state[0]
 *     if len(__pyx_state) > 1 and hasattr(__pyx_result, '__dict__'):
*/

static PyObject *__pyx_f_5pysam_7libcbcf___pyx_unpickle_VariantHeaderContigs__set_state(struct __pyx_obj_5pysam_7libcbcf_VariantHeaderContigs *__pyx_v___pyx_result, PyObject *__pyx_v___pyx_state) {
  PyObject *__pyx_r = NULL;
  __Pyx_TraceDeclarationsFunc
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_t_2;
  Py_ssize_t __pyx_t_3;
  int __pyx_t_4;
  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_TraceFrameInit(((PyObject *)__pyx_mstate_global->__pyx_codeobj_tab[397]))
  __Pyx_RefNannySetupContext("__pyx_unpickle_VariantHeaderContigs__set_state", 0);
  __Pyx_TraceStartFunc("__pyx_unpickle_VariantHeaderContigs__set_state", __pyx_f[4], 11, 0, 0, 0, __PYX_ERR(4, 11, __pyx_L1_error));

  /* "(tree fragment)":12
 *     return __pyx_result
 * cdef __pyx_unpickle_VariantHeaderContigs__set_state(VariantHeaderContigs __pyx_result, tuple __pyx_state):
 *     __pyx_result.header = __pyx_state[0]             # <<<<<<<<<<<<<<
 *     if len(__pyx_state) > 1 and hasattr(__pyx_result, '__dict__'):
 *         __pyx_result.__dict__.update(__pyx_state[1])
*/
  if (unlikely(__pyx_v___pyx_state == Py_None)) {
    PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable");
    __PYX_ERR(4, 12, __pyx_L1_error)
  }
  __pyx_t_1 = __Pyx_GetItemInt_Tuple(__pyx_v___pyx_state, 0, long, 1, __Pyx_PyLong_From_long, 0, 0, 1, 1); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 12, __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_5pysam_7libcbcf_VariantHeader))))) __PYX_ERR(4, 12, __pyx_L1_error)
  __Pyx_GIVEREF(__pyx_t_1);
  __Pyx_GOTREF((PyObject *)__pyx_v___pyx_result->header);
  __Pyx_DECREF((PyObject *)__pyx_v___pyx_result->header);
  __pyx_v___pyx_result->header = ((struct __pyx_obj_5pysam_7libcbcf_VariantHeader *)__pyx_t_1);
  __pyx_t_1 = 0;

  /* "(tree fragment)":13
 * cdef __pyx_unpickle_VariantHeaderContigs__set_state(VariantHeaderContigs __pyx_result, tuple __pyx_state):
 *     __pyx_result.header = __pyx_state[0]
 *     if len(__pyx_state) > 1 and hasattr(__pyx_result, '__dict__'):             # <<<<<<<<<<<<<<
 *         __pyx_result.__dict__.update(__pyx_state[1])
*/
  if (unlikely(__pyx_v___pyx_state == Py_None)) {
    PyErr_SetString(PyExc_TypeError, "object of type 'NoneType' has no len()");
    __PYX_ERR(4, 13, __pyx_L1_error)
  }
  __pyx_t_3 = __Pyx_PyTuple_GET_SIZE(__pyx_v___pyx_state); if (unlikely(__pyx_t_3 == ((Py_ssize_t)-1))) __PYX_ERR(4, 13, __pyx_L1_error)
  __pyx_t_4 = (__pyx_t_3 > 1);
  if (__pyx_t_4) {
  } else {
    __pyx_t_2 = __pyx_t_4;
    goto __pyx_L4_bool_binop_done;
  }
  __pyx_t_4 = __Pyx_HasAttr(((PyObject *)__pyx_v___pyx_result), __pyx_mstate_global->__pyx_n_u_dict); if (unlikely(__pyx_t_4 == ((int)-1))) __PYX_ERR(4, 13, __pyx_L1_error)
  __pyx_t_2 = __pyx_t_4;
  __pyx_L4_bool_binop_done:;
  if (__pyx_t_2) {

    /* "(tree fragment)":14
 *     __pyx_result.header = __pyx_state[0]
 *     if len(__pyx_state) > 1 and hasattr(__pyx_result, '__dict__'):
 *         __pyx_result.__dict__.update(__pyx_state[1])             # <<<<<<<<<<<<<<
*/
    __pyx_t_6 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v___pyx_result), __pyx_mstate_global->__pyx_n_u_dict); if (unlikely(!__pyx_t_6)) __PYX_ERR(4, 14, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_6);
    __pyx_t_5 = __pyx_t_6;
    __Pyx_INCREF(__pyx_t_5);
    if (unlikely(__pyx_v___pyx_state == Py_None)) {
      PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable");
      __PYX_ERR(4, 14, __pyx_L1_error)
    }
    __pyx_t_7 = __Pyx_GetItemInt_Tuple(__pyx_v___pyx_state, 1, long, 1, __Pyx_PyLong_From_long, 0, 0, 1, 1); if (unlikely(!__pyx_t_7)) __PYX_ERR(4, 14, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_7);
    __pyx_t_8 = 0;
    {
      PyObject *__pyx_callargs[2] = {__pyx_t_5, __pyx_t_7};
      __pyx_t_1 = __Pyx_PyObject_FastCallMethod(__pyx_mstate_global->__pyx_n_u_update, __pyx_callargs+__pyx_t_8, (2-__pyx_t_8) | (1*__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_1)) __PYX_ERR(4, 14, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_1);
    }
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

    /* "(tree fragment)":13
 * cdef __pyx_unpickle_VariantHeaderContigs__set_state(VariantHeaderContigs __pyx_result, tuple __pyx_state):
 *     __pyx_result.header = __pyx_state[0]
 *     if len(__pyx_state) > 1 and hasattr(__pyx_result, '__dict__'):             # <<<<<<<<<<<<<<
 *         __pyx_result.__dict__.update(__pyx_state[1])
*/
  }

  /* "(tree fragment)":11
 *         __pyx_unpickle_VariantHeaderContigs__set_state(<VariantHeaderContigs> __pyx_result, __pyx_state)
 *     return __pyx_result
 * cdef __pyx_unpickle_VariantHeaderContigs__set_state(VariantHeaderContigs __pyx_result, tuple __pyx_state):             # <<<<<<<<<<<<<<
 *     __pyx_result.header = __pyx_state[0]
 *     if len(__pyx_state) > 1 and hasattr(__pyx_result, '__dict__'):
*/

  /* function exit code */
  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  __Pyx_TraceReturnValue(__pyx_r, 0, 0, __PYX_ERR(4, 11, __pyx_L1_error));
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_5);
  __Pyx_XDECREF(__pyx_t_6);
  __Pyx_XDECREF(__pyx_t_7);
  __Pyx_TraceException(__pyx_lineno, 0, 0);
  #if CYTHON_USE_SYS_MONITORING
  __Pyx_TraceExceptionUnwind(0, 0);
  #else
  __Pyx_TraceReturnValue(NULL, 0, 0, __PYX_ERR(4, 11, __pyx_L1_error));
  #endif
  __Pyx_AddTraceback("pysam.libcbcf.__pyx_unpickle_VariantHeaderContigs__set_state", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_PyMonitoring_ExitScope(0);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "(tree fragment)":1
 * def __pyx_unpickle_VariantHeaderSamples(__pyx_type, long __pyx_checksum, __pyx_state):             # <<<<<<<<<<<<<<
 *     cdef object __pyx_PickleError
 *     cdef object __pyx_result
*/

/* Python wrapper */
static PyObject *__pyx_pw_5pysam_7libcbcf_11__pyx_unpickle_VariantHeaderSamples(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_5pysam_7libcbcf_10__pyx_unpickle_VariantHeaderSamples, "__pyx_unpickle_VariantHeaderSamples(__pyx_type, long __pyx_checksum, __pyx_state)");
static PyMethodDef __pyx_mdef_5pysam_7libcbcf_11__pyx_unpickle_VariantHeaderSamples = {"__pyx_unpickle_VariantHeaderSamples", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_5pysam_7libcbcf_11__pyx_unpickle_VariantHeaderSamples, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_5pysam_7libcbcf_10__pyx_unpickle_VariantHeaderSamples};
static PyObject *__pyx_pw_5pysam_7libcbcf_11__pyx_unpickle_VariantHeaderSamples(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_VariantHeaderSamples (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(4, 1, __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(4, 1, __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(4, 1, __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(4, 1, __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_VariantHeaderSamples", 0) < 0) __PYX_ERR(4, 1, __pyx_L3_error)
      for (Py_ssize_t i = __pyx_nargs; i < 3; i++) {
        if (unlikely(!values[i])) { __Pyx_RaiseArgtupleInvalid("__pyx_unpickle_VariantHeaderSamples", 1, 3, 3, i); __PYX_ERR(4, 1, __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(4, 1, __pyx_L3_error)
      values[1] = __Pyx_ArgRef_FASTCALL(__pyx_args, 1);
      if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[1])) __PYX_ERR(4, 1, __pyx_L3_error)
      values[2] = __Pyx_ArgRef_FASTCALL(__pyx_args, 2);
      if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[2])) __PYX_ERR(4, 1, __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(4, 1, __pyx_L3_error)
    __pyx_v___pyx_state = values[2];
  }
  goto __pyx_L6_skip;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("__pyx_unpickle_VariantHeaderSamples", 1, 3, 3, __pyx_nargs); __PYX_ERR(4, 1, __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("pysam.libcbcf.__pyx_unpickle_VariantHeaderSamples", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_5pysam_7libcbcf_10__pyx_unpickle_VariantHeaderSamples(__pyx_self, __pyx_v___pyx_type, __pyx_v___pyx_checksum, __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_5pysam_7libcbcf_10__pyx_unpickle_VariantHeaderSamples(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v___pyx_type, long __pyx_v___pyx_checksum, PyObject *__pyx_v___pyx_state) {
  PyObject *__pyx_v___pyx_PickleError = 0;
  PyObject *__pyx_v___pyx_result = 0;
  PyObject *__pyx_r = NULL;
  __Pyx_TraceDeclarationsFunc
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_t_2;
  PyObject *__pyx_t_3 = NULL;
  size_t __pyx_t_4;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_TraceFrameInit(((PyObject *)__pyx_mstate_global->__pyx_codeobj_tab[398]))
  __Pyx_RefNannySetupContext("__pyx_unpickle_VariantHeaderSamples", 0);
  __Pyx_TraceStartFunc("__pyx_unpickle_VariantHeaderSamples", __pyx_f[4], 1, 0, 0, 0, __PYX_ERR(4, 1, __pyx_L1_error));

  /* "(tree fragment)":4
 *     cdef object __pyx_PickleError
 *     cdef object __pyx_result
 *     if __pyx_checksum not in (0x1e0584a, 0x594fd16, 0x099fb99):             # <<<<<<<<<<<<<<
 *         from pickle import PickleError as __pyx_PickleError
 *         raise __pyx_PickleError, "Incompatible checksums (0x%x vs (0x1e0584a, 0x594fd16, 0x099fb99) = (header))" % __pyx_checksum
*/
  __pyx_t_1 = __Pyx_PyLong_From_long(__pyx_v___pyx_checksum); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 4, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_2 = (__Pyx_PySequence_ContainsTF(__pyx_t_1, __pyx_mstate_global->__pyx_tuple[1], Py_NE)); if (unlikely((__pyx_t_2 < 0))) __PYX_ERR(4, 4, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  if (__pyx_t_2) {

    /* "(tree fragment)":5
 *     cdef object __pyx_result
 *     if __pyx_checksum not in (0x1e0584a, 0x594fd16, 0x099fb99):
 *         from pickle import PickleError as __pyx_PickleError             # <<<<<<<<<<<<<<
 *         raise __pyx_PickleError, "Incompatible checksums (0x%x vs (0x1e0584a, 0x594fd16, 0x099fb99) = (header))" % __pyx_checksum
 *     __pyx_result = VariantHeaderSamples.__new__(__pyx_type)
*/
    __pyx_t_1 = PyList_New(1); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 5, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_INCREF(__pyx_mstate_global->__pyx_n_u_PickleError);
    __Pyx_GIVEREF(__pyx_mstate_global->__pyx_n_u_PickleError);
    if (__Pyx_PyList_SET_ITEM(__pyx_t_1, 0, __pyx_mstate_global->__pyx_n_u_PickleError) != (0)) __PYX_ERR(4, 5, __pyx_L1_error);
    __pyx_t_3 = __Pyx_Import(__pyx_mstate_global->__pyx_n_u_pickle, __pyx_t_1, 0); if (unlikely(!__pyx_t_3)) __PYX_ERR(4, 5, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    __pyx_t_1 = __Pyx_ImportFrom(__pyx_t_3, __pyx_mstate_global->__pyx_n_u_PickleError); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 5, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_INCREF(__pyx_t_1);
    __pyx_v___pyx_PickleError = __pyx_t_1;
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;

    /* "(tree fragment)":6
 *     if __pyx_checksum not in (0x1e0584a, 0x594fd16, 0x099fb99):
 *         from pickle import PickleError as __pyx_PickleError
 *         raise __pyx_PickleError, "Incompatible checksums (0x%x vs (0x1e0584a, 0x594fd16, 0x099fb99) = (header))" % __pyx_checksum             # <<<<<<<<<<<<<<
 *     __pyx_result = VariantHeaderSamples.__new__(__pyx_type)
 *     if __pyx_state is not None:
*/
    __pyx_t_3 = __Pyx_PyLong_From_long(__pyx_v___pyx_checksum); if (unlikely(!__pyx_t_3)) __PYX_ERR(4, 6, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __pyx_t_1 = PyUnicode_Format(__pyx_mstate_global->__pyx_kp_u_Incompatible_checksums_0x_x_vs_0, __pyx_t_3); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 6, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    __Pyx_Raise(__pyx_v___pyx_PickleError, __pyx_t_1, 0, 0);
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    __PYX_ERR(4, 6, __pyx_L1_error)

    /* "(tree fragment)":4
 *     cdef object __pyx_PickleError
 *     cdef object __pyx_result
 *     if __pyx_checksum not in (0x1e0584a, 0x594fd16, 0x099fb99):             # <<<<<<<<<<<<<<
 *         from pickle import PickleError as __pyx_PickleError
 *         raise __pyx_PickleError, "Incompatible checksums (0x%x vs (0x1e0584a, 0x594fd16, 0x099fb99) = (header))" % __pyx_checksum
*/
  }

  /* "(tree fragment)":7
 *         from pickle import PickleError as __pyx_PickleError
 *         raise __pyx_PickleError, "Incompatible checksums (0x%x vs (0x1e0584a, 0x594fd16, 0x099fb99) = (header))" % __pyx_checksum
 *     __pyx_result = VariantHeaderSamples.__new__(__pyx_type)             # <<<<<<<<<<<<<<
 *     if __pyx_state is not None:
 *         __pyx_unpickle_VariantHeaderSamples__set_state(<VariantHeaderSamples> __pyx_result, __pyx_state)
*/
  __pyx_t_3 = ((PyObject *)__pyx_mstate_global->__pyx_ptype_5pysam_7libcbcf_VariantHeaderSamples);
  __Pyx_INCREF(__pyx_t_3);
  __pyx_t_4 = 0;
  {
    PyObject *__pyx_callargs[2] = {__pyx_t_3, __pyx_v___pyx_type};
    __pyx_t_1 = __Pyx_PyObject_FastCallMethod(__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_1)) __PYX_ERR(4, 7, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
  }
  __pyx_v___pyx_result = __pyx_t_1;
  __pyx_t_1 = 0;

  /* "(tree fragment)":8
 *         raise __pyx_PickleError, "Incompatible checksums (0x%x vs (0x1e0584a, 0x594fd16, 0x099fb99) = (header))" % __pyx_checksum
 *     __pyx_result = VariantHeaderSamples.__new__(__pyx_type)
 *     if __pyx_state is not None:             # <<<<<<<<<<<<<<
 *         __pyx_unpickle_VariantHeaderSamples__set_state(<VariantHeaderSamples> __pyx_result, __pyx_state)
 *     return __pyx_result
*/
  __pyx_t_2 = (__pyx_v___pyx_state != Py_None);
  if (__pyx_t_2) {

    /* "(tree fragment)":9
 *     __pyx_result = VariantHeaderSamples.__new__(__pyx_type)
 *     if __pyx_state is not None:
 *         __pyx_unpickle_VariantHeaderSamples__set_state(<VariantHeaderSamples> __pyx_result, __pyx_state)             # <<<<<<<<<<<<<<
 *     return __pyx_result
 * cdef __pyx_unpickle_VariantHeaderSamples__set_state(VariantHeaderSamples __pyx_result, tuple __pyx_state):
*/
    if (!(likely(PyTuple_CheckExact(__pyx_v___pyx_state))||((__pyx_v___pyx_state) == Py_None) || __Pyx_RaiseUnexpectedTypeError("tuple", __pyx_v___pyx_state))) __PYX_ERR(4, 9, __pyx_L1_error)
    __pyx_t_1 = __pyx_f_5pysam_7libcbcf___pyx_unpickle_VariantHeaderSamples__set_state(((struct __pyx_obj_5pysam_7libcbcf_VariantHeaderSamples *)__pyx_v___pyx_result), ((PyObject*)__pyx_v___pyx_state)); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 9, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

    /* "(tree fragment)":8
 *         raise __pyx_PickleError, "Incompatible checksums (0x%x vs (0x1e0584a, 0x594fd16, 0x099fb99) = (header))" % __pyx_checksum
 *     __pyx_result = VariantHeaderSamples.__new__(__pyx_type)
 *     if __pyx_state is not None:             # <<<<<<<<<<<<<<
 *         __pyx_unpickle_VariantHeaderSamples__set_state(<VariantHeaderSamples> __pyx_result, __pyx_state)
 *     return __pyx_result
*/
  }

  /* "(tree fragment)":10
 *     if __pyx_state is not None:
 *         __pyx_unpickle_VariantHeaderSamples__set_state(<VariantHeaderSamples> __pyx_result, __pyx_state)
 *     return __pyx_result             # <<<<<<<<<<<<<<
 * cdef __pyx_unpickle_VariantHeaderSamples__set_state(VariantHeaderSamples __pyx_result, tuple __pyx_state):
 *     __pyx_result.header = __pyx_state[0]
*/
  __Pyx_XDECREF(__pyx_r);
  __Pyx_INCREF(__pyx_v___pyx_result);
  __pyx_r = __pyx_v___pyx_result;
  __Pyx_TraceReturnValue(__pyx_r, 29, 0, __PYX_ERR(4, 10, __pyx_L1_error));
  goto __pyx_L0;

  /* "(tree fragment)":1
 * def __pyx_unpickle_VariantHeaderSamples(__pyx_type, long __pyx_checksum, __pyx_state):             # <<<<<<<<<<<<<<
 *     cdef object __pyx_PickleError
 *     cdef object __pyx_result
*/

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_TraceException(__pyx_lineno, 0, 0);
  #if CYTHON_USE_SYS_MONITORING
  __Pyx_TraceExceptionUnwind(0, 0);
  #else
  __Pyx_TraceReturnValue(NULL, 0, 0, __PYX_ERR(4, 1, __pyx_L1_error));
  #endif
  __Pyx_AddTraceback("pysam.libcbcf.__pyx_unpickle_VariantHeaderSamples", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v___pyx_PickleError);
  __Pyx_XDECREF(__pyx_v___pyx_result);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_PyMonitoring_ExitScope(0);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "(tree fragment)":11
 *         __pyx_unpickle_VariantHeaderSamples__set_state(<VariantHeaderSamples> __pyx_result, __pyx_state)
 *     return __pyx_result
 * cdef __pyx_unpickle_VariantHeaderSamples__set_state(VariantHeaderSamples __pyx_result, tuple __pyx_state):             # <<<<<<<<<<<<<<
 *     __pyx_result.header = __pyx_state[0]
 *     if len(__pyx_state) > 1 and hasattr(__pyx_result, '__dict__'):
*/

static PyObject *__pyx_f_5pysam_7libcbcf___pyx_unpickle_VariantHeaderSamples__set_state(struct __pyx_obj_5pysam_7libcbcf_VariantHeaderSamples *__pyx_v___pyx_result, PyObject *__pyx_v___pyx_state) {
  PyObject *__pyx_r = NULL;
  __Pyx_TraceDeclarationsFunc
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_t_2;
  Py_ssize_t __pyx_t_3;
  int __pyx_t_4;
  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_TraceFrameInit(((PyObject *)__pyx_mstate_global->__pyx_codeobj_tab[399]))
  __Pyx_RefNannySetupContext("__pyx_unpickle_VariantHeaderSamples__set_state", 0);
  __Pyx_TraceStartFunc("__pyx_unpickle_VariantHeaderSamples__set_state", __pyx_f[4], 11, 0, 0, 0, __PYX_ERR(4, 11, __pyx_L1_error));

  /* "(tree fragment)":12
 *     return __pyx_result
 * cdef __pyx_unpickle_VariantHeaderSamples__set_state(VariantHeaderSamples __pyx_result, tuple __pyx_state):
 *     __pyx_result.header = __pyx_state[0]             # <<<<<<<<<<<<<<
 *     if len(__pyx_state) > 1 and hasattr(__pyx_result, '__dict__'):
 *         __pyx_result.__dict__.update(__pyx_state[1])
*/
  if (unlikely(__pyx_v___pyx_state == Py_None)) {
    PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable");
    __PYX_ERR(4, 12, __pyx_L1_error)
  }
  __pyx_t_1 = __Pyx_GetItemInt_Tuple(__pyx_v___pyx_state, 0, long, 1, __Pyx_PyLong_From_long, 0, 0, 1, 1); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 12, __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_5pysam_7libcbcf_VariantHeader))))) __PYX_ERR(4, 12, __pyx_L1_error)
  __Pyx_GIVEREF(__pyx_t_1);
  __Pyx_GOTREF((PyObject *)__pyx_v___pyx_result->header);
  __Pyx_DECREF((PyObject *)__pyx_v___pyx_result->header);
  __pyx_v___pyx_result->header = ((struct __pyx_obj_5pysam_7libcbcf_VariantHeader *)__pyx_t_1);
  __pyx_t_1 = 0;

  /* "(tree fragment)":13
 * cdef __pyx_unpickle_VariantHeaderSamples__set_state(VariantHeaderSamples __pyx_result, tuple __pyx_state):
 *     __pyx_result.header = __pyx_state[0]
 *     if len(__pyx_state) > 1 and hasattr(__pyx_result, '__dict__'):             # <<<<<<<<<<<<<<
 *         __pyx_result.__dict__.update(__pyx_state[1])
*/
  if (unlikely(__pyx_v___pyx_state == Py_None)) {
    PyErr_SetString(PyExc_TypeError, "object of type 'NoneType' has no len()");
    __PYX_ERR(4, 13, __pyx_L1_error)
  }
  __pyx_t_3 = __Pyx_PyTuple_GET_SIZE(__pyx_v___pyx_state); if (unlikely(__pyx_t_3 == ((Py_ssize_t)-1))) __PYX_ERR(4, 13, __pyx_L1_error)
  __pyx_t_4 = (__pyx_t_3 > 1);
  if (__pyx_t_4) {
  } else {
    __pyx_t_2 = __pyx_t_4;
    goto __pyx_L4_bool_binop_done;
  }
  __pyx_t_4 = __Pyx_HasAttr(((PyObject *)__pyx_v___pyx_result), __pyx_mstate_global->__pyx_n_u_dict); if (unlikely(__pyx_t_4 == ((int)-1))) __PYX_ERR(4, 13, __pyx_L1_error)
  __pyx_t_2 = __pyx_t_4;
  __pyx_L4_bool_binop_done:;
  if (__pyx_t_2) {

    /* "(tree fragment)":14
 *     __pyx_result.header = __pyx_state[0]
 *     if len(__pyx_state) > 1 and hasattr(__pyx_result, '__dict__'):
 *         __pyx_result.__dict__.update(__pyx_state[1])             # <<<<<<<<<<<<<<
*/
    __pyx_t_6 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v___pyx_result), __pyx_mstate_global->__pyx_n_u_dict); if (unlikely(!__pyx_t_6)) __PYX_ERR(4, 14, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_6);
    __pyx_t_5 = __pyx_t_6;
    __Pyx_INCREF(__pyx_t_5);
    if (unlikely(__pyx_v___pyx_state == Py_None)) {
      PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable");
      __PYX_ERR(4, 14, __pyx_L1_error)
    }
    __pyx_t_7 = __Pyx_GetItemInt_Tuple(__pyx_v___pyx_state, 1, long, 1, __Pyx_PyLong_From_long, 0, 0, 1, 1); if (unlikely(!__pyx_t_7)) __PYX_ERR(4, 14, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_7);
    __pyx_t_8 = 0;
    {
      PyObject *__pyx_callargs[2] = {__pyx_t_5, __pyx_t_7};
      __pyx_t_1 = __Pyx_PyObject_FastCallMethod(__pyx_mstate_global->__pyx_n_u_update, __pyx_callargs+__pyx_t_8, (2-__pyx_t_8) | (1*__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_1)) __PYX_ERR(4, 14, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_1);
    }
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

    /* "(tree fragment)":13
 * cdef __pyx_unpickle_VariantHeaderSamples__set_state(VariantHeaderSamples __pyx_result, tuple __pyx_state):
 *     __pyx_result.header = __pyx_state[0]
 *     if len(__pyx_state) > 1 and hasattr(__pyx_result, '__dict__'):             # <<<<<<<<<<<<<<
 *         __pyx_result.__dict__.update(__pyx_state[1])
*/
  }

  /* "(tree fragment)":11
 *         __pyx_unpickle_VariantHeaderSamples__set_state(<VariantHeaderSamples> __pyx_result, __pyx_state)
 *     return __pyx_result
 * cdef __pyx_unpickle_VariantHeaderSamples__set_state(VariantHeaderSamples __pyx_result, tuple __pyx_state):             # <<<<<<<<<<<<<<
 *     __pyx_result.header = __pyx_state[0]
 *     if len(__pyx_state) > 1 and hasattr(__pyx_result, '__dict__'):
*/

  /* function exit code */
  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  __Pyx_TraceReturnValue(__pyx_r, 0, 0, __PYX_ERR(4, 11, __pyx_L1_error));
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_5);
  __Pyx_XDECREF(__pyx_t_6);
  __Pyx_XDECREF(__pyx_t_7);
  __Pyx_TraceException(__pyx_lineno, 0, 0);
  #if CYTHON_USE_SYS_MONITORING
  __Pyx_TraceExceptionUnwind(0, 0);
  #else
  __Pyx_TraceReturnValue(NULL, 0, 0, __PYX_ERR(4, 11, __pyx_L1_error));
  #endif
  __Pyx_AddTraceback("pysam.libcbcf.__pyx_unpickle_VariantHeaderSamples__set_state", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_PyMonitoring_ExitScope(0);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "(tree fragment)":1
 * def __pyx_unpickle_VariantRecordFilter(__pyx_type, long __pyx_checksum, __pyx_state):             # <<<<<<<<<<<<<<
 *     cdef object __pyx_PickleError
 *     cdef object __pyx_result
*/

/* Python wrapper */
static PyObject *__pyx_pw_5pysam_7libcbcf_13__pyx_unpickle_VariantRecordFilter(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_5pysam_7libcbcf_12__pyx_unpickle_VariantRecordFilter, "__pyx_unpickle_VariantRecordFilter(__pyx_type, long __pyx_checksum, __pyx_state)");
static PyMethodDef __pyx_mdef_5pysam_7libcbcf_13__pyx_unpickle_VariantRecordFilter = {"__pyx_unpickle_VariantRecordFilter", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_5pysam_7libcbcf_13__pyx_unpickle_VariantRecordFilter, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_5pysam_7libcbcf_12__pyx_unpickle_VariantRecordFilter};
static PyObject *__pyx_pw_5pysam_7libcbcf_13__pyx_unpickle_VariantRecordFilter(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_VariantRecordFilter (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(4, 1, __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(4, 1, __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(4, 1, __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(4, 1, __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_VariantRecordFilter", 0) < 0) __PYX_ERR(4, 1, __pyx_L3_error)
      for (Py_ssize_t i = __pyx_nargs; i < 3; i++) {
        if (unlikely(!values[i])) { __Pyx_RaiseArgtupleInvalid("__pyx_unpickle_VariantRecordFilter", 1, 3, 3, i); __PYX_ERR(4, 1, __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(4, 1, __pyx_L3_error)
      values[1] = __Pyx_ArgRef_FASTCALL(__pyx_args, 1);
      if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[1])) __PYX_ERR(4, 1, __pyx_L3_error)
      values[2] = __Pyx_ArgRef_FASTCALL(__pyx_args, 2);
      if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[2])) __PYX_ERR(4, 1, __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(4, 1, __pyx_L3_error)
    __pyx_v___pyx_state = values[2];
  }
  goto __pyx_L6_skip;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("__pyx_unpickle_VariantRecordFilter", 1, 3, 3, __pyx_nargs); __PYX_ERR(4, 1, __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("pysam.libcbcf.__pyx_unpickle_VariantRecordFilter", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_5pysam_7libcbcf_12__pyx_unpickle_VariantRecordFilter(__pyx_self, __pyx_v___pyx_type, __pyx_v___pyx_checksum, __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_5pysam_7libcbcf_12__pyx_unpickle_VariantRecordFilter(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v___pyx_type, long __pyx_v___pyx_checksum, PyObject *__pyx_v___pyx_state) {
  PyObject *__pyx_v___pyx_PickleError = 0;
  PyObject *__pyx_v___pyx_result = 0;
  PyObject *__pyx_r = NULL;
  __Pyx_TraceDeclarationsFunc
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_t_2;
  PyObject *__pyx_t_3 = NULL;
  size_t __pyx_t_4;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_TraceFrameInit(((PyObject *)__pyx_mstate_global->__pyx_codeobj_tab[400]))
  __Pyx_RefNannySetupContext("__pyx_unpickle_VariantRecordFilter", 0);
  __Pyx_TraceStartFunc("__pyx_unpickle_VariantRecordFilter", __pyx_f[4], 1, 0, 0, 0, __PYX_ERR(4, 1, __pyx_L1_error));

  /* "(tree fragment)":4
 *     cdef object __pyx_PickleError
 *     cdef object __pyx_result
 *     if __pyx_checksum not in (0x70ce871, 0x275a700, 0xde17f0f):             # <<<<<<<<<<<<<<
 *         from pickle import PickleError as __pyx_PickleError
 *         raise __pyx_PickleError, "Incompatible checksums (0x%x vs (0x70ce871, 0x275a700, 0xde17f0f) = (record))" % __pyx_checksum
*/
  __pyx_t_1 = __Pyx_PyLong_From_long(__pyx_v___pyx_checksum); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 4, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_2 = (__Pyx_PySequence_ContainsTF(__pyx_t_1, __pyx_mstate_global->__pyx_tuple[5], Py_NE)); if (unlikely((__pyx_t_2 < 0))) __PYX_ERR(4, 4, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  if (__pyx_t_2) {

    /* "(tree fragment)":5
 *     cdef object __pyx_result
 *     if __pyx_checksum not in (0x70ce871, 0x275a700, 0xde17f0f):
 *         from pickle import PickleError as __pyx_PickleError             # <<<<<<<<<<<<<<
 *         raise __pyx_PickleError, "Incompatible checksums (0x%x vs (0x70ce871, 0x275a700, 0xde17f0f) = (record))" % __pyx_checksum
 *     __pyx_result = VariantRecordFilter.__new__(__pyx_type)
*/
    __pyx_t_1 = PyList_New(1); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 5, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_INCREF(__pyx_mstate_global->__pyx_n_u_PickleError);
    __Pyx_GIVEREF(__pyx_mstate_global->__pyx_n_u_PickleError);
    if (__Pyx_PyList_SET_ITEM(__pyx_t_1, 0, __pyx_mstate_global->__pyx_n_u_PickleError) != (0)) __PYX_ERR(4, 5, __pyx_L1_error);
    __pyx_t_3 = __Pyx_Import(__pyx_mstate_global->__pyx_n_u_pickle, __pyx_t_1, 0); if (unlikely(!__pyx_t_3)) __PYX_ERR(4, 5, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    __pyx_t_1 = __Pyx_ImportFrom(__pyx_t_3, __pyx_mstate_global->__pyx_n_u_PickleError); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 5, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_INCREF(__pyx_t_1);
    __pyx_v___pyx_PickleError = __pyx_t_1;
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;

    /* "(tree fragment)":6
 *     if __pyx_checksum not in (0x70ce871, 0x275a700, 0xde17f0f):
 *         from pickle import PickleError as __pyx_PickleError
 *         raise __pyx_PickleError, "Incompatible checksums (0x%x vs (0x70ce871, 0x275a700, 0xde17f0f) = (record))" % __pyx_checksum             # <<<<<<<<<<<<<<
 *     __pyx_result = VariantRecordFilter.__new__(__pyx_type)
 *     if __pyx_state is not None:
*/
    __pyx_t_3 = __Pyx_PyLong_From_long(__pyx_v___pyx_checksum); if (unlikely(!__pyx_t_3)) __PYX_ERR(4, 6, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __pyx_t_1 = PyUnicode_Format(__pyx_mstate_global->__pyx_kp_u_Incompatible_checksums_0x_x_vs_0_5, __pyx_t_3); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 6, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    __Pyx_Raise(__pyx_v___pyx_PickleError, __pyx_t_1, 0, 0);
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    __PYX_ERR(4, 6, __pyx_L1_error)

    /* "(tree fragment)":4
 *     cdef object __pyx_PickleError
 *     cdef object __pyx_result
 *     if __pyx_checksum not in (0x70ce871, 0x275a700, 0xde17f0f):             # <<<<<<<<<<<<<<
 *         from pickle import PickleError as __pyx_PickleError
 *         raise __pyx_PickleError, "Incompatible checksums (0x%x vs (0x70ce871, 0x275a700, 0xde17f0f) = (record))" % __pyx_checksum
*/
  }

  /* "(tree fragment)":7
 *         from pickle import PickleError as __pyx_PickleError
 *         raise __pyx_PickleError, "Incompatible checksums (0x%x vs (0x70ce871, 0x275a700, 0xde17f0f) = (record))" % __pyx_checksum
 *     __pyx_result = VariantRecordFilter.__new__(__pyx_type)             # <<<<<<<<<<<<<<
 *     if __pyx_state is not None:
 *         __pyx_unpickle_VariantRecordFilter__set_state(<VariantRecordFilter> __pyx_result, __pyx_state)
*/
  __pyx_t_3 = ((PyObject *)__pyx_mstate_global->__pyx_ptype_5pysam_7libcbcf_VariantRecordFilter);
  __Pyx_INCREF(__pyx_t_3);
  __pyx_t_4 = 0;
  {
    PyObject *__pyx_callargs[2] = {__pyx_t_3, __pyx_v___pyx_type};
    __pyx_t_1 = __Pyx_PyObject_FastCallMethod(__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_1)) __PYX_ERR(4, 7, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
  }
  __pyx_v___pyx_result = __pyx_t_1;
  __pyx_t_1 = 0;

  /* "(tree fragment)":8
 *         raise __pyx_PickleError, "Incompatible checksums (0x%x vs (0x70ce871, 0x275a700, 0xde17f0f) = (record))" % __pyx_checksum
 *     __pyx_result = VariantRecordFilter.__new__(__pyx_type)
 *     if __pyx_state is not None:             # <<<<<<<<<<<<<<
 *         __pyx_unpickle_VariantRecordFilter__set_state(<VariantRecordFilter> __pyx_result, __pyx_state)
 *     return __pyx_result
*/
  __pyx_t_2 = (__pyx_v___pyx_state != Py_None);
  if (__pyx_t_2) {

    /* "(tree fragment)":9
 *     __pyx_result = VariantRecordFilter.__new__(__pyx_type)
 *     if __pyx_state is not None:
 *         __pyx_unpickle_VariantRecordFilter__set_state(<VariantRecordFilter> __pyx_result, __pyx_state)             # <<<<<<<<<<<<<<
 *     return __pyx_result
 * cdef __pyx_unpickle_VariantRecordFilter__set_state(VariantRecordFilter __pyx_result, tuple __pyx_state):
*/
    if (!(likely(PyTuple_CheckExact(__pyx_v___pyx_state))||((__pyx_v___pyx_state) == Py_None) || __Pyx_RaiseUnexpectedTypeError("tuple", __pyx_v___pyx_state))) __PYX_ERR(4, 9, __pyx_L1_error)
    __pyx_t_1 = __pyx_f_5pysam_7libcbcf___pyx_unpickle_VariantRecordFilter__set_state(((struct __pyx_obj_5pysam_7libcbcf_VariantRecordFilter *)__pyx_v___pyx_result), ((PyObject*)__pyx_v___pyx_state)); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 9, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

    /* "(tree fragment)":8
 *         raise __pyx_PickleError, "Incompatible checksums (0x%x vs (0x70ce871, 0x275a700, 0xde17f0f) = (record))" % __pyx_checksum
 *     __pyx_result = VariantRecordFilter.__new__(__pyx_type)
 *     if __pyx_state is not None:             # <<<<<<<<<<<<<<
 *         __pyx_unpickle_VariantRecordFilter__set_state(<VariantRecordFilter> __pyx_result, __pyx_state)
 *     return __pyx_result
*/
  }

  /* "(tree fragment)":10
 *     if __pyx_state is not None:
 *         __pyx_unpickle_VariantRecordFilter__set_state(<VariantRecordFilter> __pyx_result, __pyx_state)
 *     return __pyx_result             # <<<<<<<<<<<<<<
 * cdef __pyx_unpickle_VariantRecordFilter__set_state(VariantRecordFilter __pyx_result, tuple __pyx_state):
 *     __pyx_result.record = __pyx_state[0]
*/
  __Pyx_XDECREF(__pyx_r);
  __Pyx_INCREF(__pyx_v___pyx_result);
  __pyx_r = __pyx_v___pyx_result;
  __Pyx_TraceReturnValue(__pyx_r, 29, 0, __PYX_ERR(4, 10, __pyx_L1_error));
  goto __pyx_L0;

  /* "(tree fragment)":1
 * def __pyx_unpickle_VariantRecordFilter(__pyx_type, long __pyx_checksum, __pyx_state):             # <<<<<<<<<<<<<<
 *     cdef object __pyx_PickleError
 *     cdef object __pyx_result
*/

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_TraceException(__pyx_lineno, 0, 0);
  #if CYTHON_USE_SYS_MONITORING
  __Pyx_TraceExceptionUnwind(0, 0);
  #else
  __Pyx_TraceReturnValue(NULL, 0, 0, __PYX_ERR(4, 1, __pyx_L1_error));
  #endif
  __Pyx_AddTraceback("pysam.libcbcf.__pyx_unpickle_VariantRecordFilter", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v___pyx_PickleError);
  __Pyx_XDECREF(__pyx_v___pyx_result);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_PyMonitoring_ExitScope(0);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "(tree fragment)":11
 *         __pyx_unpickle_VariantRecordFilter__set_state(<VariantRecordFilter> __pyx_result, __pyx_state)
 *     return __pyx_result
 * cdef __pyx_unpickle_VariantRecordFilter__set_state(VariantRecordFilter __pyx_result, tuple __pyx_state):             # <<<<<<<<<<<<<<
 *     __pyx_result.record = __pyx_state[0]
 *     if len(__pyx_state) > 1 and hasattr(__pyx_result, '__dict__'):
*/

static PyObject *__pyx_f_5pysam_7libcbcf___pyx_unpickle_VariantRecordFilter__set_state(struct __pyx_obj_5pysam_7libcbcf_VariantRecordFilter *__pyx_v___pyx_result, PyObject *__pyx_v___pyx_state) {
  PyObject *__pyx_r = NULL;
  __Pyx_TraceDeclarationsFunc
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_t_2;
  Py_ssize_t __pyx_t_3;
  int __pyx_t_4;
  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_TraceFrameInit(((PyObject *)__pyx_mstate_global->__pyx_codeobj_tab[401]))
  __Pyx_RefNannySetupContext("__pyx_unpickle_VariantRecordFilter__set_state", 0);
  __Pyx_TraceStartFunc("__pyx_unpickle_VariantRecordFilter__set_state", __pyx_f[4], 11, 0, 0, 0, __PYX_ERR(4, 11, __pyx_L1_error));

  /* "(tree fragment)":12
 *     return __pyx_result
 * cdef __pyx_unpickle_VariantRecordFilter__set_state(VariantRecordFilter __pyx_result, tuple __pyx_state):
 *     __pyx_result.record = __pyx_state[0]             # <<<<<<<<<<<<<<
 *     if len(__pyx_state) > 1 and hasattr(__pyx_result, '__dict__'):
 *         __pyx_result.__dict__.update(__pyx_state[1])
*/
  if (unlikely(__pyx_v___pyx_state == Py_None)) {
    PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable");
    __PYX_ERR(4, 12, __pyx_L1_error)
  }
  __pyx_t_1 = __Pyx_GetItemInt_Tuple(__pyx_v___pyx_state, 0, long, 1, __Pyx_PyLong_From_long, 0, 0, 1, 1); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 12, __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_5pysam_7libcbcf_VariantRecord))))) __PYX_ERR(4, 12, __pyx_L1_error)
  __Pyx_GIVEREF(__pyx_t_1);
  __Pyx_GOTREF((PyObject *)__pyx_v___pyx_result->record);
  __Pyx_DECREF((PyObject *)__pyx_v___pyx_result->record);
  __pyx_v___pyx_result->record = ((struct __pyx_obj_5pysam_7libcbcf_VariantRecord *)__pyx_t_1);
  __pyx_t_1 = 0;

  /* "(tree fragment)":13
 * cdef __pyx_unpickle_VariantRecordFilter__set_state(VariantRecordFilter __pyx_result, tuple __pyx_state):
 *     __pyx_result.record = __pyx_state[0]
 *     if len(__pyx_state) > 1 and hasattr(__pyx_result, '__dict__'):             # <<<<<<<<<<<<<<
 *         __pyx_result.__dict__.update(__pyx_state[1])
*/
  if (unlikely(__pyx_v___pyx_state == Py_None)) {
    PyErr_SetString(PyExc_TypeError, "object of type 'NoneType' has no len()");
    __PYX_ERR(4, 13, __pyx_L1_error)
  }
  __pyx_t_3 = __Pyx_PyTuple_GET_SIZE(__pyx_v___pyx_state); if (unlikely(__pyx_t_3 == ((Py_ssize_t)-1))) __PYX_ERR(4, 13, __pyx_L1_error)
  __pyx_t_4 = (__pyx_t_3 > 1);
  if (__pyx_t_4) {
  } else {
    __pyx_t_2 = __pyx_t_4;
    goto __pyx_L4_bool_binop_done;
  }
  __pyx_t_4 = __Pyx_HasAttr(((PyObject *)__pyx_v___pyx_result), __pyx_mstate_global->__pyx_n_u_dict); if (unlikely(__pyx_t_4 == ((int)-1))) __PYX_ERR(4, 13, __pyx_L1_error)
  __pyx_t_2 = __pyx_t_4;
  __pyx_L4_bool_binop_done:;
  if (__pyx_t_2) {

    /* "(tree fragment)":14
 *     __pyx_result.record = __pyx_state[0]
 *     if len(__pyx_state) > 1 and hasattr(__pyx_result, '__dict__'):
 *         __pyx_result.__dict__.update(__pyx_state[1])             # <<<<<<<<<<<<<<
*/
    __pyx_t_6 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v___pyx_result), __pyx_mstate_global->__pyx_n_u_dict); if (unlikely(!__pyx_t_6)) __PYX_ERR(4, 14, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_6);
    __pyx_t_5 = __pyx_t_6;
    __Pyx_INCREF(__pyx_t_5);
    if (unlikely(__pyx_v___pyx_state == Py_None)) {
      PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable");
      __PYX_ERR(4, 14, __pyx_L1_error)
    }
    __pyx_t_7 = __Pyx_GetItemInt_Tuple(__pyx_v___pyx_state, 1, long, 1, __Pyx_PyLong_From_long, 0, 0, 1, 1); if (unlikely(!__pyx_t_7)) __PYX_ERR(4, 14, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_7);
    __pyx_t_8 = 0;
    {
      PyObject *__pyx_callargs[2] = {__pyx_t_5, __pyx_t_7};
      __pyx_t_1 = __Pyx_PyObject_FastCallMethod(__pyx_mstate_global->__pyx_n_u_update, __pyx_callargs+__pyx_t_8, (2-__pyx_t_8) | (1*__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_1)) __PYX_ERR(4, 14, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_1);
    }
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

    /* "(tree fragment)":13
 * cdef __pyx_unpickle_VariantRecordFilter__set_state(VariantRecordFilter __pyx_result, tuple __pyx_state):
 *     __pyx_result.record = __pyx_state[0]
 *     if len(__pyx_state) > 1 and hasattr(__pyx_result, '__dict__'):             # <<<<<<<<<<<<<<
 *         __pyx_result.__dict__.update(__pyx_state[1])
*/
  }

  /* "(tree fragment)":11
 *         __pyx_unpickle_VariantRecordFilter__set_state(<VariantRecordFilter> __pyx_result, __pyx_state)
 *     return __pyx_result
 * cdef __pyx_unpickle_VariantRecordFilter__set_state(VariantRecordFilter __pyx_result, tuple __pyx_state):             # <<<<<<<<<<<<<<
 *     __pyx_result.record = __pyx_state[0]
 *     if len(__pyx_state) > 1 and hasattr(__pyx_result, '__dict__'):
*/

  /* function exit code */
  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  __Pyx_TraceReturnValue(__pyx_r, 0, 0, __PYX_ERR(4, 11, __pyx_L1_error));
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_5);
  __Pyx_XDECREF(__pyx_t_6);
  __Pyx_XDECREF(__pyx_t_7);
  __Pyx_TraceException(__pyx_lineno, 0, 0);
  #if CYTHON_USE_SYS_MONITORING
  __Pyx_TraceExceptionUnwind(0, 0);
  #else
  __Pyx_TraceReturnValue(NULL, 0, 0, __PYX_ERR(4, 11, __pyx_L1_error));
  #endif
  __Pyx_AddTraceback("pysam.libcbcf.__pyx_unpickle_VariantRecordFilter__set_state", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_PyMonitoring_ExitScope(0);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "(tree fragment)":1
 * def __pyx_unpickle_VariantRecordFormat(__pyx_type, long __pyx_checksum, __pyx_state):             # <<<<<<<<<<<<<<
 *     cdef object __pyx_PickleError
 *     cdef object __pyx_result
*/

/* Python wrapper */
static PyObject *__pyx_pw_5pysam_7libcbcf_15__pyx_unpickle_VariantRecordFormat(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_5pysam_7libcbcf_14__pyx_unpickle_VariantRecordFormat, "__pyx_unpickle_VariantRecordFormat(__pyx_type, long __pyx_checksum, __pyx_state)");
static PyMethodDef __pyx_mdef_5pysam_7libcbcf_15__pyx_unpickle_VariantRecordFormat = {"__pyx_unpickle_VariantRecordFormat", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_5pysam_7libcbcf_15__pyx_unpickle_VariantRecordFormat, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_5pysam_7libcbcf_14__pyx_unpickle_VariantRecordFormat};
static PyObject *__pyx_pw_5pysam_7libcbcf_15__pyx_unpickle_VariantRecordFormat(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_VariantRecordFormat (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(4, 1, __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(4, 1, __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(4, 1, __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(4, 1, __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_VariantRecordFormat", 0) < 0) __PYX_ERR(4, 1, __pyx_L3_error)
      for (Py_ssize_t i = __pyx_nargs; i < 3; i++) {
        if (unlikely(!values[i])) { __Pyx_RaiseArgtupleInvalid("__pyx_unpickle_VariantRecordFormat", 1, 3, 3, i); __PYX_ERR(4, 1, __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(4, 1, __pyx_L3_error)
      values[1] = __Pyx_ArgRef_FASTCALL(__pyx_args, 1);
      if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[1])) __PYX_ERR(4, 1, __pyx_L3_error)
      values[2] = __Pyx_ArgRef_FASTCALL(__pyx_args, 2);
      if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[2])) __PYX_ERR(4, 1, __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(4, 1, __pyx_L3_error)
    __pyx_v___pyx_state = values[2];
  }
  goto __pyx_L6_skip;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("__pyx_unpickle_VariantRecordFormat", 1, 3, 3, __pyx_nargs); __PYX_ERR(4, 1, __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("pysam.libcbcf.__pyx_unpickle_VariantRecordFormat", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_5pysam_7libcbcf_14__pyx_unpickle_VariantRecordFormat(__pyx_self, __pyx_v___pyx_type, __pyx_v___pyx_checksum, __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_5pysam_7libcbcf_14__pyx_unpickle_VariantRecordFormat(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v___pyx_type, long __pyx_v___pyx_checksum, PyObject *__pyx_v___pyx_state) {
  PyObject *__pyx_v___pyx_PickleError = 0;
  PyObject *__pyx_v___pyx_result = 0;
  PyObject *__pyx_r = NULL;
  __Pyx_TraceDeclarationsFunc
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_t_2;
  PyObject *__pyx_t_3 = NULL;
  size_t __pyx_t_4;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_TraceFrameInit(((PyObject *)__pyx_mstate_global->__pyx_codeobj_tab[402]))
  __Pyx_RefNannySetupContext("__pyx_unpickle_VariantRecordFormat", 0);
  __Pyx_TraceStartFunc("__pyx_unpickle_VariantRecordFormat", __pyx_f[4], 1, 0, 0, 0, __PYX_ERR(4, 1, __pyx_L1_error));

  /* "(tree fragment)":4
 *     cdef object __pyx_PickleError
 *     cdef object __pyx_result
 *     if __pyx_checksum not in (0x70ce871, 0x275a700, 0xde17f0f):             # <<<<<<<<<<<<<<
 *         from pickle import PickleError as __pyx_PickleError
 *         raise __pyx_PickleError, "Incompatible checksums (0x%x vs (0x70ce871, 0x275a700, 0xde17f0f) = (record))" % __pyx_checksum
*/
  __pyx_t_1 = __Pyx_PyLong_From_long(__pyx_v___pyx_checksum); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 4, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_2 = (__Pyx_PySequence_ContainsTF(__pyx_t_1, __pyx_mstate_global->__pyx_tuple[5], Py_NE)); if (unlikely((__pyx_t_2 < 0))) __PYX_ERR(4, 4, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  if (__pyx_t_2) {

    /* "(tree fragment)":5
 *     cdef object __pyx_result
 *     if __pyx_checksum not in (0x70ce871, 0x275a700, 0xde17f0f):
 *         from pickle import PickleError as __pyx_PickleError             # <<<<<<<<<<<<<<
 *         raise __pyx_PickleError, "Incompatible checksums (0x%x vs (0x70ce871, 0x275a700, 0xde17f0f) = (record))" % __pyx_checksum
 *     __pyx_result = VariantRecordFormat.__new__(__pyx_type)
*/
    __pyx_t_1 = PyList_New(1); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 5, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_INCREF(__pyx_mstate_global->__pyx_n_u_PickleError);
    __Pyx_GIVEREF(__pyx_mstate_global->__pyx_n_u_PickleError);
    if (__Pyx_PyList_SET_ITEM(__pyx_t_1, 0, __pyx_mstate_global->__pyx_n_u_PickleError) != (0)) __PYX_ERR(4, 5, __pyx_L1_error);
    __pyx_t_3 = __Pyx_Import(__pyx_mstate_global->__pyx_n_u_pickle, __pyx_t_1, 0); if (unlikely(!__pyx_t_3)) __PYX_ERR(4, 5, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    __pyx_t_1 = __Pyx_ImportFrom(__pyx_t_3, __pyx_mstate_global->__pyx_n_u_PickleError); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 5, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_INCREF(__pyx_t_1);
    __pyx_v___pyx_PickleError = __pyx_t_1;
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;

    /* "(tree fragment)":6
 *     if __pyx_checksum not in (0x70ce871, 0x275a700, 0xde17f0f):
 *         from pickle import PickleError as __pyx_PickleError
 *         raise __pyx_PickleError, "Incompatible checksums (0x%x vs (0x70ce871, 0x275a700, 0xde17f0f) = (record))" % __pyx_checksum             # <<<<<<<<<<<<<<
 *     __pyx_result = VariantRecordFormat.__new__(__pyx_type)
 *     if __pyx_state is not None:
*/
    __pyx_t_3 = __Pyx_PyLong_From_long(__pyx_v___pyx_checksum); if (unlikely(!__pyx_t_3)) __PYX_ERR(4, 6, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __pyx_t_1 = PyUnicode_Format(__pyx_mstate_global->__pyx_kp_u_Incompatible_checksums_0x_x_vs_0_5, __pyx_t_3); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 6, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    __Pyx_Raise(__pyx_v___pyx_PickleError, __pyx_t_1, 0, 0);
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    __PYX_ERR(4, 6, __pyx_L1_error)

    /* "(tree fragment)":4
 *     cdef object __pyx_PickleError
 *     cdef object __pyx_result
 *     if __pyx_checksum not in (0x70ce871, 0x275a700, 0xde17f0f):             # <<<<<<<<<<<<<<
 *         from pickle import PickleError as __pyx_PickleError
 *         raise __pyx_PickleError, "Incompatible checksums (0x%x vs (0x70ce871, 0x275a700, 0xde17f0f) = (record))" % __pyx_checksum
*/
  }

  /* "(tree fragment)":7
 *         from pickle import PickleError as __pyx_PickleError
 *         raise __pyx_PickleError, "Incompatible checksums (0x%x vs (0x70ce871, 0x275a700, 0xde17f0f) = (record))" % __pyx_checksum
 *     __pyx_result = VariantRecordFormat.__new__(__pyx_type)             # <<<<<<<<<<<<<<
 *     if __pyx_state is not None:
 *         __pyx_unpickle_VariantRecordFormat__set_state(<VariantRecordFormat> __pyx_result, __pyx_state)
*/
  __pyx_t_3 = ((PyObject *)__pyx_mstate_global->__pyx_ptype_5pysam_7libcbcf_VariantRecordFormat);
  __Pyx_INCREF(__pyx_t_3);
  __pyx_t_4 = 0;
  {
    PyObject *__pyx_callargs[2] = {__pyx_t_3, __pyx_v___pyx_type};
    __pyx_t_1 = __Pyx_PyObject_FastCallMethod(__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_1)) __PYX_ERR(4, 7, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
  }
  __pyx_v___pyx_result = __pyx_t_1;
  __pyx_t_1 = 0;

  /* "(tree fragment)":8
 *         raise __pyx_PickleError, "Incompatible checksums (0x%x vs (0x70ce871, 0x275a700, 0xde17f0f) = (record))" % __pyx_checksum
 *     __pyx_result = VariantRecordFormat.__new__(__pyx_type)
 *     if __pyx_state is not None:             # <<<<<<<<<<<<<<
 *         __pyx_unpickle_VariantRecordFormat__set_state(<VariantRecordFormat> __pyx_result, __pyx_state)
 *     return __pyx_result
*/
  __pyx_t_2 = (__pyx_v___pyx_state != Py_None);
  if (__pyx_t_2) {

    /* "(tree fragment)":9
 *     __pyx_result = VariantRecordFormat.__new__(__pyx_type)
 *     if __pyx_state is not None:
 *         __pyx_unpickle_VariantRecordFormat__set_state(<VariantRecordFormat> __pyx_result, __pyx_state)             # <<<<<<<<<<<<<<
 *     return __pyx_result
 * cdef __pyx_unpickle_VariantRecordFormat__set_state(VariantRecordFormat __pyx_result, tuple __pyx_state):
*/
    if (!(likely(PyTuple_CheckExact(__pyx_v___pyx_state))||((__pyx_v___pyx_state) == Py_None) || __Pyx_RaiseUnexpectedTypeError("tuple", __pyx_v___pyx_state))) __PYX_ERR(4, 9, __pyx_L1_error)
    __pyx_t_1 = __pyx_f_5pysam_7libcbcf___pyx_unpickle_VariantRecordFormat__set_state(((struct __pyx_obj_5pysam_7libcbcf_VariantRecordFormat *)__pyx_v___pyx_result), ((PyObject*)__pyx_v___pyx_state)); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 9, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

    /* "(tree fragment)":8
 *         raise __pyx_PickleError, "Incompatible checksums (0x%x vs (0x70ce871, 0x275a700, 0xde17f0f) = (record))" % __pyx_checksum
 *     __pyx_result = VariantRecordFormat.__new__(__pyx_type)
 *     if __pyx_state is not None:             # <<<<<<<<<<<<<<
 *         __pyx_unpickle_VariantRecordFormat__set_state(<VariantRecordFormat> __pyx_result, __pyx_state)
 *     return __pyx_result
*/
  }

  /* "(tree fragment)":10
 *     if __pyx_state is not None:
 *         __pyx_unpickle_VariantRecordFormat__set_state(<VariantRecordFormat> __pyx_result, __pyx_state)
 *     return __pyx_result             # <<<<<<<<<<<<<<
 * cdef __pyx_unpickle_VariantRecordFormat__set_state(VariantRecordFormat __pyx_result, tuple __pyx_state):
 *     __pyx_result.record = __pyx_state[0]
*/
  __Pyx_XDECREF(__pyx_r);
  __Pyx_INCREF(__pyx_v___pyx_result);
  __pyx_r = __pyx_v___pyx_result;
  __Pyx_TraceReturnValue(__pyx_r, 29, 0, __PYX_ERR(4, 10, __pyx_L1_error));
  goto __pyx_L0;

  /* "(tree fragment)":1
 * def __pyx_unpickle_VariantRecordFormat(__pyx_type, long __pyx_checksum, __pyx_state):             # <<<<<<<<<<<<<<
 *     cdef object __pyx_PickleError
 *     cdef object __pyx_result
*/

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_TraceException(__pyx_lineno, 0, 0);
  #if CYTHON_USE_SYS_MONITORING
  __Pyx_TraceExceptionUnwind(0, 0);
  #else
  __Pyx_TraceReturnValue(NULL, 0, 0, __PYX_ERR(4, 1, __pyx_L1_error));
  #endif
  __Pyx_AddTraceback("pysam.libcbcf.__pyx_unpickle_VariantRecordFormat", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v___pyx_PickleError);
  __Pyx_XDECREF(__pyx_v___pyx_result);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_PyMonitoring_ExitScope(0);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "(tree fragment)":11
 *         __pyx_unpickle_VariantRecordFormat__set_state(<VariantRecordFormat> __pyx_result, __pyx_state)
 *     return __pyx_result
 * cdef __pyx_unpickle_VariantRecordFormat__set_state(VariantRecordFormat __pyx_result, tuple __pyx_state):             # <<<<<<<<<<<<<<
 *     __pyx_result.record = __pyx_state[0]
 *     if len(__pyx_state) > 1 and hasattr(__pyx_result, '__dict__'):
*/

static PyObject *__pyx_f_5pysam_7libcbcf___pyx_unpickle_VariantRecordFormat__set_state(struct __pyx_obj_5pysam_7libcbcf_VariantRecordFormat *__pyx_v___pyx_result, PyObject *__pyx_v___pyx_state) {
  PyObject *__pyx_r = NULL;
  __Pyx_TraceDeclarationsFunc
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_t_2;
  Py_ssize_t __pyx_t_3;
  int __pyx_t_4;
  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_TraceFrameInit(((PyObject *)__pyx_mstate_global->__pyx_codeobj_tab[403]))
  __Pyx_RefNannySetupContext("__pyx_unpickle_VariantRecordFormat__set_state", 0);
  __Pyx_TraceStartFunc("__pyx_unpickle_VariantRecordFormat__set_state", __pyx_f[4], 11, 0, 0, 0, __PYX_ERR(4, 11, __pyx_L1_error));

  /* "(tree fragment)":12
 *     return __pyx_result
 * cdef __pyx_unpickle_VariantRecordFormat__set_state(VariantRecordFormat __pyx_result, tuple __pyx_state):
 *     __pyx_result.record = __pyx_state[0]             # <<<<<<<<<<<<<<
 *     if len(__pyx_state) > 1 and hasattr(__pyx_result, '__dict__'):
 *         __pyx_result.__dict__.update(__pyx_state[1])
*/
  if (unlikely(__pyx_v___pyx_state == Py_None)) {
    PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable");
    __PYX_ERR(4, 12, __pyx_L1_error)
  }
  __pyx_t_1 = __Pyx_GetItemInt_Tuple(__pyx_v___pyx_state, 0, long, 1, __Pyx_PyLong_From_long, 0, 0, 1, 1); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 12, __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_5pysam_7libcbcf_VariantRecord))))) __PYX_ERR(4, 12, __pyx_L1_error)
  __Pyx_GIVEREF(__pyx_t_1);
  __Pyx_GOTREF((PyObject *)__pyx_v___pyx_result->record);
  __Pyx_DECREF((PyObject *)__pyx_v___pyx_result->record);
  __pyx_v___pyx_result->record = ((struct __pyx_obj_5pysam_7libcbcf_VariantRecord *)__pyx_t_1);
  __pyx_t_1 = 0;

  /* "(tree fragment)":13
 * cdef __pyx_unpickle_VariantRecordFormat__set_state(VariantRecordFormat __pyx_result, tuple __pyx_state):
 *     __pyx_result.record = __pyx_state[0]
 *     if len(__pyx_state) > 1 and hasattr(__pyx_result, '__dict__'):             # <<<<<<<<<<<<<<
 *         __pyx_result.__dict__.update(__pyx_state[1])
*/
  if (unlikely(__pyx_v___pyx_state == Py_None)) {
    PyErr_SetString(PyExc_TypeError, "object of type 'NoneType' has no len()");
    __PYX_ERR(4, 13, __pyx_L1_error)
  }
  __pyx_t_3 = __Pyx_PyTuple_GET_SIZE(__pyx_v___pyx_state); if (unlikely(__pyx_t_3 == ((Py_ssize_t)-1))) __PYX_ERR(4, 13, __pyx_L1_error)
  __pyx_t_4 = (__pyx_t_3 > 1);
  if (__pyx_t_4) {
  } else {
    __pyx_t_2 = __pyx_t_4;
    goto __pyx_L4_bool_binop_done;
  }
  __pyx_t_4 = __Pyx_HasAttr(((PyObject *)__pyx_v___pyx_result), __pyx_mstate_global->__pyx_n_u_dict); if (unlikely(__pyx_t_4 == ((int)-1))) __PYX_ERR(4, 13, __pyx_L1_error)
  __pyx_t_2 = __pyx_t_4;
  __pyx_L4_bool_binop_done:;
  if (__pyx_t_2) {

    /* "(tree fragment)":14
 *     __pyx_result.record = __pyx_state[0]
 *     if len(__pyx_state) > 1 and hasattr(__pyx_result, '__dict__'):
 *         __pyx_result.__dict__.update(__pyx_state[1])             # <<<<<<<<<<<<<<
*/
    __pyx_t_6 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v___pyx_result), __pyx_mstate_global->__pyx_n_u_dict); if (unlikely(!__pyx_t_6)) __PYX_ERR(4, 14, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_6);
    __pyx_t_5 = __pyx_t_6;
    __Pyx_INCREF(__pyx_t_5);
    if (unlikely(__pyx_v___pyx_state == Py_None)) {
      PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable");
      __PYX_ERR(4, 14, __pyx_L1_error)
    }
    __pyx_t_7 = __Pyx_GetItemInt_Tuple(__pyx_v___pyx_state, 1, long, 1, __Pyx_PyLong_From_long, 0, 0, 1, 1); if (unlikely(!__pyx_t_7)) __PYX_ERR(4, 14, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_7);
    __pyx_t_8 = 0;
    {
      PyObject *__pyx_callargs[2] = {__pyx_t_5, __pyx_t_7};
      __pyx_t_1 = __Pyx_PyObject_FastCallMethod(__pyx_mstate_global->__pyx_n_u_update, __pyx_callargs+__pyx_t_8, (2-__pyx_t_8) | (1*__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_1)) __PYX_ERR(4, 14, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_1);
    }
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

    /* "(tree fragment)":13
 * cdef __pyx_unpickle_VariantRecordFormat__set_state(VariantRecordFormat __pyx_result, tuple __pyx_state):
 *     __pyx_result.record = __pyx_state[0]
 *     if len(__pyx_state) > 1 and hasattr(__pyx_result, '__dict__'):             # <<<<<<<<<<<<<<
 *         __pyx_result.__dict__.update(__pyx_state[1])
*/
  }

  /* "(tree fragment)":11
 *         __pyx_unpickle_VariantRecordFormat__set_state(<VariantRecordFormat> __pyx_result, __pyx_state)
 *     return __pyx_result
 * cdef __pyx_unpickle_VariantRecordFormat__set_state(VariantRecordFormat __pyx_result, tuple __pyx_state):             # <<<<<<<<<<<<<<
 *     __pyx_result.record = __pyx_state[0]
 *     if len(__pyx_state) > 1 and hasattr(__pyx_result, '__dict__'):
*/

  /* function exit code */
  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  __Pyx_TraceReturnValue(__pyx_r, 0, 0, __PYX_ERR(4, 11, __pyx_L1_error));
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_5);
  __Pyx_XDECREF(__pyx_t_6);
  __Pyx_XDECREF(__pyx_t_7);
  __Pyx_TraceException(__pyx_lineno, 0, 0);
  #if CYTHON_USE_SYS_MONITORING
  __Pyx_TraceExceptionUnwind(0, 0);
  #else
  __Pyx_TraceReturnValue(NULL, 0, 0, __PYX_ERR(4, 11, __pyx_L1_error));
  #endif
  __Pyx_AddTraceback("pysam.libcbcf.__pyx_unpickle_VariantRecordFormat__set_state", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_PyMonitoring_ExitScope(0);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "(tree fragment)":1
 * def __pyx_unpickle_VariantRecordInfo(__pyx_type, long __pyx_checksum, __pyx_state):             # <<<<<<<<<<<<<<
 *     cdef object __pyx_PickleError
 *     cdef object __pyx_result
*/

/* Python wrapper */
static PyObject *__pyx_pw_5pysam_7libcbcf_17__pyx_unpickle_VariantRecordInfo(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_5pysam_7libcbcf_16__pyx_unpickle_VariantRecordInfo, "__pyx_unpickle_VariantRecordInfo(__pyx_type, long __pyx_checksum, __pyx_state)");
static PyMethodDef __pyx_mdef_5pysam_7libcbcf_17__pyx_unpickle_VariantRecordInfo = {"__pyx_unpickle_VariantRecordInfo", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_5pysam_7libcbcf_17__pyx_unpickle_VariantRecordInfo, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_5pysam_7libcbcf_16__pyx_unpickle_VariantRecordInfo};
static PyObject *__pyx_pw_5pysam_7libcbcf_17__pyx_unpickle_VariantRecordInfo(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_VariantRecordInfo (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(4, 1, __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(4, 1, __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(4, 1, __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(4, 1, __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_VariantRecordInfo", 0) < 0) __PYX_ERR(4, 1, __pyx_L3_error)
      for (Py_ssize_t i = __pyx_nargs; i < 3; i++) {
        if (unlikely(!values[i])) { __Pyx_RaiseArgtupleInvalid("__pyx_unpickle_VariantRecordInfo", 1, 3, 3, i); __PYX_ERR(4, 1, __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(4, 1, __pyx_L3_error)
      values[1] = __Pyx_ArgRef_FASTCALL(__pyx_args, 1);
      if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[1])) __PYX_ERR(4, 1, __pyx_L3_error)
      values[2] = __Pyx_ArgRef_FASTCALL(__pyx_args, 2);
      if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[2])) __PYX_ERR(4, 1, __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(4, 1, __pyx_L3_error)
    __pyx_v___pyx_state = values[2];
  }
  goto __pyx_L6_skip;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("__pyx_unpickle_VariantRecordInfo", 1, 3, 3, __pyx_nargs); __PYX_ERR(4, 1, __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("pysam.libcbcf.__pyx_unpickle_VariantRecordInfo", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_5pysam_7libcbcf_16__pyx_unpickle_VariantRecordInfo(__pyx_self, __pyx_v___pyx_type, __pyx_v___pyx_checksum, __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_5pysam_7libcbcf_16__pyx_unpickle_VariantRecordInfo(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v___pyx_type, long __pyx_v___pyx_checksum, PyObject *__pyx_v___pyx_state) {
  PyObject *__pyx_v___pyx_PickleError = 0;
  PyObject *__pyx_v___pyx_result = 0;
  PyObject *__pyx_r = NULL;
  __Pyx_TraceDeclarationsFunc
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_t_2;
  PyObject *__pyx_t_3 = NULL;
  size_t __pyx_t_4;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_TraceFrameInit(((PyObject *)__pyx_mstate_global->__pyx_codeobj_tab[404]))
  __Pyx_RefNannySetupContext("__pyx_unpickle_VariantRecordInfo", 0);
  __Pyx_TraceStartFunc("__pyx_unpickle_VariantRecordInfo", __pyx_f[4], 1, 0, 0, 0, __PYX_ERR(4, 1, __pyx_L1_error));

  /* "(tree fragment)":4
 *     cdef object __pyx_PickleError
 *     cdef object __pyx_result
 *     if __pyx_checksum not in (0x70ce871, 0x275a700, 0xde17f0f):             # <<<<<<<<<<<<<<
 *         from pickle import PickleError as __pyx_PickleError
 *         raise __pyx_PickleError, "Incompatible checksums (0x%x vs (0x70ce871, 0x275a700, 0xde17f0f) = (record))" % __pyx_checksum
*/
  __pyx_t_1 = __Pyx_PyLong_From_long(__pyx_v___pyx_checksum); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 4, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_2 = (__Pyx_PySequence_ContainsTF(__pyx_t_1, __pyx_mstate_global->__pyx_tuple[5], Py_NE)); if (unlikely((__pyx_t_2 < 0))) __PYX_ERR(4, 4, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  if (__pyx_t_2) {

    /* "(tree fragment)":5
 *     cdef object __pyx_result
 *     if __pyx_checksum not in (0x70ce871, 0x275a700, 0xde17f0f):
 *         from pickle import PickleError as __pyx_PickleError             # <<<<<<<<<<<<<<
 *         raise __pyx_PickleError, "Incompatible checksums (0x%x vs (0x70ce871, 0x275a700, 0xde17f0f) = (record))" % __pyx_checksum
 *     __pyx_result = VariantRecordInfo.__new__(__pyx_type)
*/
    __pyx_t_1 = PyList_New(1); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 5, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_INCREF(__pyx_mstate_global->__pyx_n_u_PickleError);
    __Pyx_GIVEREF(__pyx_mstate_global->__pyx_n_u_PickleError);
    if (__Pyx_PyList_SET_ITEM(__pyx_t_1, 0, __pyx_mstate_global->__pyx_n_u_PickleError) != (0)) __PYX_ERR(4, 5, __pyx_L1_error);
    __pyx_t_3 = __Pyx_Import(__pyx_mstate_global->__pyx_n_u_pickle, __pyx_t_1, 0); if (unlikely(!__pyx_t_3)) __PYX_ERR(4, 5, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    __pyx_t_1 = __Pyx_ImportFrom(__pyx_t_3, __pyx_mstate_global->__pyx_n_u_PickleError); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 5, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_INCREF(__pyx_t_1);
    __pyx_v___pyx_PickleError = __pyx_t_1;
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;

    /* "(tree fragment)":6
 *     if __pyx_checksum not in (0x70ce871, 0x275a700, 0xde17f0f):
 *         from pickle import PickleError as __pyx_PickleError
 *         raise __pyx_PickleError, "Incompatible checksums (0x%x vs (0x70ce871, 0x275a700, 0xde17f0f) = (record))" % __pyx_checksum             # <<<<<<<<<<<<<<
 *     __pyx_result = VariantRecordInfo.__new__(__pyx_type)
 *     if __pyx_state is not None:
*/
    __pyx_t_3 = __Pyx_PyLong_From_long(__pyx_v___pyx_checksum); if (unlikely(!__pyx_t_3)) __PYX_ERR(4, 6, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __pyx_t_1 = PyUnicode_Format(__pyx_mstate_global->__pyx_kp_u_Incompatible_checksums_0x_x_vs_0_5, __pyx_t_3); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 6, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    __Pyx_Raise(__pyx_v___pyx_PickleError, __pyx_t_1, 0, 0);
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    __PYX_ERR(4, 6, __pyx_L1_error)

    /* "(tree fragment)":4
 *     cdef object __pyx_PickleError
 *     cdef object __pyx_result
 *     if __pyx_checksum not in (0x70ce871, 0x275a700, 0xde17f0f):             # <<<<<<<<<<<<<<
 *         from pickle import PickleError as __pyx_PickleError
 *         raise __pyx_PickleError, "Incompatible checksums (0x%x vs (0x70ce871, 0x275a700, 0xde17f0f) = (record))" % __pyx_checksum
*/
  }

  /* "(tree fragment)":7
 *         from pickle import PickleError as __pyx_PickleError
 *         raise __pyx_PickleError, "Incompatible checksums (0x%x vs (0x70ce871, 0x275a700, 0xde17f0f) = (record))" % __pyx_checksum
 *     __pyx_result = VariantRecordInfo.__new__(__pyx_type)             # <<<<<<<<<<<<<<
 *     if __pyx_state is not None:
 *         __pyx_unpickle_VariantRecordInfo__set_state(<VariantRecordInfo> __pyx_result, __pyx_state)
*/
  __pyx_t_3 = ((PyObject *)__pyx_mstate_global->__pyx_ptype_5pysam_7libcbcf_VariantRecordInfo);
  __Pyx_INCREF(__pyx_t_3);
  __pyx_t_4 = 0;
  {
    PyObject *__pyx_callargs[2] = {__pyx_t_3, __pyx_v___pyx_type};
    __pyx_t_1 = __Pyx_PyObject_FastCallMethod(__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_1)) __PYX_ERR(4, 7, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
  }
  __pyx_v___pyx_result = __pyx_t_1;
  __pyx_t_1 = 0;

  /* "(tree fragment)":8
 *         raise __pyx_PickleError, "Incompatible checksums (0x%x vs (0x70ce871, 0x275a700, 0xde17f0f) = (record))" % __pyx_checksum
 *     __pyx_result = VariantRecordInfo.__new__(__pyx_type)
 *     if __pyx_state is not None:             # <<<<<<<<<<<<<<
 *         __pyx_unpickle_VariantRecordInfo__set_state(<VariantRecordInfo> __pyx_result, __pyx_state)
 *     return __pyx_result
*/
  __pyx_t_2 = (__pyx_v___pyx_state != Py_None);
  if (__pyx_t_2) {

    /* "(tree fragment)":9
 *     __pyx_result = VariantRecordInfo.__new__(__pyx_type)
 *     if __pyx_state is not None:
 *         __pyx_unpickle_VariantRecordInfo__set_state(<VariantRecordInfo> __pyx_result, __pyx_state)             # <<<<<<<<<<<<<<
 *     return __pyx_result
 * cdef __pyx_unpickle_VariantRecordInfo__set_state(VariantRecordInfo __pyx_result, tuple __pyx_state):
*/
    if (!(likely(PyTuple_CheckExact(__pyx_v___pyx_state))||((__pyx_v___pyx_state) == Py_None) || __Pyx_RaiseUnexpectedTypeError("tuple", __pyx_v___pyx_state))) __PYX_ERR(4, 9, __pyx_L1_error)
    __pyx_t_1 = __pyx_f_5pysam_7libcbcf___pyx_unpickle_VariantRecordInfo__set_state(((struct __pyx_obj_5pysam_7libcbcf_VariantRecordInfo *)__pyx_v___pyx_result), ((PyObject*)__pyx_v___pyx_state)); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 9, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

    /* "(tree fragment)":8
 *         raise __pyx_PickleError, "Incompatible checksums (0x%x vs (0x70ce871, 0x275a700, 0xde17f0f) = (record))" % __pyx_checksum
 *     __pyx_result = VariantRecordInfo.__new__(__pyx_type)
 *     if __pyx_state is not None:             # <<<<<<<<<<<<<<
 *         __pyx_unpickle_VariantRecordInfo__set_state(<VariantRecordInfo> __pyx_result, __pyx_state)
 *     return __pyx_result
*/
  }

  /* "(tree fragment)":10
 *     if __pyx_state is not None:
 *         __pyx_unpickle_VariantRecordInfo__set_state(<VariantRecordInfo> __pyx_result, __pyx_state)
 *     return __pyx_result             # <<<<<<<<<<<<<<
 * cdef __pyx_unpickle_VariantRecordInfo__set_state(VariantRecordInfo __pyx_result, tuple __pyx_state):
 *     __pyx_result.record = __pyx_state[0]
*/
  __Pyx_XDECREF(__pyx_r);
  __Pyx_INCREF(__pyx_v___pyx_result);
  __pyx_r = __pyx_v___pyx_result;
  __Pyx_TraceReturnValue(__pyx_r, 29, 0, __PYX_ERR(4, 10, __pyx_L1_error));
  goto __pyx_L0;

  /* "(tree fragment)":1
 * def __pyx_unpickle_VariantRecordInfo(__pyx_type, long __pyx_checksum, __pyx_state):             # <<<<<<<<<<<<<<
 *     cdef object __pyx_PickleError
 *     cdef object __pyx_result
*/

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_TraceException(__pyx_lineno, 0, 0);
  #if CYTHON_USE_SYS_MONITORING
  __Pyx_TraceExceptionUnwind(0, 0);
  #else
  __Pyx_TraceReturnValue(NULL, 0, 0, __PYX_ERR(4, 1, __pyx_L1_error));
  #endif
  __Pyx_AddTraceback("pysam.libcbcf.__pyx_unpickle_VariantRecordInfo", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v___pyx_PickleError);
  __Pyx_XDECREF(__pyx_v___pyx_result);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_PyMonitoring_ExitScope(0);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "(tree fragment)":11
 *         __pyx_unpickle_VariantRecordInfo__set_state(<VariantRecordInfo> __pyx_result, __pyx_state)
 *     return __pyx_result
 * cdef __pyx_unpickle_VariantRecordInfo__set_state(VariantRecordInfo __pyx_result, tuple __pyx_state):             # <<<<<<<<<<<<<<
 *     __pyx_result.record = __pyx_state[0]
 *     if len(__pyx_state) > 1 and hasattr(__pyx_result, '__dict__'):
*/

static PyObject *__pyx_f_5pysam_7libcbcf___pyx_unpickle_VariantRecordInfo__set_state(struct __pyx_obj_5pysam_7libcbcf_VariantRecordInfo *__pyx_v___pyx_result, PyObject *__pyx_v___pyx_state) {
  PyObject *__pyx_r = NULL;
  __Pyx_TraceDeclarationsFunc
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_t_2;
  Py_ssize_t __pyx_t_3;
  int __pyx_t_4;
  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_TraceFrameInit(((PyObject *)__pyx_mstate_global->__pyx_codeobj_tab[405]))
  __Pyx_RefNannySetupContext("__pyx_unpickle_VariantRecordInfo__set_state", 0);
  __Pyx_TraceStartFunc("__pyx_unpickle_VariantRecordInfo__set_state", __pyx_f[4], 11, 0, 0, 0, __PYX_ERR(4, 11, __pyx_L1_error));

  /* "(tree fragment)":12
 *     return __pyx_result
 * cdef __pyx_unpickle_VariantRecordInfo__set_state(VariantRecordInfo __pyx_result, tuple __pyx_state):
 *     __pyx_result.record = __pyx_state[0]             # <<<<<<<<<<<<<<
 *     if len(__pyx_state) > 1 and hasattr(__pyx_result, '__dict__'):
 *         __pyx_result.__dict__.update(__pyx_state[1])
*/
  if (unlikely(__pyx_v___pyx_state == Py_None)) {
    PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable");
    __PYX_ERR(4, 12, __pyx_L1_error)
  }
  __pyx_t_1 = __Pyx_GetItemInt_Tuple(__pyx_v___pyx_state, 0, long, 1, __Pyx_PyLong_From_long, 0, 0, 1, 1); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 12, __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_5pysam_7libcbcf_VariantRecord))))) __PYX_ERR(4, 12, __pyx_L1_error)
  __Pyx_GIVEREF(__pyx_t_1);
  __Pyx_GOTREF((PyObject *)__pyx_v___pyx_result->record);
  __Pyx_DECREF((PyObject *)__pyx_v___pyx_result->record);
  __pyx_v___pyx_result->record = ((struct __pyx_obj_5pysam_7libcbcf_VariantRecord *)__pyx_t_1);
  __pyx_t_1 = 0;

  /* "(tree fragment)":13
 * cdef __pyx_unpickle_VariantRecordInfo__set_state(VariantRecordInfo __pyx_result, tuple __pyx_state):
 *     __pyx_result.record = __pyx_state[0]
 *     if len(__pyx_state) > 1 and hasattr(__pyx_result, '__dict__'):             # <<<<<<<<<<<<<<
 *         __pyx_result.__dict__.update(__pyx_state[1])
*/
  if (unlikely(__pyx_v___pyx_state == Py_None)) {
    PyErr_SetString(PyExc_TypeError, "object of type 'NoneType' has no len()");
    __PYX_ERR(4, 13, __pyx_L1_error)
  }
  __pyx_t_3 = __Pyx_PyTuple_GET_SIZE(__pyx_v___pyx_state); if (unlikely(__pyx_t_3 == ((Py_ssize_t)-1))) __PYX_ERR(4, 13, __pyx_L1_error)
  __pyx_t_4 = (__pyx_t_3 > 1);
  if (__pyx_t_4) {
  } else {
    __pyx_t_2 = __pyx_t_4;
    goto __pyx_L4_bool_binop_done;
  }
  __pyx_t_4 = __Pyx_HasAttr(((PyObject *)__pyx_v___pyx_result), __pyx_mstate_global->__pyx_n_u_dict); if (unlikely(__pyx_t_4 == ((int)-1))) __PYX_ERR(4, 13, __pyx_L1_error)
  __pyx_t_2 = __pyx_t_4;
  __pyx_L4_bool_binop_done:;
  if (__pyx_t_2) {

    /* "(tree fragment)":14
 *     __pyx_result.record = __pyx_state[0]
 *     if len(__pyx_state) > 1 and hasattr(__pyx_result, '__dict__'):
 *         __pyx_result.__dict__.update(__pyx_state[1])             # <<<<<<<<<<<<<<
*/
    __pyx_t_6 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v___pyx_result), __pyx_mstate_global->__pyx_n_u_dict); if (unlikely(!__pyx_t_6)) __PYX_ERR(4, 14, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_6);
    __pyx_t_5 = __pyx_t_6;
    __Pyx_INCREF(__pyx_t_5);
    if (unlikely(__pyx_v___pyx_state == Py_None)) {
      PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable");
      __PYX_ERR(4, 14, __pyx_L1_error)
    }
    __pyx_t_7 = __Pyx_GetItemInt_Tuple(__pyx_v___pyx_state, 1, long, 1, __Pyx_PyLong_From_long, 0, 0, 1, 1); if (unlikely(!__pyx_t_7)) __PYX_ERR(4, 14, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_7);
    __pyx_t_8 = 0;
    {
      PyObject *__pyx_callargs[2] = {__pyx_t_5, __pyx_t_7};
      __pyx_t_1 = __Pyx_PyObject_FastCallMethod(__pyx_mstate_global->__pyx_n_u_update, __pyx_callargs+__pyx_t_8, (2-__pyx_t_8) | (1*__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_1)) __PYX_ERR(4, 14, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_1);
    }
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

    /* "(tree fragment)":13
 * cdef __pyx_unpickle_VariantRecordInfo__set_state(VariantRecordInfo __pyx_result, tuple __pyx_state):
 *     __pyx_result.record = __pyx_state[0]
 *     if len(__pyx_state) > 1 and hasattr(__pyx_result, '__dict__'):             # <<<<<<<<<<<<<<
 *         __pyx_result.__dict__.update(__pyx_state[1])
*/
  }

  /* "(tree fragment)":11
 *         __pyx_unpickle_VariantRecordInfo__set_state(<VariantRecordInfo> __pyx_result, __pyx_state)
 *     return __pyx_result
 * cdef __pyx_unpickle_VariantRecordInfo__set_state(VariantRecordInfo __pyx_result, tuple __pyx_state):             # <<<<<<<<<<<<<<
 *     __pyx_result.record = __pyx_state[0]
 *     if len(__pyx_state) > 1 and hasattr(__pyx_result, '__dict__'):
*/

  /* function exit code */
  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  __Pyx_TraceReturnValue(__pyx_r, 0, 0, __PYX_ERR(4, 11, __pyx_L1_error));
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_5);
  __Pyx_XDECREF(__pyx_t_6);
  __Pyx_XDECREF(__pyx_t_7);
  __Pyx_TraceException(__pyx_lineno, 0, 0);
  #if CYTHON_USE_SYS_MONITORING
  __Pyx_TraceExceptionUnwind(0, 0);
  #else
  __Pyx_TraceReturnValue(NULL, 0, 0, __PYX_ERR(4, 11, __pyx_L1_error));
  #endif
  __Pyx_AddTraceback("pysam.libcbcf.__pyx_unpickle_VariantRecordInfo__set_state", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_PyMonitoring_ExitScope(0);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "(tree fragment)":1
 * def __pyx_unpickle_VariantRecordSamples(__pyx_type, long __pyx_checksum, __pyx_state):             # <<<<<<<<<<<<<<
 *     cdef object __pyx_PickleError
 *     cdef object __pyx_result
*/

/* Python wrapper */
static PyObject *__pyx_pw_5pysam_7libcbcf_19__pyx_unpickle_VariantRecordSamples(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_5pysam_7libcbcf_18__pyx_unpickle_VariantRecordSamples, "__pyx_unpickle_VariantRecordSamples(__pyx_type, long __pyx_checksum, __pyx_state)");
static PyMethodDef __pyx_mdef_5pysam_7libcbcf_19__pyx_unpickle_VariantRecordSamples = {"__pyx_unpickle_VariantRecordSamples", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_5pysam_7libcbcf_19__pyx_unpickle_VariantRecordSamples, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_5pysam_7libcbcf_18__pyx_unpickle_VariantRecordSamples};
static PyObject *__pyx_pw_5pysam_7libcbcf_19__pyx_unpickle_VariantRecordSamples(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_VariantRecordSamples (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(4, 1, __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(4, 1, __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(4, 1, __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(4, 1, __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_VariantRecordSamples", 0) < 0) __PYX_ERR(4, 1, __pyx_L3_error)
      for (Py_ssize_t i = __pyx_nargs; i < 3; i++) {
        if (unlikely(!values[i])) { __Pyx_RaiseArgtupleInvalid("__pyx_unpickle_VariantRecordSamples", 1, 3, 3, i); __PYX_ERR(4, 1, __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(4, 1, __pyx_L3_error)
      values[1] = __Pyx_ArgRef_FASTCALL(__pyx_args, 1);
      if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[1])) __PYX_ERR(4, 1, __pyx_L3_error)
      values[2] = __Pyx_ArgRef_FASTCALL(__pyx_args, 2);
      if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[2])) __PYX_ERR(4, 1, __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(4, 1, __pyx_L3_error)
    __pyx_v___pyx_state = values[2];
  }
  goto __pyx_L6_skip;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("__pyx_unpickle_VariantRecordSamples", 1, 3, 3, __pyx_nargs); __PYX_ERR(4, 1, __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("pysam.libcbcf.__pyx_unpickle_VariantRecordSamples", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_5pysam_7libcbcf_18__pyx_unpickle_VariantRecordSamples(__pyx_self, __pyx_v___pyx_type, __pyx_v___pyx_checksum, __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_5pysam_7libcbcf_18__pyx_unpickle_VariantRecordSamples(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v___pyx_type, long __pyx_v___pyx_checksum, PyObject *__pyx_v___pyx_state) {
  PyObject *__pyx_v___pyx_PickleError = 0;
  PyObject *__pyx_v___pyx_result = 0;
  PyObject *__pyx_r = NULL;
  __Pyx_TraceDeclarationsFunc
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_t_2;
  PyObject *__pyx_t_3 = NULL;
  size_t __pyx_t_4;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_TraceFrameInit(((PyObject *)__pyx_mstate_global->__pyx_codeobj_tab[406]))
  __Pyx_RefNannySetupContext("__pyx_unpickle_VariantRecordSamples", 0);
  __Pyx_TraceStartFunc("__pyx_unpickle_VariantRecordSamples", __pyx_f[4], 1, 0, 0, 0, __PYX_ERR(4, 1, __pyx_L1_error));

  /* "(tree fragment)":4
 *     cdef object __pyx_PickleError
 *     cdef object __pyx_result
 *     if __pyx_checksum not in (0x70ce871, 0x275a700, 0xde17f0f):             # <<<<<<<<<<<<<<
 *         from pickle import PickleError as __pyx_PickleError
 *         raise __pyx_PickleError, "Incompatible checksums (0x%x vs (0x70ce871, 0x275a700, 0xde17f0f) = (record))" % __pyx_checksum
*/
  __pyx_t_1 = __Pyx_PyLong_From_long(__pyx_v___pyx_checksum); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 4, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_2 = (__Pyx_PySequence_ContainsTF(__pyx_t_1, __pyx_mstate_global->__pyx_tuple[5], Py_NE)); if (unlikely((__pyx_t_2 < 0))) __PYX_ERR(4, 4, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  if (__pyx_t_2) {

    /* "(tree fragment)":5
 *     cdef object __pyx_result
 *     if __pyx_checksum not in (0x70ce871, 0x275a700, 0xde17f0f):
 *         from pickle import PickleError as __pyx_PickleError             # <<<<<<<<<<<<<<
 *         raise __pyx_PickleError, "Incompatible checksums (0x%x vs (0x70ce871, 0x275a700, 0xde17f0f) = (record))" % __pyx_checksum
 *     __pyx_result = VariantRecordSamples.__new__(__pyx_type)
*/
    __pyx_t_1 = PyList_New(1); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 5, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_INCREF(__pyx_mstate_global->__pyx_n_u_PickleError);
    __Pyx_GIVEREF(__pyx_mstate_global->__pyx_n_u_PickleError);
    if (__Pyx_PyList_SET_ITEM(__pyx_t_1, 0, __pyx_mstate_global->__pyx_n_u_PickleError) != (0)) __PYX_ERR(4, 5, __pyx_L1_error);
    __pyx_t_3 = __Pyx_Import(__pyx_mstate_global->__pyx_n_u_pickle, __pyx_t_1, 0); if (unlikely(!__pyx_t_3)) __PYX_ERR(4, 5, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    __pyx_t_1 = __Pyx_ImportFrom(__pyx_t_3, __pyx_mstate_global->__pyx_n_u_PickleError); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 5, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_INCREF(__pyx_t_1);
    __pyx_v___pyx_PickleError = __pyx_t_1;
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;

    /* "(tree fragment)":6
 *     if __pyx_checksum not in (0x70ce871, 0x275a700, 0xde17f0f):
 *         from pickle import PickleError as __pyx_PickleError
 *         raise __pyx_PickleError, "Incompatible checksums (0x%x vs (0x70ce871, 0x275a700, 0xde17f0f) = (record))" % __pyx_checksum             # <<<<<<<<<<<<<<
 *     __pyx_result = VariantRecordSamples.__new__(__pyx_type)
 *     if __pyx_state is not None:
*/
    __pyx_t_3 = __Pyx_PyLong_From_long(__pyx_v___pyx_checksum); if (unlikely(!__pyx_t_3)) __PYX_ERR(4, 6, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __pyx_t_1 = PyUnicode_Format(__pyx_mstate_global->__pyx_kp_u_Incompatible_checksums_0x_x_vs_0_5, __pyx_t_3); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 6, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    __Pyx_Raise(__pyx_v___pyx_PickleError, __pyx_t_1, 0, 0);
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    __PYX_ERR(4, 6, __pyx_L1_error)

    /* "(tree fragment)":4
 *     cdef object __pyx_PickleError
 *     cdef object __pyx_result
 *     if __pyx_checksum not in (0x70ce871, 0x275a700, 0xde17f0f):             # <<<<<<<<<<<<<<
 *         from pickle import PickleError as __pyx_PickleError
 *         raise __pyx_PickleError, "Incompatible checksums (0x%x vs (0x70ce871, 0x275a700, 0xde17f0f) = (record))" % __pyx_checksum
*/
  }

  /* "(tree fragment)":7
 *         from pickle import PickleError as __pyx_PickleError
 *         raise __pyx_PickleError, "Incompatible checksums (0x%x vs (0x70ce871, 0x275a700, 0xde17f0f) = (record))" % __pyx_checksum
 *     __pyx_result = VariantRecordSamples.__new__(__pyx_type)             # <<<<<<<<<<<<<<
 *     if __pyx_state is not None:
 *         __pyx_unpickle_VariantRecordSamples__set_state(<VariantRecordSamples> __pyx_result, __pyx_state)
*/
  __pyx_t_3 = ((PyObject *)__pyx_mstate_global->__pyx_ptype_5pysam_7libcbcf_VariantRecordSamples);
  __Pyx_INCREF(__pyx_t_3);
  __pyx_t_4 = 0;
  {
    PyObject *__pyx_callargs[2] = {__pyx_t_3, __pyx_v___pyx_type};
    __pyx_t_1 = __Pyx_PyObject_FastCallMethod(__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_1)) __PYX_ERR(4, 7, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
  }
  __pyx_v___pyx_result = __pyx_t_1;
  __pyx_t_1 = 0;

  /* "(tree fragment)":8
 *         raise __pyx_PickleError, "Incompatible checksums (0x%x vs (0x70ce871, 0x275a700, 0xde17f0f) = (record))" % __pyx_checksum
 *     __pyx_result = VariantRecordSamples.__new__(__pyx_type)
 *     if __pyx_state is not None:             # <<<<<<<<<<<<<<
 *         __pyx_unpickle_VariantRecordSamples__set_state(<VariantRecordSamples> __pyx_result, __pyx_state)
 *     return __pyx_result
*/
  __pyx_t_2 = (__pyx_v___pyx_state != Py_None);
  if (__pyx_t_2) {

    /* "(tree fragment)":9
 *     __pyx_result = VariantRecordSamples.__new__(__pyx_type)
 *     if __pyx_state is not None:
 *         __pyx_unpickle_VariantRecordSamples__set_state(<VariantRecordSamples> __pyx_result, __pyx_state)             # <<<<<<<<<<<<<<
 *     return __pyx_result
 * cdef __pyx_unpickle_VariantRecordSamples__set_state(VariantRecordSamples __pyx_result, tuple __pyx_state):
*/
    if (!(likely(PyTuple_CheckExact(__pyx_v___pyx_state))||((__pyx_v___pyx_state) == Py_None) || __Pyx_RaiseUnexpectedTypeError("tuple", __pyx_v___pyx_state))) __PYX_ERR(4, 9, __pyx_L1_error)
    __pyx_t_1 = __pyx_f_5pysam_7libcbcf___pyx_unpickle_VariantRecordSamples__set_state(((struct __pyx_obj_5pysam_7libcbcf_VariantRecordSamples *)__pyx_v___pyx_result), ((PyObject*)__pyx_v___pyx_state)); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 9, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

    /* "(tree fragment)":8
 *         raise __pyx_PickleError, "Incompatible checksums (0x%x vs (0x70ce871, 0x275a700, 0xde17f0f) = (record))" % __pyx_checksum
 *     __pyx_result = VariantRecordSamples.__new__(__pyx_type)
 *     if __pyx_state is not None:             # <<<<<<<<<<<<<<
 *         __pyx_unpickle_VariantRecordSamples__set_state(<VariantRecordSamples> __pyx_result, __pyx_state)
 *     return __pyx_result
*/
  }

  /* "(tree fragment)":10
 *     if __pyx_state is not None:
 *         __pyx_unpickle_VariantRecordSamples__set_state(<VariantRecordSamples> __pyx_result, __pyx_state)
 *     return __pyx_result             # <<<<<<<<<<<<<<
 * cdef __pyx_unpickle_VariantRecordSamples__set_state(VariantRecordSamples __pyx_result, tuple __pyx_state):
 *     __pyx_result.record = __pyx_state[0]
*/
  __Pyx_XDECREF(__pyx_r);
  __Pyx_INCREF(__pyx_v___pyx_result);
  __pyx_r = __pyx_v___pyx_result;
  __Pyx_TraceReturnValue(__pyx_r, 29, 0, __PYX_ERR(4, 10, __pyx_L1_error));
  goto __pyx_L0;

  /* "(tree fragment)":1
 * def __pyx_unpickle_VariantRecordSamples(__pyx_type, long __pyx_checksum, __pyx_state):             # <<<<<<<<<<<<<<
 *     cdef object __pyx_PickleError
 *     cdef object __pyx_result
*/

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_TraceException(__pyx_lineno, 0, 0);
  #if CYTHON_USE_SYS_MONITORING
  __Pyx_TraceExceptionUnwind(0, 0);
  #else
  __Pyx_TraceReturnValue(NULL, 0, 0, __PYX_ERR(4, 1, __pyx_L1_error));
  #endif
  __Pyx_AddTraceback("pysam.libcbcf.__pyx_unpickle_VariantRecordSamples", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v___pyx_PickleError);
  __Pyx_XDECREF(__pyx_v___pyx_result);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_PyMonitoring_ExitScope(0);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "(tree fragment)":11
 *         __pyx_unpickle_VariantRecordSamples__set_state(<VariantRecordSamples> __pyx_result, __pyx_state)
 *     return __pyx_result
 * cdef __pyx_unpickle_VariantRecordSamples__set_state(VariantRecordSamples __pyx_result, tuple __pyx_state):             # <<<<<<<<<<<<<<
 *     __pyx_result.record = __pyx_state[0]
 *     if len(__pyx_state) > 1 and hasattr(__pyx_result, '__dict__'):
*/

static PyObject *__pyx_f_5pysam_7libcbcf___pyx_unpickle_VariantRecordSamples__set_state(struct __pyx_obj_5pysam_7libcbcf_VariantRecordSamples *__pyx_v___pyx_result, PyObject *__pyx_v___pyx_state) {
  PyObject *__pyx_r = NULL;
  __Pyx_TraceDeclarationsFunc
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_t_2;
  Py_ssize_t __pyx_t_3;
  int __pyx_t_4;
  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_TraceFrameInit(((PyObject *)__pyx_mstate_global->__pyx_codeobj_tab[407]))
  __Pyx_RefNannySetupContext("__pyx_unpickle_VariantRecordSamples__set_state", 0);
  __Pyx_TraceStartFunc("__pyx_unpickle_VariantRecordSamples__set_state", __pyx_f[4], 11, 0, 0, 0, __PYX_ERR(4, 11, __pyx_L1_error));

  /* "(tree fragment)":12
 *     return __pyx_result
 * cdef __pyx_unpickle_VariantRecordSamples__set_state(VariantRecordSamples __pyx_result, tuple __pyx_state):
 *     __pyx_result.record = __pyx_state[0]             # <<<<<<<<<<<<<<
 *     if len(__pyx_state) > 1 and hasattr(__pyx_result, '__dict__'):
 *         __pyx_result.__dict__.update(__pyx_state[1])
*/
  if (unlikely(__pyx_v___pyx_state == Py_None)) {
    PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable");
    __PYX_ERR(4, 12, __pyx_L1_error)
  }
  __pyx_t_1 = __Pyx_GetItemInt_Tuple(__pyx_v___pyx_state, 0, long, 1, __Pyx_PyLong_From_long, 0, 0, 1, 1); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 12, __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_5pysam_7libcbcf_VariantRecord))))) __PYX_ERR(4, 12, __pyx_L1_error)
  __Pyx_GIVEREF(__pyx_t_1);
  __Pyx_GOTREF((PyObject *)__pyx_v___pyx_result->record);
  __Pyx_DECREF((PyObject *)__pyx_v___pyx_result->record);
  __pyx_v___pyx_result->record = ((struct __pyx_obj_5pysam_7libcbcf_VariantRecord *)__pyx_t_1);
  __pyx_t_1 = 0;

  /* "(tree fragment)":13
 * cdef __pyx_unpickle_VariantRecordSamples__set_state(VariantRecordSamples __pyx_result, tuple __pyx_state):
 *     __pyx_result.record = __pyx_state[0]
 *     if len(__pyx_state) > 1 and hasattr(__pyx_result, '__dict__'):             # <<<<<<<<<<<<<<
 *         __pyx_result.__dict__.update(__pyx_state[1])
*/
  if (unlikely(__pyx_v___pyx_state == Py_None)) {
    PyErr_SetString(PyExc_TypeError, "object of type 'NoneType' has no len()");
    __PYX_ERR(4, 13, __pyx_L1_error)
  }
  __pyx_t_3 = __Pyx_PyTuple_GET_SIZE(__pyx_v___pyx_state); if (unlikely(__pyx_t_3 == ((Py_ssize_t)-1))) __PYX_ERR(4, 13, __pyx_L1_error)
  __pyx_t_4 = (__pyx_t_3 > 1);
  if (__pyx_t_4) {
  } else {
    __pyx_t_2 = __pyx_t_4;
    goto __pyx_L4_bool_binop_done;
  }
  __pyx_t_4 = __Pyx_HasAttr(((PyObject *)__pyx_v___pyx_result), __pyx_mstate_global->__pyx_n_u_dict); if (unlikely(__pyx_t_4 == ((int)-1))) __PYX_ERR(4, 13, __pyx_L1_error)
  __pyx_t_2 = __pyx_t_4;
  __pyx_L4_bool_binop_done:;
  if (__pyx_t_2) {

    /* "(tree fragment)":14
 *     __pyx_result.record = __pyx_state[0]
 *     if len(__pyx_state) > 1 and hasattr(__pyx_result, '__dict__'):
 *         __pyx_result.__dict__.update(__pyx_state[1])             # <<<<<<<<<<<<<<
*/
    __pyx_t_6 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v___pyx_result), __pyx_mstate_global->__pyx_n_u_dict); if (unlikely(!__pyx_t_6)) __PYX_ERR(4, 14, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_6);
    __pyx_t_5 = __pyx_t_6;
    __Pyx_INCREF(__pyx_t_5);
    if (unlikely(__pyx_v___pyx_state == Py_None)) {
      PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable");
      __PYX_ERR(4, 14, __pyx_L1_error)
    }
    __pyx_t_7 = __Pyx_GetItemInt_Tuple(__pyx_v___pyx_state, 1, long, 1, __Pyx_PyLong_From_long, 0, 0, 1, 1); if (unlikely(!__pyx_t_7)) __PYX_ERR(4, 14, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_7);
    __pyx_t_8 = 0;
    {
      PyObject *__pyx_callargs[2] = {__pyx_t_5, __pyx_t_7};
      __pyx_t_1 = __Pyx_PyObject_FastCallMethod(__pyx_mstate_global->__pyx_n_u_update, __pyx_callargs+__pyx_t_8, (2-__pyx_t_8) | (1*__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_1)) __PYX_ERR(4, 14, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_1);
    }
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

    /* "(tree fragment)":13
 * cdef __pyx_unpickle_VariantRecordSamples__set_state(VariantRecordSamples __pyx_result, tuple __pyx_state):
 *     __pyx_result.record = __pyx_state[0]
 *     if len(__pyx_state) > 1 and hasattr(__pyx_result, '__dict__'):             # <<<<<<<<<<<<<<
 *         __pyx_result.__dict__.update(__pyx_state[1])
*/
  }

  /* "(tree fragment)":11
 *         __pyx_unpickle_VariantRecordSamples__set_state(<VariantRecordSamples> __pyx_result, __pyx_state)
 *     return __pyx_result
 * cdef __pyx_unpickle_VariantRecordSamples__set_state(VariantRecordSamples __pyx_result, tuple __pyx_state):             # <<<<<<<<<<<<<<
 *     __pyx_result.record = __pyx_state[0]
 *     if len(__pyx_state) > 1 and hasattr(__pyx_result, '__dict__'):
*/

  /* function exit code */
  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  __Pyx_TraceReturnValue(__pyx_r, 0, 0, __PYX_ERR(4, 11, __pyx_L1_error));
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_5);
  __Pyx_XDECREF(__pyx_t_6);
  __Pyx_XDECREF(__pyx_t_7);
  __Pyx_TraceException(__pyx_lineno, 0, 0);
  #if CYTHON_USE_SYS_MONITORING
  __Pyx_TraceExceptionUnwind(0, 0);
  #else
  __Pyx_TraceReturnValue(NULL, 0, 0, __PYX_ERR(4, 11, __pyx_L1_error));
  #endif
  __Pyx_AddTraceback("pysam.libcbcf.__pyx_unpickle_VariantRecordSamples__set_state", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_PyMonitoring_ExitScope(0);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "(tree fragment)":1
 * def __pyx_unpickle_VariantRecordSample(__pyx_type, long __pyx_checksum, __pyx_state):             # <<<<<<<<<<<<<<
 *     cdef object __pyx_PickleError
 *     cdef object __pyx_result
*/

/* Python wrapper */
static PyObject *__pyx_pw_5pysam_7libcbcf_21__pyx_unpickle_VariantRecordSample(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_5pysam_7libcbcf_20__pyx_unpickle_VariantRecordSample, "__pyx_unpickle_VariantRecordSample(__pyx_type, long __pyx_checksum, __pyx_state)");
static PyMethodDef __pyx_mdef_5pysam_7libcbcf_21__pyx_unpickle_VariantRecordSample = {"__pyx_unpickle_VariantRecordSample", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_5pysam_7libcbcf_21__pyx_unpickle_VariantRecordSample, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_5pysam_7libcbcf_20__pyx_unpickle_VariantRecordSample};
static PyObject *__pyx_pw_5pysam_7libcbcf_21__pyx_unpickle_VariantRecordSample(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_VariantRecordSample (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(4, 1, __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(4, 1, __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(4, 1, __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(4, 1, __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_VariantRecordSample", 0) < 0) __PYX_ERR(4, 1, __pyx_L3_error)
      for (Py_ssize_t i = __pyx_nargs; i < 3; i++) {
        if (unlikely(!values[i])) { __Pyx_RaiseArgtupleInvalid("__pyx_unpickle_VariantRecordSample", 1, 3, 3, i); __PYX_ERR(4, 1, __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(4, 1, __pyx_L3_error)
      values[1] = __Pyx_ArgRef_FASTCALL(__pyx_args, 1);
      if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[1])) __PYX_ERR(4, 1, __pyx_L3_error)
      values[2] = __Pyx_ArgRef_FASTCALL(__pyx_args, 2);
      if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[2])) __PYX_ERR(4, 1, __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(4, 1, __pyx_L3_error)
    __pyx_v___pyx_state = values[2];
  }
  goto __pyx_L6_skip;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("__pyx_unpickle_VariantRecordSample", 1, 3, 3, __pyx_nargs); __PYX_ERR(4, 1, __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("pysam.libcbcf.__pyx_unpickle_VariantRecordSample", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_5pysam_7libcbcf_20__pyx_unpickle_VariantRecordSample(__pyx_self, __pyx_v___pyx_type, __pyx_v___pyx_checksum, __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_5pysam_7libcbcf_20__pyx_unpickle_VariantRecordSample(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v___pyx_type, long __pyx_v___pyx_checksum, PyObject *__pyx_v___pyx_state) {
  PyObject *__pyx_v___pyx_PickleError = 0;
  PyObject *__pyx_v___pyx_result = 0;
  PyObject *__pyx_r = NULL;
  __Pyx_TraceDeclarationsFunc
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_t_2;
  PyObject *__pyx_t_3 = NULL;
  size_t __pyx_t_4;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_TraceFrameInit(((PyObject *)__pyx_mstate_global->__pyx_codeobj_tab[408]))
  __Pyx_RefNannySetupContext("__pyx_unpickle_VariantRecordSample", 0);
  __Pyx_TraceStartFunc("__pyx_unpickle_VariantRecordSample", __pyx_f[4], 1, 0, 0, 0, __PYX_ERR(4, 1, __pyx_L1_error));

  /* "(tree fragment)":4
 *     cdef object __pyx_PickleError
 *     cdef object __pyx_result
 *     if __pyx_checksum not in (0xeeb89f3, 0x59cf0f7, 0x5d6ff7b):             # <<<<<<<<<<<<<<
 *         from pickle import PickleError as __pyx_PickleError
 *         raise __pyx_PickleError, "Incompatible checksums (0x%x vs (0xeeb89f3, 0x59cf0f7, 0x5d6ff7b) = (index, record))" % __pyx_checksum
*/
  __pyx_t_1 = __Pyx_PyLong_From_long(__pyx_v___pyx_checksum); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 4, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_2 = (__Pyx_PySequence_ContainsTF(__pyx_t_1, __pyx_mstate_global->__pyx_tuple[6], Py_NE)); if (unlikely((__pyx_t_2 < 0))) __PYX_ERR(4, 4, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  if (__pyx_t_2) {

    /* "(tree fragment)":5
 *     cdef object __pyx_result
 *     if __pyx_checksum not in (0xeeb89f3, 0x59cf0f7, 0x5d6ff7b):
 *         from pickle import PickleError as __pyx_PickleError             # <<<<<<<<<<<<<<
 *         raise __pyx_PickleError, "Incompatible checksums (0x%x vs (0xeeb89f3, 0x59cf0f7, 0x5d6ff7b) = (index, record))" % __pyx_checksum
 *     __pyx_result = VariantRecordSample.__new__(__pyx_type)
*/
    __pyx_t_1 = PyList_New(1); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 5, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_INCREF(__pyx_mstate_global->__pyx_n_u_PickleError);
    __Pyx_GIVEREF(__pyx_mstate_global->__pyx_n_u_PickleError);
    if (__Pyx_PyList_SET_ITEM(__pyx_t_1, 0, __pyx_mstate_global->__pyx_n_u_PickleError) != (0)) __PYX_ERR(4, 5, __pyx_L1_error);
    __pyx_t_3 = __Pyx_Import(__pyx_mstate_global->__pyx_n_u_pickle, __pyx_t_1, 0); if (unlikely(!__pyx_t_3)) __PYX_ERR(4, 5, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    __pyx_t_1 = __Pyx_ImportFrom(__pyx_t_3, __pyx_mstate_global->__pyx_n_u_PickleError); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 5, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_INCREF(__pyx_t_1);
    __pyx_v___pyx_PickleError = __pyx_t_1;
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;

    /* "(tree fragment)":6
 *     if __pyx_checksum not in (0xeeb89f3, 0x59cf0f7, 0x5d6ff7b):
 *         from pickle import PickleError as __pyx_PickleError
 *         raise __pyx_PickleError, "Incompatible checksums (0x%x vs (0xeeb89f3, 0x59cf0f7, 0x5d6ff7b) = (index, record))" % __pyx_checksum             # <<<<<<<<<<<<<<
 *     __pyx_result = VariantRecordSample.__new__(__pyx_type)
 *     if __pyx_state is not None:
*/
    __pyx_t_3 = __Pyx_PyLong_From_long(__pyx_v___pyx_checksum); if (unlikely(!__pyx_t_3)) __PYX_ERR(4, 6, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __pyx_t_1 = PyUnicode_Format(__pyx_mstate_global->__pyx_kp_u_Incompatible_checksums_0x_x_vs_0_6, __pyx_t_3); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 6, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    __Pyx_Raise(__pyx_v___pyx_PickleError, __pyx_t_1, 0, 0);
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    __PYX_ERR(4, 6, __pyx_L1_error)

    /* "(tree fragment)":4
 *     cdef object __pyx_PickleError
 *     cdef object __pyx_result
 *     if __pyx_checksum not in (0xeeb89f3, 0x59cf0f7, 0x5d6ff7b):             # <<<<<<<<<<<<<<
 *         from pickle import PickleError as __pyx_PickleError
 *         raise __pyx_PickleError, "Incompatible checksums (0x%x vs (0xeeb89f3, 0x59cf0f7, 0x5d6ff7b) = (index, record))" % __pyx_checksum
*/
  }

  /* "(tree fragment)":7
 *         from pickle import PickleError as __pyx_PickleError
 *         raise __pyx_PickleError, "Incompatible checksums (0x%x vs (0xeeb89f3, 0x59cf0f7, 0x5d6ff7b) = (index, record))" % __pyx_checksum
 *     __pyx_result = VariantRecordSample.__new__(__pyx_type)             # <<<<<<<<<<<<<<
 *     if __pyx_state is not None:
 *         __pyx_unpickle_VariantRecordSample__set_state(<VariantRecordSample> __pyx_result, __pyx_state)
*/
  __pyx_t_3 = ((PyObject *)__pyx_mstate_global->__pyx_ptype_5pysam_7libcbcf_VariantRecordSample);
  __Pyx_INCREF(__pyx_t_3);
  __pyx_t_4 = 0;
  {
    PyObject *__pyx_callargs[2] = {__pyx_t_3, __pyx_v___pyx_type};
    __pyx_t_1 = __Pyx_PyObject_FastCallMethod(__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_1)) __PYX_ERR(4, 7, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
  }
  __pyx_v___pyx_result = __pyx_t_1;
  __pyx_t_1 = 0;

  /* "(tree fragment)":8
 *         raise __pyx_PickleError, "Incompatible checksums (0x%x vs (0xeeb89f3, 0x59cf0f7, 0x5d6ff7b) = (index, record))" % __pyx_checksum
 *     __pyx_result = VariantRecordSample.__new__(__pyx_type)
 *     if __pyx_state is not None:             # <<<<<<<<<<<<<<
 *         __pyx_unpickle_VariantRecordSample__set_state(<VariantRecordSample> __pyx_result, __pyx_state)
 *     return __pyx_result
*/
  __pyx_t_2 = (__pyx_v___pyx_state != Py_None);
  if (__pyx_t_2) {

    /* "(tree fragment)":9
 *     __pyx_result = VariantRecordSample.__new__(__pyx_type)
 *     if __pyx_state is not None:
 *         __pyx_unpickle_VariantRecordSample__set_state(<VariantRecordSample> __pyx_result, __pyx_state)             # <<<<<<<<<<<<<<
 *     return __pyx_result
 * cdef __pyx_unpickle_VariantRecordSample__set_state(VariantRecordSample __pyx_result, tuple __pyx_state):
*/
    if (!(likely(PyTuple_CheckExact(__pyx_v___pyx_state))||((__pyx_v___pyx_state) == Py_None) || __Pyx_RaiseUnexpectedTypeError("tuple", __pyx_v___pyx_state))) __PYX_ERR(4, 9, __pyx_L1_error)
    __pyx_t_1 = __pyx_f_5pysam_7libcbcf___pyx_unpickle_VariantRecordSample__set_state(((struct __pyx_obj_5pysam_7libcbcf_VariantRecordSample *)__pyx_v___pyx_result), ((PyObject*)__pyx_v___pyx_state)); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 9, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

    /* "(tree fragment)":8
 *         raise __pyx_PickleError, "Incompatible checksums (0x%x vs (0xeeb89f3, 0x59cf0f7, 0x5d6ff7b) = (index, record))" % __pyx_checksum
 *     __pyx_result = VariantRecordSample.__new__(__pyx_type)
 *     if __pyx_state is not None:             # <<<<<<<<<<<<<<
 *         __pyx_unpickle_VariantRecordSample__set_state(<VariantRecordSample> __pyx_result, __pyx_state)
 *     return __pyx_result
*/
  }

  /* "(tree fragment)":10
 *     if __pyx_state is not None:
 *         __pyx_unpickle_VariantRecordSample__set_state(<VariantRecordSample> __pyx_result, __pyx_state)
 *     return __pyx_result             # <<<<<<<<<<<<<<
 * cdef __pyx_unpickle_VariantRecordSample__set_state(VariantRecordSample __pyx_result, tuple __pyx_state):
 *     __pyx_result.index = __pyx_state[0]; __pyx_result.record = __pyx_state[1]
*/
  __Pyx_XDECREF(__pyx_r);
  __Pyx_INCREF(__pyx_v___pyx_result);
  __pyx_r = __pyx_v___pyx_result;
  __Pyx_TraceReturnValue(__pyx_r, 29, 0, __PYX_ERR(4, 10, __pyx_L1_error));
  goto __pyx_L0;

  /* "(tree fragment)":1
 * def __pyx_unpickle_VariantRecordSample(__pyx_type, long __pyx_checksum, __pyx_state):             # <<<<<<<<<<<<<<
 *     cdef object __pyx_PickleError
 *     cdef object __pyx_result
*/

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_TraceException(__pyx_lineno, 0, 0);
  #if CYTHON_USE_SYS_MONITORING
  __Pyx_TraceExceptionUnwind(0, 0);
  #else
  __Pyx_TraceReturnValue(NULL, 0, 0, __PYX_ERR(4, 1, __pyx_L1_error));
  #endif
  __Pyx_AddTraceback("pysam.libcbcf.__pyx_unpickle_VariantRecordSample", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v___pyx_PickleError);
  __Pyx_XDECREF(__pyx_v___pyx_result);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_PyMonitoring_ExitScope(0);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "(tree fragment)":11
 *         __pyx_unpickle_VariantRecordSample__set_state(<VariantRecordSample> __pyx_result, __pyx_state)
 *     return __pyx_result
 * cdef __pyx_unpickle_VariantRecordSample__set_state(VariantRecordSample __pyx_result, tuple __pyx_state):             # <<<<<<<<<<<<<<
 *     __pyx_result.index = __pyx_state[0]; __pyx_result.record = __pyx_state[1]
 *     if len(__pyx_state) > 2 and hasattr(__pyx_result, '__dict__'):
*/

static PyObject *__pyx_f_5pysam_7libcbcf___pyx_unpickle_VariantRecordSample__set_state(struct __pyx_obj_5pysam_7libcbcf_VariantRecordSample *__pyx_v___pyx_result, PyObject *__pyx_v___pyx_state) {
  PyObject *__pyx_r = NULL;
  __Pyx_TraceDeclarationsFunc
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int32_t __pyx_t_2;
  int __pyx_t_3;
  Py_ssize_t __pyx_t_4;
  int __pyx_t_5;
  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_TraceFrameInit(((PyObject *)__pyx_mstate_global->__pyx_codeobj_tab[409]))
  __Pyx_RefNannySetupContext("__pyx_unpickle_VariantRecordSample__set_state", 0);
  __Pyx_TraceStartFunc("__pyx_unpickle_VariantRecordSample__set_state", __pyx_f[4], 11, 0, 0, 0, __PYX_ERR(4, 11, __pyx_L1_error));

  /* "(tree fragment)":12
 *     return __pyx_result
 * cdef __pyx_unpickle_VariantRecordSample__set_state(VariantRecordSample __pyx_result, tuple __pyx_state):
 *     __pyx_result.index = __pyx_state[0]; __pyx_result.record = __pyx_state[1]             # <<<<<<<<<<<<<<
 *     if len(__pyx_state) > 2 and hasattr(__pyx_result, '__dict__'):
 *         __pyx_result.__dict__.update(__pyx_state[2])
*/
  if (unlikely(__pyx_v___pyx_state == Py_None)) {
    PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable");
    __PYX_ERR(4, 12, __pyx_L1_error)
  }
  __pyx_t_1 = __Pyx_GetItemInt_Tuple(__pyx_v___pyx_state, 0, long, 1, __Pyx_PyLong_From_long, 0, 0, 1, 1); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 12, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_2 = __Pyx_PyLong_As_int32_t(__pyx_t_1); if (unlikely((__pyx_t_2 == ((int32_t)-1)) && PyErr_Occurred())) __PYX_ERR(4, 12, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_v___pyx_result->index = __pyx_t_2;
  if (unlikely(__pyx_v___pyx_state == Py_None)) {
    PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable");
    __PYX_ERR(4, 12, __pyx_L1_error)
  }
  __pyx_t_1 = __Pyx_GetItemInt_Tuple(__pyx_v___pyx_state, 1, long, 1, __Pyx_PyLong_From_long, 0, 0, 1, 1); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 12, __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_5pysam_7libcbcf_VariantRecord))))) __PYX_ERR(4, 12, __pyx_L1_error)
  __Pyx_GIVEREF(__pyx_t_1);
  __Pyx_GOTREF((PyObject *)__pyx_v___pyx_result->record);
  __Pyx_DECREF((PyObject *)__pyx_v___pyx_result->record);
  __pyx_v___pyx_result->record = ((struct __pyx_obj_5pysam_7libcbcf_VariantRecord *)__pyx_t_1);
  __pyx_t_1 = 0;

  /* "(tree fragment)":13
 * cdef __pyx_unpickle_VariantRecordSample__set_state(VariantRecordSample __pyx_result, tuple __pyx_state):
 *     __pyx_result.index = __pyx_state[0]; __pyx_result.record = __pyx_state[1]
 *     if len(__pyx_state) > 2 and hasattr(__pyx_result, '__dict__'):             # <<<<<<<<<<<<<<
 *         __pyx_result.__dict__.update(__pyx_state[2])
*/
  if (unlikely(__pyx_v___pyx_state == Py_None)) {
    PyErr_SetString(PyExc_TypeError, "object of type 'NoneType' has no len()");
    __PYX_ERR(4, 13, __pyx_L1_error)
  }
  __pyx_t_4 = __Pyx_PyTuple_GET_SIZE(__pyx_v___pyx_state); if (unlikely(__pyx_t_4 == ((Py_ssize_t)-1))) __PYX_ERR(4, 13, __pyx_L1_error)
  __pyx_t_5 = (__pyx_t_4 > 2);
  if (__pyx_t_5) {
  } else {
    __pyx_t_3 = __pyx_t_5;
    goto __pyx_L4_bool_binop_done;
  }
  __pyx_t_5 = __Pyx_HasAttr(((PyObject *)__pyx_v___pyx_result), __pyx_mstate_global->__pyx_n_u_dict); if (unlikely(__pyx_t_5 == ((int)-1))) __PYX_ERR(4, 13, __pyx_L1_error)
  __pyx_t_3 = __pyx_t_5;
  __pyx_L4_bool_binop_done:;
  if (__pyx_t_3) {

    /* "(tree fragment)":14
 *     __pyx_result.index = __pyx_state[0]; __pyx_result.record = __pyx_state[1]
 *     if len(__pyx_state) > 2 and hasattr(__pyx_result, '__dict__'):
 *         __pyx_result.__dict__.update(__pyx_state[2])             # <<<<<<<<<<<<<<
*/
    __pyx_t_7 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v___pyx_result), __pyx_mstate_global->__pyx_n_u_dict); if (unlikely(!__pyx_t_7)) __PYX_ERR(4, 14, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_7);
    __pyx_t_6 = __pyx_t_7;
    __Pyx_INCREF(__pyx_t_6);
    if (unlikely(__pyx_v___pyx_state == Py_None)) {
      PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable");
      __PYX_ERR(4, 14, __pyx_L1_error)
    }
    __pyx_t_8 = __Pyx_GetItemInt_Tuple(__pyx_v___pyx_state, 2, long, 1, __Pyx_PyLong_From_long, 0, 0, 1, 1); if (unlikely(!__pyx_t_8)) __PYX_ERR(4, 14, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_8);
    __pyx_t_9 = 0;
    {
      PyObject *__pyx_callargs[2] = {__pyx_t_6, __pyx_t_8};
      __pyx_t_1 = __Pyx_PyObject_FastCallMethod(__pyx_mstate_global->__pyx_n_u_update, __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;
      __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
      if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 14, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_1);
    }
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

    /* "(tree fragment)":13
 * cdef __pyx_unpickle_VariantRecordSample__set_state(VariantRecordSample __pyx_result, tuple __pyx_state):
 *     __pyx_result.index = __pyx_state[0]; __pyx_result.record = __pyx_state[1]
 *     if len(__pyx_state) > 2 and hasattr(__pyx_result, '__dict__'):             # <<<<<<<<<<<<<<
 *         __pyx_result.__dict__.update(__pyx_state[2])
*/
  }

  /* "(tree fragment)":11
 *         __pyx_unpickle_VariantRecordSample__set_state(<VariantRecordSample> __pyx_result, __pyx_state)
 *     return __pyx_result
 * cdef __pyx_unpickle_VariantRecordSample__set_state(VariantRecordSample __pyx_result, tuple __pyx_state):             # <<<<<<<<<<<<<<
 *     __pyx_result.index = __pyx_state[0]; __pyx_result.record = __pyx_state[1]
 *     if len(__pyx_state) > 2 and hasattr(__pyx_result, '__dict__'):
*/

  /* function exit code */
  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  __Pyx_TraceReturnValue(__pyx_r, 0, 0, __PYX_ERR(4, 11, __pyx_L1_error));
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_6);
  __Pyx_XDECREF(__pyx_t_7);
  __Pyx_XDECREF(__pyx_t_8);
  __Pyx_TraceException(__pyx_lineno, 0, 0);
  #if CYTHON_USE_SYS_MONITORING
  __Pyx_TraceExceptionUnwind(0, 0);
  #else
  __Pyx_TraceReturnValue(NULL, 0, 0, __PYX_ERR(4, 11, __pyx_L1_error));
  #endif
  __Pyx_AddTraceback("pysam.libcbcf.__pyx_unpickle_VariantRecordSample__set_state", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_PyMonitoring_ExitScope(0);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "(tree fragment)":1
 * def __pyx_unpickle_BaseIndex(__pyx_type, long __pyx_checksum, __pyx_state):             # <<<<<<<<<<<<<<
 *     cdef object __pyx_PickleError
 *     cdef object __pyx_result
*/

/* Python wrapper */
static PyObject *__pyx_pw_5pysam_7libcbcf_23__pyx_unpickle_BaseIndex(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_5pysam_7libcbcf_22__pyx_unpickle_BaseIndex, "__pyx_unpickle_BaseIndex(__pyx_type, long __pyx_checksum, __pyx_state)");
static PyMethodDef __pyx_mdef_5pysam_7libcbcf_23__pyx_unpickle_BaseIndex = {"__pyx_unpickle_BaseIndex", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_5pysam_7libcbcf_23__pyx_unpickle_BaseIndex, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_5pysam_7libcbcf_22__pyx_unpickle_BaseIndex};
static PyObject *__pyx_pw_5pysam_7libcbcf_23__pyx_unpickle_BaseIndex(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_BaseIndex (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(4, 1, __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(4, 1, __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(4, 1, __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(4, 1, __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_BaseIndex", 0) < 0) __PYX_ERR(4, 1, __pyx_L3_error)
      for (Py_ssize_t i = __pyx_nargs; i < 3; i++) {
        if (unlikely(!values[i])) { __Pyx_RaiseArgtupleInvalid("__pyx_unpickle_BaseIndex", 1, 3, 3, i); __PYX_ERR(4, 1, __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(4, 1, __pyx_L3_error)
      values[1] = __Pyx_ArgRef_FASTCALL(__pyx_args, 1);
      if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[1])) __PYX_ERR(4, 1, __pyx_L3_error)
      values[2] = __Pyx_ArgRef_FASTCALL(__pyx_args, 2);
      if (!CYTHON_ASSUME_SAFE_MACROS && unlikely(!values[2])) __PYX_ERR(4, 1, __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(4, 1, __pyx_L3_error)
    __pyx_v___pyx_state = values[2];
  }
  goto __pyx_L6_skip;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("__pyx_unpickle_BaseIndex", 1, 3, 3, __pyx_nargs); __PYX_ERR(4, 1, __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("pysam.libcbcf.__pyx_unpickle_BaseIndex", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_5pysam_7libcbcf_22__pyx_unpickle_BaseIndex(__pyx_self, __pyx_v___pyx_type, __pyx_v___pyx_checksum, __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_5pysam_7libcbcf_22__pyx_unpickle_BaseIndex(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v___pyx_type, long __pyx_v___pyx_checksum, PyObject *__pyx_v___pyx_state) {
  PyObject *__pyx_v___pyx_PickleError = 0;
  PyObject *__pyx_v___pyx_result = 0;
  PyObject *__pyx_r = NULL;
  __Pyx_TraceDeclarationsFunc
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_t_2;
  PyObject *__pyx_t_3 = NULL;
  size_t __pyx_t_4;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_TraceFrameInit(((PyObject *)__pyx_mstate_global->__pyx_codeobj_tab[410]))
  __Pyx_RefNannySetupContext("__pyx_unpickle_BaseIndex", 0);
  __Pyx_TraceStartFunc("__pyx_unpickle_BaseIndex", __pyx_f[4], 1, 0, 0, 0, __PYX_ERR(4, 1, __pyx_L1_error));

  /* "(tree fragment)":4
 *     cdef object __pyx_PickleError
 *     cdef object __pyx_result
 *     if __pyx_checksum not in (0x7898a51, 0x1fe4488, 0xd936de3):             # <<<<<<<<<<<<<<
 *         from pickle import PickleError as __pyx_PickleError
 *         raise __pyx_PickleError, "Incompatible checksums (0x%x vs (0x7898a51, 0x1fe4488, 0xd936de3) = (refmap, refs))" % __pyx_checksum
*/
  __pyx_t_1 = __Pyx_PyLong_From_long(__pyx_v___pyx_checksum); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 4, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_2 = (__Pyx_PySequence_ContainsTF(__pyx_t_1, __pyx_mstate_global->__pyx_tuple[7], Py_NE)); if (unlikely((__pyx_t_2 < 0))) __PYX_ERR(4, 4, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  if (__pyx_t_2) {

    /* "(tree fragment)":5
 *     cdef object __pyx_result
 *     if __pyx_checksum not in (0x7898a51, 0x1fe4488, 0xd936de3):
 *         from pickle import PickleError as __pyx_PickleError             # <<<<<<<<<<<<<<
 *         raise __pyx_PickleError, "Incompatible checksums (0x%x vs (0x7898a51, 0x1fe4488, 0xd936de3) = (refmap, refs))" % __pyx_checksum
 *     __pyx_result = BaseIndex.__new__(__pyx_type)
*/
    __pyx_t_1 = PyList_New(1); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 5, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_INCREF(__pyx_mstate_global->__pyx_n_u_PickleError);
    __Pyx_GIVEREF(__pyx_mstate_global->__pyx_n_u_PickleError);
    if (__Pyx_PyList_SET_ITEM(__pyx_t_1, 0, __pyx_mstate_global->__pyx_n_u_PickleError) != (0)) __PYX_ERR(4, 5, __pyx_L1_error);
    __pyx_t_3 = __Pyx_Import(__pyx_mstate_global->__pyx_n_u_pickle, __pyx_t_1, 0); if (unlikely(!__pyx_t_3)) __PYX_ERR(4, 5, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    __pyx_t_1 = __Pyx_ImportFrom(__pyx_t_3, __pyx_mstate_global->__pyx_n_u_PickleError); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 5, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_INCREF(__pyx_t_1);
    __pyx_v___pyx_PickleError = __pyx_t_1;
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;

    /* "(tree fragment)":6
 *     if __pyx_checksum not in (0x7898a51, 0x1fe4488, 0xd936de3):
 *         from pickle import PickleError as __pyx_PickleError
 *         raise __pyx_PickleError, "Incompatible checksums (0x%x vs (0x7898a51, 0x1fe4488, 0xd936de3) = (refmap, refs))" % __pyx_checksum             # <<<<<<<<<<<<<<
 *     __pyx_result = BaseIndex.__new__(__pyx_type)
 *     if __pyx_state is not None:
*/
    __pyx_t_3 = __Pyx_PyLong_From_long(__pyx_v___pyx_checksum); if (unlikely(!__pyx_t_3)) __PYX_ERR(4, 6, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __pyx_t_1 = PyUnicode_Format(__pyx_mstate_global->__pyx_kp_u_Incompatible_checksums_0x_x_vs_0_7, __pyx_t_3); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 6, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    __Pyx_Raise(__pyx_v___pyx_PickleError, __pyx_t_1, 0, 0);
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    __PYX_ERR(4, 6, __pyx_L1_error)

    /* "(tree fragment)":4
 *     cdef object __pyx_PickleError
 *     cdef object __pyx_result
 *     if __pyx_checksum not in (0x7898a51, 0x1fe4488, 0xd936de3):             # <<<<<<<<<<<<<<
 *         from pickle import PickleError as __pyx_PickleError
 *         raise __pyx_PickleError, "Incompatible checksums (0x%x vs (0x7898a51, 0x1fe4488, 0xd936de3) = (refmap, refs))" % __pyx_checksum
*/
  }

  /* "(tree fragment)":7
 *         from pickle import PickleError as __pyx_PickleError
 *         raise __pyx_PickleError, "Incompatible checksums (0x%x vs (0x7898a51, 0x1fe4488, 0xd936de3) = (refmap, refs))" % __pyx_checksum
 *     __pyx_result = BaseIndex.__new__(__pyx_type)             # <<<<<<<<<<<<<<
 *     if __pyx_state is not None:
 *         __pyx_unpickle_BaseIndex__set_state(<BaseIndex> __pyx_result, __pyx_state)
*/
  __pyx_t_3 = ((PyObject *)__pyx_mstate_global->__pyx_ptype_5pysam_7libcbcf_BaseIndex);
  __Pyx_INCREF(__pyx_t_3);
  __pyx_t_4 = 0;
  {
    PyObject *__pyx_callargs[2] = {__pyx_t_3, __pyx_v___pyx_type};
    __pyx_t_1 = __Pyx_PyObject_FastCallMethod(__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_1)) __PYX_ERR(4, 7, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
  }
  __pyx_v___pyx_result = __pyx_t_1;
  __pyx_t_1 = 0;

  /* "(tree fragment)":8
 *         raise __pyx_PickleError, "Incompatible checksums (0x%x vs (0x7898a51, 0x1fe4488, 0xd936de3) = (refmap, refs))" % __pyx_checksum
 *     __pyx_result = BaseIndex.__new__(__pyx_type)
 *     if __pyx_state is not None:             # <<<<<<<<<<<<<<
 *         __pyx_unpickle_BaseIndex__set_state(<BaseIndex> __pyx_result, __pyx_state)
 *     return __pyx_result
*/
  __pyx_t_2 = (__pyx_v___pyx_state != Py_None);
  if (__pyx_t_2) {

    /* "(tree fragment)":9
 *     __pyx_result = BaseIndex.__new__(__pyx_type)
 *     if __pyx_state is not None:
 *         __pyx_unpickle_BaseIndex__set_state(<BaseIndex> __pyx_result, __pyx_state)             # <<<<<<<<<<<<<<
 *     return __pyx_result
 * cdef __pyx_unpickle_BaseIndex__set_state(BaseIndex __pyx_result, tuple __pyx_state):
*/
    if (!(likely(PyTuple_CheckExact(__pyx_v___pyx_state))||((__pyx_v___pyx_state) == Py_None) || __Pyx_RaiseUnexpectedTypeError("tuple", __pyx_v___pyx_state))) __PYX_ERR(4, 9, __pyx_L1_error)
    __pyx_t_1 = __pyx_f_5pysam_7libcbcf___pyx_unpickle_BaseIndex__set_state(((struct __pyx_obj_5pysam_7libcbcf_BaseIndex *)__pyx_v___pyx_result), ((PyObject*)__pyx_v___pyx_state)); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 9, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

    /* "(tree fragment)":8
 *         raise __pyx_PickleError, "Incompatible checksums (0x%x vs (0x7898a51, 0x1fe4488, 0xd936de3) = (refmap, refs))" % __pyx_checksum
 *     __pyx_result = BaseIndex.__new__(__pyx_type)
 *     if __pyx_state is not None:             # <<<<<<<<<<<<<<
 *         __pyx_unpickle_BaseIndex__set_state(<BaseIndex> __pyx_result, __pyx_state)
 *     return __pyx_result
*/
  }

  /* "(tree fragment)":10
 *     if __pyx_state is not None:
 *         __pyx_unpickle_BaseIndex__set_state(<BaseIndex> __pyx_result, __pyx_state)
 *     return __pyx_result             # <<<<<<<<<<<<<<
 * cdef __pyx_unpickle_BaseIndex__set_state(BaseIndex __pyx_result, tuple __pyx_state):
 *     __pyx_result.refmap = __pyx_state[0]; __pyx_result.refs = __pyx_state[1]
*/
  __Pyx_XDECREF(__pyx_r);
  __Pyx_INCREF(__pyx_v___pyx_result);
  __pyx_r = __pyx_v___pyx_result;
  __Pyx_TraceReturnValue(__pyx_r, 29, 0, __PYX_ERR(4, 10, __pyx_L1_error));
  goto __pyx_L0;

  /* "(tree fragment)":1
 * def __pyx_unpickle_BaseIndex(__pyx_type, long __pyx_checksum, __pyx_state):             # <<<<<<<<<<<<<<
 *     cdef object __pyx_PickleError
 *     cdef object __pyx_result
*/

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_TraceException(__pyx_lineno, 0, 0);
  #if CYTHON_USE_SYS_MONITORING
  __Pyx_TraceExceptionUnwind(0, 0);
  #else
  __Pyx_TraceReturnValue(NULL, 0, 0, __PYX_ERR(4, 1, __pyx_L1_error));
  #endif
  __Pyx_AddTraceback("pysam.libcbcf.__pyx_unpickle_BaseIndex", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v___pyx_PickleError);
  __Pyx_XDECREF(__pyx_v___pyx_result);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_PyMonitoring_ExitScope(0);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "(tree fragment)":11
 *         __pyx_unpickle_BaseIndex__set_state(<BaseIndex> __pyx_result, __pyx_state)
 *     return __pyx_result
 * cdef __pyx_unpickle_BaseIndex__set_state(BaseIndex __pyx_result, tuple __pyx_state):             # <<<<<<<<<<<<<<
 *     __pyx_result.refmap = __pyx_state[0]; __pyx_result.refs = __pyx_state[1]
 *     if len(__pyx_state) > 2 and hasattr(__pyx_result, '__dict__'):
*/

static PyObject *__pyx_f_5pysam_7libcbcf___pyx_unpickle_BaseIndex__set_state(struct __pyx_obj_5pysam_7libcbcf_BaseIndex *__pyx_v___pyx_result, PyObject *__pyx_v___pyx_state) {
  PyObject *__pyx_r = NULL;
  __Pyx_TraceDeclarationsFunc
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_t_2;
  Py_ssize_t __pyx_t_3;
  int __pyx_t_4;
  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_TraceFrameInit(((PyObject *)__pyx_mstate_global->__pyx_codeobj_tab[411]))
  __Pyx_RefNannySetupContext("__pyx_unpickle_BaseIndex__set_state", 0);
  __Pyx_TraceStartFunc("__pyx_unpickle_BaseIndex__set_state", __pyx_f[4], 11, 0, 0, 0, __PYX_ERR(4, 11, __pyx_L1_error));

  /* "(tree fragment)":12
 *     return __pyx_result
 * cdef __pyx_unpickle_BaseIndex__set_state(BaseIndex __pyx_result, tuple __pyx_state):
 *     __pyx_result.refmap = __pyx_state[0]; __pyx_result.refs = __pyx_state[1]             # <<<<<<<<<<<<<<
 *     if len(__pyx_state) > 2 and hasattr(__pyx_result, '__dict__'):
 *         __pyx_result.__dict__.update(__pyx_state[2])
*/
  if (unlikely(__pyx_v___pyx_state == Py_None)) {
    PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable");
    __PYX_ERR(4, 12, __pyx_L1_error)
  }
  __pyx_t_1 = __Pyx_GetItemInt_Tuple(__pyx_v___pyx_state, 0, long, 1, __Pyx_PyLong_From_long, 0, 0, 1, 1); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 12, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  if (!(likely(PyDict_CheckExact(__pyx_t_1))||((__pyx_t_1) == Py_None) || __Pyx_RaiseUnexpectedTypeError("dict", __pyx_t_1))) __PYX_ERR(4, 12, __pyx_L1_error)
  __Pyx_GIVEREF(__pyx_t_1);
  __Pyx_GOTREF(__pyx_v___pyx_result->refmap);
  __Pyx_DECREF(__pyx_v___pyx_result->refmap);
  __pyx_v___pyx_result->refmap = ((PyObject*)__pyx_t_1);
  __pyx_t_1 = 0;
  if (unlikely(__pyx_v___pyx_state == Py_None)) {
    PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable");
    __PYX_ERR(4, 12, __pyx_L1_error)
  }
  __pyx_t_1 = __Pyx_GetItemInt_Tuple(__pyx_v___pyx_state, 1, long, 1, __Pyx_PyLong_From_long, 0, 0, 1, 1); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 12, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  if (!(likely(PyTuple_CheckExact(__pyx_t_1))||((__pyx_t_1) == Py_None) || __Pyx_RaiseUnexpectedTypeError("tuple", __pyx_t_1))) __PYX_ERR(4, 12, __pyx_L1_error)
  __Pyx_GIVEREF(__pyx_t_1);
  __Pyx_GOTREF(__pyx_v___pyx_result->refs);
  __Pyx_DECREF(__pyx_v___pyx_result->refs);
  __pyx_v___pyx_result->refs = ((PyObject*)__pyx_t_1);
  __pyx_t_1 = 0;

  /* "(tree fragment)":13
 * cdef __pyx_unpickle_BaseIndex__set_state(BaseIndex __pyx_result, tuple __pyx_state):
 *     __pyx_result.refmap = __pyx_state[0]; __pyx_result.refs = __pyx_state[1]
 *     if len(__pyx_state) > 2 and hasattr(__pyx_result, '__dict__'):             # <<<<<<<<<<<<<<
 *         __pyx_result.__dict__.update(__pyx_state[2])
*/
  if (unlikely(__pyx_v___pyx_state == Py_None)) {
    PyErr_SetString(PyExc_TypeError, "object of type 'NoneType' has no len()");
    __PYX_ERR(4, 13, __pyx_L1_error)
  }
  __pyx_t_3 = __Pyx_PyTuple_GET_SIZE(__pyx_v___pyx_state); if (unlikely(__pyx_t_3 == ((Py_ssize_t)-1))) __PYX_ERR(4, 13, __pyx_L1_error)
  __pyx_t_4 = (__pyx_t_3 > 2);
  if (__pyx_t_4) {
  } else {
    __pyx_t_2 = __pyx_t_4;
    goto __pyx_L4_bool_binop_done;
  }
  __pyx_t_4 = __Pyx_HasAttr(((PyObject *)__pyx_v___pyx_result), __pyx_mstate_global->__pyx_n_u_dict); if (unlikely(__pyx_t_4 == ((int)-1))) __PYX_ERR(4, 13, __pyx_L1_error)
  __pyx_t_2 = __pyx_t_4;
  __pyx_L4_bool_binop_done:;
  if (__pyx_t_2) {

    /* "(tree fragment)":14
 *     __pyx_result.refmap = __pyx_state[0]; __pyx_result.refs = __pyx_state[1]
 *     if len(__pyx_state) > 2 and hasattr(__pyx_result, '__dict__'):
 *         __pyx_result.__dict__.update(__pyx_state[2])             # <<<<<<<<<<<<<<
*/
    __pyx_t_6 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v___pyx_result), __pyx_mstate_global->__pyx_n_u_dict); if (unlikely(!__pyx_t_6)) __PYX_ERR(4, 14, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_6);
    __pyx_t_5 = __pyx_t_6;
    __Pyx_INCREF(__pyx_t_5);
    if (unlikely(__pyx_v___pyx_state == Py_None)) {
      PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable");
      __PYX_ERR(4, 14, __pyx_L1_error)
    }
    __pyx_t_7 = __Pyx_GetItemInt_Tuple(__pyx_v___pyx_state, 2, long, 1, __Pyx_PyLong_From_long, 0, 0, 1, 1); if (unlikely(!__pyx_t_7)) __PYX_ERR(4, 14, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_7);
    __pyx_t_8 = 0;
    {
      PyObject *__pyx_callargs[2] = {__pyx_t_5, __pyx_t_7};
      __pyx_t_1 = __Pyx_PyObject_FastCallMethod(__pyx_mstate_global->__pyx_n_u_update, __pyx_callargs+__pyx_t_8, (2-__pyx_t_8) | (1*__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_1)) __PYX_ERR(4, 14, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_1);
    }
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

    /* "(tree fragment)":13
 * cdef __pyx_unpickle_BaseIndex__set_state(BaseIndex __pyx_result, tuple __pyx_state):
 *     __pyx_result.refmap = __pyx_state[0]; __pyx_result.refs = __pyx_state[1]
 *     if len(__pyx_state) > 2 and hasattr(__pyx_result, '__dict__'):             # <<<<<<<<<<<<<<
 *         __pyx_result.__dict__.update(__pyx_state[2])
*/
  }

  /* "(tree fragment)":11
 *         __pyx_unpickle_BaseIndex__set_state(<BaseIndex> __pyx_result, __pyx_state)
 *     return __pyx_result
 * cdef __pyx_unpickle_BaseIndex__set_state(BaseIndex __pyx_result, tuple __pyx_state):             # <<<<<<<<<<<<<<
 *     __pyx_result.refmap = __pyx_state[0]; __pyx_result.refs = __pyx_state[1]
 *     if len(__pyx_state) > 2 and hasattr(__pyx_result, '__dict__'):
*/

  /* function exit code */
  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  __Pyx_TraceReturnValue(__pyx_r, 0, 0, __PYX_ERR(4, 11, __pyx_L1_error));
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_5);
  __Pyx_XDECREF(__pyx_t_6);
  __Pyx_XDECREF(__pyx_t_7);
  __Pyx_TraceException(__pyx_lineno, 0, 0);
  #if CYTHON_USE_SYS_MONITORING
  __Pyx_TraceExceptionUnwind(0, 0);
  #else
  __Pyx_TraceReturnValue(NULL, 0, 0, __PYX_ERR(4, 11, __pyx_L1_error));
  #endif
  __Pyx_AddTraceback("pysam.libcbcf.__pyx_unpickle_BaseIndex__set_state", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_PyMonitoring_ExitScope(0);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}
/* #### Code section: module_exttypes ### */
static struct __pyx_vtabstruct_5pysam_7libcbcf_VariantHeader __pyx_vtable_5pysam_7libcbcf_VariantHeader;

static PyObject *__pyx_tp_new_5pysam_7libcbcf_VariantHeader(PyTypeObject *t, CYTHON_UNUSED PyObject *a, CYTHON_UNUSED PyObject *k) {
  struct __pyx_obj_5pysam_7libcbcf_VariantHeader *p;
  PyObject *o;
  #if CYTHON_COMPILING_IN_LIMITED_API
  allocfunc alloc_func = (allocfunc)PyType_GetSlot(t, Py_tp_alloc);
  o = alloc_func(t, 0);
  #else
  if (likely(!__Pyx_PyType_HasFeature(t, Py_TPFLAGS_IS_ABSTRACT))) {
    o = (*t->tp_alloc)(t, 0);
  } else {
    o = (PyObject *) PyBaseObject_Type.tp_new(t, __pyx_mstate_global->__pyx_empty_tuple, 0);
  }
  if (unlikely(!o)) return 0;
  #endif
  p = ((struct __pyx_obj_5pysam_7libcbcf_VariantHeader *)o);
  p->__pyx_vtab = __pyx_vtabptr_5pysam_7libcbcf_VariantHeader;
  if (unlikely(__pyx_pw_5pysam_7libcbcf_13VariantHeader_1__cinit__(o, __pyx_mstate_global->__pyx_empty_tuple, NULL) < 0)) goto bad;
  return o;
  bad:
  Py_DECREF(o); o = 0;
  return NULL;
}

static void __pyx_tp_dealloc_5pysam_7libcbcf_VariantHeader(PyObject *o) {
  #if CYTHON_USE_TP_FINALIZE
  if (unlikely((PY_VERSION_HEX >= 0x03080000 || __Pyx_PyType_HasFeature(Py_TYPE(o), Py_TPFLAGS_HAVE_FINALIZE)) && __Pyx_PyObject_GetSlot(o, tp_finalize, destructor)) && (!PyType_IS_GC(Py_TYPE(o)) || !__Pyx_PyObject_GC_IsFinalized(o))) {
    if (__Pyx_PyObject_GetSlot(o, tp_dealloc, destructor) == __pyx_tp_dealloc_5pysam_7libcbcf_VariantHeader) {
      if (PyObject_CallFinalizerFromDealloc(o)) return;
    }
  }
  #endif
  {
    PyObject *etype, *eval, *etb;
    PyErr_Fetch(&etype, &eval, &etb);
    __Pyx_SET_REFCNT(o, Py_REFCNT(o) + 1);
    __pyx_pw_5pysam_7libcbcf_13VariantHeader_5__dealloc__(o);
    __Pyx_SET_REFCNT(o, Py_REFCNT(o) - 1);
    PyErr_Restore(etype, eval, etb);
  }
  #if CYTHON_USE_TYPE_SLOTS
  (*Py_TYPE(o)->tp_free)(o);
  #else
  {
    freefunc tp_free = (freefunc)PyType_GetSlot(Py_TYPE(o), Py_tp_free);
    if (tp_free) tp_free(o);
  }
  #endif
}

static PyObject *__pyx_getprop_5pysam_7libcbcf_13VariantHeader_version(PyObject *o, CYTHON_UNUSED void *x) {
  return __pyx_pw_5pysam_7libcbcf_13VariantHeader_7version_1__get__(o);
}

static PyObject *__pyx_getprop_5pysam_7libcbcf_13VariantHeader_samples(PyObject *o, CYTHON_UNUSED void *x) {
  return __pyx_pw_5pysam_7libcbcf_13VariantHeader_7samples_1__get__(o);
}

static PyObject *__pyx_getprop_5pysam_7libcbcf_13VariantHeader_records(PyObject *o, CYTHON_UNUSED void *x) {
  return __pyx_pw_5pysam_7libcbcf_13VariantHeader_7records_1__get__(o);
}

static PyObject *__pyx_getprop_5pysam_7libcbcf_13VariantHeader_contigs(PyObject *o, CYTHON_UNUSED void *x) {
  return __pyx_pw_5pysam_7libcbcf_13VariantHeader_7contigs_1__get__(o);
}

static PyObject *__pyx_getprop_5pysam_7libcbcf_13VariantHeader_filters(PyObject *o, CYTHON_UNUSED void *x) {
  return __pyx_pw_5pysam_7libcbcf_13VariantHeader_7filters_1__get__(o);
}

static PyObject *__pyx_getprop_5pysam_7libcbcf_13VariantHeader_info(PyObject *o, CYTHON_UNUSED void *x) {
  return __pyx_pw_5pysam_7libcbcf_13VariantHeader_4info_1__get__(o);
}

static PyObject *__pyx_getprop_5pysam_7libcbcf_13VariantHeader_formats(PyObject *o, CYTHON_UNUSED void *x) {
  return __pyx_pw_5pysam_7libcbcf_13VariantHeader_7formats_1__get__(o);
}

static PyObject *__pyx_getprop_5pysam_7libcbcf_13VariantHeader_alts(PyObject *o, CYTHON_UNUSED void *x) {
  return __pyx_pw_5pysam_7libcbcf_13VariantHeader_4alts_1__get__(o);
}

static PyMethodDef __pyx_methods_5pysam_7libcbcf_VariantHeader[] = {
  {"copy", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_5pysam_7libcbcf_13VariantHeader_9copy, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_5pysam_7libcbcf_13VariantHeader_8copy},
  {"merge", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_5pysam_7libcbcf_13VariantHeader_11merge, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_5pysam_7libcbcf_13VariantHeader_10merge},
  {"new_record", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_5pysam_7libcbcf_13VariantHeader_15new_record, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_5pysam_7libcbcf_13VariantHeader_14new_record},
  {"add_record", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_5pysam_7libcbcf_13VariantHeader_17add_record, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_5pysam_7libcbcf_13VariantHeader_16add_record},
  {"add_line", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_5pysam_7libcbcf_13VariantHeader_19add_line, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_5pysam_7libcbcf_13VariantHeader_18add_line},
  {"add_meta", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_5pysam_7libcbcf_13VariantHeader_21add_meta, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_5pysam_7libcbcf_13VariantHeader_20add_meta},
  {"add_sample", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_5pysam_7libcbcf_13VariantHeader_23add_sample, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_5pysam_7libcbcf_13VariantHeader_22add_sample},
  {"add_samples", (PyCFunction)(void(*)(void))(PyCFunctionWithKeywords)__pyx_pw_5pysam_7libcbcf_13VariantHeader_25add_samples, METH_VARARGS|METH_KEYWORDS, __pyx_doc_5pysam_7libcbcf_13VariantHeader_24add_samples},
  {"__reduce_cython__", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_5pysam_7libcbcf_13VariantHeader_27__reduce_cython__, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_5pysam_7libcbcf_13VariantHeader_26__reduce_cython__},
  {"__setstate_cython__", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_5pysam_7libcbcf_13VariantHeader_29__setstate_cython__, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_5pysam_7libcbcf_13VariantHeader_28__setstate_cython__},
  {0, 0, 0, 0}
};

static struct PyGetSetDef __pyx_getsets_5pysam_7libcbcf_VariantHeader[] = {
  {"version", __pyx_getprop_5pysam_7libcbcf_13VariantHeader_version, 0, PyDoc_STR("VCF version"), 0},
  {"samples", __pyx_getprop_5pysam_7libcbcf_13VariantHeader_samples, 0, PyDoc_STR("samples (:class:`VariantHeaderSamples`)"), 0},
  {"records", __pyx_getprop_5pysam_7libcbcf_13VariantHeader_records, 0, PyDoc_STR("header records (:class:`VariantHeaderRecords`)"), 0},
  {"contigs", __pyx_getprop_5pysam_7libcbcf_13VariantHeader_contigs, 0, PyDoc_STR("contig information (:class:`VariantHeaderContigs`)"), 0},
  {"filters", __pyx_getprop_5pysam_7libcbcf_13VariantHeader_filters, 0, PyDoc_STR("filter metadata (:class:`VariantHeaderMetadata`)"), 0},
  {"info", __pyx_getprop_5pysam_7libcbcf_13VariantHeader_info, 0, PyDoc_STR("info metadata (:class:`VariantHeaderMetadata`)"), 0},
  {"formats", __pyx_getprop_5pysam_7libcbcf_13VariantHeader_formats, 0, PyDoc_STR("format metadata (:class:`VariantHeaderMetadata`)"), 0},
  {"alts", __pyx_getprop_5pysam_7libcbcf_13VariantHeader_alts, 0, PyDoc_STR("alt metadata (:class:`dict` ID->record).\n\n        The data returned just a snapshot of alt records, is created\n        every time the property is requested, and modifications will\n        not be reflected in the header metadata and vice versa.\n\n        i.e. it is just a dict that reflects the state of alt records\n        at the time it is created.\n        "), 0},
  {0, 0, 0, 0, 0}
};
#if CYTHON_USE_TYPE_SPECS
static PyType_Slot __pyx_type_5pysam_7libcbcf_VariantHeader_slots[] = {
  {Py_tp_dealloc, (void *)__pyx_tp_dealloc_5pysam_7libcbcf_VariantHeader},
  {Py_nb_bool, (void *)__pyx_pw_5pysam_7libcbcf_13VariantHeader_7__bool__},
  {Py_tp_str, (void *)__pyx_pw_5pysam_7libcbcf_13VariantHeader_13__str__},
  {Py_tp_doc, (void *)PyDoc_STR("VariantHeader()\n\nheader information for a :class:`VariantFile` object")},
  {Py_tp_methods, (void *)__pyx_methods_5pysam_7libcbcf_VariantHeader},
  {Py_tp_getset, (void *)__pyx_getsets_5pysam_7libcbcf_VariantHeader},
  {Py_tp_init, (void *)__pyx_pw_5pysam_7libcbcf_13VariantHeader_3__init__},
  {Py_tp_new, (void *)__pyx_tp_new_5pysam_7libcbcf_VariantHeader},
  {0, 0},
};
static PyType_Spec __pyx_type_5pysam_7libcbcf_VariantHeader_spec = {
  "pysam.libcbcf.VariantHeader",
  sizeof(struct __pyx_obj_5pysam_7libcbcf_VariantHeader),
  0,
  Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_VERSION_TAG|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_BASETYPE,
  __pyx_type_5pysam_7libcbcf_VariantHeader_slots,
};
#else

static PyNumberMethods __pyx_tp_as_number_VariantHeader = {
  0, /*nb_add*/
  0, /*nb_subtract*/
  0, /*nb_multiply*/
  0, /*nb_remainder*/
  0, /*nb_divmod*/
  0, /*nb_power*/
  0, /*nb_negative*/
  0, /*nb_positive*/
  0, /*nb_absolute*/
  __pyx_pw_5pysam_7libcbcf_13VariantHeader_7__bool__, /*nb_bool*/
  0, /*nb_invert*/
  0, /*nb_lshift*/
  0, /*nb_rshift*/
  0, /*nb_and*/
  0, /*nb_xor*/
  0, /*nb_or*/
  0, /*nb_int*/
  0, /*nb_long (reserved)*/
  0, /*nb_float*/
  0, /*nb_inplace_add*/
  0, /*nb_inplace_subtract*/
  0, /*nb_inplace_multiply*/
  0, /*nb_inplace_remainder*/
  0, /*nb_inplace_power*/
  0, /*nb_inplace_lshift*/
  0, /*nb_inplace_rshift*/
  0, /*nb_inplace_and*/
  0, /*nb_inplace_xor*/
  0, /*nb_inplace_or*/
  0, /*nb_floor_divide*/
  0, /*nb_true_divide*/
  0, /*nb_inplace_floor_divide*/
  0, /*nb_inplace_true_divide*/
  0, /*nb_index*/
  0, /*nb_matrix_multiply*/
  0, /*nb_inplace_matrix_multiply*/
};

static PyTypeObject __pyx_type_5pysam_7libcbcf_VariantHeader = {
  PyVarObject_HEAD_INIT(0, 0)
  "pysam.libcbcf.""VariantHeader", /*tp_name*/
  sizeof(struct __pyx_obj_5pysam_7libcbcf_VariantHeader), /*tp_basicsize*/
  0, /*tp_itemsize*/
  __pyx_tp_dealloc_5pysam_7libcbcf_VariantHeader, /*tp_dealloc*/
  #if PY_VERSION_HEX < 0x030800b4
  0, /*tp_print*/
  #endif
  #if PY_VERSION_HEX >= 0x030800b4
  0, /*tp_vectorcall_offset*/
  #endif
  0, /*tp_getattr*/
  0, /*tp_setattr*/
  0, /*tp_as_async*/
  0, /*tp_repr*/
  &__pyx_tp_as_number_VariantHeader, /*tp_as_number*/
  0, /*tp_as_sequence*/
  0, /*tp_as_mapping*/
  0, /*tp_hash*/
  0, /*tp_call*/
  __pyx_pw_5pysam_7libcbcf_13VariantHeader_13__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("VariantHeader()\n\nheader information for a :class:`VariantFile` object"), /*tp_doc*/
  0, /*tp_traverse*/
  0, /*tp_clear*/
  0, /*tp_richcompare*/
  0, /*tp_weaklistoffset*/
  0, /*tp_iter*/
  0, /*tp_iternext*/
  __pyx_methods_5pysam_7libcbcf_VariantHeader, /*tp_methods*/
  0, /*tp_members*/
  __pyx_getsets_5pysam_7libcbcf_VariantHeader, /*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_5pysam_7libcbcf_13VariantHeader_3__init__, /*tp_init*/
  0, /*tp_alloc*/
  __pyx_tp_new_5pysam_7libcbcf_VariantHeader, /*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 PY_VERSION_HEX >= 0x030800b1 && (!CYTHON_COMPILING_IN_PYPY || PYPY_VERSION_NUM >= 0x07030800)
  0, /*tp_vectorcall*/
  #endif
  #if __PYX_NEED_TP_PRINT_SLOT == 1
  0, /*tp_print*/
  #endif
  #if PY_VERSION_HEX >= 0x030C0000
  0, /*tp_watched*/
  #endif
  #if 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_5pysam_7libcbcf_VariantHeaderRecord(PyTypeObject *t, CYTHON_UNUSED PyObject *a, CYTHON_UNUSED PyObject *k) {
  struct __pyx_obj_5pysam_7libcbcf_VariantHeaderRecord *p;
  PyObject *o;
  #if CYTHON_COMPILING_IN_LIMITED_API
  allocfunc alloc_func = (allocfunc)PyType_GetSlot(t, Py_tp_alloc);
  o = alloc_func(t, 0);
  #else
  if (likely(!__Pyx_PyType_HasFeature(t, Py_TPFLAGS_IS_ABSTRACT))) {
    o = (*t->tp_alloc)(t, 0);
  } else {
    o = (PyObject *) PyBaseObject_Type.tp_new(t, __pyx_mstate_global->__pyx_empty_tuple, 0);
  }
  if (unlikely(!o)) return 0;
  #endif
  p = ((struct __pyx_obj_5pysam_7libcbcf_VariantHeaderRecord *)o);
  p->header = ((struct __pyx_obj_5pysam_7libcbcf_VariantHeader *)Py_None); Py_INCREF(Py_None);
  return o;
}

static void __pyx_tp_dealloc_5pysam_7libcbcf_VariantHeaderRecord(PyObject *o) {
  struct __pyx_obj_5pysam_7libcbcf_VariantHeaderRecord *p = (struct __pyx_obj_5pysam_7libcbcf_VariantHeaderRecord *)o;
  #if CYTHON_USE_TP_FINALIZE
  if (unlikely((PY_VERSION_HEX >= 0x03080000 || __Pyx_PyType_HasFeature(Py_TYPE(o), Py_TPFLAGS_HAVE_FINALIZE)) && __Pyx_PyObject_GetSlot(o, tp_finalize, destructor)) && !__Pyx_PyObject_GC_IsFinalized(o)) {
    if (__Pyx_PyObject_GetSlot(o, tp_dealloc, destructor) == __pyx_tp_dealloc_5pysam_7libcbcf_VariantHeaderRecord) {
      if (PyObject_CallFinalizerFromDealloc(o)) return;
    }
  }
  #endif
  PyObject_GC_UnTrack(o);
  Py_CLEAR(p->header);
  #if CYTHON_USE_TYPE_SLOTS
  (*Py_TYPE(o)->tp_free)(o);
  #else
  {
    freefunc tp_free = (freefunc)PyType_GetSlot(Py_TYPE(o), Py_tp_free);
    if (tp_free) tp_free(o);
  }
  #endif
}

static int __pyx_tp_traverse_5pysam_7libcbcf_VariantHeaderRecord(PyObject *o, visitproc v, void *a) {
  int e;
  struct __pyx_obj_5pysam_7libcbcf_VariantHeaderRecord *p = (struct __pyx_obj_5pysam_7libcbcf_VariantHeaderRecord *)o;
  {
    e = __Pyx_call_type_traverse(o, 1, v, a);
    if (e) return e;
  }
  if (p->header) {
    e = (*v)(((PyObject *)p->header), a); if (e) return e;
  }
  return 0;
}

static int __pyx_tp_clear_5pysam_7libcbcf_VariantHeaderRecord(PyObject *o) {
  PyObject* tmp;
  struct __pyx_obj_5pysam_7libcbcf_VariantHeaderRecord *p = (struct __pyx_obj_5pysam_7libcbcf_VariantHeaderRecord *)o;
  tmp = ((PyObject*)p->header);
  p->header = ((struct __pyx_obj_5pysam_7libcbcf_VariantHeader *)Py_None); Py_INCREF(Py_None);
  Py_XDECREF(tmp);
  return 0;
}

static PyObject *__pyx_sq_item_5pysam_7libcbcf_VariantHeaderRecord(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 PyObject *__pyx_getprop_5pysam_7libcbcf_19VariantHeaderRecord_type(PyObject *o, CYTHON_UNUSED void *x) {
  return __pyx_pw_5pysam_7libcbcf_19VariantHeaderRecord_4type_1__get__(o);
}

static PyObject *__pyx_getprop_5pysam_7libcbcf_19VariantHeaderRecord_key(PyObject *o, CYTHON_UNUSED void *x) {
  return __pyx_pw_5pysam_7libcbcf_19VariantHeaderRecord_3key_1__get__(o);
}

static PyObject *__pyx_getprop_5pysam_7libcbcf_19VariantHeaderRecord_value(PyObject *o, CYTHON_UNUSED void *x) {
  return __pyx_pw_5pysam_7libcbcf_19VariantHeaderRecord_5value_1__get__(o);
}

static PyObject *__pyx_getprop_5pysam_7libcbcf_19VariantHeaderRecord_attrs(PyObject *o, CYTHON_UNUSED void *x) {
  return __pyx_pw_5pysam_7libcbcf_19VariantHeaderRecord_5attrs_1__get__(o);
}

static PyObject *__pyx_getprop_5pysam_7libcbcf_19VariantHeaderRecord_header(PyObject *o, CYTHON_UNUSED void *x) {
  return __pyx_pw_5pysam_7libcbcf_19VariantHeaderRecord_6header_1__get__(o);
}

static PyMethodDef __pyx_methods_5pysam_7libcbcf_VariantHeaderRecord[] = {
  {"get", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_5pysam_7libcbcf_19VariantHeaderRecord_12get, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_5pysam_7libcbcf_19VariantHeaderRecord_11get},
  {"iterkeys", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_5pysam_7libcbcf_19VariantHeaderRecord_16iterkeys, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_5pysam_7libcbcf_19VariantHeaderRecord_15iterkeys},
  {"itervalues", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_5pysam_7libcbcf_19VariantHeaderRecord_18itervalues, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_5pysam_7libcbcf_19VariantHeaderRecord_17itervalues},
  {"iteritems", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_5pysam_7libcbcf_19VariantHeaderRecord_21iteritems, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_5pysam_7libcbcf_19VariantHeaderRecord_20iteritems},
  {"keys", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_5pysam_7libcbcf_19VariantHeaderRecord_24keys, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_5pysam_7libcbcf_19VariantHeaderRecord_23keys},
  {"items", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_5pysam_7libcbcf_19VariantHeaderRecord_26items, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_5pysam_7libcbcf_19VariantHeaderRecord_25items},
  {"values", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_5pysam_7libcbcf_19VariantHeaderRecord_28values, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_5pysam_7libcbcf_19VariantHeaderRecord_27values},
  {"update", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_5pysam_7libcbcf_19VariantHeaderRecord_30update, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_5pysam_7libcbcf_19VariantHeaderRecord_29update},
  {"pop", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_5pysam_7libcbcf_19VariantHeaderRecord_32pop, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_5pysam_7libcbcf_19VariantHeaderRecord_31pop},
  {"remove", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_5pysam_7libcbcf_19VariantHeaderRecord_36remove, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_5pysam_7libcbcf_19VariantHeaderRecord_35remove},
  {"__reduce_cython__", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_5pysam_7libcbcf_19VariantHeaderRecord_38__reduce_cython__, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_5pysam_7libcbcf_19VariantHeaderRecord_37__reduce_cython__},
  {"__setstate_cython__", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_5pysam_7libcbcf_19VariantHeaderRecord_40__setstate_cython__, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_5pysam_7libcbcf_19VariantHeaderRecord_39__setstate_cython__},
  {0, 0, 0, 0}
};

static struct PyGetSetDef __pyx_getsets_5pysam_7libcbcf_VariantHeaderRecord[] = {
  {"type", __pyx_getprop_5pysam_7libcbcf_19VariantHeaderRecord_type, 0, PyDoc_STR("header type: FILTER, INFO, FORMAT, CONTIG, STRUCTURED, or GENERIC"), 0},
  {"key", __pyx_getprop_5pysam_7libcbcf_19VariantHeaderRecord_key, 0, PyDoc_STR("header key (the part before '=', in FILTER/INFO/FORMAT/contig/fileformat etc.)"), 0},
  {"value", __pyx_getprop_5pysam_7libcbcf_19VariantHeaderRecord_value, 0, PyDoc_STR("header value.  Set only for generic lines, None for FILTER/INFO, etc."), 0},
  {"attrs", __pyx_getprop_5pysam_7libcbcf_19VariantHeaderRecord_attrs, 0, PyDoc_STR("sequence of additional header attributes"), 0},
  {"header", __pyx_getprop_5pysam_7libcbcf_19VariantHeaderRecord_header, 0, 0, 0},
  {0, 0, 0, 0, 0}
};
#if CYTHON_USE_TYPE_SPECS
static PyType_Slot __pyx_type_5pysam_7libcbcf_VariantHeaderRecord_slots[] = {
  {Py_tp_dealloc, (void *)__pyx_tp_dealloc_5pysam_7libcbcf_VariantHeaderRecord},
  {Py_nb_bool, (void *)__pyx_pw_5pysam_7libcbcf_19VariantHeaderRecord_5__bool__},
  {Py_sq_length, (void *)__pyx_pw_5pysam_7libcbcf_19VariantHeaderRecord_3__len__},
  {Py_sq_item, (void *)__pyx_sq_item_5pysam_7libcbcf_VariantHeaderRecord},
  {Py_sq_contains, (void *)__pyx_pw_5pysam_7libcbcf_19VariantHeaderRecord_14__contains__},
  {Py_mp_length, (void *)__pyx_pw_5pysam_7libcbcf_19VariantHeaderRecord_3__len__},
  {Py_mp_subscript, (void *)__pyx_pw_5pysam_7libcbcf_19VariantHeaderRecord_7__getitem__},
  {Py_tp_str, (void *)__pyx_pw_5pysam_7libcbcf_19VariantHeaderRecord_34__str__},
  {Py_tp_doc, (void *)PyDoc_STR("VariantHeaderRecord(*args, **kwargs)\n\nheader record from a :class:`VariantHeader` object")},
  {Py_tp_traverse, (void *)__pyx_tp_traverse_5pysam_7libcbcf_VariantHeaderRecord},
  {Py_tp_clear, (void *)__pyx_tp_clear_5pysam_7libcbcf_VariantHeaderRecord},
  {Py_tp_iter, (void *)__pyx_pw_5pysam_7libcbcf_19VariantHeaderRecord_9__iter__},
  {Py_tp_methods, (void *)__pyx_methods_5pysam_7libcbcf_VariantHeaderRecord},
  {Py_tp_getset, (void *)__pyx_getsets_5pysam_7libcbcf_VariantHeaderRecord},
  {Py_tp_init, (void *)__pyx_pw_5pysam_7libcbcf_19VariantHeaderRecord_1__init__},
  {Py_tp_new, (void *)__pyx_tp_new_5pysam_7libcbcf_VariantHeaderRecord},
  {0, 0},
};
static PyType_Spec __pyx_type_5pysam_7libcbcf_VariantHeaderRecord_spec = {
  "pysam.libcbcf.VariantHeaderRecord",
  sizeof(struct __pyx_obj_5pysam_7libcbcf_VariantHeaderRecord),
  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_5pysam_7libcbcf_VariantHeaderRecord_slots,
};
#else

static PyNumberMethods __pyx_tp_as_number_VariantHeaderRecord = {
  0, /*nb_add*/
  0, /*nb_subtract*/
  0, /*nb_multiply*/
  0, /*nb_remainder*/
  0, /*nb_divmod*/
  0, /*nb_power*/
  0, /*nb_negative*/
  0, /*nb_positive*/
  0, /*nb_absolute*/
  __pyx_pw_5pysam_7libcbcf_19VariantHeaderRecord_5__bool__, /*nb_bool*/
  0, /*nb_invert*/
  0, /*nb_lshift*/
  0, /*nb_rshift*/
  0, /*nb_and*/
  0, /*nb_xor*/
  0, /*nb_or*/
  0, /*nb_int*/
  0, /*nb_long (reserved)*/
  0, /*nb_float*/
  0, /*nb_inplace_add*/
  0, /*nb_inplace_subtract*/
  0, /*nb_inplace_multiply*/
  0, /*nb_inplace_remainder*/
  0, /*nb_inplace_power*/
  0, /*nb_inplace_lshift*/
  0, /*nb_inplace_rshift*/
  0, /*nb_inplace_and*/
  0, /*nb_inplace_xor*/
  0, /*nb_inplace_or*/
  0, /*nb_floor_divide*/
  0, /*nb_true_divide*/
  0, /*nb_inplace_floor_divide*/
  0, /*nb_inplace_true_divide*/
  0, /*nb_index*/
  0, /*nb_matrix_multiply*/
  0, /*nb_inplace_matrix_multiply*/
};

static PySequenceMethods __pyx_tp_as_sequence_VariantHeaderRecord = {
  __pyx_pw_5pysam_7libcbcf_19VariantHeaderRecord_3__len__, /*sq_length*/
  0, /*sq_concat*/
  0, /*sq_repeat*/
  __pyx_sq_item_5pysam_7libcbcf_VariantHeaderRecord, /*sq_item*/
  0, /*sq_slice*/
  0, /*sq_ass_item*/
  0, /*sq_ass_slice*/
  __pyx_pw_5pysam_7libcbcf_19VariantHeaderRecord_14__contains__, /*sq_contains*/
  0, /*sq_inplace_concat*/
  0, /*sq_inplace_repeat*/
};

static PyMappingMethods __pyx_tp_as_mapping_VariantHeaderRecord = {
  __pyx_pw_5pysam_7libcbcf_19VariantHeaderRecord_3__len__, /*mp_length*/
  __pyx_pw_5pysam_7libcbcf_19VariantHeaderRecord_7__getitem__, /*mp_subscript*/
  0, /*mp_ass_subscript*/
};

static PyTypeObject __pyx_type_5pysam_7libcbcf_VariantHeaderRecord = {
  PyVarObject_HEAD_INIT(0, 0)
  "pysam.libcbcf.""VariantHeaderRecord", /*tp_name*/
  sizeof(struct __pyx_obj_5pysam_7libcbcf_VariantHeaderRecord), /*tp_basicsize*/
  0, /*tp_itemsize*/
  __pyx_tp_dealloc_5pysam_7libcbcf_VariantHeaderRecord, /*tp_dealloc*/
  #if PY_VERSION_HEX < 0x030800b4
  0, /*tp_print*/
  #endif
  #if PY_VERSION_HEX >= 0x030800b4
  0, /*tp_vectorcall_offset*/
  #endif
  0, /*tp_getattr*/
  0, /*tp_setattr*/
  0, /*tp_as_async*/
  0, /*tp_repr*/
  &__pyx_tp_as_number_VariantHeaderRecord, /*tp_as_number*/
  &__pyx_tp_as_sequence_VariantHeaderRecord, /*tp_as_sequence*/
  &__pyx_tp_as_mapping_VariantHeaderRecord, /*tp_as_mapping*/
  0, /*tp_hash*/
  0, /*tp_call*/
  __pyx_pw_5pysam_7libcbcf_19VariantHeaderRecord_34__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("VariantHeaderRecord(*args, **kwargs)\n\nheader record from a :class:`VariantHeader` object"), /*tp_doc*/
  __pyx_tp_traverse_5pysam_7libcbcf_VariantHeaderRecord, /*tp_traverse*/
  __pyx_tp_clear_5pysam_7libcbcf_VariantHeaderRecord, /*tp_clear*/
  0, /*tp_richcompare*/
  0, /*tp_weaklistoffset*/
  __pyx_pw_5pysam_7libcbcf_19VariantHeaderRecord_9__iter__, /*tp_iter*/
  0, /*tp_iternext*/
  __pyx_methods_5pysam_7libcbcf_VariantHeaderRecord, /*tp_methods*/
  0, /*tp_members*/
  __pyx_getsets_5pysam_7libcbcf_VariantHeaderRecord, /*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_5pysam_7libcbcf_19VariantHeaderRecord_1__init__, /*tp_init*/
  0, /*tp_alloc*/
  __pyx_tp_new_5pysam_7libcbcf_VariantHeaderRecord, /*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 PY_VERSION_HEX >= 0x030800b1 && (!CYTHON_COMPILING_IN_PYPY || PYPY_VERSION_NUM >= 0x07030800)
  0, /*tp_vectorcall*/
  #endif
  #if __PYX_NEED_TP_PRINT_SLOT == 1
  0, /*tp_print*/
  #endif
  #if PY_VERSION_HEX >= 0x030C0000
  0, /*tp_watched*/
  #endif
  #if 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_5pysam_7libcbcf_VariantHeaderRecords(PyTypeObject *t, CYTHON_UNUSED PyObject *a, CYTHON_UNUSED PyObject *k) {
  struct __pyx_obj_5pysam_7libcbcf_VariantHeaderRecords *p;
  PyObject *o;
  #if CYTHON_COMPILING_IN_LIMITED_API
  allocfunc alloc_func = (allocfunc)PyType_GetSlot(t, Py_tp_alloc);
  o = alloc_func(t, 0);
  #else
  if (likely(!__Pyx_PyType_HasFeature(t, Py_TPFLAGS_IS_ABSTRACT))) {
    o = (*t->tp_alloc)(t, 0);
  } else {
    o = (PyObject *) PyBaseObject_Type.tp_new(t, __pyx_mstate_global->__pyx_empty_tuple, 0);
  }
  if (unlikely(!o)) return 0;
  #endif
  p = ((struct __pyx_obj_5pysam_7libcbcf_VariantHeaderRecords *)o);
  p->header = ((struct __pyx_obj_5pysam_7libcbcf_VariantHeader *)Py_None); Py_INCREF(Py_None);
  return o;
}

static void __pyx_tp_dealloc_5pysam_7libcbcf_VariantHeaderRecords(PyObject *o) {
  struct __pyx_obj_5pysam_7libcbcf_VariantHeaderRecords *p = (struct __pyx_obj_5pysam_7libcbcf_VariantHeaderRecords *)o;
  #if CYTHON_USE_TP_FINALIZE
  if (unlikely((PY_VERSION_HEX >= 0x03080000 || __Pyx_PyType_HasFeature(Py_TYPE(o), Py_TPFLAGS_HAVE_FINALIZE)) && __Pyx_PyObject_GetSlot(o, tp_finalize, destructor)) && !__Pyx_PyObject_GC_IsFinalized(o)) {
    if (__Pyx_PyObject_GetSlot(o, tp_dealloc, destructor) == __pyx_tp_dealloc_5pysam_7libcbcf_VariantHeaderRecords) {
      if (PyObject_CallFinalizerFromDealloc(o)) return;
    }
  }
  #endif
  PyObject_GC_UnTrack(o);
  Py_CLEAR(p->header);
  #if CYTHON_USE_TYPE_SLOTS
  (*Py_TYPE(o)->tp_free)(o);
  #else
  {
    freefunc tp_free = (freefunc)PyType_GetSlot(Py_TYPE(o), Py_tp_free);
    if (tp_free) tp_free(o);
  }
  #endif
}

static int __pyx_tp_traverse_5pysam_7libcbcf_VariantHeaderRecords(PyObject *o, visitproc v, void *a) {
  int e;
  struct __pyx_obj_5pysam_7libcbcf_VariantHeaderRecords *p = (struct __pyx_obj_5pysam_7libcbcf_VariantHeaderRecords *)o;
  {
    e = __Pyx_call_type_traverse(o, 1, v, a);
    if (e) return e;
  }
  if (p->header) {
    e = (*v)(((PyObject *)p->header), a); if (e) return e;
  }
  return 0;
}

static int __pyx_tp_clear_5pysam_7libcbcf_VariantHeaderRecords(PyObject *o) {
  PyObject* tmp;
  struct __pyx_obj_5pysam_7libcbcf_VariantHeaderRecords *p = (struct __pyx_obj_5pysam_7libcbcf_VariantHeaderRecords *)o;
  tmp = ((PyObject*)p->header);
  p->header = ((struct __pyx_obj_5pysam_7libcbcf_VariantHeader *)Py_None); Py_INCREF(Py_None);
  Py_XDECREF(tmp);
  return 0;
}

static PyObject *__pyx_sq_item_5pysam_7libcbcf_VariantHeaderRecords(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 PyObject *__pyx_getprop_5pysam_7libcbcf_20VariantHeaderRecords_header(PyObject *o, CYTHON_UNUSED void *x) {
  return __pyx_pw_5pysam_7libcbcf_20VariantHeaderRecords_6header_1__get__(o);
}

static PyMethodDef __pyx_methods_5pysam_7libcbcf_VariantHeaderRecords[] = {
  {"__reduce_cython__", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_5pysam_7libcbcf_20VariantHeaderRecords_12__reduce_cython__, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_5pysam_7libcbcf_20VariantHeaderRecords_11__reduce_cython__},
  {"__setstate_cython__", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_5pysam_7libcbcf_20VariantHeaderRecords_14__setstate_cython__, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_5pysam_7libcbcf_20VariantHeaderRecords_13__setstate_cython__},
  {0, 0, 0, 0}
};

static struct PyGetSetDef __pyx_getsets_5pysam_7libcbcf_VariantHeaderRecords[] = {
  {"header", __pyx_getprop_5pysam_7libcbcf_20VariantHeaderRecords_header, 0, 0, 0},
  {0, 0, 0, 0, 0}
};
#if CYTHON_USE_TYPE_SPECS
static PyType_Slot __pyx_type_5pysam_7libcbcf_VariantHeaderRecords_slots[] = {
  {Py_tp_dealloc, (void *)__pyx_tp_dealloc_5pysam_7libcbcf_VariantHeaderRecords},
  {Py_nb_bool, (void *)__pyx_pw_5pysam_7libcbcf_20VariantHeaderRecords_5__bool__},
  {Py_sq_length, (void *)__pyx_pw_5pysam_7libcbcf_20VariantHeaderRecords_3__len__},
  {Py_sq_item, (void *)__pyx_sq_item_5pysam_7libcbcf_VariantHeaderRecords},
  {Py_mp_length, (void *)__pyx_pw_5pysam_7libcbcf_20VariantHeaderRecords_3__len__},
  {Py_mp_subscript, (void *)__pyx_pw_5pysam_7libcbcf_20VariantHeaderRecords_7__getitem__},
  {Py_tp_doc, (void *)PyDoc_STR("VariantHeaderRecords(*args, **kwargs)\n\nsequence of :class:`VariantHeaderRecord` object from a :class:`VariantHeader` object")},
  {Py_tp_traverse, (void *)__pyx_tp_traverse_5pysam_7libcbcf_VariantHeaderRecords},
  {Py_tp_clear, (void *)__pyx_tp_clear_5pysam_7libcbcf_VariantHeaderRecords},
  {Py_tp_iter, (void *)__pyx_pw_5pysam_7libcbcf_20VariantHeaderRecords_9__iter__},
  {Py_tp_methods, (void *)__pyx_methods_5pysam_7libcbcf_VariantHeaderRecords},
  {Py_tp_getset, (void *)__pyx_getsets_5pysam_7libcbcf_VariantHeaderRecords},
  {Py_tp_init, (void *)__pyx_pw_5pysam_7libcbcf_20VariantHeaderRecords_1__init__},
  {Py_tp_new, (void *)__pyx_tp_new_5pysam_7libcbcf_VariantHeaderRecords},
  {0, 0},
};
static PyType_Spec __pyx_type_5pysam_7libcbcf_VariantHeaderRecords_spec = {
  "pysam.libcbcf.VariantHeaderRecords",
  sizeof(struct __pyx_obj_5pysam_7libcbcf_VariantHeaderRecords),
  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_5pysam_7libcbcf_VariantHeaderRecords_slots,
};
#else

static PyNumberMethods __pyx_tp_as_number_VariantHeaderRecords = {
  0, /*nb_add*/
  0, /*nb_subtract*/
  0, /*nb_multiply*/
  0, /*nb_remainder*/
  0, /*nb_divmod*/
  0, /*nb_power*/
  0, /*nb_negative*/
  0, /*nb_positive*/
  0, /*nb_absolute*/
  __pyx_pw_5pysam_7libcbcf_20VariantHeaderRecords_5__bool__, /*nb_bool*/
  0, /*nb_invert*/
  0, /*nb_lshift*/
  0, /*nb_rshift*/
  0, /*nb_and*/
  0, /*nb_xor*/
  0, /*nb_or*/
  0, /*nb_int*/
  0, /*nb_long (reserved)*/
  0, /*nb_float*/
  0, /*nb_inplace_add*/
  0, /*nb_inplace_subtract*/
  0, /*nb_inplace_multiply*/
  0, /*nb_inplace_remainder*/
  0, /*nb_inplace_power*/
  0, /*nb_inplace_lshift*/
  0, /*nb_inplace_rshift*/
  0, /*nb_inplace_and*/
  0, /*nb_inplace_xor*/
  0, /*nb_inplace_or*/
  0, /*nb_floor_divide*/
  0, /*nb_true_divide*/
  0, /*nb_inplace_floor_divide*/
  0, /*nb_inplace_true_divide*/
  0, /*nb_index*/
  0, /*nb_matrix_multiply*/
  0, /*nb_inplace_matrix_multiply*/
};

static PySequenceMethods __pyx_tp_as_sequence_VariantHeaderRecords = {
  __pyx_pw_5pysam_7libcbcf_20VariantHeaderRecords_3__len__, /*sq_length*/
  0, /*sq_concat*/
  0, /*sq_repeat*/
  __pyx_sq_item_5pysam_7libcbcf_VariantHeaderRecords, /*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_VariantHeaderRecords = {
  __pyx_pw_5pysam_7libcbcf_20VariantHeaderRecords_3__len__, /*mp_length*/
  __pyx_pw_5pysam_7libcbcf_20VariantHeaderRecords_7__getitem__, /*mp_subscript*/
  0, /*mp_ass_subscript*/
};

static PyTypeObject __pyx_type_5pysam_7libcbcf_VariantHeaderRecords = {
  PyVarObject_HEAD_INIT(0, 0)
  "pysam.libcbcf.""VariantHeaderRecords", /*tp_name*/
  sizeof(struct __pyx_obj_5pysam_7libcbcf_VariantHeaderRecords), /*tp_basicsize*/
  0, /*tp_itemsize*/
  __pyx_tp_dealloc_5pysam_7libcbcf_VariantHeaderRecords, /*tp_dealloc*/
  #if PY_VERSION_HEX < 0x030800b4
  0, /*tp_print*/
  #endif
  #if PY_VERSION_HEX >= 0x030800b4
  0, /*tp_vectorcall_offset*/
  #endif
  0, /*tp_getattr*/
  0, /*tp_setattr*/
  0, /*tp_as_async*/
  0, /*tp_repr*/
  &__pyx_tp_as_number_VariantHeaderRecords, /*tp_as_number*/
  &__pyx_tp_as_sequence_VariantHeaderRecords, /*tp_as_sequence*/
  &__pyx_tp_as_mapping_VariantHeaderRecords, /*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("VariantHeaderRecords(*args, **kwargs)\n\nsequence of :class:`VariantHeaderRecord` object from a :class:`VariantHeader` object"), /*tp_doc*/
  __pyx_tp_traverse_5pysam_7libcbcf_VariantHeaderRecords, /*tp_traverse*/
  __pyx_tp_clear_5pysam_7libcbcf_VariantHeaderRecords, /*tp_clear*/
  0, /*tp_richcompare*/
  0, /*tp_weaklistoffset*/
  __pyx_pw_5pysam_7libcbcf_20VariantHeaderRecords_9__iter__, /*tp_iter*/
  0, /*tp_iternext*/
  __pyx_methods_5pysam_7libcbcf_VariantHeaderRecords, /*tp_methods*/
  0, /*tp_members*/
  __pyx_getsets_5pysam_7libcbcf_VariantHeaderRecords, /*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_5pysam_7libcbcf_20VariantHeaderRecords_1__init__, /*tp_init*/
  0, /*tp_alloc*/
  __pyx_tp_new_5pysam_7libcbcf_VariantHeaderRecords, /*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 PY_VERSION_HEX >= 0x030800b1 && (!CYTHON_COMPILING_IN_PYPY || PYPY_VERSION_NUM >= 0x07030800)
  0, /*tp_vectorcall*/
  #endif
  #if __PYX_NEED_TP_PRINT_SLOT == 1
  0, /*tp_print*/
  #endif
  #if PY_VERSION_HEX >= 0x030C0000
  0, /*tp_watched*/
  #endif
  #if 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_5pysam_7libcbcf_VariantHeaderContigs(PyTypeObject *t, CYTHON_UNUSED PyObject *a, CYTHON_UNUSED PyObject *k) {
  struct __pyx_obj_5pysam_7libcbcf_VariantHeaderContigs *p;
  PyObject *o;
  #if CYTHON_COMPILING_IN_LIMITED_API
  allocfunc alloc_func = (allocfunc)PyType_GetSlot(t, Py_tp_alloc);
  o = alloc_func(t, 0);
  #else
  if (likely(!__Pyx_PyType_HasFeature(t, Py_TPFLAGS_IS_ABSTRACT))) {
    o = (*t->tp_alloc)(t, 0);
  } else {
    o = (PyObject *) PyBaseObject_Type.tp_new(t, __pyx_mstate_global->__pyx_empty_tuple, 0);
  }
  if (unlikely(!o)) return 0;
  #endif
  p = ((struct __pyx_obj_5pysam_7libcbcf_VariantHeaderContigs *)o);
  p->header = ((struct __pyx_obj_5pysam_7libcbcf_VariantHeader *)Py_None); Py_INCREF(Py_None);
  return o;
}

static void __pyx_tp_dealloc_5pysam_7libcbcf_VariantHeaderContigs(PyObject *o) {
  struct __pyx_obj_5pysam_7libcbcf_VariantHeaderContigs *p = (struct __pyx_obj_5pysam_7libcbcf_VariantHeaderContigs *)o;
  #if CYTHON_USE_TP_FINALIZE
  if (unlikely((PY_VERSION_HEX >= 0x03080000 || __Pyx_PyType_HasFeature(Py_TYPE(o), Py_TPFLAGS_HAVE_FINALIZE)) && __Pyx_PyObject_GetSlot(o, tp_finalize, destructor)) && !__Pyx_PyObject_GC_IsFinalized(o)) {
    if (__Pyx_PyObject_GetSlot(o, tp_dealloc, destructor) == __pyx_tp_dealloc_5pysam_7libcbcf_VariantHeaderContigs) {
      if (PyObject_CallFinalizerFromDealloc(o)) return;
    }
  }
  #endif
  PyObject_GC_UnTrack(o);
  Py_CLEAR(p->header);
  #if CYTHON_USE_TYPE_SLOTS
  (*Py_TYPE(o)->tp_free)(o);
  #else
  {
    freefunc tp_free = (freefunc)PyType_GetSlot(Py_TYPE(o), Py_tp_free);
    if (tp_free) tp_free(o);
  }
  #endif
}

static int __pyx_tp_traverse_5pysam_7libcbcf_VariantHeaderContigs(PyObject *o, visitproc v, void *a) {
  int e;
  struct __pyx_obj_5pysam_7libcbcf_VariantHeaderContigs *p = (struct __pyx_obj_5pysam_7libcbcf_VariantHeaderContigs *)o;
  {
    e = __Pyx_call_type_traverse(o, 1, v, a);
    if (e) return e;
  }
  if (p->header) {
    e = (*v)(((PyObject *)p->header), a); if (e) return e;
  }
  return 0;
}

static int __pyx_tp_clear_5pysam_7libcbcf_VariantHeaderContigs(PyObject *o) {
  PyObject* tmp;
  struct __pyx_obj_5pysam_7libcbcf_VariantHeaderContigs *p = (struct __pyx_obj_5pysam_7libcbcf_VariantHeaderContigs *)o;
  tmp = ((PyObject*)p->header);
  p->header = ((struct __pyx_obj_5pysam_7libcbcf_VariantHeader *)Py_None); Py_INCREF(Py_None);
  Py_XDECREF(tmp);
  return 0;
}

static PyObject *__pyx_sq_item_5pysam_7libcbcf_VariantHeaderContigs(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 PyObject *__pyx_getprop_5pysam_7libcbcf_20VariantHeaderContigs_header(PyObject *o, CYTHON_UNUSED void *x) {
  return __pyx_pw_5pysam_7libcbcf_20VariantHeaderContigs_6header_1__get__(o);
}

static PyMethodDef __pyx_methods_5pysam_7libcbcf_VariantHeaderContigs[] = {
  {"remove_header", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_5pysam_7libcbcf_20VariantHeaderContigs_9remove_header, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_5pysam_7libcbcf_20VariantHeaderContigs_8remove_header},
  {"clear_header", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_5pysam_7libcbcf_20VariantHeaderContigs_11clear_header, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_5pysam_7libcbcf_20VariantHeaderContigs_10clear_header},
  {"get", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_5pysam_7libcbcf_20VariantHeaderContigs_16get, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_5pysam_7libcbcf_20VariantHeaderContigs_15get},
  {"iterkeys", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_5pysam_7libcbcf_20VariantHeaderContigs_20iterkeys, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_5pysam_7libcbcf_20VariantHeaderContigs_19iterkeys},
  {"itervalues", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_5pysam_7libcbcf_20VariantHeaderContigs_22itervalues, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_5pysam_7libcbcf_20VariantHeaderContigs_21itervalues},
  {"iteritems", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_5pysam_7libcbcf_20VariantHeaderContigs_25iteritems, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_5pysam_7libcbcf_20VariantHeaderContigs_24iteritems},
  {"keys", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_5pysam_7libcbcf_20VariantHeaderContigs_28keys, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_5pysam_7libcbcf_20VariantHeaderContigs_27keys},
  {"items", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_5pysam_7libcbcf_20VariantHeaderContigs_30items, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_5pysam_7libcbcf_20VariantHeaderContigs_29items},
  {"values", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_5pysam_7libcbcf_20VariantHeaderContigs_32values, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_5pysam_7libcbcf_20VariantHeaderContigs_31values},
  {"add", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_5pysam_7libcbcf_20VariantHeaderContigs_34add, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_5pysam_7libcbcf_20VariantHeaderContigs_33add},
  {"__reduce_cython__", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_5pysam_7libcbcf_20VariantHeaderContigs_36__reduce_cython__, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_5pysam_7libcbcf_20VariantHeaderContigs_35__reduce_cython__},
  {"__setstate_cython__", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_5pysam_7libcbcf_20VariantHeaderContigs_38__setstate_cython__, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_5pysam_7libcbcf_20VariantHeaderContigs_37__setstate_cython__},
  {0, 0, 0, 0}
};

static struct PyGetSetDef __pyx_getsets_5pysam_7libcbcf_VariantHeaderContigs[] = {
  {"header", __pyx_getprop_5pysam_7libcbcf_20VariantHeaderContigs_header, 0, 0, 0},
  {0, 0, 0, 0, 0}
};
#if CYTHON_USE_TYPE_SPECS
static PyType_Slot __pyx_type_5pysam_7libcbcf_VariantHeaderContigs_slots[] = {
  {Py_tp_dealloc, (void *)__pyx_tp_dealloc_5pysam_7libcbcf_VariantHeaderContigs},
  {Py_nb_bool, (void *)__pyx_pw_5pysam_7libcbcf_20VariantHeaderContigs_5__bool__},
  {Py_sq_length, (void *)__pyx_pw_5pysam_7libcbcf_20VariantHeaderContigs_3__len__},
  {Py_sq_item, (void *)__pyx_sq_item_5pysam_7libcbcf_VariantHeaderContigs},
  {Py_sq_contains, (void *)__pyx_pw_5pysam_7libcbcf_20VariantHeaderContigs_18__contains__},
  {Py_mp_length, (void *)__pyx_pw_5pysam_7libcbcf_20VariantHeaderContigs_3__len__},
  {Py_mp_subscript, (void *)__pyx_pw_5pysam_7libcbcf_20VariantHeaderContigs_7__getitem__},
  {Py_tp_doc, (void *)PyDoc_STR("VariantHeaderContigs(*args, **kwargs)\n\nmapping from contig name or index to :class:`VariantContig` object.")},
  {Py_tp_traverse, (void *)__pyx_tp_traverse_5pysam_7libcbcf_VariantHeaderContigs},
  {Py_tp_clear, (void *)__pyx_tp_clear_5pysam_7libcbcf_VariantHeaderContigs},
  {Py_tp_iter, (void *)__pyx_pw_5pysam_7libcbcf_20VariantHeaderContigs_13__iter__},
  {Py_tp_methods, (void *)__pyx_methods_5pysam_7libcbcf_VariantHeaderContigs},
  {Py_tp_getset, (void *)__pyx_getsets_5pysam_7libcbcf_VariantHeaderContigs},
  {Py_tp_init, (void *)__pyx_pw_5pysam_7libcbcf_20VariantHeaderContigs_1__init__},
  {Py_tp_new, (void *)__pyx_tp_new_5pysam_7libcbcf_VariantHeaderContigs},
  {0, 0},
};
static PyType_Spec __pyx_type_5pysam_7libcbcf_VariantHeaderContigs_spec = {
  "pysam.libcbcf.VariantHeaderContigs",
  sizeof(struct __pyx_obj_5pysam_7libcbcf_VariantHeaderContigs),
  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_5pysam_7libcbcf_VariantHeaderContigs_slots,
};
#else

static PyNumberMethods __pyx_tp_as_number_VariantHeaderContigs = {
  0, /*nb_add*/
  0, /*nb_subtract*/
  0, /*nb_multiply*/
  0, /*nb_remainder*/
  0, /*nb_divmod*/
  0, /*nb_power*/
  0, /*nb_negative*/
  0, /*nb_positive*/
  0, /*nb_absolute*/
  __pyx_pw_5pysam_7libcbcf_20VariantHeaderContigs_5__bool__, /*nb_bool*/
  0, /*nb_invert*/
  0, /*nb_lshift*/
  0, /*nb_rshift*/
  0, /*nb_and*/
  0, /*nb_xor*/
  0, /*nb_or*/
  0, /*nb_int*/
  0, /*nb_long (reserved)*/
  0, /*nb_float*/
  0, /*nb_inplace_add*/
  0, /*nb_inplace_subtract*/
  0, /*nb_inplace_multiply*/
  0, /*nb_inplace_remainder*/
  0, /*nb_inplace_power*/
  0, /*nb_inplace_lshift*/
  0, /*nb_inplace_rshift*/
  0, /*nb_inplace_and*/
  0, /*nb_inplace_xor*/
  0, /*nb_inplace_or*/
  0, /*nb_floor_divide*/
  0, /*nb_true_divide*/
  0, /*nb_inplace_floor_divide*/
  0, /*nb_inplace_true_divide*/
  0, /*nb_index*/
  0, /*nb_matrix_multiply*/
  0, /*nb_inplace_matrix_multiply*/
};

static PySequenceMethods __pyx_tp_as_sequence_VariantHeaderContigs = {
  __pyx_pw_5pysam_7libcbcf_20VariantHeaderContigs_3__len__, /*sq_length*/
  0, /*sq_concat*/
  0, /*sq_repeat*/
  __pyx_sq_item_5pysam_7libcbcf_VariantHeaderContigs, /*sq_item*/
  0, /*sq_slice*/
  0, /*sq_ass_item*/
  0, /*sq_ass_slice*/
  __pyx_pw_5pysam_7libcbcf_20VariantHeaderContigs_18__contains__, /*sq_contains*/
  0, /*sq_inplace_concat*/
  0, /*sq_inplace_repeat*/
};

static PyMappingMethods __pyx_tp_as_mapping_VariantHeaderContigs = {
  __pyx_pw_5pysam_7libcbcf_20VariantHeaderContigs_3__len__, /*mp_length*/
  __pyx_pw_5pysam_7libcbcf_20VariantHeaderContigs_7__getitem__, /*mp_subscript*/
  0, /*mp_ass_subscript*/
};

static PyTypeObject __pyx_type_5pysam_7libcbcf_VariantHeaderContigs = {
  PyVarObject_HEAD_INIT(0, 0)
  "pysam.libcbcf.""VariantHeaderContigs", /*tp_name*/
  sizeof(struct __pyx_obj_5pysam_7libcbcf_VariantHeaderContigs), /*tp_basicsize*/
  0, /*tp_itemsize*/
  __pyx_tp_dealloc_5pysam_7libcbcf_VariantHeaderContigs, /*tp_dealloc*/
  #if PY_VERSION_HEX < 0x030800b4
  0, /*tp_print*/
  #endif
  #if PY_VERSION_HEX >= 0x030800b4
  0, /*tp_vectorcall_offset*/
  #endif
  0, /*tp_getattr*/
  0, /*tp_setattr*/
  0, /*tp_as_async*/
  0, /*tp_repr*/
  &__pyx_tp_as_number_VariantHeaderContigs, /*tp_as_number*/
  &__pyx_tp_as_sequence_VariantHeaderContigs, /*tp_as_sequence*/
  &__pyx_tp_as_mapping_VariantHeaderContigs, /*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("VariantHeaderContigs(*args, **kwargs)\n\nmapping from contig name or index to :class:`VariantContig` object."), /*tp_doc*/
  __pyx_tp_traverse_5pysam_7libcbcf_VariantHeaderContigs, /*tp_traverse*/
  __pyx_tp_clear_5pysam_7libcbcf_VariantHeaderContigs, /*tp_clear*/
  0, /*tp_richcompare*/
  0, /*tp_weaklistoffset*/
  __pyx_pw_5pysam_7libcbcf_20VariantHeaderContigs_13__iter__, /*tp_iter*/
  0, /*tp_iternext*/
  __pyx_methods_5pysam_7libcbcf_VariantHeaderContigs, /*tp_methods*/
  0, /*tp_members*/
  __pyx_getsets_5pysam_7libcbcf_VariantHeaderContigs, /*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_5pysam_7libcbcf_20VariantHeaderContigs_1__init__, /*tp_init*/
  0, /*tp_alloc*/
  __pyx_tp_new_5pysam_7libcbcf_VariantHeaderContigs, /*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 PY_VERSION_HEX >= 0x030800b1 && (!CYTHON_COMPILING_IN_PYPY || PYPY_VERSION_NUM >= 0x07030800)
  0, /*tp_vectorcall*/
  #endif
  #if __PYX_NEED_TP_PRINT_SLOT == 1
  0, /*tp_print*/
  #endif
  #if PY_VERSION_HEX >= 0x030C0000
  0, /*tp_watched*/
  #endif
  #if 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_5pysam_7libcbcf_VariantHeaderSamples(PyTypeObject *t, CYTHON_UNUSED PyObject *a, CYTHON_UNUSED PyObject *k) {
  struct __pyx_obj_5pysam_7libcbcf_VariantHeaderSamples *p;
  PyObject *o;
  #if CYTHON_COMPILING_IN_LIMITED_API
  allocfunc alloc_func = (allocfunc)PyType_GetSlot(t, Py_tp_alloc);
  o = alloc_func(t, 0);
  #else
  if (likely(!__Pyx_PyType_HasFeature(t, Py_TPFLAGS_IS_ABSTRACT))) {
    o = (*t->tp_alloc)(t, 0);
  } else {
    o = (PyObject *) PyBaseObject_Type.tp_new(t, __pyx_mstate_global->__pyx_empty_tuple, 0);
  }
  if (unlikely(!o)) return 0;
  #endif
  p = ((struct __pyx_obj_5pysam_7libcbcf_VariantHeaderSamples *)o);
  p->header = ((struct __pyx_obj_5pysam_7libcbcf_VariantHeader *)Py_None); Py_INCREF(Py_None);
  return o;
}

static void __pyx_tp_dealloc_5pysam_7libcbcf_VariantHeaderSamples(PyObject *o) {
  struct __pyx_obj_5pysam_7libcbcf_VariantHeaderSamples *p = (struct __pyx_obj_5pysam_7libcbcf_VariantHeaderSamples *)o;
  #if CYTHON_USE_TP_FINALIZE
  if (unlikely((PY_VERSION_HEX >= 0x03080000 || __Pyx_PyType_HasFeature(Py_TYPE(o), Py_TPFLAGS_HAVE_FINALIZE)) && __Pyx_PyObject_GetSlot(o, tp_finalize, destructor)) && !__Pyx_PyObject_GC_IsFinalized(o)) {
    if (__Pyx_PyObject_GetSlot(o, tp_dealloc, destructor) == __pyx_tp_dealloc_5pysam_7libcbcf_VariantHeaderSamples) {
      if (PyObject_CallFinalizerFromDealloc(o)) return;
    }
  }
  #endif
  PyObject_GC_UnTrack(o);
  Py_CLEAR(p->header);
  #if CYTHON_USE_TYPE_SLOTS
  (*Py_TYPE(o)->tp_free)(o);
  #else
  {
    freefunc tp_free = (freefunc)PyType_GetSlot(Py_TYPE(o), Py_tp_free);
    if (tp_free) tp_free(o);
  }
  #endif
}

static int __pyx_tp_traverse_5pysam_7libcbcf_VariantHeaderSamples(PyObject *o, visitproc v, void *a) {
  int e;
  struct __pyx_obj_5pysam_7libcbcf_VariantHeaderSamples *p = (struct __pyx_obj_5pysam_7libcbcf_VariantHeaderSamples *)o;
  {
    e = __Pyx_call_type_traverse(o, 1, v, a);
    if (e) return e;
  }
  if (p->header) {
    e = (*v)(((PyObject *)p->header), a); if (e) return e;
  }
  return 0;
}

static int __pyx_tp_clear_5pysam_7libcbcf_VariantHeaderSamples(PyObject *o) {
  PyObject* tmp;
  struct __pyx_obj_5pysam_7libcbcf_VariantHeaderSamples *p = (struct __pyx_obj_5pysam_7libcbcf_VariantHeaderSamples *)o;
  tmp = ((PyObject*)p->header);
  p->header = ((struct __pyx_obj_5pysam_7libcbcf_VariantHeader *)Py_None); Py_INCREF(Py_None);
  Py_XDECREF(tmp);
  return 0;
}

static PyObject *__pyx_sq_item_5pysam_7libcbcf_VariantHeaderSamples(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 PyObject *__pyx_getprop_5pysam_7libcbcf_20VariantHeaderSamples_header(PyObject *o, CYTHON_UNUSED void *x) {
  return __pyx_pw_5pysam_7libcbcf_20VariantHeaderSamples_6header_1__get__(o);
}

static PyMethodDef __pyx_methods_5pysam_7libcbcf_VariantHeaderSamples[] = {
  {"add", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_5pysam_7libcbcf_20VariantHeaderSamples_14add, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_5pysam_7libcbcf_20VariantHeaderSamples_13add},
  {"__reduce_cython__", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_5pysam_7libcbcf_20VariantHeaderSamples_16__reduce_cython__, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_5pysam_7libcbcf_20VariantHeaderSamples_15__reduce_cython__},
  {"__setstate_cython__", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_5pysam_7libcbcf_20VariantHeaderSamples_18__setstate_cython__, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_5pysam_7libcbcf_20VariantHeaderSamples_17__setstate_cython__},
  {0, 0, 0, 0}
};

static struct PyGetSetDef __pyx_getsets_5pysam_7libcbcf_VariantHeaderSamples[] = {
  {"header", __pyx_getprop_5pysam_7libcbcf_20VariantHeaderSamples_header, 0, 0, 0},
  {0, 0, 0, 0, 0}
};
#if CYTHON_USE_TYPE_SPECS
static PyType_Slot __pyx_type_5pysam_7libcbcf_VariantHeaderSamples_slots[] = {
  {Py_tp_dealloc, (void *)__pyx_tp_dealloc_5pysam_7libcbcf_VariantHeaderSamples},
  {Py_nb_bool, (void *)__pyx_pw_5pysam_7libcbcf_20VariantHeaderSamples_5__bool__},
  {Py_sq_length, (void *)__pyx_pw_5pysam_7libcbcf_20VariantHeaderSamples_3__len__},
  {Py_sq_item, (void *)__pyx_sq_item_5pysam_7libcbcf_VariantHeaderSamples},
  {Py_sq_contains, (void *)__pyx_pw_5pysam_7libcbcf_20VariantHeaderSamples_12__contains__},
  {Py_mp_length, (void *)__pyx_pw_5pysam_7libcbcf_20VariantHeaderSamples_3__len__},
  {Py_mp_subscript, (void *)__pyx_pw_5pysam_7libcbcf_20VariantHeaderSamples_7__getitem__},
  {Py_tp_doc, (void *)PyDoc_STR("VariantHeaderSamples(*args, **kwargs)\n\nsequence of sample names from a :class:`VariantHeader` object")},
  {Py_tp_traverse, (void *)__pyx_tp_traverse_5pysam_7libcbcf_VariantHeaderSamples},
  {Py_tp_clear, (void *)__pyx_tp_clear_5pysam_7libcbcf_VariantHeaderSamples},
  {Py_tp_iter, (void *)__pyx_pw_5pysam_7libcbcf_20VariantHeaderSamples_9__iter__},
  {Py_tp_methods, (void *)__pyx_methods_5pysam_7libcbcf_VariantHeaderSamples},
  {Py_tp_getset, (void *)__pyx_getsets_5pysam_7libcbcf_VariantHeaderSamples},
  {Py_tp_init, (void *)__pyx_pw_5pysam_7libcbcf_20VariantHeaderSamples_1__init__},
  {Py_tp_new, (void *)__pyx_tp_new_5pysam_7libcbcf_VariantHeaderSamples},
  {0, 0},
};
static PyType_Spec __pyx_type_5pysam_7libcbcf_VariantHeaderSamples_spec = {
  "pysam.libcbcf.VariantHeaderSamples",
  sizeof(struct __pyx_obj_5pysam_7libcbcf_VariantHeaderSamples),
  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_5pysam_7libcbcf_VariantHeaderSamples_slots,
};
#else

static PyNumberMethods __pyx_tp_as_number_VariantHeaderSamples = {
  0, /*nb_add*/
  0, /*nb_subtract*/
  0, /*nb_multiply*/
  0, /*nb_remainder*/
  0, /*nb_divmod*/
  0, /*nb_power*/
  0, /*nb_negative*/
  0, /*nb_positive*/
  0, /*nb_absolute*/
  __pyx_pw_5pysam_7libcbcf_20VariantHeaderSamples_5__bool__, /*nb_bool*/
  0, /*nb_invert*/
  0, /*nb_lshift*/
  0, /*nb_rshift*/
  0, /*nb_and*/
  0, /*nb_xor*/
  0, /*nb_or*/
  0, /*nb_int*/
  0, /*nb_long (reserved)*/
  0, /*nb_float*/
  0, /*nb_inplace_add*/
  0, /*nb_inplace_subtract*/
  0, /*nb_inplace_multiply*/
  0, /*nb_inplace_remainder*/
  0, /*nb_inplace_power*/
  0, /*nb_inplace_lshift*/
  0, /*nb_inplace_rshift*/
  0, /*nb_inplace_and*/
  0, /*nb_inplace_xor*/
  0, /*nb_inplace_or*/
  0, /*nb_floor_divide*/
  0, /*nb_true_divide*/
  0, /*nb_inplace_floor_divide*/
  0, /*nb_inplace_true_divide*/
  0, /*nb_index*/
  0, /*nb_matrix_multiply*/
  0, /*nb_inplace_matrix_multiply*/
};

static PySequenceMethods __pyx_tp_as_sequence_VariantHeaderSamples = {
  __pyx_pw_5pysam_7libcbcf_20VariantHeaderSamples_3__len__, /*sq_length*/
  0, /*sq_concat*/
  0, /*sq_repeat*/
  __pyx_sq_item_5pysam_7libcbcf_VariantHeaderSamples, /*sq_item*/
  0, /*sq_slice*/
  0, /*sq_ass_item*/
  0, /*sq_ass_slice*/
  __pyx_pw_5pysam_7libcbcf_20VariantHeaderSamples_12__contains__, /*sq_contains*/
  0, /*sq_inplace_concat*/
  0, /*sq_inplace_repeat*/
};

static PyMappingMethods __pyx_tp_as_mapping_VariantHeaderSamples = {
  __pyx_pw_5pysam_7libcbcf_20VariantHeaderSamples_3__len__, /*mp_length*/
  __pyx_pw_5pysam_7libcbcf_20VariantHeaderSamples_7__getitem__, /*mp_subscript*/
  0, /*mp_ass_subscript*/
};

static PyTypeObject __pyx_type_5pysam_7libcbcf_VariantHeaderSamples = {
  PyVarObject_HEAD_INIT(0, 0)
  "pysam.libcbcf.""VariantHeaderSamples", /*tp_name*/
  sizeof(struct __pyx_obj_5pysam_7libcbcf_VariantHeaderSamples), /*tp_basicsize*/
  0, /*tp_itemsize*/
  __pyx_tp_dealloc_5pysam_7libcbcf_VariantHeaderSamples, /*tp_dealloc*/
  #if PY_VERSION_HEX < 0x030800b4
  0, /*tp_print*/
  #endif
  #if PY_VERSION_HEX >= 0x030800b4
  0, /*tp_vectorcall_offset*/
  #endif
  0, /*tp_getattr*/
  0, /*tp_setattr*/
  0, /*tp_as_async*/
  0, /*tp_repr*/
  &__pyx_tp_as_number_VariantHeaderSamples, /*tp_as_number*/
  &__pyx_tp_as_sequence_VariantHeaderSamples, /*tp_as_sequence*/
  &__pyx_tp_as_mapping_VariantHeaderSamples, /*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("VariantHeaderSamples(*args, **kwargs)\n\nsequence of sample names from a :class:`VariantHeader` object"), /*tp_doc*/
  __pyx_tp_traverse_5pysam_7libcbcf_VariantHeaderSamples, /*tp_traverse*/
  __pyx_tp_clear_5pysam_7libcbcf_VariantHeaderSamples, /*tp_clear*/
  0, /*tp_richcompare*/
  0, /*tp_weaklistoffset*/
  __pyx_pw_5pysam_7libcbcf_20VariantHeaderSamples_9__iter__, /*tp_iter*/
  0, /*tp_iternext*/
  __pyx_methods_5pysam_7libcbcf_VariantHeaderSamples, /*tp_methods*/
  0, /*tp_members*/
  __pyx_getsets_5pysam_7libcbcf_VariantHeaderSamples, /*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_5pysam_7libcbcf_20VariantHeaderSamples_1__init__, /*tp_init*/
  0, /*tp_alloc*/
  __pyx_tp_new_5pysam_7libcbcf_VariantHeaderSamples, /*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 PY_VERSION_HEX >= 0x030800b1 && (!CYTHON_COMPILING_IN_PYPY || PYPY_VERSION_NUM >= 0x07030800)
  0, /*tp_vectorcall*/
  #endif
  #if __PYX_NEED_TP_PRINT_SLOT == 1
  0, /*tp_print*/
  #endif
  #if PY_VERSION_HEX >= 0x030C0000
  0, /*tp_watched*/
  #endif
  #if 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_5pysam_7libcbcf_VariantContig(PyTypeObject *t, CYTHON_UNUSED PyObject *a, CYTHON_UNUSED PyObject *k) {
  struct __pyx_obj_5pysam_7libcbcf_VariantContig *p;
  PyObject *o;
  #if CYTHON_COMPILING_IN_LIMITED_API
  allocfunc alloc_func = (allocfunc)PyType_GetSlot(t, Py_tp_alloc);
  o = alloc_func(t, 0);
  #else
  if (likely(!__Pyx_PyType_HasFeature(t, Py_TPFLAGS_IS_ABSTRACT))) {
    o = (*t->tp_alloc)(t, 0);
  } else {
    o = (PyObject *) PyBaseObject_Type.tp_new(t, __pyx_mstate_global->__pyx_empty_tuple, 0);
  }
  if (unlikely(!o)) return 0;
  #endif
  p = ((struct __pyx_obj_5pysam_7libcbcf_VariantContig *)o);
  p->header = ((struct __pyx_obj_5pysam_7libcbcf_VariantHeader *)Py_None); Py_INCREF(Py_None);
  return o;
}

static void __pyx_tp_dealloc_5pysam_7libcbcf_VariantContig(PyObject *o) {
  struct __pyx_obj_5pysam_7libcbcf_VariantContig *p = (struct __pyx_obj_5pysam_7libcbcf_VariantContig *)o;
  #if CYTHON_USE_TP_FINALIZE
  if (unlikely((PY_VERSION_HEX >= 0x03080000 || __Pyx_PyType_HasFeature(Py_TYPE(o), Py_TPFLAGS_HAVE_FINALIZE)) && __Pyx_PyObject_GetSlot(o, tp_finalize, destructor)) && !__Pyx_PyObject_GC_IsFinalized(o)) {
    if (__Pyx_PyObject_GetSlot(o, tp_dealloc, destructor) == __pyx_tp_dealloc_5pysam_7libcbcf_VariantContig) {
      if (PyObject_CallFinalizerFromDealloc(o)) return;
    }
  }
  #endif
  PyObject_GC_UnTrack(o);
  Py_CLEAR(p->header);
  #if CYTHON_USE_TYPE_SLOTS
  (*Py_TYPE(o)->tp_free)(o);
  #else
  {
    freefunc tp_free = (freefunc)PyType_GetSlot(Py_TYPE(o), Py_tp_free);
    if (tp_free) tp_free(o);
  }
  #endif
}

static int __pyx_tp_traverse_5pysam_7libcbcf_VariantContig(PyObject *o, visitproc v, void *a) {
  int e;
  struct __pyx_obj_5pysam_7libcbcf_VariantContig *p = (struct __pyx_obj_5pysam_7libcbcf_VariantContig *)o;
  {
    e = __Pyx_call_type_traverse(o, 1, v, a);
    if (e) return e;
  }
  if (p->header) {
    e = (*v)(((PyObject *)p->header), a); if (e) return e;
  }
  return 0;
}

static int __pyx_tp_clear_5pysam_7libcbcf_VariantContig(PyObject *o) {
  PyObject* tmp;
  struct __pyx_obj_5pysam_7libcbcf_VariantContig *p = (struct __pyx_obj_5pysam_7libcbcf_VariantContig *)o;
  tmp = ((PyObject*)p->header);
  p->header = ((struct __pyx_obj_5pysam_7libcbcf_VariantHeader *)Py_None); Py_INCREF(Py_None);
  Py_XDECREF(tmp);
  return 0;
}

static PyObject *__pyx_getprop_5pysam_7libcbcf_13VariantContig_name(PyObject *o, CYTHON_UNUSED void *x) {
  return __pyx_pw_5pysam_7libcbcf_13VariantContig_4name_1__get__(o);
}

static PyObject *__pyx_getprop_5pysam_7libcbcf_13VariantContig_id(PyObject *o, CYTHON_UNUSED void *x) {
  return __pyx_pw_5pysam_7libcbcf_13VariantContig_2id_1__get__(o);
}

static PyObject *__pyx_getprop_5pysam_7libcbcf_13VariantContig_length(PyObject *o, CYTHON_UNUSED void *x) {
  return __pyx_pw_5pysam_7libcbcf_13VariantContig_6length_1__get__(o);
}

static PyObject *__pyx_getprop_5pysam_7libcbcf_13VariantContig_header_record(PyObject *o, CYTHON_UNUSED void *x) {
  return __pyx_pw_5pysam_7libcbcf_13VariantContig_13header_record_1__get__(o);
}

static PyObject *__pyx_getprop_5pysam_7libcbcf_13VariantContig_header(PyObject *o, CYTHON_UNUSED void *x) {
  return __pyx_pw_5pysam_7libcbcf_13VariantContig_6header_1__get__(o);
}

static PyMethodDef __pyx_methods_5pysam_7libcbcf_VariantContig[] = {
  {"remove_header", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_5pysam_7libcbcf_13VariantContig_3remove_header, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_5pysam_7libcbcf_13VariantContig_2remove_header},
  {"__reduce_cython__", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_5pysam_7libcbcf_13VariantContig_5__reduce_cython__, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_5pysam_7libcbcf_13VariantContig_4__reduce_cython__},
  {"__setstate_cython__", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_5pysam_7libcbcf_13VariantContig_7__setstate_cython__, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_5pysam_7libcbcf_13VariantContig_6__setstate_cython__},
  {0, 0, 0, 0}
};

static struct PyGetSetDef __pyx_getsets_5pysam_7libcbcf_VariantContig[] = {
  {"name", __pyx_getprop_5pysam_7libcbcf_13VariantContig_name, 0, PyDoc_STR("contig name"), 0},
  {"id", __pyx_getprop_5pysam_7libcbcf_13VariantContig_id, 0, PyDoc_STR("contig internal id number"), 0},
  {"length", __pyx_getprop_5pysam_7libcbcf_13VariantContig_length, 0, PyDoc_STR("contig length or None if not available"), 0},
  {"header_record", __pyx_getprop_5pysam_7libcbcf_13VariantContig_header_record, 0, PyDoc_STR(":class:`VariantHeaderRecord` associated with this :class:`VariantContig` object"), 0},
  {"header", __pyx_getprop_5pysam_7libcbcf_13VariantContig_header, 0, 0, 0},
  {0, 0, 0, 0, 0}
};
#if CYTHON_USE_TYPE_SPECS
static PyType_Slot __pyx_type_5pysam_7libcbcf_VariantContig_slots[] = {
  {Py_tp_dealloc, (void *)__pyx_tp_dealloc_5pysam_7libcbcf_VariantContig},
  {Py_tp_doc, (void *)PyDoc_STR("VariantContig(*args, **kwargs)\n\ncontig metadata from a :class:`VariantHeader`")},
  {Py_tp_traverse, (void *)__pyx_tp_traverse_5pysam_7libcbcf_VariantContig},
  {Py_tp_clear, (void *)__pyx_tp_clear_5pysam_7libcbcf_VariantContig},
  {Py_tp_methods, (void *)__pyx_methods_5pysam_7libcbcf_VariantContig},
  {Py_tp_getset, (void *)__pyx_getsets_5pysam_7libcbcf_VariantContig},
  {Py_tp_init, (void *)__pyx_pw_5pysam_7libcbcf_13VariantContig_1__init__},
  {Py_tp_new, (void *)__pyx_tp_new_5pysam_7libcbcf_VariantContig},
  {0, 0},
};
static PyType_Spec __pyx_type_5pysam_7libcbcf_VariantContig_spec = {
  "pysam.libcbcf.VariantContig",
  sizeof(struct __pyx_obj_5pysam_7libcbcf_VariantContig),
  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_5pysam_7libcbcf_VariantContig_slots,
};
#else

static PyTypeObject __pyx_type_5pysam_7libcbcf_VariantContig = {
  PyVarObject_HEAD_INIT(0, 0)
  "pysam.libcbcf.""VariantContig", /*tp_name*/
  sizeof(struct __pyx_obj_5pysam_7libcbcf_VariantContig), /*tp_basicsize*/
  0, /*tp_itemsize*/
  __pyx_tp_dealloc_5pysam_7libcbcf_VariantContig, /*tp_dealloc*/
  #if PY_VERSION_HEX < 0x030800b4
  0, /*tp_print*/
  #endif
  #if PY_VERSION_HEX >= 0x030800b4
  0, /*tp_vectorcall_offset*/
  #endif
  0, /*tp_getattr*/
  0, /*tp_setattr*/
  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("VariantContig(*args, **kwargs)\n\ncontig metadata from a :class:`VariantHeader`"), /*tp_doc*/
  __pyx_tp_traverse_5pysam_7libcbcf_VariantContig, /*tp_traverse*/
  __pyx_tp_clear_5pysam_7libcbcf_VariantContig, /*tp_clear*/
  0, /*tp_richcompare*/
  0, /*tp_weaklistoffset*/
  0, /*tp_iter*/
  0, /*tp_iternext*/
  __pyx_methods_5pysam_7libcbcf_VariantContig, /*tp_methods*/
  0, /*tp_members*/
  __pyx_getsets_5pysam_7libcbcf_VariantContig, /*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_5pysam_7libcbcf_13VariantContig_1__init__, /*tp_init*/
  0, /*tp_alloc*/
  __pyx_tp_new_5pysam_7libcbcf_VariantContig, /*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 PY_VERSION_HEX >= 0x030800b1 && (!CYTHON_COMPILING_IN_PYPY || PYPY_VERSION_NUM >= 0x07030800)
  0, /*tp_vectorcall*/
  #endif
  #if __PYX_NEED_TP_PRINT_SLOT == 1
  0, /*tp_print*/
  #endif
  #if PY_VERSION_HEX >= 0x030C0000
  0, /*tp_watched*/
  #endif
  #if 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_5pysam_7libcbcf_VariantMetadata(PyTypeObject *t, CYTHON_UNUSED PyObject *a, CYTHON_UNUSED PyObject *k) {
  struct __pyx_obj_5pysam_7libcbcf_VariantMetadata *p;
  PyObject *o;
  #if CYTHON_COMPILING_IN_LIMITED_API
  allocfunc alloc_func = (allocfunc)PyType_GetSlot(t, Py_tp_alloc);
  o = alloc_func(t, 0);
  #else
  if (likely(!__Pyx_PyType_HasFeature(t, Py_TPFLAGS_IS_ABSTRACT))) {
    o = (*t->tp_alloc)(t, 0);
  } else {
    o = (PyObject *) PyBaseObject_Type.tp_new(t, __pyx_mstate_global->__pyx_empty_tuple, 0);
  }
  if (unlikely(!o)) return 0;
  #endif
  p = ((struct __pyx_obj_5pysam_7libcbcf_VariantMetadata *)o);
  p->header = ((struct __pyx_obj_5pysam_7libcbcf_VariantHeader *)Py_None); Py_INCREF(Py_None);
  return o;
}

static void __pyx_tp_dealloc_5pysam_7libcbcf_VariantMetadata(PyObject *o) {
  struct __pyx_obj_5pysam_7libcbcf_VariantMetadata *p = (struct __pyx_obj_5pysam_7libcbcf_VariantMetadata *)o;
  #if CYTHON_USE_TP_FINALIZE
  if (unlikely((PY_VERSION_HEX >= 0x03080000 || __Pyx_PyType_HasFeature(Py_TYPE(o), Py_TPFLAGS_HAVE_FINALIZE)) && __Pyx_PyObject_GetSlot(o, tp_finalize, destructor)) && !__Pyx_PyObject_GC_IsFinalized(o)) {
    if (__Pyx_PyObject_GetSlot(o, tp_dealloc, destructor) == __pyx_tp_dealloc_5pysam_7libcbcf_VariantMetadata) {
      if (PyObject_CallFinalizerFromDealloc(o)) return;
    }
  }
  #endif
  PyObject_GC_UnTrack(o);
  Py_CLEAR(p->header);
  #if CYTHON_USE_TYPE_SLOTS
  (*Py_TYPE(o)->tp_free)(o);
  #else
  {
    freefunc tp_free = (freefunc)PyType_GetSlot(Py_TYPE(o), Py_tp_free);
    if (tp_free) tp_free(o);
  }
  #endif
}

static int __pyx_tp_traverse_5pysam_7libcbcf_VariantMetadata(PyObject *o, visitproc v, void *a) {
  int e;
  struct __pyx_obj_5pysam_7libcbcf_VariantMetadata *p = (struct __pyx_obj_5pysam_7libcbcf_VariantMetadata *)o;
  {
    e = __Pyx_call_type_traverse(o, 1, v, a);
    if (e) return e;
  }
  if (p->header) {
    e = (*v)(((PyObject *)p->header), a); if (e) return e;
  }
  return 0;
}

static int __pyx_tp_clear_5pysam_7libcbcf_VariantMetadata(PyObject *o) {
  PyObject* tmp;
  struct __pyx_obj_5pysam_7libcbcf_VariantMetadata *p = (struct __pyx_obj_5pysam_7libcbcf_VariantMetadata *)o;
  tmp = ((PyObject*)p->header);
  p->header = ((struct __pyx_obj_5pysam_7libcbcf_VariantHeader *)Py_None); Py_INCREF(Py_None);
  Py_XDECREF(tmp);
  return 0;
}

static PyObject *__pyx_getprop_5pysam_7libcbcf_15VariantMetadata_name(PyObject *o, CYTHON_UNUSED void *x) {
  return __pyx_pw_5pysam_7libcbcf_15VariantMetadata_4name_1__get__(o);
}

static PyObject *__pyx_getprop_5pysam_7libcbcf_15VariantMetadata_id(PyObject *o, CYTHON_UNUSED void *x) {
  return __pyx_pw_5pysam_7libcbcf_15VariantMetadata_2id_1__get__(o);
}

static PyObject *__pyx_getprop_5pysam_7libcbcf_15VariantMetadata_number(PyObject *o, CYTHON_UNUSED void *x) {
  return __pyx_pw_5pysam_7libcbcf_15VariantMetadata_6number_1__get__(o);
}

static PyObject *__pyx_getprop_5pysam_7libcbcf_15VariantMetadata_type(PyObject *o, CYTHON_UNUSED void *x) {
  return __pyx_pw_5pysam_7libcbcf_15VariantMetadata_4type_1__get__(o);
}

static PyObject *__pyx_getprop_5pysam_7libcbcf_15VariantMetadata_description(PyObject *o, CYTHON_UNUSED void *x) {
  return __pyx_pw_5pysam_7libcbcf_15VariantMetadata_11description_1__get__(o);
}

static PyObject *__pyx_getprop_5pysam_7libcbcf_15VariantMetadata_record(PyObject *o, CYTHON_UNUSED void *x) {
  return __pyx_pw_5pysam_7libcbcf_15VariantMetadata_6record_1__get__(o);
}

static PyObject *__pyx_getprop_5pysam_7libcbcf_15VariantMetadata_header(PyObject *o, CYTHON_UNUSED void *x) {
  return __pyx_pw_5pysam_7libcbcf_15VariantMetadata_6header_1__get__(o);
}

static PyMethodDef __pyx_methods_5pysam_7libcbcf_VariantMetadata[] = {
  {"remove_header", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_5pysam_7libcbcf_15VariantMetadata_3remove_header, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_5pysam_7libcbcf_15VariantMetadata_2remove_header},
  {"__reduce_cython__", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_5pysam_7libcbcf_15VariantMetadata_5__reduce_cython__, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_5pysam_7libcbcf_15VariantMetadata_4__reduce_cython__},
  {"__setstate_cython__", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_5pysam_7libcbcf_15VariantMetadata_7__setstate_cython__, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_5pysam_7libcbcf_15VariantMetadata_6__setstate_cython__},
  {0, 0, 0, 0}
};

static struct PyGetSetDef __pyx_getsets_5pysam_7libcbcf_VariantMetadata[] = {
  {"name", __pyx_getprop_5pysam_7libcbcf_15VariantMetadata_name, 0, PyDoc_STR("metadata name"), 0},
  {"id", __pyx_getprop_5pysam_7libcbcf_15VariantMetadata_id, 0, PyDoc_STR("metadata internal header id number"), 0},
  {"number", __pyx_getprop_5pysam_7libcbcf_15VariantMetadata_number, 0, PyDoc_STR("metadata number (i.e. cardinality)"), 0},
  {"type", __pyx_getprop_5pysam_7libcbcf_15VariantMetadata_type, 0, PyDoc_STR("metadata value type"), 0},
  {"description", __pyx_getprop_5pysam_7libcbcf_15VariantMetadata_description, 0, PyDoc_STR("metadata description (or None if not set)"), 0},
  {"record", __pyx_getprop_5pysam_7libcbcf_15VariantMetadata_record, 0, PyDoc_STR(":class:`VariantHeaderRecord` associated with this :class:`VariantMetadata` object"), 0},
  {"header", __pyx_getprop_5pysam_7libcbcf_15VariantMetadata_header, 0, 0, 0},
  {0, 0, 0, 0, 0}
};
#if CYTHON_USE_TYPE_SPECS
static PyType_Slot __pyx_type_5pysam_7libcbcf_VariantMetadata_slots[] = {
  {Py_tp_dealloc, (void *)__pyx_tp_dealloc_5pysam_7libcbcf_VariantMetadata},
  {Py_tp_doc, (void *)PyDoc_STR("VariantMetadata(*args, **kwargs)\n\nfilter, info or format metadata record from a :class:`VariantHeader` object")},
  {Py_tp_traverse, (void *)__pyx_tp_traverse_5pysam_7libcbcf_VariantMetadata},
  {Py_tp_clear, (void *)__pyx_tp_clear_5pysam_7libcbcf_VariantMetadata},
  {Py_tp_methods, (void *)__pyx_methods_5pysam_7libcbcf_VariantMetadata},
  {Py_tp_getset, (void *)__pyx_getsets_5pysam_7libcbcf_VariantMetadata},
  {Py_tp_init, (void *)__pyx_pw_5pysam_7libcbcf_15VariantMetadata_1__init__},
  {Py_tp_new, (void *)__pyx_tp_new_5pysam_7libcbcf_VariantMetadata},
  {0, 0},
};
static PyType_Spec __pyx_type_5pysam_7libcbcf_VariantMetadata_spec = {
  "pysam.libcbcf.VariantMetadata",
  sizeof(struct __pyx_obj_5pysam_7libcbcf_VariantMetadata),
  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_5pysam_7libcbcf_VariantMetadata_slots,
};
#else

static PyTypeObject __pyx_type_5pysam_7libcbcf_VariantMetadata = {
  PyVarObject_HEAD_INIT(0, 0)
  "pysam.libcbcf.""VariantMetadata", /*tp_name*/
  sizeof(struct __pyx_obj_5pysam_7libcbcf_VariantMetadata), /*tp_basicsize*/
  0, /*tp_itemsize*/
  __pyx_tp_dealloc_5pysam_7libcbcf_VariantMetadata, /*tp_dealloc*/
  #if PY_VERSION_HEX < 0x030800b4
  0, /*tp_print*/
  #endif
  #if PY_VERSION_HEX >= 0x030800b4
  0, /*tp_vectorcall_offset*/
  #endif
  0, /*tp_getattr*/
  0, /*tp_setattr*/
  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("VariantMetadata(*args, **kwargs)\n\nfilter, info or format metadata record from a :class:`VariantHeader` object"), /*tp_doc*/
  __pyx_tp_traverse_5pysam_7libcbcf_VariantMetadata, /*tp_traverse*/
  __pyx_tp_clear_5pysam_7libcbcf_VariantMetadata, /*tp_clear*/
  0, /*tp_richcompare*/
  0, /*tp_weaklistoffset*/
  0, /*tp_iter*/
  0, /*tp_iternext*/
  __pyx_methods_5pysam_7libcbcf_VariantMetadata, /*tp_methods*/
  0, /*tp_members*/
  __pyx_getsets_5pysam_7libcbcf_VariantMetadata, /*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_5pysam_7libcbcf_15VariantMetadata_1__init__, /*tp_init*/
  0, /*tp_alloc*/
  __pyx_tp_new_5pysam_7libcbcf_VariantMetadata, /*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 PY_VERSION_HEX >= 0x030800b1 && (!CYTHON_COMPILING_IN_PYPY || PYPY_VERSION_NUM >= 0x07030800)
  0, /*tp_vectorcall*/
  #endif
  #if __PYX_NEED_TP_PRINT_SLOT == 1
  0, /*tp_print*/
  #endif
  #if PY_VERSION_HEX >= 0x030C0000
  0, /*tp_watched*/
  #endif
  #if 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_5pysam_7libcbcf_VariantHeaderMetadata(PyTypeObject *t, CYTHON_UNUSED PyObject *a, CYTHON_UNUSED PyObject *k) {
  struct __pyx_obj_5pysam_7libcbcf_VariantHeaderMetadata *p;
  PyObject *o;
  #if CYTHON_COMPILING_IN_LIMITED_API
  allocfunc alloc_func = (allocfunc)PyType_GetSlot(t, Py_tp_alloc);
  o = alloc_func(t, 0);
  #else
  if (likely(!__Pyx_PyType_HasFeature(t, Py_TPFLAGS_IS_ABSTRACT))) {
    o = (*t->tp_alloc)(t, 0);
  } else {
    o = (PyObject *) PyBaseObject_Type.tp_new(t, __pyx_mstate_global->__pyx_empty_tuple, 0);
  }
  if (unlikely(!o)) return 0;
  #endif
  p = ((struct __pyx_obj_5pysam_7libcbcf_VariantHeaderMetadata *)o);
  p->header = ((struct __pyx_obj_5pysam_7libcbcf_VariantHeader *)Py_None); Py_INCREF(Py_None);
  return o;
}

static void __pyx_tp_dealloc_5pysam_7libcbcf_VariantHeaderMetadata(PyObject *o) {
  struct __pyx_obj_5pysam_7libcbcf_VariantHeaderMetadata *p = (struct __pyx_obj_5pysam_7libcbcf_VariantHeaderMetadata *)o;
  #if CYTHON_USE_TP_FINALIZE
  if (unlikely((PY_VERSION_HEX >= 0x03080000 || __Pyx_PyType_HasFeature(Py_TYPE(o), Py_TPFLAGS_HAVE_FINALIZE)) && __Pyx_PyObject_GetSlot(o, tp_finalize, destructor)) && !__Pyx_PyObject_GC_IsFinalized(o)) {
    if (__Pyx_PyObject_GetSlot(o, tp_dealloc, destructor) == __pyx_tp_dealloc_5pysam_7libcbcf_VariantHeaderMetadata) {
      if (PyObject_CallFinalizerFromDealloc(o)) return;
    }
  }
  #endif
  PyObject_GC_UnTrack(o);
  Py_CLEAR(p->header);
  #if CYTHON_USE_TYPE_SLOTS
  (*Py_TYPE(o)->tp_free)(o);
  #else
  {
    freefunc tp_free = (freefunc)PyType_GetSlot(Py_TYPE(o), Py_tp_free);
    if (tp_free) tp_free(o);
  }
  #endif
}

static int __pyx_tp_traverse_5pysam_7libcbcf_VariantHeaderMetadata(PyObject *o, visitproc v, void *a) {
  int e;
  struct __pyx_obj_5pysam_7libcbcf_VariantHeaderMetadata *p = (struct __pyx_obj_5pysam_7libcbcf_VariantHeaderMetadata *)o;
  {
    e = __Pyx_call_type_traverse(o, 1, v, a);
    if (e) return e;
  }
  if (p->header) {
    e = (*v)(((PyObject *)p->header), a); if (e) return e;
  }
  return 0;
}

static int __pyx_tp_clear_5pysam_7libcbcf_VariantHeaderMetadata(PyObject *o) {
  PyObject* tmp;
  struct __pyx_obj_5pysam_7libcbcf_VariantHeaderMetadata *p = (struct __pyx_obj_5pysam_7libcbcf_VariantHeaderMetadata *)o;
  tmp = ((PyObject*)p->header);
  p->header = ((struct __pyx_obj_5pysam_7libcbcf_VariantHeader *)Py_None); Py_INCREF(Py_None);
  Py_XDECREF(tmp);
  return 0;
}

static PyObject *__pyx_sq_item_5pysam_7libcbcf_VariantHeaderMetadata(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 PyObject *__pyx_getprop_5pysam_7libcbcf_21VariantHeaderMetadata_header(PyObject *o, CYTHON_UNUSED void *x) {
  return __pyx_pw_5pysam_7libcbcf_21VariantHeaderMetadata_6header_1__get__(o);
}

static PyMethodDef __pyx_methods_5pysam_7libcbcf_VariantHeaderMetadata[] = {
  {"add", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_5pysam_7libcbcf_21VariantHeaderMetadata_3add, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_5pysam_7libcbcf_21VariantHeaderMetadata_2add},
  {"remove_header", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_5pysam_7libcbcf_21VariantHeaderMetadata_11remove_header, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_5pysam_7libcbcf_21VariantHeaderMetadata_10remove_header},
  {"clear_header", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_5pysam_7libcbcf_21VariantHeaderMetadata_13clear_header, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_5pysam_7libcbcf_21VariantHeaderMetadata_12clear_header},
  {"get", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_5pysam_7libcbcf_21VariantHeaderMetadata_18get, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_5pysam_7libcbcf_21VariantHeaderMetadata_17get},
  {"iterkeys", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_5pysam_7libcbcf_21VariantHeaderMetadata_22iterkeys, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_5pysam_7libcbcf_21VariantHeaderMetadata_21iterkeys},
  {"itervalues", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_5pysam_7libcbcf_21VariantHeaderMetadata_24itervalues, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_5pysam_7libcbcf_21VariantHeaderMetadata_23itervalues},
  {"iteritems", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_5pysam_7libcbcf_21VariantHeaderMetadata_27iteritems, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_5pysam_7libcbcf_21VariantHeaderMetadata_26iteritems},
  {"keys", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_5pysam_7libcbcf_21VariantHeaderMetadata_30keys, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_5pysam_7libcbcf_21VariantHeaderMetadata_29keys},
  {"items", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_5pysam_7libcbcf_21VariantHeaderMetadata_32items, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_5pysam_7libcbcf_21VariantHeaderMetadata_31items},
  {"values", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_5pysam_7libcbcf_21VariantHeaderMetadata_34values, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_5pysam_7libcbcf_21VariantHeaderMetadata_33values},
  {"__reduce_cython__", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_5pysam_7libcbcf_21VariantHeaderMetadata_36__reduce_cython__, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_5pysam_7libcbcf_21VariantHeaderMetadata_35__reduce_cython__},
  {"__setstate_cython__", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_5pysam_7libcbcf_21VariantHeaderMetadata_38__setstate_cython__, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_5pysam_7libcbcf_21VariantHeaderMetadata_37__setstate_cython__},
  {0, 0, 0, 0}
};

static struct PyGetSetDef __pyx_getsets_5pysam_7libcbcf_VariantHeaderMetadata[] = {
  {"header", __pyx_getprop_5pysam_7libcbcf_21VariantHeaderMetadata_header, 0, 0, 0},
  {0, 0, 0, 0, 0}
};
#if CYTHON_USE_TYPE_SPECS
static PyType_Slot __pyx_type_5pysam_7libcbcf_VariantHeaderMetadata_slots[] = {
  {Py_tp_dealloc, (void *)__pyx_tp_dealloc_5pysam_7libcbcf_VariantHeaderMetadata},
  {Py_nb_bool, (void *)__pyx_pw_5pysam_7libcbcf_21VariantHeaderMetadata_7__bool__},
  {Py_sq_length, (void *)__pyx_pw_5pysam_7libcbcf_21VariantHeaderMetadata_5__len__},
  {Py_sq_item, (void *)__pyx_sq_item_5pysam_7libcbcf_VariantHeaderMetadata},
  {Py_sq_contains, (void *)__pyx_pw_5pysam_7libcbcf_21VariantHeaderMetadata_20__contains__},
  {Py_mp_length, (void *)__pyx_pw_5pysam_7libcbcf_21VariantHeaderMetadata_5__len__},
  {Py_mp_subscript, (void *)__pyx_pw_5pysam_7libcbcf_21VariantHeaderMetadata_9__getitem__},
  {Py_tp_doc, (void *)PyDoc_STR("VariantHeaderMetadata(*args, **kwargs)\n\nmapping from filter, info or format name to :class:`VariantMetadata` object")},
  {Py_tp_traverse, (void *)__pyx_tp_traverse_5pysam_7libcbcf_VariantHeaderMetadata},
  {Py_tp_clear, (void *)__pyx_tp_clear_5pysam_7libcbcf_VariantHeaderMetadata},
  {Py_tp_iter, (void *)__pyx_pw_5pysam_7libcbcf_21VariantHeaderMetadata_15__iter__},
  {Py_tp_methods, (void *)__pyx_methods_5pysam_7libcbcf_VariantHeaderMetadata},
  {Py_tp_getset, (void *)__pyx_getsets_5pysam_7libcbcf_VariantHeaderMetadata},
  {Py_tp_init, (void *)__pyx_pw_5pysam_7libcbcf_21VariantHeaderMetadata_1__init__},
  {Py_tp_new, (void *)__pyx_tp_new_5pysam_7libcbcf_VariantHeaderMetadata},
  {0, 0},
};
static PyType_Spec __pyx_type_5pysam_7libcbcf_VariantHeaderMetadata_spec = {
  "pysam.libcbcf.VariantHeaderMetadata",
  sizeof(struct __pyx_obj_5pysam_7libcbcf_VariantHeaderMetadata),
  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_5pysam_7libcbcf_VariantHeaderMetadata_slots,
};
#else

static PyNumberMethods __pyx_tp_as_number_VariantHeaderMetadata = {
  0, /*nb_add*/
  0, /*nb_subtract*/
  0, /*nb_multiply*/
  0, /*nb_remainder*/
  0, /*nb_divmod*/
  0, /*nb_power*/
  0, /*nb_negative*/
  0, /*nb_positive*/
  0, /*nb_absolute*/
  __pyx_pw_5pysam_7libcbcf_21VariantHeaderMetadata_7__bool__, /*nb_bool*/
  0, /*nb_invert*/
  0, /*nb_lshift*/
  0, /*nb_rshift*/
  0, /*nb_and*/
  0, /*nb_xor*/
  0, /*nb_or*/
  0, /*nb_int*/
  0, /*nb_long (reserved)*/
  0, /*nb_float*/
  0, /*nb_inplace_add*/
  0, /*nb_inplace_subtract*/
  0, /*nb_inplace_multiply*/
  0, /*nb_inplace_remainder*/
  0, /*nb_inplace_power*/
  0, /*nb_inplace_lshift*/
  0, /*nb_inplace_rshift*/
  0, /*nb_inplace_and*/
  0, /*nb_inplace_xor*/
  0, /*nb_inplace_or*/
  0, /*nb_floor_divide*/
  0, /*nb_true_divide*/
  0, /*nb_inplace_floor_divide*/
  0, /*nb_inplace_true_divide*/
  0, /*nb_index*/
  0, /*nb_matrix_multiply*/
  0, /*nb_inplace_matrix_multiply*/
};

static PySequenceMethods __pyx_tp_as_sequence_VariantHeaderMetadata = {
  __pyx_pw_5pysam_7libcbcf_21VariantHeaderMetadata_5__len__, /*sq_length*/
  0, /*sq_concat*/
  0, /*sq_repeat*/
  __pyx_sq_item_5pysam_7libcbcf_VariantHeaderMetadata, /*sq_item*/
  0, /*sq_slice*/
  0, /*sq_ass_item*/
  0, /*sq_ass_slice*/
  __pyx_pw_5pysam_7libcbcf_21VariantHeaderMetadata_20__contains__, /*sq_contains*/
  0, /*sq_inplace_concat*/
  0, /*sq_inplace_repeat*/
};

static PyMappingMethods __pyx_tp_as_mapping_VariantHeaderMetadata = {
  __pyx_pw_5pysam_7libcbcf_21VariantHeaderMetadata_5__len__, /*mp_length*/
  __pyx_pw_5pysam_7libcbcf_21VariantHeaderMetadata_9__getitem__, /*mp_subscript*/
  0, /*mp_ass_subscript*/
};

static PyTypeObject __pyx_type_5pysam_7libcbcf_VariantHeaderMetadata = {
  PyVarObject_HEAD_INIT(0, 0)
  "pysam.libcbcf.""VariantHeaderMetadata", /*tp_name*/
  sizeof(struct __pyx_obj_5pysam_7libcbcf_VariantHeaderMetadata), /*tp_basicsize*/
  0, /*tp_itemsize*/
  __pyx_tp_dealloc_5pysam_7libcbcf_VariantHeaderMetadata, /*tp_dealloc*/
  #if PY_VERSION_HEX < 0x030800b4
  0, /*tp_print*/
  #endif
  #if PY_VERSION_HEX >= 0x030800b4
  0, /*tp_vectorcall_offset*/
  #endif
  0, /*tp_getattr*/
  0, /*tp_setattr*/
  0, /*tp_as_async*/
  0, /*tp_repr*/
  &__pyx_tp_as_number_VariantHeaderMetadata, /*tp_as_number*/
  &__pyx_tp_as_sequence_VariantHeaderMetadata, /*tp_as_sequence*/
  &__pyx_tp_as_mapping_VariantHeaderMetadata, /*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("VariantHeaderMetadata(*args, **kwargs)\n\nmapping from filter, info or format name to :class:`VariantMetadata` object"), /*tp_doc*/
  __pyx_tp_traverse_5pysam_7libcbcf_VariantHeaderMetadata, /*tp_traverse*/
  __pyx_tp_clear_5pysam_7libcbcf_VariantHeaderMetadata, /*tp_clear*/
  0, /*tp_richcompare*/
  0, /*tp_weaklistoffset*/
  __pyx_pw_5pysam_7libcbcf_21VariantHeaderMetadata_15__iter__, /*tp_iter*/
  0, /*tp_iternext*/
  __pyx_methods_5pysam_7libcbcf_VariantHeaderMetadata, /*tp_methods*/
  0, /*tp_members*/
  __pyx_getsets_5pysam_7libcbcf_VariantHeaderMetadata, /*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_5pysam_7libcbcf_21VariantHeaderMetadata_1__init__, /*tp_init*/
  0, /*tp_alloc*/
  __pyx_tp_new_5pysam_7libcbcf_VariantHeaderMetadata, /*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 PY_VERSION_HEX >= 0x030800b1 && (!CYTHON_COMPILING_IN_PYPY || PYPY_VERSION_NUM >= 0x07030800)
  0, /*tp_vectorcall*/
  #endif
  #if __PYX_NEED_TP_PRINT_SLOT == 1
  0, /*tp_print*/
  #endif
  #if PY_VERSION_HEX >= 0x030C0000
  0, /*tp_watched*/
  #endif
  #if 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_5pysam_7libcbcf_VariantRecord(PyTypeObject *t, CYTHON_UNUSED PyObject *a, CYTHON_UNUSED PyObject *k) {
  struct __pyx_obj_5pysam_7libcbcf_VariantRecord *p;
  PyObject *o;
  #if CYTHON_COMPILING_IN_LIMITED_API
  allocfunc alloc_func = (allocfunc)PyType_GetSlot(t, Py_tp_alloc);
  o = alloc_func(t, 0);
  #else
  if (likely(!__Pyx_PyType_HasFeature(t, Py_TPFLAGS_IS_ABSTRACT))) {
    o = (*t->tp_alloc)(t, 0);
  } else {
    o = (PyObject *) PyBaseObject_Type.tp_new(t, __pyx_mstate_global->__pyx_empty_tuple, 0);
  }
  if (unlikely(!o)) return 0;
  #endif
  p = ((struct __pyx_obj_5pysam_7libcbcf_VariantRecord *)o);
  p->header = ((struct __pyx_obj_5pysam_7libcbcf_VariantHeader *)Py_None); Py_INCREF(Py_None);
  return o;
}

static void __pyx_tp_dealloc_5pysam_7libcbcf_VariantRecord(PyObject *o) {
  struct __pyx_obj_5pysam_7libcbcf_VariantRecord *p = (struct __pyx_obj_5pysam_7libcbcf_VariantRecord *)o;
  #if CYTHON_USE_TP_FINALIZE
  if (unlikely((PY_VERSION_HEX >= 0x03080000 || __Pyx_PyType_HasFeature(Py_TYPE(o), Py_TPFLAGS_HAVE_FINALIZE)) && __Pyx_PyObject_GetSlot(o, tp_finalize, destructor)) && !__Pyx_PyObject_GC_IsFinalized(o)) {
    if (__Pyx_PyObject_GetSlot(o, tp_dealloc, destructor) == __pyx_tp_dealloc_5pysam_7libcbcf_VariantRecord) {
      if (PyObject_CallFinalizerFromDealloc(o)) return;
    }
  }
  #endif
  PyObject_GC_UnTrack(o);
  {
    PyObject *etype, *eval, *etb;
    PyErr_Fetch(&etype, &eval, &etb);
    __Pyx_SET_REFCNT(o, Py_REFCNT(o) + 1);
    __pyx_pw_5pysam_7libcbcf_13VariantRecord_3__dealloc__(o);
    __Pyx_SET_REFCNT(o, Py_REFCNT(o) - 1);
    PyErr_Restore(etype, eval, etb);
  }
  Py_CLEAR(p->header);
  #if CYTHON_USE_TYPE_SLOTS
  (*Py_TYPE(o)->tp_free)(o);
  #else
  {
    freefunc tp_free = (freefunc)PyType_GetSlot(Py_TYPE(o), Py_tp_free);
    if (tp_free) tp_free(o);
  }
  #endif
}

static int __pyx_tp_traverse_5pysam_7libcbcf_VariantRecord(PyObject *o, visitproc v, void *a) {
  int e;
  struct __pyx_obj_5pysam_7libcbcf_VariantRecord *p = (struct __pyx_obj_5pysam_7libcbcf_VariantRecord *)o;
  {
    e = __Pyx_call_type_traverse(o, 1, v, a);
    if (e) return e;
  }
  if (p->header) {
    e = (*v)(((PyObject *)p->header), a); if (e) return e;
  }
  return 0;
}

static int __pyx_tp_clear_5pysam_7libcbcf_VariantRecord(PyObject *o) {
  PyObject* tmp;
  struct __pyx_obj_5pysam_7libcbcf_VariantRecord *p = (struct __pyx_obj_5pysam_7libcbcf_VariantRecord *)o;
  tmp = ((PyObject*)p->header);
  p->header = ((struct __pyx_obj_5pysam_7libcbcf_VariantHeader *)Py_None); Py_INCREF(Py_None);
  Py_XDECREF(tmp);
  return 0;
}

static PyObject *__pyx_getprop_5pysam_7libcbcf_13VariantRecord_rid(PyObject *o, CYTHON_UNUSED void *x) {
  return __pyx_pw_5pysam_7libcbcf_13VariantRecord_3rid_1__get__(o);
}

static int __pyx_setprop_5pysam_7libcbcf_13VariantRecord_rid(PyObject *o, PyObject *v, CYTHON_UNUSED void *x) {
  if (v) {
    return __pyx_pw_5pysam_7libcbcf_13VariantRecord_3rid_3__set__(o, v);
  }
  else {
    PyErr_SetString(PyExc_NotImplementedError, "__del__");
    return -1;
  }
}

static PyObject *__pyx_getprop_5pysam_7libcbcf_13VariantRecord_chrom(PyObject *o, CYTHON_UNUSED void *x) {
  return __pyx_pw_5pysam_7libcbcf_13VariantRecord_5chrom_1__get__(o);
}

static int __pyx_setprop_5pysam_7libcbcf_13VariantRecord_chrom(PyObject *o, PyObject *v, CYTHON_UNUSED void *x) {
  if (v) {
    return __pyx_pw_5pysam_7libcbcf_13VariantRecord_5chrom_3__set__(o, v);
  }
  else {
    PyErr_SetString(PyExc_NotImplementedError, "__del__");
    return -1;
  }
}

static PyObject *__pyx_getprop_5pysam_7libcbcf_13VariantRecord_contig(PyObject *o, CYTHON_UNUSED void *x) {
  return __pyx_pw_5pysam_7libcbcf_13VariantRecord_6contig_1__get__(o);
}

static int __pyx_setprop_5pysam_7libcbcf_13VariantRecord_contig(PyObject *o, PyObject *v, CYTHON_UNUSED void *x) {
  if (v) {
    return __pyx_pw_5pysam_7libcbcf_13VariantRecord_6contig_3__set__(o, v);
  }
  else {
    PyErr_SetString(PyExc_NotImplementedError, "__del__");
    return -1;
  }
}

static PyObject *__pyx_getprop_5pysam_7libcbcf_13VariantRecord_pos(PyObject *o, CYTHON_UNUSED void *x) {
  return __pyx_pw_5pysam_7libcbcf_13VariantRecord_3pos_1__get__(o);
}

static int __pyx_setprop_5pysam_7libcbcf_13VariantRecord_pos(PyObject *o, PyObject *v, CYTHON_UNUSED void *x) {
  if (v) {
    return __pyx_pw_5pysam_7libcbcf_13VariantRecord_3pos_3__set__(o, v);
  }
  else {
    PyErr_SetString(PyExc_NotImplementedError, "__del__");
    return -1;
  }
}

static PyObject *__pyx_getprop_5pysam_7libcbcf_13VariantRecord_start(PyObject *o, CYTHON_UNUSED void *x) {
  return __pyx_pw_5pysam_7libcbcf_13VariantRecord_5start_1__get__(o);
}

static int __pyx_setprop_5pysam_7libcbcf_13VariantRecord_start(PyObject *o, PyObject *v, CYTHON_UNUSED void *x) {
  if (v) {
    return __pyx_pw_5pysam_7libcbcf_13VariantRecord_5start_3__set__(o, v);
  }
  else {
    PyErr_SetString(PyExc_NotImplementedError, "__del__");
    return -1;
  }
}

static PyObject *__pyx_getprop_5pysam_7libcbcf_13VariantRecord_stop(PyObject *o, CYTHON_UNUSED void *x) {
  return __pyx_pw_5pysam_7libcbcf_13VariantRecord_4stop_1__get__(o);
}

static int __pyx_setprop_5pysam_7libcbcf_13VariantRecord_stop(PyObject *o, PyObject *v, CYTHON_UNUSED void *x) {
  if (v) {
    return __pyx_pw_5pysam_7libcbcf_13VariantRecord_4stop_3__set__(o, v);
  }
  else {
    PyErr_SetString(PyExc_NotImplementedError, "__del__");
    return -1;
  }
}

static PyObject *__pyx_getprop_5pysam_7libcbcf_13VariantRecord_rlen(PyObject *o, CYTHON_UNUSED void *x) {
  return __pyx_pw_5pysam_7libcbcf_13VariantRecord_4rlen_1__get__(o);
}

static int __pyx_setprop_5pysam_7libcbcf_13VariantRecord_rlen(PyObject *o, PyObject *v, CYTHON_UNUSED void *x) {
  if (v) {
    return __pyx_pw_5pysam_7libcbcf_13VariantRecord_4rlen_3__set__(o, v);
  }
  else {
    PyErr_SetString(PyExc_NotImplementedError, "__del__");
    return -1;
  }
}

static PyObject *__pyx_getprop_5pysam_7libcbcf_13VariantRecord_qual(PyObject *o, CYTHON_UNUSED void *x) {
  return __pyx_pw_5pysam_7libcbcf_13VariantRecord_4qual_1__get__(o);
}

static int __pyx_setprop_5pysam_7libcbcf_13VariantRecord_qual(PyObject *o, PyObject *v, CYTHON_UNUSED void *x) {
  if (v) {
    return __pyx_pw_5pysam_7libcbcf_13VariantRecord_4qual_3__set__(o, v);
  }
  else {
    PyErr_SetString(PyExc_NotImplementedError, "__del__");
    return -1;
  }
}

static PyObject *__pyx_getprop_5pysam_7libcbcf_13VariantRecord_id(PyObject *o, CYTHON_UNUSED void *x) {
  return __pyx_pw_5pysam_7libcbcf_13VariantRecord_2id_1__get__(o);
}

static int __pyx_setprop_5pysam_7libcbcf_13VariantRecord_id(PyObject *o, PyObject *v, CYTHON_UNUSED void *x) {
  if (v) {
    return __pyx_pw_5pysam_7libcbcf_13VariantRecord_2id_3__set__(o, v);
  }
  else {
    PyErr_SetString(PyExc_NotImplementedError, "__del__");
    return -1;
  }
}

static PyObject *__pyx_getprop_5pysam_7libcbcf_13VariantRecord_ref(PyObject *o, CYTHON_UNUSED void *x) {
  return __pyx_pw_5pysam_7libcbcf_13VariantRecord_3ref_1__get__(o);
}

static int __pyx_setprop_5pysam_7libcbcf_13VariantRecord_ref(PyObject *o, PyObject *v, CYTHON_UNUSED void *x) {
  if (v) {
    return __pyx_pw_5pysam_7libcbcf_13VariantRecord_3ref_3__set__(o, v);
  }
  else {
    PyErr_SetString(PyExc_NotImplementedError, "__del__");
    return -1;
  }
}

static PyObject *__pyx_getprop_5pysam_7libcbcf_13VariantRecord_alleles(PyObject *o, CYTHON_UNUSED void *x) {
  return __pyx_pw_5pysam_7libcbcf_13VariantRecord_7alleles_1__get__(o);
}

static int __pyx_setprop_5pysam_7libcbcf_13VariantRecord_alleles(PyObject *o, PyObject *v, CYTHON_UNUSED void *x) {
  if (v) {
    return __pyx_pw_5pysam_7libcbcf_13VariantRecord_7alleles_3__set__(o, v);
  }
  else {
    PyErr_SetString(PyExc_NotImplementedError, "__del__");
    return -1;
  }
}

static PyObject *__pyx_getprop_5pysam_7libcbcf_13VariantRecord_alts(PyObject *o, CYTHON_UNUSED void *x) {
  return __pyx_pw_5pysam_7libcbcf_13VariantRecord_4alts_1__get__(o);
}

static int __pyx_setprop_5pysam_7libcbcf_13VariantRecord_alts(PyObject *o, PyObject *v, CYTHON_UNUSED void *x) {
  if (v) {
    return __pyx_pw_5pysam_7libcbcf_13VariantRecord_4alts_3__set__(o, v);
  }
  else {
    PyErr_SetString(PyExc_NotImplementedError, "__del__");
    return -1;
  }
}

static PyObject *__pyx_getprop_5pysam_7libcbcf_13VariantRecord_filter(PyObject *o, CYTHON_UNUSED void *x) {
  return __pyx_pw_5pysam_7libcbcf_13VariantRecord_6filter_1__get__(o);
}

static PyObject *__pyx_getprop_5pysam_7libcbcf_13VariantRecord_info(PyObject *o, CYTHON_UNUSED void *x) {
  return __pyx_pw_5pysam_7libcbcf_13VariantRecord_4info_1__get__(o);
}

static PyObject *__pyx_getprop_5pysam_7libcbcf_13VariantRecord_format(PyObject *o, CYTHON_UNUSED void *x) {
  return __pyx_pw_5pysam_7libcbcf_13VariantRecord_6format_1__get__(o);
}

static PyObject *__pyx_getprop_5pysam_7libcbcf_13VariantRecord_samples(PyObject *o, CYTHON_UNUSED void *x) {
  return __pyx_pw_5pysam_7libcbcf_13VariantRecord_7samples_1__get__(o);
}

static PyObject *__pyx_getprop_5pysam_7libcbcf_13VariantRecord_alleles_variant_types(PyObject *o, CYTHON_UNUSED void *x) {
  return __pyx_pw_5pysam_7libcbcf_13VariantRecord_21alleles_variant_types_1__get__(o);
}

static PyObject *__pyx_getprop_5pysam_7libcbcf_13VariantRecord_header(PyObject *o, CYTHON_UNUSED void *x) {
  return __pyx_pw_5pysam_7libcbcf_13VariantRecord_6header_1__get__(o);
}

static PyMethodDef __pyx_methods_5pysam_7libcbcf_VariantRecord[] = {
  {"copy", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_5pysam_7libcbcf_13VariantRecord_5copy, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_5pysam_7libcbcf_13VariantRecord_4copy},
  {"translate", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_5pysam_7libcbcf_13VariantRecord_7translate, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_5pysam_7libcbcf_13VariantRecord_6translate},
  {"__reduce_cython__", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_5pysam_7libcbcf_13VariantRecord_13__reduce_cython__, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_5pysam_7libcbcf_13VariantRecord_12__reduce_cython__},
  {"__setstate_cython__", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_5pysam_7libcbcf_13VariantRecord_15__setstate_cython__, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_5pysam_7libcbcf_13VariantRecord_14__setstate_cython__},
  {0, 0, 0, 0}
};

static struct PyGetSetDef __pyx_getsets_5pysam_7libcbcf_VariantRecord[] = {
  {"rid", __pyx_getprop_5pysam_7libcbcf_13VariantRecord_rid, __pyx_setprop_5pysam_7libcbcf_13VariantRecord_rid, PyDoc_STR("internal reference id number"), 0},
  {"chrom", __pyx_getprop_5pysam_7libcbcf_13VariantRecord_chrom, __pyx_setprop_5pysam_7libcbcf_13VariantRecord_chrom, PyDoc_STR("chromosome/contig name"), 0},
  {"contig", __pyx_getprop_5pysam_7libcbcf_13VariantRecord_contig, __pyx_setprop_5pysam_7libcbcf_13VariantRecord_contig, PyDoc_STR("chromosome/contig name"), 0},
  {"pos", __pyx_getprop_5pysam_7libcbcf_13VariantRecord_pos, __pyx_setprop_5pysam_7libcbcf_13VariantRecord_pos, PyDoc_STR("record start position on chrom/contig (1-based inclusive)"), 0},
  {"start", __pyx_getprop_5pysam_7libcbcf_13VariantRecord_start, __pyx_setprop_5pysam_7libcbcf_13VariantRecord_start, PyDoc_STR("record start position on chrom/contig (0-based inclusive)"), 0},
  {"stop", __pyx_getprop_5pysam_7libcbcf_13VariantRecord_stop, __pyx_setprop_5pysam_7libcbcf_13VariantRecord_stop, PyDoc_STR("record stop position on chrom/contig (0-based exclusive)"), 0},
  {"rlen", __pyx_getprop_5pysam_7libcbcf_13VariantRecord_rlen, __pyx_setprop_5pysam_7libcbcf_13VariantRecord_rlen, PyDoc_STR("record length on chrom/contig (aka rec.stop - rec.start)"), 0},
  {"qual", __pyx_getprop_5pysam_7libcbcf_13VariantRecord_qual, __pyx_setprop_5pysam_7libcbcf_13VariantRecord_qual, PyDoc_STR("phred scaled quality score or None if not available"), 0},
  {"id", __pyx_getprop_5pysam_7libcbcf_13VariantRecord_id, __pyx_setprop_5pysam_7libcbcf_13VariantRecord_id, PyDoc_STR("record identifier or None if not available"), 0},
  {"ref", __pyx_getprop_5pysam_7libcbcf_13VariantRecord_ref, __pyx_setprop_5pysam_7libcbcf_13VariantRecord_ref, PyDoc_STR("reference allele"), 0},
  {"alleles", __pyx_getprop_5pysam_7libcbcf_13VariantRecord_alleles, __pyx_setprop_5pysam_7libcbcf_13VariantRecord_alleles, PyDoc_STR("tuple of reference allele followed by alt alleles"), 0},
  {"alts", __pyx_getprop_5pysam_7libcbcf_13VariantRecord_alts, __pyx_setprop_5pysam_7libcbcf_13VariantRecord_alts, PyDoc_STR("tuple of alt alleles"), 0},
  {"filter", __pyx_getprop_5pysam_7libcbcf_13VariantRecord_filter, 0, PyDoc_STR("filter information (see :class:`VariantRecordFilter`)"), 0},
  {"info", __pyx_getprop_5pysam_7libcbcf_13VariantRecord_info, 0, PyDoc_STR("info data (see :class:`VariantRecordInfo`)"), 0},
  {"format", __pyx_getprop_5pysam_7libcbcf_13VariantRecord_format, 0, PyDoc_STR("sample format metadata (see :class:`VariantRecordFormat`)"), 0},
  {"samples", __pyx_getprop_5pysam_7libcbcf_13VariantRecord_samples, 0, PyDoc_STR("sample data (see :class:`VariantRecordSamples`)"), 0},
  {"alleles_variant_types", __pyx_getprop_5pysam_7libcbcf_13VariantRecord_alleles_variant_types, 0, 0, 0},
  {"header", __pyx_getprop_5pysam_7libcbcf_13VariantRecord_header, 0, 0, 0},
  {0, 0, 0, 0, 0}
};
#if CYTHON_USE_TYPE_SPECS
static PyType_Slot __pyx_type_5pysam_7libcbcf_VariantRecord_slots[] = {
  {Py_tp_dealloc, (void *)__pyx_tp_dealloc_5pysam_7libcbcf_VariantRecord},
  {Py_tp_str, (void *)__pyx_pw_5pysam_7libcbcf_13VariantRecord_11__str__},
  {Py_tp_doc, (void *)PyDoc_STR("VariantRecord(*args, **kwargs)\n\nVariant record")},
  {Py_tp_traverse, (void *)__pyx_tp_traverse_5pysam_7libcbcf_VariantRecord},
  {Py_tp_clear, (void *)__pyx_tp_clear_5pysam_7libcbcf_VariantRecord},
  {Py_tp_richcompare, (void *)__pyx_pw_5pysam_7libcbcf_13VariantRecord_9__richcmp__},
  {Py_tp_methods, (void *)__pyx_methods_5pysam_7libcbcf_VariantRecord},
  {Py_tp_getset, (void *)__pyx_getsets_5pysam_7libcbcf_VariantRecord},
  {Py_tp_init, (void *)__pyx_pw_5pysam_7libcbcf_13VariantRecord_1__init__},
  {Py_tp_new, (void *)__pyx_tp_new_5pysam_7libcbcf_VariantRecord},
  {0, 0},
};
static PyType_Spec __pyx_type_5pysam_7libcbcf_VariantRecord_spec = {
  "pysam.libcbcf.VariantRecord",
  sizeof(struct __pyx_obj_5pysam_7libcbcf_VariantRecord),
  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_5pysam_7libcbcf_VariantRecord_slots,
};
#else

static PyTypeObject __pyx_type_5pysam_7libcbcf_VariantRecord = {
  PyVarObject_HEAD_INIT(0, 0)
  "pysam.libcbcf.""VariantRecord", /*tp_name*/
  sizeof(struct __pyx_obj_5pysam_7libcbcf_VariantRecord), /*tp_basicsize*/
  0, /*tp_itemsize*/
  __pyx_tp_dealloc_5pysam_7libcbcf_VariantRecord, /*tp_dealloc*/
  #if PY_VERSION_HEX < 0x030800b4
  0, /*tp_print*/
  #endif
  #if PY_VERSION_HEX >= 0x030800b4
  0, /*tp_vectorcall_offset*/
  #endif
  0, /*tp_getattr*/
  0, /*tp_setattr*/
  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*/
  __pyx_pw_5pysam_7libcbcf_13VariantRecord_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|Py_TPFLAGS_HAVE_GC, /*tp_flags*/
  PyDoc_STR("VariantRecord(*args, **kwargs)\n\nVariant record"), /*tp_doc*/
  __pyx_tp_traverse_5pysam_7libcbcf_VariantRecord, /*tp_traverse*/
  __pyx_tp_clear_5pysam_7libcbcf_VariantRecord, /*tp_clear*/
  __pyx_pw_5pysam_7libcbcf_13VariantRecord_9__richcmp__, /*tp_richcompare*/
  0, /*tp_weaklistoffset*/
  0, /*tp_iter*/
  0, /*tp_iternext*/
  __pyx_methods_5pysam_7libcbcf_VariantRecord, /*tp_methods*/
  0, /*tp_members*/
  __pyx_getsets_5pysam_7libcbcf_VariantRecord, /*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_5pysam_7libcbcf_13VariantRecord_1__init__, /*tp_init*/
  0, /*tp_alloc*/
  __pyx_tp_new_5pysam_7libcbcf_VariantRecord, /*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 PY_VERSION_HEX >= 0x030800b1 && (!CYTHON_COMPILING_IN_PYPY || PYPY_VERSION_NUM >= 0x07030800)
  0, /*tp_vectorcall*/
  #endif
  #if __PYX_NEED_TP_PRINT_SLOT == 1
  0, /*tp_print*/
  #endif
  #if PY_VERSION_HEX >= 0x030C0000
  0, /*tp_watched*/
  #endif
  #if 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_5pysam_7libcbcf_VariantRecordFilter(PyTypeObject *t, CYTHON_UNUSED PyObject *a, CYTHON_UNUSED PyObject *k) {
  struct __pyx_obj_5pysam_7libcbcf_VariantRecordFilter *p;
  PyObject *o;
  #if CYTHON_COMPILING_IN_LIMITED_API
  allocfunc alloc_func = (allocfunc)PyType_GetSlot(t, Py_tp_alloc);
  o = alloc_func(t, 0);
  #else
  if (likely(!__Pyx_PyType_HasFeature(t, Py_TPFLAGS_IS_ABSTRACT))) {
    o = (*t->tp_alloc)(t, 0);
  } else {
    o = (PyObject *) PyBaseObject_Type.tp_new(t, __pyx_mstate_global->__pyx_empty_tuple, 0);
  }
  if (unlikely(!o)) return 0;
  #endif
  p = ((struct __pyx_obj_5pysam_7libcbcf_VariantRecordFilter *)o);
  p->record = ((struct __pyx_obj_5pysam_7libcbcf_VariantRecord *)Py_None); Py_INCREF(Py_None);
  return o;
}

static void __pyx_tp_dealloc_5pysam_7libcbcf_VariantRecordFilter(PyObject *o) {
  struct __pyx_obj_5pysam_7libcbcf_VariantRecordFilter *p = (struct __pyx_obj_5pysam_7libcbcf_VariantRecordFilter *)o;
  #if CYTHON_USE_TP_FINALIZE
  if (unlikely((PY_VERSION_HEX >= 0x03080000 || __Pyx_PyType_HasFeature(Py_TYPE(o), Py_TPFLAGS_HAVE_FINALIZE)) && __Pyx_PyObject_GetSlot(o, tp_finalize, destructor)) && !__Pyx_PyObject_GC_IsFinalized(o)) {
    if (__Pyx_PyObject_GetSlot(o, tp_dealloc, destructor) == __pyx_tp_dealloc_5pysam_7libcbcf_VariantRecordFilter) {
      if (PyObject_CallFinalizerFromDealloc(o)) return;
    }
  }
  #endif
  PyObject_GC_UnTrack(o);
  Py_CLEAR(p->record);
  #if CYTHON_USE_TYPE_SLOTS
  (*Py_TYPE(o)->tp_free)(o);
  #else
  {
    freefunc tp_free = (freefunc)PyType_GetSlot(Py_TYPE(o), Py_tp_free);
    if (tp_free) tp_free(o);
  }
  #endif
}

static int __pyx_tp_traverse_5pysam_7libcbcf_VariantRecordFilter(PyObject *o, visitproc v, void *a) {
  int e;
  struct __pyx_obj_5pysam_7libcbcf_VariantRecordFilter *p = (struct __pyx_obj_5pysam_7libcbcf_VariantRecordFilter *)o;
  {
    e = __Pyx_call_type_traverse(o, 1, v, a);
    if (e) return e;
  }
  if (p->record) {
    e = (*v)(((PyObject *)p->record), a); if (e) return e;
  }
  return 0;
}

static int __pyx_tp_clear_5pysam_7libcbcf_VariantRecordFilter(PyObject *o) {
  PyObject* tmp;
  struct __pyx_obj_5pysam_7libcbcf_VariantRecordFilter *p = (struct __pyx_obj_5pysam_7libcbcf_VariantRecordFilter *)o;
  tmp = ((PyObject*)p->record);
  p->record = ((struct __pyx_obj_5pysam_7libcbcf_VariantRecord *)Py_None); Py_INCREF(Py_None);
  Py_XDECREF(tmp);
  return 0;
}

static PyObject *__pyx_sq_item_5pysam_7libcbcf_VariantRecordFilter(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_5pysam_7libcbcf_VariantRecordFilter(PyObject *o, PyObject *i, PyObject *v) {
  if (v) {
    __Pyx_TypeName o_type_name;
    o_type_name = __Pyx_PyType_GetFullyQualifiedName(Py_TYPE(o));
    PyErr_Format(PyExc_NotImplementedError,
      "Subscript assignment not supported by " __Pyx_FMT_TYPENAME, o_type_name);
    __Pyx_DECREF_TypeName(o_type_name);
    return -1;
  }
  else {
    return __pyx_pw_5pysam_7libcbcf_19VariantRecordFilter_11__delitem__(o, i);
  }
}

static PyMethodDef __pyx_methods_5pysam_7libcbcf_VariantRecordFilter[] = {
  {"add", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_5pysam_7libcbcf_19VariantRecordFilter_9add, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_5pysam_7libcbcf_19VariantRecordFilter_8add},
  {"clear", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_5pysam_7libcbcf_19VariantRecordFilter_13clear, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_5pysam_7libcbcf_19VariantRecordFilter_12clear},
  {"get", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_5pysam_7libcbcf_19VariantRecordFilter_18get, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_5pysam_7libcbcf_19VariantRecordFilter_17get},
  {"iterkeys", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_5pysam_7libcbcf_19VariantRecordFilter_22iterkeys, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_5pysam_7libcbcf_19VariantRecordFilter_21iterkeys},
  {"itervalues", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_5pysam_7libcbcf_19VariantRecordFilter_24itervalues, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_5pysam_7libcbcf_19VariantRecordFilter_23itervalues},
  {"iteritems", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_5pysam_7libcbcf_19VariantRecordFilter_27iteritems, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_5pysam_7libcbcf_19VariantRecordFilter_26iteritems},
  {"keys", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_5pysam_7libcbcf_19VariantRecordFilter_30keys, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_5pysam_7libcbcf_19VariantRecordFilter_29keys},
  {"items", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_5pysam_7libcbcf_19VariantRecordFilter_32items, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_5pysam_7libcbcf_19VariantRecordFilter_31items},
  {"values", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_5pysam_7libcbcf_19VariantRecordFilter_34values, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_5pysam_7libcbcf_19VariantRecordFilter_33values},
  {"__reduce_cython__", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_5pysam_7libcbcf_19VariantRecordFilter_38__reduce_cython__, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_5pysam_7libcbcf_19VariantRecordFilter_37__reduce_cython__},
  {"__setstate_cython__", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_5pysam_7libcbcf_19VariantRecordFilter_40__setstate_cython__, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_5pysam_7libcbcf_19VariantRecordFilter_39__setstate_cython__},
  {0, 0, 0, 0}
};
#if CYTHON_USE_TYPE_SPECS
static PyType_Slot __pyx_type_5pysam_7libcbcf_VariantRecordFilter_slots[] = {
  {Py_tp_dealloc, (void *)__pyx_tp_dealloc_5pysam_7libcbcf_VariantRecordFilter},
  {Py_nb_bool, (void *)__pyx_pw_5pysam_7libcbcf_19VariantRecordFilter_5__bool__},
  {Py_sq_length, (void *)__pyx_pw_5pysam_7libcbcf_19VariantRecordFilter_3__len__},
  {Py_sq_item, (void *)__pyx_sq_item_5pysam_7libcbcf_VariantRecordFilter},
  {Py_sq_contains, (void *)__pyx_pw_5pysam_7libcbcf_19VariantRecordFilter_20__contains__},
  {Py_mp_length, (void *)__pyx_pw_5pysam_7libcbcf_19VariantRecordFilter_3__len__},
  {Py_mp_subscript, (void *)__pyx_pw_5pysam_7libcbcf_19VariantRecordFilter_7__getitem__},
  {Py_mp_ass_subscript, (void *)__pyx_mp_ass_subscript_5pysam_7libcbcf_VariantRecordFilter},
  {Py_tp_doc, (void *)PyDoc_STR("VariantRecordFilter(*args, **kwargs)\n\nFilters set on a :class:`VariantRecord` object, presented as a mapping from\nfilter index or name to :class:`VariantMetadata` object")},
  {Py_tp_traverse, (void *)__pyx_tp_traverse_5pysam_7libcbcf_VariantRecordFilter},
  {Py_tp_clear, (void *)__pyx_tp_clear_5pysam_7libcbcf_VariantRecordFilter},
  {Py_tp_richcompare, (void *)__pyx_pw_5pysam_7libcbcf_19VariantRecordFilter_36__richcmp__},
  {Py_tp_iter, (void *)__pyx_pw_5pysam_7libcbcf_19VariantRecordFilter_15__iter__},
  {Py_tp_methods, (void *)__pyx_methods_5pysam_7libcbcf_VariantRecordFilter},
  {Py_tp_init, (void *)__pyx_pw_5pysam_7libcbcf_19VariantRecordFilter_1__init__},
  {Py_tp_new, (void *)__pyx_tp_new_5pysam_7libcbcf_VariantRecordFilter},
  {0, 0},
};
static PyType_Spec __pyx_type_5pysam_7libcbcf_VariantRecordFilter_spec = {
  "pysam.libcbcf.VariantRecordFilter",
  sizeof(struct __pyx_obj_5pysam_7libcbcf_VariantRecordFilter),
  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_5pysam_7libcbcf_VariantRecordFilter_slots,
};
#else

static PyNumberMethods __pyx_tp_as_number_VariantRecordFilter = {
  0, /*nb_add*/
  0, /*nb_subtract*/
  0, /*nb_multiply*/
  0, /*nb_remainder*/
  0, /*nb_divmod*/
  0, /*nb_power*/
  0, /*nb_negative*/
  0, /*nb_positive*/
  0, /*nb_absolute*/
  __pyx_pw_5pysam_7libcbcf_19VariantRecordFilter_5__bool__, /*nb_bool*/
  0, /*nb_invert*/
  0, /*nb_lshift*/
  0, /*nb_rshift*/
  0, /*nb_and*/
  0, /*nb_xor*/
  0, /*nb_or*/
  0, /*nb_int*/
  0, /*nb_long (reserved)*/
  0, /*nb_float*/
  0, /*nb_inplace_add*/
  0, /*nb_inplace_subtract*/
  0, /*nb_inplace_multiply*/
  0, /*nb_inplace_remainder*/
  0, /*nb_inplace_power*/
  0, /*nb_inplace_lshift*/
  0, /*nb_inplace_rshift*/
  0, /*nb_inplace_and*/
  0, /*nb_inplace_xor*/
  0, /*nb_inplace_or*/
  0, /*nb_floor_divide*/
  0, /*nb_true_divide*/
  0, /*nb_inplace_floor_divide*/
  0, /*nb_inplace_true_divide*/
  0, /*nb_index*/
  0, /*nb_matrix_multiply*/
  0, /*nb_inplace_matrix_multiply*/
};

static PySequenceMethods __pyx_tp_as_sequence_VariantRecordFilter = {
  __pyx_pw_5pysam_7libcbcf_19VariantRecordFilter_3__len__, /*sq_length*/
  0, /*sq_concat*/
  0, /*sq_repeat*/
  __pyx_sq_item_5pysam_7libcbcf_VariantRecordFilter, /*sq_item*/
  0, /*sq_slice*/
  0, /*sq_ass_item*/
  0, /*sq_ass_slice*/
  __pyx_pw_5pysam_7libcbcf_19VariantRecordFilter_20__contains__, /*sq_contains*/
  0, /*sq_inplace_concat*/
  0, /*sq_inplace_repeat*/
};

static PyMappingMethods __pyx_tp_as_mapping_VariantRecordFilter = {
  __pyx_pw_5pysam_7libcbcf_19VariantRecordFilter_3__len__, /*mp_length*/
  __pyx_pw_5pysam_7libcbcf_19VariantRecordFilter_7__getitem__, /*mp_subscript*/
  __pyx_mp_ass_subscript_5pysam_7libcbcf_VariantRecordFilter, /*mp_ass_subscript*/
};

static PyTypeObject __pyx_type_5pysam_7libcbcf_VariantRecordFilter = {
  PyVarObject_HEAD_INIT(0, 0)
  "pysam.libcbcf.""VariantRecordFilter", /*tp_name*/
  sizeof(struct __pyx_obj_5pysam_7libcbcf_VariantRecordFilter), /*tp_basicsize*/
  0, /*tp_itemsize*/
  __pyx_tp_dealloc_5pysam_7libcbcf_VariantRecordFilter, /*tp_dealloc*/
  #if PY_VERSION_HEX < 0x030800b4
  0, /*tp_print*/
  #endif
  #if PY_VERSION_HEX >= 0x030800b4
  0, /*tp_vectorcall_offset*/
  #endif
  0, /*tp_getattr*/
  0, /*tp_setattr*/
  0, /*tp_as_async*/
  0, /*tp_repr*/
  &__pyx_tp_as_number_VariantRecordFilter, /*tp_as_number*/
  &__pyx_tp_as_sequence_VariantRecordFilter, /*tp_as_sequence*/
  &__pyx_tp_as_mapping_VariantRecordFilter, /*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("VariantRecordFilter(*args, **kwargs)\n\nFilters set on a :class:`VariantRecord` object, presented as a mapping from\nfilter index or name to :class:`VariantMetadata` object"), /*tp_doc*/
  __pyx_tp_traverse_5pysam_7libcbcf_VariantRecordFilter, /*tp_traverse*/
  __pyx_tp_clear_5pysam_7libcbcf_VariantRecordFilter, /*tp_clear*/
  __pyx_pw_5pysam_7libcbcf_19VariantRecordFilter_36__richcmp__, /*tp_richcompare*/
  0, /*tp_weaklistoffset*/
  __pyx_pw_5pysam_7libcbcf_19VariantRecordFilter_15__iter__, /*tp_iter*/
  0, /*tp_iternext*/
  __pyx_methods_5pysam_7libcbcf_VariantRecordFilter, /*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_5pysam_7libcbcf_19VariantRecordFilter_1__init__, /*tp_init*/
  0, /*tp_alloc*/
  __pyx_tp_new_5pysam_7libcbcf_VariantRecordFilter, /*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 PY_VERSION_HEX >= 0x030800b1 && (!CYTHON_COMPILING_IN_PYPY || PYPY_VERSION_NUM >= 0x07030800)
  0, /*tp_vectorcall*/
  #endif
  #if __PYX_NEED_TP_PRINT_SLOT == 1
  0, /*tp_print*/
  #endif
  #if PY_VERSION_HEX >= 0x030C0000
  0, /*tp_watched*/
  #endif
  #if 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_5pysam_7libcbcf_VariantRecordFormat(PyTypeObject *t, CYTHON_UNUSED PyObject *a, CYTHON_UNUSED PyObject *k) {
  struct __pyx_obj_5pysam_7libcbcf_VariantRecordFormat *p;
  PyObject *o;
  #if CYTHON_COMPILING_IN_LIMITED_API
  allocfunc alloc_func = (allocfunc)PyType_GetSlot(t, Py_tp_alloc);
  o = alloc_func(t, 0);
  #else
  if (likely(!__Pyx_PyType_HasFeature(t, Py_TPFLAGS_IS_ABSTRACT))) {
    o = (*t->tp_alloc)(t, 0);
  } else {
    o = (PyObject *) PyBaseObject_Type.tp_new(t, __pyx_mstate_global->__pyx_empty_tuple, 0);
  }
  if (unlikely(!o)) return 0;
  #endif
  p = ((struct __pyx_obj_5pysam_7libcbcf_VariantRecordFormat *)o);
  p->record = ((struct __pyx_obj_5pysam_7libcbcf_VariantRecord *)Py_None); Py_INCREF(Py_None);
  return o;
}

static void __pyx_tp_dealloc_5pysam_7libcbcf_VariantRecordFormat(PyObject *o) {
  struct __pyx_obj_5pysam_7libcbcf_VariantRecordFormat *p = (struct __pyx_obj_5pysam_7libcbcf_VariantRecordFormat *)o;
  #if CYTHON_USE_TP_FINALIZE
  if (unlikely((PY_VERSION_HEX >= 0x03080000 || __Pyx_PyType_HasFeature(Py_TYPE(o), Py_TPFLAGS_HAVE_FINALIZE)) && __Pyx_PyObject_GetSlot(o, tp_finalize, destructor)) && !__Pyx_PyObject_GC_IsFinalized(o)) {
    if (__Pyx_PyObject_GetSlot(o, tp_dealloc, destructor) == __pyx_tp_dealloc_5pysam_7libcbcf_VariantRecordFormat) {
      if (PyObject_CallFinalizerFromDealloc(o)) return;
    }
  }
  #endif
  PyObject_GC_UnTrack(o);
  Py_CLEAR(p->record);
  #if CYTHON_USE_TYPE_SLOTS
  (*Py_TYPE(o)->tp_free)(o);
  #else
  {
    freefunc tp_free = (freefunc)PyType_GetSlot(Py_TYPE(o), Py_tp_free);
    if (tp_free) tp_free(o);
  }
  #endif
}

static int __pyx_tp_traverse_5pysam_7libcbcf_VariantRecordFormat(PyObject *o, visitproc v, void *a) {
  int e;
  struct __pyx_obj_5pysam_7libcbcf_VariantRecordFormat *p = (struct __pyx_obj_5pysam_7libcbcf_VariantRecordFormat *)o;
  {
    e = __Pyx_call_type_traverse(o, 1, v, a);
    if (e) return e;
  }
  if (p->record) {
    e = (*v)(((PyObject *)p->record), a); if (e) return e;
  }
  return 0;
}

static int __pyx_tp_clear_5pysam_7libcbcf_VariantRecordFormat(PyObject *o) {
  PyObject* tmp;
  struct __pyx_obj_5pysam_7libcbcf_VariantRecordFormat *p = (struct __pyx_obj_5pysam_7libcbcf_VariantRecordFormat *)o;
  tmp = ((PyObject*)p->record);
  p->record = ((struct __pyx_obj_5pysam_7libcbcf_VariantRecord *)Py_None); Py_INCREF(Py_None);
  Py_XDECREF(tmp);
  return 0;
}

static PyObject *__pyx_sq_item_5pysam_7libcbcf_VariantRecordFormat(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_5pysam_7libcbcf_VariantRecordFormat(PyObject *o, PyObject *i, PyObject *v) {
  if (v) {
    __Pyx_TypeName o_type_name;
    o_type_name = __Pyx_PyType_GetFullyQualifiedName(Py_TYPE(o));
    PyErr_Format(PyExc_NotImplementedError,
      "Subscript assignment not supported by " __Pyx_FMT_TYPENAME, o_type_name);
    __Pyx_DECREF_TypeName(o_type_name);
    return -1;
  }
  else {
    return __pyx_pw_5pysam_7libcbcf_19VariantRecordFormat_9__delitem__(o, i);
  }
}

static PyMethodDef __pyx_methods_5pysam_7libcbcf_VariantRecordFormat[] = {
  {"clear", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_5pysam_7libcbcf_19VariantRecordFormat_11clear, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_5pysam_7libcbcf_19VariantRecordFormat_10clear},
  {"get", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_5pysam_7libcbcf_19VariantRecordFormat_16get, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_5pysam_7libcbcf_19VariantRecordFormat_15get},
  {"iterkeys", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_5pysam_7libcbcf_19VariantRecordFormat_20iterkeys, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_5pysam_7libcbcf_19VariantRecordFormat_19iterkeys},
  {"itervalues", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_5pysam_7libcbcf_19VariantRecordFormat_22itervalues, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_5pysam_7libcbcf_19VariantRecordFormat_21itervalues},
  {"iteritems", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_5pysam_7libcbcf_19VariantRecordFormat_25iteritems, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_5pysam_7libcbcf_19VariantRecordFormat_24iteritems},
  {"keys", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_5pysam_7libcbcf_19VariantRecordFormat_28keys, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_5pysam_7libcbcf_19VariantRecordFormat_27keys},
  {"items", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_5pysam_7libcbcf_19VariantRecordFormat_30items, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_5pysam_7libcbcf_19VariantRecordFormat_29items},
  {"values", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_5pysam_7libcbcf_19VariantRecordFormat_32values, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_5pysam_7libcbcf_19VariantRecordFormat_31values},
  {"__reduce_cython__", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_5pysam_7libcbcf_19VariantRecordFormat_34__reduce_cython__, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_5pysam_7libcbcf_19VariantRecordFormat_33__reduce_cython__},
  {"__setstate_cython__", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_5pysam_7libcbcf_19VariantRecordFormat_36__setstate_cython__, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_5pysam_7libcbcf_19VariantRecordFormat_35__setstate_cython__},
  {0, 0, 0, 0}
};
#if CYTHON_USE_TYPE_SPECS
static PyType_Slot __pyx_type_5pysam_7libcbcf_VariantRecordFormat_slots[] = {
  {Py_tp_dealloc, (void *)__pyx_tp_dealloc_5pysam_7libcbcf_VariantRecordFormat},
  {Py_nb_bool, (void *)__pyx_pw_5pysam_7libcbcf_19VariantRecordFormat_5__bool__},
  {Py_sq_length, (void *)__pyx_pw_5pysam_7libcbcf_19VariantRecordFormat_3__len__},
  {Py_sq_item, (void *)__pyx_sq_item_5pysam_7libcbcf_VariantRecordFormat},
  {Py_sq_contains, (void *)__pyx_pw_5pysam_7libcbcf_19VariantRecordFormat_18__contains__},
  {Py_mp_length, (void *)__pyx_pw_5pysam_7libcbcf_19VariantRecordFormat_3__len__},
  {Py_mp_subscript, (void *)__pyx_pw_5pysam_7libcbcf_19VariantRecordFormat_7__getitem__},
  {Py_mp_ass_subscript, (void *)__pyx_mp_ass_subscript_5pysam_7libcbcf_VariantRecordFormat},
  {Py_tp_doc, (void *)PyDoc_STR("VariantRecordFormat(*args, **kwargs)\n\nFormat data present for each sample in a :class:`VariantRecord` object,\npresented as mapping from format name to :class:`VariantMetadata` object.")},
  {Py_tp_traverse, (void *)__pyx_tp_traverse_5pysam_7libcbcf_VariantRecordFormat},
  {Py_tp_clear, (void *)__pyx_tp_clear_5pysam_7libcbcf_VariantRecordFormat},
  {Py_tp_iter, (void *)__pyx_pw_5pysam_7libcbcf_19VariantRecordFormat_13__iter__},
  {Py_tp_methods, (void *)__pyx_methods_5pysam_7libcbcf_VariantRecordFormat},
  {Py_tp_init, (void *)__pyx_pw_5pysam_7libcbcf_19VariantRecordFormat_1__init__},
  {Py_tp_new, (void *)__pyx_tp_new_5pysam_7libcbcf_VariantRecordFormat},
  {0, 0},
};
static PyType_Spec __pyx_type_5pysam_7libcbcf_VariantRecordFormat_spec = {
  "pysam.libcbcf.VariantRecordFormat",
  sizeof(struct __pyx_obj_5pysam_7libcbcf_VariantRecordFormat),
  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_5pysam_7libcbcf_VariantRecordFormat_slots,
};
#else

static PyNumberMethods __pyx_tp_as_number_VariantRecordFormat = {
  0, /*nb_add*/
  0, /*nb_subtract*/
  0, /*nb_multiply*/
  0, /*nb_remainder*/
  0, /*nb_divmod*/
  0, /*nb_power*/
  0, /*nb_negative*/
  0, /*nb_positive*/
  0, /*nb_absolute*/
  __pyx_pw_5pysam_7libcbcf_19VariantRecordFormat_5__bool__, /*nb_bool*/
  0, /*nb_invert*/
  0, /*nb_lshift*/
  0, /*nb_rshift*/
  0, /*nb_and*/
  0, /*nb_xor*/
  0, /*nb_or*/
  0, /*nb_int*/
  0, /*nb_long (reserved)*/
  0, /*nb_float*/
  0, /*nb_inplace_add*/
  0, /*nb_inplace_subtract*/
  0, /*nb_inplace_multiply*/
  0, /*nb_inplace_remainder*/
  0, /*nb_inplace_power*/
  0, /*nb_inplace_lshift*/
  0, /*nb_inplace_rshift*/
  0, /*nb_inplace_and*/
  0, /*nb_inplace_xor*/
  0, /*nb_inplace_or*/
  0, /*nb_floor_divide*/
  0, /*nb_true_divide*/
  0, /*nb_inplace_floor_divide*/
  0, /*nb_inplace_true_divide*/
  0, /*nb_index*/
  0, /*nb_matrix_multiply*/
  0, /*nb_inplace_matrix_multiply*/
};

static PySequenceMethods __pyx_tp_as_sequence_VariantRecordFormat = {
  __pyx_pw_5pysam_7libcbcf_19VariantRecordFormat_3__len__, /*sq_length*/
  0, /*sq_concat*/
  0, /*sq_repeat*/
  __pyx_sq_item_5pysam_7libcbcf_VariantRecordFormat, /*sq_item*/
  0, /*sq_slice*/
  0, /*sq_ass_item*/
  0, /*sq_ass_slice*/
  __pyx_pw_5pysam_7libcbcf_19VariantRecordFormat_18__contains__, /*sq_contains*/
  0, /*sq_inplace_concat*/
  0, /*sq_inplace_repeat*/
};

static PyMappingMethods __pyx_tp_as_mapping_VariantRecordFormat = {
  __pyx_pw_5pysam_7libcbcf_19VariantRecordFormat_3__len__, /*mp_length*/
  __pyx_pw_5pysam_7libcbcf_19VariantRecordFormat_7__getitem__, /*mp_subscript*/
  __pyx_mp_ass_subscript_5pysam_7libcbcf_VariantRecordFormat, /*mp_ass_subscript*/
};

static PyTypeObject __pyx_type_5pysam_7libcbcf_VariantRecordFormat = {
  PyVarObject_HEAD_INIT(0, 0)
  "pysam.libcbcf.""VariantRecordFormat", /*tp_name*/
  sizeof(struct __pyx_obj_5pysam_7libcbcf_VariantRecordFormat), /*tp_basicsize*/
  0, /*tp_itemsize*/
  __pyx_tp_dealloc_5pysam_7libcbcf_VariantRecordFormat, /*tp_dealloc*/
  #if PY_VERSION_HEX < 0x030800b4
  0, /*tp_print*/
  #endif
  #if PY_VERSION_HEX >= 0x030800b4
  0, /*tp_vectorcall_offset*/
  #endif
  0, /*tp_getattr*/
  0, /*tp_setattr*/
  0, /*tp_as_async*/
  0, /*tp_repr*/
  &__pyx_tp_as_number_VariantRecordFormat, /*tp_as_number*/
  &__pyx_tp_as_sequence_VariantRecordFormat, /*tp_as_sequence*/
  &__pyx_tp_as_mapping_VariantRecordFormat, /*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("VariantRecordFormat(*args, **kwargs)\n\nFormat data present for each sample in a :class:`VariantRecord` object,\npresented as mapping from format name to :class:`VariantMetadata` object."), /*tp_doc*/
  __pyx_tp_traverse_5pysam_7libcbcf_VariantRecordFormat, /*tp_traverse*/
  __pyx_tp_clear_5pysam_7libcbcf_VariantRecordFormat, /*tp_clear*/
  0, /*tp_richcompare*/
  0, /*tp_weaklistoffset*/
  __pyx_pw_5pysam_7libcbcf_19VariantRecordFormat_13__iter__, /*tp_iter*/
  0, /*tp_iternext*/
  __pyx_methods_5pysam_7libcbcf_VariantRecordFormat, /*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_5pysam_7libcbcf_19VariantRecordFormat_1__init__, /*tp_init*/
  0, /*tp_alloc*/
  __pyx_tp_new_5pysam_7libcbcf_VariantRecordFormat, /*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 PY_VERSION_HEX >= 0x030800b1 && (!CYTHON_COMPILING_IN_PYPY || PYPY_VERSION_NUM >= 0x07030800)
  0, /*tp_vectorcall*/
  #endif
  #if __PYX_NEED_TP_PRINT_SLOT == 1
  0, /*tp_print*/
  #endif
  #if PY_VERSION_HEX >= 0x030C0000
  0, /*tp_watched*/
  #endif
  #if 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_5pysam_7libcbcf_VariantRecordInfo(PyTypeObject *t, CYTHON_UNUSED PyObject *a, CYTHON_UNUSED PyObject *k) {
  struct __pyx_obj_5pysam_7libcbcf_VariantRecordInfo *p;
  PyObject *o;
  #if CYTHON_COMPILING_IN_LIMITED_API
  allocfunc alloc_func = (allocfunc)PyType_GetSlot(t, Py_tp_alloc);
  o = alloc_func(t, 0);
  #else
  if (likely(!__Pyx_PyType_HasFeature(t, Py_TPFLAGS_IS_ABSTRACT))) {
    o = (*t->tp_alloc)(t, 0);
  } else {
    o = (PyObject *) PyBaseObject_Type.tp_new(t, __pyx_mstate_global->__pyx_empty_tuple, 0);
  }
  if (unlikely(!o)) return 0;
  #endif
  p = ((struct __pyx_obj_5pysam_7libcbcf_VariantRecordInfo *)o);
  p->record = ((struct __pyx_obj_5pysam_7libcbcf_VariantRecord *)Py_None); Py_INCREF(Py_None);
  return o;
}

static void __pyx_tp_dealloc_5pysam_7libcbcf_VariantRecordInfo(PyObject *o) {
  struct __pyx_obj_5pysam_7libcbcf_VariantRecordInfo *p = (struct __pyx_obj_5pysam_7libcbcf_VariantRecordInfo *)o;
  #if CYTHON_USE_TP_FINALIZE
  if (unlikely((PY_VERSION_HEX >= 0x03080000 || __Pyx_PyType_HasFeature(Py_TYPE(o), Py_TPFLAGS_HAVE_FINALIZE)) && __Pyx_PyObject_GetSlot(o, tp_finalize, destructor)) && !__Pyx_PyObject_GC_IsFinalized(o)) {
    if (__Pyx_PyObject_GetSlot(o, tp_dealloc, destructor) == __pyx_tp_dealloc_5pysam_7libcbcf_VariantRecordInfo) {
      if (PyObject_CallFinalizerFromDealloc(o)) return;
    }
  }
  #endif
  PyObject_GC_UnTrack(o);
  Py_CLEAR(p->record);
  #if CYTHON_USE_TYPE_SLOTS
  (*Py_TYPE(o)->tp_free)(o);
  #else
  {
    freefunc tp_free = (freefunc)PyType_GetSlot(Py_TYPE(o), Py_tp_free);
    if (tp_free) tp_free(o);
  }
  #endif
}

static int __pyx_tp_traverse_5pysam_7libcbcf_VariantRecordInfo(PyObject *o, visitproc v, void *a) {
  int e;
  struct __pyx_obj_5pysam_7libcbcf_VariantRecordInfo *p = (struct __pyx_obj_5pysam_7libcbcf_VariantRecordInfo *)o;
  {
    e = __Pyx_call_type_traverse(o, 1, v, a);
    if (e) return e;
  }
  if (p->record) {
    e = (*v)(((PyObject *)p->record), a); if (e) return e;
  }
  return 0;
}

static int __pyx_tp_clear_5pysam_7libcbcf_VariantRecordInfo(PyObject *o) {
  PyObject* tmp;
  struct __pyx_obj_5pysam_7libcbcf_VariantRecordInfo *p = (struct __pyx_obj_5pysam_7libcbcf_VariantRecordInfo *)o;
  tmp = ((PyObject*)p->record);
  p->record = ((struct __pyx_obj_5pysam_7libcbcf_VariantRecord *)Py_None); Py_INCREF(Py_None);
  Py_XDECREF(tmp);
  return 0;
}

static PyObject *__pyx_sq_item_5pysam_7libcbcf_VariantRecordInfo(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_5pysam_7libcbcf_VariantRecordInfo(PyObject *o, PyObject *i, PyObject *v) {
  if (v) {
    return __pyx_pw_5pysam_7libcbcf_17VariantRecordInfo_9__setitem__(o, i, v);
  }
  else {
    return __pyx_pw_5pysam_7libcbcf_17VariantRecordInfo_11__delitem__(o, i);
  }
}

static PyMethodDef __pyx_methods_5pysam_7libcbcf_VariantRecordInfo[] = {
  {"clear", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_5pysam_7libcbcf_17VariantRecordInfo_13clear, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_5pysam_7libcbcf_17VariantRecordInfo_12clear},
  {"get", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_5pysam_7libcbcf_17VariantRecordInfo_18get, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_5pysam_7libcbcf_17VariantRecordInfo_17get},
  {"iterkeys", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_5pysam_7libcbcf_17VariantRecordInfo_22iterkeys, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_5pysam_7libcbcf_17VariantRecordInfo_21iterkeys},
  {"itervalues", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_5pysam_7libcbcf_17VariantRecordInfo_24itervalues, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_5pysam_7libcbcf_17VariantRecordInfo_23itervalues},
  {"iteritems", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_5pysam_7libcbcf_17VariantRecordInfo_27iteritems, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_5pysam_7libcbcf_17VariantRecordInfo_26iteritems},
  {"keys", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_5pysam_7libcbcf_17VariantRecordInfo_30keys, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_5pysam_7libcbcf_17VariantRecordInfo_29keys},
  {"items", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_5pysam_7libcbcf_17VariantRecordInfo_32items, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_5pysam_7libcbcf_17VariantRecordInfo_31items},
  {"values", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_5pysam_7libcbcf_17VariantRecordInfo_34values, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_5pysam_7libcbcf_17VariantRecordInfo_33values},
  {"update", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_5pysam_7libcbcf_17VariantRecordInfo_36update, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_5pysam_7libcbcf_17VariantRecordInfo_35update},
  {"pop", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_5pysam_7libcbcf_17VariantRecordInfo_38pop, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_5pysam_7libcbcf_17VariantRecordInfo_37pop},
  {"__reduce_cython__", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_5pysam_7libcbcf_17VariantRecordInfo_42__reduce_cython__, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_5pysam_7libcbcf_17VariantRecordInfo_41__reduce_cython__},
  {"__setstate_cython__", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_5pysam_7libcbcf_17VariantRecordInfo_44__setstate_cython__, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_5pysam_7libcbcf_17VariantRecordInfo_43__setstate_cython__},
  {0, 0, 0, 0}
};
#if CYTHON_USE_TYPE_SPECS
static PyType_Slot __pyx_type_5pysam_7libcbcf_VariantRecordInfo_slots[] = {
  {Py_tp_dealloc, (void *)__pyx_tp_dealloc_5pysam_7libcbcf_VariantRecordInfo},
  {Py_nb_bool, (void *)__pyx_pw_5pysam_7libcbcf_17VariantRecordInfo_5__bool__},
  {Py_sq_length, (void *)__pyx_pw_5pysam_7libcbcf_17VariantRecordInfo_3__len__},
  {Py_sq_item, (void *)__pyx_sq_item_5pysam_7libcbcf_VariantRecordInfo},
  {Py_sq_contains, (void *)__pyx_pw_5pysam_7libcbcf_17VariantRecordInfo_20__contains__},
  {Py_mp_length, (void *)__pyx_pw_5pysam_7libcbcf_17VariantRecordInfo_3__len__},
  {Py_mp_subscript, (void *)__pyx_pw_5pysam_7libcbcf_17VariantRecordInfo_7__getitem__},
  {Py_mp_ass_subscript, (void *)__pyx_mp_ass_subscript_5pysam_7libcbcf_VariantRecordInfo},
  {Py_tp_doc, (void *)PyDoc_STR("VariantRecordInfo(*args, **kwargs)\n\nInfo data stored in a :class:`VariantRecord` object, presented as a\nmapping from info metadata name to value.")},
  {Py_tp_traverse, (void *)__pyx_tp_traverse_5pysam_7libcbcf_VariantRecordInfo},
  {Py_tp_clear, (void *)__pyx_tp_clear_5pysam_7libcbcf_VariantRecordInfo},
  {Py_tp_richcompare, (void *)__pyx_pw_5pysam_7libcbcf_17VariantRecordInfo_40__richcmp__},
  {Py_tp_iter, (void *)__pyx_pw_5pysam_7libcbcf_17VariantRecordInfo_15__iter__},
  {Py_tp_methods, (void *)__pyx_methods_5pysam_7libcbcf_VariantRecordInfo},
  {Py_tp_init, (void *)__pyx_pw_5pysam_7libcbcf_17VariantRecordInfo_1__init__},
  {Py_tp_new, (void *)__pyx_tp_new_5pysam_7libcbcf_VariantRecordInfo},
  {0, 0},
};
static PyType_Spec __pyx_type_5pysam_7libcbcf_VariantRecordInfo_spec = {
  "pysam.libcbcf.VariantRecordInfo",
  sizeof(struct __pyx_obj_5pysam_7libcbcf_VariantRecordInfo),
  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_5pysam_7libcbcf_VariantRecordInfo_slots,
};
#else

static PyNumberMethods __pyx_tp_as_number_VariantRecordInfo = {
  0, /*nb_add*/
  0, /*nb_subtract*/
  0, /*nb_multiply*/
  0, /*nb_remainder*/
  0, /*nb_divmod*/
  0, /*nb_power*/
  0, /*nb_negative*/
  0, /*nb_positive*/
  0, /*nb_absolute*/
  __pyx_pw_5pysam_7libcbcf_17VariantRecordInfo_5__bool__, /*nb_bool*/
  0, /*nb_invert*/
  0, /*nb_lshift*/
  0, /*nb_rshift*/
  0, /*nb_and*/
  0, /*nb_xor*/
  0, /*nb_or*/
  0, /*nb_int*/
  0, /*nb_long (reserved)*/
  0, /*nb_float*/
  0, /*nb_inplace_add*/
  0, /*nb_inplace_subtract*/
  0, /*nb_inplace_multiply*/
  0, /*nb_inplace_remainder*/
  0, /*nb_inplace_power*/
  0, /*nb_inplace_lshift*/
  0, /*nb_inplace_rshift*/
  0, /*nb_inplace_and*/
  0, /*nb_inplace_xor*/
  0, /*nb_inplace_or*/
  0, /*nb_floor_divide*/
  0, /*nb_true_divide*/
  0, /*nb_inplace_floor_divide*/
  0, /*nb_inplace_true_divide*/
  0, /*nb_index*/
  0, /*nb_matrix_multiply*/
  0, /*nb_inplace_matrix_multiply*/
};

static PySequenceMethods __pyx_tp_as_sequence_VariantRecordInfo = {
  __pyx_pw_5pysam_7libcbcf_17VariantRecordInfo_3__len__, /*sq_length*/
  0, /*sq_concat*/
  0, /*sq_repeat*/
  __pyx_sq_item_5pysam_7libcbcf_VariantRecordInfo, /*sq_item*/
  0, /*sq_slice*/
  0, /*sq_ass_item*/
  0, /*sq_ass_slice*/
  __pyx_pw_5pysam_7libcbcf_17VariantRecordInfo_20__contains__, /*sq_contains*/
  0, /*sq_inplace_concat*/
  0, /*sq_inplace_repeat*/
};

static PyMappingMethods __pyx_tp_as_mapping_VariantRecordInfo = {
  __pyx_pw_5pysam_7libcbcf_17VariantRecordInfo_3__len__, /*mp_length*/
  __pyx_pw_5pysam_7libcbcf_17VariantRecordInfo_7__getitem__, /*mp_subscript*/
  __pyx_mp_ass_subscript_5pysam_7libcbcf_VariantRecordInfo, /*mp_ass_subscript*/
};

static PyTypeObject __pyx_type_5pysam_7libcbcf_VariantRecordInfo = {
  PyVarObject_HEAD_INIT(0, 0)
  "pysam.libcbcf.""VariantRecordInfo", /*tp_name*/
  sizeof(struct __pyx_obj_5pysam_7libcbcf_VariantRecordInfo), /*tp_basicsize*/
  0, /*tp_itemsize*/
  __pyx_tp_dealloc_5pysam_7libcbcf_VariantRecordInfo, /*tp_dealloc*/
  #if PY_VERSION_HEX < 0x030800b4
  0, /*tp_print*/
  #endif
  #if PY_VERSION_HEX >= 0x030800b4
  0, /*tp_vectorcall_offset*/
  #endif
  0, /*tp_getattr*/
  0, /*tp_setattr*/
  0, /*tp_as_async*/
  0, /*tp_repr*/
  &__pyx_tp_as_number_VariantRecordInfo, /*tp_as_number*/
  &__pyx_tp_as_sequence_VariantRecordInfo, /*tp_as_sequence*/
  &__pyx_tp_as_mapping_VariantRecordInfo, /*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("VariantRecordInfo(*args, **kwargs)\n\nInfo data stored in a :class:`VariantRecord` object, presented as a\nmapping from info metadata name to value."), /*tp_doc*/
  __pyx_tp_traverse_5pysam_7libcbcf_VariantRecordInfo, /*tp_traverse*/
  __pyx_tp_clear_5pysam_7libcbcf_VariantRecordInfo, /*tp_clear*/
  __pyx_pw_5pysam_7libcbcf_17VariantRecordInfo_40__richcmp__, /*tp_richcompare*/
  0, /*tp_weaklistoffset*/
  __pyx_pw_5pysam_7libcbcf_17VariantRecordInfo_15__iter__, /*tp_iter*/
  0, /*tp_iternext*/
  __pyx_methods_5pysam_7libcbcf_VariantRecordInfo, /*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_5pysam_7libcbcf_17VariantRecordInfo_1__init__, /*tp_init*/
  0, /*tp_alloc*/
  __pyx_tp_new_5pysam_7libcbcf_VariantRecordInfo, /*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 PY_VERSION_HEX >= 0x030800b1 && (!CYTHON_COMPILING_IN_PYPY || PYPY_VERSION_NUM >= 0x07030800)
  0, /*tp_vectorcall*/
  #endif
  #if __PYX_NEED_TP_PRINT_SLOT == 1
  0, /*tp_print*/
  #endif
  #if PY_VERSION_HEX >= 0x030C0000
  0, /*tp_watched*/
  #endif
  #if 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_5pysam_7libcbcf_VariantRecordSamples(PyTypeObject *t, CYTHON_UNUSED PyObject *a, CYTHON_UNUSED PyObject *k) {
  struct __pyx_obj_5pysam_7libcbcf_VariantRecordSamples *p;
  PyObject *o;
  #if CYTHON_COMPILING_IN_LIMITED_API
  allocfunc alloc_func = (allocfunc)PyType_GetSlot(t, Py_tp_alloc);
  o = alloc_func(t, 0);
  #else
  if (likely(!__Pyx_PyType_HasFeature(t, Py_TPFLAGS_IS_ABSTRACT))) {
    o = (*t->tp_alloc)(t, 0);
  } else {
    o = (PyObject *) PyBaseObject_Type.tp_new(t, __pyx_mstate_global->__pyx_empty_tuple, 0);
  }
  if (unlikely(!o)) return 0;
  #endif
  p = ((struct __pyx_obj_5pysam_7libcbcf_VariantRecordSamples *)o);
  p->record = ((struct __pyx_obj_5pysam_7libcbcf_VariantRecord *)Py_None); Py_INCREF(Py_None);
  return o;
}

static void __pyx_tp_dealloc_5pysam_7libcbcf_VariantRecordSamples(PyObject *o) {
  struct __pyx_obj_5pysam_7libcbcf_VariantRecordSamples *p = (struct __pyx_obj_5pysam_7libcbcf_VariantRecordSamples *)o;
  #if CYTHON_USE_TP_FINALIZE
  if (unlikely((PY_VERSION_HEX >= 0x03080000 || __Pyx_PyType_HasFeature(Py_TYPE(o), Py_TPFLAGS_HAVE_FINALIZE)) && __Pyx_PyObject_GetSlot(o, tp_finalize, destructor)) && !__Pyx_PyObject_GC_IsFinalized(o)) {
    if (__Pyx_PyObject_GetSlot(o, tp_dealloc, destructor) == __pyx_tp_dealloc_5pysam_7libcbcf_VariantRecordSamples) {
      if (PyObject_CallFinalizerFromDealloc(o)) return;
    }
  }
  #endif
  PyObject_GC_UnTrack(o);
  Py_CLEAR(p->record);
  #if CYTHON_USE_TYPE_SLOTS
  (*Py_TYPE(o)->tp_free)(o);
  #else
  {
    freefunc tp_free = (freefunc)PyType_GetSlot(Py_TYPE(o), Py_tp_free);
    if (tp_free) tp_free(o);
  }
  #endif
}

static int __pyx_tp_traverse_5pysam_7libcbcf_VariantRecordSamples(PyObject *o, visitproc v, void *a) {
  int e;
  struct __pyx_obj_5pysam_7libcbcf_VariantRecordSamples *p = (struct __pyx_obj_5pysam_7libcbcf_VariantRecordSamples *)o;
  {
    e = __Pyx_call_type_traverse(o, 1, v, a);
    if (e) return e;
  }
  if (p->record) {
    e = (*v)(((PyObject *)p->record), a); if (e) return e;
  }
  return 0;
}

static int __pyx_tp_clear_5pysam_7libcbcf_VariantRecordSamples(PyObject *o) {
  PyObject* tmp;
  struct __pyx_obj_5pysam_7libcbcf_VariantRecordSamples *p = (struct __pyx_obj_5pysam_7libcbcf_VariantRecordSamples *)o;
  tmp = ((PyObject*)p->record);
  p->record = ((struct __pyx_obj_5pysam_7libcbcf_VariantRecord *)Py_None); Py_INCREF(Py_None);
  Py_XDECREF(tmp);
  return 0;
}

static PyObject *__pyx_sq_item_5pysam_7libcbcf_VariantRecordSamples(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 PyMethodDef __pyx_methods_5pysam_7libcbcf_VariantRecordSamples[] = {
  {"get", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_5pysam_7libcbcf_20VariantRecordSamples_12get, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_5pysam_7libcbcf_20VariantRecordSamples_11get},
  {"iterkeys", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_5pysam_7libcbcf_20VariantRecordSamples_16iterkeys, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_5pysam_7libcbcf_20VariantRecordSamples_15iterkeys},
  {"itervalues", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_5pysam_7libcbcf_20VariantRecordSamples_18itervalues, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_5pysam_7libcbcf_20VariantRecordSamples_17itervalues},
  {"iteritems", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_5pysam_7libcbcf_20VariantRecordSamples_21iteritems, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_5pysam_7libcbcf_20VariantRecordSamples_20iteritems},
  {"keys", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_5pysam_7libcbcf_20VariantRecordSamples_24keys, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_5pysam_7libcbcf_20VariantRecordSamples_23keys},
  {"items", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_5pysam_7libcbcf_20VariantRecordSamples_26items, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_5pysam_7libcbcf_20VariantRecordSamples_25items},
  {"values", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_5pysam_7libcbcf_20VariantRecordSamples_28values, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_5pysam_7libcbcf_20VariantRecordSamples_27values},
  {"update", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_5pysam_7libcbcf_20VariantRecordSamples_30update, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_5pysam_7libcbcf_20VariantRecordSamples_29update},
  {"pop", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_5pysam_7libcbcf_20VariantRecordSamples_32pop, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_5pysam_7libcbcf_20VariantRecordSamples_31pop},
  {"__reduce_cython__", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_5pysam_7libcbcf_20VariantRecordSamples_36__reduce_cython__, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_5pysam_7libcbcf_20VariantRecordSamples_35__reduce_cython__},
  {"__setstate_cython__", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_5pysam_7libcbcf_20VariantRecordSamples_38__setstate_cython__, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_5pysam_7libcbcf_20VariantRecordSamples_37__setstate_cython__},
  {0, 0, 0, 0}
};
#if CYTHON_USE_TYPE_SPECS
static PyType_Slot __pyx_type_5pysam_7libcbcf_VariantRecordSamples_slots[] = {
  {Py_tp_dealloc, (void *)__pyx_tp_dealloc_5pysam_7libcbcf_VariantRecordSamples},
  {Py_nb_bool, (void *)__pyx_pw_5pysam_7libcbcf_20VariantRecordSamples_5__bool__},
  {Py_sq_length, (void *)__pyx_pw_5pysam_7libcbcf_20VariantRecordSamples_3__len__},
  {Py_sq_item, (void *)__pyx_sq_item_5pysam_7libcbcf_VariantRecordSamples},
  {Py_sq_contains, (void *)__pyx_pw_5pysam_7libcbcf_20VariantRecordSamples_14__contains__},
  {Py_mp_length, (void *)__pyx_pw_5pysam_7libcbcf_20VariantRecordSamples_3__len__},
  {Py_mp_subscript, (void *)__pyx_pw_5pysam_7libcbcf_20VariantRecordSamples_7__getitem__},
  {Py_tp_doc, (void *)PyDoc_STR("VariantRecordSamples(*args, **kwargs)\n\nmapping from sample index or name to :class:`VariantRecordSample` object.")},
  {Py_tp_traverse, (void *)__pyx_tp_traverse_5pysam_7libcbcf_VariantRecordSamples},
  {Py_tp_clear, (void *)__pyx_tp_clear_5pysam_7libcbcf_VariantRecordSamples},
  {Py_tp_richcompare, (void *)__pyx_pw_5pysam_7libcbcf_20VariantRecordSamples_34__richcmp__},
  {Py_tp_iter, (void *)__pyx_pw_5pysam_7libcbcf_20VariantRecordSamples_9__iter__},
  {Py_tp_methods, (void *)__pyx_methods_5pysam_7libcbcf_VariantRecordSamples},
  {Py_tp_init, (void *)__pyx_pw_5pysam_7libcbcf_20VariantRecordSamples_1__init__},
  {Py_tp_new, (void *)__pyx_tp_new_5pysam_7libcbcf_VariantRecordSamples},
  {0, 0},
};
static PyType_Spec __pyx_type_5pysam_7libcbcf_VariantRecordSamples_spec = {
  "pysam.libcbcf.VariantRecordSamples",
  sizeof(struct __pyx_obj_5pysam_7libcbcf_VariantRecordSamples),
  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_5pysam_7libcbcf_VariantRecordSamples_slots,
};
#else

static PyNumberMethods __pyx_tp_as_number_VariantRecordSamples = {
  0, /*nb_add*/
  0, /*nb_subtract*/
  0, /*nb_multiply*/
  0, /*nb_remainder*/
  0, /*nb_divmod*/
  0, /*nb_power*/
  0, /*nb_negative*/
  0, /*nb_positive*/
  0, /*nb_absolute*/
  __pyx_pw_5pysam_7libcbcf_20VariantRecordSamples_5__bool__, /*nb_bool*/
  0, /*nb_invert*/
  0, /*nb_lshift*/
  0, /*nb_rshift*/
  0, /*nb_and*/
  0, /*nb_xor*/
  0, /*nb_or*/
  0, /*nb_int*/
  0, /*nb_long (reserved)*/
  0, /*nb_float*/
  0, /*nb_inplace_add*/
  0, /*nb_inplace_subtract*/
  0, /*nb_inplace_multiply*/
  0, /*nb_inplace_remainder*/
  0, /*nb_inplace_power*/
  0, /*nb_inplace_lshift*/
  0, /*nb_inplace_rshift*/
  0, /*nb_inplace_and*/
  0, /*nb_inplace_xor*/
  0, /*nb_inplace_or*/
  0, /*nb_floor_divide*/
  0, /*nb_true_divide*/
  0, /*nb_inplace_floor_divide*/
  0, /*nb_inplace_true_divide*/
  0, /*nb_index*/
  0, /*nb_matrix_multiply*/
  0, /*nb_inplace_matrix_multiply*/
};

static PySequenceMethods __pyx_tp_as_sequence_VariantRecordSamples = {
  __pyx_pw_5pysam_7libcbcf_20VariantRecordSamples_3__len__, /*sq_length*/
  0, /*sq_concat*/
  0, /*sq_repeat*/
  __pyx_sq_item_5pysam_7libcbcf_VariantRecordSamples, /*sq_item*/
  0, /*sq_slice*/
  0, /*sq_ass_item*/
  0, /*sq_ass_slice*/
  __pyx_pw_5pysam_7libcbcf_20VariantRecordSamples_14__contains__, /*sq_contains*/
  0, /*sq_inplace_concat*/
  0, /*sq_inplace_repeat*/
};

static PyMappingMethods __pyx_tp_as_mapping_VariantRecordSamples = {
  __pyx_pw_5pysam_7libcbcf_20VariantRecordSamples_3__len__, /*mp_length*/
  __pyx_pw_5pysam_7libcbcf_20VariantRecordSamples_7__getitem__, /*mp_subscript*/
  0, /*mp_ass_subscript*/
};

static PyTypeObject __pyx_type_5pysam_7libcbcf_VariantRecordSamples = {
  PyVarObject_HEAD_INIT(0, 0)
  "pysam.libcbcf.""VariantRecordSamples", /*tp_name*/
  sizeof(struct __pyx_obj_5pysam_7libcbcf_VariantRecordSamples), /*tp_basicsize*/
  0, /*tp_itemsize*/
  __pyx_tp_dealloc_5pysam_7libcbcf_VariantRecordSamples, /*tp_dealloc*/
  #if PY_VERSION_HEX < 0x030800b4
  0, /*tp_print*/
  #endif
  #if PY_VERSION_HEX >= 0x030800b4
  0, /*tp_vectorcall_offset*/
  #endif
  0, /*tp_getattr*/
  0, /*tp_setattr*/
  0, /*tp_as_async*/
  0, /*tp_repr*/
  &__pyx_tp_as_number_VariantRecordSamples, /*tp_as_number*/
  &__pyx_tp_as_sequence_VariantRecordSamples, /*tp_as_sequence*/
  &__pyx_tp_as_mapping_VariantRecordSamples, /*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("VariantRecordSamples(*args, **kwargs)\n\nmapping from sample index or name to :class:`VariantRecordSample` object."), /*tp_doc*/
  __pyx_tp_traverse_5pysam_7libcbcf_VariantRecordSamples, /*tp_traverse*/
  __pyx_tp_clear_5pysam_7libcbcf_VariantRecordSamples, /*tp_clear*/
  __pyx_pw_5pysam_7libcbcf_20VariantRecordSamples_34__richcmp__, /*tp_richcompare*/
  0, /*tp_weaklistoffset*/
  __pyx_pw_5pysam_7libcbcf_20VariantRecordSamples_9__iter__, /*tp_iter*/
  0, /*tp_iternext*/
  __pyx_methods_5pysam_7libcbcf_VariantRecordSamples, /*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_5pysam_7libcbcf_20VariantRecordSamples_1__init__, /*tp_init*/
  0, /*tp_alloc*/
  __pyx_tp_new_5pysam_7libcbcf_VariantRecordSamples, /*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 PY_VERSION_HEX >= 0x030800b1 && (!CYTHON_COMPILING_IN_PYPY || PYPY_VERSION_NUM >= 0x07030800)
  0, /*tp_vectorcall*/
  #endif
  #if __PYX_NEED_TP_PRINT_SLOT == 1
  0, /*tp_print*/
  #endif
  #if PY_VERSION_HEX >= 0x030C0000
  0, /*tp_watched*/
  #endif
  #if 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_5pysam_7libcbcf_VariantRecordSample(PyTypeObject *t, CYTHON_UNUSED PyObject *a, CYTHON_UNUSED PyObject *k) {
  struct __pyx_obj_5pysam_7libcbcf_VariantRecordSample *p;
  PyObject *o;
  #if CYTHON_COMPILING_IN_LIMITED_API
  allocfunc alloc_func = (allocfunc)PyType_GetSlot(t, Py_tp_alloc);
  o = alloc_func(t, 0);
  #else
  if (likely(!__Pyx_PyType_HasFeature(t, Py_TPFLAGS_IS_ABSTRACT))) {
    o = (*t->tp_alloc)(t, 0);
  } else {
    o = (PyObject *) PyBaseObject_Type.tp_new(t, __pyx_mstate_global->__pyx_empty_tuple, 0);
  }
  if (unlikely(!o)) return 0;
  #endif
  p = ((struct __pyx_obj_5pysam_7libcbcf_VariantRecordSample *)o);
  p->record = ((struct __pyx_obj_5pysam_7libcbcf_VariantRecord *)Py_None); Py_INCREF(Py_None);
  return o;
}

static void __pyx_tp_dealloc_5pysam_7libcbcf_VariantRecordSample(PyObject *o) {
  struct __pyx_obj_5pysam_7libcbcf_VariantRecordSample *p = (struct __pyx_obj_5pysam_7libcbcf_VariantRecordSample *)o;
  #if CYTHON_USE_TP_FINALIZE
  if (unlikely((PY_VERSION_HEX >= 0x03080000 || __Pyx_PyType_HasFeature(Py_TYPE(o), Py_TPFLAGS_HAVE_FINALIZE)) && __Pyx_PyObject_GetSlot(o, tp_finalize, destructor)) && !__Pyx_PyObject_GC_IsFinalized(o)) {
    if (__Pyx_PyObject_GetSlot(o, tp_dealloc, destructor) == __pyx_tp_dealloc_5pysam_7libcbcf_VariantRecordSample) {
      if (PyObject_CallFinalizerFromDealloc(o)) return;
    }
  }
  #endif
  PyObject_GC_UnTrack(o);
  Py_CLEAR(p->record);
  #if CYTHON_USE_TYPE_SLOTS
  (*Py_TYPE(o)->tp_free)(o);
  #else
  {
    freefunc tp_free = (freefunc)PyType_GetSlot(Py_TYPE(o), Py_tp_free);
    if (tp_free) tp_free(o);
  }
  #endif
}

static int __pyx_tp_traverse_5pysam_7libcbcf_VariantRecordSample(PyObject *o, visitproc v, void *a) {
  int e;
  struct __pyx_obj_5pysam_7libcbcf_VariantRecordSample *p = (struct __pyx_obj_5pysam_7libcbcf_VariantRecordSample *)o;
  {
    e = __Pyx_call_type_traverse(o, 1, v, a);
    if (e) return e;
  }
  if (p->record) {
    e = (*v)(((PyObject *)p->record), a); if (e) return e;
  }
  return 0;
}

static int __pyx_tp_clear_5pysam_7libcbcf_VariantRecordSample(PyObject *o) {
  PyObject* tmp;
  struct __pyx_obj_5pysam_7libcbcf_VariantRecordSample *p = (struct __pyx_obj_5pysam_7libcbcf_VariantRecordSample *)o;
  tmp = ((PyObject*)p->record);
  p->record = ((struct __pyx_obj_5pysam_7libcbcf_VariantRecord *)Py_None); Py_INCREF(Py_None);
  Py_XDECREF(tmp);
  return 0;
}

static PyObject *__pyx_sq_item_5pysam_7libcbcf_VariantRecordSample(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_5pysam_7libcbcf_VariantRecordSample(PyObject *o, PyObject *i, PyObject *v) {
  if (v) {
    return __pyx_pw_5pysam_7libcbcf_19VariantRecordSample_9__setitem__(o, i, v);
  }
  else {
    return __pyx_pw_5pysam_7libcbcf_19VariantRecordSample_11__delitem__(o, i);
  }
}

static PyObject *__pyx_getprop_5pysam_7libcbcf_19VariantRecordSample_name(PyObject *o, CYTHON_UNUSED void *x) {
  return __pyx_pw_5pysam_7libcbcf_19VariantRecordSample_4name_1__get__(o);
}

static PyObject *__pyx_getprop_5pysam_7libcbcf_19VariantRecordSample_allele_indices(PyObject *o, CYTHON_UNUSED void *x) {
  return __pyx_pw_5pysam_7libcbcf_19VariantRecordSample_14allele_indices_1__get__(o);
}

static int __pyx_setprop_5pysam_7libcbcf_19VariantRecordSample_allele_indices(PyObject *o, PyObject *v, CYTHON_UNUSED void *x) {
  if (v) {
    return __pyx_pw_5pysam_7libcbcf_19VariantRecordSample_14allele_indices_3__set__(o, v);
  }
  else {
    return __pyx_pw_5pysam_7libcbcf_19VariantRecordSample_14allele_indices_5__del__(o);
  }
}

static PyObject *__pyx_getprop_5pysam_7libcbcf_19VariantRecordSample_alleles(PyObject *o, CYTHON_UNUSED void *x) {
  return __pyx_pw_5pysam_7libcbcf_19VariantRecordSample_7alleles_1__get__(o);
}

static int __pyx_setprop_5pysam_7libcbcf_19VariantRecordSample_alleles(PyObject *o, PyObject *v, CYTHON_UNUSED void *x) {
  if (v) {
    return __pyx_pw_5pysam_7libcbcf_19VariantRecordSample_7alleles_3__set__(o, v);
  }
  else {
    return __pyx_pw_5pysam_7libcbcf_19VariantRecordSample_7alleles_5__del__(o);
  }
}

static PyObject *__pyx_getprop_5pysam_7libcbcf_19VariantRecordSample_phased(PyObject *o, CYTHON_UNUSED void *x) {
  return __pyx_pw_5pysam_7libcbcf_19VariantRecordSample_6phased_1__get__(o);
}

static int __pyx_setprop_5pysam_7libcbcf_19VariantRecordSample_phased(PyObject *o, PyObject *v, CYTHON_UNUSED void *x) {
  if (v) {
    return __pyx_pw_5pysam_7libcbcf_19VariantRecordSample_6phased_3__set__(o, v);
  }
  else {
    PyErr_SetString(PyExc_NotImplementedError, "__del__");
    return -1;
  }
}

static PyObject *__pyx_getprop_5pysam_7libcbcf_19VariantRecordSample_index(PyObject *o, CYTHON_UNUSED void *x) {
  return __pyx_pw_5pysam_7libcbcf_19VariantRecordSample_5index_1__get__(o);
}

static PyMethodDef __pyx_methods_5pysam_7libcbcf_VariantRecordSample[] = {
  {"clear", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_5pysam_7libcbcf_19VariantRecordSample_13clear, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_5pysam_7libcbcf_19VariantRecordSample_12clear},
  {"get", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_5pysam_7libcbcf_19VariantRecordSample_18get, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_5pysam_7libcbcf_19VariantRecordSample_17get},
  {"iterkeys", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_5pysam_7libcbcf_19VariantRecordSample_22iterkeys, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_5pysam_7libcbcf_19VariantRecordSample_21iterkeys},
  {"itervalues", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_5pysam_7libcbcf_19VariantRecordSample_24itervalues, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_5pysam_7libcbcf_19VariantRecordSample_23itervalues},
  {"iteritems", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_5pysam_7libcbcf_19VariantRecordSample_27iteritems, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_5pysam_7libcbcf_19VariantRecordSample_26iteritems},
  {"keys", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_5pysam_7libcbcf_19VariantRecordSample_30keys, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_5pysam_7libcbcf_19VariantRecordSample_29keys},
  {"items", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_5pysam_7libcbcf_19VariantRecordSample_32items, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_5pysam_7libcbcf_19VariantRecordSample_31items},
  {"values", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_5pysam_7libcbcf_19VariantRecordSample_34values, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_5pysam_7libcbcf_19VariantRecordSample_33values},
  {"update", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_5pysam_7libcbcf_19VariantRecordSample_36update, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_5pysam_7libcbcf_19VariantRecordSample_35update},
  {"pop", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_5pysam_7libcbcf_19VariantRecordSample_38pop, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_5pysam_7libcbcf_19VariantRecordSample_37pop},
  {"__reduce_cython__", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_5pysam_7libcbcf_19VariantRecordSample_42__reduce_cython__, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_5pysam_7libcbcf_19VariantRecordSample_41__reduce_cython__},
  {"__setstate_cython__", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_5pysam_7libcbcf_19VariantRecordSample_44__setstate_cython__, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_5pysam_7libcbcf_19VariantRecordSample_43__setstate_cython__},
  {0, 0, 0, 0}
};

static struct PyGetSetDef __pyx_getsets_5pysam_7libcbcf_VariantRecordSample[] = {
  {"name", __pyx_getprop_5pysam_7libcbcf_19VariantRecordSample_name, 0, PyDoc_STR("sample name"), 0},
  {"allele_indices", __pyx_getprop_5pysam_7libcbcf_19VariantRecordSample_allele_indices, __pyx_setprop_5pysam_7libcbcf_19VariantRecordSample_allele_indices, PyDoc_STR("allele indices for called genotype, if present.  Otherwise None"), 0},
  {"alleles", __pyx_getprop_5pysam_7libcbcf_19VariantRecordSample_alleles, __pyx_setprop_5pysam_7libcbcf_19VariantRecordSample_alleles, PyDoc_STR("alleles for called genotype, if present.  Otherwise None"), 0},
  {"phased", __pyx_getprop_5pysam_7libcbcf_19VariantRecordSample_phased, __pyx_setprop_5pysam_7libcbcf_19VariantRecordSample_phased, PyDoc_STR("False if genotype is missing or any allele is unphased.  Otherwise True."), 0},
  {"index", __pyx_getprop_5pysam_7libcbcf_19VariantRecordSample_index, 0, 0, 0},
  {0, 0, 0, 0, 0}
};
#if CYTHON_USE_TYPE_SPECS
static PyType_Slot __pyx_type_5pysam_7libcbcf_VariantRecordSample_slots[] = {
  {Py_tp_dealloc, (void *)__pyx_tp_dealloc_5pysam_7libcbcf_VariantRecordSample},
  {Py_nb_bool, (void *)__pyx_pw_5pysam_7libcbcf_19VariantRecordSample_5__bool__},
  {Py_sq_length, (void *)__pyx_pw_5pysam_7libcbcf_19VariantRecordSample_3__len__},
  {Py_sq_item, (void *)__pyx_sq_item_5pysam_7libcbcf_VariantRecordSample},
  {Py_sq_contains, (void *)__pyx_pw_5pysam_7libcbcf_19VariantRecordSample_20__contains__},
  {Py_mp_length, (void *)__pyx_pw_5pysam_7libcbcf_19VariantRecordSample_3__len__},
  {Py_mp_subscript, (void *)__pyx_pw_5pysam_7libcbcf_19VariantRecordSample_7__getitem__},
  {Py_mp_ass_subscript, (void *)__pyx_mp_ass_subscript_5pysam_7libcbcf_VariantRecordSample},
  {Py_tp_doc, (void *)PyDoc_STR("VariantRecordSample(*args, **kwargs)\n\nData for a single sample from a :class:`VariantRecord` object.\nProvides data accessors for genotypes and a mapping interface\nfrom format name to values.")},
  {Py_tp_traverse, (void *)__pyx_tp_traverse_5pysam_7libcbcf_VariantRecordSample},
  {Py_tp_clear, (void *)__pyx_tp_clear_5pysam_7libcbcf_VariantRecordSample},
  {Py_tp_richcompare, (void *)__pyx_pw_5pysam_7libcbcf_19VariantRecordSample_40__richcmp__},
  {Py_tp_iter, (void *)__pyx_pw_5pysam_7libcbcf_19VariantRecordSample_15__iter__},
  {Py_tp_methods, (void *)__pyx_methods_5pysam_7libcbcf_VariantRecordSample},
  {Py_tp_getset, (void *)__pyx_getsets_5pysam_7libcbcf_VariantRecordSample},
  {Py_tp_init, (void *)__pyx_pw_5pysam_7libcbcf_19VariantRecordSample_1__init__},
  {Py_tp_new, (void *)__pyx_tp_new_5pysam_7libcbcf_VariantRecordSample},
  {0, 0},
};
static PyType_Spec __pyx_type_5pysam_7libcbcf_VariantRecordSample_spec = {
  "pysam.libcbcf.VariantRecordSample",
  sizeof(struct __pyx_obj_5pysam_7libcbcf_VariantRecordSample),
  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_5pysam_7libcbcf_VariantRecordSample_slots,
};
#else

static PyNumberMethods __pyx_tp_as_number_VariantRecordSample = {
  0, /*nb_add*/
  0, /*nb_subtract*/
  0, /*nb_multiply*/
  0, /*nb_remainder*/
  0, /*nb_divmod*/
  0, /*nb_power*/
  0, /*nb_negative*/
  0, /*nb_positive*/
  0, /*nb_absolute*/
  __pyx_pw_5pysam_7libcbcf_19VariantRecordSample_5__bool__, /*nb_bool*/
  0, /*nb_invert*/
  0, /*nb_lshift*/
  0, /*nb_rshift*/
  0, /*nb_and*/
  0, /*nb_xor*/
  0, /*nb_or*/
  0, /*nb_int*/
  0, /*nb_long (reserved)*/
  0, /*nb_float*/
  0, /*nb_inplace_add*/
  0, /*nb_inplace_subtract*/
  0, /*nb_inplace_multiply*/
  0, /*nb_inplace_remainder*/
  0, /*nb_inplace_power*/
  0, /*nb_inplace_lshift*/
  0, /*nb_inplace_rshift*/
  0, /*nb_inplace_and*/
  0, /*nb_inplace_xor*/
  0, /*nb_inplace_or*/
  0, /*nb_floor_divide*/
  0, /*nb_true_divide*/
  0, /*nb_inplace_floor_divide*/
  0, /*nb_inplace_true_divide*/
  0, /*nb_index*/
  0, /*nb_matrix_multiply*/
  0, /*nb_inplace_matrix_multiply*/
};

static PySequenceMethods __pyx_tp_as_sequence_VariantRecordSample = {
  __pyx_pw_5pysam_7libcbcf_19VariantRecordSample_3__len__, /*sq_length*/
  0, /*sq_concat*/
  0, /*sq_repeat*/
  __pyx_sq_item_5pysam_7libcbcf_VariantRecordSample, /*sq_item*/
  0, /*sq_slice*/
  0, /*sq_ass_item*/
  0, /*sq_ass_slice*/
  __pyx_pw_5pysam_7libcbcf_19VariantRecordSample_20__contains__, /*sq_contains*/
  0, /*sq_inplace_concat*/
  0, /*sq_inplace_repeat*/
};

static PyMappingMethods __pyx_tp_as_mapping_VariantRecordSample = {
  __pyx_pw_5pysam_7libcbcf_19VariantRecordSample_3__len__, /*mp_length*/
  __pyx_pw_5pysam_7libcbcf_19VariantRecordSample_7__getitem__, /*mp_subscript*/
  __pyx_mp_ass_subscript_5pysam_7libcbcf_VariantRecordSample, /*mp_ass_subscript*/
};

static PyTypeObject __pyx_type_5pysam_7libcbcf_VariantRecordSample = {
  PyVarObject_HEAD_INIT(0, 0)
  "pysam.libcbcf.""VariantRecordSample", /*tp_name*/
  sizeof(struct __pyx_obj_5pysam_7libcbcf_VariantRecordSample), /*tp_basicsize*/
  0, /*tp_itemsize*/
  __pyx_tp_dealloc_5pysam_7libcbcf_VariantRecordSample, /*tp_dealloc*/
  #if PY_VERSION_HEX < 0x030800b4
  0, /*tp_print*/
  #endif
  #if PY_VERSION_HEX >= 0x030800b4
  0, /*tp_vectorcall_offset*/
  #endif
  0, /*tp_getattr*/
  0, /*tp_setattr*/
  0, /*tp_as_async*/
  0, /*tp_repr*/
  &__pyx_tp_as_number_VariantRecordSample, /*tp_as_number*/
  &__pyx_tp_as_sequence_VariantRecordSample, /*tp_as_sequence*/
  &__pyx_tp_as_mapping_VariantRecordSample, /*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("VariantRecordSample(*args, **kwargs)\n\nData for a single sample from a :class:`VariantRecord` object.\nProvides data accessors for genotypes and a mapping interface\nfrom format name to values."), /*tp_doc*/
  __pyx_tp_traverse_5pysam_7libcbcf_VariantRecordSample, /*tp_traverse*/
  __pyx_tp_clear_5pysam_7libcbcf_VariantRecordSample, /*tp_clear*/
  __pyx_pw_5pysam_7libcbcf_19VariantRecordSample_40__richcmp__, /*tp_richcompare*/
  0, /*tp_weaklistoffset*/
  __pyx_pw_5pysam_7libcbcf_19VariantRecordSample_15__iter__, /*tp_iter*/
  0, /*tp_iternext*/
  __pyx_methods_5pysam_7libcbcf_VariantRecordSample, /*tp_methods*/
  0, /*tp_members*/
  __pyx_getsets_5pysam_7libcbcf_VariantRecordSample, /*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_5pysam_7libcbcf_19VariantRecordSample_1__init__, /*tp_init*/
  0, /*tp_alloc*/
  __pyx_tp_new_5pysam_7libcbcf_VariantRecordSample, /*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 PY_VERSION_HEX >= 0x030800b1 && (!CYTHON_COMPILING_IN_PYPY || PYPY_VERSION_NUM >= 0x07030800)
  0, /*tp_vectorcall*/
  #endif
  #if __PYX_NEED_TP_PRINT_SLOT == 1
  0, /*tp_print*/
  #endif
  #if PY_VERSION_HEX >= 0x030C0000
  0, /*tp_watched*/
  #endif
  #if 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_5pysam_7libcbcf_BaseIndex(PyTypeObject *t, CYTHON_UNUSED PyObject *a, CYTHON_UNUSED PyObject *k) {
  struct __pyx_obj_5pysam_7libcbcf_BaseIndex *p;
  PyObject *o;
  #if CYTHON_COMPILING_IN_LIMITED_API
  allocfunc alloc_func = (allocfunc)PyType_GetSlot(t, Py_tp_alloc);
  o = alloc_func(t, 0);
  #else
  if (likely(!__Pyx_PyType_HasFeature(t, Py_TPFLAGS_IS_ABSTRACT))) {
    o = (*t->tp_alloc)(t, 0);
  } else {
    o = (PyObject *) PyBaseObject_Type.tp_new(t, __pyx_mstate_global->__pyx_empty_tuple, 0);
  }
  if (unlikely(!o)) return 0;
  #endif
  p = ((struct __pyx_obj_5pysam_7libcbcf_BaseIndex *)o);
  p->refs = ((PyObject*)Py_None); Py_INCREF(Py_None);
  p->refmap = ((PyObject*)Py_None); Py_INCREF(Py_None);
  return o;
}

static void __pyx_tp_dealloc_5pysam_7libcbcf_BaseIndex(PyObject *o) {
  struct __pyx_obj_5pysam_7libcbcf_BaseIndex *p = (struct __pyx_obj_5pysam_7libcbcf_BaseIndex *)o;
  #if CYTHON_USE_TP_FINALIZE
  if (unlikely((PY_VERSION_HEX >= 0x03080000 || __Pyx_PyType_HasFeature(Py_TYPE(o), Py_TPFLAGS_HAVE_FINALIZE)) && __Pyx_PyObject_GetSlot(o, tp_finalize, destructor)) && !__Pyx_PyObject_GC_IsFinalized(o)) {
    if (__Pyx_PyObject_GetSlot(o, tp_dealloc, destructor) == __pyx_tp_dealloc_5pysam_7libcbcf_BaseIndex) {
      if (PyObject_CallFinalizerFromDealloc(o)) return;
    }
  }
  #endif
  PyObject_GC_UnTrack(o);
  Py_CLEAR(p->refs);
  Py_CLEAR(p->refmap);
  #if CYTHON_USE_TYPE_SLOTS
  (*Py_TYPE(o)->tp_free)(o);
  #else
  {
    freefunc tp_free = (freefunc)PyType_GetSlot(Py_TYPE(o), Py_tp_free);
    if (tp_free) tp_free(o);
  }
  #endif
}

static int __pyx_tp_traverse_5pysam_7libcbcf_BaseIndex(PyObject *o, visitproc v, void *a) {
  int e;
  struct __pyx_obj_5pysam_7libcbcf_BaseIndex *p = (struct __pyx_obj_5pysam_7libcbcf_BaseIndex *)o;
  {
    e = __Pyx_call_type_traverse(o, 1, v, a);
    if (e) return e;
  }
  if (p->refs) {
    e = (*v)(p->refs, a); if (e) return e;
  }
  if (p->refmap) {
    e = (*v)(p->refmap, a); if (e) return e;
  }
  return 0;
}

static int __pyx_tp_clear_5pysam_7libcbcf_BaseIndex(PyObject *o) {
  PyObject* tmp;
  struct __pyx_obj_5pysam_7libcbcf_BaseIndex *p = (struct __pyx_obj_5pysam_7libcbcf_BaseIndex *)o;
  tmp = ((PyObject*)p->refs);
  p->refs = ((PyObject*)Py_None); Py_INCREF(Py_None);
  Py_XDECREF(tmp);
  tmp = ((PyObject*)p->refmap);
  p->refmap = ((PyObject*)Py_None); Py_INCREF(Py_None);
  Py_XDECREF(tmp);
  return 0;
}

static PyObject *__pyx_sq_item_5pysam_7libcbcf_BaseIndex(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 PyMethodDef __pyx_methods_5pysam_7libcbcf_BaseIndex[] = {
  {"get", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_5pysam_7libcbcf_9BaseIndex_11get, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_5pysam_7libcbcf_9BaseIndex_10get},
  {"iterkeys", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_5pysam_7libcbcf_9BaseIndex_15iterkeys, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_5pysam_7libcbcf_9BaseIndex_14iterkeys},
  {"itervalues", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_5pysam_7libcbcf_9BaseIndex_17itervalues, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_5pysam_7libcbcf_9BaseIndex_16itervalues},
  {"iteritems", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_5pysam_7libcbcf_9BaseIndex_20iteritems, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_5pysam_7libcbcf_9BaseIndex_19iteritems},
  {"keys", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_5pysam_7libcbcf_9BaseIndex_23keys, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_5pysam_7libcbcf_9BaseIndex_22keys},
  {"items", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_5pysam_7libcbcf_9BaseIndex_25items, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_5pysam_7libcbcf_9BaseIndex_24items},
  {"values", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_5pysam_7libcbcf_9BaseIndex_27values, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_5pysam_7libcbcf_9BaseIndex_26values},
  {"update", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_5pysam_7libcbcf_9BaseIndex_29update, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_5pysam_7libcbcf_9BaseIndex_28update},
  {"pop", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_5pysam_7libcbcf_9BaseIndex_31pop, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_5pysam_7libcbcf_9BaseIndex_30pop},
  {"__reduce_cython__", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_5pysam_7libcbcf_9BaseIndex_33__reduce_cython__, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_5pysam_7libcbcf_9BaseIndex_32__reduce_cython__},
  {"__setstate_cython__", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_5pysam_7libcbcf_9BaseIndex_35__setstate_cython__, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_5pysam_7libcbcf_9BaseIndex_34__setstate_cython__},
  {0, 0, 0, 0}
};
#if CYTHON_USE_TYPE_SPECS
static PyType_Slot __pyx_type_5pysam_7libcbcf_BaseIndex_slots[] = {
  {Py_tp_dealloc, (void *)__pyx_tp_dealloc_5pysam_7libcbcf_BaseIndex},
  {Py_nb_bool, (void *)__pyx_pw_5pysam_7libcbcf_9BaseIndex_5__bool__},
  {Py_sq_length, (void *)__pyx_pw_5pysam_7libcbcf_9BaseIndex_3__len__},
  {Py_sq_item, (void *)__pyx_sq_item_5pysam_7libcbcf_BaseIndex},
  {Py_sq_contains, (void *)__pyx_pw_5pysam_7libcbcf_9BaseIndex_13__contains__},
  {Py_mp_length, (void *)__pyx_pw_5pysam_7libcbcf_9BaseIndex_3__len__},
  {Py_mp_subscript, (void *)__pyx_pw_5pysam_7libcbcf_9BaseIndex_7__getitem__},
  {Py_tp_doc, (void *)PyDoc_STR("BaseIndex()")},
  {Py_tp_traverse, (void *)__pyx_tp_traverse_5pysam_7libcbcf_BaseIndex},
  {Py_tp_clear, (void *)__pyx_tp_clear_5pysam_7libcbcf_BaseIndex},
  {Py_tp_iter, (void *)__pyx_pw_5pysam_7libcbcf_9BaseIndex_9__iter__},
  {Py_tp_methods, (void *)__pyx_methods_5pysam_7libcbcf_BaseIndex},
  {Py_tp_init, (void *)__pyx_pw_5pysam_7libcbcf_9BaseIndex_1__init__},
  {Py_tp_new, (void *)__pyx_tp_new_5pysam_7libcbcf_BaseIndex},
  {0, 0},
};
static PyType_Spec __pyx_type_5pysam_7libcbcf_BaseIndex_spec = {
  "pysam.libcbcf.BaseIndex",
  sizeof(struct __pyx_obj_5pysam_7libcbcf_BaseIndex),
  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_5pysam_7libcbcf_BaseIndex_slots,
};
#else

static PyNumberMethods __pyx_tp_as_number_BaseIndex = {
  0, /*nb_add*/
  0, /*nb_subtract*/
  0, /*nb_multiply*/
  0, /*nb_remainder*/
  0, /*nb_divmod*/
  0, /*nb_power*/
  0, /*nb_negative*/
  0, /*nb_positive*/
  0, /*nb_absolute*/
  __pyx_pw_5pysam_7libcbcf_9BaseIndex_5__bool__, /*nb_bool*/
  0, /*nb_invert*/
  0, /*nb_lshift*/
  0, /*nb_rshift*/
  0, /*nb_and*/
  0, /*nb_xor*/
  0, /*nb_or*/
  0, /*nb_int*/
  0, /*nb_long (reserved)*/
  0, /*nb_float*/
  0, /*nb_inplace_add*/
  0, /*nb_inplace_subtract*/
  0, /*nb_inplace_multiply*/
  0, /*nb_inplace_remainder*/
  0, /*nb_inplace_power*/
  0, /*nb_inplace_lshift*/
  0, /*nb_inplace_rshift*/
  0, /*nb_inplace_and*/
  0, /*nb_inplace_xor*/
  0, /*nb_inplace_or*/
  0, /*nb_floor_divide*/
  0, /*nb_true_divide*/
  0, /*nb_inplace_floor_divide*/
  0, /*nb_inplace_true_divide*/
  0, /*nb_index*/
  0, /*nb_matrix_multiply*/
  0, /*nb_inplace_matrix_multiply*/
};

static PySequenceMethods __pyx_tp_as_sequence_BaseIndex = {
  __pyx_pw_5pysam_7libcbcf_9BaseIndex_3__len__, /*sq_length*/
  0, /*sq_concat*/
  0, /*sq_repeat*/
  __pyx_sq_item_5pysam_7libcbcf_BaseIndex, /*sq_item*/
  0, /*sq_slice*/
  0, /*sq_ass_item*/
  0, /*sq_ass_slice*/
  __pyx_pw_5pysam_7libcbcf_9BaseIndex_13__contains__, /*sq_contains*/
  0, /*sq_inplace_concat*/
  0, /*sq_inplace_repeat*/
};

static PyMappingMethods __pyx_tp_as_mapping_BaseIndex = {
  __pyx_pw_5pysam_7libcbcf_9BaseIndex_3__len__, /*mp_length*/
  __pyx_pw_5pysam_7libcbcf_9BaseIndex_7__getitem__, /*mp_subscript*/
  0, /*mp_ass_subscript*/
};

static PyTypeObject __pyx_type_5pysam_7libcbcf_BaseIndex = {
  PyVarObject_HEAD_INIT(0, 0)
  "pysam.libcbcf.""BaseIndex", /*tp_name*/
  sizeof(struct __pyx_obj_5pysam_7libcbcf_BaseIndex), /*tp_basicsize*/
  0, /*tp_itemsize*/
  __pyx_tp_dealloc_5pysam_7libcbcf_BaseIndex, /*tp_dealloc*/
  #if PY_VERSION_HEX < 0x030800b4
  0, /*tp_print*/
  #endif
  #if PY_VERSION_HEX >= 0x030800b4
  0, /*tp_vectorcall_offset*/
  #endif
  0, /*tp_getattr*/
  0, /*tp_setattr*/
  0, /*tp_as_async*/
  0, /*tp_repr*/
  &__pyx_tp_as_number_BaseIndex, /*tp_as_number*/
  &__pyx_tp_as_sequence_BaseIndex, /*tp_as_sequence*/
  &__pyx_tp_as_mapping_BaseIndex, /*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("BaseIndex()"), /*tp_doc*/
  __pyx_tp_traverse_5pysam_7libcbcf_BaseIndex, /*tp_traverse*/
  __pyx_tp_clear_5pysam_7libcbcf_BaseIndex, /*tp_clear*/
  0, /*tp_richcompare*/
  0, /*tp_weaklistoffset*/
  __pyx_pw_5pysam_7libcbcf_9BaseIndex_9__iter__, /*tp_iter*/
  0, /*tp_iternext*/
  __pyx_methods_5pysam_7libcbcf_BaseIndex, /*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_5pysam_7libcbcf_9BaseIndex_1__init__, /*tp_init*/
  0, /*tp_alloc*/
  __pyx_tp_new_5pysam_7libcbcf_BaseIndex, /*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 PY_VERSION_HEX >= 0x030800b1 && (!CYTHON_COMPILING_IN_PYPY || PYPY_VERSION_NUM >= 0x07030800)
  0, /*tp_vectorcall*/
  #endif
  #if __PYX_NEED_TP_PRINT_SLOT == 1
  0, /*tp_print*/
  #endif
  #if PY_VERSION_HEX >= 0x030C0000
  0, /*tp_watched*/
  #endif
  #if 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_5pysam_7libcbcf_BCFIndex(PyTypeObject *t, PyObject *a, PyObject *k) {
  struct __pyx_obj_5pysam_7libcbcf_BCFIndex *p;
  PyObject *o = __pyx_tp_new_5pysam_7libcbcf_BaseIndex(t, a, k);
  if (unlikely(!o)) return 0;
  p = ((struct __pyx_obj_5pysam_7libcbcf_BCFIndex *)o);
  p->header = ((struct __pyx_obj_5pysam_7libcbcf_VariantHeader *)Py_None); Py_INCREF(Py_None);
  return o;
}

static void __pyx_tp_dealloc_5pysam_7libcbcf_BCFIndex(PyObject *o) {
  struct __pyx_obj_5pysam_7libcbcf_BCFIndex *p = (struct __pyx_obj_5pysam_7libcbcf_BCFIndex *)o;
  #if CYTHON_USE_TP_FINALIZE
  if (unlikely((PY_VERSION_HEX >= 0x03080000 || __Pyx_PyType_HasFeature(Py_TYPE(o), Py_TPFLAGS_HAVE_FINALIZE)) && __Pyx_PyObject_GetSlot(o, tp_finalize, destructor)) && !__Pyx_PyObject_GC_IsFinalized(o)) {
    if (__Pyx_PyObject_GetSlot(o, tp_dealloc, destructor) == __pyx_tp_dealloc_5pysam_7libcbcf_BCFIndex) {
      if (PyObject_CallFinalizerFromDealloc(o)) return;
    }
  }
  #endif
  PyObject_GC_UnTrack(o);
  {
    PyObject *etype, *eval, *etb;
    PyErr_Fetch(&etype, &eval, &etb);
    __Pyx_SET_REFCNT(o, Py_REFCNT(o) + 1);
    __pyx_pw_5pysam_7libcbcf_8BCFIndex_3__dealloc__(o);
    __Pyx_SET_REFCNT(o, Py_REFCNT(o) - 1);
    PyErr_Restore(etype, eval, etb);
  }
  Py_CLEAR(p->header);
  PyObject_GC_Track(o);
  __pyx_tp_dealloc_5pysam_7libcbcf_BaseIndex(o);
}

static int __pyx_tp_traverse_5pysam_7libcbcf_BCFIndex(PyObject *o, visitproc v, void *a) {
  int e;
  struct __pyx_obj_5pysam_7libcbcf_BCFIndex *p = (struct __pyx_obj_5pysam_7libcbcf_BCFIndex *)o;
  e = __pyx_tp_traverse_5pysam_7libcbcf_BaseIndex(o, v, a); if (e) return e;
  if (p->header) {
    e = (*v)(((PyObject *)p->header), a); if (e) return e;
  }
  return 0;
}

static int __pyx_tp_clear_5pysam_7libcbcf_BCFIndex(PyObject *o) {
  PyObject* tmp;
  struct __pyx_obj_5pysam_7libcbcf_BCFIndex *p = (struct __pyx_obj_5pysam_7libcbcf_BCFIndex *)o;
  __pyx_tp_clear_5pysam_7libcbcf_BaseIndex(o);
  tmp = ((PyObject*)p->header);
  p->header = ((struct __pyx_obj_5pysam_7libcbcf_VariantHeader *)Py_None); Py_INCREF(Py_None);
  Py_XDECREF(tmp);
  return 0;
}

static PyObject *__pyx_getprop_5pysam_7libcbcf_8BCFIndex_header(PyObject *o, CYTHON_UNUSED void *x) {
  return __pyx_pw_5pysam_7libcbcf_8BCFIndex_6header_1__get__(o);
}

static PyMethodDef __pyx_methods_5pysam_7libcbcf_BCFIndex[] = {
  {"fetch", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_5pysam_7libcbcf_8BCFIndex_5fetch, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_5pysam_7libcbcf_8BCFIndex_4fetch},
  {"__reduce_cython__", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_5pysam_7libcbcf_8BCFIndex_7__reduce_cython__, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_5pysam_7libcbcf_8BCFIndex_6__reduce_cython__},
  {"__setstate_cython__", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_5pysam_7libcbcf_8BCFIndex_9__setstate_cython__, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_5pysam_7libcbcf_8BCFIndex_8__setstate_cython__},
  {0, 0, 0, 0}
};

static struct PyGetSetDef __pyx_getsets_5pysam_7libcbcf_BCFIndex[] = {
  {"header", __pyx_getprop_5pysam_7libcbcf_8BCFIndex_header, 0, 0, 0},
  {0, 0, 0, 0, 0}
};
#if CYTHON_USE_TYPE_SPECS
static PyType_Slot __pyx_type_5pysam_7libcbcf_BCFIndex_slots[] = {
  {Py_tp_dealloc, (void *)__pyx_tp_dealloc_5pysam_7libcbcf_BCFIndex},
  {Py_tp_doc, (void *)PyDoc_STR("BCFIndex()\n\nCSI index data structure for BCF files")},
  {Py_tp_traverse, (void *)__pyx_tp_traverse_5pysam_7libcbcf_BCFIndex},
  {Py_tp_clear, (void *)__pyx_tp_clear_5pysam_7libcbcf_BCFIndex},
  {Py_tp_methods, (void *)__pyx_methods_5pysam_7libcbcf_BCFIndex},
  {Py_tp_getset, (void *)__pyx_getsets_5pysam_7libcbcf_BCFIndex},
  {Py_tp_init, (void *)__pyx_pw_5pysam_7libcbcf_8BCFIndex_1__init__},
  {Py_tp_new, (void *)__pyx_tp_new_5pysam_7libcbcf_BCFIndex},
  {0, 0},
};
static PyType_Spec __pyx_type_5pysam_7libcbcf_BCFIndex_spec = {
  "pysam.libcbcf.BCFIndex",
  sizeof(struct __pyx_obj_5pysam_7libcbcf_BCFIndex),
  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_5pysam_7libcbcf_BCFIndex_slots,
};
#else

static PyTypeObject __pyx_type_5pysam_7libcbcf_BCFIndex = {
  PyVarObject_HEAD_INIT(0, 0)
  "pysam.libcbcf.""BCFIndex", /*tp_name*/
  sizeof(struct __pyx_obj_5pysam_7libcbcf_BCFIndex), /*tp_basicsize*/
  0, /*tp_itemsize*/
  __pyx_tp_dealloc_5pysam_7libcbcf_BCFIndex, /*tp_dealloc*/
  #if PY_VERSION_HEX < 0x030800b4
  0, /*tp_print*/
  #endif
  #if PY_VERSION_HEX >= 0x030800b4
  0, /*tp_vectorcall_offset*/
  #endif
  0, /*tp_getattr*/
  0, /*tp_setattr*/
  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("BCFIndex()\n\nCSI index data structure for BCF files"), /*tp_doc*/
  __pyx_tp_traverse_5pysam_7libcbcf_BCFIndex, /*tp_traverse*/
  __pyx_tp_clear_5pysam_7libcbcf_BCFIndex, /*tp_clear*/
  0, /*tp_richcompare*/
  0, /*tp_weaklistoffset*/
  #if CYTHON_COMPILING_IN_PYPY || 0
  __pyx_pw_5pysam_7libcbcf_9BaseIndex_9__iter__, /*tp_iter*/
  #else
  0, /*tp_iter*/
  #endif
  0, /*tp_iternext*/
  __pyx_methods_5pysam_7libcbcf_BCFIndex, /*tp_methods*/
  0, /*tp_members*/
  __pyx_getsets_5pysam_7libcbcf_BCFIndex, /*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_5pysam_7libcbcf_8BCFIndex_1__init__, /*tp_init*/
  0, /*tp_alloc*/
  __pyx_tp_new_5pysam_7libcbcf_BCFIndex, /*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 PY_VERSION_HEX >= 0x030800b1 && (!CYTHON_COMPILING_IN_PYPY || PYPY_VERSION_NUM >= 0x07030800)
  0, /*tp_vectorcall*/
  #endif
  #if __PYX_NEED_TP_PRINT_SLOT == 1
  0, /*tp_print*/
  #endif
  #if PY_VERSION_HEX >= 0x030C0000
  0, /*tp_watched*/
  #endif
  #if 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 void __pyx_tp_dealloc_5pysam_7libcbcf_TabixIndex(PyObject *o) {
  #if CYTHON_USE_TP_FINALIZE
  if (unlikely((PY_VERSION_HEX >= 0x03080000 || __Pyx_PyType_HasFeature(Py_TYPE(o), Py_TPFLAGS_HAVE_FINALIZE)) && __Pyx_PyObject_GetSlot(o, tp_finalize, destructor)) && !__Pyx_PyObject_GC_IsFinalized(o)) {
    if (__Pyx_PyObject_GetSlot(o, tp_dealloc, destructor) == __pyx_tp_dealloc_5pysam_7libcbcf_TabixIndex) {
      if (PyObject_CallFinalizerFromDealloc(o)) return;
    }
  }
  #endif
  PyObject_GC_UnTrack(o);
  {
    PyObject *etype, *eval, *etb;
    PyErr_Fetch(&etype, &eval, &etb);
    __Pyx_SET_REFCNT(o, Py_REFCNT(o) + 1);
    __pyx_pw_5pysam_7libcbcf_10TabixIndex_3__dealloc__(o);
    __Pyx_SET_REFCNT(o, Py_REFCNT(o) - 1);
    PyErr_Restore(etype, eval, etb);
  }
  PyObject_GC_Track(o);
  __pyx_tp_dealloc_5pysam_7libcbcf_BaseIndex(o);
}

static PyMethodDef __pyx_methods_5pysam_7libcbcf_TabixIndex[] = {
  {"fetch", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_5pysam_7libcbcf_10TabixIndex_5fetch, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_5pysam_7libcbcf_10TabixIndex_4fetch},
  {"__reduce_cython__", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_5pysam_7libcbcf_10TabixIndex_7__reduce_cython__, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_5pysam_7libcbcf_10TabixIndex_6__reduce_cython__},
  {"__setstate_cython__", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_5pysam_7libcbcf_10TabixIndex_9__setstate_cython__, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_5pysam_7libcbcf_10TabixIndex_8__setstate_cython__},
  {0, 0, 0, 0}
};
#if CYTHON_USE_TYPE_SPECS
static PyType_Slot __pyx_type_5pysam_7libcbcf_TabixIndex_slots[] = {
  {Py_tp_dealloc, (void *)__pyx_tp_dealloc_5pysam_7libcbcf_TabixIndex},
  {Py_tp_doc, (void *)PyDoc_STR("TabixIndex()\n\nTabix index data structure for VCF files")},
  {Py_tp_traverse, (void *)__pyx_tp_traverse_5pysam_7libcbcf_BaseIndex},
  {Py_tp_clear, (void *)__pyx_tp_clear_5pysam_7libcbcf_BaseIndex},
  {Py_tp_methods, (void *)__pyx_methods_5pysam_7libcbcf_TabixIndex},
  {Py_tp_init, (void *)__pyx_pw_5pysam_7libcbcf_10TabixIndex_1__init__},
  {Py_tp_new, (void *)__pyx_tp_new_5pysam_7libcbcf_BaseIndex},
  {0, 0},
};
static PyType_Spec __pyx_type_5pysam_7libcbcf_TabixIndex_spec = {
  "pysam.libcbcf.TabixIndex",
  sizeof(struct __pyx_obj_5pysam_7libcbcf_TabixIndex),
  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_5pysam_7libcbcf_TabixIndex_slots,
};
#else

static PyTypeObject __pyx_type_5pysam_7libcbcf_TabixIndex = {
  PyVarObject_HEAD_INIT(0, 0)
  "pysam.libcbcf.""TabixIndex", /*tp_name*/
  sizeof(struct __pyx_obj_5pysam_7libcbcf_TabixIndex), /*tp_basicsize*/
  0, /*tp_itemsize*/
  __pyx_tp_dealloc_5pysam_7libcbcf_TabixIndex, /*tp_dealloc*/
  #if PY_VERSION_HEX < 0x030800b4
  0, /*tp_print*/
  #endif
  #if PY_VERSION_HEX >= 0x030800b4
  0, /*tp_vectorcall_offset*/
  #endif
  0, /*tp_getattr*/
  0, /*tp_setattr*/
  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("TabixIndex()\n\nTabix index data structure for VCF files"), /*tp_doc*/
  __pyx_tp_traverse_5pysam_7libcbcf_BaseIndex, /*tp_traverse*/
  __pyx_tp_clear_5pysam_7libcbcf_BaseIndex, /*tp_clear*/
  0, /*tp_richcompare*/
  0, /*tp_weaklistoffset*/
  #if CYTHON_COMPILING_IN_PYPY || 0
  __pyx_pw_5pysam_7libcbcf_9BaseIndex_9__iter__, /*tp_iter*/
  #else
  0, /*tp_iter*/
  #endif
  0, /*tp_iternext*/
  __pyx_methods_5pysam_7libcbcf_TabixIndex, /*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_5pysam_7libcbcf_10TabixIndex_1__init__, /*tp_init*/
  0, /*tp_alloc*/
  __pyx_tp_new_5pysam_7libcbcf_BaseIndex, /*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 PY_VERSION_HEX >= 0x030800b1 && (!CYTHON_COMPILING_IN_PYPY || PYPY_VERSION_NUM >= 0x07030800)
  0, /*tp_vectorcall*/
  #endif
  #if __PYX_NEED_TP_PRINT_SLOT == 1
  0, /*tp_print*/
  #endif
  #if PY_VERSION_HEX >= 0x030C0000
  0, /*tp_watched*/
  #endif
  #if 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_5pysam_7libcbcf_BaseIterator(PyTypeObject *t, CYTHON_UNUSED PyObject *a, CYTHON_UNUSED PyObject *k) {
  struct __pyx_obj_5pysam_7libcbcf_BaseIterator *p;
  PyObject *o;
  #if CYTHON_COMPILING_IN_LIMITED_API
  allocfunc alloc_func = (allocfunc)PyType_GetSlot(t, Py_tp_alloc);
  o = alloc_func(t, 0);
  #else
  if (likely(!__Pyx_PyType_HasFeature(t, Py_TPFLAGS_IS_ABSTRACT))) {
    o = (*t->tp_alloc)(t, 0);
  } else {
    o = (PyObject *) PyBaseObject_Type.tp_new(t, __pyx_mstate_global->__pyx_empty_tuple, 0);
  }
  if (unlikely(!o)) return 0;
  #endif
  p = ((struct __pyx_obj_5pysam_7libcbcf_BaseIterator *)o);
  p->bcf = ((struct __pyx_obj_5pysam_7libcbcf_VariantFile *)Py_None); Py_INCREF(Py_None);
  return o;
}

static void __pyx_tp_dealloc_5pysam_7libcbcf_BaseIterator(PyObject *o) {
  struct __pyx_obj_5pysam_7libcbcf_BaseIterator *p = (struct __pyx_obj_5pysam_7libcbcf_BaseIterator *)o;
  #if CYTHON_USE_TP_FINALIZE
  if (unlikely((PY_VERSION_HEX >= 0x03080000 || __Pyx_PyType_HasFeature(Py_TYPE(o), Py_TPFLAGS_HAVE_FINALIZE)) && __Pyx_PyObject_GetSlot(o, tp_finalize, destructor)) && !__Pyx_PyObject_GC_IsFinalized(o)) {
    if (__Pyx_PyObject_GetSlot(o, tp_dealloc, destructor) == __pyx_tp_dealloc_5pysam_7libcbcf_BaseIterator) {
      if (PyObject_CallFinalizerFromDealloc(o)) return;
    }
  }
  #endif
  PyObject_GC_UnTrack(o);
  Py_CLEAR(p->bcf);
  #if CYTHON_USE_TYPE_SLOTS
  (*Py_TYPE(o)->tp_free)(o);
  #else
  {
    freefunc tp_free = (freefunc)PyType_GetSlot(Py_TYPE(o), Py_tp_free);
    if (tp_free) tp_free(o);
  }
  #endif
}

static int __pyx_tp_traverse_5pysam_7libcbcf_BaseIterator(PyObject *o, visitproc v, void *a) {
  int e;
  struct __pyx_obj_5pysam_7libcbcf_BaseIterator *p = (struct __pyx_obj_5pysam_7libcbcf_BaseIterator *)o;
  {
    e = __Pyx_call_type_traverse(o, 1, v, a);
    if (e) return e;
  }
  if (p->bcf) {
    e = (*v)(((PyObject *)p->bcf), a); if (e) return e;
  }
  return 0;
}

static int __pyx_tp_clear_5pysam_7libcbcf_BaseIterator(PyObject *o) {
  PyObject* tmp;
  struct __pyx_obj_5pysam_7libcbcf_BaseIterator *p = (struct __pyx_obj_5pysam_7libcbcf_BaseIterator *)o;
  tmp = ((PyObject*)p->bcf);
  p->bcf = ((struct __pyx_obj_5pysam_7libcbcf_VariantFile *)Py_None); Py_INCREF(Py_None);
  Py_XDECREF(tmp);
  return 0;
}

static PyMethodDef __pyx_methods_5pysam_7libcbcf_BaseIterator[] = {
  {"__reduce_cython__", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_5pysam_7libcbcf_12BaseIterator_1__reduce_cython__, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_5pysam_7libcbcf_12BaseIterator___reduce_cython__},
  {"__setstate_cython__", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_5pysam_7libcbcf_12BaseIterator_3__setstate_cython__, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_5pysam_7libcbcf_12BaseIterator_2__setstate_cython__},
  {0, 0, 0, 0}
};
#if CYTHON_USE_TYPE_SPECS
static PyType_Slot __pyx_type_5pysam_7libcbcf_BaseIterator_slots[] = {
  {Py_tp_dealloc, (void *)__pyx_tp_dealloc_5pysam_7libcbcf_BaseIterator},
  {Py_tp_traverse, (void *)__pyx_tp_traverse_5pysam_7libcbcf_BaseIterator},
  {Py_tp_clear, (void *)__pyx_tp_clear_5pysam_7libcbcf_BaseIterator},
  {Py_tp_methods, (void *)__pyx_methods_5pysam_7libcbcf_BaseIterator},
  {Py_tp_new, (void *)__pyx_tp_new_5pysam_7libcbcf_BaseIterator},
  {0, 0},
};
static PyType_Spec __pyx_type_5pysam_7libcbcf_BaseIterator_spec = {
  "pysam.libcbcf.BaseIterator",
  sizeof(struct __pyx_obj_5pysam_7libcbcf_BaseIterator),
  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_5pysam_7libcbcf_BaseIterator_slots,
};
#else

static PyTypeObject __pyx_type_5pysam_7libcbcf_BaseIterator = {
  PyVarObject_HEAD_INIT(0, 0)
  "pysam.libcbcf.""BaseIterator", /*tp_name*/
  sizeof(struct __pyx_obj_5pysam_7libcbcf_BaseIterator), /*tp_basicsize*/
  0, /*tp_itemsize*/
  __pyx_tp_dealloc_5pysam_7libcbcf_BaseIterator, /*tp_dealloc*/
  #if PY_VERSION_HEX < 0x030800b4
  0, /*tp_print*/
  #endif
  #if PY_VERSION_HEX >= 0x030800b4
  0, /*tp_vectorcall_offset*/
  #endif
  0, /*tp_getattr*/
  0, /*tp_setattr*/
  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_5pysam_7libcbcf_BaseIterator, /*tp_traverse*/
  __pyx_tp_clear_5pysam_7libcbcf_BaseIterator, /*tp_clear*/
  0, /*tp_richcompare*/
  0, /*tp_weaklistoffset*/
  0, /*tp_iter*/
  0, /*tp_iternext*/
  __pyx_methods_5pysam_7libcbcf_BaseIterator, /*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_5pysam_7libcbcf_BaseIterator, /*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 PY_VERSION_HEX >= 0x030800b1 && (!CYTHON_COMPILING_IN_PYPY || PYPY_VERSION_NUM >= 0x07030800)
  0, /*tp_vectorcall*/
  #endif
  #if __PYX_NEED_TP_PRINT_SLOT == 1
  0, /*tp_print*/
  #endif
  #if PY_VERSION_HEX >= 0x030C0000
  0, /*tp_watched*/
  #endif
  #if 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_5pysam_7libcbcf_BCFIterator(PyTypeObject *t, PyObject *a, PyObject *k) {
  struct __pyx_obj_5pysam_7libcbcf_BCFIterator *p;
  PyObject *o = __pyx_tp_new_5pysam_7libcbcf_BaseIterator(t, a, k);
  if (unlikely(!o)) return 0;
  p = ((struct __pyx_obj_5pysam_7libcbcf_BCFIterator *)o);
  p->index = ((struct __pyx_obj_5pysam_7libcbcf_BCFIndex *)Py_None); Py_INCREF(Py_None);
  return o;
}

static void __pyx_tp_dealloc_5pysam_7libcbcf_BCFIterator(PyObject *o) {
  struct __pyx_obj_5pysam_7libcbcf_BCFIterator *p = (struct __pyx_obj_5pysam_7libcbcf_BCFIterator *)o;
  #if CYTHON_USE_TP_FINALIZE
  if (unlikely((PY_VERSION_HEX >= 0x03080000 || __Pyx_PyType_HasFeature(Py_TYPE(o), Py_TPFLAGS_HAVE_FINALIZE)) && __Pyx_PyObject_GetSlot(o, tp_finalize, destructor)) && !__Pyx_PyObject_GC_IsFinalized(o)) {
    if (__Pyx_PyObject_GetSlot(o, tp_dealloc, destructor) == __pyx_tp_dealloc_5pysam_7libcbcf_BCFIterator) {
      if (PyObject_CallFinalizerFromDealloc(o)) return;
    }
  }
  #endif
  PyObject_GC_UnTrack(o);
  {
    PyObject *etype, *eval, *etb;
    PyErr_Fetch(&etype, &eval, &etb);
    __Pyx_SET_REFCNT(o, Py_REFCNT(o) + 1);
    __pyx_pw_5pysam_7libcbcf_11BCFIterator_3__dealloc__(o);
    __Pyx_SET_REFCNT(o, Py_REFCNT(o) - 1);
    PyErr_Restore(etype, eval, etb);
  }
  Py_CLEAR(p->index);
  PyObject_GC_Track(o);
  __pyx_tp_dealloc_5pysam_7libcbcf_BaseIterator(o);
}

static int __pyx_tp_traverse_5pysam_7libcbcf_BCFIterator(PyObject *o, visitproc v, void *a) {
  int e;
  struct __pyx_obj_5pysam_7libcbcf_BCFIterator *p = (struct __pyx_obj_5pysam_7libcbcf_BCFIterator *)o;
  e = __pyx_tp_traverse_5pysam_7libcbcf_BaseIterator(o, v, a); if (e) return e;
  if (p->index) {
    e = (*v)(((PyObject *)p->index), a); if (e) return e;
  }
  return 0;
}

static int __pyx_tp_clear_5pysam_7libcbcf_BCFIterator(PyObject *o) {
  PyObject* tmp;
  struct __pyx_obj_5pysam_7libcbcf_BCFIterator *p = (struct __pyx_obj_5pysam_7libcbcf_BCFIterator *)o;
  __pyx_tp_clear_5pysam_7libcbcf_BaseIterator(o);
  tmp = ((PyObject*)p->index);
  p->index = ((struct __pyx_obj_5pysam_7libcbcf_BCFIndex *)Py_None); Py_INCREF(Py_None);
  Py_XDECREF(tmp);
  return 0;
}

static PyObject *__pyx_specialmethod___pyx_pw_5pysam_7libcbcf_11BCFIterator_7__next__(PyObject *self, CYTHON_UNUSED PyObject *arg) {
  PyObject *res = __pyx_pw_5pysam_7libcbcf_11BCFIterator_7__next__(self);
  if (!res && !PyErr_Occurred()) { PyErr_SetNone(PyExc_StopIteration); }
  return res;
}

static PyMethodDef __pyx_methods_5pysam_7libcbcf_BCFIterator[] = {
  {"__next__", (PyCFunction)__pyx_specialmethod___pyx_pw_5pysam_7libcbcf_11BCFIterator_7__next__, METH_NOARGS|METH_COEXIST, 0},
  {"__reduce_cython__", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_5pysam_7libcbcf_11BCFIterator_9__reduce_cython__, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_5pysam_7libcbcf_11BCFIterator_8__reduce_cython__},
  {"__setstate_cython__", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_5pysam_7libcbcf_11BCFIterator_11__setstate_cython__, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_5pysam_7libcbcf_11BCFIterator_10__setstate_cython__},
  {0, 0, 0, 0}
};
#if CYTHON_USE_TYPE_SPECS
static PyType_Slot __pyx_type_5pysam_7libcbcf_BCFIterator_slots[] = {
  {Py_tp_dealloc, (void *)__pyx_tp_dealloc_5pysam_7libcbcf_BCFIterator},
  {Py_tp_doc, (void *)PyDoc_STR("BCFIterator(VariantFile bcf, contig=None, start=None, stop=None, reopen=True)")},
  {Py_tp_traverse, (void *)__pyx_tp_traverse_5pysam_7libcbcf_BCFIterator},
  {Py_tp_clear, (void *)__pyx_tp_clear_5pysam_7libcbcf_BCFIterator},
  {Py_tp_iter, (void *)__pyx_pw_5pysam_7libcbcf_11BCFIterator_5__iter__},
  {Py_tp_iternext, (void *)__pyx_pw_5pysam_7libcbcf_11BCFIterator_7__next__},
  {Py_tp_methods, (void *)__pyx_methods_5pysam_7libcbcf_BCFIterator},
  {Py_tp_init, (void *)__pyx_pw_5pysam_7libcbcf_11BCFIterator_1__init__},
  {Py_tp_new, (void *)__pyx_tp_new_5pysam_7libcbcf_BCFIterator},
  {0, 0},
};
static PyType_Spec __pyx_type_5pysam_7libcbcf_BCFIterator_spec = {
  "pysam.libcbcf.BCFIterator",
  sizeof(struct __pyx_obj_5pysam_7libcbcf_BCFIterator),
  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_5pysam_7libcbcf_BCFIterator_slots,
};
#else

static PyTypeObject __pyx_type_5pysam_7libcbcf_BCFIterator = {
  PyVarObject_HEAD_INIT(0, 0)
  "pysam.libcbcf.""BCFIterator", /*tp_name*/
  sizeof(struct __pyx_obj_5pysam_7libcbcf_BCFIterator), /*tp_basicsize*/
  0, /*tp_itemsize*/
  __pyx_tp_dealloc_5pysam_7libcbcf_BCFIterator, /*tp_dealloc*/
  #if PY_VERSION_HEX < 0x030800b4
  0, /*tp_print*/
  #endif
  #if PY_VERSION_HEX >= 0x030800b4
  0, /*tp_vectorcall_offset*/
  #endif
  0, /*tp_getattr*/
  0, /*tp_setattr*/
  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("BCFIterator(VariantFile bcf, contig=None, start=None, stop=None, reopen=True)"), /*tp_doc*/
  __pyx_tp_traverse_5pysam_7libcbcf_BCFIterator, /*tp_traverse*/
  __pyx_tp_clear_5pysam_7libcbcf_BCFIterator, /*tp_clear*/
  0, /*tp_richcompare*/
  0, /*tp_weaklistoffset*/
  __pyx_pw_5pysam_7libcbcf_11BCFIterator_5__iter__, /*tp_iter*/
  __pyx_pw_5pysam_7libcbcf_11BCFIterator_7__next__, /*tp_iternext*/
  __pyx_methods_5pysam_7libcbcf_BCFIterator, /*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_5pysam_7libcbcf_11BCFIterator_1__init__, /*tp_init*/
  0, /*tp_alloc*/
  __pyx_tp_new_5pysam_7libcbcf_BCFIterator, /*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 PY_VERSION_HEX >= 0x030800b1 && (!CYTHON_COMPILING_IN_PYPY || PYPY_VERSION_NUM >= 0x07030800)
  0, /*tp_vectorcall*/
  #endif
  #if __PYX_NEED_TP_PRINT_SLOT == 1
  0, /*tp_print*/
  #endif
  #if PY_VERSION_HEX >= 0x030C0000
  0, /*tp_watched*/
  #endif
  #if 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_5pysam_7libcbcf_TabixIterator(PyTypeObject *t, PyObject *a, PyObject *k) {
  struct __pyx_obj_5pysam_7libcbcf_TabixIterator *p;
  PyObject *o = __pyx_tp_new_5pysam_7libcbcf_BaseIterator(t, a, k);
  if (unlikely(!o)) return 0;
  p = ((struct __pyx_obj_5pysam_7libcbcf_TabixIterator *)o);
  p->index = ((struct __pyx_obj_5pysam_7libcbcf_TabixIndex *)Py_None); Py_INCREF(Py_None);
  if (unlikely(__pyx_pw_5pysam_7libcbcf_13TabixIterator_1__cinit__(o, a, k) < 0)) goto bad;
  return o;
  bad:
  Py_DECREF(o); o = 0;
  return NULL;
}

static void __pyx_tp_dealloc_5pysam_7libcbcf_TabixIterator(PyObject *o) {
  struct __pyx_obj_5pysam_7libcbcf_TabixIterator *p = (struct __pyx_obj_5pysam_7libcbcf_TabixIterator *)o;
  #if CYTHON_USE_TP_FINALIZE
  if (unlikely((PY_VERSION_HEX >= 0x03080000 || __Pyx_PyType_HasFeature(Py_TYPE(o), Py_TPFLAGS_HAVE_FINALIZE)) && __Pyx_PyObject_GetSlot(o, tp_finalize, destructor)) && !__Pyx_PyObject_GC_IsFinalized(o)) {
    if (__Pyx_PyObject_GetSlot(o, tp_dealloc, destructor) == __pyx_tp_dealloc_5pysam_7libcbcf_TabixIterator) {
      if (PyObject_CallFinalizerFromDealloc(o)) return;
    }
  }
  #endif
  PyObject_GC_UnTrack(o);
  {
    PyObject *etype, *eval, *etb;
    PyErr_Fetch(&etype, &eval, &etb);
    __Pyx_SET_REFCNT(o, Py_REFCNT(o) + 1);
    __pyx_pw_5pysam_7libcbcf_13TabixIterator_5__dealloc__(o);
    __Pyx_SET_REFCNT(o, Py_REFCNT(o) - 1);
    PyErr_Restore(etype, eval, etb);
  }
  Py_CLEAR(p->index);
  PyObject_GC_Track(o);
  __pyx_tp_dealloc_5pysam_7libcbcf_BaseIterator(o);
}

static int __pyx_tp_traverse_5pysam_7libcbcf_TabixIterator(PyObject *o, visitproc v, void *a) {
  int e;
  struct __pyx_obj_5pysam_7libcbcf_TabixIterator *p = (struct __pyx_obj_5pysam_7libcbcf_TabixIterator *)o;
  e = __pyx_tp_traverse_5pysam_7libcbcf_BaseIterator(o, v, a); if (e) return e;
  if (p->index) {
    e = (*v)(((PyObject *)p->index), a); if (e) return e;
  }
  return 0;
}

static int __pyx_tp_clear_5pysam_7libcbcf_TabixIterator(PyObject *o) {
  PyObject* tmp;
  struct __pyx_obj_5pysam_7libcbcf_TabixIterator *p = (struct __pyx_obj_5pysam_7libcbcf_TabixIterator *)o;
  __pyx_tp_clear_5pysam_7libcbcf_BaseIterator(o);
  tmp = ((PyObject*)p->index);
  p->index = ((struct __pyx_obj_5pysam_7libcbcf_TabixIndex *)Py_None); Py_INCREF(Py_None);
  Py_XDECREF(tmp);
  return 0;
}

static PyObject *__pyx_specialmethod___pyx_pw_5pysam_7libcbcf_13TabixIterator_9__next__(PyObject *self, CYTHON_UNUSED PyObject *arg) {
  PyObject *res = __pyx_pw_5pysam_7libcbcf_13TabixIterator_9__next__(self);
  if (!res && !PyErr_Occurred()) { PyErr_SetNone(PyExc_StopIteration); }
  return res;
}

static PyMethodDef __pyx_methods_5pysam_7libcbcf_TabixIterator[] = {
  {"__next__", (PyCFunction)__pyx_specialmethod___pyx_pw_5pysam_7libcbcf_13TabixIterator_9__next__, METH_NOARGS|METH_COEXIST, 0},
  {"__reduce_cython__", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_5pysam_7libcbcf_13TabixIterator_11__reduce_cython__, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_5pysam_7libcbcf_13TabixIterator_10__reduce_cython__},
  {"__setstate_cython__", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_5pysam_7libcbcf_13TabixIterator_13__setstate_cython__, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_5pysam_7libcbcf_13TabixIterator_12__setstate_cython__},
  {0, 0, 0, 0}
};
#if CYTHON_USE_TYPE_SPECS
static PyType_Slot __pyx_type_5pysam_7libcbcf_TabixIterator_slots[] = {
  {Py_tp_dealloc, (void *)__pyx_tp_dealloc_5pysam_7libcbcf_TabixIterator},
  {Py_tp_doc, (void *)PyDoc_STR("TabixIterator(VariantFile bcf, contig=None, start=None, stop=None, reopen=True)")},
  {Py_tp_traverse, (void *)__pyx_tp_traverse_5pysam_7libcbcf_TabixIterator},
  {Py_tp_clear, (void *)__pyx_tp_clear_5pysam_7libcbcf_TabixIterator},
  {Py_tp_iter, (void *)__pyx_pw_5pysam_7libcbcf_13TabixIterator_7__iter__},
  {Py_tp_iternext, (void *)__pyx_pw_5pysam_7libcbcf_13TabixIterator_9__next__},
  {Py_tp_methods, (void *)__pyx_methods_5pysam_7libcbcf_TabixIterator},
  {Py_tp_init, (void *)__pyx_pw_5pysam_7libcbcf_13TabixIterator_3__init__},
  {Py_tp_new, (void *)__pyx_tp_new_5pysam_7libcbcf_TabixIterator},
  {0, 0},
};
static PyType_Spec __pyx_type_5pysam_7libcbcf_TabixIterator_spec = {
  "pysam.libcbcf.TabixIterator",
  sizeof(struct __pyx_obj_5pysam_7libcbcf_TabixIterator),
  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_5pysam_7libcbcf_TabixIterator_slots,
};
#else

static PyTypeObject __pyx_type_5pysam_7libcbcf_TabixIterator = {
  PyVarObject_HEAD_INIT(0, 0)
  "pysam.libcbcf.""TabixIterator", /*tp_name*/
  sizeof(struct __pyx_obj_5pysam_7libcbcf_TabixIterator), /*tp_basicsize*/
  0, /*tp_itemsize*/
  __pyx_tp_dealloc_5pysam_7libcbcf_TabixIterator, /*tp_dealloc*/
  #if PY_VERSION_HEX < 0x030800b4
  0, /*tp_print*/
  #endif
  #if PY_VERSION_HEX >= 0x030800b4
  0, /*tp_vectorcall_offset*/
  #endif
  0, /*tp_getattr*/
  0, /*tp_setattr*/
  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("TabixIterator(VariantFile bcf, contig=None, start=None, stop=None, reopen=True)"), /*tp_doc*/
  __pyx_tp_traverse_5pysam_7libcbcf_TabixIterator, /*tp_traverse*/
  __pyx_tp_clear_5pysam_7libcbcf_TabixIterator, /*tp_clear*/
  0, /*tp_richcompare*/
  0, /*tp_weaklistoffset*/
  __pyx_pw_5pysam_7libcbcf_13TabixIterator_7__iter__, /*tp_iter*/
  __pyx_pw_5pysam_7libcbcf_13TabixIterator_9__next__, /*tp_iternext*/
  __pyx_methods_5pysam_7libcbcf_TabixIterator, /*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_5pysam_7libcbcf_13TabixIterator_3__init__, /*tp_init*/
  0, /*tp_alloc*/
  __pyx_tp_new_5pysam_7libcbcf_TabixIterator, /*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 PY_VERSION_HEX >= 0x030800b1 && (!CYTHON_COMPILING_IN_PYPY || PYPY_VERSION_NUM >= 0x07030800)
  0, /*tp_vectorcall*/
  #endif
  #if __PYX_NEED_TP_PRINT_SLOT == 1
  0, /*tp_print*/
  #endif
  #if PY_VERSION_HEX >= 0x030C0000
  0, /*tp_watched*/
  #endif
  #if 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_5pysam_7libcbcf_VariantFile __pyx_vtable_5pysam_7libcbcf_VariantFile;

static PyObject *__pyx_tp_new_5pysam_7libcbcf_VariantFile(PyTypeObject *t, PyObject *a, PyObject *k) {
  struct __pyx_obj_5pysam_7libcbcf_VariantFile *p;
  PyObject *o = __Pyx_PyType_GetSlot(__pyx_mstate_global->__pyx_ptype_5pysam_10libchtslib_HTSFile, tp_new, newfunc)(t, a, k);
  if (unlikely(!o)) return 0;
  p = ((struct __pyx_obj_5pysam_7libcbcf_VariantFile *)o);
  p->__pyx_base.__pyx_vtab = (struct __pyx_vtabstruct_5pysam_10libchtslib_HTSFile*)__pyx_vtabptr_5pysam_7libcbcf_VariantFile;
  p->header = ((struct __pyx_obj_5pysam_7libcbcf_VariantHeader *)Py_None); Py_INCREF(Py_None);
  p->index = ((struct __pyx_obj_5pysam_7libcbcf_BaseIndex *)Py_None); Py_INCREF(Py_None);
  if (unlikely(__pyx_pw_5pysam_7libcbcf_11VariantFile_1__cinit__(o, a, k) < 0)) goto bad;
  return o;
  bad:
  Py_DECREF(o); o = 0;
  return NULL;
}

static void __pyx_tp_dealloc_5pysam_7libcbcf_VariantFile(PyObject *o) {
  struct __pyx_obj_5pysam_7libcbcf_VariantFile *p = (struct __pyx_obj_5pysam_7libcbcf_VariantFile *)o;
  #if CYTHON_USE_TP_FINALIZE
  if (unlikely((PY_VERSION_HEX >= 0x03080000 || __Pyx_PyType_HasFeature(Py_TYPE(o), Py_TPFLAGS_HAVE_FINALIZE)) && __Pyx_PyObject_GetSlot(o, tp_finalize, destructor)) && !__Pyx_PyObject_GC_IsFinalized(o)) {
    if (__Pyx_PyObject_GetSlot(o, tp_dealloc, destructor) == __pyx_tp_dealloc_5pysam_7libcbcf_VariantFile) {
      if (PyObject_CallFinalizerFromDealloc(o)) return;
    }
  }
  #endif
  PyObject_GC_UnTrack(o);
  {
    PyObject *etype, *eval, *etb;
    PyErr_Fetch(&etype, &eval, &etb);
    __Pyx_SET_REFCNT(o, Py_REFCNT(o) + 1);
    __pyx_pw_5pysam_7libcbcf_11VariantFile_5__dealloc__(o);
    __Pyx_SET_REFCNT(o, Py_REFCNT(o) - 1);
    PyErr_Restore(etype, eval, etb);
  }
  Py_CLEAR(p->header);
  Py_CLEAR(p->index);
  if (PyType_IS_GC(__pyx_mstate_global->__pyx_ptype_5pysam_10libchtslib_HTSFile)) PyObject_GC_Track(o);
  #if !CYTHON_USE_MODULE_STATE
  if (likely(__pyx_mstate_global->__pyx_ptype_5pysam_10libchtslib_HTSFile)) __Pyx_PyType_GetSlot(__pyx_mstate_global->__pyx_ptype_5pysam_10libchtslib_HTSFile, tp_dealloc, destructor)(o); else
  #endif
  __Pyx_call_next_tp_dealloc(o, __pyx_tp_dealloc_5pysam_7libcbcf_VariantFile);
}

static int __pyx_tp_traverse_5pysam_7libcbcf_VariantFile(PyObject *o, visitproc v, void *a) {
  int e;
  struct __pyx_obj_5pysam_7libcbcf_VariantFile *p = (struct __pyx_obj_5pysam_7libcbcf_VariantFile *)o;
  #if !CYTHON_USE_MODULE_STATE
  e = 0;
  if (likely(__pyx_mstate_global->__pyx_ptype_5pysam_10libchtslib_HTSFile)) {
    traverseproc traverse = __Pyx_PyType_GetSlot(__pyx_mstate_global->__pyx_ptype_5pysam_10libchtslib_HTSFile, tp_traverse, traverseproc);
    if (traverse) { e = traverse(o, v, a); }
  } else
  #endif
  { e = __Pyx_call_next_tp_traverse(o, v, a, __pyx_tp_traverse_5pysam_7libcbcf_VariantFile); }
  if (e) return e;
  {
    e = __Pyx_call_type_traverse(o, 0, v, a);
    if (e) return e;
  }
  if (p->header) {
    e = (*v)(((PyObject *)p->header), a); if (e) return e;
  }
  if (p->index) {
    e = (*v)(((PyObject *)p->index), a); if (e) return e;
  }
  return 0;
}

static int __pyx_tp_clear_5pysam_7libcbcf_VariantFile(PyObject *o) {
  PyObject* tmp;
  struct __pyx_obj_5pysam_7libcbcf_VariantFile *p = (struct __pyx_obj_5pysam_7libcbcf_VariantFile *)o;
  #if !CYTHON_USE_MODULE_STATE
  if (likely(__pyx_mstate_global->__pyx_ptype_5pysam_10libchtslib_HTSFile)) {
    inquiry clear = __Pyx_PyType_GetSlot(__pyx_mstate_global->__pyx_ptype_5pysam_10libchtslib_HTSFile, tp_clear, inquiry);
    if (clear) clear(o);
  } else
  #endif
  { __Pyx_call_next_tp_clear(o, __pyx_tp_clear_5pysam_7libcbcf_VariantFile); }
  tmp = ((PyObject*)p->header);
  p->header = ((struct __pyx_obj_5pysam_7libcbcf_VariantHeader *)Py_None); Py_INCREF(Py_None);
  Py_XDECREF(tmp);
  tmp = ((PyObject*)p->index);
  p->index = ((struct __pyx_obj_5pysam_7libcbcf_BaseIndex *)Py_None); Py_INCREF(Py_None);
  Py_XDECREF(tmp);
  return 0;
}

static PyObject *__pyx_getprop_5pysam_7libcbcf_11VariantFile_header(PyObject *o, CYTHON_UNUSED void *x) {
  return __pyx_pw_5pysam_7libcbcf_11VariantFile_6header_1__get__(o);
}

static PyObject *__pyx_getprop_5pysam_7libcbcf_11VariantFile_index(PyObject *o, CYTHON_UNUSED void *x) {
  return __pyx_pw_5pysam_7libcbcf_11VariantFile_5index_1__get__(o);
}

static PyObject *__pyx_getprop_5pysam_7libcbcf_11VariantFile_drop_samples(PyObject *o, CYTHON_UNUSED void *x) {
  return __pyx_pw_5pysam_7libcbcf_11VariantFile_12drop_samples_1__get__(o);
}

static PyObject *__pyx_getprop_5pysam_7libcbcf_11VariantFile_is_reading(PyObject *o, CYTHON_UNUSED void *x) {
  return __pyx_pw_5pysam_7libcbcf_11VariantFile_10is_reading_1__get__(o);
}

static PyObject *__pyx_getprop_5pysam_7libcbcf_11VariantFile_header_written(PyObject *o, CYTHON_UNUSED void *x) {
  return __pyx_pw_5pysam_7libcbcf_11VariantFile_14header_written_1__get__(o);
}

static PyObject *__pyx_specialmethod___pyx_pw_5pysam_7libcbcf_11VariantFile_11__next__(PyObject *self, CYTHON_UNUSED PyObject *arg) {
  PyObject *res = __pyx_pw_5pysam_7libcbcf_11VariantFile_11__next__(self);
  if (!res && !PyErr_Occurred()) { PyErr_SetNone(PyExc_StopIteration); }
  return res;
}

static PyMethodDef __pyx_methods_5pysam_7libcbcf_VariantFile[] = {
  {"close", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_5pysam_7libcbcf_11VariantFile_7close, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_5pysam_7libcbcf_11VariantFile_6close},
  {"__next__", (PyCFunction)__pyx_specialmethod___pyx_pw_5pysam_7libcbcf_11VariantFile_11__next__, METH_NOARGS|METH_COEXIST, 0},
  {"copy", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_5pysam_7libcbcf_11VariantFile_13copy, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_5pysam_7libcbcf_11VariantFile_12copy},
  {"open", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_5pysam_7libcbcf_11VariantFile_15open, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_5pysam_7libcbcf_11VariantFile_14open},
  {"reset", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_5pysam_7libcbcf_11VariantFile_17reset, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_5pysam_7libcbcf_11VariantFile_16reset},
  {"is_valid_tid", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_5pysam_7libcbcf_11VariantFile_19is_valid_tid, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_5pysam_7libcbcf_11VariantFile_18is_valid_tid},
  {"get_tid", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_5pysam_7libcbcf_11VariantFile_21get_tid, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_5pysam_7libcbcf_11VariantFile_20get_tid},
  {"get_reference_name", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_5pysam_7libcbcf_11VariantFile_23get_reference_name, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_5pysam_7libcbcf_11VariantFile_22get_reference_name},
  {"fetch", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_5pysam_7libcbcf_11VariantFile_25fetch, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_5pysam_7libcbcf_11VariantFile_24fetch},
  {"new_record", (PyCFunction)(void(*)(void))(PyCFunctionWithKeywords)__pyx_pw_5pysam_7libcbcf_11VariantFile_27new_record, METH_VARARGS|METH_KEYWORDS, __pyx_doc_5pysam_7libcbcf_11VariantFile_26new_record},
  {"subset_samples", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_5pysam_7libcbcf_11VariantFile_31subset_samples, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_5pysam_7libcbcf_11VariantFile_30subset_samples},
  {"__reduce_cython__", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_5pysam_7libcbcf_11VariantFile_33__reduce_cython__, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_5pysam_7libcbcf_11VariantFile_32__reduce_cython__},
  {"__setstate_cython__", (PyCFunction)(void(*)(void))(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_5pysam_7libcbcf_11VariantFile_35__setstate_cython__, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_5pysam_7libcbcf_11VariantFile_34__setstate_cython__},
  {0, 0, 0, 0}
};

static struct PyGetSetDef __pyx_getsets_5pysam_7libcbcf_VariantFile[] = {
  {"header", __pyx_getprop_5pysam_7libcbcf_11VariantFile_header, 0, 0, 0},
  {"index", __pyx_getprop_5pysam_7libcbcf_11VariantFile_index, 0, 0, 0},
  {"drop_samples", __pyx_getprop_5pysam_7libcbcf_11VariantFile_drop_samples, 0, 0, 0},
  {"is_reading", __pyx_getprop_5pysam_7libcbcf_11VariantFile_is_reading, 0, 0, 0},
  {"header_written", __pyx_getprop_5pysam_7libcbcf_11VariantFile_header_written, 0, 0, 0},
  {0, 0, 0, 0, 0}
};
#if CYTHON_USE_TYPE_SPECS
static PyType_Slot __pyx_type_5pysam_7libcbcf_VariantFile_slots[] = {
  {Py_tp_dealloc, (void *)__pyx_tp_dealloc_5pysam_7libcbcf_VariantFile},
  {Py_tp_doc, (void *)PyDoc_STR("VariantFile(*args, **kwargs)\n\n*(filename, mode=None, index_filename=None, header=None, drop_samples=False,\nduplicate_filehandle=True, ignore_truncation=False, threads=1)*\n\nA :term:`VCF`/:term:`BCF` formatted file. The file is automatically\nopened.\n\nIf an index for a variant file exists (.csi or .tbi), it will be\nopened automatically.  Without an index random access to records\nvia :meth:`fetch` is disabled.\n\nFor writing, a :class:`VariantHeader` object must be provided,\ntypically obtained from another :term:`VCF` file/:term:`BCF`\nfile.\n\nParameters\n----------\nmode : string\n    *mode* should be ``r`` for reading or ``w`` for writing. The default is\n    text mode (:term:`VCF`).  For binary (:term:`BCF`) I/O you should append\n    ``b`` for compressed or ``u`` for uncompressed :term:`BCF` output.\n\n    If ``b`` is present, it must immediately follow ``r`` or ``w``.  Valid\n    modes are ``r``, ``w``, ``wh``, ``rb``, ``wb``, ``wbu`` and ``wb0``.\n    For instance, to open a :term:`BCF` formatted file for reading, type::\n\n        f = pysam.VariantFile('ex1.bcf','r')\n\n    If mode is not specified, we will try to auto-detect the file type.  All\n    of the following should work::\n\n        f1 = pysam.VariantFile('ex1.bcf')\n        f2 = pysam.VariantFile('ex1.vcf')\n        f3 = pysam.VariantFile('ex1.vcf.gz')\n\nindex_filename : string\n    Explicit path to an index file.\n\nheader : VariantHeader\n    :class:`VariantHeader` object required for writing.\n\ndrop_samples: bool\n    Ignore sample information when reading.\n\nduplicate_filehandle: bool\n    By default, file handles passed either directly or through\n    File-like objects will be duplicated before passing them to\n    htslib. The duplication prevents issues where the same stream\n    will be closed by htslib and through destruction of the\n    high-level python object. Set to False to turn off\n    duplication.\n\nignore_truncation: bool\n    Issue a warning, instead of raising an error"" if the current file\n    appears to be truncated due to a missing EOF marker.  Only applies\n    to bgzipped formats. (Default=False)\n\nthreads: integer\n    Number of threads to use for compressing/decompressing VCF/BCF files.\n    Setting threads to > 1 cannot be combined with `ignore_truncation`.\n    (Default=1)")},
  {Py_tp_traverse, (void *)__pyx_tp_traverse_5pysam_7libcbcf_VariantFile},
  {Py_tp_clear, (void *)__pyx_tp_clear_5pysam_7libcbcf_VariantFile},
  {Py_tp_iter, (void *)__pyx_pw_5pysam_7libcbcf_11VariantFile_9__iter__},
  {Py_tp_iternext, (void *)__pyx_pw_5pysam_7libcbcf_11VariantFile_11__next__},
  {Py_tp_methods, (void *)__pyx_methods_5pysam_7libcbcf_VariantFile},
  {Py_tp_getset, (void *)__pyx_getsets_5pysam_7libcbcf_VariantFile},
  {Py_tp_init, (void *)__pyx_pw_5pysam_7libcbcf_11VariantFile_3__init__},
  {Py_tp_new, (void *)__pyx_tp_new_5pysam_7libcbcf_VariantFile},
  {0, 0},
};
static PyType_Spec __pyx_type_5pysam_7libcbcf_VariantFile_spec = {
  "pysam.libcbcf.VariantFile",
  sizeof(struct __pyx_obj_5pysam_7libcbcf_VariantFile),
  0,
  Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_VERSION_TAG|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_BASETYPE|Py_TPFLAGS_HAVE_GC|Py_TPFLAGS_HAVE_FINALIZE,
  __pyx_type_5pysam_7libcbcf_VariantFile_slots,
};
#else

static PyTypeObject __pyx_type_5pysam_7libcbcf_VariantFile = {
  PyVarObject_HEAD_INIT(0, 0)
  "pysam.libcbcf.""VariantFile", /*tp_name*/
  sizeof(struct __pyx_obj_5pysam_7libcbcf_VariantFile), /*tp_basicsize*/
  0, /*tp_itemsize*/
  __pyx_tp_dealloc_5pysam_7libcbcf_VariantFile, /*tp_dealloc*/
  #if PY_VERSION_HEX < 0x030800b4
  0, /*tp_print*/
  #endif
  #if PY_VERSION_HEX >= 0x030800b4
  0, /*tp_vectorcall_offset*/
  #endif
  0, /*tp_getattr*/
  0, /*tp_setattr*/
  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|Py_TPFLAGS_HAVE_FINALIZE, /*tp_flags*/
  PyDoc_STR("VariantFile(*args, **kwargs)\n\n*(filename, mode=None, index_filename=None, header=None, drop_samples=False,\nduplicate_filehandle=True, ignore_truncation=False, threads=1)*\n\nA :term:`VCF`/:term:`BCF` formatted file. The file is automatically\nopened.\n\nIf an index for a variant file exists (.csi or .tbi), it will be\nopened automatically.  Without an index random access to records\nvia :meth:`fetch` is disabled.\n\nFor writing, a :class:`VariantHeader` object must be provided,\ntypically obtained from another :term:`VCF` file/:term:`BCF`\nfile.\n\nParameters\n----------\nmode : string\n    *mode* should be ``r`` for reading or ``w`` for writing. The default is\n    text mode (:term:`VCF`).  For binary (:term:`BCF`) I/O you should append\n    ``b`` for compressed or ``u`` for uncompressed :term:`BCF` output.\n\n    If ``b`` is present, it must immediately follow ``r`` or ``w``.  Valid\n    modes are ``r``, ``w``, ``wh``, ``rb``, ``wb``, ``wbu`` and ``wb0``.\n    For instance, to open a :term:`BCF` formatted file for reading, type::\n\n        f = pysam.VariantFile('ex1.bcf','r')\n\n    If mode is not specified, we will try to auto-detect the file type.  All\n    of the following should work::\n\n        f1 = pysam.VariantFile('ex1.bcf')\n        f2 = pysam.VariantFile('ex1.vcf')\n        f3 = pysam.VariantFile('ex1.vcf.gz')\n\nindex_filename : string\n    Explicit path to an index file.\n\nheader : VariantHeader\n    :class:`VariantHeader` object required for writing.\n\ndrop_samples: bool\n    Ignore sample information when reading.\n\nduplicate_filehandle: bool\n    By default, file handles passed either directly or through\n    File-like objects will be duplicated before passing them to\n    htslib. The duplication prevents issues where the same stream\n    will be closed by htslib and through destruction of the\n    high-level python object. Set to False to turn off\n    duplication.\n\nignore_truncation: bool\n    Issue a warning, instead of raising an error"" if the current file\n    appears to be truncated due to a missing EOF marker.  Only applies\n    to bgzipped formats. (Default=False)\n\nthreads: integer\n    Number of threads to use for compressing/decompressing VCF/BCF files.\n    Setting threads to > 1 cannot be combined with `ignore_truncation`.\n    (Default=1)"), /*tp_doc*/
  __pyx_tp_traverse_5pysam_7libcbcf_VariantFile, /*tp_traverse*/
  __pyx_tp_clear_5pysam_7libcbcf_VariantFile, /*tp_clear*/
  0, /*tp_richcompare*/
  0, /*tp_weaklistoffset*/
  __pyx_pw_5pysam_7libcbcf_11VariantFile_9__iter__, /*tp_iter*/
  __pyx_pw_5pysam_7libcbcf_11VariantFile_11__next__, /*tp_iternext*/
  __pyx_methods_5pysam_7libcbcf_VariantFile, /*tp_methods*/
  0, /*tp_members*/
  __pyx_getsets_5pysam_7libcbcf_VariantFile, /*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_5pysam_7libcbcf_11VariantFile_3__init__, /*tp_init*/
  0, /*tp_alloc*/
  __pyx_tp_new_5pysam_7libcbcf_VariantFile, /*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 PY_VERSION_HEX >= 0x030800b1 && (!CYTHON_COMPILING_IN_PYPY || PYPY_VERSION_NUM >= 0x07030800)
  0, /*tp_vectorcall*/
  #endif
  #if __PYX_NEED_TP_PRINT_SLOT == 1
  0, /*tp_print*/
  #endif
  #if PY_VERSION_HEX >= 0x030C0000
  0, /*tp_watched*/
  #endif
  #if 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_5pysam_7libcbcf___pyx_scope_struct____pyx_f_5pysam_7libcbcf_char_array_to_tuple(PyTypeObject *t, CYTHON_UNUSED PyObject *a, CYTHON_UNUSED PyObject *k) {
  PyObject *o;
  #if CYTHON_COMPILING_IN_LIMITED_API
  allocfunc alloc_func = (allocfunc)PyType_GetSlot(t, Py_tp_alloc);
  o = alloc_func(t, 0);
  #else
  #if CYTHON_USE_FREELISTS
  if (likely((int)(__pyx_mstate_global->__pyx_freecount_5pysam_7libcbcf___pyx_scope_struct____pyx_f_5pysam_7libcbcf_char_array_to_tuple > 0) & (int)(t->tp_basicsize == sizeof(struct __pyx_obj_5pysam_7libcbcf___pyx_scope_struct____pyx_f_5pysam_7libcbcf_char_array_to_tuple)))) {
    o = (PyObject*)__pyx_mstate_global->__pyx_freelist_5pysam_7libcbcf___pyx_scope_struct____pyx_f_5pysam_7libcbcf_char_array_to_tuple[--__pyx_mstate_global->__pyx_freecount_5pysam_7libcbcf___pyx_scope_struct____pyx_f_5pysam_7libcbcf_char_array_to_tuple];
    memset(o, 0, sizeof(struct __pyx_obj_5pysam_7libcbcf___pyx_scope_struct____pyx_f_5pysam_7libcbcf_char_array_to_tuple));
    (void) PyObject_INIT(o, t);
  } else
  #endif
  {
    o = (*t->tp_alloc)(t, 0);
    if (unlikely(!o)) return 0;
  }
  #endif
  return o;
}

static void __pyx_tp_dealloc_5pysam_7libcbcf___pyx_scope_struct____pyx_f_5pysam_7libcbcf_char_array_to_tuple(PyObject *o) {
  #if CYTHON_USE_TP_FINALIZE
  if (unlikely((PY_VERSION_HEX >= 0x03080000 || __Pyx_PyType_HasFeature(Py_TYPE(o), Py_TPFLAGS_HAVE_FINALIZE)) && __Pyx_PyObject_GetSlot(o, tp_finalize, destructor)) && (!PyType_IS_GC(Py_TYPE(o)) || !__Pyx_PyObject_GC_IsFinalized(o))) {
    if (__Pyx_PyObject_GetSlot(o, tp_dealloc, destructor) == __pyx_tp_dealloc_5pysam_7libcbcf___pyx_scope_struct____pyx_f_5pysam_7libcbcf_char_array_to_tuple) {
      if (PyObject_CallFinalizerFromDealloc(o)) return;
    }
  }
  #endif
  #if CYTHON_USE_FREELISTS
  if (((int)(__pyx_mstate_global->__pyx_freecount_5pysam_7libcbcf___pyx_scope_struct____pyx_f_5pysam_7libcbcf_char_array_to_tuple < 8) & (int)(Py_TYPE(o)->tp_basicsize == sizeof(struct __pyx_obj_5pysam_7libcbcf___pyx_scope_struct____pyx_f_5pysam_7libcbcf_char_array_to_tuple)))) {
    __pyx_mstate_global->__pyx_freelist_5pysam_7libcbcf___pyx_scope_struct____pyx_f_5pysam_7libcbcf_char_array_to_tuple[__pyx_mstate_global->__pyx_freecount_5pysam_7libcbcf___pyx_scope_struct____pyx_f_5pysam_7libcbcf_char_array_to_tuple++] = ((struct __pyx_obj_5pysam_7libcbcf___pyx_scope_struct____pyx_f_5pysam_7libcbcf_char_array_to_tuple *)o);
  } else
  #endif
  {
    #if CYTHON_USE_TYPE_SLOTS
    (*Py_TYPE(o)->tp_free)(o);
    #else
    {
      freefunc tp_free = (freefunc)PyType_GetSlot(Py_TYPE(o), Py_tp_free);
      if (tp_free) tp_free(o);
    }
    #endif
  }
}
#if CYTHON_USE_TYPE_SPECS
static PyType_Slot __pyx_type_5pysam_7libcbcf___pyx_scope_struct____pyx_f_5pysam_7libcbcf_char_array_to_tuple_slots[] = {
  {Py_tp_dealloc, (void *)__pyx_tp_dealloc_5pysam_7libcbcf___pyx_scope_struct____pyx_f_5pysam_7libcbcf_char_array_to_tuple},
  {Py_tp_new, (void *)__pyx_tp_new_5pysam_7libcbcf___pyx_scope_struct____pyx_f_5pysam_7libcbcf_char_array_to_tuple},
  {0, 0},
};
static PyType_Spec __pyx_type_5pysam_7libcbcf___pyx_scope_struct____pyx_f_5pysam_7libcbcf_char_array_to_tuple_spec = {
  "pysam.libcbcf.__pyx_scope_struct____pyx_f_5pysam_7libcbcf_char_array_to_tuple",
  sizeof(struct __pyx_obj_5pysam_7libcbcf___pyx_scope_struct____pyx_f_5pysam_7libcbcf_char_array_to_tuple),
  0,
  Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_VERSION_TAG|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_HAVE_FINALIZE,
  __pyx_type_5pysam_7libcbcf___pyx_scope_struct____pyx_f_5pysam_7libcbcf_char_array_to_tuple_slots,
};
#else

static PyTypeObject __pyx_type_5pysam_7libcbcf___pyx_scope_struct____pyx_f_5pysam_7libcbcf_char_array_to_tuple = {
  PyVarObject_HEAD_INIT(0, 0)
  "pysam.libcbcf.""__pyx_scope_struct____pyx_f_5pysam_7libcbcf_char_array_to_tuple", /*tp_name*/
  sizeof(struct __pyx_obj_5pysam_7libcbcf___pyx_scope_struct____pyx_f_5pysam_7libcbcf_char_array_to_tuple), /*tp_basicsize*/
  0, /*tp_itemsize*/
  __pyx_tp_dealloc_5pysam_7libcbcf___pyx_scope_struct____pyx_f_5pysam_7libcbcf_char_array_to_tuple, /*tp_dealloc*/
  #if PY_VERSION_HEX < 0x030800b4
  0, /*tp_print*/
  #endif
  #if PY_VERSION_HEX >= 0x030800b4
  0, /*tp_vectorcall_offset*/
  #endif
  0, /*tp_getattr*/
  0, /*tp_setattr*/
  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_FINALIZE, /*tp_flags*/
  0, /*tp_doc*/
  0, /*tp_traverse*/
  0, /*tp_clear*/
  0, /*tp_richcompare*/
  0, /*tp_weaklistoffset*/
  0, /*tp_iter*/
  0, /*tp_iternext*/
  0, /*tp_methods*/
  0, /*tp_members*/
  0, /*tp_getset*/
  0, /*tp_base*/
  0, /*tp_dict*/
  0, /*tp_descr_get*/
  0, /*tp_descr_set*/
  #if !CYTHON_USE_TYPE_SPECS
  0, /*tp_dictoffset*/
  #endif
  0, /*tp_init*/
  0, /*tp_alloc*/
  __pyx_tp_new_5pysam_7libcbcf___pyx_scope_struct____pyx_f_5pysam_7libcbcf_char_array_to_tuple, /*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 PY_VERSION_HEX >= 0x030800b1 && (!CYTHON_COMPILING_IN_PYPY || PYPY_VERSION_NUM >= 0x07030800)
  0, /*tp_vectorcall*/
  #endif
  #if __PYX_NEED_TP_PRINT_SLOT == 1
  0, /*tp_print*/
  #endif
  #if PY_VERSION_HEX >= 0x030C0000
  0, /*tp_watched*/
  #endif
  #if 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_5pysam_7libcbcf___pyx_scope_struct_1_genexpr(PyTypeObject *t, CYTHON_UNUSED PyObject *a, CYTHON_UNUSED PyObject *k) {
  PyObject *o;
  #if CYTHON_COMPILING_IN_LIMITED_API
  allocfunc alloc_func = (allocfunc)PyType_GetSlot(t, Py_tp_alloc);
  o = alloc_func(t, 0);
  #else
  #if CYTHON_USE_FREELISTS
  if (likely((int)(__pyx_mstate_global->__pyx_freecount_5pysam_7libcbcf___pyx_scope_struct_1_genexpr > 0) & (int)(t->tp_basicsize == sizeof(struct __pyx_obj_5pysam_7libcbcf___pyx_scope_struct_1_genexpr)))) {
    o = (PyObject*)__pyx_mstate_global->__pyx_freelist_5pysam_7libcbcf___pyx_scope_struct_1_genexpr[--__pyx_mstate_global->__pyx_freecount_5pysam_7libcbcf___pyx_scope_struct_1_genexpr];
    memset(o, 0, sizeof(struct __pyx_obj_5pysam_7libcbcf___pyx_scope_struct_1_genexpr));
    (void) PyObject_INIT(o, t);
    PyObject_GC_Track(o);
  } else
  #endif
  {
    o = (*t->tp_alloc)(t, 0);
    if (unlikely(!o)) return 0;
  }
  #endif
  return o;
}

static void __pyx_tp_dealloc_5pysam_7libcbcf___pyx_scope_struct_1_genexpr(PyObject *o) {
  struct __pyx_obj_5pysam_7libcbcf___pyx_scope_struct_1_genexpr *p = (struct __pyx_obj_5pysam_7libcbcf___pyx_scope_struct_1_genexpr *)o;
  #if CYTHON_USE_TP_FINALIZE
  if (unlikely((PY_VERSION_HEX >= 0x03080000 || __Pyx_PyType_HasFeature(Py_TYPE(o), Py_TPFLAGS_HAVE_FINALIZE)) && __Pyx_PyObject_GetSlot(o, tp_finalize, destructor)) && !__Pyx_PyObject_GC_IsFinalized(o)) {
    if (__Pyx_PyObject_GetSlot(o, tp_dealloc, destructor) == __pyx_tp_dealloc_5pysam_7libcbcf___pyx_scope_struct_1_genexpr) {
      if (PyObject_CallFinalizerFromDealloc(o)) return;
    }
  }
  #endif
  PyObject_GC_UnTrack(o);
  Py_CLEAR(p->__pyx_outer_scope);
  #if CYTHON_USE_FREELISTS
  if (((int)(__pyx_mstate_global->__pyx_freecount_5pysam_7libcbcf___pyx_scope_struct_1_genexpr < 8) & (int)(Py_TYPE(o)->tp_basicsize == sizeof(struct __pyx_obj_5pysam_7libcbcf___pyx_scope_struct_1_genexpr)))) {
    __pyx_mstate_global->__pyx_freelist_5pysam_7libcbcf___pyx_scope_struct_1_genexpr[__pyx_mstate_global->__pyx_freecount_5pysam_7libcbcf___pyx_scope_struct_1_genexpr++] = ((struct __pyx_obj_5pysam_7libcbcf___pyx_scope_struct_1_genexpr *)o);
  } else
  #endif
  {
    #if CYTHON_USE_TYPE_SLOTS
    (*Py_TYPE(o)->tp_free)(o);
    #else
    {
      freefunc tp_free = (freefunc)PyType_GetSlot(Py_TYPE(o), Py_tp_free);
      if (tp_free) tp_free(o);
    }
    #endif
  }
}

static int __pyx_tp_traverse_5pysam_7libcbcf___pyx_scope_struct_1_genexpr(PyObject *o, visitproc v, void *a) {
  int e;
  struct __pyx_obj_5pysam_7libcbcf___pyx_scope_struct_1_genexpr *p = (struct __pyx_obj_5pysam_7libcbcf___pyx_scope_struct_1_genexpr *)o;
  {
    e = __Pyx_call_type_traverse(o, 1, v, a);
    if (e) return e;
  }
  if (p->__pyx_outer_scope) {
    e = (*v)(((PyObject *)p->__pyx_outer_scope), a); if (e) return e;
  }
  return 0;
}
#if CYTHON_USE_TYPE_SPECS
static PyType_Slot __pyx_type_5pysam_7libcbcf___pyx_scope_struct_1_genexpr_slots[] = {
  {Py_tp_dealloc, (void *)__pyx_tp_dealloc_5pysam_7libcbcf___pyx_scope_struct_1_genexpr},
  {Py_tp_traverse, (void *)__pyx_tp_traverse_5pysam_7libcbcf___pyx_scope_struct_1_genexpr},
  {Py_tp_new, (void *)__pyx_tp_new_5pysam_7libcbcf___pyx_scope_struct_1_genexpr},
  {0, 0},
};
static PyType_Spec __pyx_type_5pysam_7libcbcf___pyx_scope_struct_1_genexpr_spec = {
  "pysam.libcbcf.__pyx_scope_struct_1_genexpr",
  sizeof(struct __pyx_obj_5pysam_7libcbcf___pyx_scope_struct_1_genexpr),
  0,
  Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_VERSION_TAG|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_HAVE_GC|Py_TPFLAGS_HAVE_FINALIZE,
  __pyx_type_5pysam_7libcbcf___pyx_scope_struct_1_genexpr_slots,
};
#else

static PyTypeObject __pyx_type_5pysam_7libcbcf___pyx_scope_struct_1_genexpr = {
  PyVarObject_HEAD_INIT(0, 0)
  "pysam.libcbcf.""__pyx_scope_struct_1_genexpr", /*tp_name*/
  sizeof(struct __pyx_obj_5pysam_7libcbcf___pyx_scope_struct_1_genexpr), /*tp_basicsize*/
  0, /*tp_itemsize*/
  __pyx_tp_dealloc_5pysam_7libcbcf___pyx_scope_struct_1_genexpr, /*tp_dealloc*/
  #if PY_VERSION_HEX < 0x030800b4
  0, /*tp_print*/
  #endif
  #if PY_VERSION_HEX >= 0x030800b4
  0, /*tp_vectorcall_offset*/
  #endif
  0, /*tp_getattr*/
  0, /*tp_setattr*/
  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|Py_TPFLAGS_HAVE_FINALIZE, /*tp_flags*/
  0, /*tp_doc*/
  __pyx_tp_traverse_5pysam_7libcbcf___pyx_scope_struct_1_genexpr, /*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_5pysam_7libcbcf___pyx_scope_struct_1_genexpr, /*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 PY_VERSION_HEX >= 0x030800b1 && (!CYTHON_COMPILING_IN_PYPY || PYPY_VERSION_NUM >= 0x07030800)
  0, /*tp_vectorcall*/
  #endif
  #if __PYX_NEED_TP_PRINT_SLOT == 1
  0, /*tp_print*/
  #endif
  #if PY_VERSION_HEX >= 0x030C0000
  0, /*tp_watched*/
  #endif
  #if 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_5pysam_7libcbcf___pyx_scope_struct_2_genexpr(PyTypeObject *t, CYTHON_UNUSED PyObject *a, CYTHON_UNUSED PyObject *k) {
  PyObject *o;
  #if CYTHON_COMPILING_IN_LIMITED_API
  allocfunc alloc_func = (allocfunc)PyType_GetSlot(t, Py_tp_alloc);
  o = alloc_func(t, 0);
  #else
  #if CYTHON_USE_FREELISTS
  if (likely((int)(__pyx_mstate_global->__pyx_freecount_5pysam_7libcbcf___pyx_scope_struct_2_genexpr > 0) & (int)(t->tp_basicsize == sizeof(struct __pyx_obj_5pysam_7libcbcf___pyx_scope_struct_2_genexpr)))) {
    o = (PyObject*)__pyx_mstate_global->__pyx_freelist_5pysam_7libcbcf___pyx_scope_struct_2_genexpr[--__pyx_mstate_global->__pyx_freecount_5pysam_7libcbcf___pyx_scope_struct_2_genexpr];
    memset(o, 0, sizeof(struct __pyx_obj_5pysam_7libcbcf___pyx_scope_struct_2_genexpr));
    (void) PyObject_INIT(o, t);
    PyObject_GC_Track(o);
  } else
  #endif
  {
    o = (*t->tp_alloc)(t, 0);
    if (unlikely(!o)) return 0;
  }
  #endif
  return o;
}

static void __pyx_tp_dealloc_5pysam_7libcbcf___pyx_scope_struct_2_genexpr(PyObject *o) {
  struct __pyx_obj_5pysam_7libcbcf___pyx_scope_struct_2_genexpr *p = (struct __pyx_obj_5pysam_7libcbcf___pyx_scope_struct_2_genexpr *)o;
  #if CYTHON_USE_TP_FINALIZE
  if (unlikely((PY_VERSION_HEX >= 0x03080000 || __Pyx_PyType_HasFeature(Py_TYPE(o), Py_TPFLAGS_HAVE_FINALIZE)) && __Pyx_PyObject_GetSlot(o, tp_finalize, destructor)) && !__Pyx_PyObject_GC_IsFinalized(o)) {
    if (__Pyx_PyObject_GetSlot(o, tp_dealloc, destructor) == __pyx_tp_dealloc_5pysam_7libcbcf___pyx_scope_struct_2_genexpr) {
      if (PyObject_CallFinalizerFromDealloc(o)) return;
    }
  }
  #endif
  PyObject_GC_UnTrack(o);
  Py_CLEAR(p->__pyx_genexpr_arg_0);
  Py_CLEAR(p->__pyx_v_v);
  Py_CLEAR(p->__pyx_t_0);
  #if CYTHON_USE_FREELISTS
  if (((int)(__pyx_mstate_global->__pyx_freecount_5pysam_7libcbcf___pyx_scope_struct_2_genexpr < 8) & (int)(Py_TYPE(o)->tp_basicsize == sizeof(struct __pyx_obj_5pysam_7libcbcf___pyx_scope_struct_2_genexpr)))) {
    __pyx_mstate_global->__pyx_freelist_5pysam_7libcbcf___pyx_scope_struct_2_genexpr[__pyx_mstate_global->__pyx_freecount_5pysam_7libcbcf___pyx_scope_struct_2_genexpr++] = ((struct __pyx_obj_5pysam_7libcbcf___pyx_scope_struct_2_genexpr *)o);
  } else
  #endif
  {
    #if CYTHON_USE_TYPE_SLOTS
    (*Py_TYPE(o)->tp_free)(o);
    #else
    {
      freefunc tp_free = (freefunc)PyType_GetSlot(Py_TYPE(o), Py_tp_free);
      if (tp_free) tp_free(o);
    }
    #endif
  }
}

static int __pyx_tp_traverse_5pysam_7libcbcf___pyx_scope_struct_2_genexpr(PyObject *o, visitproc v, void *a) {
  int e;
  struct __pyx_obj_5pysam_7libcbcf___pyx_scope_struct_2_genexpr *p = (struct __pyx_obj_5pysam_7libcbcf___pyx_scope_struct_2_genexpr *)o;
  {
    e = __Pyx_call_type_traverse(o, 1, v, a);
    if (e) return e;
  }
  if (p->__pyx_v_v) {
    e = (*v)(p->__pyx_v_v, 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_5pysam_7libcbcf___pyx_scope_struct_2_genexpr_slots[] = {
  {Py_tp_dealloc, (void *)__pyx_tp_dealloc_5pysam_7libcbcf___pyx_scope_struct_2_genexpr},
  {Py_tp_traverse, (void *)__pyx_tp_traverse_5pysam_7libcbcf___pyx_scope_struct_2_genexpr},
  {Py_tp_new, (void *)__pyx_tp_new_5pysam_7libcbcf___pyx_scope_struct_2_genexpr},
  {0, 0},
};
static PyType_Spec __pyx_type_5pysam_7libcbcf___pyx_scope_struct_2_genexpr_spec = {
  "pysam.libcbcf.__pyx_scope_struct_2_genexpr",
  sizeof(struct __pyx_obj_5pysam_7libcbcf___pyx_scope_struct_2_genexpr),
  0,
  Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_VERSION_TAG|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_HAVE_GC|Py_TPFLAGS_HAVE_FINALIZE,
  __pyx_type_5pysam_7libcbcf___pyx_scope_struct_2_genexpr_slots,
};
#else

static PyTypeObject __pyx_type_5pysam_7libcbcf___pyx_scope_struct_2_genexpr = {
  PyVarObject_HEAD_INIT(0, 0)
  "pysam.libcbcf.""__pyx_scope_struct_2_genexpr", /*tp_name*/
  sizeof(struct __pyx_obj_5pysam_7libcbcf___pyx_scope_struct_2_genexpr), /*tp_basicsize*/
  0, /*tp_itemsize*/
  __pyx_tp_dealloc_5pysam_7libcbcf___pyx_scope_struct_2_genexpr, /*tp_dealloc*/
  #if PY_VERSION_HEX < 0x030800b4
  0, /*tp_print*/
  #endif
  #if PY_VERSION_HEX >= 0x030800b4
  0, /*tp_vectorcall_offset*/
  #endif
  0, /*tp_getattr*/
  0, /*tp_setattr*/
  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|Py_TPFLAGS_HAVE_FINALIZE, /*tp_flags*/
  0, /*tp_doc*/
  __pyx_tp_traverse_5pysam_7libcbcf___pyx_scope_struct_2_genexpr, /*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_5pysam_7libcbcf___pyx_scope_struct_2_genexpr, /*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 PY_VERSION_HEX >= 0x030800b1 && (!CYTHON_COMPILING_IN_PYPY || PYPY_VERSION_NUM >= 0x07030800)
  0, /*tp_vectorcall*/
  #endif
  #if __PYX_NEED_TP_PRINT_SLOT == 1
  0, /*tp_print*/
  #endif
  #if PY_VERSION_HEX >= 0x030C0000
  0, /*tp_watched*/
  #endif
  #if 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_5pysam_7libcbcf___pyx_scope_struct_3_genexpr(PyTypeObject *t, CYTHON_UNUSED PyObject *a, CYTHON_UNUSED PyObject *k) {
  PyObject *o;
  #if CYTHON_COMPILING_IN_LIMITED_API
  allocfunc alloc_func = (allocfunc)PyType_GetSlot(t, Py_tp_alloc);
  o = alloc_func(t, 0);
  #else
  #if CYTHON_USE_FREELISTS
  if (likely((int)(__pyx_mstate_global->__pyx_freecount_5pysam_7libcbcf___pyx_scope_struct_3_genexpr > 0) & (int)(t->tp_basicsize == sizeof(struct __pyx_obj_5pysam_7libcbcf___pyx_scope_struct_3_genexpr)))) {
    o = (PyObject*)__pyx_mstate_global->__pyx_freelist_5pysam_7libcbcf___pyx_scope_struct_3_genexpr[--__pyx_mstate_global->__pyx_freecount_5pysam_7libcbcf___pyx_scope_struct_3_genexpr];
    memset(o, 0, sizeof(struct __pyx_obj_5pysam_7libcbcf___pyx_scope_struct_3_genexpr));
    (void) PyObject_INIT(o, t);
    PyObject_GC_Track(o);
  } else
  #endif
  {
    o = (*t->tp_alloc)(t, 0);
    if (unlikely(!o)) return 0;
  }
  #endif
  return o;
}

static void __pyx_tp_dealloc_5pysam_7libcbcf___pyx_scope_struct_3_genexpr(PyObject *o) {
  struct __pyx_obj_5pysam_7libcbcf___pyx_scope_struct_3_genexpr *p = (struct __pyx_obj_5pysam_7libcbcf___pyx_scope_struct_3_genexpr *)o;
  #if CYTHON_USE_TP_FINALIZE
  if (unlikely((PY_VERSION_HEX >= 0x03080000 || __Pyx_PyType_HasFeature(Py_TYPE(o), Py_TPFLAGS_HAVE_FINALIZE)) && __Pyx_PyObject_GetSlot(o, tp_finalize, destructor)) && !__Pyx_PyObject_GC_IsFinalized(o)) {
    if (__Pyx_PyObject_GetSlot(o, tp_dealloc, destructor) == __pyx_tp_dealloc_5pysam_7libcbcf___pyx_scope_struct_3_genexpr) {
      if (PyObject_CallFinalizerFromDealloc(o)) return;
    }
  }
  #endif
  PyObject_GC_UnTrack(o);
  Py_CLEAR(p->__pyx_genexpr_arg_0);
  Py_CLEAR(p->__pyx_v_v);
  Py_CLEAR(p->__pyx_t_0);
  #if CYTHON_USE_FREELISTS
  if (((int)(__pyx_mstate_global->__pyx_freecount_5pysam_7libcbcf___pyx_scope_struct_3_genexpr < 8) & (int)(Py_TYPE(o)->tp_basicsize == sizeof(struct __pyx_obj_5pysam_7libcbcf___pyx_scope_struct_3_genexpr)))) {
    __pyx_mstate_global->__pyx_freelist_5pysam_7libcbcf___pyx_scope_struct_3_genexpr[__pyx_mstate_global->__pyx_freecount_5pysam_7libcbcf___pyx_scope_struct_3_genexpr++] = ((struct __pyx_obj_5pysam_7libcbcf___pyx_scope_struct_3_genexpr *)o);
  } else
  #endif
  {
    #if CYTHON_USE_TYPE_SLOTS
    (*Py_TYPE(o)->tp_free)(o);
    #else
    {
      freefunc tp_free = (freefunc)PyType_GetSlot(Py_TYPE(o), Py_tp_free);
      if (tp_free) tp_free(o);
    }
    #endif
  }
}

static int __pyx_tp_traverse_5pysam_7libcbcf___pyx_scope_struct_3_genexpr(PyObject *o, visitproc v, void *a) {
  int e;
  struct __pyx_obj_5pysam_7libcbcf___pyx_scope_struct_3_genexpr *p = (struct __pyx_obj_5pysam_7libcbcf___pyx_scope_struct_3_genexpr *)o;
  {
    e = __Pyx_call_type_traverse(o, 1, v, a);
    if (e) return e;
  }
  if (p->__pyx_genexpr_arg_0) {
    e = (*v)(p->__pyx_genexpr_arg_0, a); if (e) return e;
  }
  if (p->__pyx_v_v) {
    e = (*v)(p->__pyx_v_v, 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_5pysam_7libcbcf___pyx_scope_struct_3_genexpr_slots[] = {
  {Py_tp_dealloc, (void *)__pyx_tp_dealloc_5pysam_7libcbcf___pyx_scope_struct_3_genexpr},
  {Py_tp_traverse, (void *)__pyx_tp_traverse_5pysam_7libcbcf___pyx_scope_struct_3_genexpr},
  {Py_tp_new, (void *)__pyx_tp_new_5pysam_7libcbcf___pyx_scope_struct_3_genexpr},
  {0, 0},
};
static PyType_Spec __pyx_type_5pysam_7libcbcf___pyx_scope_struct_3_genexpr_spec = {
  "pysam.libcbcf.__pyx_scope_struct_3_genexpr",
  sizeof(struct __pyx_obj_5pysam_7libcbcf___pyx_scope_struct_3_genexpr),
  0,
  Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_VERSION_TAG|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_HAVE_GC|Py_TPFLAGS_HAVE_FINALIZE,
  __pyx_type_5pysam_7libcbcf___pyx_scope_struct_3_genexpr_slots,
};
#else

static PyTypeObject __pyx_type_5pysam_7libcbcf___pyx_scope_struct_3_genexpr = {
  PyVarObject_HEAD_INIT(0, 0)
  "pysam.libcbcf.""__pyx_scope_struct_3_genexpr", /*tp_name*/
  sizeof(struct __pyx_obj_5pysam_7libcbcf___pyx_scope_struct_3_genexpr), /*tp_basicsize*/
  0, /*tp_itemsize*/
  __pyx_tp_dealloc_5pysam_7libcbcf___pyx_scope_struct_3_genexpr, /*tp_dealloc*/
  #if PY_VERSION_HEX < 0x030800b4
  0, /*tp_print*/
  #endif
  #if PY_VERSION_HEX >= 0x030800b4
  0, /*tp_vectorcall_offset*/
  #endif
  0, /*tp_getattr*/
  0, /*tp_setattr*/
  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|Py_TPFLAGS_HAVE_FINALIZE, /*tp_flags*/
  0, /*tp_doc*/
  __pyx_tp_traverse_5pysam_7libcbcf___pyx_scope_struct_3_genexpr, /*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_5pysam_7libcbcf___pyx_scope_struct_3_genexpr, /*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 PY_VERSION_HEX >= 0x030800b1 && (!CYTHON_COMPILING_IN_PYPY || PYPY_VERSION_NUM >= 0x07030800)
  0, /*tp_vectorcall*/
  #endif
  #if __PYX_NEED_TP_PRINT_SLOT == 1
  0, /*tp_print*/
  #endif
  #if PY_VERSION_HEX >= 0x030C0000
  0, /*tp_watched*/
  #endif
  #if 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_5pysam_7libcbcf___pyx_scope_struct_4_genexpr(PyTypeObject *t, CYTHON_UNUSED PyObject *a, CYTHON_UNUSED PyObject *k) {
  PyObject *o;
  #if CYTHON_COMPILING_IN_LIMITED_API
  allocfunc alloc_func = (allocfunc)PyType_GetSlot(t, Py_tp_alloc);
  o = alloc_func(t, 0);
  #else
  #if CYTHON_USE_FREELISTS
  if (likely((int)(__pyx_mstate_global->__pyx_freecount_5pysam_7libcbcf___pyx_scope_struct_4_genexpr > 0) & (int)(t->tp_basicsize == sizeof(struct __pyx_obj_5pysam_7libcbcf___pyx_scope_struct_4_genexpr)))) {
    o = (PyObject*)__pyx_mstate_global->__pyx_freelist_5pysam_7libcbcf___pyx_scope_struct_4_genexpr[--__pyx_mstate_global->__pyx_freecount_5pysam_7libcbcf___pyx_scope_struct_4_genexpr];
    memset(o, 0, sizeof(struct __pyx_obj_5pysam_7libcbcf___pyx_scope_struct_4_genexpr));
    (void) PyObject_INIT(o, t);
    PyObject_GC_Track(o);
  } else
  #endif
  {
    o = (*t->tp_alloc)(t, 0);
    if (unlikely(!o)) return 0;
  }
  #endif
  return o;
}

static void __pyx_tp_dealloc_5pysam_7libcbcf___pyx_scope_struct_4_genexpr(PyObject *o) {
  struct __pyx_obj_5pysam_7libcbcf___pyx_scope_struct_4_genexpr *p = (struct __pyx_obj_5pysam_7libcbcf___pyx_scope_struct_4_genexpr *)o;
  #if CYTHON_USE_TP_FINALIZE
  if (unlikely((PY_VERSION_HEX >= 0x03080000 || __Pyx_PyType_HasFeature(Py_TYPE(o), Py_TPFLAGS_HAVE_FINALIZE)) && __Pyx_PyObject_GetSlot(o, tp_finalize, destructor)) && !__Pyx_PyObject_GC_IsFinalized(o)) {
    if (__Pyx_PyObject_GetSlot(o, tp_dealloc, destructor) == __pyx_tp_dealloc_5pysam_7libcbcf___pyx_scope_struct_4_genexpr) {
      if (PyObject_CallFinalizerFromDealloc(o)) return;
    }
  }
  #endif
  PyObject_GC_UnTrack(o);
  Py_CLEAR(p->__pyx_genexpr_arg_0);
  Py_CLEAR(p->__pyx_v_v);
  Py_CLEAR(p->__pyx_t_0);
  #if CYTHON_USE_FREELISTS
  if (((int)(__pyx_mstate_global->__pyx_freecount_5pysam_7libcbcf___pyx_scope_struct_4_genexpr < 8) & (int)(Py_TYPE(o)->tp_basicsize == sizeof(struct __pyx_obj_5pysam_7libcbcf___pyx_scope_struct_4_genexpr)))) {
    __pyx_mstate_global->__pyx_freelist_5pysam_7libcbcf___pyx_scope_struct_4_genexpr[__pyx_mstate_global->__pyx_freecount_5pysam_7libcbcf___pyx_scope_struct_4_genexpr++] = ((struct __pyx_obj_5pysam_7libcbcf___pyx_scope_struct_4_genexpr *)o);
  } else
  #endif
  {
    #if CYTHON_USE_TYPE_SLOTS
    (*Py_TYPE(o)->tp_free)(o);
    #else
    {
      freefunc tp_free = (freefunc)PyType_GetSlot(Py_TYPE(o), Py_tp_free);
      if (tp_free) tp_free(o);
    }
    #endif
  }
}

static int __pyx_tp_traverse_5pysam_7libcbcf___pyx_scope_struct_4_genexpr(PyObject *o, visitproc v, void *a) {
  int e;
  struct __pyx_obj_5pysam_7libcbcf___pyx_scope_struct_4_genexpr *p = (struct __pyx_obj_5pysam_7libcbcf___pyx_scope_struct_4_genexpr *)o;
  {
    e = __Pyx_call_type_traverse(o, 1, v, a);
    if (e) return e;
  }
  if (p->__pyx_genexpr_arg_0) {
    e = (*v)(p->__pyx_genexpr_arg_0, a); if (e) return e;
  }
  if (p->__pyx_v_v) {
    e = (*v)(p->__pyx_v_v, 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_5pysam_7libcbcf___pyx_scope_struct_4_genexpr_slots[] = {
  {Py_tp_dealloc, (void *)__pyx_tp_dealloc_5pysam_7libcbcf___pyx_scope_struct_4_genexpr},
  {Py_tp_traverse, (void *)__pyx_tp_traverse_5pysam_7libcbcf___pyx_scope_struct_4_genexpr},
  {Py_tp_new, (void *)__pyx_tp_new_5pysam_7libcbcf___pyx_scope_struct_4_genexpr},
  {0, 0},
};
static PyType_Spec __pyx_type_5pysam_7libcbcf___pyx_scope_struct_4_genexpr_spec = {
  "pysam.libcbcf.__pyx_scope_struct_4_genexpr",
  sizeof(struct __pyx_obj_5pysam_7libcbcf___pyx_scope_struct_4_genexpr),
  0,
  Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_VERSION_TAG|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_HAVE_GC|Py_TPFLAGS_HAVE_FINALIZE,
  __pyx_type_5pysam_7libcbcf___pyx_scope_struct_4_genexpr_slots,
};
#else

static PyTypeObject __pyx_type_5pysam_7libcbcf___pyx_scope_struct_4_genexpr = {
  PyVarObject_HEAD_INIT(0, 0)
  "pysam.libcbcf.""__pyx_scope_struct_4_genexpr", /*tp_name*/
  sizeof(struct __pyx_obj_5pysam_7libcbcf___pyx_scope_struct_4_genexpr), /*tp_basicsize*/
  0, /*tp_itemsize*/
  __pyx_tp_dealloc_5pysam_7libcbcf___pyx_scope_struct_4_genexpr, /*tp_dealloc*/
  #if PY_VERSION_HEX < 0x030800b4
  0, /*tp_print*/
  #endif
  #if PY_VERSION_HEX >= 0x030800b4
  0, /*tp_vectorcall_offset*/
  #endif
  0, /*tp_getattr*/
  0, /*tp_setattr*/
  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|Py_TPFLAGS_HAVE_FINALIZE, /*tp_flags*/
  0, /*tp_doc*/
  __pyx_tp_traverse_5pysam_7libcbcf___pyx_scope_struct_4_genexpr, /*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_5pysam_7libcbcf___pyx_scope_struct_4_genexpr, /*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 PY_VERSION_HEX >= 0x030800b1 && (!CYTHON_COMPILING_IN_PYPY || PYPY_VERSION_NUM >= 0x07030800)
  0, /*tp_vectorcall*/
  #endif
  #if __PYX_NEED_TP_PRINT_SLOT == 1
  0, /*tp_print*/
  #endif
  #if PY_VERSION_HEX >= 0x030C0000
  0, /*tp_watched*/
  #endif
  #if 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_5pysam_7libcbcf___pyx_scope_struct_5___get__(PyTypeObject *t, CYTHON_UNUSED PyObject *a, CYTHON_UNUSED PyObject *k) {
  PyObject *o;
  #if CYTHON_COMPILING_IN_LIMITED_API
  allocfunc alloc_func = (allocfunc)PyType_GetSlot(t, Py_tp_alloc);
  o = alloc_func(t, 0);
  #else
  #if CYTHON_USE_FREELISTS
  if (likely((int)(__pyx_mstate_global->__pyx_freecount_5pysam_7libcbcf___pyx_scope_struct_5___get__ > 0) & (int)(t->tp_basicsize == sizeof(struct __pyx_obj_5pysam_7libcbcf___pyx_scope_struct_5___get__)))) {
    o = (PyObject*)__pyx_mstate_global->__pyx_freelist_5pysam_7libcbcf___pyx_scope_struct_5___get__[--__pyx_mstate_global->__pyx_freecount_5pysam_7libcbcf___pyx_scope_struct_5___get__];
    memset(o, 0, sizeof(struct __pyx_obj_5pysam_7libcbcf___pyx_scope_struct_5___get__));
    (void) PyObject_INIT(o, t);
  } else
  #endif
  {
    o = (*t->tp_alloc)(t, 0);
    if (unlikely(!o)) return 0;
  }
  #endif
  return o;
}

static void __pyx_tp_dealloc_5pysam_7libcbcf___pyx_scope_struct_5___get__(PyObject *o) {
  #if CYTHON_USE_TP_FINALIZE
  if (unlikely((PY_VERSION_HEX >= 0x03080000 || __Pyx_PyType_HasFeature(Py_TYPE(o), Py_TPFLAGS_HAVE_FINALIZE)) && __Pyx_PyObject_GetSlot(o, tp_finalize, destructor)) && (!PyType_IS_GC(Py_TYPE(o)) || !__Pyx_PyObject_GC_IsFinalized(o))) {
    if (__Pyx_PyObject_GetSlot(o, tp_dealloc, destructor) == __pyx_tp_dealloc_5pysam_7libcbcf___pyx_scope_struct_5___get__) {
      if (PyObject_CallFinalizerFromDealloc(o)) return;
    }
  }
  #endif
  #if CYTHON_USE_FREELISTS
  if (((int)(__pyx_mstate_global->__pyx_freecount_5pysam_7libcbcf___pyx_scope_struct_5___get__ < 8) & (int)(Py_TYPE(o)->tp_basicsize == sizeof(struct __pyx_obj_5pysam_7libcbcf___pyx_scope_struct_5___get__)))) {
    __pyx_mstate_global->__pyx_freelist_5pysam_7libcbcf___pyx_scope_struct_5___get__[__pyx_mstate_global->__pyx_freecount_5pysam_7libcbcf___pyx_scope_struct_5___get__++] = ((struct __pyx_obj_5pysam_7libcbcf___pyx_scope_struct_5___get__ *)o);
  } else
  #endif
  {
    #if CYTHON_USE_TYPE_SLOTS
    (*Py_TYPE(o)->tp_free)(o);
    #else
    {
      freefunc tp_free = (freefunc)PyType_GetSlot(Py_TYPE(o), Py_tp_free);
      if (tp_free) tp_free(o);
    }
    #endif
  }
}
#if CYTHON_USE_TYPE_SPECS
static PyType_Slot __pyx_type_5pysam_7libcbcf___pyx_scope_struct_5___get___slots[] = {
  {Py_tp_dealloc, (void *)__pyx_tp_dealloc_5pysam_7libcbcf___pyx_scope_struct_5___get__},
  {Py_tp_new, (void *)__pyx_tp_new_5pysam_7libcbcf___pyx_scope_struct_5___get__},
  {0, 0},
};
static PyType_Spec __pyx_type_5pysam_7libcbcf___pyx_scope_struct_5___get___spec = {
  "pysam.libcbcf.__pyx_scope_struct_5___get__",
  sizeof(struct __pyx_obj_5pysam_7libcbcf___pyx_scope_struct_5___get__),
  0,
  Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_VERSION_TAG|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_HAVE_FINALIZE,
  __pyx_type_5pysam_7libcbcf___pyx_scope_struct_5___get___slots,
};
#else

static PyTypeObject __pyx_type_5pysam_7libcbcf___pyx_scope_struct_5___get__ = {
  PyVarObject_HEAD_INIT(0, 0)
  "pysam.libcbcf.""__pyx_scope_struct_5___get__", /*tp_name*/
  sizeof(struct __pyx_obj_5pysam_7libcbcf___pyx_scope_struct_5___get__), /*tp_basicsize*/
  0, /*tp_itemsize*/
  __pyx_tp_dealloc_5pysam_7libcbcf___pyx_scope_struct_5___get__, /*tp_dealloc*/
  #if PY_VERSION_HEX < 0x030800b4
  0, /*tp_print*/
  #endif
  #if PY_VERSION_HEX >= 0x030800b4
  0, /*tp_vectorcall_offset*/
  #endif
  0, /*tp_getattr*/
  0, /*tp_setattr*/
  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_FINALIZE, /*tp_flags*/
  0, /*tp_doc*/
  0, /*tp_traverse*/
  0, /*tp_clear*/
  0, /*tp_richcompare*/
  0, /*tp_weaklistoffset*/
  0, /*tp_iter*/
  0, /*tp_iternext*/
  0, /*tp_methods*/
  0, /*tp_members*/
  0, /*tp_getset*/
  0, /*tp_base*/
  0, /*tp_dict*/
  0, /*tp_descr_get*/
  0, /*tp_descr_set*/
  #if !CYTHON_USE_TYPE_SPECS
  0, /*tp_dictoffset*/
  #endif
  0, /*tp_init*/
  0, /*tp_alloc*/
  __pyx_tp_new_5pysam_7libcbcf___pyx_scope_struct_5___get__, /*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 PY_VERSION_HEX >= 0x030800b1 && (!CYTHON_COMPILING_IN_PYPY || PYPY_VERSION_NUM >= 0x07030800)
  0, /*tp_vectorcall*/
  #endif
  #if __PYX_NEED_TP_PRINT_SLOT == 1
  0, /*tp_print*/
  #endif
  #if PY_VERSION_HEX >= 0x030C0000
  0, /*tp_watched*/
  #endif
  #if 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_5pysam_7libcbcf___pyx_scope_struct_6_genexpr(PyTypeObject *t, CYTHON_UNUSED PyObject *a, CYTHON_UNUSED PyObject *k) {
  PyObject *o;
  #if CYTHON_COMPILING_IN_LIMITED_API
  allocfunc alloc_func = (allocfunc)PyType_GetSlot(t, Py_tp_alloc);
  o = alloc_func(t, 0);
  #else
  #if CYTHON_USE_FREELISTS
  if (likely((int)(__pyx_mstate_global->__pyx_freecount_5pysam_7libcbcf___pyx_scope_struct_6_genexpr > 0) & (int)(t->tp_basicsize == sizeof(struct __pyx_obj_5pysam_7libcbcf___pyx_scope_struct_6_genexpr)))) {
    o = (PyObject*)__pyx_mstate_global->__pyx_freelist_5pysam_7libcbcf___pyx_scope_struct_6_genexpr[--__pyx_mstate_global->__pyx_freecount_5pysam_7libcbcf___pyx_scope_struct_6_genexpr];
    memset(o, 0, sizeof(struct __pyx_obj_5pysam_7libcbcf___pyx_scope_struct_6_genexpr));
    (void) PyObject_INIT(o, t);
    PyObject_GC_Track(o);
  } else
  #endif
  {
    o = (*t->tp_alloc)(t, 0);
    if (unlikely(!o)) return 0;
  }
  #endif
  return o;
}

static void __pyx_tp_dealloc_5pysam_7libcbcf___pyx_scope_struct_6_genexpr(PyObject *o) {
  struct __pyx_obj_5pysam_7libcbcf___pyx_scope_struct_6_genexpr *p = (struct __pyx_obj_5pysam_7libcbcf___pyx_scope_struct_6_genexpr *)o;
  #if CYTHON_USE_TP_FINALIZE
  if (unlikely((PY_VERSION_HEX >= 0x03080000 || __Pyx_PyType_HasFeature(Py_TYPE(o), Py_TPFLAGS_HAVE_FINALIZE)) && __Pyx_PyObject_GetSlot(o, tp_finalize, destructor)) && !__Pyx_PyObject_GC_IsFinalized(o)) {
    if (__Pyx_PyObject_GetSlot(o, tp_dealloc, destructor) == __pyx_tp_dealloc_5pysam_7libcbcf___pyx_scope_struct_6_genexpr) {
      if (PyObject_CallFinalizerFromDealloc(o)) return;
    }
  }
  #endif
  PyObject_GC_UnTrack(o);
  Py_CLEAR(p->__pyx_outer_scope);
  #if CYTHON_USE_FREELISTS
  if (((int)(__pyx_mstate_global->__pyx_freecount_5pysam_7libcbcf___pyx_scope_struct_6_genexpr < 8) & (int)(Py_TYPE(o)->tp_basicsize == sizeof(struct __pyx_obj_5pysam_7libcbcf___pyx_scope_struct_6_genexpr)))) {
    __pyx_mstate_global->__pyx_freelist_5pysam_7libcbcf___pyx_scope_struct_6_genexpr[__pyx_mstate_global->__pyx_freecount_5pysam_7libcbcf___pyx_scope_struct_6_genexpr++] = ((struct __pyx_obj_5pysam_7libcbcf___pyx_scope_struct_6_genexpr *)o);
  } else
  #endif
  {
    #if CYTHON_USE_TYPE_SLOTS
    (*Py_TYPE(o)->tp_free)(o);
    #else
    {
      freefunc tp_free = (freefunc)PyType_GetSlot(Py_TYPE(o), Py_tp_free);
      if (tp_free) tp_free(o);
    }
    #endif
  }
}

static int __pyx_tp_traverse_5pysam_7libcbcf___pyx_scope_struct_6_genexpr(PyObject *o, visitproc v, void *a) {
  int e;
  struct __pyx_obj_5pysam_7libcbcf___pyx_scope_struct_6_genexpr *p = (struct __pyx_obj_5pysam_7libcbcf___pyx_scope_struct_6_genexpr *)o;
  {
    e = __Pyx_call_type_traverse(o, 1, v, a);
    if (e) return e;
  }
  if (p->__pyx_outer_scope) {
    e = (*v)(((PyObject *)p->__pyx_outer_scope), a); if (e) return e;
  }
  return 0;
}
#if CYTHON_USE_TYPE_SPECS
static PyType_Slot __pyx_type_5pysam_7libcbcf___pyx_scope_struct_6_genexpr_slots[] = {
  {Py_tp_dealloc, (void *)__pyx_tp_dealloc_5pysam_7libcbcf___pyx_scope_struct_6_genexpr},
  {Py_tp_traverse, (void *)__pyx_tp_traverse_5pysam_7libcbcf___pyx_scope_struct_6_genexpr},
  {Py_tp_new, (void *)__pyx_tp_new_5pysam_7libcbcf___pyx_scope_struct_6_genexpr},
  {0, 0},
};
static PyType_Spec __pyx_type_5pysam_7libcbcf___pyx_scope_struct_6_genexpr_spec = {
  "pysam.libcbcf.__pyx_scope_struct_6_genexpr",
  sizeof(struct __pyx_obj_5pysam_7libcbcf___pyx_scope_struct_6_genexpr),
  0,
  Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_VERSION_TAG|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_HAVE_GC|Py_TPFLAGS_HAVE_FINALIZE,
  __pyx_type_5pysam_7libcbcf___pyx_scope_struct_6_genexpr_slots,
};
#else

static PyTypeObject __pyx_type_5pysam_7libcbcf___pyx_scope_struct_6_genexpr = {
  PyVarObject_HEAD_INIT(0, 0)
  "pysam.libcbcf.""__pyx_scope_struct_6_genexpr", /*tp_name*/
  sizeof(struct __pyx_obj_5pysam_7libcbcf___pyx_scope_struct_6_genexpr), /*tp_basicsize*/
  0, /*tp_itemsize*/
  __pyx_tp_dealloc_5pysam_7libcbcf___pyx_scope_struct_6_genexpr, /*tp_dealloc*/
  #if PY_VERSION_HEX < 0x030800b4
  0, /*tp_print*/
  #endif
  #if PY_VERSION_HEX >= 0x030800b4
  0, /*tp_vectorcall_offset*/
  #endif
  0, /*tp_getattr*/
  0, /*tp_setattr*/
  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|Py_TPFLAGS_HAVE_FINALIZE, /*tp_flags*/
  0, /*tp_doc*/
  __pyx_tp_traverse_5pysam_7libcbcf___pyx_scope_struct_6_genexpr, /*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_5pysam_7libcbcf___pyx_scope_struct_6_genexpr, /*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 PY_VERSION_HEX >= 0x030800b1 && (!CYTHON_COMPILING_IN_PYPY || PYPY_VERSION_NUM >= 0x07030800)
  0, /*tp_vectorcall*/
  #endif
  #if __PYX_NEED_TP_PRINT_SLOT == 1
  0, /*tp_print*/
  #endif
  #if PY_VERSION_HEX >= 0x030C0000
  0, /*tp_watched*/
  #endif
  #if 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_5pysam_7libcbcf___pyx_scope_struct_7___iter__(PyTypeObject *t, CYTHON_UNUSED PyObject *a, CYTHON_UNUSED PyObject *k) {
  PyObject *o;
  #if CYTHON_COMPILING_IN_LIMITED_API
  allocfunc alloc_func = (allocfunc)PyType_GetSlot(t, Py_tp_alloc);
  o = alloc_func(t, 0);
  #else
  #if CYTHON_USE_FREELISTS
  if (likely((int)(__pyx_mstate_global->__pyx_freecount_5pysam_7libcbcf___pyx_scope_struct_7___iter__ > 0) & (int)(t->tp_basicsize == sizeof(struct __pyx_obj_5pysam_7libcbcf___pyx_scope_struct_7___iter__)))) {
    o = (PyObject*)__pyx_mstate_global->__pyx_freelist_5pysam_7libcbcf___pyx_scope_struct_7___iter__[--__pyx_mstate_global->__pyx_freecount_5pysam_7libcbcf___pyx_scope_struct_7___iter__];
    memset(o, 0, sizeof(struct __pyx_obj_5pysam_7libcbcf___pyx_scope_struct_7___iter__));
    (void) PyObject_INIT(o, t);
    PyObject_GC_Track(o);
  } else
  #endif
  {
    o = (*t->tp_alloc)(t, 0);
    if (unlikely(!o)) return 0;
  }
  #endif
  return o;
}

static void __pyx_tp_dealloc_5pysam_7libcbcf___pyx_scope_struct_7___iter__(PyObject *o) {
  struct __pyx_obj_5pysam_7libcbcf___pyx_scope_struct_7___iter__ *p = (struct __pyx_obj_5pysam_7libcbcf___pyx_scope_struct_7___iter__ *)o;
  #if CYTHON_USE_TP_FINALIZE
  if (unlikely((PY_VERSION_HEX >= 0x03080000 || __Pyx_PyType_HasFeature(Py_TYPE(o), Py_TPFLAGS_HAVE_FINALIZE)) && __Pyx_PyObject_GetSlot(o, tp_finalize, destructor)) && !__Pyx_PyObject_GC_IsFinalized(o)) {
    if (__Pyx_PyObject_GetSlot(o, tp_dealloc, destructor) == __pyx_tp_dealloc_5pysam_7libcbcf___pyx_scope_struct_7___iter__) {
      if (PyObject_CallFinalizerFromDealloc(o)) return;
    }
  }
  #endif
  PyObject_GC_UnTrack(o);
  Py_CLEAR(p->__pyx_v_self);
  #if CYTHON_USE_FREELISTS
  if (((int)(__pyx_mstate_global->__pyx_freecount_5pysam_7libcbcf___pyx_scope_struct_7___iter__ < 8) & (int)(Py_TYPE(o)->tp_basicsize == sizeof(struct __pyx_obj_5pysam_7libcbcf___pyx_scope_struct_7___iter__)))) {
    __pyx_mstate_global->__pyx_freelist_5pysam_7libcbcf___pyx_scope_struct_7___iter__[__pyx_mstate_global->__pyx_freecount_5pysam_7libcbcf___pyx_scope_struct_7___iter__++] = ((struct __pyx_obj_5pysam_7libcbcf___pyx_scope_struct_7___iter__ *)o);
  } else
  #endif
  {
    #if CYTHON_USE_TYPE_SLOTS
    (*Py_TYPE(o)->tp_free)(o);
    #else
    {
      freefunc tp_free = (freefunc)PyType_GetSlot(Py_TYPE(o), Py_tp_free);
      if (tp_free) tp_free(o);
    }
    #endif
  }
}

static int __pyx_tp_traverse_5pysam_7libcbcf___pyx_scope_struct_7___iter__(PyObject *o, visitproc v, void *a) {
  int e;
  struct __pyx_obj_5pysam_7libcbcf___pyx_scope_struct_7___iter__ *p = (struct __pyx_obj_5pysam_7libcbcf___pyx_scope_struct_7___iter__ *)o;
  {
    e = __Pyx_call_type_traverse(o, 1, v, a);
    if (e) return e;
  }
  if (p->__pyx_v_self) {
    e = (*v)(((PyObject *)p->__pyx_v_self), a); if (e) return e;
  }
  return 0;
}
#if CYTHON_USE_TYPE_SPECS
static PyType_Slot __pyx_type_5pysam_7libcbcf___pyx_scope_struct_7___iter___slots[] = {
  {Py_tp_dealloc, (void *)__pyx_tp_dealloc_5pysam_7libcbcf___pyx_scope_struct_7___iter__},
  {Py_tp_traverse, (void *)__pyx_tp_traverse_5pysam_7libcbcf___pyx_scope_struct_7___iter__},
  {Py_tp_new, (void *)__pyx_tp_new_5pysam_7libcbcf___pyx_scope_struct_7___iter__},
  {0, 0},
};
static PyType_Spec __pyx_type_5pysam_7libcbcf___pyx_scope_struct_7___iter___spec = {
  "pysam.libcbcf.__pyx_scope_struct_7___iter__",
  sizeof(struct __pyx_obj_5pysam_7libcbcf___pyx_scope_struct_7___iter__),
  0,
  Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_VERSION_TAG|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_HAVE_GC|Py_TPFLAGS_HAVE_FINALIZE,
  __pyx_type_5pysam_7libcbcf___pyx_scope_struct_7___iter___slots,
};
#else

static PyTypeObject __pyx_type_5pysam_7libcbcf___pyx_scope_struct_7___iter__ = {
  PyVarObject_HEAD_INIT(0, 0)
  "pysam.libcbcf.""__pyx_scope_struct_7___iter__", /*tp_name*/
  sizeof(struct __pyx_obj_5pysam_7libcbcf___pyx_scope_struct_7___iter__), /*tp_basicsize*/
  0, /*tp_itemsize*/
  __pyx_tp_dealloc_5pysam_7libcbcf___pyx_scope_struct_7___iter__, /*tp_dealloc*/
  #if PY_VERSION_HEX < 0x030800b4
  0, /*tp_print*/
  #endif
  #if PY_VERSION_HEX >= 0x030800b4
  0, /*tp_vectorcall_offset*/
  #endif
  0, /*tp_getattr*/
  0, /*tp_setattr*/
  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|Py_TPFLAGS_HAVE_FINALIZE, /*tp_flags*/
  0, /*tp_doc*/
  __pyx_tp_traverse_5pysam_7libcbcf___pyx_scope_struct_7___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_5pysam_7libcbcf___pyx_scope_struct_7___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 PY_VERSION_HEX >= 0x030800b1 && (!CYTHON_COMPILING_IN_PYPY || PYPY_VERSION_NUM >= 0x07030800)
  0, /*tp_vectorcall*/
  #endif
  #if __PYX_NEED_TP_PRINT_SLOT == 1
  0, /*tp_print*/
  #endif
  #if PY_VERSION_HEX >= 0x030C0000
  0, /*tp_watched*/
  #endif
  #if 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_5pysam_7libcbcf___pyx_scope_struct_8_itervalues(PyTypeObject *t, CYTHON_UNUSED PyObject *a, CYTHON_UNUSED PyObject *k) {
  PyObject *o;
  #if CYTHON_COMPILING_IN_LIMITED_API
  allocfunc alloc_func = (allocfunc)PyType_GetSlot(t, Py_tp_alloc);
  o = alloc_func(t, 0);
  #else
  #if CYTHON_USE_FREELISTS
  if (likely((int)(__pyx_mstate_global->__pyx_freecount_5pysam_7libcbcf___pyx_scope_struct_8_itervalues > 0) & (int)(t->tp_basicsize == sizeof(struct __pyx_obj_5pysam_7libcbcf___pyx_scope_struct_8_itervalues)))) {
    o = (PyObject*)__pyx_mstate_global->__pyx_freelist_5pysam_7libcbcf___pyx_scope_struct_8_itervalues[--__pyx_mstate_global->__pyx_freecount_5pysam_7libcbcf___pyx_scope_struct_8_itervalues];
    memset(o, 0, sizeof(struct __pyx_obj_5pysam_7libcbcf___pyx_scope_struct_8_itervalues));
    (void) PyObject_INIT(o, t);
    PyObject_GC_Track(o);
  } else
  #endif
  {
    o = (*t->tp_alloc)(t, 0);
    if (unlikely(!o)) return 0;
  }
  #endif
  return o;
}

static void __pyx_tp_dealloc_5pysam_7libcbcf___pyx_scope_struct_8_itervalues(PyObject *o) {
  struct __pyx_obj_5pysam_7libcbcf___pyx_scope_struct_8_itervalues *p = (struct __pyx_obj_5pysam_7libcbcf___pyx_scope_struct_8_itervalues *)o;
  #if CYTHON_USE_TP_FINALIZE
  if (unlikely((PY_VERSION_HEX >= 0x03080000 || __Pyx_PyType_HasFeature(Py_TYPE(o), Py_TPFLAGS_HAVE_FINALIZE)) && __Pyx_PyObject_GetSlot(o, tp_finalize, destructor)) && !__Pyx_PyObject_GC_IsFinalized(o)) {
    if (__Pyx_PyObject_GetSlot(o, tp_dealloc, destructor) == __pyx_tp_dealloc_5pysam_7libcbcf___pyx_scope_struct_8_itervalues) {
      if (PyObject_CallFinalizerFromDealloc(o)) return;
    }
  }
  #endif
  PyObject_GC_UnTrack(o);
  Py_CLEAR(p->__pyx_v_self);
  #if CYTHON_USE_FREELISTS
  if (((int)(__pyx_mstate_global->__pyx_freecount_5pysam_7libcbcf___pyx_scope_struct_8_itervalues < 8) & (int)(Py_TYPE(o)->tp_basicsize == sizeof(struct __pyx_obj_5pysam_7libcbcf___pyx_scope_struct_8_itervalues)))) {
    __pyx_mstate_global->__pyx_freelist_5pysam_7libcbcf___pyx_scope_struct_8_itervalues[__pyx_mstate_global->__pyx_freecount_5pysam_7libcbcf___pyx_scope_struct_8_itervalues++] = ((struct __pyx_obj_5pysam_7libcbcf___pyx_scope_struct_8_itervalues *)o);
  } else
  #endif
  {
    #if CYTHON_USE_TYPE_SLOTS
    (*Py_TYPE(o)->tp_free)(o);
    #else
    {
      freefunc tp_free = (freefunc)PyType_GetSlot(Py_TYPE(o), Py_tp_free);
      if (tp_free) tp_free(o);
    }
    #endif
  }
}

static int __pyx_tp_traverse_5pysam_7libcbcf___pyx_scope_struct_8_itervalues(PyObject *o, visitproc v, void *a) {
  int e;
  struct __pyx_obj_5pysam_7libcbcf___pyx_scope_struct_8_itervalues *p = (struct __pyx_obj_5pysam_7libcbcf___pyx_scope_struct_8_itervalues *)o;
  {
    e = __Pyx_call_type_traverse(o, 1, v, a);
    if (e) return e;
  }
  if (p->__pyx_v_self) {
    e = (*v)(((PyObject *)p->__pyx_v_self), a); if (e) return e;
  }
  return 0;
}
#if CYTHON_USE_TYPE_SPECS
static PyType_Slot __pyx_type_5pysam_7libcbcf___pyx_scope_struct_8_itervalues_slots[] = {
  {Py_tp_dealloc, (void *)__pyx_tp_dealloc_5pysam_7libcbcf___pyx_scope_struct_8_itervalues},
  {Py_tp_traverse, (void *)__pyx_tp_traverse_5pysam_7libcbcf___pyx_scope_struct_8_itervalues},
  {Py_tp_new, (void *)__pyx_tp_new_5pysam_7libcbcf___pyx_scope_struct_8_itervalues},
  {0, 0},
};
static PyType_Spec __pyx_type_5pysam_7libcbcf___pyx_scope_struct_8_itervalues_spec = {
  "pysam.libcbcf.__pyx_scope_struct_8_itervalues",
  sizeof(struct __pyx_obj_5pysam_7libcbcf___pyx_scope_struct_8_itervalues),
  0,
  Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_VERSION_TAG|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_HAVE_GC|Py_TPFLAGS_HAVE_FINALIZE,
  __pyx_type_5pysam_7libcbcf___pyx_scope_struct_8_itervalues_slots,
};
#else

static PyTypeObject __pyx_type_5pysam_7libcbcf___pyx_scope_struct_8_itervalues = {
  PyVarObject_HEAD_INIT(0, 0)
  "pysam.libcbcf.""__pyx_scope_struct_8_itervalues", /*tp_name*/
  sizeof(struct __pyx_obj_5pysam_7libcbcf___pyx_scope_struct_8_itervalues), /*tp_basicsize*/
  0, /*tp_itemsize*/
  __pyx_tp_dealloc_5pysam_7libcbcf___pyx_scope_struct_8_itervalues, /*tp_dealloc*/
  #if PY_VERSION_HEX < 0x030800b4
  0, /*tp_print*/
  #endif
  #if PY_VERSION_HEX >= 0x030800b4
  0, /*tp_vectorcall_offset*/
  #endif
  0, /*tp_getattr*/
  0, /*tp_setattr*/
  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|Py_TPFLAGS_HAVE_FINALIZE, /*tp_flags*/
  0, /*tp_doc*/
  __pyx_tp_traverse_5pysam_7libcbcf___pyx_scope_struct_8_itervalues, /*tp_traverse*/
  0, /*tp_clear*/
  0, /*tp_richcompare*/
  0, /*tp_weaklistoffset*/
  0, /*tp_iter*/
  0, /*tp_iternext*/
  0, /*tp_methods*/
  0, /*tp_members*/
  0, /*tp_getset*/
  0, /*tp_base*/
  0, /*tp_dict*/
  0, /*tp_descr_get*/
  0, /*tp_descr_set*/
  #if !CYTHON_USE_TYPE_SPECS
  0, /*tp_dictoffset*/
  #endif
  0, /*tp_init*/
  0, /*tp_alloc*/
  __pyx_tp_new_5pysam_7libcbcf___pyx_scope_struct_8_itervalues, /*tp_new*/
  0, /*tp_free*/
  0, /*tp_is_gc*/
  0, /*tp_bases*/
  0, /*tp_mro*/
  0, /*tp_cache*/
  0, /*tp_subclasses*/
  0, /*tp_weaklist*/
  0, /*tp_del*/
  0, /*tp_version_tag*/
  #if CYTHON_USE_TP_FINALIZE
  0, /*tp_finalize*/
  #else
  NULL, /*tp_finalize*/
  #endif
  #if PY_VERSION_HEX >= 0x030800b1 && (!CYTHON_COMPILING_IN_PYPY || PYPY_VERSION_NUM >= 0x07030800)
  0, /*tp_vectorcall*/
  #endif
  #if __PYX_NEED_TP_PRINT_SLOT == 1
  0, /*tp_print*/
  #endif
  #if PY_VERSION_HEX >= 0x030C0000
  0, /*tp_watched*/
  #endif
  #if 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_5pysam_7libcbcf___pyx_scope_struct_9_iteritems(PyTypeObject *t, CYTHON_UNUSED PyObject *a, CYTHON_UNUSED PyObject *k) {
  PyObject *o;
  #if CYTHON_COMPILING_IN_LIMITED_API
  allocfunc alloc_func = (allocfunc)PyType_GetSlot(t, Py_tp_alloc);
  o = alloc_func(t, 0);
  #else
  #if CYTHON_USE_FREELISTS
  if (likely((int)(__pyx_mstate_global->__pyx_freecount_5pysam_7libcbcf___pyx_scope_struct_9_iteritems > 0) & (int)(t->tp_basicsize == sizeof(struct __pyx_obj_5pysam_7libcbcf___pyx_scope_struct_9_iteritems)))) {
    o = (PyObject*)__pyx_mstate_global->__pyx_freelist_5pysam_7libcbcf___pyx_scope_struct_9_iteritems[--__pyx_mstate_global->__pyx_freecount_5pysam_7libcbcf___pyx_scope_struct_9_iteritems];
    memset(o, 0, sizeof(struct __pyx_obj_5pysam_7libcbcf___pyx_scope_struct_9_iteritems));
    (void) PyObject_INIT(o, t);
    PyObject_GC_Track(o);
  } else
  #endif
  {
    o = (*t->tp_alloc)(t, 0);
    if (unlikely(!o)) return 0;
  }
  #endif
  return o;
}

static void __pyx_tp_dealloc_5pysam_7libcbcf___pyx_scope_struct_9_iteritems(PyObject *o) {
  struct __pyx_obj_5pysam_7libcbcf___pyx_scope_struct_9_iteritems *p = (struct __pyx_obj_5pysam_7libcbcf___pyx_scope_struct_9_iteritems *)o;
  #if CYTHON_USE_TP_FINALIZE
  if (unlikely((PY_VERSION_HEX >= 0x03080000 || __Pyx_PyType_HasFeature(Py_TYPE(o), Py_TPFLAGS_HAVE_FINALIZE)) && __Pyx_PyObject_GetSlot(o, tp_finalize, destructor)) && !__Pyx_PyObject_GC_IsFinalized(o)) {
    if (__Pyx_PyObject_GetSlot(o, tp_dealloc, destructor) == __pyx_tp_dealloc_5pysam_7libcbcf___pyx_scope_struct_9_iteritems) {
      if (PyObject_CallFinalizerFromDealloc(o)) return;
    }
  }
  #endif
  PyObject_GC_UnTrack(o);
  Py_CLEAR(p->__pyx_v_self);
  #if CYTHON_USE_FREELISTS
  if (((int)(__pyx_mstate_global->__pyx_freecount_5pysam_7libcbcf___pyx_scope_struct_9_iteritems < 8) & (int)(Py_TYPE(o)->tp_basicsize == sizeof(struct __pyx_obj_5pysam_7libcbcf___pyx_scope_struct_9_iteritems)))) {
    __pyx_mstate_global->__pyx_freelist_5pysam_7libcbcf___pyx_scope_struct_9_iteritems[__pyx_mstate_global->__pyx_freecount_5pysam_7libcbcf___pyx_scope_struct_9_iteritems++] = ((struct __pyx_obj_5pysam_7libcbcf___pyx_scope_struct_9_iteritems *)o);
  } else
  #endif
  {
    #if CYTHON_USE_TYPE_SLOTS
    (*Py_TYPE(o)->tp_free)(o);
    #else
    {
      freefunc tp_free = (freefunc)PyType_GetSlot(Py_TYPE(o), Py_tp_free);
      if (tp_free) tp_free(o);
    }
    #endif
  }
}

static int __pyx_tp_traverse_5pysam_7libcbcf___pyx_scope_struct_9_iteritems(PyObject *o, visitproc v, void *a) {
  int e;
  struct __pyx_obj_5pysam_7libcbcf___pyx_scope_struct_9_iteritems *p = (struct __pyx_obj_5pysam_7libcbcf___pyx_scope_struct_9_iteritems *)o;
  {
    e = __Pyx_call_type_traverse(o, 1, v, a);
    if (e) return e;
  }
  if (p->__pyx_v_self) {
    e = (*v)(((PyObject *)p->__pyx_v_self), a); if (e) return e;
  }
  return 0;
}
#if CYTHON_USE_TYPE_SPECS
static PyType_Slot __pyx_type_5pysam_7libcbcf___pyx_scope_struct_9_iteritems_slots[] = {
  {Py_tp_dealloc, (void *)__pyx_tp_dealloc_5pysam_7libcbcf___pyx_scope_struct_9_iteritems},
  {Py_tp_traverse, (void *)__pyx_tp_traverse_5pysam_7libcbcf___pyx_scope_struct_9_iteritems},
  {Py_tp_new, (void *)__pyx_tp_new_5pysam_7libcbcf___pyx_scope_struct_9_iteritems},
  {0, 0},
};
static PyType_Spec __pyx_type_5pysam_7libcbcf___pyx_scope_struct_9_iteritems_spec = {
  "pysam.libcbcf.__pyx_scope_struct_9_iteritems",
  sizeof(struct __pyx_obj_5pysam_7libcbcf___pyx_scope_struct_9_iteritems),
  0,
  Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_VERSION_TAG|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_HAVE_GC|Py_TPFLAGS_HAVE_FINALIZE,
  __pyx_type_5pysam_7libcbcf___pyx_scope_struct_9_iteritems_slots,
};
#else

static PyTypeObject __pyx_type_5pysam_7libcbcf___pyx_scope_struct_9_iteritems = {
  PyVarObject_HEAD_INIT(0, 0)
  "pysam.libcbcf.""__pyx_scope_struct_9_iteritems", /*tp_name*/
  sizeof(struct __pyx_obj_5pysam_7libcbcf___pyx_scope_struct_9_iteritems), /*tp_basicsize*/
  0, /*tp_itemsize*/
  __pyx_tp_dealloc_5pysam_7libcbcf___pyx_scope_struct_9_iteritems, /*tp_dealloc*/
  #if PY_VERSION_HEX < 0x030800b4
  0, /*tp_print*/
  #endif
  #if PY_VERSION_HEX >= 0x030800b4
  0, /*tp_vectorcall_offset*/
  #endif
  0, /*tp_getattr*/
  0, /*tp_setattr*/
  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|Py_TPFLAGS_HAVE_FINALIZE, /*tp_flags*/
  0, /*tp_doc*/
  __pyx_tp_traverse_5pysam_7libcbcf___pyx_scope_struct_9_iteritems, /*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_5pysam_7libcbcf___pyx_scope_struct_9_iteritems, /*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 PY_VERSION_HEX >= 0x030800b1 && (!CYTHON_COMPILING_IN_PYPY || PYPY_VERSION_NUM >= 0x07030800)
  0, /*tp_vectorcall*/
  #endif
  #if __PYX_NEED_TP_PRINT_SLOT == 1
  0, /*tp_print*/
  #endif
  #if PY_VERSION_HEX >= 0x030C0000
  0, /*tp_watched*/
  #endif
  #if 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_5pysam_7libcbcf___pyx_scope_struct_10___iter__(PyTypeObject *t, CYTHON_UNUSED PyObject *a, CYTHON_UNUSED PyObject *k) {
  PyObject *o;
  #if CYTHON_COMPILING_IN_LIMITED_API
  allocfunc alloc_func = (allocfunc)PyType_GetSlot(t, Py_tp_alloc);
  o = alloc_func(t, 0);
  #else
  #if CYTHON_USE_FREELISTS
  if (likely((int)(__pyx_mstate_global->__pyx_freecount_5pysam_7libcbcf___pyx_scope_struct_10___iter__ > 0) & (int)(t->tp_basicsize == sizeof(struct __pyx_obj_5pysam_7libcbcf___pyx_scope_struct_10___iter__)))) {
    o = (PyObject*)__pyx_mstate_global->__pyx_freelist_5pysam_7libcbcf___pyx_scope_struct_10___iter__[--__pyx_mstate_global->__pyx_freecount_5pysam_7libcbcf___pyx_scope_struct_10___iter__];
    memset(o, 0, sizeof(struct __pyx_obj_5pysam_7libcbcf___pyx_scope_struct_10___iter__));
    (void) PyObject_INIT(o, t);
    PyObject_GC_Track(o);
  } else
  #endif
  {
    o = (*t->tp_alloc)(t, 0);
    if (unlikely(!o)) return 0;
  }
  #endif
  return o;
}

static void __pyx_tp_dealloc_5pysam_7libcbcf___pyx_scope_struct_10___iter__(PyObject *o) {
  struct __pyx_obj_5pysam_7libcbcf___pyx_scope_struct_10___iter__ *p = (struct __pyx_obj_5pysam_7libcbcf___pyx_scope_struct_10___iter__ *)o;
  #if CYTHON_USE_TP_FINALIZE
  if (unlikely((PY_VERSION_HEX >= 0x03080000 || __Pyx_PyType_HasFeature(Py_TYPE(o), Py_TPFLAGS_HAVE_FINALIZE)) && __Pyx_PyObject_GetSlot(o, tp_finalize, destructor)) && !__Pyx_PyObject_GC_IsFinalized(o)) {
    if (__Pyx_PyObject_GetSlot(o, tp_dealloc, destructor) == __pyx_tp_dealloc_5pysam_7libcbcf___pyx_scope_struct_10___iter__) {
      if (PyObject_CallFinalizerFromDealloc(o)) return;
    }
  }
  #endif
  PyObject_GC_UnTrack(o);
  Py_CLEAR(p->__pyx_v_self);
  #if CYTHON_USE_FREELISTS
  if (((int)(__pyx_mstate_global->__pyx_freecount_5pysam_7libcbcf___pyx_scope_struct_10___iter__ < 8) & (int)(Py_TYPE(o)->tp_basicsize == sizeof(struct __pyx_obj_5pysam_7libcbcf___pyx_scope_struct_10___iter__)))) {
    __pyx_mstate_global->__pyx_freelist_5pysam_7libcbcf___pyx_scope_struct_10___iter__[__pyx_mstate_global->__pyx_freecount_5pysam_7libcbcf___pyx_scope_struct_10___iter__++] = ((struct __pyx_obj_5pysam_7libcbcf___pyx_scope_struct_10___iter__ *)o);
  } else
  #endif
  {
    #if CYTHON_USE_TYPE_SLOTS
    (*Py_TYPE(o)->tp_free)(o);
    #else
    {
      freefunc tp_free = (freefunc)PyType_GetSlot(Py_TYPE(o), Py_tp_free);
      if (tp_free) tp_free(o);
    }
    #endif
  }
}

static int __pyx_tp_traverse_5pysam_7libcbcf___pyx_scope_struct_10___iter__(PyObject *o, visitproc v, void *a) {
  int e;
  struct __pyx_obj_5pysam_7libcbcf___pyx_scope_struct_10___iter__ *p = (struct __pyx_obj_5pysam_7libcbcf___pyx_scope_struct_10___iter__ *)o;
  {
    e = __Pyx_call_type_traverse(o, 1, v, a);
    if (e) return e;
  }
  if (p->__pyx_v_self) {
    e = (*v)(((PyObject *)p->__pyx_v_self), a); if (e) return e;
  }
  return 0;
}
#if CYTHON_USE_TYPE_SPECS
static PyType_Slot __pyx_type_5pysam_7libcbcf___pyx_scope_struct_10___iter___slots[] = {
  {Py_tp_dealloc, (void *)__pyx_tp_dealloc_5pysam_7libcbcf___pyx_scope_struct_10___iter__},
  {Py_tp_traverse, (void *)__pyx_tp_traverse_5pysam_7libcbcf___pyx_scope_struct_10___iter__},
  {Py_tp_new, (void *)__pyx_tp_new_5pysam_7libcbcf___pyx_scope_struct_10___iter__},
  {0, 0},
};
static PyType_Spec __pyx_type_5pysam_7libcbcf___pyx_scope_struct_10___iter___spec = {
  "pysam.libcbcf.__pyx_scope_struct_10___iter__",
  sizeof(struct __pyx_obj_5pysam_7libcbcf___pyx_scope_struct_10___iter__),
  0,
  Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_VERSION_TAG|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_HAVE_GC|Py_TPFLAGS_HAVE_FINALIZE,
  __pyx_type_5pysam_7libcbcf___pyx_scope_struct_10___iter___slots,
};
#else

static PyTypeObject __pyx_type_5pysam_7libcbcf___pyx_scope_struct_10___iter__ = {
  PyVarObject_HEAD_INIT(0, 0)
  "pysam.libcbcf.""__pyx_scope_struct_10___iter__", /*tp_name*/
  sizeof(struct __pyx_obj_5pysam_7libcbcf___pyx_scope_struct_10___iter__), /*tp_basicsize*/
  0, /*tp_itemsize*/
  __pyx_tp_dealloc_5pysam_7libcbcf___pyx_scope_struct_10___iter__, /*tp_dealloc*/
  #if PY_VERSION_HEX < 0x030800b4
  0, /*tp_print*/
  #endif
  #if PY_VERSION_HEX >= 0x030800b4
  0, /*tp_vectorcall_offset*/
  #endif
  0, /*tp_getattr*/
  0, /*tp_setattr*/
  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|Py_TPFLAGS_HAVE_FINALIZE, /*tp_flags*/
  0, /*tp_doc*/
  __pyx_tp_traverse_5pysam_7libcbcf___pyx_scope_struct_10___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_5pysam_7libcbcf___pyx_scope_struct_10___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 PY_VERSION_HEX >= 0x030800b1 && (!CYTHON_COMPILING_IN_PYPY || PYPY_VERSION_NUM >= 0x07030800)
  0, /*tp_vectorcall*/
  #endif
  #if __PYX_NEED_TP_PRINT_SLOT == 1
  0, /*tp_print*/
  #endif
  #if PY_VERSION_HEX >= 0x030C0000
  0, /*tp_watched*/
  #endif
  #if 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_5pysam_7libcbcf___pyx_scope_struct_11___iter__(PyTypeObject *t, CYTHON_UNUSED PyObject *a, CYTHON_UNUSED PyObject *k) {
  PyObject *o;
  #if CYTHON_COMPILING_IN_LIMITED_API
  allocfunc alloc_func = (allocfunc)PyType_GetSlot(t, Py_tp_alloc);
  o = alloc_func(t, 0);
  #else
  #if CYTHON_USE_FREELISTS
  if (likely((int)(__pyx_mstate_global->__pyx_freecount_5pysam_7libcbcf___pyx_scope_struct_11___iter__ > 0) & (int)(t->tp_basicsize == sizeof(struct __pyx_obj_5pysam_7libcbcf___pyx_scope_struct_11___iter__)))) {
    o = (PyObject*)__pyx_mstate_global->__pyx_freelist_5pysam_7libcbcf___pyx_scope_struct_11___iter__[--__pyx_mstate_global->__pyx_freecount_5pysam_7libcbcf___pyx_scope_struct_11___iter__];
    memset(o, 0, sizeof(struct __pyx_obj_5pysam_7libcbcf___pyx_scope_struct_11___iter__));
    (void) PyObject_INIT(o, t);
    PyObject_GC_Track(o);
  } else
  #endif
  {
    o = (*t->tp_alloc)(t, 0);
    if (unlikely(!o)) return 0;
  }
  #endif
  return o;
}

static void __pyx_tp_dealloc_5pysam_7libcbcf___pyx_scope_struct_11___iter__(PyObject *o) {
  struct __pyx_obj_5pysam_7libcbcf___pyx_scope_struct_11___iter__ *p = (struct __pyx_obj_5pysam_7libcbcf___pyx_scope_struct_11___iter__ *)o;
  #if CYTHON_USE_TP_FINALIZE
  if (unlikely((PY_VERSION_HEX >= 0x03080000 || __Pyx_PyType_HasFeature(Py_TYPE(o), Py_TPFLAGS_HAVE_FINALIZE)) && __Pyx_PyObject_GetSlot(o, tp_finalize, destructor)) && !__Pyx_PyObject_GC_IsFinalized(o)) {
    if (__Pyx_PyObject_GetSlot(o, tp_dealloc, destructor) == __pyx_tp_dealloc_5pysam_7libcbcf___pyx_scope_struct_11___iter__) {
      if (PyObject_CallFinalizerFromDealloc(o)) return;
    }
  }
  #endif
  PyObject_GC_UnTrack(o);
  Py_CLEAR(p->__pyx_v_self);
  #if CYTHON_USE_FREELISTS
  if (((int)(__pyx_mstate_global->__pyx_freecount_5pysam_7libcbcf___pyx_scope_struct_11___iter__ < 8) & (int)(Py_TYPE(o)->tp_basicsize == sizeof(struct __pyx_obj_5pysam_7libcbcf___pyx_scope_struct_11___iter__)))) {
    __pyx_mstate_global->__pyx_freelist_5pysam_7libcbcf___pyx_scope_struct_11___iter__[__pyx_mstate_global->__pyx_freecount_5pysam_7libcbcf___pyx_scope_struct_11___iter__++] = ((struct __pyx_obj_5pysam_7libcbcf___pyx_scope_struct_11___iter__ *)o);
  } else
  #endif
  {
    #if CYTHON_USE_TYPE_SLOTS
    (*Py_TYPE(o)->tp_free)(o);
    #else
    {
      freefunc tp_free = (freefunc)PyType_GetSlot(Py_TYPE(o), Py_tp_free);
      if (tp_free) tp_free(o);
    }
    #endif
  }
}

static int __pyx_tp_traverse_5pysam_7libcbcf___pyx_scope_struct_11___iter__(PyObject *o, visitproc v, void *a) {
  int e;
  struct __pyx_obj_5pysam_7libcbcf___pyx_scope_struct_11___iter__ *p = (struct __pyx_obj_5pysam_7libcbcf___pyx_scope_struct_11___iter__ *)o;
  {
    e = __Pyx_call_type_traverse(o, 1, v, a);
    if (e) return e;
  }
  if (p->__pyx_v_self) {
    e = (*v)(((PyObject *)p->__pyx_v_self), a); if (e) return e;
  }
  return 0;
}
#if CYTHON_USE_TYPE_SPECS
static PyType_Slot __pyx_type_5pysam_7libcbcf___pyx_scope_struct_11___iter___slots[] = {
  {Py_tp_dealloc, (void *)__pyx_tp_dealloc_5pysam_7libcbcf___pyx_scope_struct_11___iter__},
  {Py_tp_traverse, (void *)__pyx_tp_traverse_5pysam_7libcbcf___pyx_scope_struct_11___iter__},
  {Py_tp_new, (void *)__pyx_tp_new_5pysam_7libcbcf___pyx_scope_struct_11___iter__},
  {0, 0},
};
static PyType_Spec __pyx_type_5pysam_7libcbcf___pyx_scope_struct_11___iter___spec = {
  "pysam.libcbcf.__pyx_scope_struct_11___iter__",
  sizeof(struct __pyx_obj_5pysam_7libcbcf___pyx_scope_struct_11___iter__),
  0,
  Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_VERSION_TAG|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_HAVE_GC|Py_TPFLAGS_HAVE_FINALIZE,
  __pyx_type_5pysam_7libcbcf___pyx_scope_struct_11___iter___slots,
};
#else

static PyTypeObject __pyx_type_5pysam_7libcbcf___pyx_scope_struct_11___iter__ = {
  PyVarObject_HEAD_INIT(0, 0)
  "pysam.libcbcf.""__pyx_scope_struct_11___iter__", /*tp_name*/
  sizeof(struct __pyx_obj_5pysam_7libcbcf___pyx_scope_struct_11___iter__), /*tp_basicsize*/
  0, /*tp_itemsize*/
  __pyx_tp_dealloc_5pysam_7libcbcf___pyx_scope_struct_11___iter__, /*tp_dealloc*/
  #if PY_VERSION_HEX < 0x030800b4
  0, /*tp_print*/
  #endif
  #if PY_VERSION_HEX >= 0x030800b4
  0, /*tp_vectorcall_offset*/
  #endif
  0, /*tp_getattr*/
  0, /*tp_setattr*/
  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|Py_TPFLAGS_HAVE_FINALIZE, /*tp_flags*/
  0, /*tp_doc*/
  __pyx_tp_traverse_5pysam_7libcbcf___pyx_scope_struct_11___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_5pysam_7libcbcf___pyx_scope_struct_11___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 PY_VERSION_HEX >= 0x030800b1 && (!CYTHON_COMPILING_IN_PYPY || PYPY_VERSION_NUM >= 0x07030800)
  0, /*tp_vectorcall*/
  #endif
  #if __PYX_NEED_TP_PRINT_SLOT == 1
  0, /*tp_print*/
  #endif
  #if PY_VERSION_HEX >= 0x030C0000
  0, /*tp_watched*/
  #endif
  #if 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_5pysam_7libcbcf___pyx_scope_struct_12_itervalues(PyTypeObject *t, CYTHON_UNUSED PyObject *a, CYTHON_UNUSED PyObject *k) {
  PyObject *o;
  #if CYTHON_COMPILING_IN_LIMITED_API
  allocfunc alloc_func = (allocfunc)PyType_GetSlot(t, Py_tp_alloc);
  o = alloc_func(t, 0);
  #else
  #if CYTHON_USE_FREELISTS
  if (likely((int)(__pyx_mstate_global->__pyx_freecount_5pysam_7libcbcf___pyx_scope_struct_12_itervalues > 0) & (int)(t->tp_basicsize == sizeof(struct __pyx_obj_5pysam_7libcbcf___pyx_scope_struct_12_itervalues)))) {
    o = (PyObject*)__pyx_mstate_global->__pyx_freelist_5pysam_7libcbcf___pyx_scope_struct_12_itervalues[--__pyx_mstate_global->__pyx_freecount_5pysam_7libcbcf___pyx_scope_struct_12_itervalues];
    memset(o, 0, sizeof(struct __pyx_obj_5pysam_7libcbcf___pyx_scope_struct_12_itervalues));
    (void) PyObject_INIT(o, t);
    PyObject_GC_Track(o);
  } else
  #endif
  {
    o = (*t->tp_alloc)(t, 0);
    if (unlikely(!o)) return 0;
  }
  #endif
  return o;
}

static void __pyx_tp_dealloc_5pysam_7libcbcf___pyx_scope_struct_12_itervalues(PyObject *o) {
  struct __pyx_obj_5pysam_7libcbcf___pyx_scope_struct_12_itervalues *p = (struct __pyx_obj_5pysam_7libcbcf___pyx_scope_struct_12_itervalues *)o;
  #if CYTHON_USE_TP_FINALIZE
  if (unlikely((PY_VERSION_HEX >= 0x03080000 || __Pyx_PyType_HasFeature(Py_TYPE(o), Py_TPFLAGS_HAVE_FINALIZE)) && __Pyx_PyObject_GetSlot(o, tp_finalize, destructor)) && !__Pyx_PyObject_GC_IsFinalized(o)) {
    if (__Pyx_PyObject_GetSlot(o, tp_dealloc, destructor) == __pyx_tp_dealloc_5pysam_7libcbcf___pyx_scope_struct_12_itervalues) {
      if (PyObject_CallFinalizerFromDealloc(o)) return;
    }
  }
  #endif
  PyObject_GC_UnTrack(o);
  Py_CLEAR(p->__pyx_v_key);
  Py_CLEAR(p->__pyx_v_self);
  Py_CLEAR(p->__pyx_t_0);
  #if CYTHON_USE_FREELISTS
  if (((int)(__pyx_mstate_global->__pyx_freecount_5pysam_7libcbcf___pyx_scope_struct_12_itervalues < 8) & (int)(Py_TYPE(o)->tp_basicsize == sizeof(struct __pyx_obj_5pysam_7libcbcf___pyx_scope_struct_12_itervalues)))) {
    __pyx_mstate_global->__pyx_freelist_5pysam_7libcbcf___pyx_scope_struct_12_itervalues[__pyx_mstate_global->__pyx_freecount_5pysam_7libcbcf___pyx_scope_struct_12_itervalues++] = ((struct __pyx_obj_5pysam_7libcbcf___pyx_scope_struct_12_itervalues *)o);
  } else
  #endif
  {
    #if CYTHON_USE_TYPE_SLOTS
    (*Py_TYPE(o)->tp_free)(o);
    #else
    {
      freefunc tp_free = (freefunc)PyType_GetSlot(Py_TYPE(o), Py_tp_free);
      if (tp_free) tp_free(o);
    }
    #endif
  }
}

static int __pyx_tp_traverse_5pysam_7libcbcf___pyx_scope_struct_12_itervalues(PyObject *o, visitproc v, void *a) {
  int e;
  struct __pyx_obj_5pysam_7libcbcf___pyx_scope_struct_12_itervalues *p = (struct __pyx_obj_5pysam_7libcbcf___pyx_scope_struct_12_itervalues *)o;
  {
    e = __Pyx_call_type_traverse(o, 1, v, a);
    if (e) return e;
  }
  if (p->__pyx_v_key) {
    e = (*v)(p->__pyx_v_key, 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_5pysam_7libcbcf___pyx_scope_struct_12_itervalues_slots[] = {
  {Py_tp_dealloc, (void *)__pyx_tp_dealloc_5pysam_7libcbcf___pyx_scope_struct_12_itervalues},
  {Py_tp_traverse, (void *)__pyx_tp_traverse_5pysam_7libcbcf___pyx_scope_struct_12_itervalues},
  {Py_tp_new, (void *)__pyx_tp_new_5pysam_7libcbcf___pyx_scope_struct_12_itervalues},
  {0, 0},
};
static PyType_Spec __pyx_type_5pysam_7libcbcf___pyx_scope_struct_12_itervalues_spec = {
  "pysam.libcbcf.__pyx_scope_struct_12_itervalues",
  sizeof(struct __pyx_obj_5pysam_7libcbcf___pyx_scope_struct_12_itervalues),
  0,
  Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_VERSION_TAG|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_HAVE_GC|Py_TPFLAGS_HAVE_FINALIZE,
  __pyx_type_5pysam_7libcbcf___pyx_scope_struct_12_itervalues_slots,
};
#else

static PyTypeObject __pyx_type_5pysam_7libcbcf___pyx_scope_struct_12_itervalues = {
  PyVarObject_HEAD_INIT(0, 0)
  "pysam.libcbcf.""__pyx_scope_struct_12_itervalues", /*tp_name*/
  sizeof(struct __pyx_obj_5pysam_7libcbcf___pyx_scope_struct_12_itervalues), /*tp_basicsize*/
  0, /*tp_itemsize*/
  __pyx_tp_dealloc_5pysam_7libcbcf___pyx_scope_struct_12_itervalues, /*tp_dealloc*/
  #if PY_VERSION_HEX < 0x030800b4
  0, /*tp_print*/
  #endif
  #if PY_VERSION_HEX >= 0x030800b4
  0, /*tp_vectorcall_offset*/
  #endif
  0, /*tp_getattr*/
  0, /*tp_setattr*/
  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|Py_TPFLAGS_HAVE_FINALIZE, /*tp_flags*/
  0, /*tp_doc*/
  __pyx_tp_traverse_5pysam_7libcbcf___pyx_scope_struct_12_itervalues, /*tp_traverse*/
  0, /*tp_clear*/
  0, /*tp_richcompare*/
  0, /*tp_weaklistoffset*/
  0, /*tp_iter*/
  0, /*tp_iternext*/
  0, /*tp_methods*/
  0, /*tp_members*/
  0, /*tp_getset*/
  0, /*tp_base*/
  0, /*tp_dict*/
  0, /*tp_descr_get*/
  0, /*tp_descr_set*/
  #if !CYTHON_USE_TYPE_SPECS
  0, /*tp_dictoffset*/
  #endif
  0, /*tp_init*/
  0, /*tp_alloc*/
  __pyx_tp_new_5pysam_7libcbcf___pyx_scope_struct_12_itervalues, /*tp_new*/
  0, /*tp_free*/
  0, /*tp_is_gc*/
  0, /*tp_bases*/
  0, /*tp_mro*/
  0, /*tp_cache*/
  0, /*tp_subclasses*/
  0, /*tp_weaklist*/
  0, /*tp_del*/
  0, /*tp_version_tag*/
  #if CYTHON_USE_TP_FINALIZE
  0, /*tp_finalize*/
  #else
  NULL, /*tp_finalize*/
  #endif
  #if PY_VERSION_HEX >= 0x030800b1 && (!CYTHON_COMPILING_IN_PYPY || PYPY_VERSION_NUM >= 0x07030800)
  0, /*tp_vectorcall*/
  #endif
  #if __PYX_NEED_TP_PRINT_SLOT == 1
  0, /*tp_print*/
  #endif
  #if PY_VERSION_HEX >= 0x030C0000
  0, /*tp_watched*/
  #endif
  #if 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_5pysam_7libcbcf___pyx_scope_struct_13_iteritems(PyTypeObject *t, CYTHON_UNUSED PyObject *a, CYTHON_UNUSED PyObject *k) {
  PyObject *o;
  #if CYTHON_COMPILING_IN_LIMITED_API
  allocfunc alloc_func = (allocfunc)PyType_GetSlot(t, Py_tp_alloc);
  o = alloc_func(t, 0);
  #else
  #if CYTHON_USE_FREELISTS
  if (likely((int)(__pyx_mstate_global->__pyx_freecount_5pysam_7libcbcf___pyx_scope_struct_13_iteritems > 0) & (int)(t->tp_basicsize == sizeof(struct __pyx_obj_5pysam_7libcbcf___pyx_scope_struct_13_iteritems)))) {
    o = (PyObject*)__pyx_mstate_global->__pyx_freelist_5pysam_7libcbcf___pyx_scope_struct_13_iteritems[--__pyx_mstate_global->__pyx_freecount_5pysam_7libcbcf___pyx_scope_struct_13_iteritems];
    memset(o, 0, sizeof(struct __pyx_obj_5pysam_7libcbcf___pyx_scope_struct_13_iteritems));
    (void) PyObject_INIT(o, t);
    PyObject_GC_Track(o);
  } else
  #endif
  {
    o = (*t->tp_alloc)(t, 0);
    if (unlikely(!o)) return 0;
  }
  #endif
  return o;
}

static void __pyx_tp_dealloc_5pysam_7libcbcf___pyx_scope_struct_13_iteritems(PyObject *o) {
  struct __pyx_obj_5pysam_7libcbcf___pyx_scope_struct_13_iteritems *p = (struct __pyx_obj_5pysam_7libcbcf___pyx_scope_struct_13_iteritems *)o;
  #if CYTHON_USE_TP_FINALIZE
  if (unlikely((PY_VERSION_HEX >= 0x03080000 || __Pyx_PyType_HasFeature(Py_TYPE(o), Py_TPFLAGS_HAVE_FINALIZE)) && __Pyx_PyObject_GetSlot(o, tp_finalize, destructor)) && !__Pyx_PyObject_GC_IsFinalized(o)) {
    if (__Pyx_PyObject_GetSlot(o, tp_dealloc, destructor) == __pyx_tp_dealloc_5pysam_7libcbcf___pyx_scope_struct_13_iteritems) {
      if (PyObject_CallFinalizerFromDealloc(o)) return;
    }
  }
  #endif
  PyObject_GC_UnTrack(o);
  Py_CLEAR(p->__pyx_v_key);
  Py_CLEAR(p->__pyx_v_self);
  Py_CLEAR(p->__pyx_t_0);
  #if CYTHON_USE_FREELISTS
  if (((int)(__pyx_mstate_global->__pyx_freecount_5pysam_7libcbcf___pyx_scope_struct_13_iteritems < 8) & (int)(Py_TYPE(o)->tp_basicsize == sizeof(struct __pyx_obj_5pysam_7libcbcf___pyx_scope_struct_13_iteritems)))) {
    __pyx_mstate_global->__pyx_freelist_5pysam_7libcbcf___pyx_scope_struct_13_iteritems[__pyx_mstate_global->__pyx_freecount_5pysam_7libcbcf___pyx_scope_struct_13_iteritems++] = ((struct __pyx_obj_5pysam_7libcbcf___pyx_scope_struct_13_iteritems *)o);
  } else
  #endif
  {
    #if CYTHON_USE_TYPE_SLOTS
    (*Py_TYPE(o)->tp_free)(o);
    #else
    {
      freefunc tp_free = (freefunc)PyType_GetSlot(Py_TYPE(o), Py_tp_free);
      if (tp_free) tp_free(o);
    }
    #endif
  }
}

static int __pyx_tp_traverse_5pysam_7libcbcf___pyx_scope_struct_13_iteritems(PyObject *o, visitproc v, void *a) {
  int e;
  struct __pyx_obj_5pysam_7libcbcf___pyx_scope_struct_13_iteritems *p = (struct __pyx_obj_5pysam_7libcbcf___pyx_scope_struct_13_iteritems *)o;
  {
    e = __Pyx_call_type_traverse(o, 1, v, a);
    if (e) return e;
  }
  if (p->__pyx_v_key) {
    e = (*v)(p->__pyx_v_key, 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_5pysam_7libcbcf___pyx_scope_struct_13_iteritems_slots[] = {
  {Py_tp_dealloc, (void *)__pyx_tp_dealloc_5pysam_7libcbcf___pyx_scope_struct_13_iteritems},
  {Py_tp_traverse, (void *)__pyx_tp_traverse_5pysam_7libcbcf___pyx_scope_struct_13_iteritems},
  {Py_tp_new, (void *)__pyx_tp_new_5pysam_7libcbcf___pyx_scope_struct_13_iteritems},
  {0, 0},
};
static PyType_Spec __pyx_type_5pysam_7libcbcf___pyx_scope_struct_13_iteritems_spec = {
  "pysam.libcbcf.__pyx_scope_struct_13_iteritems",
  sizeof(struct __pyx_obj_5pysam_7libcbcf___pyx_scope_struct_13_iteritems),
  0,
  Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_VERSION_TAG|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_HAVE_GC|Py_TPFLAGS_HAVE_FINALIZE,
  __pyx_type_5pysam_7libcbcf___pyx_scope_struct_13_iteritems_slots,
};
#else

static PyTypeObject __pyx_type_5pysam_7libcbcf___pyx_scope_struct_13_iteritems = {
  PyVarObject_HEAD_INIT(0, 0)
  "pysam.libcbcf.""__pyx_scope_struct_13_iteritems", /*tp_name*/
  sizeof(struct __pyx_obj_5pysam_7libcbcf___pyx_scope_struct_13_iteritems), /*tp_basicsize*/
  0, /*tp_itemsize*/
  __pyx_tp_dealloc_5pysam_7libcbcf___pyx_scope_struct_13_iteritems, /*tp_dealloc*/
  #if PY_VERSION_HEX < 0x030800b4
  0, /*tp_print*/
  #endif
  #if PY_VERSION_HEX >= 0x030800b4
  0, /*tp_vectorcall_offset*/
  #endif
  0, /*tp_getattr*/
  0, /*tp_setattr*/
  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|Py_TPFLAGS_HAVE_FINALIZE, /*tp_flags*/
  0, /*tp_doc*/
  __pyx_tp_traverse_5pysam_7libcbcf___pyx_scope_struct_13_iteritems, /*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_5pysam_7libcbcf___pyx_scope_struct_13_iteritems, /*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 PY_VERSION_HEX >= 0x030800b1 && (!CYTHON_COMPILING_IN_PYPY || PYPY_VERSION_NUM >= 0x07030800)
  0, /*tp_vectorcall*/
  #endif
  #if __PYX_NEED_TP_PRINT_SLOT == 1
  0, /*tp_print*/
  #endif
  #if PY_VERSION_HEX >= 0x030C0000
  0, /*tp_watched*/
  #endif
  #if 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_5pysam_7libcbcf___pyx_scope_struct_14___iter__(PyTypeObject *t, CYTHON_UNUSED PyObject *a, CYTHON_UNUSED PyObject *k) {
  PyObject *o;
  #if CYTHON_COMPILING_IN_LIMITED_API
  allocfunc alloc_func = (allocfunc)PyType_GetSlot(t, Py_tp_alloc);
  o = alloc_func(t, 0);
  #else
  #if CYTHON_USE_FREELISTS
  if (likely((int)(__pyx_mstate_global->__pyx_freecount_5pysam_7libcbcf___pyx_scope_struct_14___iter__ > 0) & (int)(t->tp_basicsize == sizeof(struct __pyx_obj_5pysam_7libcbcf___pyx_scope_struct_14___iter__)))) {
    o = (PyObject*)__pyx_mstate_global->__pyx_freelist_5pysam_7libcbcf___pyx_scope_struct_14___iter__[--__pyx_mstate_global->__pyx_freecount_5pysam_7libcbcf___pyx_scope_struct_14___iter__];
    memset(o, 0, sizeof(struct __pyx_obj_5pysam_7libcbcf___pyx_scope_struct_14___iter__));
    (void) PyObject_INIT(o, t);
    PyObject_GC_Track(o);
  } else
  #endif
  {
    o = (*t->tp_alloc)(t, 0);
    if (unlikely(!o)) return 0;
  }
  #endif
  return o;
}

static void __pyx_tp_dealloc_5pysam_7libcbcf___pyx_scope_struct_14___iter__(PyObject *o) {
  struct __pyx_obj_5pysam_7libcbcf___pyx_scope_struct_14___iter__ *p = (struct __pyx_obj_5pysam_7libcbcf___pyx_scope_struct_14___iter__ *)o;
  #if CYTHON_USE_TP_FINALIZE
  if (unlikely((PY_VERSION_HEX >= 0x03080000 || __Pyx_PyType_HasFeature(Py_TYPE(o), Py_TPFLAGS_HAVE_FINALIZE)) && __Pyx_PyObject_GetSlot(o, tp_finalize, destructor)) && !__Pyx_PyObject_GC_IsFinalized(o)) {
    if (__Pyx_PyObject_GetSlot(o, tp_dealloc, destructor) == __pyx_tp_dealloc_5pysam_7libcbcf___pyx_scope_struct_14___iter__) {
      if (PyObject_CallFinalizerFromDealloc(o)) return;
    }
  }
  #endif
  PyObject_GC_UnTrack(o);
  Py_CLEAR(p->__pyx_v_self);
  #if CYTHON_USE_FREELISTS
  if (((int)(__pyx_mstate_global->__pyx_freecount_5pysam_7libcbcf___pyx_scope_struct_14___iter__ < 8) & (int)(Py_TYPE(o)->tp_basicsize == sizeof(struct __pyx_obj_5pysam_7libcbcf___pyx_scope_struct_14___iter__)))) {
    __pyx_mstate_global->__pyx_freelist_5pysam_7libcbcf___pyx_scope_struct_14___iter__[__pyx_mstate_global->__pyx_freecount_5pysam_7libcbcf___pyx_scope_struct_14___iter__++] = ((struct __pyx_obj_5pysam_7libcbcf___pyx_scope_struct_14___iter__ *)o);
  } else
  #endif
  {
    #if CYTHON_USE_TYPE_SLOTS
    (*Py_TYPE(o)->tp_free)(o);
    #else
    {
      freefunc tp_free = (freefunc)PyType_GetSlot(Py_TYPE(o), Py_tp_free);
      if (tp_free) tp_free(o);
    }
    #endif
  }
}

static int __pyx_tp_traverse_5pysam_7libcbcf___pyx_scope_struct_14___iter__(PyObject *o, visitproc v, void *a) {
  int e;
  struct __pyx_obj_5pysam_7libcbcf___pyx_scope_struct_14___iter__ *p = (struct __pyx_obj_5pysam_7libcbcf___pyx_scope_struct_14___iter__ *)o;
  {
    e = __Pyx_call_type_traverse(o, 1, v, a);
    if (e) return e;
  }
  if (p->__pyx_v_self) {
    e = (*v)(((PyObject *)p->__pyx_v_self), a); if (e) return e;
  }
  return 0;
}
#if CYTHON_USE_TYPE_SPECS
static PyType_Slot __pyx_type_5pysam_7libcbcf___pyx_scope_struct_14___iter___slots[] = {
  {Py_tp_dealloc, (void *)__pyx_tp_dealloc_5pysam_7libcbcf___pyx_scope_struct_14___iter__},
  {Py_tp_traverse, (void *)__pyx_tp_traverse_5pysam_7libcbcf___pyx_scope_struct_14___iter__},
  {Py_tp_new, (void *)__pyx_tp_new_5pysam_7libcbcf___pyx_scope_struct_14___iter__},
  {0, 0},
};
static PyType_Spec __pyx_type_5pysam_7libcbcf___pyx_scope_struct_14___iter___spec = {
  "pysam.libcbcf.__pyx_scope_struct_14___iter__",
  sizeof(struct __pyx_obj_5pysam_7libcbcf___pyx_scope_struct_14___iter__),
  0,
  Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_VERSION_TAG|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_HAVE_GC|Py_TPFLAGS_HAVE_FINALIZE,
  __pyx_type_5pysam_7libcbcf___pyx_scope_struct_14___iter___slots,
};
#else

static PyTypeObject __pyx_type_5pysam_7libcbcf___pyx_scope_struct_14___iter__ = {
  PyVarObject_HEAD_INIT(0, 0)
  "pysam.libcbcf.""__pyx_scope_struct_14___iter__", /*tp_name*/
  sizeof(struct __pyx_obj_5pysam_7libcbcf___pyx_scope_struct_14___iter__), /*tp_basicsize*/
  0, /*tp_itemsize*/
  __pyx_tp_dealloc_5pysam_7libcbcf___pyx_scope_struct_14___iter__, /*tp_dealloc*/
  #if PY_VERSION_HEX < 0x030800b4
  0, /*tp_print*/
  #endif
  #if PY_VERSION_HEX >= 0x030800b4
  0, /*tp_vectorcall_offset*/
  #endif
  0, /*tp_getattr*/
  0, /*tp_setattr*/
  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|Py_TPFLAGS_HAVE_FINALIZE, /*tp_flags*/
  0, /*tp_doc*/
  __pyx_tp_traverse_5pysam_7libcbcf___pyx_scope_struct_14___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_5pysam_7libcbcf___pyx_scope_struct_14___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 PY_VERSION_HEX >= 0x030800b1 && (!CYTHON_COMPILING_IN_PYPY || PYPY_VERSION_NUM >= 0x07030800)
  0, /*tp_vectorcall*/
  #endif
  #if __PYX_NEED_TP_PRINT_SLOT == 1
  0, /*tp_print*/
  #endif
  #if PY_VERSION_HEX >= 0x030C0000
  0, /*tp_watched*/
  #endif
  #if 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_5pysam_7libcbcf___pyx_scope_struct_15_itervalues(PyTypeObject *t, CYTHON_UNUSED PyObject *a, CYTHON_UNUSED PyObject *k) {
  PyObject *o;
  #if CYTHON_COMPILING_IN_LIMITED_API
  allocfunc alloc_func = (allocfunc)PyType_GetSlot(t, Py_tp_alloc);
  o = alloc_func(t, 0);
  #else
  #if CYTHON_USE_FREELISTS
  if (likely((int)(__pyx_mstate_global->__pyx_freecount_5pysam_7libcbcf___pyx_scope_struct_15_itervalues > 0) & (int)(t->tp_basicsize == sizeof(struct __pyx_obj_5pysam_7libcbcf___pyx_scope_struct_15_itervalues)))) {
    o = (PyObject*)__pyx_mstate_global->__pyx_freelist_5pysam_7libcbcf___pyx_scope_struct_15_itervalues[--__pyx_mstate_global->__pyx_freecount_5pysam_7libcbcf___pyx_scope_struct_15_itervalues];
    memset(o, 0, sizeof(struct __pyx_obj_5pysam_7libcbcf___pyx_scope_struct_15_itervalues));
    (void) PyObject_INIT(o, t);
    PyObject_GC_Track(o);
  } else
  #endif
  {
    o = (*t->tp_alloc)(t, 0);
    if (unlikely(!o)) return 0;
  }
  #endif
  return o;
}

static void __pyx_tp_dealloc_5pysam_7libcbcf___pyx_scope_struct_15_itervalues(PyObject *o) {
  struct __pyx_obj_5pysam_7libcbcf___pyx_scope_struct_15_itervalues *p = (struct __pyx_obj_5pysam_7libcbcf___pyx_scope_struct_15_itervalues *)o;
  #if CYTHON_USE_TP_FINALIZE
  if (unlikely((PY_VERSION_HEX >= 0x03080000 || __Pyx_PyType_HasFeature(Py_TYPE(o), Py_TPFLAGS_HAVE_FINALIZE)) && __Pyx_PyObject_GetSlot(o, tp_finalize, destructor)) && !__Pyx_PyObject_GC_IsFinalized(o)) {
    if (__Pyx_PyObject_GetSlot(o, tp_dealloc, destructor) == __pyx_tp_dealloc_5pysam_7libcbcf___pyx_scope_struct_15_itervalues) {
      if (PyObject_CallFinalizerFromDealloc(o)) return;
    }
  }
  #endif
  PyObject_GC_UnTrack(o);
  Py_CLEAR(p->__pyx_v_key);
  Py_CLEAR(p->__pyx_v_self);
  Py_CLEAR(p->__pyx_t_0);
  #if CYTHON_USE_FREELISTS
  if (((int)(__pyx_mstate_global->__pyx_freecount_5pysam_7libcbcf___pyx_scope_struct_15_itervalues < 8) & (int)(Py_TYPE(o)->tp_basicsize == sizeof(struct __pyx_obj_5pysam_7libcbcf___pyx_scope_struct_15_itervalues)))) {
    __pyx_mstate_global->__pyx_freelist_5pysam_7libcbcf___pyx_scope_struct_15_itervalues[__pyx_mstate_global->__pyx_freecount_5pysam_7libcbcf___pyx_scope_struct_15_itervalues++] = ((struct __pyx_obj_5pysam_7libcbcf___pyx_scope_struct_15_itervalues *)o);
  } else
  #endif
  {
    #if CYTHON_USE_TYPE_SLOTS
    (*Py_TYPE(o)->tp_free)(o);
    #else
    {
      freefunc tp_free = (freefunc)PyType_GetSlot(Py_TYPE(o), Py_tp_free);
      if (tp_free) tp_free(o);
    }
    #endif
  }
}

static int __pyx_tp_traverse_5pysam_7libcbcf___pyx_scope_struct_15_itervalues(PyObject *o, visitproc v, void *a) {
  int e;
  struct __pyx_obj_5pysam_7libcbcf___pyx_scope_struct_15_itervalues *p = (struct __pyx_obj_5pysam_7libcbcf___pyx_scope_struct_15_itervalues *)o;
  {
    e = __Pyx_call_type_traverse(o, 1, v, a);
    if (e) return e;
  }
  if (p->__pyx_v_key) {
    e = (*v)(p->__pyx_v_key, 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_5pysam_7libcbcf___pyx_scope_struct_15_itervalues_slots[] = {
  {Py_tp_dealloc, (void *)__pyx_tp_dealloc_5pysam_7libcbcf___pyx_scope_struct_15_itervalues},
  {Py_tp_traverse, (void *)__pyx_tp_traverse_5pysam_7libcbcf___pyx_scope_struct_15_itervalues},
  {Py_tp_new, (void *)__pyx_tp_new_5pysam_7libcbcf___pyx_scope_struct_15_itervalues},
  {0, 0},
};
static PyType_Spec __pyx_type_5pysam_7libcbcf___pyx_scope_struct_15_itervalues_spec = {
  "pysam.libcbcf.__pyx_scope_struct_15_itervalues",
  sizeof(struct __pyx_obj_5pysam_7libcbcf___pyx_scope_struct_15_itervalues),
  0,
  Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_VERSION_TAG|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_HAVE_GC|Py_TPFLAGS_HAVE_FINALIZE,
  __pyx_type_5pysam_7libcbcf___pyx_scope_struct_15_itervalues_slots,
};
#else

static PyTypeObject __pyx_type_5pysam_7libcbcf___pyx_scope_struct_15_itervalues = {
  PyVarObject_HEAD_INIT(0, 0)
  "pysam.libcbcf.""__pyx_scope_struct_15_itervalues", /*tp_name*/
  sizeof(struct __pyx_obj_5pysam_7libcbcf___pyx_scope_struct_15_itervalues), /*tp_basicsize*/
  0, /*tp_itemsize*/
  __pyx_tp_dealloc_5pysam_7libcbcf___pyx_scope_struct_15_itervalues, /*tp_dealloc*/
  #if PY_VERSION_HEX < 0x030800b4
  0, /*tp_print*/
  #endif
  #if PY_VERSION_HEX >= 0x030800b4
  0, /*tp_vectorcall_offset*/
  #endif
  0, /*tp_getattr*/
  0, /*tp_setattr*/
  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|Py_TPFLAGS_HAVE_FINALIZE, /*tp_flags*/
  0, /*tp_doc*/
  __pyx_tp_traverse_5pysam_7libcbcf___pyx_scope_struct_15_itervalues, /*tp_traverse*/
  0, /*tp_clear*/
  0, /*tp_richcompare*/
  0, /*tp_weaklistoffset*/
  0, /*tp_iter*/
  0, /*tp_iternext*/
  0, /*tp_methods*/
  0, /*tp_members*/
  0, /*tp_getset*/
  0, /*tp_base*/
  0, /*tp_dict*/
  0, /*tp_descr_get*/
  0, /*tp_descr_set*/
  #if !CYTHON_USE_TYPE_SPECS
  0, /*tp_dictoffset*/
  #endif
  0, /*tp_init*/
  0, /*tp_alloc*/
  __pyx_tp_new_5pysam_7libcbcf___pyx_scope_struct_15_itervalues, /*tp_new*/
  0, /*tp_free*/
  0, /*tp_is_gc*/
  0, /*tp_bases*/
  0, /*tp_mro*/
  0, /*tp_cache*/
  0, /*tp_subclasses*/
  0, /*tp_weaklist*/
  0, /*tp_del*/
  0, /*tp_version_tag*/
  #if CYTHON_USE_TP_FINALIZE
  0, /*tp_finalize*/
  #else
  NULL, /*tp_finalize*/
  #endif
  #if PY_VERSION_HEX >= 0x030800b1 && (!CYTHON_COMPILING_IN_PYPY || PYPY_VERSION_NUM >= 0x07030800)
  0, /*tp_vectorcall*/
  #endif
  #if __PYX_NEED_TP_PRINT_SLOT == 1
  0, /*tp_print*/
  #endif
  #if PY_VERSION_HEX >= 0x030C0000
  0, /*tp_watched*/
  #endif
  #if 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_5pysam_7libcbcf___pyx_scope_struct_16_iteritems(PyTypeObject *t, CYTHON_UNUSED PyObject *a, CYTHON_UNUSED PyObject *k) {
  PyObject *o;
  #if CYTHON_COMPILING_IN_LIMITED_API
  allocfunc alloc_func = (allocfunc)PyType_GetSlot(t, Py_tp_alloc);
  o = alloc_func(t, 0);
  #else
  #if CYTHON_USE_FREELISTS
  if (likely((int)(__pyx_mstate_global->__pyx_freecount_5pysam_7libcbcf___pyx_scope_struct_16_iteritems > 0) & (int)(t->tp_basicsize == sizeof(struct __pyx_obj_5pysam_7libcbcf___pyx_scope_struct_16_iteritems)))) {
    o = (PyObject*)__pyx_mstate_global->__pyx_freelist_5pysam_7libcbcf___pyx_scope_struct_16_iteritems[--__pyx_mstate_global->__pyx_freecount_5pysam_7libcbcf___pyx_scope_struct_16_iteritems];
    memset(o, 0, sizeof(struct __pyx_obj_5pysam_7libcbcf___pyx_scope_struct_16_iteritems));
    (void) PyObject_INIT(o, t);
    PyObject_GC_Track(o);
  } else
  #endif
  {
    o = (*t->tp_alloc)(t, 0);
    if (unlikely(!o)) return 0;
  }
  #endif
  return o;
}

static void __pyx_tp_dealloc_5pysam_7libcbcf___pyx_scope_struct_16_iteritems(PyObject *o) {
  struct __pyx_obj_5pysam_7libcbcf___pyx_scope_struct_16_iteritems *p = (struct __pyx_obj_5pysam_7libcbcf___pyx_scope_struct_16_iteritems *)o;
  #if CYTHON_USE_TP_FINALIZE
  if (unlikely((PY_VERSION_HEX >= 0x03080000 || __Pyx_PyType_HasFeature(Py_TYPE(o), Py_TPFLAGS_HAVE_FINALIZE)) && __Pyx_PyObject_GetSlot(o, tp_finalize, destructor)) && !__Pyx_PyObject_GC_IsFinalized(o)) {
    if (__Pyx_PyObject_GetSlot(o, tp_dealloc, destructor) == __pyx_tp_dealloc_5pysam_7libcbcf___pyx_scope_struct_16_iteritems) {
      if (PyObject_CallFinalizerFromDealloc(o)) return;
    }
  }
  #endif
  PyObject_GC_UnTrack(o);
  Py_CLEAR(p->__pyx_v_key);
  Py_CLEAR(p->__pyx_v_self);
  Py_CLEAR(p->__pyx_t_0);
  #if CYTHON_USE_FREELISTS
  if (((int)(__pyx_mstate_global->__pyx_freecount_5pysam_7libcbcf___pyx_scope_struct_16_iteritems < 8) & (int)(Py_TYPE(o)->tp_basicsize == sizeof(struct __pyx_obj_5pysam_7libcbcf___pyx_scope_struct_16_iteritems)))) {
    __pyx_mstate_global->__pyx_freelist_5pysam_7libcbcf___pyx_scope_struct_16_iteritems[__pyx_mstate_global->__pyx_freecount_5pysam_7libcbcf___pyx_scope_struct_16_iteritems++] = ((struct __pyx_obj_5pysam_7libcbcf___pyx_scope_struct_16_iteritems *)o);
  } else
  #endif
  {
    #if CYTHON_USE_TYPE_SLOTS
    (*Py_TYPE(o)->tp_free)(o);
    #else
    {
      freefunc tp_free = (freefunc)PyType_GetSlot(Py_TYPE(o), Py_tp_free);
      if (tp_free) tp_free(o);
    }
    #endif
  }
}

static int __pyx_tp_traverse_5pysam_7libcbcf___pyx_scope_struct_16_iteritems(PyObject *o, visitproc v, void *a) {
  int e;
  struct __pyx_obj_5pysam_7libcbcf___pyx_scope_struct_16_iteritems *p = (struct __pyx_obj_5pysam_7libcbcf___pyx_scope_struct_16_iteritems *)o;
  {
    e = __Pyx_call_type_traverse(o, 1, v, a);
    if (e) return e;
  }
  if (p->__pyx_v_key) {
    e = (*v)(p->__pyx_v_key, 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_5pysam_7libcbcf___pyx_scope_struct_16_iteritems_slots[] = {
  {Py_tp_dealloc, (void *)__pyx_tp_dealloc_5pysam_7libcbcf___pyx_scope_struct_16_iteritems},
  {Py_tp_traverse, (void *)__pyx_tp_traverse_5pysam_7libcbcf___pyx_scope_struct_16_iteritems},
  {Py_tp_new, (void *)__pyx_tp_new_5pysam_7libcbcf___pyx_scope_struct_16_iteritems},
  {0, 0},
};
static PyType_Spec __pyx_type_5pysam_7libcbcf___pyx_scope_struct_16_iteritems_spec = {
  "pysam.libcbcf.__pyx_scope_struct_16_iteritems",
  sizeof(struct __pyx_obj_5pysam_7libcbcf___pyx_scope_struct_16_iteritems),
  0,
  Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_VERSION_TAG|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_HAVE_GC|Py_TPFLAGS_HAVE_FINALIZE,
  __pyx_type_5pysam_7libcbcf___pyx_scope_struct_16_iteritems_slots,
};
#else

static PyTypeObject __pyx_type_5pysam_7libcbcf___pyx_scope_struct_16_iteritems = {
  PyVarObject_HEAD_INIT(0, 0)
  "pysam.libcbcf.""__pyx_scope_struct_16_iteritems", /*tp_name*/
  sizeof(struct __pyx_obj_5pysam_7libcbcf___pyx_scope_struct_16_iteritems), /*tp_basicsize*/
  0, /*tp_itemsize*/
  __pyx_tp_dealloc_5pysam_7libcbcf___pyx_scope_struct_16_iteritems, /*tp_dealloc*/
  #if PY_VERSION_HEX < 0x030800b4
  0, /*tp_print*/
  #endif
  #if PY_VERSION_HEX >= 0x030800b4
  0, /*tp_vectorcall_offset*/
  #endif
  0, /*tp_getattr*/
  0, /*tp_setattr*/
  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|Py_TPFLAGS_HAVE_FINALIZE, /*tp_flags*/
  0, /*tp_doc*/
  __pyx_tp_traverse_5pysam_7libcbcf___pyx_scope_struct_16_iteritems, /*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_5pysam_7libcbcf___pyx_scope_struct_16_iteritems, /*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 PY_VERSION_HEX >= 0x030800b1 && (!CYTHON_COMPILING_IN_PYPY || PYPY_VERSION_NUM >= 0x07030800)
  0, /*tp_vectorcall*/
  #endif
  #if __PYX_NEED_TP_PRINT_SLOT == 1
  0, /*tp_print*/
  #endif
  #if PY_VERSION_HEX >= 0x030C0000
  0, /*tp_watched*/
  #endif
  #if 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_5pysam_7libcbcf___pyx_scope_struct_17___iter__(PyTypeObject *t, CYTHON_UNUSED PyObject *a, CYTHON_UNUSED PyObject *k) {
  PyObject *o;
  #if CYTHON_COMPILING_IN_LIMITED_API
  allocfunc alloc_func = (allocfunc)PyType_GetSlot(t, Py_tp_alloc);
  o = alloc_func(t, 0);
  #else
  #if CYTHON_USE_FREELISTS
  if (likely((int)(__pyx_mstate_global->__pyx_freecount_5pysam_7libcbcf___pyx_scope_struct_17___iter__ > 0) & (int)(t->tp_basicsize == sizeof(struct __pyx_obj_5pysam_7libcbcf___pyx_scope_struct_17___iter__)))) {
    o = (PyObject*)__pyx_mstate_global->__pyx_freelist_5pysam_7libcbcf___pyx_scope_struct_17___iter__[--__pyx_mstate_global->__pyx_freecount_5pysam_7libcbcf___pyx_scope_struct_17___iter__];
    memset(o, 0, sizeof(struct __pyx_obj_5pysam_7libcbcf___pyx_scope_struct_17___iter__));
    (void) PyObject_INIT(o, t);
    PyObject_GC_Track(o);
  } else
  #endif
  {
    o = (*t->tp_alloc)(t, 0);
    if (unlikely(!o)) return 0;
  }
  #endif
  return o;
}

static void __pyx_tp_dealloc_5pysam_7libcbcf___pyx_scope_struct_17___iter__(PyObject *o) {
  struct __pyx_obj_5pysam_7libcbcf___pyx_scope_struct_17___iter__ *p = (struct __pyx_obj_5pysam_7libcbcf___pyx_scope_struct_17___iter__ *)o;
  #if CYTHON_USE_TP_FINALIZE
  if (unlikely((PY_VERSION_HEX >= 0x03080000 || __Pyx_PyType_HasFeature(Py_TYPE(o), Py_TPFLAGS_HAVE_FINALIZE)) && __Pyx_PyObject_GetSlot(o, tp_finalize, destructor)) && !__Pyx_PyObject_GC_IsFinalized(o)) {
    if (__Pyx_PyObject_GetSlot(o, tp_dealloc, destructor) == __pyx_tp_dealloc_5pysam_7libcbcf___pyx_scope_struct_17___iter__) {
      if (PyObject_CallFinalizerFromDealloc(o)) return;
    }
  }
  #endif
  PyObject_GC_UnTrack(o);
  Py_CLEAR(p->__pyx_v_self);
  #if CYTHON_USE_FREELISTS
  if (((int)(__pyx_mstate_global->__pyx_freecount_5pysam_7libcbcf___pyx_scope_struct_17___iter__ < 8) & (int)(Py_TYPE(o)->tp_basicsize == sizeof(struct __pyx_obj_5pysam_7libcbcf___pyx_scope_struct_17___iter__)))) {
    __pyx_mstate_global->__pyx_freelist_5pysam_7libcbcf___pyx_scope_struct_17___iter__[__pyx_mstate_global->__pyx_freecount_5pysam_7libcbcf___pyx_scope_struct_17___iter__++] = ((struct __pyx_obj_5pysam_7libcbcf___pyx_scope_struct_17___iter__ *)o);
  } else
  #endif
  {
    #if CYTHON_USE_TYPE_SLOTS
    (*Py_TYPE(o)->tp_free)(o);
    #else
    {
      freefunc tp_free = (freefunc)PyType_GetSlot(Py_TYPE(o), Py_tp_free);
      if (tp_free) tp_free(o);
    }
    #endif
  }
}

static int __pyx_tp_traverse_5pysam_7libcbcf___pyx_scope_struct_17___iter__(PyObject *o, visitproc v, void *a) {
  int e;
  struct __pyx_obj_5pysam_7libcbcf___pyx_scope_struct_17___iter__ *p = (struct __pyx_obj_5pysam_7libcbcf___pyx_scope_struct_17___iter__ *)o;
  {
    e = __Pyx_call_type_traverse(o, 1, v, a);
    if (e) return e;
  }
  if (p->__pyx_v_self) {
    e = (*v)(((PyObject *)p->__pyx_v_self), a); if (e) return e;
  }
  return 0;
}
#if CYTHON_USE_TYPE_SPECS
static PyType_Slot __pyx_type_5pysam_7libcbcf___pyx_scope_struct_17___iter___slots[] = {
  {Py_tp_dealloc, (void *)__pyx_tp_dealloc_5pysam_7libcbcf___pyx_scope_struct_17___iter__},
  {Py_tp_traverse, (void *)__pyx_tp_traverse_5pysam_7libcbcf___pyx_scope_struct_17___iter__},
  {Py_tp_new, (void *)__pyx_tp_new_5pysam_7libcbcf___pyx_scope_struct_17___iter__},
  {0, 0},
};
static PyType_Spec __pyx_type_5pysam_7libcbcf___pyx_scope_struct_17___iter___spec = {
  "pysam.libcbcf.__pyx_scope_struct_17___iter__",
  sizeof(struct __pyx_obj_5pysam_7libcbcf___pyx_scope_struct_17___iter__),
  0,
  Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_VERSION_TAG|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_HAVE_GC|Py_TPFLAGS_HAVE_FINALIZE,
  __pyx_type_5pysam_7libcbcf___pyx_scope_struct_17___iter___slots,
};
#else

static PyTypeObject __pyx_type_5pysam_7libcbcf___pyx_scope_struct_17___iter__ = {
  PyVarObject_HEAD_INIT(0, 0)
  "pysam.libcbcf.""__pyx_scope_struct_17___iter__", /*tp_name*/
  sizeof(struct __pyx_obj_5pysam_7libcbcf___pyx_scope_struct_17___iter__), /*tp_basicsize*/
  0, /*tp_itemsize*/
  __pyx_tp_dealloc_5pysam_7libcbcf___pyx_scope_struct_17___iter__, /*tp_dealloc*/
  #if PY_VERSION_HEX < 0x030800b4
  0, /*tp_print*/
  #endif
  #if PY_VERSION_HEX >= 0x030800b4
  0, /*tp_vectorcall_offset*/
  #endif
  0, /*tp_getattr*/
  0, /*tp_setattr*/
  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|Py_TPFLAGS_HAVE_FINALIZE, /*tp_flags*/
  0, /*tp_doc*/
  __pyx_tp_traverse_5pysam_7libcbcf___pyx_scope_struct_17___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_5pysam_7libcbcf___pyx_scope_struct_17___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 PY_VERSION_HEX >= 0x030800b1 && (!CYTHON_COMPILING_IN_PYPY || PYPY_VERSION_NUM >= 0x07030800)
  0, /*tp_vectorcall*/
  #endif
  #if __PYX_NEED_TP_PRINT_SLOT == 1
  0, /*tp_print*/
  #endif
  #if PY_VERSION_HEX >= 0x030C0000
  0, /*tp_watched*/
  #endif
  #if 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_5pysam_7libcbcf___pyx_scope_struct_18___iter__(PyTypeObject *t, CYTHON_UNUSED PyObject *a, CYTHON_UNUSED PyObject *k) {
  PyObject *o;
  #if CYTHON_COMPILING_IN_LIMITED_API
  allocfunc alloc_func = (allocfunc)PyType_GetSlot(t, Py_tp_alloc);
  o = alloc_func(t, 0);
  #else
  #if CYTHON_USE_FREELISTS
  if (likely((int)(__pyx_mstate_global->__pyx_freecount_5pysam_7libcbcf___pyx_scope_struct_18___iter__ > 0) & (int)(t->tp_basicsize == sizeof(struct __pyx_obj_5pysam_7libcbcf___pyx_scope_struct_18___iter__)))) {
    o = (PyObject*)__pyx_mstate_global->__pyx_freelist_5pysam_7libcbcf___pyx_scope_struct_18___iter__[--__pyx_mstate_global->__pyx_freecount_5pysam_7libcbcf___pyx_scope_struct_18___iter__];
    memset(o, 0, sizeof(struct __pyx_obj_5pysam_7libcbcf___pyx_scope_struct_18___iter__));
    (void) PyObject_INIT(o, t);
    PyObject_GC_Track(o);
  } else
  #endif
  {
    o = (*t->tp_alloc)(t, 0);
    if (unlikely(!o)) return 0;
  }
  #endif
  return o;
}

static void __pyx_tp_dealloc_5pysam_7libcbcf___pyx_scope_struct_18___iter__(PyObject *o) {
  struct __pyx_obj_5pysam_7libcbcf___pyx_scope_struct_18___iter__ *p = (struct __pyx_obj_5pysam_7libcbcf___pyx_scope_struct_18___iter__ *)o;
  #if CYTHON_USE_TP_FINALIZE
  if (unlikely((PY_VERSION_HEX >= 0x03080000 || __Pyx_PyType_HasFeature(Py_TYPE(o), Py_TPFLAGS_HAVE_FINALIZE)) && __Pyx_PyObject_GetSlot(o, tp_finalize, destructor)) && !__Pyx_PyObject_GC_IsFinalized(o)) {
    if (__Pyx_PyObject_GetSlot(o, tp_dealloc, destructor) == __pyx_tp_dealloc_5pysam_7libcbcf___pyx_scope_struct_18___iter__) {
      if (PyObject_CallFinalizerFromDealloc(o)) return;
    }
  }
  #endif
  PyObject_GC_UnTrack(o);
  Py_CLEAR(p->__pyx_v_self);
  #if CYTHON_USE_FREELISTS
  if (((int)(__pyx_mstate_global->__pyx_freecount_5pysam_7libcbcf___pyx_scope_struct_18___iter__ < 8) & (int)(Py_TYPE(o)->tp_basicsize == sizeof(struct __pyx_obj_5pysam_7libcbcf___pyx_scope_struct_18___iter__)))) {
    __pyx_mstate_global->__pyx_freelist_5pysam_7libcbcf___pyx_scope_struct_18___iter__[__pyx_mstate_global->__pyx_freecount_5pysam_7libcbcf___pyx_scope_struct_18___iter__++] = ((struct __pyx_obj_5pysam_7libcbcf___pyx_scope_struct_18___iter__ *)o);
  } else
  #endif
  {
    #if CYTHON_USE_TYPE_SLOTS
    (*Py_TYPE(o)->tp_free)(o);
    #else
    {
      freefunc tp_free = (freefunc)PyType_GetSlot(Py_TYPE(o), Py_tp_free);
      if (tp_free) tp_free(o);
    }
    #endif
  }
}

static int __pyx_tp_traverse_5pysam_7libcbcf___pyx_scope_struct_18___iter__(PyObject *o, visitproc v, void *a) {
  int e;
  struct __pyx_obj_5pysam_7libcbcf___pyx_scope_struct_18___iter__ *p = (struct __pyx_obj_5pysam_7libcbcf___pyx_scope_struct_18___iter__ *)o;
  {
    e = __Pyx_call_type_traverse(o, 1, v, a);
    if (e) return e;
  }
  if (p->__pyx_v_self) {
    e = (*v)(((PyObject *)p->__pyx_v_self), a); if (e) return e;
  }
  return 0;
}
#if CYTHON_USE_TYPE_SPECS
static PyType_Slot __pyx_type_5pysam_7libcbcf___pyx_scope_struct_18___iter___slots[] = {
  {Py_tp_dealloc, (void *)__pyx_tp_dealloc_5pysam_7libcbcf___pyx_scope_struct_18___iter__},
  {Py_tp_traverse, (void *)__pyx_tp_traverse_5pysam_7libcbcf___pyx_scope_struct_18___iter__},
  {Py_tp_new, (void *)__pyx_tp_new_5pysam_7libcbcf___pyx_scope_struct_18___iter__},
  {0, 0},
};
static PyType_Spec __pyx_type_5pysam_7libcbcf___pyx_scope_struct_18___iter___spec = {
  "pysam.libcbcf.__pyx_scope_struct_18___iter__",
  sizeof(struct __pyx_obj_5pysam_7libcbcf___pyx_scope_struct_18___iter__),
  0,
  Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_VERSION_TAG|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_HAVE_GC|Py_TPFLAGS_HAVE_FINALIZE,
  __pyx_type_5pysam_7libcbcf___pyx_scope_struct_18___iter___slots,
};
#else

static PyTypeObject __pyx_type_5pysam_7libcbcf___pyx_scope_struct_18___iter__ = {
  PyVarObject_HEAD_INIT(0, 0)
  "pysam.libcbcf.""__pyx_scope_struct_18___iter__", /*tp_name*/
  sizeof(struct __pyx_obj_5pysam_7libcbcf___pyx_scope_struct_18___iter__), /*tp_basicsize*/
  0, /*tp_itemsize*/
  __pyx_tp_dealloc_5pysam_7libcbcf___pyx_scope_struct_18___iter__, /*tp_dealloc*/
  #if PY_VERSION_HEX < 0x030800b4
  0, /*tp_print*/
  #endif
  #if PY_VERSION_HEX >= 0x030800b4
  0, /*tp_vectorcall_offset*/
  #endif
  0, /*tp_getattr*/
  0, /*tp_setattr*/
  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|Py_TPFLAGS_HAVE_FINALIZE, /*tp_flags*/
  0, /*tp_doc*/
  __pyx_tp_traverse_5pysam_7libcbcf___pyx_scope_struct_18___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_5pysam_7libcbcf___pyx_scope_struct_18___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 PY_VERSION_HEX >= 0x030800b1 && (!CYTHON_COMPILING_IN_PYPY || PYPY_VERSION_NUM >= 0x07030800)
  0, /*tp_vectorcall*/
  #endif
  #if __PYX_NEED_TP_PRINT_SLOT == 1
  0, /*tp_print*/
  #endif
  #if PY_VERSION_HEX >= 0x030C0000
  0, /*tp_watched*/
  #endif
  #if 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_5pysam_7libcbcf___pyx_scope_struct_19_itervalues(PyTypeObject *t, CYTHON_UNUSED PyObject *a, CYTHON_UNUSED PyObject *k) {
  PyObject *o;
  #if CYTHON_COMPILING_IN_LIMITED_API
  allocfunc alloc_func = (allocfunc)PyType_GetSlot(t, Py_tp_alloc);
  o = alloc_func(t, 0);
  #else
  #if CYTHON_USE_FREELISTS
  if (likely((int)(__pyx_mstate_global->__pyx_freecount_5pysam_7libcbcf___pyx_scope_struct_19_itervalues > 0) & (int)(t->tp_basicsize == sizeof(struct __pyx_obj_5pysam_7libcbcf___pyx_scope_struct_19_itervalues)))) {
    o = (PyObject*)__pyx_mstate_global->__pyx_freelist_5pysam_7libcbcf___pyx_scope_struct_19_itervalues[--__pyx_mstate_global->__pyx_freecount_5pysam_7libcbcf___pyx_scope_struct_19_itervalues];
    memset(o, 0, sizeof(struct __pyx_obj_5pysam_7libcbcf___pyx_scope_struct_19_itervalues));
    (void) PyObject_INIT(o, t);
    PyObject_GC_Track(o);
  } else
  #endif
  {
    o = (*t->tp_alloc)(t, 0);
    if (unlikely(!o)) return 0;
  }
  #endif
  return o;
}

static void __pyx_tp_dealloc_5pysam_7libcbcf___pyx_scope_struct_19_itervalues(PyObject *o) {
  struct __pyx_obj_5pysam_7libcbcf___pyx_scope_struct_19_itervalues *p = (struct __pyx_obj_5pysam_7libcbcf___pyx_scope_struct_19_itervalues *)o;
  #if CYTHON_USE_TP_FINALIZE
  if (unlikely((PY_VERSION_HEX >= 0x03080000 || __Pyx_PyType_HasFeature(Py_TYPE(o), Py_TPFLAGS_HAVE_FINALIZE)) && __Pyx_PyObject_GetSlot(o, tp_finalize, destructor)) && !__Pyx_PyObject_GC_IsFinalized(o)) {
    if (__Pyx_PyObject_GetSlot(o, tp_dealloc, destructor) == __pyx_tp_dealloc_5pysam_7libcbcf___pyx_scope_struct_19_itervalues) {
      if (PyObject_CallFinalizerFromDealloc(o)) return;
    }
  }
  #endif
  PyObject_GC_UnTrack(o);
  Py_CLEAR(p->__pyx_v_key);
  Py_CLEAR(p->__pyx_v_self);
  Py_CLEAR(p->__pyx_t_0);
  #if CYTHON_USE_FREELISTS
  if (((int)(__pyx_mstate_global->__pyx_freecount_5pysam_7libcbcf___pyx_scope_struct_19_itervalues < 8) & (int)(Py_TYPE(o)->tp_basicsize == sizeof(struct __pyx_obj_5pysam_7libcbcf___pyx_scope_struct_19_itervalues)))) {
    __pyx_mstate_global->__pyx_freelist_5pysam_7libcbcf___pyx_scope_struct_19_itervalues[__pyx_mstate_global->__pyx_freecount_5pysam_7libcbcf___pyx_scope_struct_19_itervalues++] = ((struct __pyx_obj_5pysam_7libcbcf___pyx_scope_struct_19_itervalues *)o);
  } else
  #endif
  {
    #if CYTHON_USE_TYPE_SLOTS
    (*Py_TYPE(o)->tp_free)(o);
    #else
    {
      freefunc tp_free = (freefunc)PyType_GetSlot(Py_TYPE(o), Py_tp_free);
      if (tp_free) tp_free(o);
    }
    #endif
  }
}

static int __pyx_tp_traverse_5pysam_7libcbcf___pyx_scope_struct_19_itervalues(PyObject *o, visitproc v, void *a) {
  int e;
  struct __pyx_obj_5pysam_7libcbcf___pyx_scope_struct_19_itervalues *p = (struct __pyx_obj_5pysam_7libcbcf___pyx_scope_struct_19_itervalues *)o;
  {
    e = __Pyx_call_type_traverse(o, 1, v, a);
    if (e) return e;
  }
  if (p->__pyx_v_key) {
    e = (*v)(p->__pyx_v_key, 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_5pysam_7libcbcf___pyx_scope_struct_19_itervalues_slots[] = {
  {Py_tp_dealloc, (void *)__pyx_tp_dealloc_5pysam_7libcbcf___pyx_scope_struct_19_itervalues},
  {Py_tp_traverse, (void *)__pyx_tp_traverse_5pysam_7libcbcf___pyx_scope_struct_19_itervalues},
  {Py_tp_new, (void *)__pyx_tp_new_5pysam_7libcbcf___pyx_scope_struct_19_itervalues},
  {0, 0},
};
static PyType_Spec __pyx_type_5pysam_7libcbcf___pyx_scope_struct_19_itervalues_spec = {
  "pysam.libcbcf.__pyx_scope_struct_19_itervalues",
  sizeof(struct __pyx_obj_5pysam_7libcbcf___pyx_scope_struct_19_itervalues),
  0,
  Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_VERSION_TAG|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_HAVE_GC|Py_TPFLAGS_HAVE_FINALIZE,
  __pyx_type_5pysam_7libcbcf___pyx_scope_struct_19_itervalues_slots,
};
#else

static PyTypeObject __pyx_type_5pysam_7libcbcf___pyx_scope_struct_19_itervalues = {
  PyVarObject_HEAD_INIT(0, 0)
  "pysam.libcbcf.""__pyx_scope_struct_19_itervalues", /*tp_name*/
  sizeof(struct __pyx_obj_5pysam_7libcbcf___pyx_scope_struct_19_itervalues), /*tp_basicsize*/
  0, /*tp_itemsize*/
  __pyx_tp_dealloc_5pysam_7libcbcf___pyx_scope_struct_19_itervalues, /*tp_dealloc*/
  #if PY_VERSION_HEX < 0x030800b4
  0, /*tp_print*/
  #endif
  #if PY_VERSION_HEX >= 0x030800b4
  0, /*tp_vectorcall_offset*/
  #endif
  0, /*tp_getattr*/
  0, /*tp_setattr*/
  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|Py_TPFLAGS_HAVE_FINALIZE, /*tp_flags*/
  0, /*tp_doc*/
  __pyx_tp_traverse_5pysam_7libcbcf___pyx_scope_struct_19_itervalues, /*tp_traverse*/
  0, /*tp_clear*/
  0, /*tp_richcompare*/
  0, /*tp_weaklistoffset*/
  0, /*tp_iter*/
  0, /*tp_iternext*/
  0, /*tp_methods*/
  0, /*tp_members*/
  0, /*tp_getset*/
  0, /*tp_base*/
  0, /*tp_dict*/
  0, /*tp_descr_get*/
  0, /*tp_descr_set*/
  #if !CYTHON_USE_TYPE_SPECS
  0, /*tp_dictoffset*/
  #endif
  0, /*tp_init*/
  0, /*tp_alloc*/
  __pyx_tp_new_5pysam_7libcbcf___pyx_scope_struct_19_itervalues, /*tp_new*/
  0, /*tp_free*/
  0, /*tp_is_gc*/
  0, /*tp_bases*/
  0, /*tp_mro*/
  0, /*tp_cache*/
  0, /*tp_subclasses*/
  0, /*tp_weaklist*/
  0, /*tp_del*/
  0, /*tp_version_tag*/
  #if CYTHON_USE_TP_FINALIZE
  0, /*tp_finalize*/
  #else
  NULL, /*tp_finalize*/
  #endif
  #if PY_VERSION_HEX >= 0x030800b1 && (!CYTHON_COMPILING_IN_PYPY || PYPY_VERSION_NUM >= 0x07030800)
  0, /*tp_vectorcall*/
  #endif
  #if __PYX_NEED_TP_PRINT_SLOT == 1
  0, /*tp_print*/
  #endif
  #if PY_VERSION_HEX >= 0x030C0000
  0, /*tp_watched*/
  #endif
  #if 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_5pysam_7libcbcf___pyx_scope_struct_20_iteritems(PyTypeObject *t, CYTHON_UNUSED PyObject *a, CYTHON_UNUSED PyObject *k) {
  PyObject *o;
  #if CYTHON_COMPILING_IN_LIMITED_API
  allocfunc alloc_func = (allocfunc)PyType_GetSlot(t, Py_tp_alloc);
  o = alloc_func(t, 0);
  #else
  #if CYTHON_USE_FREELISTS
  if (likely((int)(__pyx_mstate_global->__pyx_freecount_5pysam_7libcbcf___pyx_scope_struct_20_iteritems > 0) & (int)(t->tp_basicsize == sizeof(struct __pyx_obj_5pysam_7libcbcf___pyx_scope_struct_20_iteritems)))) {
    o = (PyObject*)__pyx_mstate_global->__pyx_freelist_5pysam_7libcbcf___pyx_scope_struct_20_iteritems[--__pyx_mstate_global->__pyx_freecount_5pysam_7libcbcf___pyx_scope_struct_20_iteritems];
    memset(o, 0, sizeof(struct __pyx_obj_5pysam_7libcbcf___pyx_scope_struct_20_iteritems));
    (void) PyObject_INIT(o, t);
    PyObject_GC_Track(o);
  } else
  #endif
  {
    o = (*t->tp_alloc)(t, 0);
    if (unlikely(!o)) return 0;
  }
  #endif
  return o;
}

static void __pyx_tp_dealloc_5pysam_7libcbcf___pyx_scope_struct_20_iteritems(PyObject *o) {
  struct __pyx_obj_5pysam_7libcbcf___pyx_scope_struct_20_iteritems *p = (struct __pyx_obj_5pysam_7libcbcf___pyx_scope_struct_20_iteritems *)o;
  #if CYTHON_USE_TP_FINALIZE
  if (unlikely((PY_VERSION_HEX >= 0x03080000 || __Pyx_PyType_HasFeature(Py_TYPE(o), Py_TPFLAGS_HAVE_FINALIZE)) && __Pyx_PyObject_GetSlot(o, tp_finalize, destructor)) && !__Pyx_PyObject_GC_IsFinalized(o)) {
    if (__Pyx_PyObject_GetSlot(o, tp_dealloc, destructor) == __pyx_tp_dealloc_5pysam_7libcbcf___pyx_scope_struct_20_iteritems) {
      if (PyObject_CallFinalizerFromDealloc(o)) return;
    }
  }
  #endif
  PyObject_GC_UnTrack(o);
  Py_CLEAR(p->__pyx_v_key);
  Py_CLEAR(p->__pyx_v_self);
  Py_CLEAR(p->__pyx_t_0);
  #if CYTHON_USE_FREELISTS
  if (((int)(__pyx_mstate_global->__pyx_freecount_5pysam_7libcbcf___pyx_scope_struct_20_iteritems < 8) & (int)(Py_TYPE(o)->tp_basicsize == sizeof(struct __pyx_obj_5pysam_7libcbcf___pyx_scope_struct_20_iteritems)))) {
    __pyx_mstate_global->__pyx_freelist_5pysam_7libcbcf___pyx_scope_struct_20_iteritems[__pyx_mstate_global->__pyx_freecount_5pysam_7libcbcf___pyx_scope_struct_20_iteritems++] = ((struct __pyx_obj_5pysam_7libcbcf___pyx_scope_struct_20_iteritems *)o);
  } else
  #endif
  {
    #if CYTHON_USE_TYPE_SLOTS
    (*Py_TYPE(o)->tp_free)(o);
    #else
    {
      freefunc tp_free = (freefunc)PyType_GetSlot(Py_TYPE(o), Py_tp_free);
      if (tp_free) tp_free(o);
    }
    #endif
  }
}

static int __pyx_tp_traverse_5pysam_7libcbcf___pyx_scope_struct_20_iteritems(PyObject *o, visitproc v, void *a) {
  int e;
  struct __pyx_obj_5pysam_7libcbcf___pyx_scope_struct_20_iteritems *p = (struct __pyx_obj_5pysam_7libcbcf___pyx_scope_struct_20_iteritems *)o;
  {
    e = __Pyx_call_type_traverse(o, 1, v, a);
    if (e) return e;
  }
  if (p->__pyx_v_key) {
    e = (*v)(p->__pyx_v_key, 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_5pysam_7libcbcf___pyx_scope_struct_20_iteritems_slots[] = {
  {Py_tp_dealloc, (void *)__pyx_tp_dealloc_5pysam_7libcbcf___pyx_scope_struct_20_iteritems},
  {Py_tp_traverse, (void *)__pyx_tp_traverse_5pysam_7libcbcf___pyx_scope_struct_20_iteritems},
  {Py_tp_new, (void *)__pyx_tp_new_5pysam_7libcbcf___pyx_scope_struct_20_iteritems},
  {0, 0},
};
static PyType_Spec __pyx_type_5pysam_7libcbcf___pyx_scope_struct_20_iteritems_spec = {
  "pysam.libcbcf.__pyx_scope_struct_20_iteritems",
  sizeof(struct __pyx_obj_5pysam_7libcbcf___pyx_scope_struct_20_iteritems),
  0,
  Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_VERSION_TAG|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_HAVE_GC|Py_TPFLAGS_HAVE_FINALIZE,
  __pyx_type_5pysam_7libcbcf___pyx_scope_struct_20_iteritems_slots,
};
#else

static PyTypeObject __pyx_type_5pysam_7libcbcf___pyx_scope_struct_20_iteritems = {
  PyVarObject_HEAD_INIT(0, 0)
  "pysam.libcbcf.""__pyx_scope_struct_20_iteritems", /*tp_name*/
  sizeof(struct __pyx_obj_5pysam_7libcbcf___pyx_scope_struct_20_iteritems), /*tp_basicsize*/
  0, /*tp_itemsize*/
  __pyx_tp_dealloc_5pysam_7libcbcf___pyx_scope_struct_20_iteritems, /*tp_dealloc*/
  #if PY_VERSION_HEX < 0x030800b4
  0, /*tp_print*/
  #endif
  #if PY_VERSION_HEX >= 0x030800b4
  0, /*tp_vectorcall_offset*/
  #endif
  0, /*tp_getattr*/
  0, /*tp_setattr*/
  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|Py_TPFLAGS_HAVE_FINALIZE, /*tp_flags*/
  0, /*tp_doc*/
  __pyx_tp_traverse_5pysam_7libcbcf___pyx_scope_struct_20_iteritems, /*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_5pysam_7libcbcf___pyx_scope_struct_20_iteritems, /*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 PY_VERSION_HEX >= 0x030800b1 && (!CYTHON_COMPILING_IN_PYPY || PYPY_VERSION_NUM >= 0x07030800)
  0, /*tp_vectorcall*/
  #endif
  #if __PYX_NEED_TP_PRINT_SLOT == 1
  0, /*tp_print*/
  #endif
  #if PY_VERSION_HEX >= 0x030C0000
  0, /*tp_watched*/
  #endif
  #if 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_5pysam_7libcbcf___pyx_scope_struct_21___iter__(PyTypeObject *t, CYTHON_UNUSED PyObject *a, CYTHON_UNUSED PyObject *k) {
  PyObject *o;
  #if CYTHON_COMPILING_IN_LIMITED_API
  allocfunc alloc_func = (allocfunc)PyType_GetSlot(t, Py_tp_alloc);
  o = alloc_func(t, 0);
  #else
  #if CYTHON_USE_FREELISTS
  if (likely((int)(__pyx_mstate_global->__pyx_freecount_5pysam_7libcbcf___pyx_scope_struct_21___iter__ > 0) & (int)(t->tp_basicsize == sizeof(struct __pyx_obj_5pysam_7libcbcf___pyx_scope_struct_21___iter__)))) {
    o = (PyObject*)__pyx_mstate_global->__pyx_freelist_5pysam_7libcbcf___pyx_scope_struct_21___iter__[--__pyx_mstate_global->__pyx_freecount_5pysam_7libcbcf___pyx_scope_struct_21___iter__];
    memset(o, 0, sizeof(struct __pyx_obj_5pysam_7libcbcf___pyx_scope_struct_21___iter__));
    (void) PyObject_INIT(o, t);
    PyObject_GC_Track(o);
  } else
  #endif
  {
    o = (*t->tp_alloc)(t, 0);
    if (unlikely(!o)) return 0;
  }
  #endif
  return o;
}

static void __pyx_tp_dealloc_5pysam_7libcbcf___pyx_scope_struct_21___iter__(PyObject *o) {
  struct __pyx_obj_5pysam_7libcbcf___pyx_scope_struct_21___iter__ *p = (struct __pyx_obj_5pysam_7libcbcf___pyx_scope_struct_21___iter__ *)o;
  #if CYTHON_USE_TP_FINALIZE
  if (unlikely((PY_VERSION_HEX >= 0x03080000 || __Pyx_PyType_HasFeature(Py_TYPE(o), Py_TPFLAGS_HAVE_FINALIZE)) && __Pyx_PyObject_GetSlot(o, tp_finalize, destructor)) && !__Pyx_PyObject_GC_IsFinalized(o)) {
    if (__Pyx_PyObject_GetSlot(o, tp_dealloc, destructor) == __pyx_tp_dealloc_5pysam_7libcbcf___pyx_scope_struct_21___iter__) {
      if (PyObject_CallFinalizerFromDealloc(o)) return;
    }
  }
  #endif
  PyObject_GC_UnTrack(o);
  Py_CLEAR(p->__pyx_v_self);
  #if CYTHON_USE_FREELISTS
  if (((int)(__pyx_mstate_global->__pyx_freecount_5pysam_7libcbcf___pyx_scope_struct_21___iter__ < 8) & (int)(Py_TYPE(o)->tp_basicsize == sizeof(struct __pyx_obj_5pysam_7libcbcf___pyx_scope_struct_21___iter__)))) {
    __pyx_mstate_global->__pyx_freelist_5pysam_7libcbcf___pyx_scope_struct_21___iter__[__pyx_mstate_global->__pyx_freecount_5pysam_7libcbcf___pyx_scope_struct_21___iter__++] = ((struct __pyx_obj_5pysam_7libcbcf___pyx_scope_struct_21___iter__ *)o);
  } else
  #endif
  {
    #if CYTHON_USE_TYPE_SLOTS
    (*Py_TYPE(o)->tp_free)(o);
    #else
    {
      freefunc tp_free = (freefunc)PyType_GetSlot(Py_TYPE(o), Py_tp_free);
      if (tp_free) tp_free(o);
    }
    #endif
  }
}

static int __pyx_tp_traverse_5pysam_7libcbcf___pyx_scope_struct_21___iter__(PyObject *o, visitproc v, void *a) {
  int e;
  struct __pyx_obj_5pysam_7libcbcf___pyx_scope_struct_21___iter__ *p = (struct __pyx_obj_5pysam_7libcbcf___pyx_scope_struct_21___iter__ *)o;
  {
    e = __Pyx_call_type_traverse(o, 1, v, a);
    if (e) return e;
  }
  if (p->__pyx_v_self) {
    e = (*v)(((PyObject *)p->__pyx_v_self), a); if (e) return e;
  }
  return 0;
}
#if CYTHON_USE_TYPE_SPECS
static PyType_Slot __pyx_type_5pysam_7libcbcf___pyx_scope_struct_21___iter___slots[] = {
  {Py_tp_dealloc, (void *)__pyx_tp_dealloc_5pysam_7libcbcf___pyx_scope_struct_21___iter__},
  {Py_tp_traverse, (void *)__pyx_tp_traverse_5pysam_7libcbcf___pyx_scope_struct_21___iter__},
  {Py_tp_new, (void *)__pyx_tp_new_5pysam_7libcbcf___pyx_scope_struct_21___iter__},
  {0, 0},
};
static PyType_Spec __pyx_type_5pysam_7libcbcf___pyx_scope_struct_21___iter___spec = {
  "pysam.libcbcf.__pyx_scope_struct_21___iter__",
  sizeof(struct __pyx_obj_5pysam_7libcbcf___pyx_scope_struct_21___iter__),
  0,
  Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_VERSION_TAG|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_HAVE_GC|Py_TPFLAGS_HAVE_FINALIZE,
  __pyx_type_5pysam_7libcbcf___pyx_scope_struct_21___iter___slots,
};
#else

static PyTypeObject __pyx_type_5pysam_7libcbcf___pyx_scope_struct_21___iter__ = {
  PyVarObject_HEAD_INIT(0, 0)
  "pysam.libcbcf.""__pyx_scope_struct_21___iter__", /*tp_name*/
  sizeof(struct __pyx_obj_5pysam_7libcbcf___pyx_scope_struct_21___iter__), /*tp_basicsize*/
  0, /*tp_itemsize*/
  __pyx_tp_dealloc_5pysam_7libcbcf___pyx_scope_struct_21___iter__, /*tp_dealloc*/
  #if PY_VERSION_HEX < 0x030800b4
  0, /*tp_print*/
  #endif
  #if PY_VERSION_HEX >= 0x030800b4
  0, /*tp_vectorcall_offset*/
  #endif
  0, /*tp_getattr*/
  0, /*tp_setattr*/
  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|Py_TPFLAGS_HAVE_FINALIZE, /*tp_flags*/
  0, /*tp_doc*/
  __pyx_tp_traverse_5pysam_7libcbcf___pyx_scope_struct_21___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_5pysam_7libcbcf___pyx_scope_struct_21___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 PY_VERSION_HEX >= 0x030800b1 && (!CYTHON_COMPILING_IN_PYPY || PYPY_VERSION_NUM >= 0x07030800)
  0, /*tp_vectorcall*/
  #endif
  #if __PYX_NEED_TP_PRINT_SLOT == 1
  0, /*tp_print*/
  #endif
  #if PY_VERSION_HEX >= 0x030C0000
  0, /*tp_watched*/
  #endif
  #if 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_5pysam_7libcbcf___pyx_scope_struct_22_itervalues(PyTypeObject *t, CYTHON_UNUSED PyObject *a, CYTHON_UNUSED PyObject *k) {
  PyObject *o;
  #if CYTHON_COMPILING_IN_LIMITED_API
  allocfunc alloc_func = (allocfunc)PyType_GetSlot(t, Py_tp_alloc);
  o = alloc_func(t, 0);
  #else
  #if CYTHON_USE_FREELISTS
  if (likely((int)(__pyx_mstate_global->__pyx_freecount_5pysam_7libcbcf___pyx_scope_struct_22_itervalues > 0) & (int)(t->tp_basicsize == sizeof(struct __pyx_obj_5pysam_7libcbcf___pyx_scope_struct_22_itervalues)))) {
    o = (PyObject*)__pyx_mstate_global->__pyx_freelist_5pysam_7libcbcf___pyx_scope_struct_22_itervalues[--__pyx_mstate_global->__pyx_freecount_5pysam_7libcbcf___pyx_scope_struct_22_itervalues];
    memset(o, 0, sizeof(struct __pyx_obj_5pysam_7libcbcf___pyx_scope_struct_22_itervalues));
    (void) PyObject_INIT(o, t);
    PyObject_GC_Track(o);
  } else
  #endif
  {
    o = (*t->tp_alloc)(t, 0);
    if (unlikely(!o)) return 0;
  }
  #endif
  return o;
}

static void __pyx_tp_dealloc_5pysam_7libcbcf___pyx_scope_struct_22_itervalues(PyObject *o) {
  struct __pyx_obj_5pysam_7libcbcf___pyx_scope_struct_22_itervalues *p = (struct __pyx_obj_5pysam_7libcbcf___pyx_scope_struct_22_itervalues *)o;
  #if CYTHON_USE_TP_FINALIZE
  if (unlikely((PY_VERSION_HEX >= 0x03080000 || __Pyx_PyType_HasFeature(Py_TYPE(o), Py_TPFLAGS_HAVE_FINALIZE)) && __Pyx_PyObject_GetSlot(o, tp_finalize, destructor)) && !__Pyx_PyObject_GC_IsFinalized(o)) {
    if (__Pyx_PyObject_GetSlot(o, tp_dealloc, destructor) == __pyx_tp_dealloc_5pysam_7libcbcf___pyx_scope_struct_22_itervalues) {
      if (PyObject_CallFinalizerFromDealloc(o)) return;
    }
  }
  #endif
  PyObject_GC_UnTrack(o);
  Py_CLEAR(p->__pyx_v_key);
  Py_CLEAR(p->__pyx_v_self);
  Py_CLEAR(p->__pyx_t_0);
  #if CYTHON_USE_FREELISTS
  if (((int)(__pyx_mstate_global->__pyx_freecount_5pysam_7libcbcf___pyx_scope_struct_22_itervalues < 8) & (int)(Py_TYPE(o)->tp_basicsize == sizeof(struct __pyx_obj_5pysam_7libcbcf___pyx_scope_struct_22_itervalues)))) {
    __pyx_mstate_global->__pyx_freelist_5pysam_7libcbcf___pyx_scope_struct_22_itervalues[__pyx_mstate_global->__pyx_freecount_5pysam_7libcbcf___pyx_scope_struct_22_itervalues++] = ((struct __pyx_obj_5pysam_7libcbcf___pyx_scope_struct_22_itervalues *)o);
  } else
  #endif
  {
    #if CYTHON_USE_TYPE_SLOTS
    (*Py_TYPE(o)->tp_free)(o);
    #else
    {
      freefunc tp_free = (freefunc)PyType_GetSlot(Py_TYPE(o), Py_tp_free);
      if (tp_free) tp_free(o);
    }
    #endif
  }
}

static int __pyx_tp_traverse_5pysam_7libcbcf___pyx_scope_struct_22_itervalues(PyObject *o, visitproc v, void *a) {
  int e;
  struct __pyx_obj_5pysam_7libcbcf___pyx_scope_struct_22_itervalues *p = (struct __pyx_obj_5pysam_7libcbcf___pyx_scope_struct_22_itervalues *)o;
  {
    e = __Pyx_call_type_traverse(o, 1, v, a);
    if (e) return e;
  }
  if (p->__pyx_v_key) {
    e = (*v)(p->__pyx_v_key, 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_5pysam_7libcbcf___pyx_scope_struct_22_itervalues_slots[] = {
  {Py_tp_dealloc, (void *)__pyx_tp_dealloc_5pysam_7libcbcf___pyx_scope_struct_22_itervalues},
  {Py_tp_traverse, (void *)__pyx_tp_traverse_5pysam_7libcbcf___pyx_scope_struct_22_itervalues},
  {Py_tp_new, (void *)__pyx_tp_new_5pysam_7libcbcf___pyx_scope_struct_22_itervalues},
  {0, 0},
};
static PyType_Spec __pyx_type_5pysam_7libcbcf___pyx_scope_struct_22_itervalues_spec = {
  "pysam.libcbcf.__pyx_scope_struct_22_itervalues",
  sizeof(struct __pyx_obj_5pysam_7libcbcf___pyx_scope_struct_22_itervalues),
  0,
  Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_VERSION_TAG|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_HAVE_GC|Py_TPFLAGS_HAVE_FINALIZE,
  __pyx_type_5pysam_7libcbcf___pyx_scope_struct_22_itervalues_slots,
};
#else

static PyTypeObject __pyx_type_5pysam_7libcbcf___pyx_scope_struct_22_itervalues = {
  PyVarObject_HEAD_INIT(0, 0)
  "pysam.libcbcf.""__pyx_scope_struct_22_itervalues", /*tp_name*/
  sizeof(struct __pyx_obj_5pysam_7libcbcf___pyx_scope_struct_22_itervalues), /*tp_basicsize*/
  0, /*tp_itemsize*/
  __pyx_tp_dealloc_5pysam_7libcbcf___pyx_scope_struct_22_itervalues, /*tp_dealloc*/
  #if PY_VERSION_HEX < 0x030800b4
  0, /*tp_print*/
  #endif
  #if PY_VERSION_HEX >= 0x030800b4
  0, /*tp_vectorcall_offset*/
  #endif
  0, /*tp_getattr*/
  0, /*tp_setattr*/
  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|Py_TPFLAGS_HAVE_FINALIZE, /*tp_flags*/
  0, /*tp_doc*/
  __pyx_tp_traverse_5pysam_7libcbcf___pyx_scope_struct_22_itervalues, /*tp_traverse*/
  0, /*tp_clear*/
  0, /*tp_richcompare*/
  0, /*tp_weaklistoffset*/
  0, /*tp_iter*/
  0, /*tp_iternext*/
  0, /*tp_methods*/
  0, /*tp_members*/
  0, /*tp_getset*/
  0, /*tp_base*/
  0, /*tp_dict*/
  0, /*tp_descr_get*/
  0, /*tp_descr_set*/
  #if !CYTHON_USE_TYPE_SPECS
  0, /*tp_dictoffset*/
  #endif
  0, /*tp_init*/
  0, /*tp_alloc*/
  __pyx_tp_new_5pysam_7libcbcf___pyx_scope_struct_22_itervalues, /*tp_new*/
  0, /*tp_free*/
  0, /*tp_is_gc*/
  0, /*tp_bases*/
  0, /*tp_mro*/
  0, /*tp_cache*/
  0, /*tp_subclasses*/
  0, /*tp_weaklist*/
  0, /*tp_del*/
  0, /*tp_version_tag*/
  #if CYTHON_USE_TP_FINALIZE
  0, /*tp_finalize*/
  #else
  NULL, /*tp_finalize*/
  #endif
  #if PY_VERSION_HEX >= 0x030800b1 && (!CYTHON_COMPILING_IN_PYPY || PYPY_VERSION_NUM >= 0x07030800)
  0, /*tp_vectorcall*/
  #endif
  #if __PYX_NEED_TP_PRINT_SLOT == 1
  0, /*tp_print*/
  #endif
  #if PY_VERSION_HEX >= 0x030C0000
  0, /*tp_watched*/
  #endif
  #if 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_5pysam_7libcbcf___pyx_scope_struct_23_iteritems(PyTypeObject *t, CYTHON_UNUSED PyObject *a, CYTHON_UNUSED PyObject *k) {
  PyObject *o;
  #if CYTHON_COMPILING_IN_LIMITED_API
  allocfunc alloc_func = (allocfunc)PyType_GetSlot(t, Py_tp_alloc);
  o = alloc_func(t, 0);
  #else
  #if CYTHON_USE_FREELISTS
  if (likely((int)(__pyx_mstate_global->__pyx_freecount_5pysam_7libcbcf___pyx_scope_struct_23_iteritems > 0) & (int)(t->tp_basicsize == sizeof(struct __pyx_obj_5pysam_7libcbcf___pyx_scope_struct_23_iteritems)))) {
    o = (PyObject*)__pyx_mstate_global->__pyx_freelist_5pysam_7libcbcf___pyx_scope_struct_23_iteritems[--__pyx_mstate_global->__pyx_freecount_5pysam_7libcbcf___pyx_scope_struct_23_iteritems];
    memset(o, 0, sizeof(struct __pyx_obj_5pysam_7libcbcf___pyx_scope_struct_23_iteritems));
    (void) PyObject_INIT(o, t);
    PyObject_GC_Track(o);
  } else
  #endif
  {
    o = (*t->tp_alloc)(t, 0);
    if (unlikely(!o)) return 0;
  }
  #endif
  return o;
}

static void __pyx_tp_dealloc_5pysam_7libcbcf___pyx_scope_struct_23_iteritems(PyObject *o) {
  struct __pyx_obj_5pysam_7libcbcf___pyx_scope_struct_23_iteritems *p = (struct __pyx_obj_5pysam_7libcbcf___pyx_scope_struct_23_iteritems *)o;
  #if CYTHON_USE_TP_FINALIZE
  if (unlikely((PY_VERSION_HEX >= 0x03080000 || __Pyx_PyType_HasFeature(Py_TYPE(o), Py_TPFLAGS_HAVE_FINALIZE)) && __Pyx_PyObject_GetSlot(o, tp_finalize, destructor)) && !__Pyx_PyObject_GC_IsFinalized(o)) {
    if (__Pyx_PyObject_GetSlot(o, tp_dealloc, destructor) == __pyx_tp_dealloc_5pysam_7libcbcf___pyx_scope_struct_23_iteritems) {
      if (PyObject_CallFinalizerFromDealloc(o)) return;
    }
  }
  #endif
  PyObject_GC_UnTrack(o);
  Py_CLEAR(p->__pyx_v_key);
  Py_CLEAR(p->__pyx_v_self);
  Py_CLEAR(p->__pyx_t_0);
  #if CYTHON_USE_FREELISTS
  if (((int)(__pyx_mstate_global->__pyx_freecount_5pysam_7libcbcf___pyx_scope_struct_23_iteritems < 8) & (int)(Py_TYPE(o)->tp_basicsize == sizeof(struct __pyx_obj_5pysam_7libcbcf___pyx_scope_struct_23_iteritems)))) {
    __pyx_mstate_global->__pyx_freelist_5pysam_7libcbcf___pyx_scope_struct_23_iteritems[__pyx_mstate_global->__pyx_freecount_5pysam_7libcbcf___pyx_scope_struct_23_iteritems++] = ((struct __pyx_obj_5pysam_7libcbcf___pyx_scope_struct_23_iteritems *)o);
  } else
  #endif
  {
    #if CYTHON_USE_TYPE_SLOTS
    (*Py_TYPE(o)->tp_free)(o);
    #else
    {
      freefunc tp_free = (freefunc)PyType_GetSlot(Py_TYPE(o), Py_tp_free);
      if (tp_free) tp_free(o);
    }
    #endif
  }
}

static int __pyx_tp_traverse_5pysam_7libcbcf___pyx_scope_struct_23_iteritems(PyObject *o, visitproc v, void *a) {
  int e;
  struct __pyx_obj_5pysam_7libcbcf___pyx_scope_struct_23_iteritems *p = (struct __pyx_obj_5pysam_7libcbcf___pyx_scope_struct_23_iteritems *)o;
  {
    e = __Pyx_call_type_traverse(o, 1, v, a);
    if (e) return e;
  }
  if (p->__pyx_v_key) {
    e = (*v)(p->__pyx_v_key, 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_5pysam_7libcbcf___pyx_scope_struct_23_iteritems_slots[] = {
  {Py_tp_dealloc, (void *)__pyx_tp_dealloc_5pysam_7libcbcf___pyx_scope_struct_23_iteritems},
  {Py_tp_traverse, (void *)__pyx_tp_traverse_5pysam_7libcbcf___pyx_scope_struct_23_iteritems},
  {Py_tp_new, (void *)__pyx_tp_new_5pysam_7libcbcf___pyx_scope_struct_23_iteritems},
  {0, 0},
};
static PyType_Spec __pyx_type_5pysam_7libcbcf___pyx_scope_struct_23_iteritems_spec = {
  "pysam.libcbcf.__pyx_scope_struct_23_iteritems",
  sizeof(struct __pyx_obj_5pysam_7libcbcf___pyx_scope_struct_23_iteritems),
  0,
  Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_VERSION_TAG|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_HAVE_GC|Py_TPFLAGS_HAVE_FINALIZE,
  __pyx_type_5pysam_7libcbcf___pyx_scope_struct_23_iteritems_slots,
};
#else

static PyTypeObject __pyx_type_5pysam_7libcbcf___pyx_scope_struct_23_iteritems = {
  PyVarObject_HEAD_INIT(0, 0)
  "pysam.libcbcf.""__pyx_scope_struct_23_iteritems", /*tp_name*/
  sizeof(struct __pyx_obj_5pysam_7libcbcf___pyx_scope_struct_23_iteritems), /*tp_basicsize*/
  0, /*tp_itemsize*/
  __pyx_tp_dealloc_5pysam_7libcbcf___pyx_scope_struct_23_iteritems, /*tp_dealloc*/
  #if PY_VERSION_HEX < 0x030800b4
  0, /*tp_print*/
  #endif
  #if PY_VERSION_HEX >= 0x030800b4
  0, /*tp_vectorcall_offset*/
  #endif
  0, /*tp_getattr*/
  0, /*tp_setattr*/
  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|Py_TPFLAGS_HAVE_FINALIZE, /*tp_flags*/
  0, /*tp_doc*/
  __pyx_tp_traverse_5pysam_7libcbcf___pyx_scope_struct_23_iteritems, /*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_5pysam_7libcbcf___pyx_scope_struct_23_iteritems, /*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 PY_VERSION_HEX >= 0x030800b1 && (!CYTHON_COMPILING_IN_PYPY || PYPY_VERSION_NUM >= 0x07030800)
  0, /*tp_vectorcall*/
  #endif
  #if __PYX_NEED_TP_PRINT_SLOT == 1
  0, /*tp_print*/
  #endif
  #if PY_VERSION_HEX >= 0x030C0000
  0, /*tp_watched*/
  #endif
  #if 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_5pysam_7libcbcf___pyx_scope_struct_24___iter__(PyTypeObject *t, CYTHON_UNUSED PyObject *a, CYTHON_UNUSED PyObject *k) {
  PyObject *o;
  #if CYTHON_COMPILING_IN_LIMITED_API
  allocfunc alloc_func = (allocfunc)PyType_GetSlot(t, Py_tp_alloc);
  o = alloc_func(t, 0);
  #else
  #if CYTHON_USE_FREELISTS
  if (likely((int)(__pyx_mstate_global->__pyx_freecount_5pysam_7libcbcf___pyx_scope_struct_24___iter__ > 0) & (int)(t->tp_basicsize == sizeof(struct __pyx_obj_5pysam_7libcbcf___pyx_scope_struct_24___iter__)))) {
    o = (PyObject*)__pyx_mstate_global->__pyx_freelist_5pysam_7libcbcf___pyx_scope_struct_24___iter__[--__pyx_mstate_global->__pyx_freecount_5pysam_7libcbcf___pyx_scope_struct_24___iter__];
    memset(o, 0, sizeof(struct __pyx_obj_5pysam_7libcbcf___pyx_scope_struct_24___iter__));
    (void) PyObject_INIT(o, t);
    PyObject_GC_Track(o);
  } else
  #endif
  {
    o = (*t->tp_alloc)(t, 0);
    if (unlikely(!o)) return 0;
  }
  #endif
  return o;
}

static void __pyx_tp_dealloc_5pysam_7libcbcf___pyx_scope_struct_24___iter__(PyObject *o) {
  struct __pyx_obj_5pysam_7libcbcf___pyx_scope_struct_24___iter__ *p = (struct __pyx_obj_5pysam_7libcbcf___pyx_scope_struct_24___iter__ *)o;
  #if CYTHON_USE_TP_FINALIZE
  if (unlikely((PY_VERSION_HEX >= 0x03080000 || __Pyx_PyType_HasFeature(Py_TYPE(o), Py_TPFLAGS_HAVE_FINALIZE)) && __Pyx_PyObject_GetSlot(o, tp_finalize, destructor)) && !__Pyx_PyObject_GC_IsFinalized(o)) {
    if (__Pyx_PyObject_GetSlot(o, tp_dealloc, destructor) == __pyx_tp_dealloc_5pysam_7libcbcf___pyx_scope_struct_24___iter__) {
      if (PyObject_CallFinalizerFromDealloc(o)) return;
    }
  }
  #endif
  PyObject_GC_UnTrack(o);
  Py_CLEAR(p->__pyx_v_self);
  #if CYTHON_USE_FREELISTS
  if (((int)(__pyx_mstate_global->__pyx_freecount_5pysam_7libcbcf___pyx_scope_struct_24___iter__ < 8) & (int)(Py_TYPE(o)->tp_basicsize == sizeof(struct __pyx_obj_5pysam_7libcbcf___pyx_scope_struct_24___iter__)))) {
    __pyx_mstate_global->__pyx_freelist_5pysam_7libcbcf___pyx_scope_struct_24___iter__[__pyx_mstate_global->__pyx_freecount_5pysam_7libcbcf___pyx_scope_struct_24___iter__++] = ((struct __pyx_obj_5pysam_7libcbcf___pyx_scope_struct_24___iter__ *)o);
  } else
  #endif
  {
    #if CYTHON_USE_TYPE_SLOTS
    (*Py_TYPE(o)->tp_free)(o);
    #else
    {
      freefunc tp_free = (freefunc)PyType_GetSlot(Py_TYPE(o), Py_tp_free);
      if (tp_free) tp_free(o);
    }
    #endif
  }
}

static int __pyx_tp_traverse_5pysam_7libcbcf___pyx_scope_struct_24___iter__(PyObject *o, visitproc v, void *a) {
  int e;
  struct __pyx_obj_5pysam_7libcbcf___pyx_scope_struct_24___iter__ *p = (struct __pyx_obj_5pysam_7libcbcf___pyx_scope_struct_24___iter__ *)o;
  {
    e = __Pyx_call_type_traverse(o, 1, v, a);
    if (e) return e;
  }
  if (p->__pyx_v_self) {
    e = (*v)(((PyObject *)p->__pyx_v_self), a); if (e) return e;
  }
  return 0;
}
#if CYTHON_USE_TYPE_SPECS
static PyType_Slot __pyx_type_5pysam_7libcbcf___pyx_scope_struct_24___iter___slots[] = {
  {Py_tp_dealloc, (void *)__pyx_tp_dealloc_5pysam_7libcbcf___pyx_scope_struct_24___iter__},
  {Py_tp_traverse, (void *)__pyx_tp_traverse_5pysam_7libcbcf___pyx_scope_struct_24___iter__},
  {Py_tp_new, (void *)__pyx_tp_new_5pysam_7libcbcf___pyx_scope_struct_24___iter__},
  {0, 0},
};
static PyType_Spec __pyx_type_5pysam_7libcbcf___pyx_scope_struct_24___iter___spec = {
  "pysam.libcbcf.__pyx_scope_struct_24___iter__",
  sizeof(struct __pyx_obj_5pysam_7libcbcf___pyx_scope_struct_24___iter__),
  0,
  Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_VERSION_TAG|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_HAVE_GC|Py_TPFLAGS_HAVE_FINALIZE,
  __pyx_type_5pysam_7libcbcf___pyx_scope_struct_24___iter___slots,
};
#else

static PyTypeObject __pyx_type_5pysam_7libcbcf___pyx_scope_struct_24___iter__ = {
  PyVarObject_HEAD_INIT(0, 0)
  "pysam.libcbcf.""__pyx_scope_struct_24___iter__", /*tp_name*/
  sizeof(struct __pyx_obj_5pysam_7libcbcf___pyx_scope_struct_24___iter__), /*tp_basicsize*/
  0, /*tp_itemsize*/
  __pyx_tp_dealloc_5pysam_7libcbcf___pyx_scope_struct_24___iter__, /*tp_dealloc*/
  #if PY_VERSION_HEX < 0x030800b4
  0, /*tp_print*/
  #endif
  #if PY_VERSION_HEX >= 0x030800b4
  0, /*tp_vectorcall_offset*/
  #endif
  0, /*tp_getattr*/
  0, /*tp_setattr*/
  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|Py_TPFLAGS_HAVE_FINALIZE, /*tp_flags*/
  0, /*tp_doc*/
  __pyx_tp_traverse_5pysam_7libcbcf___pyx_scope_struct_24___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_5pysam_7libcbcf___pyx_scope_struct_24___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 PY_VERSION_HEX >= 0x030800b1 && (!CYTHON_COMPILING_IN_PYPY || PYPY_VERSION_NUM >= 0x07030800)
  0, /*tp_vectorcall*/
  #endif
  #if __PYX_NEED_TP_PRINT_SLOT == 1
  0, /*tp_print*/
  #endif
  #if PY_VERSION_HEX >= 0x030C0000
  0, /*tp_watched*/
  #endif
  #if 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_5pysam_7libcbcf___pyx_scope_struct_25_itervalues(PyTypeObject *t, CYTHON_UNUSED PyObject *a, CYTHON_UNUSED PyObject *k) {
  PyObject *o;
  #if CYTHON_COMPILING_IN_LIMITED_API
  allocfunc alloc_func = (allocfunc)PyType_GetSlot(t, Py_tp_alloc);
  o = alloc_func(t, 0);
  #else
  #if CYTHON_USE_FREELISTS
  if (likely((int)(__pyx_mstate_global->__pyx_freecount_5pysam_7libcbcf___pyx_scope_struct_25_itervalues > 0) & (int)(t->tp_basicsize == sizeof(struct __pyx_obj_5pysam_7libcbcf___pyx_scope_struct_25_itervalues)))) {
    o = (PyObject*)__pyx_mstate_global->__pyx_freelist_5pysam_7libcbcf___pyx_scope_struct_25_itervalues[--__pyx_mstate_global->__pyx_freecount_5pysam_7libcbcf___pyx_scope_struct_25_itervalues];
    memset(o, 0, sizeof(struct __pyx_obj_5pysam_7libcbcf___pyx_scope_struct_25_itervalues));
    (void) PyObject_INIT(o, t);
    PyObject_GC_Track(o);
  } else
  #endif
  {
    o = (*t->tp_alloc)(t, 0);
    if (unlikely(!o)) return 0;
  }
  #endif
  return o;
}

static void __pyx_tp_dealloc_5pysam_7libcbcf___pyx_scope_struct_25_itervalues(PyObject *o) {
  struct __pyx_obj_5pysam_7libcbcf___pyx_scope_struct_25_itervalues *p = (struct __pyx_obj_5pysam_7libcbcf___pyx_scope_struct_25_itervalues *)o;
  #if CYTHON_USE_TP_FINALIZE
  if (unlikely((PY_VERSION_HEX >= 0x03080000 || __Pyx_PyType_HasFeature(Py_TYPE(o), Py_TPFLAGS_HAVE_FINALIZE)) && __Pyx_PyObject_GetSlot(o, tp_finalize, destructor)) && !__Pyx_PyObject_GC_IsFinalized(o)) {
    if (__Pyx_PyObject_GetSlot(o, tp_dealloc, destructor) == __pyx_tp_dealloc_5pysam_7libcbcf___pyx_scope_struct_25_itervalues) {
      if (PyObject_CallFinalizerFromDealloc(o)) return;
    }
  }
  #endif
  PyObject_GC_UnTrack(o);
  Py_CLEAR(p->__pyx_v_self);
  #if CYTHON_USE_FREELISTS
  if (((int)(__pyx_mstate_global->__pyx_freecount_5pysam_7libcbcf___pyx_scope_struct_25_itervalues < 8) & (int)(Py_TYPE(o)->tp_basicsize == sizeof(struct __pyx_obj_5pysam_7libcbcf___pyx_scope_struct_25_itervalues)))) {
    __pyx_mstate_global->__pyx_freelist_5pysam_7libcbcf___pyx_scope_struct_25_itervalues[__pyx_mstate_global->__pyx_freecount_5pysam_7libcbcf___pyx_scope_struct_25_itervalues++] = ((struct __pyx_obj_5pysam_7libcbcf___pyx_scope_struct_25_itervalues *)o);
  } else
  #endif
  {
    #if CYTHON_USE_TYPE_SLOTS
    (*Py_TYPE(o)->tp_free)(o);
    #else
    {
      freefunc tp_free = (freefunc)PyType_GetSlot(Py_TYPE(o), Py_tp_free);
      if (tp_free) tp_free(o);
    }
    #endif
  }
}

static int __pyx_tp_traverse_5pysam_7libcbcf___pyx_scope_struct_25_itervalues(PyObject *o, visitproc v, void *a) {
  int e;
  struct __pyx_obj_5pysam_7libcbcf___pyx_scope_struct_25_itervalues *p = (struct __pyx_obj_5pysam_7libcbcf___pyx_scope_struct_25_itervalues *)o;
  {
    e = __Pyx_call_type_traverse(o, 1, v, a);
    if (e) return e;
  }
  if (p->__pyx_v_self) {
    e = (*v)(((PyObject *)p->__pyx_v_self), a); if (e) return e;
  }
  return 0;
}
#if CYTHON_USE_TYPE_SPECS
static PyType_Slot __pyx_type_5pysam_7libcbcf___pyx_scope_struct_25_itervalues_slots[] = {
  {Py_tp_dealloc, (void *)__pyx_tp_dealloc_5pysam_7libcbcf___pyx_scope_struct_25_itervalues},
  {Py_tp_traverse, (void *)__pyx_tp_traverse_5pysam_7libcbcf___pyx_scope_struct_25_itervalues},
  {Py_tp_new, (void *)__pyx_tp_new_5pysam_7libcbcf___pyx_scope_struct_25_itervalues},
  {0, 0},
};
static PyType_Spec __pyx_type_5pysam_7libcbcf___pyx_scope_struct_25_itervalues_spec = {
  "pysam.libcbcf.__pyx_scope_struct_25_itervalues",
  sizeof(struct __pyx_obj_5pysam_7libcbcf___pyx_scope_struct_25_itervalues),
  0,
  Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_VERSION_TAG|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_HAVE_GC|Py_TPFLAGS_HAVE_FINALIZE,
  __pyx_type_5pysam_7libcbcf___pyx_scope_struct_25_itervalues_slots,
};
#else

static PyTypeObject __pyx_type_5pysam_7libcbcf___pyx_scope_struct_25_itervalues = {
  PyVarObject_HEAD_INIT(0, 0)
  "pysam.libcbcf.""__pyx_scope_struct_25_itervalues", /*tp_name*/
  sizeof(struct __pyx_obj_5pysam_7libcbcf___pyx_scope_struct_25_itervalues), /*tp_basicsize*/
  0, /*tp_itemsize*/
  __pyx_tp_dealloc_5pysam_7libcbcf___pyx_scope_struct_25_itervalues, /*tp_dealloc*/
  #if PY_VERSION_HEX < 0x030800b4
  0, /*tp_print*/
  #endif
  #if PY_VERSION_HEX >= 0x030800b4
  0, /*tp_vectorcall_offset*/
  #endif
  0, /*tp_getattr*/
  0, /*tp_setattr*/
  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|Py_TPFLAGS_HAVE_FINALIZE, /*tp_flags*/
  0, /*tp_doc*/
  __pyx_tp_traverse_5pysam_7libcbcf___pyx_scope_struct_25_itervalues, /*tp_traverse*/
  0, /*tp_clear*/
  0, /*tp_richcompare*/
  0, /*tp_weaklistoffset*/
  0, /*tp_iter*/
  0, /*tp_iternext*/
  0, /*tp_methods*/
  0, /*tp_members*/
  0, /*tp_getset*/
  0, /*tp_base*/
  0, /*tp_dict*/
  0, /*tp_descr_get*/
  0, /*tp_descr_set*/
  #if !CYTHON_USE_TYPE_SPECS
  0, /*tp_dictoffset*/
  #endif
  0, /*tp_init*/
  0, /*tp_alloc*/
  __pyx_tp_new_5pysam_7libcbcf___pyx_scope_struct_25_itervalues, /*tp_new*/
  0, /*tp_free*/
  0, /*tp_is_gc*/
  0, /*tp_bases*/
  0, /*tp_mro*/
  0, /*tp_cache*/
  0, /*tp_subclasses*/
  0, /*tp_weaklist*/
  0, /*tp_del*/
  0, /*tp_version_tag*/
  #if CYTHON_USE_TP_FINALIZE
  0, /*tp_finalize*/
  #else
  NULL, /*tp_finalize*/
  #endif
  #if PY_VERSION_HEX >= 0x030800b1 && (!CYTHON_COMPILING_IN_PYPY || PYPY_VERSION_NUM >= 0x07030800)
  0, /*tp_vectorcall*/
  #endif
  #if __PYX_NEED_TP_PRINT_SLOT == 1
  0, /*tp_print*/
  #endif
  #if PY_VERSION_HEX >= 0x030C0000
  0, /*tp_watched*/
  #endif
  #if 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_5pysam_7libcbcf___pyx_scope_struct_26_iteritems(PyTypeObject *t, CYTHON_UNUSED PyObject *a, CYTHON_UNUSED PyObject *k) {
  PyObject *o;
  #if CYTHON_COMPILING_IN_LIMITED_API
  allocfunc alloc_func = (allocfunc)PyType_GetSlot(t, Py_tp_alloc);
  o = alloc_func(t, 0);
  #else
  #if CYTHON_USE_FREELISTS
  if (likely((int)(__pyx_mstate_global->__pyx_freecount_5pysam_7libcbcf___pyx_scope_struct_26_iteritems > 0) & (int)(t->tp_basicsize == sizeof(struct __pyx_obj_5pysam_7libcbcf___pyx_scope_struct_26_iteritems)))) {
    o = (PyObject*)__pyx_mstate_global->__pyx_freelist_5pysam_7libcbcf___pyx_scope_struct_26_iteritems[--__pyx_mstate_global->__pyx_freecount_5pysam_7libcbcf___pyx_scope_struct_26_iteritems];
    memset(o, 0, sizeof(struct __pyx_obj_5pysam_7libcbcf___pyx_scope_struct_26_iteritems));
    (void) PyObject_INIT(o, t);
    PyObject_GC_Track(o);
  } else
  #endif
  {
    o = (*t->tp_alloc)(t, 0);
    if (unlikely(!o)) return 0;
  }
  #endif
  return o;
}

static void __pyx_tp_dealloc_5pysam_7libcbcf___pyx_scope_struct_26_iteritems(PyObject *o) {
  struct __pyx_obj_5pysam_7libcbcf___pyx_scope_struct_26_iteritems *p = (struct __pyx_obj_5pysam_7libcbcf___pyx_scope_struct_26_iteritems *)o;
  #if CYTHON_USE_TP_FINALIZE
  if (unlikely((PY_VERSION_HEX >= 0x03080000 || __Pyx_PyType_HasFeature(Py_TYPE(o), Py_TPFLAGS_HAVE_FINALIZE)) && __Pyx_PyObject_GetSlot(o, tp_finalize, destructor)) && !__Pyx_PyObject_GC_IsFinalized(o)) {
    if (__Pyx_PyObject_GetSlot(o, tp_dealloc, destructor) == __pyx_tp_dealloc_5pysam_7libcbcf___pyx_scope_struct_26_iteritems) {
      if (PyObject_CallFinalizerFromDealloc(o)) return;
    }
  }
  #endif
  PyObject_GC_UnTrack(o);
  Py_CLEAR(p->__pyx_v_self);
  Py_CLEAR(p->__pyx_v_value);
  #if CYTHON_USE_FREELISTS
  if (((int)(__pyx_mstate_global->__pyx_freecount_5pysam_7libcbcf___pyx_scope_struct_26_iteritems < 8) & (int)(Py_TYPE(o)->tp_basicsize == sizeof(struct __pyx_obj_5pysam_7libcbcf___pyx_scope_struct_26_iteritems)))) {
    __pyx_mstate_global->__pyx_freelist_5pysam_7libcbcf___pyx_scope_struct_26_iteritems[__pyx_mstate_global->__pyx_freecount_5pysam_7libcbcf___pyx_scope_struct_26_iteritems++] = ((struct __pyx_obj_5pysam_7libcbcf___pyx_scope_struct_26_iteritems *)o);
  } else
  #endif
  {
    #if CYTHON_USE_TYPE_SLOTS
    (*Py_TYPE(o)->tp_free)(o);
    #else
    {
      freefunc tp_free = (freefunc)PyType_GetSlot(Py_TYPE(o), Py_tp_free);
      if (tp_free) tp_free(o);
    }
    #endif
  }
}

static int __pyx_tp_traverse_5pysam_7libcbcf___pyx_scope_struct_26_iteritems(PyObject *o, visitproc v, void *a) {
  int e;
  struct __pyx_obj_5pysam_7libcbcf___pyx_scope_struct_26_iteritems *p = (struct __pyx_obj_5pysam_7libcbcf___pyx_scope_struct_26_iteritems *)o;
  {
    e = __Pyx_call_type_traverse(o, 1, v, 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_value) {
    e = (*v)(p->__pyx_v_value, a); if (e) return e;
  }
  return 0;
}
#if CYTHON_USE_TYPE_SPECS
static PyType_Slot __pyx_type_5pysam_7libcbcf___pyx_scope_struct_26_iteritems_slots[] = {
  {Py_tp_dealloc, (void *)__pyx_tp_dealloc_5pysam_7libcbcf___pyx_scope_struct_26_iteritems},
  {Py_tp_traverse, (void *)__pyx_tp_traverse_5pysam_7libcbcf___pyx_scope_struct_26_iteritems},
  {Py_tp_new, (void *)__pyx_tp_new_5pysam_7libcbcf___pyx_scope_struct_26_iteritems},
  {0, 0},
};
static PyType_Spec __pyx_type_5pysam_7libcbcf___pyx_scope_struct_26_iteritems_spec = {
  "pysam.libcbcf.__pyx_scope_struct_26_iteritems",
  sizeof(struct __pyx_obj_5pysam_7libcbcf___pyx_scope_struct_26_iteritems),
  0,
  Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_VERSION_TAG|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_HAVE_GC|Py_TPFLAGS_HAVE_FINALIZE,
  __pyx_type_5pysam_7libcbcf___pyx_scope_struct_26_iteritems_slots,
};
#else

static PyTypeObject __pyx_type_5pysam_7libcbcf___pyx_scope_struct_26_iteritems = {
  PyVarObject_HEAD_INIT(0, 0)
  "pysam.libcbcf.""__pyx_scope_struct_26_iteritems", /*tp_name*/
  sizeof(struct __pyx_obj_5pysam_7libcbcf___pyx_scope_struct_26_iteritems), /*tp_basicsize*/
  0, /*tp_itemsize*/
  __pyx_tp_dealloc_5pysam_7libcbcf___pyx_scope_struct_26_iteritems, /*tp_dealloc*/
  #if PY_VERSION_HEX < 0x030800b4
  0, /*tp_print*/
  #endif
  #if PY_VERSION_HEX >= 0x030800b4
  0, /*tp_vectorcall_offset*/
  #endif
  0, /*tp_getattr*/
  0, /*tp_setattr*/
  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|Py_TPFLAGS_HAVE_FINALIZE, /*tp_flags*/
  0, /*tp_doc*/
  __pyx_tp_traverse_5pysam_7libcbcf___pyx_scope_struct_26_iteritems, /*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_5pysam_7libcbcf___pyx_scope_struct_26_iteritems, /*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 PY_VERSION_HEX >= 0x030800b1 && (!CYTHON_COMPILING_IN_PYPY || PYPY_VERSION_NUM >= 0x07030800)
  0, /*tp_vectorcall*/
  #endif
  #if __PYX_NEED_TP_PRINT_SLOT == 1
  0, /*tp_print*/
  #endif
  #if PY_VERSION_HEX >= 0x030C0000
  0, /*tp_watched*/
  #endif
  #if 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_5pysam_7libcbcf___pyx_scope_struct_27___iter__(PyTypeObject *t, CYTHON_UNUSED PyObject *a, CYTHON_UNUSED PyObject *k) {
  PyObject *o;
  #if CYTHON_COMPILING_IN_LIMITED_API
  allocfunc alloc_func = (allocfunc)PyType_GetSlot(t, Py_tp_alloc);
  o = alloc_func(t, 0);
  #else
  #if CYTHON_USE_FREELISTS
  if (likely((int)(__pyx_mstate_global->__pyx_freecount_5pysam_7libcbcf___pyx_scope_struct_27___iter__ > 0) & (int)(t->tp_basicsize == sizeof(struct __pyx_obj_5pysam_7libcbcf___pyx_scope_struct_27___iter__)))) {
    o = (PyObject*)__pyx_mstate_global->__pyx_freelist_5pysam_7libcbcf___pyx_scope_struct_27___iter__[--__pyx_mstate_global->__pyx_freecount_5pysam_7libcbcf___pyx_scope_struct_27___iter__];
    memset(o, 0, sizeof(struct __pyx_obj_5pysam_7libcbcf___pyx_scope_struct_27___iter__));
    (void) PyObject_INIT(o, t);
    PyObject_GC_Track(o);
  } else
  #endif
  {
    o = (*t->tp_alloc)(t, 0);
    if (unlikely(!o)) return 0;
  }
  #endif
  return o;
}

static void __pyx_tp_dealloc_5pysam_7libcbcf___pyx_scope_struct_27___iter__(PyObject *o) {
  struct __pyx_obj_5pysam_7libcbcf___pyx_scope_struct_27___iter__ *p = (struct __pyx_obj_5pysam_7libcbcf___pyx_scope_struct_27___iter__ *)o;
  #if CYTHON_USE_TP_FINALIZE
  if (unlikely((PY_VERSION_HEX >= 0x03080000 || __Pyx_PyType_HasFeature(Py_TYPE(o), Py_TPFLAGS_HAVE_FINALIZE)) && __Pyx_PyObject_GetSlot(o, tp_finalize, destructor)) && !__Pyx_PyObject_GC_IsFinalized(o)) {
    if (__Pyx_PyObject_GetSlot(o, tp_dealloc, destructor) == __pyx_tp_dealloc_5pysam_7libcbcf___pyx_scope_struct_27___iter__) {
      if (PyObject_CallFinalizerFromDealloc(o)) return;
    }
  }
  #endif
  PyObject_GC_UnTrack(o);
  Py_CLEAR(p->__pyx_v_self);
  #if CYTHON_USE_FREELISTS
  if (((int)(__pyx_mstate_global->__pyx_freecount_5pysam_7libcbcf___pyx_scope_struct_27___iter__ < 8) & (int)(Py_TYPE(o)->tp_basicsize == sizeof(struct __pyx_obj_5pysam_7libcbcf___pyx_scope_struct_27___iter__)))) {
    __pyx_mstate_global->__pyx_freelist_5pysam_7libcbcf___pyx_scope_struct_27___iter__[__pyx_mstate_global->__pyx_freecount_5pysam_7libcbcf___pyx_scope_struct_27___iter__++] = ((struct __pyx_obj_5pysam_7libcbcf___pyx_scope_struct_27___iter__ *)o);
  } else
  #endif
  {
    #if CYTHON_USE_TYPE_SLOTS
    (*Py_TYPE(o)->tp_free)(o);
    #else
    {
      freefunc tp_free = (freefunc)PyType_GetSlot(Py_TYPE(o), Py_tp_free);
      if (tp_free) tp_free(o);
    }
    #endif
  }
}

static int __pyx_tp_traverse_5pysam_7libcbcf___pyx_scope_struct_27___iter__(PyObject *o, visitproc v, void *a) {
  int e;
  struct __pyx_obj_5pysam_7libcbcf___pyx_scope_struct_27___iter__ *p = (struct __pyx_obj_5pysam_7libcbcf___pyx_scope_struct_27___iter__ *)o;
  {
    e = __Pyx_call_type_traverse(o, 1, v, a);
    if (e) return e;
  }
  if (p->__pyx_v_self) {
    e = (*v)(((PyObject *)p->__pyx_v_self), a); if (e) return e;
  }
  return 0;
}
#if CYTHON_USE_TYPE_SPECS
static PyType_Slot __pyx_type_5pysam_7libcbcf___pyx_scope_struct_27___iter___slots[] = {
  {Py_tp_dealloc, (void *)__pyx_tp_dealloc_5pysam_7libcbcf___pyx_scope_struct_27___iter__},
  {Py_tp_traverse, (void *)__pyx_tp_traverse_5pysam_7libcbcf___pyx_scope_struct_27___iter__},
  {Py_tp_new, (void *)__pyx_tp_new_5pysam_7libcbcf___pyx_scope_struct_27___iter__},
  {0, 0},
};
static PyType_Spec __pyx_type_5pysam_7libcbcf___pyx_scope_struct_27___iter___spec = {
  "pysam.libcbcf.__pyx_scope_struct_27___iter__",
  sizeof(struct __pyx_obj_5pysam_7libcbcf___pyx_scope_struct_27___iter__),
  0,
  Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_VERSION_TAG|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_HAVE_GC|Py_TPFLAGS_HAVE_FINALIZE,
  __pyx_type_5pysam_7libcbcf___pyx_scope_struct_27___iter___slots,
};
#else

static PyTypeObject __pyx_type_5pysam_7libcbcf___pyx_scope_struct_27___iter__ = {
  PyVarObject_HEAD_INIT(0, 0)
  "pysam.libcbcf.""__pyx_scope_struct_27___iter__", /*tp_name*/
  sizeof(struct __pyx_obj_5pysam_7libcbcf___pyx_scope_struct_27___iter__), /*tp_basicsize*/
  0, /*tp_itemsize*/
  __pyx_tp_dealloc_5pysam_7libcbcf___pyx_scope_struct_27___iter__, /*tp_dealloc*/
  #if PY_VERSION_HEX < 0x030800b4
  0, /*tp_print*/
  #endif
  #if PY_VERSION_HEX >= 0x030800b4
  0, /*tp_vectorcall_offset*/
  #endif
  0, /*tp_getattr*/
  0, /*tp_setattr*/
  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|Py_TPFLAGS_HAVE_FINALIZE, /*tp_flags*/
  0, /*tp_doc*/
  __pyx_tp_traverse_5pysam_7libcbcf___pyx_scope_struct_27___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_5pysam_7libcbcf___pyx_scope_struct_27___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 PY_VERSION_HEX >= 0x030800b1 && (!CYTHON_COMPILING_IN_PYPY || PYPY_VERSION_NUM >= 0x07030800)
  0, /*tp_vectorcall*/
  #endif
  #if __PYX_NEED_TP_PRINT_SLOT == 1
  0, /*tp_print*/
  #endif
  #if PY_VERSION_HEX >= 0x030C0000
  0, /*tp_watched*/
  #endif
  #if 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_5pysam_7libcbcf___pyx_scope_struct_28_itervalues(PyTypeObject *t, CYTHON_UNUSED PyObject *a, CYTHON_UNUSED PyObject *k) {
  PyObject *o;
  #if CYTHON_COMPILING_IN_LIMITED_API
  allocfunc alloc_func = (allocfunc)PyType_GetSlot(t, Py_tp_alloc);
  o = alloc_func(t, 0);
  #else
  #if CYTHON_USE_FREELISTS
  if (likely((int)(__pyx_mstate_global->__pyx_freecount_5pysam_7libcbcf___pyx_scope_struct_28_itervalues > 0) & (int)(t->tp_basicsize == sizeof(struct __pyx_obj_5pysam_7libcbcf___pyx_scope_struct_28_itervalues)))) {
    o = (PyObject*)__pyx_mstate_global->__pyx_freelist_5pysam_7libcbcf___pyx_scope_struct_28_itervalues[--__pyx_mstate_global->__pyx_freecount_5pysam_7libcbcf___pyx_scope_struct_28_itervalues];
    memset(o, 0, sizeof(struct __pyx_obj_5pysam_7libcbcf___pyx_scope_struct_28_itervalues));
    (void) PyObject_INIT(o, t);
    PyObject_GC_Track(o);
  } else
  #endif
  {
    o = (*t->tp_alloc)(t, 0);
    if (unlikely(!o)) return 0;
  }
  #endif
  return o;
}

static void __pyx_tp_dealloc_5pysam_7libcbcf___pyx_scope_struct_28_itervalues(PyObject *o) {
  struct __pyx_obj_5pysam_7libcbcf___pyx_scope_struct_28_itervalues *p = (struct __pyx_obj_5pysam_7libcbcf___pyx_scope_struct_28_itervalues *)o;
  #if CYTHON_USE_TP_FINALIZE
  if (unlikely((PY_VERSION_HEX >= 0x03080000 || __Pyx_PyType_HasFeature(Py_TYPE(o), Py_TPFLAGS_HAVE_FINALIZE)) && __Pyx_PyObject_GetSlot(o, tp_finalize, destructor)) && !__Pyx_PyObject_GC_IsFinalized(o)) {
    if (__Pyx_PyObject_GetSlot(o, tp_dealloc, destructor) == __pyx_tp_dealloc_5pysam_7libcbcf___pyx_scope_struct_28_itervalues) {
      if (PyObject_CallFinalizerFromDealloc(o)) return;
    }
  }
  #endif
  PyObject_GC_UnTrack(o);
  Py_CLEAR(p->__pyx_v_self);
  #if CYTHON_USE_FREELISTS
  if (((int)(__pyx_mstate_global->__pyx_freecount_5pysam_7libcbcf___pyx_scope_struct_28_itervalues < 8) & (int)(Py_TYPE(o)->tp_basicsize == sizeof(struct __pyx_obj_5pysam_7libcbcf___pyx_scope_struct_28_itervalues)))) {
    __pyx_mstate_global->__pyx_freelist_5pysam_7libcbcf___pyx_scope_struct_28_itervalues[__pyx_mstate_global->__pyx_freecount_5pysam_7libcbcf___pyx_scope_struct_28_itervalues++] = ((struct __pyx_obj_5pysam_7libcbcf___pyx_scope_struct_28_itervalues *)o);
  } else
  #endif
  {
    #if CYTHON_USE_TYPE_SLOTS
    (*Py_TYPE(o)->tp_free)(o);
    #else
    {
      freefunc tp_free = (freefunc)PyType_GetSlot(Py_TYPE(o), Py_tp_free);
      if (tp_free) tp_free(o);
    }
    #endif
  }
}

static int __pyx_tp_traverse_5pysam_7libcbcf___pyx_scope_struct_28_itervalues(PyObject *o, visitproc v, void *a) {
  int e;
  struct __pyx_obj_5pysam_7libcbcf___pyx_scope_struct_28_itervalues *p = (struct __pyx_obj_5pysam_7libcbcf___pyx_scope_struct_28_itervalues *)o;
  {
    e = __Pyx_call_type_traverse(o, 1, v, a);
    if (e) return e;
  }
  if (p->__pyx_v_self) {
    e = (*v)(((PyObject *)p->__pyx_v_self), a); if (e) return e;
  }
  return 0;
}
#if CYTHON_USE_TYPE_SPECS
static PyType_Slot __pyx_type_5pysam_7libcbcf___pyx_scope_struct_28_itervalues_slots[] = {
  {Py_tp_dealloc, (void *)__pyx_tp_dealloc_5pysam_7libcbcf___pyx_scope_struct_28_itervalues},
  {Py_tp_traverse, (void *)__pyx_tp_traverse_5pysam_7libcbcf___pyx_scope_struct_28_itervalues},
  {Py_tp_new, (void *)__pyx_tp_new_5pysam_7libcbcf___pyx_scope_struct_28_itervalues},
  {0, 0},
};
static PyType_Spec __pyx_type_5pysam_7libcbcf___pyx_scope_struct_28_itervalues_spec = {
  "pysam.libcbcf.__pyx_scope_struct_28_itervalues",
  sizeof(struct __pyx_obj_5pysam_7libcbcf___pyx_scope_struct_28_itervalues),
  0,
  Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_VERSION_TAG|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_HAVE_GC|Py_TPFLAGS_HAVE_FINALIZE,
  __pyx_type_5pysam_7libcbcf___pyx_scope_struct_28_itervalues_slots,
};
#else

static PyTypeObject __pyx_type_5pysam_7libcbcf___pyx_scope_struct_28_itervalues = {
  PyVarObject_HEAD_INIT(0, 0)
  "pysam.libcbcf.""__pyx_scope_struct_28_itervalues", /*tp_name*/
  sizeof(struct __pyx_obj_5pysam_7libcbcf___pyx_scope_struct_28_itervalues), /*tp_basicsize*/
  0, /*tp_itemsize*/
  __pyx_tp_dealloc_5pysam_7libcbcf___pyx_scope_struct_28_itervalues, /*tp_dealloc*/
  #if PY_VERSION_HEX < 0x030800b4
  0, /*tp_print*/
  #endif
  #if PY_VERSION_HEX >= 0x030800b4
  0, /*tp_vectorcall_offset*/
  #endif
  0, /*tp_getattr*/
  0, /*tp_setattr*/
  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|Py_TPFLAGS_HAVE_FINALIZE, /*tp_flags*/
  0, /*tp_doc*/
  __pyx_tp_traverse_5pysam_7libcbcf___pyx_scope_struct_28_itervalues, /*tp_traverse*/
  0, /*tp_clear*/
  0, /*tp_richcompare*/
  0, /*tp_weaklistoffset*/
  0, /*tp_iter*/
  0, /*tp_iternext*/
  0, /*tp_methods*/
  0, /*tp_members*/
  0, /*tp_getset*/
  0, /*tp_base*/
  0, /*tp_dict*/
  0, /*tp_descr_get*/
  0, /*tp_descr_set*/
  #if !CYTHON_USE_TYPE_SPECS
  0, /*tp_dictoffset*/
  #endif
  0, /*tp_init*/
  0, /*tp_alloc*/
  __pyx_tp_new_5pysam_7libcbcf___pyx_scope_struct_28_itervalues, /*tp_new*/
  0, /*tp_free*/
  0, /*tp_is_gc*/
  0, /*tp_bases*/
  0, /*tp_mro*/
  0, /*tp_cache*/
  0, /*tp_subclasses*/
  0, /*tp_weaklist*/
  0, /*tp_del*/
  0, /*tp_version_tag*/
  #if CYTHON_USE_TP_FINALIZE
  0, /*tp_finalize*/
  #else
  NULL, /*tp_finalize*/
  #endif
  #if PY_VERSION_HEX >= 0x030800b1 && (!CYTHON_COMPILING_IN_PYPY || PYPY_VERSION_NUM >= 0x07030800)
  0, /*tp_vectorcall*/
  #endif
  #if __PYX_NEED_TP_PRINT_SLOT == 1
  0, /*tp_print*/
  #endif
  #if PY_VERSION_HEX >= 0x030C0000
  0, /*tp_watched*/
  #endif
  #if 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_5pysam_7libcbcf___pyx_scope_struct_29_iteritems(PyTypeObject *t, CYTHON_UNUSED PyObject *a, CYTHON_UNUSED PyObject *k) {
  PyObject *o;
  #if CYTHON_COMPILING_IN_LIMITED_API
  allocfunc alloc_func = (allocfunc)PyType_GetSlot(t, Py_tp_alloc);
  o = alloc_func(t, 0);
  #else
  #if CYTHON_USE_FREELISTS
  if (likely((int)(__pyx_mstate_global->__pyx_freecount_5pysam_7libcbcf___pyx_scope_struct_29_iteritems > 0) & (int)(t->tp_basicsize == sizeof(struct __pyx_obj_5pysam_7libcbcf___pyx_scope_struct_29_iteritems)))) {
    o = (PyObject*)__pyx_mstate_global->__pyx_freelist_5pysam_7libcbcf___pyx_scope_struct_29_iteritems[--__pyx_mstate_global->__pyx_freecount_5pysam_7libcbcf___pyx_scope_struct_29_iteritems];
    memset(o, 0, sizeof(struct __pyx_obj_5pysam_7libcbcf___pyx_scope_struct_29_iteritems));
    (void) PyObject_INIT(o, t);
    PyObject_GC_Track(o);
  } else
  #endif
  {
    o = (*t->tp_alloc)(t, 0);
    if (unlikely(!o)) return 0;
  }
  #endif
  return o;
}

static void __pyx_tp_dealloc_5pysam_7libcbcf___pyx_scope_struct_29_iteritems(PyObject *o) {
  struct __pyx_obj_5pysam_7libcbcf___pyx_scope_struct_29_iteritems *p = (struct __pyx_obj_5pysam_7libcbcf___pyx_scope_struct_29_iteritems *)o;
  #if CYTHON_USE_TP_FINALIZE
  if (unlikely((PY_VERSION_HEX >= 0x03080000 || __Pyx_PyType_HasFeature(Py_TYPE(o), Py_TPFLAGS_HAVE_FINALIZE)) && __Pyx_PyObject_GetSlot(o, tp_finalize, destructor)) && !__Pyx_PyObject_GC_IsFinalized(o)) {
    if (__Pyx_PyObject_GetSlot(o, tp_dealloc, destructor) == __pyx_tp_dealloc_5pysam_7libcbcf___pyx_scope_struct_29_iteritems) {
      if (PyObject_CallFinalizerFromDealloc(o)) return;
    }
  }
  #endif
  PyObject_GC_UnTrack(o);
  Py_CLEAR(p->__pyx_v_self);
  #if CYTHON_USE_FREELISTS
  if (((int)(__pyx_mstate_global->__pyx_freecount_5pysam_7libcbcf___pyx_scope_struct_29_iteritems < 8) & (int)(Py_TYPE(o)->tp_basicsize == sizeof(struct __pyx_obj_5pysam_7libcbcf___pyx_scope_struct_29_iteritems)))) {
    __pyx_mstate_global->__pyx_freelist_5pysam_7libcbcf___pyx_scope_struct_29_iteritems[__pyx_mstate_global->__pyx_freecount_5pysam_7libcbcf___pyx_scope_struct_29_iteritems++] = ((struct __pyx_obj_5pysam_7libcbcf___pyx_scope_struct_29_iteritems *)o);
  } else
  #endif
  {
    #if CYTHON_USE_TYPE_SLOTS
    (*Py_TYPE(o)->tp_free)(o);
    #else
    {
      freefunc tp_free = (freefunc)PyType_GetSlot(Py_TYPE(o), Py_tp_free);
      if (tp_free) tp_free(o);
    }
    #endif
  }
}

static int __pyx_tp_traverse_5pysam_7libcbcf___pyx_scope_struct_29_iteritems(PyObject *o, visitproc v, void *a) {
  int e;
  struct __pyx_obj_5pysam_7libcbcf___pyx_scope_struct_29_iteritems *p = (struct __pyx_obj_5pysam_7libcbcf___pyx_scope_struct_29_iteritems *)o;
  {
    e = __Pyx_call_type_traverse(o, 1, v, a);
    if (e) return e;
  }
  if (p->__pyx_v_self) {
    e = (*v)(((PyObject *)p->__pyx_v_self), a); if (e) return e;
  }
  return 0;
}
#if CYTHON_USE_TYPE_SPECS
static PyType_Slot __pyx_type_5pysam_7libcbcf___pyx_scope_struct_29_iteritems_slots[] = {
  {Py_tp_dealloc, (void *)__pyx_tp_dealloc_5pysam_7libcbcf___pyx_scope_struct_29_iteritems},
  {Py_tp_traverse, (void *)__pyx_tp_traverse_5pysam_7libcbcf___pyx_scope_struct_29_iteritems},
  {Py_tp_new, (void *)__pyx_tp_new_5pysam_7libcbcf___pyx_scope_struct_29_iteritems},
  {0, 0},
};
static PyType_Spec __pyx_type_5pysam_7libcbcf___pyx_scope_struct_29_iteritems_spec = {
  "pysam.libcbcf.__pyx_scope_struct_29_iteritems",
  sizeof(struct __pyx_obj_5pysam_7libcbcf___pyx_scope_struct_29_iteritems),
  0,
  Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_VERSION_TAG|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_HAVE_GC|Py_TPFLAGS_HAVE_FINALIZE,
  __pyx_type_5pysam_7libcbcf___pyx_scope_struct_29_iteritems_slots,
};
#else

static PyTypeObject __pyx_type_5pysam_7libcbcf___pyx_scope_struct_29_iteritems = {
  PyVarObject_HEAD_INIT(0, 0)
  "pysam.libcbcf.""__pyx_scope_struct_29_iteritems", /*tp_name*/
  sizeof(struct __pyx_obj_5pysam_7libcbcf___pyx_scope_struct_29_iteritems), /*tp_basicsize*/
  0, /*tp_itemsize*/
  __pyx_tp_dealloc_5pysam_7libcbcf___pyx_scope_struct_29_iteritems, /*tp_dealloc*/
  #if PY_VERSION_HEX < 0x030800b4
  0, /*tp_print*/
  #endif
  #if PY_VERSION_HEX >= 0x030800b4
  0, /*tp_vectorcall_offset*/
  #endif
  0, /*tp_getattr*/
  0, /*tp_setattr*/
  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|Py_TPFLAGS_HAVE_FINALIZE, /*tp_flags*/
  0, /*tp_doc*/
  __pyx_tp_traverse_5pysam_7libcbcf___pyx_scope_struct_29_iteritems, /*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_5pysam_7libcbcf___pyx_scope_struct_29_iteritems, /*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 PY_VERSION_HEX >= 0x030800b1 && (!CYTHON_COMPILING_IN_PYPY || PYPY_VERSION_NUM >= 0x07030800)
  0, /*tp_vectorcall*/
  #endif
  #if __PYX_NEED_TP_PRINT_SLOT == 1
  0, /*tp_print*/
  #endif
  #if PY_VERSION_HEX >= 0x030C0000
  0, /*tp_watched*/
  #endif
  #if 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_5pysam_7libcbcf___pyx_scope_struct_30___set__(PyTypeObject *t, CYTHON_UNUSED PyObject *a, CYTHON_UNUSED PyObject *k) {
  PyObject *o;
  #if CYTHON_COMPILING_IN_LIMITED_API
  allocfunc alloc_func = (allocfunc)PyType_GetSlot(t, Py_tp_alloc);
  o = alloc_func(t, 0);
  #else
  #if CYTHON_USE_FREELISTS
  if (likely((int)(__pyx_mstate_global->__pyx_freecount_5pysam_7libcbcf___pyx_scope_struct_30___set__ > 0) & (int)(t->tp_basicsize == sizeof(struct __pyx_obj_5pysam_7libcbcf___pyx_scope_struct_30___set__)))) {
    o = (PyObject*)__pyx_mstate_global->__pyx_freelist_5pysam_7libcbcf___pyx_scope_struct_30___set__[--__pyx_mstate_global->__pyx_freecount_5pysam_7libcbcf___pyx_scope_struct_30___set__];
    memset(o, 0, sizeof(struct __pyx_obj_5pysam_7libcbcf___pyx_scope_struct_30___set__));
    (void) PyObject_INIT(o, t);
    PyObject_GC_Track(o);
  } else
  #endif
  {
    o = (*t->tp_alloc)(t, 0);
    if (unlikely(!o)) return 0;
  }
  #endif
  return o;
}

static void __pyx_tp_dealloc_5pysam_7libcbcf___pyx_scope_struct_30___set__(PyObject *o) {
  struct __pyx_obj_5pysam_7libcbcf___pyx_scope_struct_30___set__ *p = (struct __pyx_obj_5pysam_7libcbcf___pyx_scope_struct_30___set__ *)o;
  #if CYTHON_USE_TP_FINALIZE
  if (unlikely((PY_VERSION_HEX >= 0x03080000 || __Pyx_PyType_HasFeature(Py_TYPE(o), Py_TPFLAGS_HAVE_FINALIZE)) && __Pyx_PyObject_GetSlot(o, tp_finalize, destructor)) && !__Pyx_PyObject_GC_IsFinalized(o)) {
    if (__Pyx_PyObject_GetSlot(o, tp_dealloc, destructor) == __pyx_tp_dealloc_5pysam_7libcbcf___pyx_scope_struct_30___set__) {
      if (PyObject_CallFinalizerFromDealloc(o)) return;
    }
  }
  #endif
  PyObject_GC_UnTrack(o);
  Py_CLEAR(p->__pyx_v_self);
  #if CYTHON_USE_FREELISTS
  if (((int)(__pyx_mstate_global->__pyx_freecount_5pysam_7libcbcf___pyx_scope_struct_30___set__ < 8) & (int)(Py_TYPE(o)->tp_basicsize == sizeof(struct __pyx_obj_5pysam_7libcbcf___pyx_scope_struct_30___set__)))) {
    __pyx_mstate_global->__pyx_freelist_5pysam_7libcbcf___pyx_scope_struct_30___set__[__pyx_mstate_global->__pyx_freecount_5pysam_7libcbcf___pyx_scope_struct_30___set__++] = ((struct __pyx_obj_5pysam_7libcbcf___pyx_scope_struct_30___set__ *)o);
  } else
  #endif
  {
    #if CYTHON_USE_TYPE_SLOTS
    (*Py_TYPE(o)->tp_free)(o);
    #else
    {
      freefunc tp_free = (freefunc)PyType_GetSlot(Py_TYPE(o), Py_tp_free);
      if (tp_free) tp_free(o);
    }
    #endif
  }
}

static int __pyx_tp_traverse_5pysam_7libcbcf___pyx_scope_struct_30___set__(PyObject *o, visitproc v, void *a) {
  int e;
  struct __pyx_obj_5pysam_7libcbcf___pyx_scope_struct_30___set__ *p = (struct __pyx_obj_5pysam_7libcbcf___pyx_scope_struct_30___set__ *)o;
  {
    e = __Pyx_call_type_traverse(o, 1, v, a);
    if (e) return e;
  }
  if (p->__pyx_v_self) {
    e = (*v)(((PyObject *)p->__pyx_v_self), a); if (e) return e;
  }
  return 0;
}

static int __pyx_tp_clear_5pysam_7libcbcf___pyx_scope_struct_30___set__(PyObject *o) {
  PyObject* tmp;
  struct __pyx_obj_5pysam_7libcbcf___pyx_scope_struct_30___set__ *p = (struct __pyx_obj_5pysam_7libcbcf___pyx_scope_struct_30___set__ *)o;
  tmp = ((PyObject*)p->__pyx_v_self);
  p->__pyx_v_self = ((struct __pyx_obj_5pysam_7libcbcf_VariantRecordSample *)Py_None); Py_INCREF(Py_None);
  Py_XDECREF(tmp);
  return 0;
}
#if CYTHON_USE_TYPE_SPECS
static PyType_Slot __pyx_type_5pysam_7libcbcf___pyx_scope_struct_30___set___slots[] = {
  {Py_tp_dealloc, (void *)__pyx_tp_dealloc_5pysam_7libcbcf___pyx_scope_struct_30___set__},
  {Py_tp_traverse, (void *)__pyx_tp_traverse_5pysam_7libcbcf___pyx_scope_struct_30___set__},
  {Py_tp_clear, (void *)__pyx_tp_clear_5pysam_7libcbcf___pyx_scope_struct_30___set__},
  {Py_tp_new, (void *)__pyx_tp_new_5pysam_7libcbcf___pyx_scope_struct_30___set__},
  {0, 0},
};
static PyType_Spec __pyx_type_5pysam_7libcbcf___pyx_scope_struct_30___set___spec = {
  "pysam.libcbcf.__pyx_scope_struct_30___set__",
  sizeof(struct __pyx_obj_5pysam_7libcbcf___pyx_scope_struct_30___set__),
  0,
  Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_VERSION_TAG|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_HAVE_GC|Py_TPFLAGS_HAVE_FINALIZE,
  __pyx_type_5pysam_7libcbcf___pyx_scope_struct_30___set___slots,
};
#else

static PyTypeObject __pyx_type_5pysam_7libcbcf___pyx_scope_struct_30___set__ = {
  PyVarObject_HEAD_INIT(0, 0)
  "pysam.libcbcf.""__pyx_scope_struct_30___set__", /*tp_name*/
  sizeof(struct __pyx_obj_5pysam_7libcbcf___pyx_scope_struct_30___set__), /*tp_basicsize*/
  0, /*tp_itemsize*/
  __pyx_tp_dealloc_5pysam_7libcbcf___pyx_scope_struct_30___set__, /*tp_dealloc*/
  #if PY_VERSION_HEX < 0x030800b4
  0, /*tp_print*/
  #endif
  #if PY_VERSION_HEX >= 0x030800b4
  0, /*tp_vectorcall_offset*/
  #endif
  0, /*tp_getattr*/
  0, /*tp_setattr*/
  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|Py_TPFLAGS_HAVE_FINALIZE, /*tp_flags*/
  0, /*tp_doc*/
  __pyx_tp_traverse_5pysam_7libcbcf___pyx_scope_struct_30___set__, /*tp_traverse*/
  __pyx_tp_clear_5pysam_7libcbcf___pyx_scope_struct_30___set__, /*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_5pysam_7libcbcf___pyx_scope_struct_30___set__, /*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 PY_VERSION_HEX >= 0x030800b1 && (!CYTHON_COMPILING_IN_PYPY || PYPY_VERSION_NUM >= 0x07030800)
  0, /*tp_vectorcall*/
  #endif
  #if __PYX_NEED_TP_PRINT_SLOT == 1
  0, /*tp_print*/
  #endif
  #if PY_VERSION_HEX >= 0x030C0000
  0, /*tp_watched*/
  #endif
  #if 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_5pysam_7libcbcf___pyx_scope_struct_31_genexpr(PyTypeObject *t, CYTHON_UNUSED PyObject *a, CYTHON_UNUSED PyObject *k) {
  PyObject *o;
  #if CYTHON_COMPILING_IN_LIMITED_API
  allocfunc alloc_func = (allocfunc)PyType_GetSlot(t, Py_tp_alloc);
  o = alloc_func(t, 0);
  #else
  #if CYTHON_USE_FREELISTS
  if (likely((int)(__pyx_mstate_global->__pyx_freecount_5pysam_7libcbcf___pyx_scope_struct_31_genexpr > 0) & (int)(t->tp_basicsize == sizeof(struct __pyx_obj_5pysam_7libcbcf___pyx_scope_struct_31_genexpr)))) {
    o = (PyObject*)__pyx_mstate_global->__pyx_freelist_5pysam_7libcbcf___pyx_scope_struct_31_genexpr[--__pyx_mstate_global->__pyx_freecount_5pysam_7libcbcf___pyx_scope_struct_31_genexpr];
    memset(o, 0, sizeof(struct __pyx_obj_5pysam_7libcbcf___pyx_scope_struct_31_genexpr));
    (void) PyObject_INIT(o, t);
    PyObject_GC_Track(o);
  } else
  #endif
  {
    o = (*t->tp_alloc)(t, 0);
    if (unlikely(!o)) return 0;
  }
  #endif
  return o;
}

static void __pyx_tp_dealloc_5pysam_7libcbcf___pyx_scope_struct_31_genexpr(PyObject *o) {
  struct __pyx_obj_5pysam_7libcbcf___pyx_scope_struct_31_genexpr *p = (struct __pyx_obj_5pysam_7libcbcf___pyx_scope_struct_31_genexpr *)o;
  #if CYTHON_USE_TP_FINALIZE
  if (unlikely((PY_VERSION_HEX >= 0x03080000 || __Pyx_PyType_HasFeature(Py_TYPE(o), Py_TPFLAGS_HAVE_FINALIZE)) && __Pyx_PyObject_GetSlot(o, tp_finalize, destructor)) && !__Pyx_PyObject_GC_IsFinalized(o)) {
    if (__Pyx_PyObject_GetSlot(o, tp_dealloc, destructor) == __pyx_tp_dealloc_5pysam_7libcbcf___pyx_scope_struct_31_genexpr) {
      if (PyObject_CallFinalizerFromDealloc(o)) return;
    }
  }
  #endif
  PyObject_GC_UnTrack(o);
  Py_CLEAR(p->__pyx_genexpr_arg_0);
  Py_CLEAR(p->__pyx_v_x);
  #if CYTHON_USE_FREELISTS
  if (((int)(__pyx_mstate_global->__pyx_freecount_5pysam_7libcbcf___pyx_scope_struct_31_genexpr < 8) & (int)(Py_TYPE(o)->tp_basicsize == sizeof(struct __pyx_obj_5pysam_7libcbcf___pyx_scope_struct_31_genexpr)))) {
    __pyx_mstate_global->__pyx_freelist_5pysam_7libcbcf___pyx_scope_struct_31_genexpr[__pyx_mstate_global->__pyx_freecount_5pysam_7libcbcf___pyx_scope_struct_31_genexpr++] = ((struct __pyx_obj_5pysam_7libcbcf___pyx_scope_struct_31_genexpr *)o);
  } else
  #endif
  {
    #if CYTHON_USE_TYPE_SLOTS
    (*Py_TYPE(o)->tp_free)(o);
    #else
    {
      freefunc tp_free = (freefunc)PyType_GetSlot(Py_TYPE(o), Py_tp_free);
      if (tp_free) tp_free(o);
    }
    #endif
  }
}

static int __pyx_tp_traverse_5pysam_7libcbcf___pyx_scope_struct_31_genexpr(PyObject *o, visitproc v, void *a) {
  int e;
  struct __pyx_obj_5pysam_7libcbcf___pyx_scope_struct_31_genexpr *p = (struct __pyx_obj_5pysam_7libcbcf___pyx_scope_struct_31_genexpr *)o;
  {
    e = __Pyx_call_type_traverse(o, 1, v, a);
    if (e) return e;
  }
  if (p->__pyx_genexpr_arg_0) {
    e = (*v)(p->__pyx_genexpr_arg_0, a); if (e) return e;
  }
  if (p->__pyx_v_x) {
    e = (*v)(p->__pyx_v_x, a); if (e) return e;
  }
  return 0;
}
#if CYTHON_USE_TYPE_SPECS
static PyType_Slot __pyx_type_5pysam_7libcbcf___pyx_scope_struct_31_genexpr_slots[] = {
  {Py_tp_dealloc, (void *)__pyx_tp_dealloc_5pysam_7libcbcf___pyx_scope_struct_31_genexpr},
  {Py_tp_traverse, (void *)__pyx_tp_traverse_5pysam_7libcbcf___pyx_scope_struct_31_genexpr},
  {Py_tp_new, (void *)__pyx_tp_new_5pysam_7libcbcf___pyx_scope_struct_31_genexpr},
  {0, 0},
};
static PyType_Spec __pyx_type_5pysam_7libcbcf___pyx_scope_struct_31_genexpr_spec = {
  "pysam.libcbcf.__pyx_scope_struct_31_genexpr",
  sizeof(struct __pyx_obj_5pysam_7libcbcf___pyx_scope_struct_31_genexpr),
  0,
  Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_VERSION_TAG|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_HAVE_GC|Py_TPFLAGS_HAVE_FINALIZE,
  __pyx_type_5pysam_7libcbcf___pyx_scope_struct_31_genexpr_slots,
};
#else

static PyTypeObject __pyx_type_5pysam_7libcbcf___pyx_scope_struct_31_genexpr = {
  PyVarObject_HEAD_INIT(0, 0)
  "pysam.libcbcf.""__pyx_scope_struct_31_genexpr", /*tp_name*/
  sizeof(struct __pyx_obj_5pysam_7libcbcf___pyx_scope_struct_31_genexpr), /*tp_basicsize*/
  0, /*tp_itemsize*/
  __pyx_tp_dealloc_5pysam_7libcbcf___pyx_scope_struct_31_genexpr, /*tp_dealloc*/
  #if PY_VERSION_HEX < 0x030800b4
  0, /*tp_print*/
  #endif
  #if PY_VERSION_HEX >= 0x030800b4
  0, /*tp_vectorcall_offset*/
  #endif
  0, /*tp_getattr*/
  0, /*tp_setattr*/
  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|Py_TPFLAGS_HAVE_FINALIZE, /*tp_flags*/
  0, /*tp_doc*/
  __pyx_tp_traverse_5pysam_7libcbcf___pyx_scope_struct_31_genexpr, /*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_5pysam_7libcbcf___pyx_scope_struct_31_genexpr, /*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 PY_VERSION_HEX >= 0x030800b1 && (!CYTHON_COMPILING_IN_PYPY || PYPY_VERSION_NUM >= 0x07030800)
  0, /*tp_vectorcall*/
  #endif
  #if __PYX_NEED_TP_PRINT_SLOT == 1
  0, /*tp_print*/
  #endif
  #if PY_VERSION_HEX >= 0x030C0000
  0, /*tp_watched*/
  #endif
  #if 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_5pysam_7libcbcf___pyx_scope_struct_32_genexpr(PyTypeObject *t, CYTHON_UNUSED PyObject *a, CYTHON_UNUSED PyObject *k) {
  PyObject *o;
  #if CYTHON_COMPILING_IN_LIMITED_API
  allocfunc alloc_func = (allocfunc)PyType_GetSlot(t, Py_tp_alloc);
  o = alloc_func(t, 0);
  #else
  #if CYTHON_USE_FREELISTS
  if (likely((int)(__pyx_mstate_global->__pyx_freecount_5pysam_7libcbcf___pyx_scope_struct_32_genexpr > 0) & (int)(t->tp_basicsize == sizeof(struct __pyx_obj_5pysam_7libcbcf___pyx_scope_struct_32_genexpr)))) {
    o = (PyObject*)__pyx_mstate_global->__pyx_freelist_5pysam_7libcbcf___pyx_scope_struct_32_genexpr[--__pyx_mstate_global->__pyx_freecount_5pysam_7libcbcf___pyx_scope_struct_32_genexpr];
    memset(o, 0, sizeof(struct __pyx_obj_5pysam_7libcbcf___pyx_scope_struct_32_genexpr));
    (void) PyObject_INIT(o, t);
    PyObject_GC_Track(o);
  } else
  #endif
  {
    o = (*t->tp_alloc)(t, 0);
    if (unlikely(!o)) return 0;
  }
  #endif
  return o;
}

static void __pyx_tp_dealloc_5pysam_7libcbcf___pyx_scope_struct_32_genexpr(PyObject *o) {
  struct __pyx_obj_5pysam_7libcbcf___pyx_scope_struct_32_genexpr *p = (struct __pyx_obj_5pysam_7libcbcf___pyx_scope_struct_32_genexpr *)o;
  #if CYTHON_USE_TP_FINALIZE
  if (unlikely((PY_VERSION_HEX >= 0x03080000 || __Pyx_PyType_HasFeature(Py_TYPE(o), Py_TPFLAGS_HAVE_FINALIZE)) && __Pyx_PyObject_GetSlot(o, tp_finalize, destructor)) && !__Pyx_PyObject_GC_IsFinalized(o)) {
    if (__Pyx_PyObject_GetSlot(o, tp_dealloc, destructor) == __pyx_tp_dealloc_5pysam_7libcbcf___pyx_scope_struct_32_genexpr) {
      if (PyObject_CallFinalizerFromDealloc(o)) return;
    }
  }
  #endif
  PyObject_GC_UnTrack(o);
  Py_CLEAR(p->__pyx_outer_scope);
  Py_CLEAR(p->__pyx_genexpr_arg_0);
  Py_CLEAR(p->__pyx_v_allele);
  Py_CLEAR(p->__pyx_t_0);
  #if CYTHON_USE_FREELISTS
  if (((int)(__pyx_mstate_global->__pyx_freecount_5pysam_7libcbcf___pyx_scope_struct_32_genexpr < 8) & (int)(Py_TYPE(o)->tp_basicsize == sizeof(struct __pyx_obj_5pysam_7libcbcf___pyx_scope_struct_32_genexpr)))) {
    __pyx_mstate_global->__pyx_freelist_5pysam_7libcbcf___pyx_scope_struct_32_genexpr[__pyx_mstate_global->__pyx_freecount_5pysam_7libcbcf___pyx_scope_struct_32_genexpr++] = ((struct __pyx_obj_5pysam_7libcbcf___pyx_scope_struct_32_genexpr *)o);
  } else
  #endif
  {
    #if CYTHON_USE_TYPE_SLOTS
    (*Py_TYPE(o)->tp_free)(o);
    #else
    {
      freefunc tp_free = (freefunc)PyType_GetSlot(Py_TYPE(o), Py_tp_free);
      if (tp_free) tp_free(o);
    }
    #endif
  }
}

static int __pyx_tp_traverse_5pysam_7libcbcf___pyx_scope_struct_32_genexpr(PyObject *o, visitproc v, void *a) {
  int e;
  struct __pyx_obj_5pysam_7libcbcf___pyx_scope_struct_32_genexpr *p = (struct __pyx_obj_5pysam_7libcbcf___pyx_scope_struct_32_genexpr *)o;
  {
    e = __Pyx_call_type_traverse(o, 1, v, a);
    if (e) return e;
  }
  if (p->__pyx_outer_scope) {
    e = (*v)(((PyObject *)p->__pyx_outer_scope), a); if (e) return e;
  }
  if (p->__pyx_genexpr_arg_0) {
    e = (*v)(p->__pyx_genexpr_arg_0, a); if (e) return e;
  }
  if (p->__pyx_v_allele) {
    e = (*v)(p->__pyx_v_allele, 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_5pysam_7libcbcf___pyx_scope_struct_32_genexpr_slots[] = {
  {Py_tp_dealloc, (void *)__pyx_tp_dealloc_5pysam_7libcbcf___pyx_scope_struct_32_genexpr},
  {Py_tp_traverse, (void *)__pyx_tp_traverse_5pysam_7libcbcf___pyx_scope_struct_32_genexpr},
  {Py_tp_new, (void *)__pyx_tp_new_5pysam_7libcbcf___pyx_scope_struct_32_genexpr},
  {0, 0},
};
static PyType_Spec __pyx_type_5pysam_7libcbcf___pyx_scope_struct_32_genexpr_spec = {
  "pysam.libcbcf.__pyx_scope_struct_32_genexpr",
  sizeof(struct __pyx_obj_5pysam_7libcbcf___pyx_scope_struct_32_genexpr),
  0,
  Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_VERSION_TAG|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_HAVE_GC|Py_TPFLAGS_HAVE_FINALIZE,
  __pyx_type_5pysam_7libcbcf___pyx_scope_struct_32_genexpr_slots,
};
#else

static PyTypeObject __pyx_type_5pysam_7libcbcf___pyx_scope_struct_32_genexpr = {
  PyVarObject_HEAD_INIT(0, 0)
  "pysam.libcbcf.""__pyx_scope_struct_32_genexpr", /*tp_name*/
  sizeof(struct __pyx_obj_5pysam_7libcbcf___pyx_scope_struct_32_genexpr), /*tp_basicsize*/
  0, /*tp_itemsize*/
  __pyx_tp_dealloc_5pysam_7libcbcf___pyx_scope_struct_32_genexpr, /*tp_dealloc*/
  #if PY_VERSION_HEX < 0x030800b4
  0, /*tp_print*/
  #endif
  #if PY_VERSION_HEX >= 0x030800b4
  0, /*tp_vectorcall_offset*/
  #endif
  0, /*tp_getattr*/
  0, /*tp_setattr*/
  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|Py_TPFLAGS_HAVE_FINALIZE, /*tp_flags*/
  0, /*tp_doc*/
  __pyx_tp_traverse_5pysam_7libcbcf___pyx_scope_struct_32_genexpr, /*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_5pysam_7libcbcf___pyx_scope_struct_32_genexpr, /*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 PY_VERSION_HEX >= 0x030800b1 && (!CYTHON_COMPILING_IN_PYPY || PYPY_VERSION_NUM >= 0x07030800)
  0, /*tp_vectorcall*/
  #endif
  #if __PYX_NEED_TP_PRINT_SLOT == 1
  0, /*tp_print*/
  #endif
  #if PY_VERSION_HEX >= 0x030C0000
  0, /*tp_watched*/
  #endif
  #if 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_5pysam_7libcbcf___pyx_scope_struct_33___iter__(PyTypeObject *t, CYTHON_UNUSED PyObject *a, CYTHON_UNUSED PyObject *k) {
  PyObject *o;
  #if CYTHON_COMPILING_IN_LIMITED_API
  allocfunc alloc_func = (allocfunc)PyType_GetSlot(t, Py_tp_alloc);
  o = alloc_func(t, 0);
  #else
  #if CYTHON_USE_FREELISTS
  if (likely((int)(__pyx_mstate_global->__pyx_freecount_5pysam_7libcbcf___pyx_scope_struct_33___iter__ > 0) & (int)(t->tp_basicsize == sizeof(struct __pyx_obj_5pysam_7libcbcf___pyx_scope_struct_33___iter__)))) {
    o = (PyObject*)__pyx_mstate_global->__pyx_freelist_5pysam_7libcbcf___pyx_scope_struct_33___iter__[--__pyx_mstate_global->__pyx_freecount_5pysam_7libcbcf___pyx_scope_struct_33___iter__];
    memset(o, 0, sizeof(struct __pyx_obj_5pysam_7libcbcf___pyx_scope_struct_33___iter__));
    (void) PyObject_INIT(o, t);
    PyObject_GC_Track(o);
  } else
  #endif
  {
    o = (*t->tp_alloc)(t, 0);
    if (unlikely(!o)) return 0;
  }
  #endif
  return o;
}

static void __pyx_tp_dealloc_5pysam_7libcbcf___pyx_scope_struct_33___iter__(PyObject *o) {
  struct __pyx_obj_5pysam_7libcbcf___pyx_scope_struct_33___iter__ *p = (struct __pyx_obj_5pysam_7libcbcf___pyx_scope_struct_33___iter__ *)o;
  #if CYTHON_USE_TP_FINALIZE
  if (unlikely((PY_VERSION_HEX >= 0x03080000 || __Pyx_PyType_HasFeature(Py_TYPE(o), Py_TPFLAGS_HAVE_FINALIZE)) && __Pyx_PyObject_GetSlot(o, tp_finalize, destructor)) && !__Pyx_PyObject_GC_IsFinalized(o)) {
    if (__Pyx_PyObject_GetSlot(o, tp_dealloc, destructor) == __pyx_tp_dealloc_5pysam_7libcbcf___pyx_scope_struct_33___iter__) {
      if (PyObject_CallFinalizerFromDealloc(o)) return;
    }
  }
  #endif
  PyObject_GC_UnTrack(o);
  Py_CLEAR(p->__pyx_v_self);
  #if CYTHON_USE_FREELISTS
  if (((int)(__pyx_mstate_global->__pyx_freecount_5pysam_7libcbcf___pyx_scope_struct_33___iter__ < 8) & (int)(Py_TYPE(o)->tp_basicsize == sizeof(struct __pyx_obj_5pysam_7libcbcf___pyx_scope_struct_33___iter__)))) {
    __pyx_mstate_global->__pyx_freelist_5pysam_7libcbcf___pyx_scope_struct_33___iter__[__pyx_mstate_global->__pyx_freecount_5pysam_7libcbcf___pyx_scope_struct_33___iter__++] = ((struct __pyx_obj_5pysam_7libcbcf___pyx_scope_struct_33___iter__ *)o);
  } else
  #endif
  {
    #if CYTHON_USE_TYPE_SLOTS
    (*Py_TYPE(o)->tp_free)(o);
    #else
    {
      freefunc tp_free = (freefunc)PyType_GetSlot(Py_TYPE(o), Py_tp_free);
      if (tp_free) tp_free(o);
    }
    #endif
  }
}

static int __pyx_tp_traverse_5pysam_7libcbcf___pyx_scope_struct_33___iter__(PyObject *o, visitproc v, void *a) {
  int e;
  struct __pyx_obj_5pysam_7libcbcf___pyx_scope_struct_33___iter__ *p = (struct __pyx_obj_5pysam_7libcbcf___pyx_scope_struct_33___iter__ *)o;
  {
    e = __Pyx_call_type_traverse(o, 1, v, a);
    if (e) return e;
  }
  if (p->__pyx_v_self) {
    e = (*v)(((PyObject *)p->__pyx_v_self), a); if (e) return e;
  }
  return 0;
}
#if CYTHON_USE_TYPE_SPECS
static PyType_Slot __pyx_type_5pysam_7libcbcf___pyx_scope_struct_33___iter___slots[] = {
  {Py_tp_dealloc, (void *)__pyx_tp_dealloc_5pysam_7libcbcf___pyx_scope_struct_33___iter__},
  {Py_tp_traverse, (void *)__pyx_tp_traverse_5pysam_7libcbcf___pyx_scope_struct_33___iter__},
  {Py_tp_new, (void *)__pyx_tp_new_5pysam_7libcbcf___pyx_scope_struct_33___iter__},
  {0, 0},
};
static PyType_Spec __pyx_type_5pysam_7libcbcf___pyx_scope_struct_33___iter___spec = {
  "pysam.libcbcf.__pyx_scope_struct_33___iter__",
  sizeof(struct __pyx_obj_5pysam_7libcbcf___pyx_scope_struct_33___iter__),
  0,
  Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_VERSION_TAG|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_HAVE_GC|Py_TPFLAGS_HAVE_FINALIZE,
  __pyx_type_5pysam_7libcbcf___pyx_scope_struct_33___iter___slots,
};
#else

static PyTypeObject __pyx_type_5pysam_7libcbcf___pyx_scope_struct_33___iter__ = {
  PyVarObject_HEAD_INIT(0, 0)
  "pysam.libcbcf.""__pyx_scope_struct_33___iter__", /*tp_name*/
  sizeof(struct __pyx_obj_5pysam_7libcbcf___pyx_scope_struct_33___iter__), /*tp_basicsize*/
  0, /*tp_itemsize*/
  __pyx_tp_dealloc_5pysam_7libcbcf___pyx_scope_struct_33___iter__, /*tp_dealloc*/
  #if PY_VERSION_HEX < 0x030800b4
  0, /*tp_print*/
  #endif
  #if PY_VERSION_HEX >= 0x030800b4
  0, /*tp_vectorcall_offset*/
  #endif
  0, /*tp_getattr*/
  0, /*tp_setattr*/
  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|Py_TPFLAGS_HAVE_FINALIZE, /*tp_flags*/
  0, /*tp_doc*/
  __pyx_tp_traverse_5pysam_7libcbcf___pyx_scope_struct_33___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_5pysam_7libcbcf___pyx_scope_struct_33___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 PY_VERSION_HEX >= 0x030800b1 && (!CYTHON_COMPILING_IN_PYPY || PYPY_VERSION_NUM >= 0x07030800)
  0, /*tp_vectorcall*/
  #endif
  #if __PYX_NEED_TP_PRINT_SLOT == 1
  0, /*tp_print*/
  #endif
  #if PY_VERSION_HEX >= 0x030C0000
  0, /*tp_watched*/
  #endif
  #if 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_5pysam_7libcbcf___pyx_scope_struct_34_itervalues(PyTypeObject *t, CYTHON_UNUSED PyObject *a, CYTHON_UNUSED PyObject *k) {
  PyObject *o;
  #if CYTHON_COMPILING_IN_LIMITED_API
  allocfunc alloc_func = (allocfunc)PyType_GetSlot(t, Py_tp_alloc);
  o = alloc_func(t, 0);
  #else
  #if CYTHON_USE_FREELISTS
  if (likely((int)(__pyx_mstate_global->__pyx_freecount_5pysam_7libcbcf___pyx_scope_struct_34_itervalues > 0) & (int)(t->tp_basicsize == sizeof(struct __pyx_obj_5pysam_7libcbcf___pyx_scope_struct_34_itervalues)))) {
    o = (PyObject*)__pyx_mstate_global->__pyx_freelist_5pysam_7libcbcf___pyx_scope_struct_34_itervalues[--__pyx_mstate_global->__pyx_freecount_5pysam_7libcbcf___pyx_scope_struct_34_itervalues];
    memset(o, 0, sizeof(struct __pyx_obj_5pysam_7libcbcf___pyx_scope_struct_34_itervalues));
    (void) PyObject_INIT(o, t);
    PyObject_GC_Track(o);
  } else
  #endif
  {
    o = (*t->tp_alloc)(t, 0);
    if (unlikely(!o)) return 0;
  }
  #endif
  return o;
}

static void __pyx_tp_dealloc_5pysam_7libcbcf___pyx_scope_struct_34_itervalues(PyObject *o) {
  struct __pyx_obj_5pysam_7libcbcf___pyx_scope_struct_34_itervalues *p = (struct __pyx_obj_5pysam_7libcbcf___pyx_scope_struct_34_itervalues *)o;
  #if CYTHON_USE_TP_FINALIZE
  if (unlikely((PY_VERSION_HEX >= 0x03080000 || __Pyx_PyType_HasFeature(Py_TYPE(o), Py_TPFLAGS_HAVE_FINALIZE)) && __Pyx_PyObject_GetSlot(o, tp_finalize, destructor)) && !__Pyx_PyObject_GC_IsFinalized(o)) {
    if (__Pyx_PyObject_GetSlot(o, tp_dealloc, destructor) == __pyx_tp_dealloc_5pysam_7libcbcf___pyx_scope_struct_34_itervalues) {
      if (PyObject_CallFinalizerFromDealloc(o)) return;
    }
  }
  #endif
  PyObject_GC_UnTrack(o);
  Py_CLEAR(p->__pyx_v_key);
  Py_CLEAR(p->__pyx_v_self);
  Py_CLEAR(p->__pyx_t_0);
  #if CYTHON_USE_FREELISTS
  if (((int)(__pyx_mstate_global->__pyx_freecount_5pysam_7libcbcf___pyx_scope_struct_34_itervalues < 8) & (int)(Py_TYPE(o)->tp_basicsize == sizeof(struct __pyx_obj_5pysam_7libcbcf___pyx_scope_struct_34_itervalues)))) {
    __pyx_mstate_global->__pyx_freelist_5pysam_7libcbcf___pyx_scope_struct_34_itervalues[__pyx_mstate_global->__pyx_freecount_5pysam_7libcbcf___pyx_scope_struct_34_itervalues++] = ((struct __pyx_obj_5pysam_7libcbcf___pyx_scope_struct_34_itervalues *)o);
  } else
  #endif
  {
    #if CYTHON_USE_TYPE_SLOTS
    (*Py_TYPE(o)->tp_free)(o);
    #else
    {
      freefunc tp_free = (freefunc)PyType_GetSlot(Py_TYPE(o), Py_tp_free);
      if (tp_free) tp_free(o);
    }
    #endif
  }
}

static int __pyx_tp_traverse_5pysam_7libcbcf___pyx_scope_struct_34_itervalues(PyObject *o, visitproc v, void *a) {
  int e;
  struct __pyx_obj_5pysam_7libcbcf___pyx_scope_struct_34_itervalues *p = (struct __pyx_obj_5pysam_7libcbcf___pyx_scope_struct_34_itervalues *)o;
  {
    e = __Pyx_call_type_traverse(o, 1, v, a);
    if (e) return e;
  }
  if (p->__pyx_v_key) {
    e = (*v)(p->__pyx_v_key, 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_5pysam_7libcbcf___pyx_scope_struct_34_itervalues_slots[] = {
  {Py_tp_dealloc, (void *)__pyx_tp_dealloc_5pysam_7libcbcf___pyx_scope_struct_34_itervalues},
  {Py_tp_traverse, (void *)__pyx_tp_traverse_5pysam_7libcbcf___pyx_scope_struct_34_itervalues},
  {Py_tp_new, (void *)__pyx_tp_new_5pysam_7libcbcf___pyx_scope_struct_34_itervalues},
  {0, 0},
};
static PyType_Spec __pyx_type_5pysam_7libcbcf___pyx_scope_struct_34_itervalues_spec = {
  "pysam.libcbcf.__pyx_scope_struct_34_itervalues",
  sizeof(struct __pyx_obj_5pysam_7libcbcf___pyx_scope_struct_34_itervalues),
  0,
  Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_VERSION_TAG|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_HAVE_GC|Py_TPFLAGS_HAVE_FINALIZE,
  __pyx_type_5pysam_7libcbcf___pyx_scope_struct_34_itervalues_slots,
};
#else

static PyTypeObject __pyx_type_5pysam_7libcbcf___pyx_scope_struct_34_itervalues = {
  PyVarObject_HEAD_INIT(0, 0)
  "pysam.libcbcf.""__pyx_scope_struct_34_itervalues", /*tp_name*/
  sizeof(struct __pyx_obj_5pysam_7libcbcf___pyx_scope_struct_34_itervalues), /*tp_basicsize*/
  0, /*tp_itemsize*/
  __pyx_tp_dealloc_5pysam_7libcbcf___pyx_scope_struct_34_itervalues, /*tp_dealloc*/
  #if PY_VERSION_HEX < 0x030800b4
  0, /*tp_print*/
  #endif
  #if PY_VERSION_HEX >= 0x030800b4
  0, /*tp_vectorcall_offset*/
  #endif
  0, /*tp_getattr*/
  0, /*tp_setattr*/
  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|Py_TPFLAGS_HAVE_FINALIZE, /*tp_flags*/
  0, /*tp_doc*/
  __pyx_tp_traverse_5pysam_7libcbcf___pyx_scope_struct_34_itervalues, /*tp_traverse*/
  0, /*tp_clear*/
  0, /*tp_richcompare*/
  0, /*tp_weaklistoffset*/
  0, /*tp_iter*/
  0, /*tp_iternext*/
  0, /*tp_methods*/
  0, /*tp_members*/
  0, /*tp_getset*/
  0, /*tp_base*/
  0, /*tp_dict*/
  0, /*tp_descr_get*/
  0, /*tp_descr_set*/
  #if !CYTHON_USE_TYPE_SPECS
  0, /*tp_dictoffset*/
  #endif
  0, /*tp_init*/
  0, /*tp_alloc*/
  __pyx_tp_new_5pysam_7libcbcf___pyx_scope_struct_34_itervalues, /*tp_new*/
  0, /*tp_free*/
  0, /*tp_is_gc*/
  0, /*tp_bases*/
  0, /*tp_mro*/
  0, /*tp_cache*/
  0, /*tp_subclasses*/
  0, /*tp_weaklist*/
  0, /*tp_del*/
  0, /*tp_version_tag*/
  #if CYTHON_USE_TP_FINALIZE
  0, /*tp_finalize*/
  #else
  NULL, /*tp_finalize*/
  #endif
  #if PY_VERSION_HEX >= 0x030800b1 && (!CYTHON_COMPILING_IN_PYPY || PYPY_VERSION_NUM >= 0x07030800)
  0, /*tp_vectorcall*/
  #endif
  #if __PYX_NEED_TP_PRINT_SLOT == 1
  0, /*tp_print*/
  #endif
  #if PY_VERSION_HEX >= 0x030C0000
  0, /*tp_watched*/
  #endif
  #if 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_5pysam_7libcbcf___pyx_scope_struct_35_iteritems(PyTypeObject *t, CYTHON_UNUSED PyObject *a, CYTHON_UNUSED PyObject *k) {
  PyObject *o;
  #if CYTHON_COMPILING_IN_LIMITED_API
  allocfunc alloc_func = (allocfunc)PyType_GetSlot(t, Py_tp_alloc);
  o = alloc_func(t, 0);
  #else
  #if CYTHON_USE_FREELISTS
  if (likely((int)(__pyx_mstate_global->__pyx_freecount_5pysam_7libcbcf___pyx_scope_struct_35_iteritems > 0) & (int)(t->tp_basicsize == sizeof(struct __pyx_obj_5pysam_7libcbcf___pyx_scope_struct_35_iteritems)))) {
    o = (PyObject*)__pyx_mstate_global->__pyx_freelist_5pysam_7libcbcf___pyx_scope_struct_35_iteritems[--__pyx_mstate_global->__pyx_freecount_5pysam_7libcbcf___pyx_scope_struct_35_iteritems];
    memset(o, 0, sizeof(struct __pyx_obj_5pysam_7libcbcf___pyx_scope_struct_35_iteritems));
    (void) PyObject_INIT(o, t);
    PyObject_GC_Track(o);
  } else
  #endif
  {
    o = (*t->tp_alloc)(t, 0);
    if (unlikely(!o)) return 0;
  }
  #endif
  return o;
}

static void __pyx_tp_dealloc_5pysam_7libcbcf___pyx_scope_struct_35_iteritems(PyObject *o) {
  struct __pyx_obj_5pysam_7libcbcf___pyx_scope_struct_35_iteritems *p = (struct __pyx_obj_5pysam_7libcbcf___pyx_scope_struct_35_iteritems *)o;
  #if CYTHON_USE_TP_FINALIZE
  if (unlikely((PY_VERSION_HEX >= 0x03080000 || __Pyx_PyType_HasFeature(Py_TYPE(o), Py_TPFLAGS_HAVE_FINALIZE)) && __Pyx_PyObject_GetSlot(o, tp_finalize, destructor)) && !__Pyx_PyObject_GC_IsFinalized(o)) {
    if (__Pyx_PyObject_GetSlot(o, tp_dealloc, destructor) == __pyx_tp_dealloc_5pysam_7libcbcf___pyx_scope_struct_35_iteritems) {
      if (PyObject_CallFinalizerFromDealloc(o)) return;
    }
  }
  #endif
  PyObject_GC_UnTrack(o);
  Py_CLEAR(p->__pyx_v_key);
  Py_CLEAR(p->__pyx_v_self);
  Py_CLEAR(p->__pyx_t_0);
  #if CYTHON_USE_FREELISTS
  if (((int)(__pyx_mstate_global->__pyx_freecount_5pysam_7libcbcf___pyx_scope_struct_35_iteritems < 8) & (int)(Py_TYPE(o)->tp_basicsize == sizeof(struct __pyx_obj_5pysam_7libcbcf___pyx_scope_struct_35_iteritems)))) {
    __pyx_mstate_global->__pyx_freelist_5pysam_7libcbcf___pyx_scope_struct_35_iteritems[__pyx_mstate_global->__pyx_freecount_5pysam_7libcbcf___pyx_scope_struct_35_iteritems++] = ((struct __pyx_obj_5pysam_7libcbcf___pyx_scope_struct_35_iteritems *)o);
  } else
  #endif
  {
    #if CYTHON_USE_TYPE_SLOTS
    (*Py_TYPE(o)->tp_free)(o);
    #else
    {
      freefunc tp_free = (freefunc)PyType_GetSlot(Py_TYPE(o), Py_tp_free);
      if (tp_free) tp_free(o);
    }
    #endif
  }
}

static int __pyx_tp_traverse_5pysam_7libcbcf___pyx_scope_struct_35_iteritems(PyObject *o, visitproc v, void *a) {
  int e;
  struct __pyx_obj_5pysam_7libcbcf___pyx_scope_struct_35_iteritems *p = (struct __pyx_obj_5pysam_7libcbcf___pyx_scope_struct_35_iteritems *)o;
  {
    e = __Pyx_call_type_traverse(o, 1, v, a);
    if (e) return e;
  }
  if (p->__pyx_v_key) {
    e = (*v)(p->__pyx_v_key, 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_5pysam_7libcbcf___pyx_scope_struct_35_iteritems_slots[] = {
  {Py_tp_dealloc, (void *)__pyx_tp_dealloc_5pysam_7libcbcf___pyx_scope_struct_35_iteritems},
  {Py_tp_traverse, (void *)__pyx_tp_traverse_5pysam_7libcbcf___pyx_scope_struct_35_iteritems},
  {Py_tp_new, (void *)__pyx_tp_new_5pysam_7libcbcf___pyx_scope_struct_35_iteritems},
  {0, 0},
};
static PyType_Spec __pyx_type_5pysam_7libcbcf___pyx_scope_struct_35_iteritems_spec = {
  "pysam.libcbcf.__pyx_scope_struct_35_iteritems",
  sizeof(struct __pyx_obj_5pysam_7libcbcf___pyx_scope_struct_35_iteritems),
  0,
  Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_VERSION_TAG|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_HAVE_GC|Py_TPFLAGS_HAVE_FINALIZE,
  __pyx_type_5pysam_7libcbcf___pyx_scope_struct_35_iteritems_slots,
};
#else

static PyTypeObject __pyx_type_5pysam_7libcbcf___pyx_scope_struct_35_iteritems = {
  PyVarObject_HEAD_INIT(0, 0)
  "pysam.libcbcf.""__pyx_scope_struct_35_iteritems", /*tp_name*/
  sizeof(struct __pyx_obj_5pysam_7libcbcf___pyx_scope_struct_35_iteritems), /*tp_basicsize*/
  0, /*tp_itemsize*/
  __pyx_tp_dealloc_5pysam_7libcbcf___pyx_scope_struct_35_iteritems, /*tp_dealloc*/
  #if PY_VERSION_HEX < 0x030800b4
  0, /*tp_print*/
  #endif
  #if PY_VERSION_HEX >= 0x030800b4
  0, /*tp_vectorcall_offset*/
  #endif
  0, /*tp_getattr*/
  0, /*tp_setattr*/
  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|Py_TPFLAGS_HAVE_FINALIZE, /*tp_flags*/
  0, /*tp_doc*/
  __pyx_tp_traverse_5pysam_7libcbcf___pyx_scope_struct_35_iteritems, /*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_5pysam_7libcbcf___pyx_scope_struct_35_iteritems, /*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 PY_VERSION_HEX >= 0x030800b1 && (!CYTHON_COMPILING_IN_PYPY || PYPY_VERSION_NUM >= 0x07030800)
  0, /*tp_vectorcall*/
  #endif
  #if __PYX_NEED_TP_PRINT_SLOT == 1
  0, /*tp_print*/
  #endif
  #if PY_VERSION_HEX >= 0x030C0000
  0, /*tp_watched*/
  #endif
  #if 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_5pysam_7libcbcf___pyx_scope_struct_36_itervalues(PyTypeObject *t, CYTHON_UNUSED PyObject *a, CYTHON_UNUSED PyObject *k) {
  PyObject *o;
  #if CYTHON_COMPILING_IN_LIMITED_API
  allocfunc alloc_func = (allocfunc)PyType_GetSlot(t, Py_tp_alloc);
  o = alloc_func(t, 0);
  #else
  #if CYTHON_USE_FREELISTS
  if (likely((int)(__pyx_mstate_global->__pyx_freecount_5pysam_7libcbcf___pyx_scope_struct_36_itervalues > 0) & (int)(t->tp_basicsize == sizeof(struct __pyx_obj_5pysam_7libcbcf___pyx_scope_struct_36_itervalues)))) {
    o = (PyObject*)__pyx_mstate_global->__pyx_freelist_5pysam_7libcbcf___pyx_scope_struct_36_itervalues[--__pyx_mstate_global->__pyx_freecount_5pysam_7libcbcf___pyx_scope_struct_36_itervalues];
    memset(o, 0, sizeof(struct __pyx_obj_5pysam_7libcbcf___pyx_scope_struct_36_itervalues));
    (void) PyObject_INIT(o, t);
    PyObject_GC_Track(o);
  } else
  #endif
  {
    o = (*t->tp_alloc)(t, 0);
    if (unlikely(!o)) return 0;
  }
  #endif
  return o;
}

static void __pyx_tp_dealloc_5pysam_7libcbcf___pyx_scope_struct_36_itervalues(PyObject *o) {
  struct __pyx_obj_5pysam_7libcbcf___pyx_scope_struct_36_itervalues *p = (struct __pyx_obj_5pysam_7libcbcf___pyx_scope_struct_36_itervalues *)o;
  #if CYTHON_USE_TP_FINALIZE
  if (unlikely((PY_VERSION_HEX >= 0x03080000 || __Pyx_PyType_HasFeature(Py_TYPE(o), Py_TPFLAGS_HAVE_FINALIZE)) && __Pyx_PyObject_GetSlot(o, tp_finalize, destructor)) && !__Pyx_PyObject_GC_IsFinalized(o)) {
    if (__Pyx_PyObject_GetSlot(o, tp_dealloc, destructor) == __pyx_tp_dealloc_5pysam_7libcbcf___pyx_scope_struct_36_itervalues) {
      if (PyObject_CallFinalizerFromDealloc(o)) return;
    }
  }
  #endif
  PyObject_GC_UnTrack(o);
  Py_CLEAR(p->__pyx_v_key);
  Py_CLEAR(p->__pyx_v_self);
  Py_CLEAR(p->__pyx_t_0);
  #if CYTHON_USE_FREELISTS
  if (((int)(__pyx_mstate_global->__pyx_freecount_5pysam_7libcbcf___pyx_scope_struct_36_itervalues < 8) & (int)(Py_TYPE(o)->tp_basicsize == sizeof(struct __pyx_obj_5pysam_7libcbcf___pyx_scope_struct_36_itervalues)))) {
    __pyx_mstate_global->__pyx_freelist_5pysam_7libcbcf___pyx_scope_struct_36_itervalues[__pyx_mstate_global->__pyx_freecount_5pysam_7libcbcf___pyx_scope_struct_36_itervalues++] = ((struct __pyx_obj_5pysam_7libcbcf___pyx_scope_struct_36_itervalues *)o);
  } else
  #endif
  {
    #if CYTHON_USE_TYPE_SLOTS
    (*Py_TYPE(o)->tp_free)(o);
    #else
    {
      freefunc tp_free = (freefunc)PyType_GetSlot(Py_TYPE(o), Py_tp_free);
      if (tp_free) tp_free(o);
    }
    #endif
  }
}

static int __pyx_tp_traverse_5pysam_7libcbcf___pyx_scope_struct_36_itervalues(PyObject *o, visitproc v, void *a) {
  int e;
  struct __pyx_obj_5pysam_7libcbcf___pyx_scope_struct_36_itervalues *p = (struct __pyx_obj_5pysam_7libcbcf___pyx_scope_struct_36_itervalues *)o;
  {
    e = __Pyx_call_type_traverse(o, 1, v, a);
    if (e) return e;
  }
  if (p->__pyx_v_key) {
    e = (*v)(p->__pyx_v_key, 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_5pysam_7libcbcf___pyx_scope_struct_36_itervalues_slots[] = {
  {Py_tp_dealloc, (void *)__pyx_tp_dealloc_5pysam_7libcbcf___pyx_scope_struct_36_itervalues},
  {Py_tp_traverse, (void *)__pyx_tp_traverse_5pysam_7libcbcf___pyx_scope_struct_36_itervalues},
  {Py_tp_new, (void *)__pyx_tp_new_5pysam_7libcbcf___pyx_scope_struct_36_itervalues},
  {0, 0},
};
static PyType_Spec __pyx_type_5pysam_7libcbcf___pyx_scope_struct_36_itervalues_spec = {
  "pysam.libcbcf.__pyx_scope_struct_36_itervalues",
  sizeof(struct __pyx_obj_5pysam_7libcbcf___pyx_scope_struct_36_itervalues),
  0,
  Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_VERSION_TAG|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_HAVE_GC|Py_TPFLAGS_HAVE_FINALIZE,
  __pyx_type_5pysam_7libcbcf___pyx_scope_struct_36_itervalues_slots,
};
#else

static PyTypeObject __pyx_type_5pysam_7libcbcf___pyx_scope_struct_36_itervalues = {
  PyVarObject_HEAD_INIT(0, 0)
  "pysam.libcbcf.""__pyx_scope_struct_36_itervalues", /*tp_name*/
  sizeof(struct __pyx_obj_5pysam_7libcbcf___pyx_scope_struct_36_itervalues), /*tp_basicsize*/
  0, /*tp_itemsize*/
  __pyx_tp_dealloc_5pysam_7libcbcf___pyx_scope_struct_36_itervalues, /*tp_dealloc*/
  #if PY_VERSION_HEX < 0x030800b4
  0, /*tp_print*/
  #endif
  #if PY_VERSION_HEX >= 0x030800b4
  0, /*tp_vectorcall_offset*/
  #endif
  0, /*tp_getattr*/
  0, /*tp_setattr*/
  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|Py_TPFLAGS_HAVE_FINALIZE, /*tp_flags*/
  0, /*tp_doc*/
  __pyx_tp_traverse_5pysam_7libcbcf___pyx_scope_struct_36_itervalues, /*tp_traverse*/
  0, /*tp_clear*/
  0, /*tp_richcompare*/
  0, /*tp_weaklistoffset*/
  0, /*tp_iter*/
  0, /*tp_iternext*/
  0, /*tp_methods*/
  0, /*tp_members*/
  0, /*tp_getset*/
  0, /*tp_base*/
  0, /*tp_dict*/
  0, /*tp_descr_get*/
  0, /*tp_descr_set*/
  #if !CYTHON_USE_TYPE_SPECS
  0, /*tp_dictoffset*/
  #endif
  0, /*tp_init*/
  0, /*tp_alloc*/
  __pyx_tp_new_5pysam_7libcbcf___pyx_scope_struct_36_itervalues, /*tp_new*/
  0, /*tp_free*/
  0, /*tp_is_gc*/
  0, /*tp_bases*/
  0, /*tp_mro*/
  0, /*tp_cache*/
  0, /*tp_subclasses*/
  0, /*tp_weaklist*/
  0, /*tp_del*/
  0, /*tp_version_tag*/
  #if CYTHON_USE_TP_FINALIZE
  0, /*tp_finalize*/
  #else
  NULL, /*tp_finalize*/
  #endif
  #if PY_VERSION_HEX >= 0x030800b1 && (!CYTHON_COMPILING_IN_PYPY || PYPY_VERSION_NUM >= 0x07030800)
  0, /*tp_vectorcall*/
  #endif
  #if __PYX_NEED_TP_PRINT_SLOT == 1
  0, /*tp_print*/
  #endif
  #if PY_VERSION_HEX >= 0x030C0000
  0, /*tp_watched*/
  #endif
  #if 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_5pysam_7libcbcf___pyx_scope_struct_37_iteritems(PyTypeObject *t, CYTHON_UNUSED PyObject *a, CYTHON_UNUSED PyObject *k) {
  PyObject *o;
  #if CYTHON_COMPILING_IN_LIMITED_API
  allocfunc alloc_func = (allocfunc)PyType_GetSlot(t, Py_tp_alloc);
  o = alloc_func(t, 0);
  #else
  #if CYTHON_USE_FREELISTS
  if (likely((int)(__pyx_mstate_global->__pyx_freecount_5pysam_7libcbcf___pyx_scope_struct_37_iteritems > 0) & (int)(t->tp_basicsize == sizeof(struct __pyx_obj_5pysam_7libcbcf___pyx_scope_struct_37_iteritems)))) {
    o = (PyObject*)__pyx_mstate_global->__pyx_freelist_5pysam_7libcbcf___pyx_scope_struct_37_iteritems[--__pyx_mstate_global->__pyx_freecount_5pysam_7libcbcf___pyx_scope_struct_37_iteritems];
    memset(o, 0, sizeof(struct __pyx_obj_5pysam_7libcbcf___pyx_scope_struct_37_iteritems));
    (void) PyObject_INIT(o, t);
    PyObject_GC_Track(o);
  } else
  #endif
  {
    o = (*t->tp_alloc)(t, 0);
    if (unlikely(!o)) return 0;
  }
  #endif
  return o;
}

static void __pyx_tp_dealloc_5pysam_7libcbcf___pyx_scope_struct_37_iteritems(PyObject *o) {
  struct __pyx_obj_5pysam_7libcbcf___pyx_scope_struct_37_iteritems *p = (struct __pyx_obj_5pysam_7libcbcf___pyx_scope_struct_37_iteritems *)o;
  #if CYTHON_USE_TP_FINALIZE
  if (unlikely((PY_VERSION_HEX >= 0x03080000 || __Pyx_PyType_HasFeature(Py_TYPE(o), Py_TPFLAGS_HAVE_FINALIZE)) && __Pyx_PyObject_GetSlot(o, tp_finalize, destructor)) && !__Pyx_PyObject_GC_IsFinalized(o)) {
    if (__Pyx_PyObject_GetSlot(o, tp_dealloc, destructor) == __pyx_tp_dealloc_5pysam_7libcbcf___pyx_scope_struct_37_iteritems) {
      if (PyObject_CallFinalizerFromDealloc(o)) return;
    }
  }
  #endif
  PyObject_GC_UnTrack(o);
  Py_CLEAR(p->__pyx_v_key);
  Py_CLEAR(p->__pyx_v_self);
  Py_CLEAR(p->__pyx_t_0);
  #if CYTHON_USE_FREELISTS
  if (((int)(__pyx_mstate_global->__pyx_freecount_5pysam_7libcbcf___pyx_scope_struct_37_iteritems < 8) & (int)(Py_TYPE(o)->tp_basicsize == sizeof(struct __pyx_obj_5pysam_7libcbcf___pyx_scope_struct_37_iteritems)))) {
    __pyx_mstate_global->__pyx_freelist_5pysam_7libcbcf___pyx_scope_struct_37_iteritems[__pyx_mstate_global->__pyx_freecount_5pysam_7libcbcf___pyx_scope_struct_37_iteritems++] = ((struct __pyx_obj_5pysam_7libcbcf___pyx_scope_struct_37_iteritems *)o);
  } else
  #endif
  {
    #if CYTHON_USE_TYPE_SLOTS
    (*Py_TYPE(o)->tp_free)(o);
    #else
    {
      freefunc tp_free = (freefunc)PyType_GetSlot(Py_TYPE(o), Py_tp_free);
      if (tp_free) tp_free(o);
    }
    #endif
  }
}

static int __pyx_tp_traverse_5pysam_7libcbcf___pyx_scope_struct_37_iteritems(PyObject *o, visitproc v, void *a) {
  int e;
  struct __pyx_obj_5pysam_7libcbcf___pyx_scope_struct_37_iteritems *p = (struct __pyx_obj_5pysam_7libcbcf___pyx_scope_struct_37_iteritems *)o;
  {
    e = __Pyx_call_type_traverse(o, 1, v, a);
    if (e) return e;
  }
  if (p->__pyx_v_key) {
    e = (*v)(p->__pyx_v_key, 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_5pysam_7libcbcf___pyx_scope_struct_37_iteritems_slots[] = {
  {Py_tp_dealloc, (void *)__pyx_tp_dealloc_5pysam_7libcbcf___pyx_scope_struct_37_iteritems},
  {Py_tp_traverse, (void *)__pyx_tp_traverse_5pysam_7libcbcf___pyx_scope_struct_37_iteritems},
  {Py_tp_new, (void *)__pyx_tp_new_5pysam_7libcbcf___pyx_scope_struct_37_iteritems},
  {0, 0},
};
static PyType_Spec __pyx_type_5pysam_7libcbcf___pyx_scope_struct_37_iteritems_spec = {
  "pysam.libcbcf.__pyx_scope_struct_37_iteritems",
  sizeof(struct __pyx_obj_5pysam_7libcbcf___pyx_scope_struct_37_iteritems),
  0,
  Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_VERSION_TAG|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_HAVE_GC|Py_TPFLAGS_HAVE_FINALIZE,
  __pyx_type_5pysam_7libcbcf___pyx_scope_struct_37_iteritems_slots,
};
#else

static PyTypeObject __pyx_type_5pysam_7libcbcf___pyx_scope_struct_37_iteritems = {
  PyVarObject_HEAD_INIT(0, 0)
  "pysam.libcbcf.""__pyx_scope_struct_37_iteritems", /*tp_name*/
  sizeof(struct __pyx_obj_5pysam_7libcbcf___pyx_scope_struct_37_iteritems), /*tp_basicsize*/
  0, /*tp_itemsize*/
  __pyx_tp_dealloc_5pysam_7libcbcf___pyx_scope_struct_37_iteritems, /*tp_dealloc*/
  #if PY_VERSION_HEX < 0x030800b4
  0, /*tp_print*/
  #endif
  #if PY_VERSION_HEX >= 0x030800b4
  0, /*tp_vectorcall_offset*/
  #endif
  0, /*tp_getattr*/
  0, /*tp_setattr*/
  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|Py_TPFLAGS_HAVE_FINALIZE, /*tp_flags*/
  0, /*tp_doc*/
  __pyx_tp_traverse_5pysam_7libcbcf___pyx_scope_struct_37_iteritems, /*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_5pysam_7libcbcf___pyx_scope_struct_37_iteritems, /*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 PY_VERSION_HEX >= 0x030800b1 && (!CYTHON_COMPILING_IN_PYPY || PYPY_VERSION_NUM >= 0x07030800)
  0, /*tp_vectorcall*/
  #endif
  #if __PYX_NEED_TP_PRINT_SLOT == 1
  0, /*tp_print*/
  #endif
  #if PY_VERSION_HEX >= 0x030C0000
  0, /*tp_watched*/
  #endif
  #if 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}
};
/* #### 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_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_v_5pysam_7libcbcf_VALUE_TYPES = ((PyObject*)Py_None); Py_INCREF(Py_None);
  __pyx_v_5pysam_7libcbcf_METADATA_TYPES = ((PyObject*)Py_None); Py_INCREF(Py_None);
  __pyx_v_5pysam_7libcbcf_METADATA_LENGTHS = ((PyObject*)Py_None); Py_INCREF(Py_None);
  __pyx_v_5pysam_7libcbcf__nothing = Py_None; Py_INCREF(Py_None);
  __pyx_v_5pysam_7libcbcf_bcf_str_cache = ((PyObject*)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;
  PyObject *__pyx_t_2 = 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 ---*/
  __pyx_vtabptr_5pysam_7libcbcf_VariantHeader = &__pyx_vtable_5pysam_7libcbcf_VariantHeader;
  __pyx_vtable_5pysam_7libcbcf_VariantHeader._add_sample = (PyObject *(*)(struct __pyx_obj_5pysam_7libcbcf_VariantHeader *, PyObject *))__pyx_f_5pysam_7libcbcf_13VariantHeader__add_sample;
  __pyx_vtable_5pysam_7libcbcf_VariantHeader._hdr_sync = (PyObject *(*)(struct __pyx_obj_5pysam_7libcbcf_VariantHeader *))__pyx_f_5pysam_7libcbcf_13VariantHeader__hdr_sync;
  __pyx_vtable_5pysam_7libcbcf_VariantHeader._subset_samples = (PyObject *(*)(struct __pyx_obj_5pysam_7libcbcf_VariantHeader *, PyObject *))__pyx_f_5pysam_7libcbcf_13VariantHeader__subset_samples;
  #if CYTHON_USE_TYPE_SPECS
  __pyx_mstate->__pyx_ptype_5pysam_7libcbcf_VariantHeader = (PyTypeObject *) __Pyx_PyType_FromModuleAndSpec(__pyx_m, &__pyx_type_5pysam_7libcbcf_VariantHeader_spec, NULL); if (unlikely(!__pyx_mstate->__pyx_ptype_5pysam_7libcbcf_VariantHeader)) __PYX_ERR(0, 1957, __pyx_L1_error)
  if (__Pyx_fix_up_extension_type_from_spec(&__pyx_type_5pysam_7libcbcf_VariantHeader_spec, __pyx_mstate->__pyx_ptype_5pysam_7libcbcf_VariantHeader) < 0) __PYX_ERR(0, 1957, __pyx_L1_error)
  #else
  __pyx_mstate->__pyx_ptype_5pysam_7libcbcf_VariantHeader = &__pyx_type_5pysam_7libcbcf_VariantHeader;
  #endif
  #if !CYTHON_COMPILING_IN_LIMITED_API
  #endif
  #if !CYTHON_USE_TYPE_SPECS
  if (__Pyx_PyType_Ready(__pyx_mstate->__pyx_ptype_5pysam_7libcbcf_VariantHeader) < 0) __PYX_ERR(0, 1957, __pyx_L1_error)
  #endif
  #if !CYTHON_COMPILING_IN_LIMITED_API
  if ((CYTHON_USE_TYPE_SLOTS && CYTHON_USE_PYTYPE_LOOKUP) && likely(!__pyx_mstate->__pyx_ptype_5pysam_7libcbcf_VariantHeader->tp_dictoffset && __pyx_mstate->__pyx_ptype_5pysam_7libcbcf_VariantHeader->tp_getattro == PyObject_GenericGetAttr)) {
    __pyx_mstate->__pyx_ptype_5pysam_7libcbcf_VariantHeader->tp_getattro = PyObject_GenericGetAttr;
  }
  #endif
  if (__Pyx_SetVtable(__pyx_mstate->__pyx_ptype_5pysam_7libcbcf_VariantHeader, __pyx_vtabptr_5pysam_7libcbcf_VariantHeader) < 0) __PYX_ERR(0, 1957, __pyx_L1_error)
  if (__Pyx_MergeVtables(__pyx_mstate->__pyx_ptype_5pysam_7libcbcf_VariantHeader) < 0) __PYX_ERR(0, 1957, __pyx_L1_error)
  if (PyObject_SetAttr(__pyx_m, __pyx_mstate_global->__pyx_n_u_VariantHeader, (PyObject *) __pyx_mstate->__pyx_ptype_5pysam_7libcbcf_VariantHeader) < 0) __PYX_ERR(0, 1957, __pyx_L1_error)
  if (__Pyx_setup_reduce((PyObject *) __pyx_mstate->__pyx_ptype_5pysam_7libcbcf_VariantHeader) < 0) __PYX_ERR(0, 1957, __pyx_L1_error)
  #if CYTHON_USE_TYPE_SPECS
  __pyx_mstate->__pyx_ptype_5pysam_7libcbcf_VariantHeaderRecord = (PyTypeObject *) __Pyx_PyType_FromModuleAndSpec(__pyx_m, &__pyx_type_5pysam_7libcbcf_VariantHeaderRecord_spec, NULL); if (unlikely(!__pyx_mstate->__pyx_ptype_5pysam_7libcbcf_VariantHeaderRecord)) __PYX_ERR(0, 1249, __pyx_L1_error)
  if (__Pyx_fix_up_extension_type_from_spec(&__pyx_type_5pysam_7libcbcf_VariantHeaderRecord_spec, __pyx_mstate->__pyx_ptype_5pysam_7libcbcf_VariantHeaderRecord) < 0) __PYX_ERR(0, 1249, __pyx_L1_error)
  #else
  __pyx_mstate->__pyx_ptype_5pysam_7libcbcf_VariantHeaderRecord = &__pyx_type_5pysam_7libcbcf_VariantHeaderRecord;
  #endif
  #if !CYTHON_COMPILING_IN_LIMITED_API
  #endif
  #if !CYTHON_USE_TYPE_SPECS
  if (__Pyx_PyType_Ready(__pyx_mstate->__pyx_ptype_5pysam_7libcbcf_VariantHeaderRecord) < 0) __PYX_ERR(0, 1249, __pyx_L1_error)
  #endif
  #if !CYTHON_COMPILING_IN_LIMITED_API
  if ((CYTHON_USE_TYPE_SLOTS && CYTHON_USE_PYTYPE_LOOKUP) && likely(!__pyx_mstate->__pyx_ptype_5pysam_7libcbcf_VariantHeaderRecord->tp_dictoffset && __pyx_mstate->__pyx_ptype_5pysam_7libcbcf_VariantHeaderRecord->tp_getattro == PyObject_GenericGetAttr)) {
    __pyx_mstate->__pyx_ptype_5pysam_7libcbcf_VariantHeaderRecord->tp_getattro = PyObject_GenericGetAttr;
  }
  #endif
  #if CYTHON_UPDATE_DESCRIPTOR_DOC
  {
    PyObject *wrapper = PyObject_GetAttrString((PyObject *)__pyx_mstate->__pyx_ptype_5pysam_7libcbcf_VariantHeaderRecord, "__getitem__"); if (unlikely(!wrapper)) __PYX_ERR(0, 1249, __pyx_L1_error)
    if (__Pyx_IS_TYPE(wrapper, &PyWrapperDescr_Type)) {
      __pyx_wrapperbase_5pysam_7libcbcf_19VariantHeaderRecord_6__getitem__ = *((PyWrapperDescrObject *)wrapper)->d_base;
      __pyx_wrapperbase_5pysam_7libcbcf_19VariantHeaderRecord_6__getitem__.doc = __pyx_doc_5pysam_7libcbcf_19VariantHeaderRecord_6__getitem__;
      ((PyWrapperDescrObject *)wrapper)->d_base = &__pyx_wrapperbase_5pysam_7libcbcf_19VariantHeaderRecord_6__getitem__;
    }
  }
  #endif
  if (PyObject_SetAttr(__pyx_m, __pyx_mstate_global->__pyx_n_u_VariantHeaderRecord, (PyObject *) __pyx_mstate->__pyx_ptype_5pysam_7libcbcf_VariantHeaderRecord) < 0) __PYX_ERR(0, 1249, __pyx_L1_error)
  if (__Pyx_setup_reduce((PyObject *) __pyx_mstate->__pyx_ptype_5pysam_7libcbcf_VariantHeaderRecord) < 0) __PYX_ERR(0, 1249, __pyx_L1_error)
  #if CYTHON_USE_TYPE_SPECS
  __pyx_mstate->__pyx_ptype_5pysam_7libcbcf_VariantHeaderRecords = (PyTypeObject *) __Pyx_PyType_FromModuleAndSpec(__pyx_m, &__pyx_type_5pysam_7libcbcf_VariantHeaderRecords_spec, NULL); if (unlikely(!__pyx_mstate->__pyx_ptype_5pysam_7libcbcf_VariantHeaderRecords)) __PYX_ERR(0, 1436, __pyx_L1_error)
  if (__Pyx_fix_up_extension_type_from_spec(&__pyx_type_5pysam_7libcbcf_VariantHeaderRecords_spec, __pyx_mstate->__pyx_ptype_5pysam_7libcbcf_VariantHeaderRecords) < 0) __PYX_ERR(0, 1436, __pyx_L1_error)
  #else
  __pyx_mstate->__pyx_ptype_5pysam_7libcbcf_VariantHeaderRecords = &__pyx_type_5pysam_7libcbcf_VariantHeaderRecords;
  #endif
  #if !CYTHON_COMPILING_IN_LIMITED_API
  #endif
  #if !CYTHON_USE_TYPE_SPECS
  if (__Pyx_PyType_Ready(__pyx_mstate->__pyx_ptype_5pysam_7libcbcf_VariantHeaderRecords) < 0) __PYX_ERR(0, 1436, __pyx_L1_error)
  #endif
  #if !CYTHON_COMPILING_IN_LIMITED_API
  if ((CYTHON_USE_TYPE_SLOTS && CYTHON_USE_PYTYPE_LOOKUP) && likely(!__pyx_mstate->__pyx_ptype_5pysam_7libcbcf_VariantHeaderRecords->tp_dictoffset && __pyx_mstate->__pyx_ptype_5pysam_7libcbcf_VariantHeaderRecords->tp_getattro == PyObject_GenericGetAttr)) {
    __pyx_mstate->__pyx_ptype_5pysam_7libcbcf_VariantHeaderRecords->tp_getattro = PyObject_GenericGetAttr;
  }
  #endif
  if (PyObject_SetAttr(__pyx_m, __pyx_mstate_global->__pyx_n_u_VariantHeaderRecords, (PyObject *) __pyx_mstate->__pyx_ptype_5pysam_7libcbcf_VariantHeaderRecords) < 0) __PYX_ERR(0, 1436, __pyx_L1_error)
  if (__Pyx_setup_reduce((PyObject *) __pyx_mstate->__pyx_ptype_5pysam_7libcbcf_VariantHeaderRecords) < 0) __PYX_ERR(0, 1436, __pyx_L1_error)
  #if CYTHON_USE_TYPE_SPECS
  __pyx_mstate->__pyx_ptype_5pysam_7libcbcf_VariantHeaderContigs = (PyTypeObject *) __Pyx_PyType_FromModuleAndSpec(__pyx_m, &__pyx_type_5pysam_7libcbcf_VariantHeaderContigs_spec, NULL); if (unlikely(!__pyx_mstate->__pyx_ptype_5pysam_7libcbcf_VariantHeaderContigs)) __PYX_ERR(0, 1761, __pyx_L1_error)
  if (__Pyx_fix_up_extension_type_from_spec(&__pyx_type_5pysam_7libcbcf_VariantHeaderContigs_spec, __pyx_mstate->__pyx_ptype_5pysam_7libcbcf_VariantHeaderContigs) < 0) __PYX_ERR(0, 1761, __pyx_L1_error)
  #else
  __pyx_mstate->__pyx_ptype_5pysam_7libcbcf_VariantHeaderContigs = &__pyx_type_5pysam_7libcbcf_VariantHeaderContigs;
  #endif
  #if !CYTHON_COMPILING_IN_LIMITED_API
  #endif
  #if !CYTHON_USE_TYPE_SPECS
  if (__Pyx_PyType_Ready(__pyx_mstate->__pyx_ptype_5pysam_7libcbcf_VariantHeaderContigs) < 0) __PYX_ERR(0, 1761, __pyx_L1_error)
  #endif
  #if !CYTHON_COMPILING_IN_LIMITED_API
  if ((CYTHON_USE_TYPE_SLOTS && CYTHON_USE_PYTYPE_LOOKUP) && likely(!__pyx_mstate->__pyx_ptype_5pysam_7libcbcf_VariantHeaderContigs->tp_dictoffset && __pyx_mstate->__pyx_ptype_5pysam_7libcbcf_VariantHeaderContigs->tp_getattro == PyObject_GenericGetAttr)) {
    __pyx_mstate->__pyx_ptype_5pysam_7libcbcf_VariantHeaderContigs->tp_getattro = PyObject_GenericGetAttr;
  }
  #endif
  if (PyObject_SetAttr(__pyx_m, __pyx_mstate_global->__pyx_n_u_VariantHeaderContigs, (PyObject *) __pyx_mstate->__pyx_ptype_5pysam_7libcbcf_VariantHeaderContigs) < 0) __PYX_ERR(0, 1761, __pyx_L1_error)
  if (__Pyx_setup_reduce((PyObject *) __pyx_mstate->__pyx_ptype_5pysam_7libcbcf_VariantHeaderContigs) < 0) __PYX_ERR(0, 1761, __pyx_L1_error)
  #if CYTHON_USE_TYPE_SPECS
  __pyx_mstate->__pyx_ptype_5pysam_7libcbcf_VariantHeaderSamples = (PyTypeObject *) __Pyx_PyType_FromModuleAndSpec(__pyx_m, &__pyx_type_5pysam_7libcbcf_VariantHeaderSamples_spec, NULL); if (unlikely(!__pyx_mstate->__pyx_ptype_5pysam_7libcbcf_VariantHeaderSamples)) __PYX_ERR(0, 1901, __pyx_L1_error)
  if (__Pyx_fix_up_extension_type_from_spec(&__pyx_type_5pysam_7libcbcf_VariantHeaderSamples_spec, __pyx_mstate->__pyx_ptype_5pysam_7libcbcf_VariantHeaderSamples) < 0) __PYX_ERR(0, 1901, __pyx_L1_error)
  #else
  __pyx_mstate->__pyx_ptype_5pysam_7libcbcf_VariantHeaderSamples = &__pyx_type_5pysam_7libcbcf_VariantHeaderSamples;
  #endif
  #if !CYTHON_COMPILING_IN_LIMITED_API
  #endif
  #if !CYTHON_USE_TYPE_SPECS
  if (__Pyx_PyType_Ready(__pyx_mstate->__pyx_ptype_5pysam_7libcbcf_VariantHeaderSamples) < 0) __PYX_ERR(0, 1901, __pyx_L1_error)
  #endif
  #if !CYTHON_COMPILING_IN_LIMITED_API
  if ((CYTHON_USE_TYPE_SLOTS && CYTHON_USE_PYTYPE_LOOKUP) && likely(!__pyx_mstate->__pyx_ptype_5pysam_7libcbcf_VariantHeaderSamples->tp_dictoffset && __pyx_mstate->__pyx_ptype_5pysam_7libcbcf_VariantHeaderSamples->tp_getattro == PyObject_GenericGetAttr)) {
    __pyx_mstate->__pyx_ptype_5pysam_7libcbcf_VariantHeaderSamples->tp_getattro = PyObject_GenericGetAttr;
  }
  #endif
  if (PyObject_SetAttr(__pyx_m, __pyx_mstate_global->__pyx_n_u_VariantHeaderSamples, (PyObject *) __pyx_mstate->__pyx_ptype_5pysam_7libcbcf_VariantHeaderSamples) < 0) __PYX_ERR(0, 1901, __pyx_L1_error)
  if (__Pyx_setup_reduce((PyObject *) __pyx_mstate->__pyx_ptype_5pysam_7libcbcf_VariantHeaderSamples) < 0) __PYX_ERR(0, 1901, __pyx_L1_error)
  #if CYTHON_USE_TYPE_SPECS
  __pyx_mstate->__pyx_ptype_5pysam_7libcbcf_VariantContig = (PyTypeObject *) __Pyx_PyType_FromModuleAndSpec(__pyx_m, &__pyx_type_5pysam_7libcbcf_VariantContig_spec, NULL); if (unlikely(!__pyx_mstate->__pyx_ptype_5pysam_7libcbcf_VariantContig)) __PYX_ERR(0, 1711, __pyx_L1_error)
  if (__Pyx_fix_up_extension_type_from_spec(&__pyx_type_5pysam_7libcbcf_VariantContig_spec, __pyx_mstate->__pyx_ptype_5pysam_7libcbcf_VariantContig) < 0) __PYX_ERR(0, 1711, __pyx_L1_error)
  #else
  __pyx_mstate->__pyx_ptype_5pysam_7libcbcf_VariantContig = &__pyx_type_5pysam_7libcbcf_VariantContig;
  #endif
  #if !CYTHON_COMPILING_IN_LIMITED_API
  #endif
  #if !CYTHON_USE_TYPE_SPECS
  if (__Pyx_PyType_Ready(__pyx_mstate->__pyx_ptype_5pysam_7libcbcf_VariantContig) < 0) __PYX_ERR(0, 1711, __pyx_L1_error)
  #endif
  #if !CYTHON_COMPILING_IN_LIMITED_API
  if ((CYTHON_USE_TYPE_SLOTS && CYTHON_USE_PYTYPE_LOOKUP) && likely(!__pyx_mstate->__pyx_ptype_5pysam_7libcbcf_VariantContig->tp_dictoffset && __pyx_mstate->__pyx_ptype_5pysam_7libcbcf_VariantContig->tp_getattro == PyObject_GenericGetAttr)) {
    __pyx_mstate->__pyx_ptype_5pysam_7libcbcf_VariantContig->tp_getattro = PyObject_GenericGetAttr;
  }
  #endif
  if (PyObject_SetAttr(__pyx_m, __pyx_mstate_global->__pyx_n_u_VariantContig, (PyObject *) __pyx_mstate->__pyx_ptype_5pysam_7libcbcf_VariantContig) < 0) __PYX_ERR(0, 1711, __pyx_L1_error)
  if (__Pyx_setup_reduce((PyObject *) __pyx_mstate->__pyx_ptype_5pysam_7libcbcf_VariantContig) < 0) __PYX_ERR(0, 1711, __pyx_L1_error)
  #if CYTHON_USE_TYPE_SPECS
  __pyx_mstate->__pyx_ptype_5pysam_7libcbcf_VariantMetadata = (PyTypeObject *) __Pyx_PyType_FromModuleAndSpec(__pyx_m, &__pyx_type_5pysam_7libcbcf_VariantMetadata_spec, NULL); if (unlikely(!__pyx_mstate->__pyx_ptype_5pysam_7libcbcf_VariantMetadata)) __PYX_ERR(0, 1470, __pyx_L1_error)
  if (__Pyx_fix_up_extension_type_from_spec(&__pyx_type_5pysam_7libcbcf_VariantMetadata_spec, __pyx_mstate->__pyx_ptype_5pysam_7libcbcf_VariantMetadata) < 0) __PYX_ERR(0, 1470, __pyx_L1_error)
  #else
  __pyx_mstate->__pyx_ptype_5pysam_7libcbcf_VariantMetadata = &__pyx_type_5pysam_7libcbcf_VariantMetadata;
  #endif
  #if !CYTHON_COMPILING_IN_LIMITED_API
  #endif
  #if !CYTHON_USE_TYPE_SPECS
  if (__Pyx_PyType_Ready(__pyx_mstate->__pyx_ptype_5pysam_7libcbcf_VariantMetadata) < 0) __PYX_ERR(0, 1470, __pyx_L1_error)
  #endif
  #if !CYTHON_COMPILING_IN_LIMITED_API
  if ((CYTHON_USE_TYPE_SLOTS && CYTHON_USE_PYTYPE_LOOKUP) && likely(!__pyx_mstate->__pyx_ptype_5pysam_7libcbcf_VariantMetadata->tp_dictoffset && __pyx_mstate->__pyx_ptype_5pysam_7libcbcf_VariantMetadata->tp_getattro == PyObject_GenericGetAttr)) {
    __pyx_mstate->__pyx_ptype_5pysam_7libcbcf_VariantMetadata->tp_getattro = PyObject_GenericGetAttr;
  }
  #endif
  if (PyObject_SetAttr(__pyx_m, __pyx_mstate_global->__pyx_n_u_VariantMetadata, (PyObject *) __pyx_mstate->__pyx_ptype_5pysam_7libcbcf_VariantMetadata) < 0) __PYX_ERR(0, 1470, __pyx_L1_error)
  if (__Pyx_setup_reduce((PyObject *) __pyx_mstate->__pyx_ptype_5pysam_7libcbcf_VariantMetadata) < 0) __PYX_ERR(0, 1470, __pyx_L1_error)
  #if CYTHON_USE_TYPE_SPECS
  __pyx_mstate->__pyx_ptype_5pysam_7libcbcf_VariantHeaderMetadata = (PyTypeObject *) __Pyx_PyType_FromModuleAndSpec(__pyx_m, &__pyx_type_5pysam_7libcbcf_VariantHeaderMetadata_spec, NULL); if (unlikely(!__pyx_mstate->__pyx_ptype_5pysam_7libcbcf_VariantHeaderMetadata)) __PYX_ERR(0, 1560, __pyx_L1_error)
  if (__Pyx_fix_up_extension_type_from_spec(&__pyx_type_5pysam_7libcbcf_VariantHeaderMetadata_spec, __pyx_mstate->__pyx_ptype_5pysam_7libcbcf_VariantHeaderMetadata) < 0) __PYX_ERR(0, 1560, __pyx_L1_error)
  #else
  __pyx_mstate->__pyx_ptype_5pysam_7libcbcf_VariantHeaderMetadata = &__pyx_type_5pysam_7libcbcf_VariantHeaderMetadata;
  #endif
  #if !CYTHON_COMPILING_IN_LIMITED_API
  #endif
  #if !CYTHON_USE_TYPE_SPECS
  if (__Pyx_PyType_Ready(__pyx_mstate->__pyx_ptype_5pysam_7libcbcf_VariantHeaderMetadata) < 0) __PYX_ERR(0, 1560, __pyx_L1_error)
  #endif
  #if !CYTHON_COMPILING_IN_LIMITED_API
  if ((CYTHON_USE_TYPE_SLOTS && CYTHON_USE_PYTYPE_LOOKUP) && likely(!__pyx_mstate->__pyx_ptype_5pysam_7libcbcf_VariantHeaderMetadata->tp_dictoffset && __pyx_mstate->__pyx_ptype_5pysam_7libcbcf_VariantHeaderMetadata->tp_getattro == PyObject_GenericGetAttr)) {
    __pyx_mstate->__pyx_ptype_5pysam_7libcbcf_VariantHeaderMetadata->tp_getattro = PyObject_GenericGetAttr;
  }
  #endif
  if (PyObject_SetAttr(__pyx_m, __pyx_mstate_global->__pyx_n_u_VariantHeaderMetadata, (PyObject *) __pyx_mstate->__pyx_ptype_5pysam_7libcbcf_VariantHeaderMetadata) < 0) __PYX_ERR(0, 1560, __pyx_L1_error)
  if (__Pyx_setup_reduce((PyObject *) __pyx_mstate->__pyx_ptype_5pysam_7libcbcf_VariantHeaderMetadata) < 0) __PYX_ERR(0, 1560, __pyx_L1_error)
  #if CYTHON_USE_TYPE_SPECS
  __pyx_mstate->__pyx_ptype_5pysam_7libcbcf_VariantRecord = (PyTypeObject *) __Pyx_PyType_FromModuleAndSpec(__pyx_m, &__pyx_type_5pysam_7libcbcf_VariantRecord_spec, NULL); if (unlikely(!__pyx_mstate->__pyx_ptype_5pysam_7libcbcf_VariantRecord)) __PYX_ERR(0, 3019, __pyx_L1_error)
  if (__Pyx_fix_up_extension_type_from_spec(&__pyx_type_5pysam_7libcbcf_VariantRecord_spec, __pyx_mstate->__pyx_ptype_5pysam_7libcbcf_VariantRecord) < 0) __PYX_ERR(0, 3019, __pyx_L1_error)
  #else
  __pyx_mstate->__pyx_ptype_5pysam_7libcbcf_VariantRecord = &__pyx_type_5pysam_7libcbcf_VariantRecord;
  #endif
  #if !CYTHON_COMPILING_IN_LIMITED_API
  #endif
  #if !CYTHON_USE_TYPE_SPECS
  if (__Pyx_PyType_Ready(__pyx_mstate->__pyx_ptype_5pysam_7libcbcf_VariantRecord) < 0) __PYX_ERR(0, 3019, __pyx_L1_error)
  #endif
  #if !CYTHON_COMPILING_IN_LIMITED_API
  if ((CYTHON_USE_TYPE_SLOTS && CYTHON_USE_PYTYPE_LOOKUP) && likely(!__pyx_mstate->__pyx_ptype_5pysam_7libcbcf_VariantRecord->tp_dictoffset && __pyx_mstate->__pyx_ptype_5pysam_7libcbcf_VariantRecord->tp_getattro == PyObject_GenericGetAttr)) {
    __pyx_mstate->__pyx_ptype_5pysam_7libcbcf_VariantRecord->tp_getattro = PyObject_GenericGetAttr;
  }
  #endif
  if (PyObject_SetAttr(__pyx_m, __pyx_mstate_global->__pyx_n_u_VariantRecord, (PyObject *) __pyx_mstate->__pyx_ptype_5pysam_7libcbcf_VariantRecord) < 0) __PYX_ERR(0, 3019, __pyx_L1_error)
  if (__Pyx_setup_reduce((PyObject *) __pyx_mstate->__pyx_ptype_5pysam_7libcbcf_VariantRecord) < 0) __PYX_ERR(0, 3019, __pyx_L1_error)
  #if CYTHON_USE_TYPE_SPECS
  __pyx_mstate->__pyx_ptype_5pysam_7libcbcf_VariantRecordFilter = (PyTypeObject *) __Pyx_PyType_FromModuleAndSpec(__pyx_m, &__pyx_type_5pysam_7libcbcf_VariantRecordFilter_spec, NULL); if (unlikely(!__pyx_mstate->__pyx_ptype_5pysam_7libcbcf_VariantRecordFilter)) __PYX_ERR(0, 2238, __pyx_L1_error)
  if (__Pyx_fix_up_extension_type_from_spec(&__pyx_type_5pysam_7libcbcf_VariantRecordFilter_spec, __pyx_mstate->__pyx_ptype_5pysam_7libcbcf_VariantRecordFilter) < 0) __PYX_ERR(0, 2238, __pyx_L1_error)
  #else
  __pyx_mstate->__pyx_ptype_5pysam_7libcbcf_VariantRecordFilter = &__pyx_type_5pysam_7libcbcf_VariantRecordFilter;
  #endif
  #if !CYTHON_COMPILING_IN_LIMITED_API
  #endif
  #if !CYTHON_USE_TYPE_SPECS
  if (__Pyx_PyType_Ready(__pyx_mstate->__pyx_ptype_5pysam_7libcbcf_VariantRecordFilter) < 0) __PYX_ERR(0, 2238, __pyx_L1_error)
  #endif
  #if !CYTHON_COMPILING_IN_LIMITED_API
  if ((CYTHON_USE_TYPE_SLOTS && CYTHON_USE_PYTYPE_LOOKUP) && likely(!__pyx_mstate->__pyx_ptype_5pysam_7libcbcf_VariantRecordFilter->tp_dictoffset && __pyx_mstate->__pyx_ptype_5pysam_7libcbcf_VariantRecordFilter->tp_getattro == PyObject_GenericGetAttr)) {
    __pyx_mstate->__pyx_ptype_5pysam_7libcbcf_VariantRecordFilter->tp_getattro = PyObject_GenericGetAttr;
  }
  #endif
  if (PyObject_SetAttr(__pyx_m, __pyx_mstate_global->__pyx_n_u_VariantRecordFilter, (PyObject *) __pyx_mstate->__pyx_ptype_5pysam_7libcbcf_VariantRecordFilter) < 0) __PYX_ERR(0, 2238, __pyx_L1_error)
  if (__Pyx_setup_reduce((PyObject *) __pyx_mstate->__pyx_ptype_5pysam_7libcbcf_VariantRecordFilter) < 0) __PYX_ERR(0, 2238, __pyx_L1_error)
  #if CYTHON_USE_TYPE_SPECS
  __pyx_mstate->__pyx_ptype_5pysam_7libcbcf_VariantRecordFormat = (PyTypeObject *) __Pyx_PyType_FromModuleAndSpec(__pyx_m, &__pyx_type_5pysam_7libcbcf_VariantRecordFormat_spec, NULL); if (unlikely(!__pyx_mstate->__pyx_ptype_5pysam_7libcbcf_VariantRecordFormat)) __PYX_ERR(0, 2400, __pyx_L1_error)
  if (__Pyx_fix_up_extension_type_from_spec(&__pyx_type_5pysam_7libcbcf_VariantRecordFormat_spec, __pyx_mstate->__pyx_ptype_5pysam_7libcbcf_VariantRecordFormat) < 0) __PYX_ERR(0, 2400, __pyx_L1_error)
  #else
  __pyx_mstate->__pyx_ptype_5pysam_7libcbcf_VariantRecordFormat = &__pyx_type_5pysam_7libcbcf_VariantRecordFormat;
  #endif
  #if !CYTHON_COMPILING_IN_LIMITED_API
  #endif
  #if !CYTHON_USE_TYPE_SPECS
  if (__Pyx_PyType_Ready(__pyx_mstate->__pyx_ptype_5pysam_7libcbcf_VariantRecordFormat) < 0) __PYX_ERR(0, 2400, __pyx_L1_error)
  #endif
  #if !CYTHON_COMPILING_IN_LIMITED_API
  if ((CYTHON_USE_TYPE_SLOTS && CYTHON_USE_PYTYPE_LOOKUP) && likely(!__pyx_mstate->__pyx_ptype_5pysam_7libcbcf_VariantRecordFormat->tp_dictoffset && __pyx_mstate->__pyx_ptype_5pysam_7libcbcf_VariantRecordFormat->tp_getattro == PyObject_GenericGetAttr)) {
    __pyx_mstate->__pyx_ptype_5pysam_7libcbcf_VariantRecordFormat->tp_getattro = PyObject_GenericGetAttr;
  }
  #endif
  if (PyObject_SetAttr(__pyx_m, __pyx_mstate_global->__pyx_n_u_VariantRecordFormat, (PyObject *) __pyx_mstate->__pyx_ptype_5pysam_7libcbcf_VariantRecordFormat) < 0) __PYX_ERR(0, 2400, __pyx_L1_error)
  if (__Pyx_setup_reduce((PyObject *) __pyx_mstate->__pyx_ptype_5pysam_7libcbcf_VariantRecordFormat) < 0) __PYX_ERR(0, 2400, __pyx_L1_error)
  #if CYTHON_USE_TYPE_SPECS
  __pyx_mstate->__pyx_ptype_5pysam_7libcbcf_VariantRecordInfo = (PyTypeObject *) __Pyx_PyType_FromModuleAndSpec(__pyx_m, &__pyx_type_5pysam_7libcbcf_VariantRecordInfo_spec, NULL); if (unlikely(!__pyx_mstate->__pyx_ptype_5pysam_7libcbcf_VariantRecordInfo)) __PYX_ERR(0, 2535, __pyx_L1_error)
  if (__Pyx_fix_up_extension_type_from_spec(&__pyx_type_5pysam_7libcbcf_VariantRecordInfo_spec, __pyx_mstate->__pyx_ptype_5pysam_7libcbcf_VariantRecordInfo) < 0) __PYX_ERR(0, 2535, __pyx_L1_error)
  #else
  __pyx_mstate->__pyx_ptype_5pysam_7libcbcf_VariantRecordInfo = &__pyx_type_5pysam_7libcbcf_VariantRecordInfo;
  #endif
  #if !CYTHON_COMPILING_IN_LIMITED_API
  #endif
  #if !CYTHON_USE_TYPE_SPECS
  if (__Pyx_PyType_Ready(__pyx_mstate->__pyx_ptype_5pysam_7libcbcf_VariantRecordInfo) < 0) __PYX_ERR(0, 2535, __pyx_L1_error)
  #endif
  #if !CYTHON_COMPILING_IN_LIMITED_API
  if ((CYTHON_USE_TYPE_SLOTS && CYTHON_USE_PYTYPE_LOOKUP) && likely(!__pyx_mstate->__pyx_ptype_5pysam_7libcbcf_VariantRecordInfo->tp_dictoffset && __pyx_mstate->__pyx_ptype_5pysam_7libcbcf_VariantRecordInfo->tp_getattro == PyObject_GenericGetAttr)) {
    __pyx_mstate->__pyx_ptype_5pysam_7libcbcf_VariantRecordInfo->tp_getattro = PyObject_GenericGetAttr;
  }
  #endif
  if (PyObject_SetAttr(__pyx_m, __pyx_mstate_global->__pyx_n_u_VariantRecordInfo, (PyObject *) __pyx_mstate->__pyx_ptype_5pysam_7libcbcf_VariantRecordInfo) < 0) __PYX_ERR(0, 2535, __pyx_L1_error)
  if (__Pyx_setup_reduce((PyObject *) __pyx_mstate->__pyx_ptype_5pysam_7libcbcf_VariantRecordInfo) < 0) __PYX_ERR(0, 2535, __pyx_L1_error)
  #if CYTHON_USE_TYPE_SPECS
  __pyx_mstate->__pyx_ptype_5pysam_7libcbcf_VariantRecordSamples = (PyTypeObject *) __Pyx_PyType_FromModuleAndSpec(__pyx_m, &__pyx_type_5pysam_7libcbcf_VariantRecordSamples_spec, NULL); if (unlikely(!__pyx_mstate->__pyx_ptype_5pysam_7libcbcf_VariantRecordSamples)) __PYX_ERR(0, 2869, __pyx_L1_error)
  if (__Pyx_fix_up_extension_type_from_spec(&__pyx_type_5pysam_7libcbcf_VariantRecordSamples_spec, __pyx_mstate->__pyx_ptype_5pysam_7libcbcf_VariantRecordSamples) < 0) __PYX_ERR(0, 2869, __pyx_L1_error)
  #else
  __pyx_mstate->__pyx_ptype_5pysam_7libcbcf_VariantRecordSamples = &__pyx_type_5pysam_7libcbcf_VariantRecordSamples;
  #endif
  #if !CYTHON_COMPILING_IN_LIMITED_API
  #endif
  #if !CYTHON_USE_TYPE_SPECS
  if (__Pyx_PyType_Ready(__pyx_mstate->__pyx_ptype_5pysam_7libcbcf_VariantRecordSamples) < 0) __PYX_ERR(0, 2869, __pyx_L1_error)
  #endif
  #if !CYTHON_COMPILING_IN_LIMITED_API
  if ((CYTHON_USE_TYPE_SLOTS && CYTHON_USE_PYTYPE_LOOKUP) && likely(!__pyx_mstate->__pyx_ptype_5pysam_7libcbcf_VariantRecordSamples->tp_dictoffset && __pyx_mstate->__pyx_ptype_5pysam_7libcbcf_VariantRecordSamples->tp_getattro == PyObject_GenericGetAttr)) {
    __pyx_mstate->__pyx_ptype_5pysam_7libcbcf_VariantRecordSamples->tp_getattro = PyObject_GenericGetAttr;
  }
  #endif
  if (PyObject_SetAttr(__pyx_m, __pyx_mstate_global->__pyx_n_u_VariantRecordSamples, (PyObject *) __pyx_mstate->__pyx_ptype_5pysam_7libcbcf_VariantRecordSamples) < 0) __PYX_ERR(0, 2869, __pyx_L1_error)
  if (__Pyx_setup_reduce((PyObject *) __pyx_mstate->__pyx_ptype_5pysam_7libcbcf_VariantRecordSamples) < 0) __PYX_ERR(0, 2869, __pyx_L1_error)
  #if CYTHON_USE_TYPE_SPECS
  __pyx_mstate->__pyx_ptype_5pysam_7libcbcf_VariantRecordSample = (PyTypeObject *) __Pyx_PyType_FromModuleAndSpec(__pyx_m, &__pyx_type_5pysam_7libcbcf_VariantRecordSample_spec, NULL); if (unlikely(!__pyx_mstate->__pyx_ptype_5pysam_7libcbcf_VariantRecordSample)) __PYX_ERR(0, 3441, __pyx_L1_error)
  if (__Pyx_fix_up_extension_type_from_spec(&__pyx_type_5pysam_7libcbcf_VariantRecordSample_spec, __pyx_mstate->__pyx_ptype_5pysam_7libcbcf_VariantRecordSample) < 0) __PYX_ERR(0, 3441, __pyx_L1_error)
  #else
  __pyx_mstate->__pyx_ptype_5pysam_7libcbcf_VariantRecordSample = &__pyx_type_5pysam_7libcbcf_VariantRecordSample;
  #endif
  #if !CYTHON_COMPILING_IN_LIMITED_API
  #endif
  #if !CYTHON_USE_TYPE_SPECS
  if (__Pyx_PyType_Ready(__pyx_mstate->__pyx_ptype_5pysam_7libcbcf_VariantRecordSample) < 0) __PYX_ERR(0, 3441, __pyx_L1_error)
  #endif
  #if !CYTHON_COMPILING_IN_LIMITED_API
  if ((CYTHON_USE_TYPE_SLOTS && CYTHON_USE_PYTYPE_LOOKUP) && likely(!__pyx_mstate->__pyx_ptype_5pysam_7libcbcf_VariantRecordSample->tp_dictoffset && __pyx_mstate->__pyx_ptype_5pysam_7libcbcf_VariantRecordSample->tp_getattro == PyObject_GenericGetAttr)) {
    __pyx_mstate->__pyx_ptype_5pysam_7libcbcf_VariantRecordSample->tp_getattro = PyObject_GenericGetAttr;
  }
  #endif
  if (PyObject_SetAttr(__pyx_m, __pyx_mstate_global->__pyx_n_u_VariantRecordSample, (PyObject *) __pyx_mstate->__pyx_ptype_5pysam_7libcbcf_VariantRecordSample) < 0) __PYX_ERR(0, 3441, __pyx_L1_error)
  if (__Pyx_setup_reduce((PyObject *) __pyx_mstate->__pyx_ptype_5pysam_7libcbcf_VariantRecordSample) < 0) __PYX_ERR(0, 3441, __pyx_L1_error)
  #if CYTHON_USE_TYPE_SPECS
  __pyx_mstate->__pyx_ptype_5pysam_7libcbcf_BaseIndex = (PyTypeObject *) __Pyx_PyType_FromModuleAndSpec(__pyx_m, &__pyx_type_5pysam_7libcbcf_BaseIndex_spec, NULL); if (unlikely(!__pyx_mstate->__pyx_ptype_5pysam_7libcbcf_BaseIndex)) __PYX_ERR(0, 3664, __pyx_L1_error)
  if (__Pyx_fix_up_extension_type_from_spec(&__pyx_type_5pysam_7libcbcf_BaseIndex_spec, __pyx_mstate->__pyx_ptype_5pysam_7libcbcf_BaseIndex) < 0) __PYX_ERR(0, 3664, __pyx_L1_error)
  #else
  __pyx_mstate->__pyx_ptype_5pysam_7libcbcf_BaseIndex = &__pyx_type_5pysam_7libcbcf_BaseIndex;
  #endif
  #if !CYTHON_COMPILING_IN_LIMITED_API
  #endif
  #if !CYTHON_USE_TYPE_SPECS
  if (__Pyx_PyType_Ready(__pyx_mstate->__pyx_ptype_5pysam_7libcbcf_BaseIndex) < 0) __PYX_ERR(0, 3664, __pyx_L1_error)
  #endif
  #if !CYTHON_COMPILING_IN_LIMITED_API
  if ((CYTHON_USE_TYPE_SLOTS && CYTHON_USE_PYTYPE_LOOKUP) && likely(!__pyx_mstate->__pyx_ptype_5pysam_7libcbcf_BaseIndex->tp_dictoffset && __pyx_mstate->__pyx_ptype_5pysam_7libcbcf_BaseIndex->tp_getattro == PyObject_GenericGetAttr)) {
    __pyx_mstate->__pyx_ptype_5pysam_7libcbcf_BaseIndex->tp_getattro = PyObject_GenericGetAttr;
  }
  #endif
  if (PyObject_SetAttr(__pyx_m, __pyx_mstate_global->__pyx_n_u_BaseIndex, (PyObject *) __pyx_mstate->__pyx_ptype_5pysam_7libcbcf_BaseIndex) < 0) __PYX_ERR(0, 3664, __pyx_L1_error)
  if (__Pyx_setup_reduce((PyObject *) __pyx_mstate->__pyx_ptype_5pysam_7libcbcf_BaseIndex) < 0) __PYX_ERR(0, 3664, __pyx_L1_error)
  #if CYTHON_USE_TYPE_SPECS
  __pyx_t_1 = PyTuple_Pack(1, (PyObject *)__pyx_mstate_global->__pyx_ptype_5pysam_7libcbcf_BaseIndex); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 3753, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_mstate->__pyx_ptype_5pysam_7libcbcf_BCFIndex = (PyTypeObject *) __Pyx_PyType_FromModuleAndSpec(__pyx_m, &__pyx_type_5pysam_7libcbcf_BCFIndex_spec, __pyx_t_1);
  __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0;
  if (unlikely(!__pyx_mstate->__pyx_ptype_5pysam_7libcbcf_BCFIndex)) __PYX_ERR(0, 3753, __pyx_L1_error)
  if (__Pyx_fix_up_extension_type_from_spec(&__pyx_type_5pysam_7libcbcf_BCFIndex_spec, __pyx_mstate->__pyx_ptype_5pysam_7libcbcf_BCFIndex) < 0) __PYX_ERR(0, 3753, __pyx_L1_error)
  #else
  __pyx_mstate->__pyx_ptype_5pysam_7libcbcf_BCFIndex = &__pyx_type_5pysam_7libcbcf_BCFIndex;
  #endif
  #if !CYTHON_COMPILING_IN_LIMITED_API
  __pyx_mstate_global->__pyx_ptype_5pysam_7libcbcf_BCFIndex->tp_base = __pyx_mstate_global->__pyx_ptype_5pysam_7libcbcf_BaseIndex;
  #endif
  #if !CYTHON_USE_TYPE_SPECS
  if (__Pyx_PyType_Ready(__pyx_mstate->__pyx_ptype_5pysam_7libcbcf_BCFIndex) < 0) __PYX_ERR(0, 3753, __pyx_L1_error)
  #endif
  #if !CYTHON_COMPILING_IN_LIMITED_API
  if ((CYTHON_USE_TYPE_SLOTS && CYTHON_USE_PYTYPE_LOOKUP) && likely(!__pyx_mstate->__pyx_ptype_5pysam_7libcbcf_BCFIndex->tp_dictoffset && __pyx_mstate->__pyx_ptype_5pysam_7libcbcf_BCFIndex->tp_getattro == PyObject_GenericGetAttr)) {
    __pyx_mstate->__pyx_ptype_5pysam_7libcbcf_BCFIndex->tp_getattro = PyObject_GenericGetAttr;
  }
  #endif
  if (PyObject_SetAttr(__pyx_m, __pyx_mstate_global->__pyx_n_u_BCFIndex, (PyObject *) __pyx_mstate->__pyx_ptype_5pysam_7libcbcf_BCFIndex) < 0) __PYX_ERR(0, 3753, __pyx_L1_error)
  if (__Pyx_setup_reduce((PyObject *) __pyx_mstate->__pyx_ptype_5pysam_7libcbcf_BCFIndex) < 0) __PYX_ERR(0, 3753, __pyx_L1_error)
  #if CYTHON_USE_TYPE_SPECS
  __pyx_t_1 = PyTuple_Pack(1, (PyObject *)__pyx_mstate_global->__pyx_ptype_5pysam_7libcbcf_BaseIndex); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 3792, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_mstate->__pyx_ptype_5pysam_7libcbcf_TabixIndex = (PyTypeObject *) __Pyx_PyType_FromModuleAndSpec(__pyx_m, &__pyx_type_5pysam_7libcbcf_TabixIndex_spec, __pyx_t_1);
  __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0;
  if (unlikely(!__pyx_mstate->__pyx_ptype_5pysam_7libcbcf_TabixIndex)) __PYX_ERR(0, 3792, __pyx_L1_error)
  if (__Pyx_fix_up_extension_type_from_spec(&__pyx_type_5pysam_7libcbcf_TabixIndex_spec, __pyx_mstate->__pyx_ptype_5pysam_7libcbcf_TabixIndex) < 0) __PYX_ERR(0, 3792, __pyx_L1_error)
  #else
  __pyx_mstate->__pyx_ptype_5pysam_7libcbcf_TabixIndex = &__pyx_type_5pysam_7libcbcf_TabixIndex;
  #endif
  #if !CYTHON_COMPILING_IN_LIMITED_API
  __pyx_mstate_global->__pyx_ptype_5pysam_7libcbcf_TabixIndex->tp_base = __pyx_mstate_global->__pyx_ptype_5pysam_7libcbcf_BaseIndex;
  #endif
  #if !CYTHON_USE_TYPE_SPECS
  if (__Pyx_PyType_Ready(__pyx_mstate->__pyx_ptype_5pysam_7libcbcf_TabixIndex) < 0) __PYX_ERR(0, 3792, __pyx_L1_error)
  #endif
  #if !CYTHON_COMPILING_IN_LIMITED_API
  if ((CYTHON_USE_TYPE_SLOTS && CYTHON_USE_PYTYPE_LOOKUP) && likely(!__pyx_mstate->__pyx_ptype_5pysam_7libcbcf_TabixIndex->tp_dictoffset && __pyx_mstate->__pyx_ptype_5pysam_7libcbcf_TabixIndex->tp_getattro == PyObject_GenericGetAttr)) {
    __pyx_mstate->__pyx_ptype_5pysam_7libcbcf_TabixIndex->tp_getattro = PyObject_GenericGetAttr;
  }
  #endif
  if (PyObject_SetAttr(__pyx_m, __pyx_mstate_global->__pyx_n_u_TabixIndex, (PyObject *) __pyx_mstate->__pyx_ptype_5pysam_7libcbcf_TabixIndex) < 0) __PYX_ERR(0, 3792, __pyx_L1_error)
  if (__Pyx_setup_reduce((PyObject *) __pyx_mstate->__pyx_ptype_5pysam_7libcbcf_TabixIndex) < 0) __PYX_ERR(0, 3792, __pyx_L1_error)
  #if CYTHON_USE_TYPE_SPECS
  __pyx_mstate->__pyx_ptype_5pysam_7libcbcf_BaseIterator = (PyTypeObject *) __Pyx_PyType_FromModuleAndSpec(__pyx_m, &__pyx_type_5pysam_7libcbcf_BaseIterator_spec, NULL); if (unlikely(!__pyx_mstate->__pyx_ptype_5pysam_7libcbcf_BaseIterator)) __PYX_ERR(0, 3833, __pyx_L1_error)
  if (__Pyx_fix_up_extension_type_from_spec(&__pyx_type_5pysam_7libcbcf_BaseIterator_spec, __pyx_mstate->__pyx_ptype_5pysam_7libcbcf_BaseIterator) < 0) __PYX_ERR(0, 3833, __pyx_L1_error)
  #else
  __pyx_mstate->__pyx_ptype_5pysam_7libcbcf_BaseIterator = &__pyx_type_5pysam_7libcbcf_BaseIterator;
  #endif
  #if !CYTHON_COMPILING_IN_LIMITED_API
  #endif
  #if !CYTHON_USE_TYPE_SPECS
  if (__Pyx_PyType_Ready(__pyx_mstate->__pyx_ptype_5pysam_7libcbcf_BaseIterator) < 0) __PYX_ERR(0, 3833, __pyx_L1_error)
  #endif
  #if !CYTHON_COMPILING_IN_LIMITED_API
  if ((CYTHON_USE_TYPE_SLOTS && CYTHON_USE_PYTYPE_LOOKUP) && likely(!__pyx_mstate->__pyx_ptype_5pysam_7libcbcf_BaseIterator->tp_dictoffset && __pyx_mstate->__pyx_ptype_5pysam_7libcbcf_BaseIterator->tp_getattro == PyObject_GenericGetAttr)) {
    __pyx_mstate->__pyx_ptype_5pysam_7libcbcf_BaseIterator->tp_getattro = PyObject_GenericGetAttr;
  }
  #endif
  if (PyObject_SetAttr(__pyx_m, __pyx_mstate_global->__pyx_n_u_BaseIterator, (PyObject *) __pyx_mstate->__pyx_ptype_5pysam_7libcbcf_BaseIterator) < 0) __PYX_ERR(0, 3833, __pyx_L1_error)
  if (__Pyx_setup_reduce((PyObject *) __pyx_mstate->__pyx_ptype_5pysam_7libcbcf_BaseIterator) < 0) __PYX_ERR(0, 3833, __pyx_L1_error)
  #if CYTHON_USE_TYPE_SPECS
  __pyx_t_1 = PyTuple_Pack(1, (PyObject *)__pyx_mstate_global->__pyx_ptype_5pysam_7libcbcf_BaseIterator); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 3847, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_mstate->__pyx_ptype_5pysam_7libcbcf_BCFIterator = (PyTypeObject *) __Pyx_PyType_FromModuleAndSpec(__pyx_m, &__pyx_type_5pysam_7libcbcf_BCFIterator_spec, __pyx_t_1);
  __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0;
  if (unlikely(!__pyx_mstate->__pyx_ptype_5pysam_7libcbcf_BCFIterator)) __PYX_ERR(0, 3847, __pyx_L1_error)
  if (__Pyx_fix_up_extension_type_from_spec(&__pyx_type_5pysam_7libcbcf_BCFIterator_spec, __pyx_mstate->__pyx_ptype_5pysam_7libcbcf_BCFIterator) < 0) __PYX_ERR(0, 3847, __pyx_L1_error)
  #else
  __pyx_mstate->__pyx_ptype_5pysam_7libcbcf_BCFIterator = &__pyx_type_5pysam_7libcbcf_BCFIterator;
  #endif
  #if !CYTHON_COMPILING_IN_LIMITED_API
  __pyx_mstate_global->__pyx_ptype_5pysam_7libcbcf_BCFIterator->tp_base = __pyx_mstate_global->__pyx_ptype_5pysam_7libcbcf_BaseIterator;
  #endif
  #if !CYTHON_USE_TYPE_SPECS
  if (__Pyx_PyType_Ready(__pyx_mstate->__pyx_ptype_5pysam_7libcbcf_BCFIterator) < 0) __PYX_ERR(0, 3847, __pyx_L1_error)
  #endif
  #if !CYTHON_COMPILING_IN_LIMITED_API
  if ((CYTHON_USE_TYPE_SLOTS && CYTHON_USE_PYTYPE_LOOKUP) && likely(!__pyx_mstate->__pyx_ptype_5pysam_7libcbcf_BCFIterator->tp_dictoffset && __pyx_mstate->__pyx_ptype_5pysam_7libcbcf_BCFIterator->tp_getattro == PyObject_GenericGetAttr)) {
    __pyx_mstate->__pyx_ptype_5pysam_7libcbcf_BCFIterator->tp_getattro = PyObject_GenericGetAttr;
  }
  #endif
  if (PyObject_SetAttr(__pyx_m, __pyx_mstate_global->__pyx_n_u_BCFIterator, (PyObject *) __pyx_mstate->__pyx_ptype_5pysam_7libcbcf_BCFIterator) < 0) __PYX_ERR(0, 3847, __pyx_L1_error)
  if (__Pyx_setup_reduce((PyObject *) __pyx_mstate->__pyx_ptype_5pysam_7libcbcf_BCFIterator) < 0) __PYX_ERR(0, 3847, __pyx_L1_error)
  #if CYTHON_USE_TYPE_SPECS
  __pyx_t_1 = PyTuple_Pack(1, (PyObject *)__pyx_mstate_global->__pyx_ptype_5pysam_7libcbcf_BaseIterator); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 3933, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_mstate->__pyx_ptype_5pysam_7libcbcf_TabixIterator = (PyTypeObject *) __Pyx_PyType_FromModuleAndSpec(__pyx_m, &__pyx_type_5pysam_7libcbcf_TabixIterator_spec, __pyx_t_1);
  __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0;
  if (unlikely(!__pyx_mstate->__pyx_ptype_5pysam_7libcbcf_TabixIterator)) __PYX_ERR(0, 3933, __pyx_L1_error)
  if (__Pyx_fix_up_extension_type_from_spec(&__pyx_type_5pysam_7libcbcf_TabixIterator_spec, __pyx_mstate->__pyx_ptype_5pysam_7libcbcf_TabixIterator) < 0) __PYX_ERR(0, 3933, __pyx_L1_error)
  #else
  __pyx_mstate->__pyx_ptype_5pysam_7libcbcf_TabixIterator = &__pyx_type_5pysam_7libcbcf_TabixIterator;
  #endif
  #if !CYTHON_COMPILING_IN_LIMITED_API
  __pyx_mstate_global->__pyx_ptype_5pysam_7libcbcf_TabixIterator->tp_base = __pyx_mstate_global->__pyx_ptype_5pysam_7libcbcf_BaseIterator;
  #endif
  #if !CYTHON_USE_TYPE_SPECS
  if (__Pyx_PyType_Ready(__pyx_mstate->__pyx_ptype_5pysam_7libcbcf_TabixIterator) < 0) __PYX_ERR(0, 3933, __pyx_L1_error)
  #endif
  #if !CYTHON_COMPILING_IN_LIMITED_API
  if ((CYTHON_USE_TYPE_SLOTS && CYTHON_USE_PYTYPE_LOOKUP) && likely(!__pyx_mstate->__pyx_ptype_5pysam_7libcbcf_TabixIterator->tp_dictoffset && __pyx_mstate->__pyx_ptype_5pysam_7libcbcf_TabixIterator->tp_getattro == PyObject_GenericGetAttr)) {
    __pyx_mstate->__pyx_ptype_5pysam_7libcbcf_TabixIterator->tp_getattro = PyObject_GenericGetAttr;
  }
  #endif
  if (PyObject_SetAttr(__pyx_m, __pyx_mstate_global->__pyx_n_u_TabixIterator, (PyObject *) __pyx_mstate->__pyx_ptype_5pysam_7libcbcf_TabixIterator) < 0) __PYX_ERR(0, 3933, __pyx_L1_error)
  if (__Pyx_setup_reduce((PyObject *) __pyx_mstate->__pyx_ptype_5pysam_7libcbcf_TabixIterator) < 0) __PYX_ERR(0, 3933, __pyx_L1_error)
  __pyx_t_1 = PyImport_ImportModule("pysam.libchtslib"); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_mstate->__pyx_ptype_5pysam_10libchtslib_HTSFile = __Pyx_ImportType_3_1_2(__pyx_t_1, "pysam.libchtslib", "HTSFile",
  #if defined(PYPY_VERSION_NUM) && PYPY_VERSION_NUM < 0x050B0000
  sizeof(struct __pyx_obj_5pysam_10libchtslib_HTSFile), __PYX_GET_STRUCT_ALIGNMENT_3_1_2(struct __pyx_obj_5pysam_10libchtslib_HTSFile),
  #elif CYTHON_COMPILING_IN_LIMITED_API
  sizeof(struct __pyx_obj_5pysam_10libchtslib_HTSFile), __PYX_GET_STRUCT_ALIGNMENT_3_1_2(struct __pyx_obj_5pysam_10libchtslib_HTSFile),
  #else
  sizeof(struct __pyx_obj_5pysam_10libchtslib_HTSFile), __PYX_GET_STRUCT_ALIGNMENT_3_1_2(struct __pyx_obj_5pysam_10libchtslib_HTSFile),
  #endif
  __Pyx_ImportType_CheckSize_Warn_3_1_2); if (!__pyx_mstate->__pyx_ptype_5pysam_10libchtslib_HTSFile) __PYX_ERR(0, 1, __pyx_L1_error)
  __pyx_vtabptr_5pysam_10libchtslib_HTSFile = (struct __pyx_vtabstruct_5pysam_10libchtslib_HTSFile*)__Pyx_GetVtable(__pyx_mstate->__pyx_ptype_5pysam_10libchtslib_HTSFile); if (unlikely(!__pyx_vtabptr_5pysam_10libchtslib_HTSFile)) __PYX_ERR(0, 1, __pyx_L1_error)
  __pyx_vtabptr_5pysam_7libcbcf_VariantFile = &__pyx_vtable_5pysam_7libcbcf_VariantFile;
  __pyx_vtable_5pysam_7libcbcf_VariantFile.__pyx_base = *__pyx_vtabptr_5pysam_10libchtslib_HTSFile;
  __pyx_vtable_5pysam_7libcbcf_VariantFile.write = (int (*)(struct __pyx_obj_5pysam_7libcbcf_VariantFile *, struct __pyx_obj_5pysam_7libcbcf_VariantRecord *, int __pyx_skip_dispatch))__pyx_f_5pysam_7libcbcf_11VariantFile_write;
  #if CYTHON_USE_TYPE_SPECS
  __pyx_t_2 = PyTuple_Pack(1, (PyObject *)__pyx_mstate_global->__pyx_ptype_5pysam_10libchtslib_HTSFile); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 4035, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_mstate->__pyx_ptype_5pysam_7libcbcf_VariantFile = (PyTypeObject *) __Pyx_PyType_FromModuleAndSpec(__pyx_m, &__pyx_type_5pysam_7libcbcf_VariantFile_spec, __pyx_t_2);
  __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
  if (unlikely(!__pyx_mstate->__pyx_ptype_5pysam_7libcbcf_VariantFile)) __PYX_ERR(0, 4035, __pyx_L1_error)
  if (__Pyx_fix_up_extension_type_from_spec(&__pyx_type_5pysam_7libcbcf_VariantFile_spec, __pyx_mstate->__pyx_ptype_5pysam_7libcbcf_VariantFile) < 0) __PYX_ERR(0, 4035, __pyx_L1_error)
  #else
  __pyx_mstate->__pyx_ptype_5pysam_7libcbcf_VariantFile = &__pyx_type_5pysam_7libcbcf_VariantFile;
  #endif
  #if !CYTHON_COMPILING_IN_LIMITED_API
  __pyx_mstate_global->__pyx_ptype_5pysam_7libcbcf_VariantFile->tp_base = __pyx_mstate_global->__pyx_ptype_5pysam_10libchtslib_HTSFile;
  #endif
  #if !CYTHON_USE_TYPE_SPECS
  if (__Pyx_PyType_Ready(__pyx_mstate->__pyx_ptype_5pysam_7libcbcf_VariantFile) < 0) __PYX_ERR(0, 4035, __pyx_L1_error)
  #endif
  #if !CYTHON_COMPILING_IN_LIMITED_API
  if ((CYTHON_USE_TYPE_SLOTS && CYTHON_USE_PYTYPE_LOOKUP) && likely(!__pyx_mstate->__pyx_ptype_5pysam_7libcbcf_VariantFile->tp_dictoffset && __pyx_mstate->__pyx_ptype_5pysam_7libcbcf_VariantFile->tp_getattro == PyObject_GenericGetAttr)) {
    __pyx_mstate->__pyx_ptype_5pysam_7libcbcf_VariantFile->tp_getattro = PyObject_GenericGetAttr;
  }
  #endif
  if (__Pyx_SetVtable(__pyx_mstate->__pyx_ptype_5pysam_7libcbcf_VariantFile, __pyx_vtabptr_5pysam_7libcbcf_VariantFile) < 0) __PYX_ERR(0, 4035, __pyx_L1_error)
  if (__Pyx_MergeVtables(__pyx_mstate->__pyx_ptype_5pysam_7libcbcf_VariantFile) < 0) __PYX_ERR(0, 4035, __pyx_L1_error)
  if (PyObject_SetAttr(__pyx_m, __pyx_mstate_global->__pyx_n_u_VariantFile, (PyObject *) __pyx_mstate->__pyx_ptype_5pysam_7libcbcf_VariantFile) < 0) __PYX_ERR(0, 4035, __pyx_L1_error)
  if (__Pyx_setup_reduce((PyObject *) __pyx_mstate->__pyx_ptype_5pysam_7libcbcf_VariantFile) < 0) __PYX_ERR(0, 4035, __pyx_L1_error)
  #if CYTHON_USE_TYPE_SPECS
  __pyx_mstate->__pyx_ptype_5pysam_7libcbcf___pyx_scope_struct____pyx_f_5pysam_7libcbcf_char_array_to_tuple = (PyTypeObject *) __Pyx_PyType_FromModuleAndSpec(__pyx_m, &__pyx_type_5pysam_7libcbcf___pyx_scope_struct____pyx_f_5pysam_7libcbcf_char_array_to_tuple_spec, NULL); if (unlikely(!__pyx_mstate->__pyx_ptype_5pysam_7libcbcf___pyx_scope_struct____pyx_f_5pysam_7libcbcf_char_array_to_tuple)) __PYX_ERR(0, 267, __pyx_L1_error)
  if (__Pyx_fix_up_extension_type_from_spec(&__pyx_type_5pysam_7libcbcf___pyx_scope_struct____pyx_f_5pysam_7libcbcf_char_array_to_tuple_spec, __pyx_mstate->__pyx_ptype_5pysam_7libcbcf___pyx_scope_struct____pyx_f_5pysam_7libcbcf_char_array_to_tuple) < 0) __PYX_ERR(0, 267, __pyx_L1_error)
  #else
  __pyx_mstate->__pyx_ptype_5pysam_7libcbcf___pyx_scope_struct____pyx_f_5pysam_7libcbcf_char_array_to_tuple = &__pyx_type_5pysam_7libcbcf___pyx_scope_struct____pyx_f_5pysam_7libcbcf_char_array_to_tuple;
  #endif
  #if !CYTHON_COMPILING_IN_LIMITED_API
  #endif
  #if !CYTHON_USE_TYPE_SPECS
  if (__Pyx_PyType_Ready(__pyx_mstate->__pyx_ptype_5pysam_7libcbcf___pyx_scope_struct____pyx_f_5pysam_7libcbcf_char_array_to_tuple) < 0) __PYX_ERR(0, 267, __pyx_L1_error)
  #endif
  #if !CYTHON_COMPILING_IN_LIMITED_API
  if ((CYTHON_USE_TYPE_SLOTS && CYTHON_USE_PYTYPE_LOOKUP) && likely(!__pyx_mstate->__pyx_ptype_5pysam_7libcbcf___pyx_scope_struct____pyx_f_5pysam_7libcbcf_char_array_to_tuple->tp_dictoffset && __pyx_mstate->__pyx_ptype_5pysam_7libcbcf___pyx_scope_struct____pyx_f_5pysam_7libcbcf_char_array_to_tuple->tp_getattro == PyObject_GenericGetAttr)) {
    __pyx_mstate->__pyx_ptype_5pysam_7libcbcf___pyx_scope_struct____pyx_f_5pysam_7libcbcf_char_array_to_tuple->tp_getattro = PyObject_GenericGetAttr;
  }
  #endif
  #if CYTHON_USE_TYPE_SPECS
  __pyx_mstate->__pyx_ptype_5pysam_7libcbcf___pyx_scope_struct_1_genexpr = (PyTypeObject *) __Pyx_PyType_FromModuleAndSpec(__pyx_m, &__pyx_type_5pysam_7libcbcf___pyx_scope_struct_1_genexpr_spec, NULL); if (unlikely(!__pyx_mstate->__pyx_ptype_5pysam_7libcbcf___pyx_scope_struct_1_genexpr)) __PYX_ERR(0, 271, __pyx_L1_error)
  if (__Pyx_fix_up_extension_type_from_spec(&__pyx_type_5pysam_7libcbcf___pyx_scope_struct_1_genexpr_spec, __pyx_mstate->__pyx_ptype_5pysam_7libcbcf___pyx_scope_struct_1_genexpr) < 0) __PYX_ERR(0, 271, __pyx_L1_error)
  #else
  __pyx_mstate->__pyx_ptype_5pysam_7libcbcf___pyx_scope_struct_1_genexpr = &__pyx_type_5pysam_7libcbcf___pyx_scope_struct_1_genexpr;
  #endif
  #if !CYTHON_COMPILING_IN_LIMITED_API
  #endif
  #if !CYTHON_USE_TYPE_SPECS
  if (__Pyx_PyType_Ready(__pyx_mstate->__pyx_ptype_5pysam_7libcbcf___pyx_scope_struct_1_genexpr) < 0) __PYX_ERR(0, 271, __pyx_L1_error)
  #endif
  #if !CYTHON_COMPILING_IN_LIMITED_API
  if ((CYTHON_USE_TYPE_SLOTS && CYTHON_USE_PYTYPE_LOOKUP) && likely(!__pyx_mstate->__pyx_ptype_5pysam_7libcbcf___pyx_scope_struct_1_genexpr->tp_dictoffset && __pyx_mstate->__pyx_ptype_5pysam_7libcbcf___pyx_scope_struct_1_genexpr->tp_getattro == PyObject_GenericGetAttr)) {
    __pyx_mstate->__pyx_ptype_5pysam_7libcbcf___pyx_scope_struct_1_genexpr->tp_getattro = PyObject_GenericGetAttr;
  }
  #endif
  #if CYTHON_USE_TYPE_SPECS
  __pyx_mstate->__pyx_ptype_5pysam_7libcbcf___pyx_scope_struct_2_genexpr = (PyTypeObject *) __Pyx_PyType_FromModuleAndSpec(__pyx_m, &__pyx_type_5pysam_7libcbcf___pyx_scope_struct_2_genexpr_spec, NULL); if (unlikely(!__pyx_mstate->__pyx_ptype_5pysam_7libcbcf___pyx_scope_struct_2_genexpr)) __PYX_ERR(0, 302, __pyx_L1_error)
  if (__Pyx_fix_up_extension_type_from_spec(&__pyx_type_5pysam_7libcbcf___pyx_scope_struct_2_genexpr_spec, __pyx_mstate->__pyx_ptype_5pysam_7libcbcf___pyx_scope_struct_2_genexpr) < 0) __PYX_ERR(0, 302, __pyx_L1_error)
  #else
  __pyx_mstate->__pyx_ptype_5pysam_7libcbcf___pyx_scope_struct_2_genexpr = &__pyx_type_5pysam_7libcbcf___pyx_scope_struct_2_genexpr;
  #endif
  #if !CYTHON_COMPILING_IN_LIMITED_API
  #endif
  #if !CYTHON_USE_TYPE_SPECS
  if (__Pyx_PyType_Ready(__pyx_mstate->__pyx_ptype_5pysam_7libcbcf___pyx_scope_struct_2_genexpr) < 0) __PYX_ERR(0, 302, __pyx_L1_error)
  #endif
  #if !CYTHON_COMPILING_IN_LIMITED_API
  if ((CYTHON_USE_TYPE_SLOTS && CYTHON_USE_PYTYPE_LOOKUP) && likely(!__pyx_mstate->__pyx_ptype_5pysam_7libcbcf___pyx_scope_struct_2_genexpr->tp_dictoffset && __pyx_mstate->__pyx_ptype_5pysam_7libcbcf___pyx_scope_struct_2_genexpr->tp_getattro == PyObject_GenericGetAttr)) {
    __pyx_mstate->__pyx_ptype_5pysam_7libcbcf___pyx_scope_struct_2_genexpr->tp_getattro = PyObject_GenericGetAttr;
  }
  #endif
  #if CYTHON_USE_TYPE_SPECS
  __pyx_mstate->__pyx_ptype_5pysam_7libcbcf___pyx_scope_struct_3_genexpr = (PyTypeObject *) __Pyx_PyType_FromModuleAndSpec(__pyx_m, &__pyx_type_5pysam_7libcbcf___pyx_scope_struct_3_genexpr_spec, NULL); if (unlikely(!__pyx_mstate->__pyx_ptype_5pysam_7libcbcf___pyx_scope_struct_3_genexpr)) __PYX_ERR(0, 360, __pyx_L1_error)
  if (__Pyx_fix_up_extension_type_from_spec(&__pyx_type_5pysam_7libcbcf___pyx_scope_struct_3_genexpr_spec, __pyx_mstate->__pyx_ptype_5pysam_7libcbcf___pyx_scope_struct_3_genexpr) < 0) __PYX_ERR(0, 360, __pyx_L1_error)
  #else
  __pyx_mstate->__pyx_ptype_5pysam_7libcbcf___pyx_scope_struct_3_genexpr = &__pyx_type_5pysam_7libcbcf___pyx_scope_struct_3_genexpr;
  #endif
  #if !CYTHON_COMPILING_IN_LIMITED_API
  #endif
  #if !CYTHON_USE_TYPE_SPECS
  if (__Pyx_PyType_Ready(__pyx_mstate->__pyx_ptype_5pysam_7libcbcf___pyx_scope_struct_3_genexpr) < 0) __PYX_ERR(0, 360, __pyx_L1_error)
  #endif
  #if !CYTHON_COMPILING_IN_LIMITED_API
  if ((CYTHON_USE_TYPE_SLOTS && CYTHON_USE_PYTYPE_LOOKUP) && likely(!__pyx_mstate->__pyx_ptype_5pysam_7libcbcf___pyx_scope_struct_3_genexpr->tp_dictoffset && __pyx_mstate->__pyx_ptype_5pysam_7libcbcf___pyx_scope_struct_3_genexpr->tp_getattro == PyObject_GenericGetAttr)) {
    __pyx_mstate->__pyx_ptype_5pysam_7libcbcf___pyx_scope_struct_3_genexpr->tp_getattro = PyObject_GenericGetAttr;
  }
  #endif
  #if CYTHON_USE_TYPE_SPECS
  __pyx_mstate->__pyx_ptype_5pysam_7libcbcf___pyx_scope_struct_4_genexpr = (PyTypeObject *) __Pyx_PyType_FromModuleAndSpec(__pyx_m, &__pyx_type_5pysam_7libcbcf___pyx_scope_struct_4_genexpr_spec, NULL); if (unlikely(!__pyx_mstate->__pyx_ptype_5pysam_7libcbcf___pyx_scope_struct_4_genexpr)) __PYX_ERR(0, 614, __pyx_L1_error)
  if (__Pyx_fix_up_extension_type_from_spec(&__pyx_type_5pysam_7libcbcf___pyx_scope_struct_4_genexpr_spec, __pyx_mstate->__pyx_ptype_5pysam_7libcbcf___pyx_scope_struct_4_genexpr) < 0) __PYX_ERR(0, 614, __pyx_L1_error)
  #else
  __pyx_mstate->__pyx_ptype_5pysam_7libcbcf___pyx_scope_struct_4_genexpr = &__pyx_type_5pysam_7libcbcf___pyx_scope_struct_4_genexpr;
  #endif
  #if !CYTHON_COMPILING_IN_LIMITED_API
  #endif
  #if !CYTHON_USE_TYPE_SPECS
  if (__Pyx_PyType_Ready(__pyx_mstate->__pyx_ptype_5pysam_7libcbcf___pyx_scope_struct_4_genexpr) < 0) __PYX_ERR(0, 614, __pyx_L1_error)
  #endif
  #if !CYTHON_COMPILING_IN_LIMITED_API
  if ((CYTHON_USE_TYPE_SLOTS && CYTHON_USE_PYTYPE_LOOKUP) && likely(!__pyx_mstate->__pyx_ptype_5pysam_7libcbcf___pyx_scope_struct_4_genexpr->tp_dictoffset && __pyx_mstate->__pyx_ptype_5pysam_7libcbcf___pyx_scope_struct_4_genexpr->tp_getattro == PyObject_GenericGetAttr)) {
    __pyx_mstate->__pyx_ptype_5pysam_7libcbcf___pyx_scope_struct_4_genexpr->tp_getattro = PyObject_GenericGetAttr;
  }
  #endif
  #if CYTHON_USE_TYPE_SPECS
  __pyx_mstate->__pyx_ptype_5pysam_7libcbcf___pyx_scope_struct_5___get__ = (PyTypeObject *) __Pyx_PyType_FromModuleAndSpec(__pyx_m, &__pyx_type_5pysam_7libcbcf___pyx_scope_struct_5___get___spec, NULL); if (unlikely(!__pyx_mstate->__pyx_ptype_5pysam_7libcbcf___pyx_scope_struct_5___get__)) __PYX_ERR(0, 1274, __pyx_L1_error)
  if (__Pyx_fix_up_extension_type_from_spec(&__pyx_type_5pysam_7libcbcf___pyx_scope_struct_5___get___spec, __pyx_mstate->__pyx_ptype_5pysam_7libcbcf___pyx_scope_struct_5___get__) < 0) __PYX_ERR(0, 1274, __pyx_L1_error)
  #else
  __pyx_mstate->__pyx_ptype_5pysam_7libcbcf___pyx_scope_struct_5___get__ = &__pyx_type_5pysam_7libcbcf___pyx_scope_struct_5___get__;
  #endif
  #if !CYTHON_COMPILING_IN_LIMITED_API
  #endif
  #if !CYTHON_USE_TYPE_SPECS
  if (__Pyx_PyType_Ready(__pyx_mstate->__pyx_ptype_5pysam_7libcbcf___pyx_scope_struct_5___get__) < 0) __PYX_ERR(0, 1274, __pyx_L1_error)
  #endif
  #if !CYTHON_COMPILING_IN_LIMITED_API
  if ((CYTHON_USE_TYPE_SLOTS && CYTHON_USE_PYTYPE_LOOKUP) && likely(!__pyx_mstate->__pyx_ptype_5pysam_7libcbcf___pyx_scope_struct_5___get__->tp_dictoffset && __pyx_mstate->__pyx_ptype_5pysam_7libcbcf___pyx_scope_struct_5___get__->tp_getattro == PyObject_GenericGetAttr)) {
    __pyx_mstate->__pyx_ptype_5pysam_7libcbcf___pyx_scope_struct_5___get__->tp_getattro = PyObject_GenericGetAttr;
  }
  #endif
  #if CYTHON_USE_TYPE_SPECS
  __pyx_mstate->__pyx_ptype_5pysam_7libcbcf___pyx_scope_struct_6_genexpr = (PyTypeObject *) __Pyx_PyType_FromModuleAndSpec(__pyx_m, &__pyx_type_5pysam_7libcbcf___pyx_scope_struct_6_genexpr_spec, NULL); if (unlikely(!__pyx_mstate->__pyx_ptype_5pysam_7libcbcf___pyx_scope_struct_6_genexpr)) __PYX_ERR(0, 1281, __pyx_L1_error)
  if (__Pyx_fix_up_extension_type_from_spec(&__pyx_type_5pysam_7libcbcf___pyx_scope_struct_6_genexpr_spec, __pyx_mstate->__pyx_ptype_5pysam_7libcbcf___pyx_scope_struct_6_genexpr) < 0) __PYX_ERR(0, 1281, __pyx_L1_error)
  #else
  __pyx_mstate->__pyx_ptype_5pysam_7libcbcf___pyx_scope_struct_6_genexpr = &__pyx_type_5pysam_7libcbcf___pyx_scope_struct_6_genexpr;
  #endif
  #if !CYTHON_COMPILING_IN_LIMITED_API
  #endif
  #if !CYTHON_USE_TYPE_SPECS
  if (__Pyx_PyType_Ready(__pyx_mstate->__pyx_ptype_5pysam_7libcbcf___pyx_scope_struct_6_genexpr) < 0) __PYX_ERR(0, 1281, __pyx_L1_error)
  #endif
  #if !CYTHON_COMPILING_IN_LIMITED_API
  if ((CYTHON_USE_TYPE_SLOTS && CYTHON_USE_PYTYPE_LOOKUP) && likely(!__pyx_mstate->__pyx_ptype_5pysam_7libcbcf___pyx_scope_struct_6_genexpr->tp_dictoffset && __pyx_mstate->__pyx_ptype_5pysam_7libcbcf___pyx_scope_struct_6_genexpr->tp_getattro == PyObject_GenericGetAttr)) {
    __pyx_mstate->__pyx_ptype_5pysam_7libcbcf___pyx_scope_struct_6_genexpr->tp_getattro = PyObject_GenericGetAttr;
  }
  #endif
  #if CYTHON_USE_TYPE_SPECS
  __pyx_mstate->__pyx_ptype_5pysam_7libcbcf___pyx_scope_struct_7___iter__ = (PyTypeObject *) __Pyx_PyType_FromModuleAndSpec(__pyx_m, &__pyx_type_5pysam_7libcbcf___pyx_scope_struct_7___iter___spec, NULL); if (unlikely(!__pyx_mstate->__pyx_ptype_5pysam_7libcbcf___pyx_scope_struct_7___iter__)) __PYX_ERR(0, 1304, __pyx_L1_error)
  if (__Pyx_fix_up_extension_type_from_spec(&__pyx_type_5pysam_7libcbcf___pyx_scope_struct_7___iter___spec, __pyx_mstate->__pyx_ptype_5pysam_7libcbcf___pyx_scope_struct_7___iter__) < 0) __PYX_ERR(0, 1304, __pyx_L1_error)
  #else
  __pyx_mstate->__pyx_ptype_5pysam_7libcbcf___pyx_scope_struct_7___iter__ = &__pyx_type_5pysam_7libcbcf___pyx_scope_struct_7___iter__;
  #endif
  #if !CYTHON_COMPILING_IN_LIMITED_API
  #endif
  #if !CYTHON_USE_TYPE_SPECS
  if (__Pyx_PyType_Ready(__pyx_mstate->__pyx_ptype_5pysam_7libcbcf___pyx_scope_struct_7___iter__) < 0) __PYX_ERR(0, 1304, __pyx_L1_error)
  #endif
  #if !CYTHON_COMPILING_IN_LIMITED_API
  if ((CYTHON_USE_TYPE_SLOTS && CYTHON_USE_PYTYPE_LOOKUP) && likely(!__pyx_mstate->__pyx_ptype_5pysam_7libcbcf___pyx_scope_struct_7___iter__->tp_dictoffset && __pyx_mstate->__pyx_ptype_5pysam_7libcbcf___pyx_scope_struct_7___iter__->tp_getattro == PyObject_GenericGetAttr)) {
    __pyx_mstate->__pyx_ptype_5pysam_7libcbcf___pyx_scope_struct_7___iter__->tp_getattro = PyObject_GenericGetAttr;
  }
  #endif
  #if CYTHON_USE_TYPE_SPECS
  __pyx_mstate->__pyx_ptype_5pysam_7libcbcf___pyx_scope_struct_8_itervalues = (PyTypeObject *) __Pyx_PyType_FromModuleAndSpec(__pyx_m, &__pyx_type_5pysam_7libcbcf___pyx_scope_struct_8_itervalues_spec, NULL); if (unlikely(!__pyx_mstate->__pyx_ptype_5pysam_7libcbcf___pyx_scope_struct_8_itervalues)) __PYX_ERR(0, 1332, __pyx_L1_error)
  if (__Pyx_fix_up_extension_type_from_spec(&__pyx_type_5pysam_7libcbcf___pyx_scope_struct_8_itervalues_spec, __pyx_mstate->__pyx_ptype_5pysam_7libcbcf___pyx_scope_struct_8_itervalues) < 0) __PYX_ERR(0, 1332, __pyx_L1_error)
  #else
  __pyx_mstate->__pyx_ptype_5pysam_7libcbcf___pyx_scope_struct_8_itervalues = &__pyx_type_5pysam_7libcbcf___pyx_scope_struct_8_itervalues;
  #endif
  #if !CYTHON_COMPILING_IN_LIMITED_API
  #endif
  #if !CYTHON_USE_TYPE_SPECS
  if (__Pyx_PyType_Ready(__pyx_mstate->__pyx_ptype_5pysam_7libcbcf___pyx_scope_struct_8_itervalues) < 0) __PYX_ERR(0, 1332, __pyx_L1_error)
  #endif
  #if !CYTHON_COMPILING_IN_LIMITED_API
  if ((CYTHON_USE_TYPE_SLOTS && CYTHON_USE_PYTYPE_LOOKUP) && likely(!__pyx_mstate->__pyx_ptype_5pysam_7libcbcf___pyx_scope_struct_8_itervalues->tp_dictoffset && __pyx_mstate->__pyx_ptype_5pysam_7libcbcf___pyx_scope_struct_8_itervalues->tp_getattro == PyObject_GenericGetAttr)) {
    __pyx_mstate->__pyx_ptype_5pysam_7libcbcf___pyx_scope_struct_8_itervalues->tp_getattro = PyObject_GenericGetAttr;
  }
  #endif
  #if CYTHON_USE_TYPE_SPECS
  __pyx_mstate->__pyx_ptype_5pysam_7libcbcf___pyx_scope_struct_9_iteritems = (PyTypeObject *) __Pyx_PyType_FromModuleAndSpec(__pyx_m, &__pyx_type_5pysam_7libcbcf___pyx_scope_struct_9_iteritems_spec, NULL); if (unlikely(!__pyx_mstate->__pyx_ptype_5pysam_7libcbcf___pyx_scope_struct_9_iteritems)) __PYX_ERR(0, 1342, __pyx_L1_error)
  if (__Pyx_fix_up_extension_type_from_spec(&__pyx_type_5pysam_7libcbcf___pyx_scope_struct_9_iteritems_spec, __pyx_mstate->__pyx_ptype_5pysam_7libcbcf___pyx_scope_struct_9_iteritems) < 0) __PYX_ERR(0, 1342, __pyx_L1_error)
  #else
  __pyx_mstate->__pyx_ptype_5pysam_7libcbcf___pyx_scope_struct_9_iteritems = &__pyx_type_5pysam_7libcbcf___pyx_scope_struct_9_iteritems;
  #endif
  #if !CYTHON_COMPILING_IN_LIMITED_API
  #endif
  #if !CYTHON_USE_TYPE_SPECS
  if (__Pyx_PyType_Ready(__pyx_mstate->__pyx_ptype_5pysam_7libcbcf___pyx_scope_struct_9_iteritems) < 0) __PYX_ERR(0, 1342, __pyx_L1_error)
  #endif
  #if !CYTHON_COMPILING_IN_LIMITED_API
  if ((CYTHON_USE_TYPE_SLOTS && CYTHON_USE_PYTYPE_LOOKUP) && likely(!__pyx_mstate->__pyx_ptype_5pysam_7libcbcf___pyx_scope_struct_9_iteritems->tp_dictoffset && __pyx_mstate->__pyx_ptype_5pysam_7libcbcf___pyx_scope_struct_9_iteritems->tp_getattro == PyObject_GenericGetAttr)) {
    __pyx_mstate->__pyx_ptype_5pysam_7libcbcf___pyx_scope_struct_9_iteritems->tp_getattro = PyObject_GenericGetAttr;
  }
  #endif
  #if CYTHON_USE_TYPE_SPECS
  __pyx_mstate->__pyx_ptype_5pysam_7libcbcf___pyx_scope_struct_10___iter__ = (PyTypeObject *) __Pyx_PyType_FromModuleAndSpec(__pyx_m, &__pyx_type_5pysam_7libcbcf___pyx_scope_struct_10___iter___spec, NULL); if (unlikely(!__pyx_mstate->__pyx_ptype_5pysam_7libcbcf___pyx_scope_struct_10___iter__)) __PYX_ERR(0, 1453, __pyx_L1_error)
  if (__Pyx_fix_up_extension_type_from_spec(&__pyx_type_5pysam_7libcbcf___pyx_scope_struct_10___iter___spec, __pyx_mstate->__pyx_ptype_5pysam_7libcbcf___pyx_scope_struct_10___iter__) < 0) __PYX_ERR(0, 1453, __pyx_L1_error)
  #else
  __pyx_mstate->__pyx_ptype_5pysam_7libcbcf___pyx_scope_struct_10___iter__ = &__pyx_type_5pysam_7libcbcf___pyx_scope_struct_10___iter__;
  #endif
  #if !CYTHON_COMPILING_IN_LIMITED_API
  #endif
  #if !CYTHON_USE_TYPE_SPECS
  if (__Pyx_PyType_Ready(__pyx_mstate->__pyx_ptype_5pysam_7libcbcf___pyx_scope_struct_10___iter__) < 0) __PYX_ERR(0, 1453, __pyx_L1_error)
  #endif
  #if !CYTHON_COMPILING_IN_LIMITED_API
  if ((CYTHON_USE_TYPE_SLOTS && CYTHON_USE_PYTYPE_LOOKUP) && likely(!__pyx_mstate->__pyx_ptype_5pysam_7libcbcf___pyx_scope_struct_10___iter__->tp_dictoffset && __pyx_mstate->__pyx_ptype_5pysam_7libcbcf___pyx_scope_struct_10___iter__->tp_getattro == PyObject_GenericGetAttr)) {
    __pyx_mstate->__pyx_ptype_5pysam_7libcbcf___pyx_scope_struct_10___iter__->tp_getattro = PyObject_GenericGetAttr;
  }
  #endif
  #if CYTHON_USE_TYPE_SPECS
  __pyx_mstate->__pyx_ptype_5pysam_7libcbcf___pyx_scope_struct_11___iter__ = (PyTypeObject *) __Pyx_PyType_FromModuleAndSpec(__pyx_m, &__pyx_type_5pysam_7libcbcf___pyx_scope_struct_11___iter___spec, NULL); if (unlikely(!__pyx_mstate->__pyx_ptype_5pysam_7libcbcf___pyx_scope_struct_11___iter__)) __PYX_ERR(0, 1643, __pyx_L1_error)
  if (__Pyx_fix_up_extension_type_from_spec(&__pyx_type_5pysam_7libcbcf___pyx_scope_struct_11___iter___spec, __pyx_mstate->__pyx_ptype_5pysam_7libcbcf___pyx_scope_struct_11___iter__) < 0) __PYX_ERR(0, 1643, __pyx_L1_error)
  #else
  __pyx_mstate->__pyx_ptype_5pysam_7libcbcf___pyx_scope_struct_11___iter__ = &__pyx_type_5pysam_7libcbcf___pyx_scope_struct_11___iter__;
  #endif
  #if !CYTHON_COMPILING_IN_LIMITED_API
  #endif
  #if !CYTHON_USE_TYPE_SPECS
  if (__Pyx_PyType_Ready(__pyx_mstate->__pyx_ptype_5pysam_7libcbcf___pyx_scope_struct_11___iter__) < 0) __PYX_ERR(0, 1643, __pyx_L1_error)
  #endif
  #if !CYTHON_COMPILING_IN_LIMITED_API
  if ((CYTHON_USE_TYPE_SLOTS && CYTHON_USE_PYTYPE_LOOKUP) && likely(!__pyx_mstate->__pyx_ptype_5pysam_7libcbcf___pyx_scope_struct_11___iter__->tp_dictoffset && __pyx_mstate->__pyx_ptype_5pysam_7libcbcf___pyx_scope_struct_11___iter__->tp_getattro == PyObject_GenericGetAttr)) {
    __pyx_mstate->__pyx_ptype_5pysam_7libcbcf___pyx_scope_struct_11___iter__->tp_getattro = PyObject_GenericGetAttr;
  }
  #endif
  #if CYTHON_USE_TYPE_SPECS
  __pyx_mstate->__pyx_ptype_5pysam_7libcbcf___pyx_scope_struct_12_itervalues = (PyTypeObject *) __Pyx_PyType_FromModuleAndSpec(__pyx_m, &__pyx_type_5pysam_7libcbcf___pyx_scope_struct_12_itervalues_spec, NULL); if (unlikely(!__pyx_mstate->__pyx_ptype_5pysam_7libcbcf___pyx_scope_struct_12_itervalues)) __PYX_ERR(0, 1672, __pyx_L1_error)
  if (__Pyx_fix_up_extension_type_from_spec(&__pyx_type_5pysam_7libcbcf___pyx_scope_struct_12_itervalues_spec, __pyx_mstate->__pyx_ptype_5pysam_7libcbcf___pyx_scope_struct_12_itervalues) < 0) __PYX_ERR(0, 1672, __pyx_L1_error)
  #else
  __pyx_mstate->__pyx_ptype_5pysam_7libcbcf___pyx_scope_struct_12_itervalues = &__pyx_type_5pysam_7libcbcf___pyx_scope_struct_12_itervalues;
  #endif
  #if !CYTHON_COMPILING_IN_LIMITED_API
  #endif
  #if !CYTHON_USE_TYPE_SPECS
  if (__Pyx_PyType_Ready(__pyx_mstate->__pyx_ptype_5pysam_7libcbcf___pyx_scope_struct_12_itervalues) < 0) __PYX_ERR(0, 1672, __pyx_L1_error)
  #endif
  #if !CYTHON_COMPILING_IN_LIMITED_API
  if ((CYTHON_USE_TYPE_SLOTS && CYTHON_USE_PYTYPE_LOOKUP) && likely(!__pyx_mstate->__pyx_ptype_5pysam_7libcbcf___pyx_scope_struct_12_itervalues->tp_dictoffset && __pyx_mstate->__pyx_ptype_5pysam_7libcbcf___pyx_scope_struct_12_itervalues->tp_getattro == PyObject_GenericGetAttr)) {
    __pyx_mstate->__pyx_ptype_5pysam_7libcbcf___pyx_scope_struct_12_itervalues->tp_getattro = PyObject_GenericGetAttr;
  }
  #endif
  #if CYTHON_USE_TYPE_SPECS
  __pyx_mstate->__pyx_ptype_5pysam_7libcbcf___pyx_scope_struct_13_iteritems = (PyTypeObject *) __Pyx_PyType_FromModuleAndSpec(__pyx_m, &__pyx_type_5pysam_7libcbcf___pyx_scope_struct_13_iteritems_spec, NULL); if (unlikely(!__pyx_mstate->__pyx_ptype_5pysam_7libcbcf___pyx_scope_struct_13_iteritems)) __PYX_ERR(0, 1677, __pyx_L1_error)
  if (__Pyx_fix_up_extension_type_from_spec(&__pyx_type_5pysam_7libcbcf___pyx_scope_struct_13_iteritems_spec, __pyx_mstate->__pyx_ptype_5pysam_7libcbcf___pyx_scope_struct_13_iteritems) < 0) __PYX_ERR(0, 1677, __pyx_L1_error)
  #else
  __pyx_mstate->__pyx_ptype_5pysam_7libcbcf___pyx_scope_struct_13_iteritems = &__pyx_type_5pysam_7libcbcf___pyx_scope_struct_13_iteritems;
  #endif
  #if !CYTHON_COMPILING_IN_LIMITED_API
  #endif
  #if !CYTHON_USE_TYPE_SPECS
  if (__Pyx_PyType_Ready(__pyx_mstate->__pyx_ptype_5pysam_7libcbcf___pyx_scope_struct_13_iteritems) < 0) __PYX_ERR(0, 1677, __pyx_L1_error)
  #endif
  #if !CYTHON_COMPILING_IN_LIMITED_API
  if ((CYTHON_USE_TYPE_SLOTS && CYTHON_USE_PYTYPE_LOOKUP) && likely(!__pyx_mstate->__pyx_ptype_5pysam_7libcbcf___pyx_scope_struct_13_iteritems->tp_dictoffset && __pyx_mstate->__pyx_ptype_5pysam_7libcbcf___pyx_scope_struct_13_iteritems->tp_getattro == PyObject_GenericGetAttr)) {
    __pyx_mstate->__pyx_ptype_5pysam_7libcbcf___pyx_scope_struct_13_iteritems->tp_getattro = PyObject_GenericGetAttr;
  }
  #endif
  #if CYTHON_USE_TYPE_SPECS
  __pyx_mstate->__pyx_ptype_5pysam_7libcbcf___pyx_scope_struct_14___iter__ = (PyTypeObject *) __Pyx_PyType_FromModuleAndSpec(__pyx_m, &__pyx_type_5pysam_7libcbcf___pyx_scope_struct_14___iter___spec, NULL); if (unlikely(!__pyx_mstate->__pyx_ptype_5pysam_7libcbcf___pyx_scope_struct_14___iter__)) __PYX_ERR(0, 1823, __pyx_L1_error)
  if (__Pyx_fix_up_extension_type_from_spec(&__pyx_type_5pysam_7libcbcf___pyx_scope_struct_14___iter___spec, __pyx_mstate->__pyx_ptype_5pysam_7libcbcf___pyx_scope_struct_14___iter__) < 0) __PYX_ERR(0, 1823, __pyx_L1_error)
  #else
  __pyx_mstate->__pyx_ptype_5pysam_7libcbcf___pyx_scope_struct_14___iter__ = &__pyx_type_5pysam_7libcbcf___pyx_scope_struct_14___iter__;
  #endif
  #if !CYTHON_COMPILING_IN_LIMITED_API
  #endif
  #if !CYTHON_USE_TYPE_SPECS
  if (__Pyx_PyType_Ready(__pyx_mstate->__pyx_ptype_5pysam_7libcbcf___pyx_scope_struct_14___iter__) < 0) __PYX_ERR(0, 1823, __pyx_L1_error)
  #endif
  #if !CYTHON_COMPILING_IN_LIMITED_API
  if ((CYTHON_USE_TYPE_SLOTS && CYTHON_USE_PYTYPE_LOOKUP) && likely(!__pyx_mstate->__pyx_ptype_5pysam_7libcbcf___pyx_scope_struct_14___iter__->tp_dictoffset && __pyx_mstate->__pyx_ptype_5pysam_7libcbcf___pyx_scope_struct_14___iter__->tp_getattro == PyObject_GenericGetAttr)) {
    __pyx_mstate->__pyx_ptype_5pysam_7libcbcf___pyx_scope_struct_14___iter__->tp_getattro = PyObject_GenericGetAttr;
  }
  #endif
  #if CYTHON_USE_TYPE_SPECS
  __pyx_mstate->__pyx_ptype_5pysam_7libcbcf___pyx_scope_struct_15_itervalues = (PyTypeObject *) __Pyx_PyType_FromModuleAndSpec(__pyx_m, &__pyx_type_5pysam_7libcbcf___pyx_scope_struct_15_itervalues_spec, NULL); if (unlikely(!__pyx_mstate->__pyx_ptype_5pysam_7libcbcf___pyx_scope_struct_15_itervalues)) __PYX_ERR(0, 1852, __pyx_L1_error)
  if (__Pyx_fix_up_extension_type_from_spec(&__pyx_type_5pysam_7libcbcf___pyx_scope_struct_15_itervalues_spec, __pyx_mstate->__pyx_ptype_5pysam_7libcbcf___pyx_scope_struct_15_itervalues) < 0) __PYX_ERR(0, 1852, __pyx_L1_error)
  #else
  __pyx_mstate->__pyx_ptype_5pysam_7libcbcf___pyx_scope_struct_15_itervalues = &__pyx_type_5pysam_7libcbcf___pyx_scope_struct_15_itervalues;
  #endif
  #if !CYTHON_COMPILING_IN_LIMITED_API
  #endif
  #if !CYTHON_USE_TYPE_SPECS
  if (__Pyx_PyType_Ready(__pyx_mstate->__pyx_ptype_5pysam_7libcbcf___pyx_scope_struct_15_itervalues) < 0) __PYX_ERR(0, 1852, __pyx_L1_error)
  #endif
  #if !CYTHON_COMPILING_IN_LIMITED_API
  if ((CYTHON_USE_TYPE_SLOTS && CYTHON_USE_PYTYPE_LOOKUP) && likely(!__pyx_mstate->__pyx_ptype_5pysam_7libcbcf___pyx_scope_struct_15_itervalues->tp_dictoffset && __pyx_mstate->__pyx_ptype_5pysam_7libcbcf___pyx_scope_struct_15_itervalues->tp_getattro == PyObject_GenericGetAttr)) {
    __pyx_mstate->__pyx_ptype_5pysam_7libcbcf___pyx_scope_struct_15_itervalues->tp_getattro = PyObject_GenericGetAttr;
  }
  #endif
  #if CYTHON_USE_TYPE_SPECS
  __pyx_mstate->__pyx_ptype_5pysam_7libcbcf___pyx_scope_struct_16_iteritems = (PyTypeObject *) __Pyx_PyType_FromModuleAndSpec(__pyx_m, &__pyx_type_5pysam_7libcbcf___pyx_scope_struct_16_iteritems_spec, NULL); if (unlikely(!__pyx_mstate->__pyx_ptype_5pysam_7libcbcf___pyx_scope_struct_16_iteritems)) __PYX_ERR(0, 1857, __pyx_L1_error)
  if (__Pyx_fix_up_extension_type_from_spec(&__pyx_type_5pysam_7libcbcf___pyx_scope_struct_16_iteritems_spec, __pyx_mstate->__pyx_ptype_5pysam_7libcbcf___pyx_scope_struct_16_iteritems) < 0) __PYX_ERR(0, 1857, __pyx_L1_error)
  #else
  __pyx_mstate->__pyx_ptype_5pysam_7libcbcf___pyx_scope_struct_16_iteritems = &__pyx_type_5pysam_7libcbcf___pyx_scope_struct_16_iteritems;
  #endif
  #if !CYTHON_COMPILING_IN_LIMITED_API
  #endif
  #if !CYTHON_USE_TYPE_SPECS
  if (__Pyx_PyType_Ready(__pyx_mstate->__pyx_ptype_5pysam_7libcbcf___pyx_scope_struct_16_iteritems) < 0) __PYX_ERR(0, 1857, __pyx_L1_error)
  #endif
  #if !CYTHON_COMPILING_IN_LIMITED_API
  if ((CYTHON_USE_TYPE_SLOTS && CYTHON_USE_PYTYPE_LOOKUP) && likely(!__pyx_mstate->__pyx_ptype_5pysam_7libcbcf___pyx_scope_struct_16_iteritems->tp_dictoffset && __pyx_mstate->__pyx_ptype_5pysam_7libcbcf___pyx_scope_struct_16_iteritems->tp_getattro == PyObject_GenericGetAttr)) {
    __pyx_mstate->__pyx_ptype_5pysam_7libcbcf___pyx_scope_struct_16_iteritems->tp_getattro = PyObject_GenericGetAttr;
  }
  #endif
  #if CYTHON_USE_TYPE_SPECS
  __pyx_mstate->__pyx_ptype_5pysam_7libcbcf___pyx_scope_struct_17___iter__ = (PyTypeObject *) __Pyx_PyType_FromModuleAndSpec(__pyx_m, &__pyx_type_5pysam_7libcbcf___pyx_scope_struct_17___iter___spec, NULL); if (unlikely(!__pyx_mstate->__pyx_ptype_5pysam_7libcbcf___pyx_scope_struct_17___iter__)) __PYX_ERR(0, 1922, __pyx_L1_error)
  if (__Pyx_fix_up_extension_type_from_spec(&__pyx_type_5pysam_7libcbcf___pyx_scope_struct_17___iter___spec, __pyx_mstate->__pyx_ptype_5pysam_7libcbcf___pyx_scope_struct_17___iter__) < 0) __PYX_ERR(0, 1922, __pyx_L1_error)
  #else
  __pyx_mstate->__pyx_ptype_5pysam_7libcbcf___pyx_scope_struct_17___iter__ = &__pyx_type_5pysam_7libcbcf___pyx_scope_struct_17___iter__;
  #endif
  #if !CYTHON_COMPILING_IN_LIMITED_API
  #endif
  #if !CYTHON_USE_TYPE_SPECS
  if (__Pyx_PyType_Ready(__pyx_mstate->__pyx_ptype_5pysam_7libcbcf___pyx_scope_struct_17___iter__) < 0) __PYX_ERR(0, 1922, __pyx_L1_error)
  #endif
  #if !CYTHON_COMPILING_IN_LIMITED_API
  if ((CYTHON_USE_TYPE_SLOTS && CYTHON_USE_PYTYPE_LOOKUP) && likely(!__pyx_mstate->__pyx_ptype_5pysam_7libcbcf___pyx_scope_struct_17___iter__->tp_dictoffset && __pyx_mstate->__pyx_ptype_5pysam_7libcbcf___pyx_scope_struct_17___iter__->tp_getattro == PyObject_GenericGetAttr)) {
    __pyx_mstate->__pyx_ptype_5pysam_7libcbcf___pyx_scope_struct_17___iter__->tp_getattro = PyObject_GenericGetAttr;
  }
  #endif
  #if CYTHON_USE_TYPE_SPECS
  __pyx_mstate->__pyx_ptype_5pysam_7libcbcf___pyx_scope_struct_18___iter__ = (PyTypeObject *) __Pyx_PyType_FromModuleAndSpec(__pyx_m, &__pyx_type_5pysam_7libcbcf___pyx_scope_struct_18___iter___spec, NULL); if (unlikely(!__pyx_mstate->__pyx_ptype_5pysam_7libcbcf___pyx_scope_struct_18___iter__)) __PYX_ERR(0, 2323, __pyx_L1_error)
  if (__Pyx_fix_up_extension_type_from_spec(&__pyx_type_5pysam_7libcbcf___pyx_scope_struct_18___iter___spec, __pyx_mstate->__pyx_ptype_5pysam_7libcbcf___pyx_scope_struct_18___iter__) < 0) __PYX_ERR(0, 2323, __pyx_L1_error)
  #else
  __pyx_mstate->__pyx_ptype_5pysam_7libcbcf___pyx_scope_struct_18___iter__ = &__pyx_type_5pysam_7libcbcf___pyx_scope_struct_18___iter__;
  #endif
  #if !CYTHON_COMPILING_IN_LIMITED_API
  #endif
  #if !CYTHON_USE_TYPE_SPECS
  if (__Pyx_PyType_Ready(__pyx_mstate->__pyx_ptype_5pysam_7libcbcf___pyx_scope_struct_18___iter__) < 0) __PYX_ERR(0, 2323, __pyx_L1_error)
  #endif
  #if !CYTHON_COMPILING_IN_LIMITED_API
  if ((CYTHON_USE_TYPE_SLOTS && CYTHON_USE_PYTYPE_LOOKUP) && likely(!__pyx_mstate->__pyx_ptype_5pysam_7libcbcf___pyx_scope_struct_18___iter__->tp_dictoffset && __pyx_mstate->__pyx_ptype_5pysam_7libcbcf___pyx_scope_struct_18___iter__->tp_getattro == PyObject_GenericGetAttr)) {
    __pyx_mstate->__pyx_ptype_5pysam_7libcbcf___pyx_scope_struct_18___iter__->tp_getattro = PyObject_GenericGetAttr;
  }
  #endif
  #if CYTHON_USE_TYPE_SPECS
  __pyx_mstate->__pyx_ptype_5pysam_7libcbcf___pyx_scope_struct_19_itervalues = (PyTypeObject *) __Pyx_PyType_FromModuleAndSpec(__pyx_m, &__pyx_type_5pysam_7libcbcf___pyx_scope_struct_19_itervalues_spec, NULL); if (unlikely(!__pyx_mstate->__pyx_ptype_5pysam_7libcbcf___pyx_scope_struct_19_itervalues)) __PYX_ERR(0, 2348, __pyx_L1_error)
  if (__Pyx_fix_up_extension_type_from_spec(&__pyx_type_5pysam_7libcbcf___pyx_scope_struct_19_itervalues_spec, __pyx_mstate->__pyx_ptype_5pysam_7libcbcf___pyx_scope_struct_19_itervalues) < 0) __PYX_ERR(0, 2348, __pyx_L1_error)
  #else
  __pyx_mstate->__pyx_ptype_5pysam_7libcbcf___pyx_scope_struct_19_itervalues = &__pyx_type_5pysam_7libcbcf___pyx_scope_struct_19_itervalues;
  #endif
  #if !CYTHON_COMPILING_IN_LIMITED_API
  #endif
  #if !CYTHON_USE_TYPE_SPECS
  if (__Pyx_PyType_Ready(__pyx_mstate->__pyx_ptype_5pysam_7libcbcf___pyx_scope_struct_19_itervalues) < 0) __PYX_ERR(0, 2348, __pyx_L1_error)
  #endif
  #if !CYTHON_COMPILING_IN_LIMITED_API
  if ((CYTHON_USE_TYPE_SLOTS && CYTHON_USE_PYTYPE_LOOKUP) && likely(!__pyx_mstate->__pyx_ptype_5pysam_7libcbcf___pyx_scope_struct_19_itervalues->tp_dictoffset && __pyx_mstate->__pyx_ptype_5pysam_7libcbcf___pyx_scope_struct_19_itervalues->tp_getattro == PyObject_GenericGetAttr)) {
    __pyx_mstate->__pyx_ptype_5pysam_7libcbcf___pyx_scope_struct_19_itervalues->tp_getattro = PyObject_GenericGetAttr;
  }
  #endif
  #if CYTHON_USE_TYPE_SPECS
  __pyx_mstate->__pyx_ptype_5pysam_7libcbcf___pyx_scope_struct_20_iteritems = (PyTypeObject *) __Pyx_PyType_FromModuleAndSpec(__pyx_m, &__pyx_type_5pysam_7libcbcf___pyx_scope_struct_20_iteritems_spec, NULL); if (unlikely(!__pyx_mstate->__pyx_ptype_5pysam_7libcbcf___pyx_scope_struct_20_iteritems)) __PYX_ERR(0, 2353, __pyx_L1_error)
  if (__Pyx_fix_up_extension_type_from_spec(&__pyx_type_5pysam_7libcbcf___pyx_scope_struct_20_iteritems_spec, __pyx_mstate->__pyx_ptype_5pysam_7libcbcf___pyx_scope_struct_20_iteritems) < 0) __PYX_ERR(0, 2353, __pyx_L1_error)
  #else
  __pyx_mstate->__pyx_ptype_5pysam_7libcbcf___pyx_scope_struct_20_iteritems = &__pyx_type_5pysam_7libcbcf___pyx_scope_struct_20_iteritems;
  #endif
  #if !CYTHON_COMPILING_IN_LIMITED_API
  #endif
  #if !CYTHON_USE_TYPE_SPECS
  if (__Pyx_PyType_Ready(__pyx_mstate->__pyx_ptype_5pysam_7libcbcf___pyx_scope_struct_20_iteritems) < 0) __PYX_ERR(0, 2353, __pyx_L1_error)
  #endif
  #if !CYTHON_COMPILING_IN_LIMITED_API
  if ((CYTHON_USE_TYPE_SLOTS && CYTHON_USE_PYTYPE_LOOKUP) && likely(!__pyx_mstate->__pyx_ptype_5pysam_7libcbcf___pyx_scope_struct_20_iteritems->tp_dictoffset && __pyx_mstate->__pyx_ptype_5pysam_7libcbcf___pyx_scope_struct_20_iteritems->tp_getattro == PyObject_GenericGetAttr)) {
    __pyx_mstate->__pyx_ptype_5pysam_7libcbcf___pyx_scope_struct_20_iteritems->tp_getattro = PyObject_GenericGetAttr;
  }
  #endif
  #if CYTHON_USE_TYPE_SPECS
  __pyx_mstate->__pyx_ptype_5pysam_7libcbcf___pyx_scope_struct_21___iter__ = (PyTypeObject *) __Pyx_PyType_FromModuleAndSpec(__pyx_m, &__pyx_type_5pysam_7libcbcf___pyx_scope_struct_21___iter___spec, NULL); if (unlikely(!__pyx_mstate->__pyx_ptype_5pysam_7libcbcf___pyx_scope_struct_21___iter__)) __PYX_ERR(0, 2467, __pyx_L1_error)
  if (__Pyx_fix_up_extension_type_from_spec(&__pyx_type_5pysam_7libcbcf___pyx_scope_struct_21___iter___spec, __pyx_mstate->__pyx_ptype_5pysam_7libcbcf___pyx_scope_struct_21___iter__) < 0) __PYX_ERR(0, 2467, __pyx_L1_error)
  #else
  __pyx_mstate->__pyx_ptype_5pysam_7libcbcf___pyx_scope_struct_21___iter__ = &__pyx_type_5pysam_7libcbcf___pyx_scope_struct_21___iter__;
  #endif
  #if !CYTHON_COMPILING_IN_LIMITED_API
  #endif
  #if !CYTHON_USE_TYPE_SPECS
  if (__Pyx_PyType_Ready(__pyx_mstate->__pyx_ptype_5pysam_7libcbcf___pyx_scope_struct_21___iter__) < 0) __PYX_ERR(0, 2467, __pyx_L1_error)
  #endif
  #if !CYTHON_COMPILING_IN_LIMITED_API
  if ((CYTHON_USE_TYPE_SLOTS && CYTHON_USE_PYTYPE_LOOKUP) && likely(!__pyx_mstate->__pyx_ptype_5pysam_7libcbcf___pyx_scope_struct_21___iter__->tp_dictoffset && __pyx_mstate->__pyx_ptype_5pysam_7libcbcf___pyx_scope_struct_21___iter__->tp_getattro == PyObject_GenericGetAttr)) {
    __pyx_mstate->__pyx_ptype_5pysam_7libcbcf___pyx_scope_struct_21___iter__->tp_getattro = PyObject_GenericGetAttr;
  }
  #endif
  #if CYTHON_USE_TYPE_SPECS
  __pyx_mstate->__pyx_ptype_5pysam_7libcbcf___pyx_scope_struct_22_itervalues = (PyTypeObject *) __Pyx_PyType_FromModuleAndSpec(__pyx_m, &__pyx_type_5pysam_7libcbcf___pyx_scope_struct_22_itervalues_spec, NULL); if (unlikely(!__pyx_mstate->__pyx_ptype_5pysam_7libcbcf___pyx_scope_struct_22_itervalues)) __PYX_ERR(0, 2496, __pyx_L1_error)
  if (__Pyx_fix_up_extension_type_from_spec(&__pyx_type_5pysam_7libcbcf___pyx_scope_struct_22_itervalues_spec, __pyx_mstate->__pyx_ptype_5pysam_7libcbcf___pyx_scope_struct_22_itervalues) < 0) __PYX_ERR(0, 2496, __pyx_L1_error)
  #else
  __pyx_mstate->__pyx_ptype_5pysam_7libcbcf___pyx_scope_struct_22_itervalues = &__pyx_type_5pysam_7libcbcf___pyx_scope_struct_22_itervalues;
  #endif
  #if !CYTHON_COMPILING_IN_LIMITED_API
  #endif
  #if !CYTHON_USE_TYPE_SPECS
  if (__Pyx_PyType_Ready(__pyx_mstate->__pyx_ptype_5pysam_7libcbcf___pyx_scope_struct_22_itervalues) < 0) __PYX_ERR(0, 2496, __pyx_L1_error)
  #endif
  #if !CYTHON_COMPILING_IN_LIMITED_API
  if ((CYTHON_USE_TYPE_SLOTS && CYTHON_USE_PYTYPE_LOOKUP) && likely(!__pyx_mstate->__pyx_ptype_5pysam_7libcbcf___pyx_scope_struct_22_itervalues->tp_dictoffset && __pyx_mstate->__pyx_ptype_5pysam_7libcbcf___pyx_scope_struct_22_itervalues->tp_getattro == PyObject_GenericGetAttr)) {
    __pyx_mstate->__pyx_ptype_5pysam_7libcbcf___pyx_scope_struct_22_itervalues->tp_getattro = PyObject_GenericGetAttr;
  }
  #endif
  #if CYTHON_USE_TYPE_SPECS
  __pyx_mstate->__pyx_ptype_5pysam_7libcbcf___pyx_scope_struct_23_iteritems = (PyTypeObject *) __Pyx_PyType_FromModuleAndSpec(__pyx_m, &__pyx_type_5pysam_7libcbcf___pyx_scope_struct_23_iteritems_spec, NULL); if (unlikely(!__pyx_mstate->__pyx_ptype_5pysam_7libcbcf___pyx_scope_struct_23_iteritems)) __PYX_ERR(0, 2501, __pyx_L1_error)
  if (__Pyx_fix_up_extension_type_from_spec(&__pyx_type_5pysam_7libcbcf___pyx_scope_struct_23_iteritems_spec, __pyx_mstate->__pyx_ptype_5pysam_7libcbcf___pyx_scope_struct_23_iteritems) < 0) __PYX_ERR(0, 2501, __pyx_L1_error)
  #else
  __pyx_mstate->__pyx_ptype_5pysam_7libcbcf___pyx_scope_struct_23_iteritems = &__pyx_type_5pysam_7libcbcf___pyx_scope_struct_23_iteritems;
  #endif
  #if !CYTHON_COMPILING_IN_LIMITED_API
  #endif
  #if !CYTHON_USE_TYPE_SPECS
  if (__Pyx_PyType_Ready(__pyx_mstate->__pyx_ptype_5pysam_7libcbcf___pyx_scope_struct_23_iteritems) < 0) __PYX_ERR(0, 2501, __pyx_L1_error)
  #endif
  #if !CYTHON_COMPILING_IN_LIMITED_API
  if ((CYTHON_USE_TYPE_SLOTS && CYTHON_USE_PYTYPE_LOOKUP) && likely(!__pyx_mstate->__pyx_ptype_5pysam_7libcbcf___pyx_scope_struct_23_iteritems->tp_dictoffset && __pyx_mstate->__pyx_ptype_5pysam_7libcbcf___pyx_scope_struct_23_iteritems->tp_getattro == PyObject_GenericGetAttr)) {
    __pyx_mstate->__pyx_ptype_5pysam_7libcbcf___pyx_scope_struct_23_iteritems->tp_getattro = PyObject_GenericGetAttr;
  }
  #endif
  #if CYTHON_USE_TYPE_SPECS
  __pyx_mstate->__pyx_ptype_5pysam_7libcbcf___pyx_scope_struct_24___iter__ = (PyTypeObject *) __Pyx_PyType_FromModuleAndSpec(__pyx_m, &__pyx_type_5pysam_7libcbcf___pyx_scope_struct_24___iter___spec, NULL); if (unlikely(!__pyx_mstate->__pyx_ptype_5pysam_7libcbcf___pyx_scope_struct_24___iter__)) __PYX_ERR(0, 2673, __pyx_L1_error)
  if (__Pyx_fix_up_extension_type_from_spec(&__pyx_type_5pysam_7libcbcf___pyx_scope_struct_24___iter___spec, __pyx_mstate->__pyx_ptype_5pysam_7libcbcf___pyx_scope_struct_24___iter__) < 0) __PYX_ERR(0, 2673, __pyx_L1_error)
  #else
  __pyx_mstate->__pyx_ptype_5pysam_7libcbcf___pyx_scope_struct_24___iter__ = &__pyx_type_5pysam_7libcbcf___pyx_scope_struct_24___iter__;
  #endif
  #if !CYTHON_COMPILING_IN_LIMITED_API
  #endif
  #if !CYTHON_USE_TYPE_SPECS
  if (__Pyx_PyType_Ready(__pyx_mstate->__pyx_ptype_5pysam_7libcbcf___pyx_scope_struct_24___iter__) < 0) __PYX_ERR(0, 2673, __pyx_L1_error)
  #endif
  #if !CYTHON_COMPILING_IN_LIMITED_API
  if ((CYTHON_USE_TYPE_SLOTS && CYTHON_USE_PYTYPE_LOOKUP) && likely(!__pyx_mstate->__pyx_ptype_5pysam_7libcbcf___pyx_scope_struct_24___iter__->tp_dictoffset && __pyx_mstate->__pyx_ptype_5pysam_7libcbcf___pyx_scope_struct_24___iter__->tp_getattro == PyObject_GenericGetAttr)) {
    __pyx_mstate->__pyx_ptype_5pysam_7libcbcf___pyx_scope_struct_24___iter__->tp_getattro = PyObject_GenericGetAttr;
  }
  #endif
  #if CYTHON_USE_TYPE_SPECS
  __pyx_mstate->__pyx_ptype_5pysam_7libcbcf___pyx_scope_struct_25_itervalues = (PyTypeObject *) __Pyx_PyType_FromModuleAndSpec(__pyx_m, &__pyx_type_5pysam_7libcbcf___pyx_scope_struct_25_itervalues_spec, NULL); if (unlikely(!__pyx_mstate->__pyx_ptype_5pysam_7libcbcf___pyx_scope_struct_25_itervalues)) __PYX_ERR(0, 2740, __pyx_L1_error)
  if (__Pyx_fix_up_extension_type_from_spec(&__pyx_type_5pysam_7libcbcf___pyx_scope_struct_25_itervalues_spec, __pyx_mstate->__pyx_ptype_5pysam_7libcbcf___pyx_scope_struct_25_itervalues) < 0) __PYX_ERR(0, 2740, __pyx_L1_error)
  #else
  __pyx_mstate->__pyx_ptype_5pysam_7libcbcf___pyx_scope_struct_25_itervalues = &__pyx_type_5pysam_7libcbcf___pyx_scope_struct_25_itervalues;
  #endif
  #if !CYTHON_COMPILING_IN_LIMITED_API
  #endif
  #if !CYTHON_USE_TYPE_SPECS
  if (__Pyx_PyType_Ready(__pyx_mstate->__pyx_ptype_5pysam_7libcbcf___pyx_scope_struct_25_itervalues) < 0) __PYX_ERR(0, 2740, __pyx_L1_error)
  #endif
  #if !CYTHON_COMPILING_IN_LIMITED_API
  if ((CYTHON_USE_TYPE_SLOTS && CYTHON_USE_PYTYPE_LOOKUP) && likely(!__pyx_mstate->__pyx_ptype_5pysam_7libcbcf___pyx_scope_struct_25_itervalues->tp_dictoffset && __pyx_mstate->__pyx_ptype_5pysam_7libcbcf___pyx_scope_struct_25_itervalues->tp_getattro == PyObject_GenericGetAttr)) {
    __pyx_mstate->__pyx_ptype_5pysam_7libcbcf___pyx_scope_struct_25_itervalues->tp_getattro = PyObject_GenericGetAttr;
  }
  #endif
  #if CYTHON_USE_TYPE_SPECS
  __pyx_mstate->__pyx_ptype_5pysam_7libcbcf___pyx_scope_struct_26_iteritems = (PyTypeObject *) __Pyx_PyType_FromModuleAndSpec(__pyx_m, &__pyx_type_5pysam_7libcbcf___pyx_scope_struct_26_iteritems_spec, NULL); if (unlikely(!__pyx_mstate->__pyx_ptype_5pysam_7libcbcf___pyx_scope_struct_26_iteritems)) __PYX_ERR(0, 2758, __pyx_L1_error)
  if (__Pyx_fix_up_extension_type_from_spec(&__pyx_type_5pysam_7libcbcf___pyx_scope_struct_26_iteritems_spec, __pyx_mstate->__pyx_ptype_5pysam_7libcbcf___pyx_scope_struct_26_iteritems) < 0) __PYX_ERR(0, 2758, __pyx_L1_error)
  #else
  __pyx_mstate->__pyx_ptype_5pysam_7libcbcf___pyx_scope_struct_26_iteritems = &__pyx_type_5pysam_7libcbcf___pyx_scope_struct_26_iteritems;
  #endif
  #if !CYTHON_COMPILING_IN_LIMITED_API
  #endif
  #if !CYTHON_USE_TYPE_SPECS
  if (__Pyx_PyType_Ready(__pyx_mstate->__pyx_ptype_5pysam_7libcbcf___pyx_scope_struct_26_iteritems) < 0) __PYX_ERR(0, 2758, __pyx_L1_error)
  #endif
  #if !CYTHON_COMPILING_IN_LIMITED_API
  if ((CYTHON_USE_TYPE_SLOTS && CYTHON_USE_PYTYPE_LOOKUP) && likely(!__pyx_mstate->__pyx_ptype_5pysam_7libcbcf___pyx_scope_struct_26_iteritems->tp_dictoffset && __pyx_mstate->__pyx_ptype_5pysam_7libcbcf___pyx_scope_struct_26_iteritems->tp_getattro == PyObject_GenericGetAttr)) {
    __pyx_mstate->__pyx_ptype_5pysam_7libcbcf___pyx_scope_struct_26_iteritems->tp_getattro = PyObject_GenericGetAttr;
  }
  #endif
  #if CYTHON_USE_TYPE_SPECS
  __pyx_mstate->__pyx_ptype_5pysam_7libcbcf___pyx_scope_struct_27___iter__ = (PyTypeObject *) __Pyx_PyType_FromModuleAndSpec(__pyx_m, &__pyx_type_5pysam_7libcbcf___pyx_scope_struct_27___iter___spec, NULL); if (unlikely(!__pyx_mstate->__pyx_ptype_5pysam_7libcbcf___pyx_scope_struct_27___iter__)) __PYX_ERR(0, 2901, __pyx_L1_error)
  if (__Pyx_fix_up_extension_type_from_spec(&__pyx_type_5pysam_7libcbcf___pyx_scope_struct_27___iter___spec, __pyx_mstate->__pyx_ptype_5pysam_7libcbcf___pyx_scope_struct_27___iter__) < 0) __PYX_ERR(0, 2901, __pyx_L1_error)
  #else
  __pyx_mstate->__pyx_ptype_5pysam_7libcbcf___pyx_scope_struct_27___iter__ = &__pyx_type_5pysam_7libcbcf___pyx_scope_struct_27___iter__;
  #endif
  #if !CYTHON_COMPILING_IN_LIMITED_API
  #endif
  #if !CYTHON_USE_TYPE_SPECS
  if (__Pyx_PyType_Ready(__pyx_mstate->__pyx_ptype_5pysam_7libcbcf___pyx_scope_struct_27___iter__) < 0) __PYX_ERR(0, 2901, __pyx_L1_error)
  #endif
  #if !CYTHON_COMPILING_IN_LIMITED_API
  if ((CYTHON_USE_TYPE_SLOTS && CYTHON_USE_PYTYPE_LOOKUP) && likely(!__pyx_mstate->__pyx_ptype_5pysam_7libcbcf___pyx_scope_struct_27___iter__->tp_dictoffset && __pyx_mstate->__pyx_ptype_5pysam_7libcbcf___pyx_scope_struct_27___iter__->tp_getattro == PyObject_GenericGetAttr)) {
    __pyx_mstate->__pyx_ptype_5pysam_7libcbcf___pyx_scope_struct_27___iter__->tp_getattro = PyObject_GenericGetAttr;
  }
  #endif
  #if CYTHON_USE_TYPE_SPECS
  __pyx_mstate->__pyx_ptype_5pysam_7libcbcf___pyx_scope_struct_28_itervalues = (PyTypeObject *) __Pyx_PyType_FromModuleAndSpec(__pyx_m, &__pyx_type_5pysam_7libcbcf___pyx_scope_struct_28_itervalues_spec, NULL); if (unlikely(!__pyx_mstate->__pyx_ptype_5pysam_7libcbcf___pyx_scope_struct_28_itervalues)) __PYX_ERR(0, 2938, __pyx_L1_error)
  if (__Pyx_fix_up_extension_type_from_spec(&__pyx_type_5pysam_7libcbcf___pyx_scope_struct_28_itervalues_spec, __pyx_mstate->__pyx_ptype_5pysam_7libcbcf___pyx_scope_struct_28_itervalues) < 0) __PYX_ERR(0, 2938, __pyx_L1_error)
  #else
  __pyx_mstate->__pyx_ptype_5pysam_7libcbcf___pyx_scope_struct_28_itervalues = &__pyx_type_5pysam_7libcbcf___pyx_scope_struct_28_itervalues;
  #endif
  #if !CYTHON_COMPILING_IN_LIMITED_API
  #endif
  #if !CYTHON_USE_TYPE_SPECS
  if (__Pyx_PyType_Ready(__pyx_mstate->__pyx_ptype_5pysam_7libcbcf___pyx_scope_struct_28_itervalues) < 0) __PYX_ERR(0, 2938, __pyx_L1_error)
  #endif
  #if !CYTHON_COMPILING_IN_LIMITED_API
  if ((CYTHON_USE_TYPE_SLOTS && CYTHON_USE_PYTYPE_LOOKUP) && likely(!__pyx_mstate->__pyx_ptype_5pysam_7libcbcf___pyx_scope_struct_28_itervalues->tp_dictoffset && __pyx_mstate->__pyx_ptype_5pysam_7libcbcf___pyx_scope_struct_28_itervalues->tp_getattro == PyObject_GenericGetAttr)) {
    __pyx_mstate->__pyx_ptype_5pysam_7libcbcf___pyx_scope_struct_28_itervalues->tp_getattro = PyObject_GenericGetAttr;
  }
  #endif
  #if CYTHON_USE_TYPE_SPECS
  __pyx_mstate->__pyx_ptype_5pysam_7libcbcf___pyx_scope_struct_29_iteritems = (PyTypeObject *) __Pyx_PyType_FromModuleAndSpec(__pyx_m, &__pyx_type_5pysam_7libcbcf___pyx_scope_struct_29_iteritems_spec, NULL); if (unlikely(!__pyx_mstate->__pyx_ptype_5pysam_7libcbcf___pyx_scope_struct_29_iteritems)) __PYX_ERR(0, 2947, __pyx_L1_error)
  if (__Pyx_fix_up_extension_type_from_spec(&__pyx_type_5pysam_7libcbcf___pyx_scope_struct_29_iteritems_spec, __pyx_mstate->__pyx_ptype_5pysam_7libcbcf___pyx_scope_struct_29_iteritems) < 0) __PYX_ERR(0, 2947, __pyx_L1_error)
  #else
  __pyx_mstate->__pyx_ptype_5pysam_7libcbcf___pyx_scope_struct_29_iteritems = &__pyx_type_5pysam_7libcbcf___pyx_scope_struct_29_iteritems;
  #endif
  #if !CYTHON_COMPILING_IN_LIMITED_API
  #endif
  #if !CYTHON_USE_TYPE_SPECS
  if (__Pyx_PyType_Ready(__pyx_mstate->__pyx_ptype_5pysam_7libcbcf___pyx_scope_struct_29_iteritems) < 0) __PYX_ERR(0, 2947, __pyx_L1_error)
  #endif
  #if !CYTHON_COMPILING_IN_LIMITED_API
  if ((CYTHON_USE_TYPE_SLOTS && CYTHON_USE_PYTYPE_LOOKUP) && likely(!__pyx_mstate->__pyx_ptype_5pysam_7libcbcf___pyx_scope_struct_29_iteritems->tp_dictoffset && __pyx_mstate->__pyx_ptype_5pysam_7libcbcf___pyx_scope_struct_29_iteritems->tp_getattro == PyObject_GenericGetAttr)) {
    __pyx_mstate->__pyx_ptype_5pysam_7libcbcf___pyx_scope_struct_29_iteritems->tp_getattro = PyObject_GenericGetAttr;
  }
  #endif
  #if CYTHON_USE_TYPE_SPECS
  __pyx_mstate->__pyx_ptype_5pysam_7libcbcf___pyx_scope_struct_30___set__ = (PyTypeObject *) __Pyx_PyType_FromModuleAndSpec(__pyx_m, &__pyx_type_5pysam_7libcbcf___pyx_scope_struct_30___set___spec, NULL); if (unlikely(!__pyx_mstate->__pyx_ptype_5pysam_7libcbcf___pyx_scope_struct_30___set__)) __PYX_ERR(0, 3479, __pyx_L1_error)
  if (__Pyx_fix_up_extension_type_from_spec(&__pyx_type_5pysam_7libcbcf___pyx_scope_struct_30___set___spec, __pyx_mstate->__pyx_ptype_5pysam_7libcbcf___pyx_scope_struct_30___set__) < 0) __PYX_ERR(0, 3479, __pyx_L1_error)
  #else
  __pyx_mstate->__pyx_ptype_5pysam_7libcbcf___pyx_scope_struct_30___set__ = &__pyx_type_5pysam_7libcbcf___pyx_scope_struct_30___set__;
  #endif
  #if !CYTHON_COMPILING_IN_LIMITED_API
  #endif
  #if !CYTHON_USE_TYPE_SPECS
  if (__Pyx_PyType_Ready(__pyx_mstate->__pyx_ptype_5pysam_7libcbcf___pyx_scope_struct_30___set__) < 0) __PYX_ERR(0, 3479, __pyx_L1_error)
  #endif
  #if !CYTHON_COMPILING_IN_LIMITED_API
  if ((CYTHON_USE_TYPE_SLOTS && CYTHON_USE_PYTYPE_LOOKUP) && likely(!__pyx_mstate->__pyx_ptype_5pysam_7libcbcf___pyx_scope_struct_30___set__->tp_dictoffset && __pyx_mstate->__pyx_ptype_5pysam_7libcbcf___pyx_scope_struct_30___set__->tp_getattro == PyObject_GenericGetAttr)) {
    __pyx_mstate->__pyx_ptype_5pysam_7libcbcf___pyx_scope_struct_30___set__->tp_getattro = PyObject_GenericGetAttr;
  }
  #endif
  #if CYTHON_USE_TYPE_SPECS
  __pyx_mstate->__pyx_ptype_5pysam_7libcbcf___pyx_scope_struct_31_genexpr = (PyTypeObject *) __Pyx_PyType_FromModuleAndSpec(__pyx_m, &__pyx_type_5pysam_7libcbcf___pyx_scope_struct_31_genexpr_spec, NULL); if (unlikely(!__pyx_mstate->__pyx_ptype_5pysam_7libcbcf___pyx_scope_struct_31_genexpr)) __PYX_ERR(0, 3489, __pyx_L1_error)
  if (__Pyx_fix_up_extension_type_from_spec(&__pyx_type_5pysam_7libcbcf___pyx_scope_struct_31_genexpr_spec, __pyx_mstate->__pyx_ptype_5pysam_7libcbcf___pyx_scope_struct_31_genexpr) < 0) __PYX_ERR(0, 3489, __pyx_L1_error)
  #else
  __pyx_mstate->__pyx_ptype_5pysam_7libcbcf___pyx_scope_struct_31_genexpr = &__pyx_type_5pysam_7libcbcf___pyx_scope_struct_31_genexpr;
  #endif
  #if !CYTHON_COMPILING_IN_LIMITED_API
  #endif
  #if !CYTHON_USE_TYPE_SPECS
  if (__Pyx_PyType_Ready(__pyx_mstate->__pyx_ptype_5pysam_7libcbcf___pyx_scope_struct_31_genexpr) < 0) __PYX_ERR(0, 3489, __pyx_L1_error)
  #endif
  #if !CYTHON_COMPILING_IN_LIMITED_API
  if ((CYTHON_USE_TYPE_SLOTS && CYTHON_USE_PYTYPE_LOOKUP) && likely(!__pyx_mstate->__pyx_ptype_5pysam_7libcbcf___pyx_scope_struct_31_genexpr->tp_dictoffset && __pyx_mstate->__pyx_ptype_5pysam_7libcbcf___pyx_scope_struct_31_genexpr->tp_getattro == PyObject_GenericGetAttr)) {
    __pyx_mstate->__pyx_ptype_5pysam_7libcbcf___pyx_scope_struct_31_genexpr->tp_getattro = PyObject_GenericGetAttr;
  }
  #endif
  #if CYTHON_USE_TYPE_SPECS
  __pyx_mstate->__pyx_ptype_5pysam_7libcbcf___pyx_scope_struct_32_genexpr = (PyTypeObject *) __Pyx_PyType_FromModuleAndSpec(__pyx_m, &__pyx_type_5pysam_7libcbcf___pyx_scope_struct_32_genexpr_spec, NULL); if (unlikely(!__pyx_mstate->__pyx_ptype_5pysam_7libcbcf___pyx_scope_struct_32_genexpr)) __PYX_ERR(0, 3494, __pyx_L1_error)
  if (__Pyx_fix_up_extension_type_from_spec(&__pyx_type_5pysam_7libcbcf___pyx_scope_struct_32_genexpr_spec, __pyx_mstate->__pyx_ptype_5pysam_7libcbcf___pyx_scope_struct_32_genexpr) < 0) __PYX_ERR(0, 3494, __pyx_L1_error)
  #else
  __pyx_mstate->__pyx_ptype_5pysam_7libcbcf___pyx_scope_struct_32_genexpr = &__pyx_type_5pysam_7libcbcf___pyx_scope_struct_32_genexpr;
  #endif
  #if !CYTHON_COMPILING_IN_LIMITED_API
  #endif
  #if !CYTHON_USE_TYPE_SPECS
  if (__Pyx_PyType_Ready(__pyx_mstate->__pyx_ptype_5pysam_7libcbcf___pyx_scope_struct_32_genexpr) < 0) __PYX_ERR(0, 3494, __pyx_L1_error)
  #endif
  #if !CYTHON_COMPILING_IN_LIMITED_API
  if ((CYTHON_USE_TYPE_SLOTS && CYTHON_USE_PYTYPE_LOOKUP) && likely(!__pyx_mstate->__pyx_ptype_5pysam_7libcbcf___pyx_scope_struct_32_genexpr->tp_dictoffset && __pyx_mstate->__pyx_ptype_5pysam_7libcbcf___pyx_scope_struct_32_genexpr->tp_getattro == PyObject_GenericGetAttr)) {
    __pyx_mstate->__pyx_ptype_5pysam_7libcbcf___pyx_scope_struct_32_genexpr->tp_getattro = PyObject_GenericGetAttr;
  }
  #endif
  #if CYTHON_USE_TYPE_SPECS
  __pyx_mstate->__pyx_ptype_5pysam_7libcbcf___pyx_scope_struct_33___iter__ = (PyTypeObject *) __Pyx_PyType_FromModuleAndSpec(__pyx_m, &__pyx_type_5pysam_7libcbcf___pyx_scope_struct_33___iter___spec, NULL); if (unlikely(!__pyx_mstate->__pyx_ptype_5pysam_7libcbcf___pyx_scope_struct_33___iter__)) __PYX_ERR(0, 3559, __pyx_L1_error)
  if (__Pyx_fix_up_extension_type_from_spec(&__pyx_type_5pysam_7libcbcf___pyx_scope_struct_33___iter___spec, __pyx_mstate->__pyx_ptype_5pysam_7libcbcf___pyx_scope_struct_33___iter__) < 0) __PYX_ERR(0, 3559, __pyx_L1_error)
  #else
  __pyx_mstate->__pyx_ptype_5pysam_7libcbcf___pyx_scope_struct_33___iter__ = &__pyx_type_5pysam_7libcbcf___pyx_scope_struct_33___iter__;
  #endif
  #if !CYTHON_COMPILING_IN_LIMITED_API
  #endif
  #if !CYTHON_USE_TYPE_SPECS
  if (__Pyx_PyType_Ready(__pyx_mstate->__pyx_ptype_5pysam_7libcbcf___pyx_scope_struct_33___iter__) < 0) __PYX_ERR(0, 3559, __pyx_L1_error)
  #endif
  #if !CYTHON_COMPILING_IN_LIMITED_API
  if ((CYTHON_USE_TYPE_SLOTS && CYTHON_USE_PYTYPE_LOOKUP) && likely(!__pyx_mstate->__pyx_ptype_5pysam_7libcbcf___pyx_scope_struct_33___iter__->tp_dictoffset && __pyx_mstate->__pyx_ptype_5pysam_7libcbcf___pyx_scope_struct_33___iter__->tp_getattro == PyObject_GenericGetAttr)) {
    __pyx_mstate->__pyx_ptype_5pysam_7libcbcf___pyx_scope_struct_33___iter__->tp_getattro = PyObject_GenericGetAttr;
  }
  #endif
  #if CYTHON_USE_TYPE_SPECS
  __pyx_mstate->__pyx_ptype_5pysam_7libcbcf___pyx_scope_struct_34_itervalues = (PyTypeObject *) __Pyx_PyType_FromModuleAndSpec(__pyx_m, &__pyx_type_5pysam_7libcbcf___pyx_scope_struct_34_itervalues_spec, NULL); if (unlikely(!__pyx_mstate->__pyx_ptype_5pysam_7libcbcf___pyx_scope_struct_34_itervalues)) __PYX_ERR(0, 3588, __pyx_L1_error)
  if (__Pyx_fix_up_extension_type_from_spec(&__pyx_type_5pysam_7libcbcf___pyx_scope_struct_34_itervalues_spec, __pyx_mstate->__pyx_ptype_5pysam_7libcbcf___pyx_scope_struct_34_itervalues) < 0) __PYX_ERR(0, 3588, __pyx_L1_error)
  #else
  __pyx_mstate->__pyx_ptype_5pysam_7libcbcf___pyx_scope_struct_34_itervalues = &__pyx_type_5pysam_7libcbcf___pyx_scope_struct_34_itervalues;
  #endif
  #if !CYTHON_COMPILING_IN_LIMITED_API
  #endif
  #if !CYTHON_USE_TYPE_SPECS
  if (__Pyx_PyType_Ready(__pyx_mstate->__pyx_ptype_5pysam_7libcbcf___pyx_scope_struct_34_itervalues) < 0) __PYX_ERR(0, 3588, __pyx_L1_error)
  #endif
  #if !CYTHON_COMPILING_IN_LIMITED_API
  if ((CYTHON_USE_TYPE_SLOTS && CYTHON_USE_PYTYPE_LOOKUP) && likely(!__pyx_mstate->__pyx_ptype_5pysam_7libcbcf___pyx_scope_struct_34_itervalues->tp_dictoffset && __pyx_mstate->__pyx_ptype_5pysam_7libcbcf___pyx_scope_struct_34_itervalues->tp_getattro == PyObject_GenericGetAttr)) {
    __pyx_mstate->__pyx_ptype_5pysam_7libcbcf___pyx_scope_struct_34_itervalues->tp_getattro = PyObject_GenericGetAttr;
  }
  #endif
  #if CYTHON_USE_TYPE_SPECS
  __pyx_mstate->__pyx_ptype_5pysam_7libcbcf___pyx_scope_struct_35_iteritems = (PyTypeObject *) __Pyx_PyType_FromModuleAndSpec(__pyx_m, &__pyx_type_5pysam_7libcbcf___pyx_scope_struct_35_iteritems_spec, NULL); if (unlikely(!__pyx_mstate->__pyx_ptype_5pysam_7libcbcf___pyx_scope_struct_35_iteritems)) __PYX_ERR(0, 3593, __pyx_L1_error)
  if (__Pyx_fix_up_extension_type_from_spec(&__pyx_type_5pysam_7libcbcf___pyx_scope_struct_35_iteritems_spec, __pyx_mstate->__pyx_ptype_5pysam_7libcbcf___pyx_scope_struct_35_iteritems) < 0) __PYX_ERR(0, 3593, __pyx_L1_error)
  #else
  __pyx_mstate->__pyx_ptype_5pysam_7libcbcf___pyx_scope_struct_35_iteritems = &__pyx_type_5pysam_7libcbcf___pyx_scope_struct_35_iteritems;
  #endif
  #if !CYTHON_COMPILING_IN_LIMITED_API
  #endif
  #if !CYTHON_USE_TYPE_SPECS
  if (__Pyx_PyType_Ready(__pyx_mstate->__pyx_ptype_5pysam_7libcbcf___pyx_scope_struct_35_iteritems) < 0) __PYX_ERR(0, 3593, __pyx_L1_error)
  #endif
  #if !CYTHON_COMPILING_IN_LIMITED_API
  if ((CYTHON_USE_TYPE_SLOTS && CYTHON_USE_PYTYPE_LOOKUP) && likely(!__pyx_mstate->__pyx_ptype_5pysam_7libcbcf___pyx_scope_struct_35_iteritems->tp_dictoffset && __pyx_mstate->__pyx_ptype_5pysam_7libcbcf___pyx_scope_struct_35_iteritems->tp_getattro == PyObject_GenericGetAttr)) {
    __pyx_mstate->__pyx_ptype_5pysam_7libcbcf___pyx_scope_struct_35_iteritems->tp_getattro = PyObject_GenericGetAttr;
  }
  #endif
  #if CYTHON_USE_TYPE_SPECS
  __pyx_mstate->__pyx_ptype_5pysam_7libcbcf___pyx_scope_struct_36_itervalues = (PyTypeObject *) __Pyx_PyType_FromModuleAndSpec(__pyx_m, &__pyx_type_5pysam_7libcbcf___pyx_scope_struct_36_itervalues_spec, NULL); if (unlikely(!__pyx_mstate->__pyx_ptype_5pysam_7libcbcf___pyx_scope_struct_36_itervalues)) __PYX_ERR(0, 3703, __pyx_L1_error)
  if (__Pyx_fix_up_extension_type_from_spec(&__pyx_type_5pysam_7libcbcf___pyx_scope_struct_36_itervalues_spec, __pyx_mstate->__pyx_ptype_5pysam_7libcbcf___pyx_scope_struct_36_itervalues) < 0) __PYX_ERR(0, 3703, __pyx_L1_error)
  #else
  __pyx_mstate->__pyx_ptype_5pysam_7libcbcf___pyx_scope_struct_36_itervalues = &__pyx_type_5pysam_7libcbcf___pyx_scope_struct_36_itervalues;
  #endif
  #if !CYTHON_COMPILING_IN_LIMITED_API
  #endif
  #if !CYTHON_USE_TYPE_SPECS
  if (__Pyx_PyType_Ready(__pyx_mstate->__pyx_ptype_5pysam_7libcbcf___pyx_scope_struct_36_itervalues) < 0) __PYX_ERR(0, 3703, __pyx_L1_error)
  #endif
  #if !CYTHON_COMPILING_IN_LIMITED_API
  if ((CYTHON_USE_TYPE_SLOTS && CYTHON_USE_PYTYPE_LOOKUP) && likely(!__pyx_mstate->__pyx_ptype_5pysam_7libcbcf___pyx_scope_struct_36_itervalues->tp_dictoffset && __pyx_mstate->__pyx_ptype_5pysam_7libcbcf___pyx_scope_struct_36_itervalues->tp_getattro == PyObject_GenericGetAttr)) {
    __pyx_mstate->__pyx_ptype_5pysam_7libcbcf___pyx_scope_struct_36_itervalues->tp_getattro = PyObject_GenericGetAttr;
  }
  #endif
  #if CYTHON_USE_TYPE_SPECS
  __pyx_mstate->__pyx_ptype_5pysam_7libcbcf___pyx_scope_struct_37_iteritems = (PyTypeObject *) __Pyx_PyType_FromModuleAndSpec(__pyx_m, &__pyx_type_5pysam_7libcbcf___pyx_scope_struct_37_iteritems_spec, NULL); if (unlikely(!__pyx_mstate->__pyx_ptype_5pysam_7libcbcf___pyx_scope_struct_37_iteritems)) __PYX_ERR(0, 3708, __pyx_L1_error)
  if (__Pyx_fix_up_extension_type_from_spec(&__pyx_type_5pysam_7libcbcf___pyx_scope_struct_37_iteritems_spec, __pyx_mstate->__pyx_ptype_5pysam_7libcbcf___pyx_scope_struct_37_iteritems) < 0) __PYX_ERR(0, 3708, __pyx_L1_error)
  #else
  __pyx_mstate->__pyx_ptype_5pysam_7libcbcf___pyx_scope_struct_37_iteritems = &__pyx_type_5pysam_7libcbcf___pyx_scope_struct_37_iteritems;
  #endif
  #if !CYTHON_COMPILING_IN_LIMITED_API
  #endif
  #if !CYTHON_USE_TYPE_SPECS
  if (__Pyx_PyType_Ready(__pyx_mstate->__pyx_ptype_5pysam_7libcbcf___pyx_scope_struct_37_iteritems) < 0) __PYX_ERR(0, 3708, __pyx_L1_error)
  #endif
  #if !CYTHON_COMPILING_IN_LIMITED_API
  if ((CYTHON_USE_TYPE_SLOTS && CYTHON_USE_PYTYPE_LOOKUP) && likely(!__pyx_mstate->__pyx_ptype_5pysam_7libcbcf___pyx_scope_struct_37_iteritems->tp_dictoffset && __pyx_mstate->__pyx_ptype_5pysam_7libcbcf___pyx_scope_struct_37_iteritems->tp_getattro == PyObject_GenericGetAttr)) {
    __pyx_mstate->__pyx_ptype_5pysam_7libcbcf___pyx_scope_struct_37_iteritems->tp_getattro = PyObject_GenericGetAttr;
  }
  #endif
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __Pyx_RefNannyFinishContext();
  return 0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __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(5, 9, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_mstate->__pyx_ptype_7cpython_4type_type = __Pyx_ImportType_3_1_2(__pyx_t_1, __Pyx_BUILTIN_MODULE_NAME, "type",
  #if defined(PYPY_VERSION_NUM) && PYPY_VERSION_NUM < 0x050B0000
  sizeof(PyTypeObject), __PYX_GET_STRUCT_ALIGNMENT_3_1_2(PyTypeObject),
  #elif CYTHON_COMPILING_IN_LIMITED_API
  0, 0,
  #else
  sizeof(PyHeapTypeObject), __PYX_GET_STRUCT_ALIGNMENT_3_1_2(PyHeapTypeObject),
  #endif
  __Pyx_ImportType_CheckSize_Warn_3_1_2); if (!__pyx_mstate->__pyx_ptype_7cpython_4type_type) __PYX_ERR(5, 9, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_t_1 = PyImport_ImportModule(__Pyx_BUILTIN_MODULE_NAME); if (unlikely(!__pyx_t_1)) __PYX_ERR(6, 8, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_mstate->__pyx_ptype_7cpython_4bool_bool = __Pyx_ImportType_3_1_2(__pyx_t_1, __Pyx_BUILTIN_MODULE_NAME, "bool",
  #if defined(PYPY_VERSION_NUM) && PYPY_VERSION_NUM < 0x050B0000
  sizeof(PyLongObject), __PYX_GET_STRUCT_ALIGNMENT_3_1_2(PyLongObject),
  #elif CYTHON_COMPILING_IN_LIMITED_API
  0, 0,
  #else
  sizeof(PyLongObject), __PYX_GET_STRUCT_ALIGNMENT_3_1_2(PyLongObject),
  #endif
  __Pyx_ImportType_CheckSize_Warn_3_1_2); if (!__pyx_mstate->__pyx_ptype_7cpython_4bool_bool) __PYX_ERR(6, 8, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_t_1 = PyImport_ImportModule(__Pyx_BUILTIN_MODULE_NAME); if (unlikely(!__pyx_t_1)) __PYX_ERR(7, 16, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_mstate->__pyx_ptype_7cpython_7complex_complex = __Pyx_ImportType_3_1_2(__pyx_t_1, __Pyx_BUILTIN_MODULE_NAME, "complex",
  #if defined(PYPY_VERSION_NUM) && PYPY_VERSION_NUM < 0x050B0000
  sizeof(PyComplexObject), __PYX_GET_STRUCT_ALIGNMENT_3_1_2(PyComplexObject),
  #elif CYTHON_COMPILING_IN_LIMITED_API
  0, 0,
  #else
  sizeof(PyComplexObject), __PYX_GET_STRUCT_ALIGNMENT_3_1_2(PyComplexObject),
  #endif
  __Pyx_ImportType_CheckSize_Warn_3_1_2); if (!__pyx_mstate->__pyx_ptype_7cpython_7complex_complex) __PYX_ERR(7, 16, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_t_1 = PyImport_ImportModule("array"); if (unlikely(!__pyx_t_1)) __PYX_ERR(2, 69, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_mstate->__pyx_ptype_7cpython_5array_array = __Pyx_ImportType_3_1_2(__pyx_t_1, "array", "array",
  #if defined(PYPY_VERSION_NUM) && PYPY_VERSION_NUM < 0x050B0000
  sizeof(arrayobject), __PYX_GET_STRUCT_ALIGNMENT_3_1_2(arrayobject),
  #elif CYTHON_COMPILING_IN_LIMITED_API
  sizeof(arrayobject), __PYX_GET_STRUCT_ALIGNMENT_3_1_2(arrayobject),
  #else
  sizeof(arrayobject), __PYX_GET_STRUCT_ALIGNMENT_3_1_2(arrayobject),
  #endif
  __Pyx_ImportType_CheckSize_Warn_3_1_2); if (!__pyx_mstate->__pyx_ptype_7cpython_5array_array) __PYX_ERR(2, 69, __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);
  PyObject *__pyx_t_1 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("__Pyx_modinit_function_import_code", 0);
  /*--- Function import code ---*/
  __pyx_t_1 = PyImport_ImportModule("pysam.libcutils"); if (!__pyx_t_1) __PYX_ERR(0, 1, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  if (__Pyx_ImportFunction_3_1_2(__pyx_t_1, "OSError_from_errno", (void (**)(void))&__pyx_f_5pysam_9libcutils_OSError_from_errno, "PyObject *(PyObject *, struct __pyx_opt_args_5pysam_9libcutils_OSError_from_errno *__pyx_optional_args)") < 0) __PYX_ERR(0, 1, __pyx_L1_error)
  if (__Pyx_ImportFunction_3_1_2(__pyx_t_1, "charptr_to_str", (void (**)(void))&__pyx_f_5pysam_9libcutils_charptr_to_str, "PyObject *(char const *, struct __pyx_opt_args_5pysam_9libcutils_charptr_to_str *__pyx_optional_args)") < 0) __PYX_ERR(0, 1, __pyx_L1_error)
  if (__Pyx_ImportFunction_3_1_2(__pyx_t_1, "charptr_to_str_w_len", (void (**)(void))&__pyx_f_5pysam_9libcutils_charptr_to_str_w_len, "PyObject *(char const *, size_t, struct __pyx_opt_args_5pysam_9libcutils_charptr_to_str_w_len *__pyx_optional_args)") < 0) __PYX_ERR(0, 1, __pyx_L1_error)
  if (__Pyx_ImportFunction_3_1_2(__pyx_t_1, "force_str", (void (**)(void))&__pyx_f_5pysam_9libcutils_force_str, "PyObject *(PyObject *, struct __pyx_opt_args_5pysam_9libcutils_force_str *__pyx_optional_args)") < 0) __PYX_ERR(0, 1, __pyx_L1_error)
  if (__Pyx_ImportFunction_3_1_2(__pyx_t_1, "force_bytes", (void (**)(void))&__pyx_f_5pysam_9libcutils_force_bytes, "PyObject *(PyObject *, struct __pyx_opt_args_5pysam_9libcutils_force_bytes *__pyx_optional_args)") < 0) __PYX_ERR(0, 1, __pyx_L1_error)
  if (__Pyx_ImportFunction_3_1_2(__pyx_t_1, "decode_bytes", (void (**)(void))&__pyx_f_5pysam_9libcutils_decode_bytes, "PyObject *(PyObject *, struct __pyx_opt_args_5pysam_9libcutils_decode_bytes *__pyx_optional_args)") < 0) __PYX_ERR(0, 1, __pyx_L1_error)
  if (__Pyx_ImportFunction_3_1_2(__pyx_t_1, "encode_filename", (void (**)(void))&__pyx_f_5pysam_9libcutils_encode_filename, "PyObject *(PyObject *)") < 0) __PYX_ERR(0, 1, __pyx_L1_error)
  if (__Pyx_ImportFunction_3_1_2(__pyx_t_1, "from_string_and_size", (void (**)(void))&__pyx_f_5pysam_9libcutils_from_string_and_size, "PyObject *(char const *, size_t)") < 0) __PYX_ERR(0, 1, __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;
}

#if CYTHON_PEP489_MULTI_PHASE_INIT
static PyObject* __pyx_pymod_create(PyObject *spec, PyModuleDef *def); /*proto*/
static int __pyx_pymod_exec_libcbcf(PyObject* module); /*proto*/
static PyModuleDef_Slot __pyx_moduledef_slots[] = {
  {Py_mod_create, (void*)__pyx_pymod_create},
  {Py_mod_exec, (void*)__pyx_pymod_exec_libcbcf},
  #if CYTHON_COMPILING_IN_CPYTHON_FREETHREADING
  {Py_mod_gil, Py_MOD_GIL_USED},
  #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,
      "libcbcf",
      0, /* 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_libcbcf(void) CYTHON_SMALL_CODE; /*proto*/
__Pyx_PyMODINIT_FUNC PyInit_libcbcf(void)
#if CYTHON_PEP489_MULTI_PHASE_INIT
{
  return PyModuleDef_Init(&__pyx_moduledef);
}
/* ModuleCreationPEP489 */
#if CYTHON_COMPILING_IN_LIMITED_API && __PYX_LIMITED_VERSION_HEX < 0x03090000
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
    PY_INT64_T current_id = PyInterpreterState_GetIDFromThreadState(PyThreadState_Get());
#elif CYTHON_COMPILING_IN_LIMITED_API && __PYX_LIMITED_VERSION_HEX >= 0x03090000
    PY_INT64_T current_id = PyInterpreterState_GetID(PyInterpreterState_Get());
#elif CYTHON_COMPILING_IN_LIMITED_API
    PY_INT64_T current_id = __Pyx_GetCurrentInterpreterId();
#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_libcbcf(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;
  __Pyx_TraceDeclarationsFunc
  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_RefNannyDeclarations
  #if CYTHON_PEP489_MULTI_PHASE_INIT
  if (__pyx_m) {
    if (__pyx_m == __pyx_pyinit_module) return 0;
    PyErr_SetString(PyExc_RuntimeError, "Module 'libcbcf' 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 "libcbcf" 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_libcbcf", 0);
  if (__Pyx_check_binary_version(__PYX_LIMITED_VERSION_HEX, __Pyx_get_runtime_version(), CYTHON_COMPILING_IN_LIMITED_API) < 0) __PYX_ERR(0, 1, __pyx_L1_error)
  #ifdef __Pxy_PyFrame_Initialize_Offsets
  __Pxy_PyFrame_Initialize_Offsets();
  #endif
  __pyx_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)
  /*--- 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 0 || defined(__Pyx_CyFunction_USED) || defined(__Pyx_FusedFunction_USED) || defined(__Pyx_Coroutine_USED) || defined(__Pyx_Generator_USED) || defined(__Pyx_AsyncGen_USED)
  if (__pyx_CommonTypesMetaclass_init(__pyx_m) < 0) __PYX_ERR(0, 1, __pyx_L1_error)
  #endif
  #ifdef __Pyx_CyFunction_USED
  if (__pyx_CyFunction_init(__pyx_m) < 0) __PYX_ERR(0, 1, __pyx_L1_error)
  #endif
  #ifdef __Pyx_FusedFunction_USED
  if (__pyx_FusedFunction_init(__pyx_m) < 0) __PYX_ERR(0, 1, __pyx_L1_error)
  #endif
  #ifdef __Pyx_Coroutine_USED
  if (__pyx_Coroutine_init(__pyx_m) < 0) __PYX_ERR(0, 1, __pyx_L1_error)
  #endif
  #ifdef __Pyx_Generator_USED
  if (__pyx_Generator_init(__pyx_m) < 0) __PYX_ERR(0, 1, __pyx_L1_error)
  #endif
  #ifdef __Pyx_AsyncGen_USED
  if (__pyx_AsyncGen_init(__pyx_m) < 0) __PYX_ERR(0, 1, __pyx_L1_error)
  #endif
  /*--- Library function declarations ---*/
  if (__pyx_module_is_main_pysam__libcbcf) {
    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, "pysam.libcbcf")) {
      if (unlikely((PyDict_SetItemString(modules, "pysam.libcbcf", __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);
  if (unlikely((__Pyx_modinit_function_import_code(__pyx_mstate) < 0))) __PYX_ERR(0, 1, __pyx_L1_error)
  /*--- Execution code ---*/
  __Pyx_TraceStartFunc("PyInit_libcbcf", __pyx_f[0], 1, 13, 0, 0, __PYX_ERR(0, 1, __pyx_L1_error));

  /* "pysam/libcbcf.pyx":85
 * from __future__ import division, print_function
 * 
 * import os             # <<<<<<<<<<<<<<
 * import sys
 * 
*/
  __pyx_t_2 = __Pyx_ImportDottedModule(__pyx_mstate_global->__pyx_n_u_os, NULL); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 85, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  if (PyDict_SetItem(__pyx_mstate_global->__pyx_d, __pyx_mstate_global->__pyx_n_u_os, __pyx_t_2) < 0) __PYX_ERR(0, 85, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

  /* "pysam/libcbcf.pyx":86
 * 
 * import os
 * import sys             # <<<<<<<<<<<<<<
 * 
 * from libc.errno  cimport errno, EPIPE
*/
  __pyx_t_2 = __Pyx_ImportDottedModule(__pyx_mstate_global->__pyx_n_u_sys, NULL); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 86, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  if (PyDict_SetItem(__pyx_mstate_global->__pyx_d, __pyx_mstate_global->__pyx_n_u_sys, __pyx_t_2) < 0) __PYX_ERR(0, 86, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

  /* "pysam/libcbcf.pyx":103
 * from pysam.libchtslib cimport HTSFile, hisremote
 * 
 * from pysam.utils import unquoted_str             # <<<<<<<<<<<<<<
 * 
 * 
*/
  __pyx_t_2 = __Pyx_PyList_Pack(1, __pyx_mstate_global->__pyx_n_u_unquoted_str); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 103, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_3 = __Pyx_Import(__pyx_mstate_global->__pyx_n_u_pysam_utils, __pyx_t_2, 0); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 103, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __pyx_t_2 = __Pyx_ImportFrom(__pyx_t_3, __pyx_mstate_global->__pyx_n_u_unquoted_str); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 103, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  if (PyDict_SetItem(__pyx_mstate_global->__pyx_d, __pyx_mstate_global->__pyx_n_u_unquoted_str, __pyx_t_2) < 0) __PYX_ERR(0, 103, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;

  /* "pysam/libcbcf.pyx":106
 * 
 * 
 * __all__ = ['VariantFile',             # <<<<<<<<<<<<<<
 *            'VariantHeader',
 *            'VariantHeaderRecord',
*/
  __pyx_t_3 = __Pyx_PyList_Pack(22, __pyx_mstate_global->__pyx_n_u_VariantFile, __pyx_mstate_global->__pyx_n_u_VariantHeader, __pyx_mstate_global->__pyx_n_u_VariantHeaderRecord, __pyx_mstate_global->__pyx_n_u_VariantHeaderRecords, __pyx_mstate_global->__pyx_n_u_VariantMetadata, __pyx_mstate_global->__pyx_n_u_VariantHeaderMetadata, __pyx_mstate_global->__pyx_n_u_VariantContig, __pyx_mstate_global->__pyx_n_u_VariantHeaderContigs, __pyx_mstate_global->__pyx_n_u_VariantHeaderSamples, __pyx_mstate_global->__pyx_n_u_VariantRecordFilter, __pyx_mstate_global->__pyx_n_u_VariantRecordFormat, __pyx_mstate_global->__pyx_n_u_VariantRecordInfo, __pyx_mstate_global->__pyx_n_u_VariantRecordSamples, __pyx_mstate_global->__pyx_n_u_VariantRecord, __pyx_mstate_global->__pyx_n_u_VariantRecordSample, __pyx_mstate_global->__pyx_n_u_BaseIndex, __pyx_mstate_global->__pyx_n_u_BCFIndex, __pyx_mstate_global->__pyx_n_u_TabixIndex, __pyx_mstate_global->__pyx_n_u_BaseIterator, __pyx_mstate_global->__pyx_n_u_BCFIterator, __pyx_mstate_global->__pyx_n_u_TabixIterator, __pyx_mstate_global->__pyx_n_u_VariantRecord); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 106, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  if (PyDict_SetItem(__pyx_mstate_global->__pyx_d, __pyx_mstate_global->__pyx_n_u_all, __pyx_t_3) < 0) __PYX_ERR(0, 106, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;

  /* "pysam/libcbcf.pyx":134
 * ########################################################################
 * 
 * cdef int MAX_POS = (1 << 31) - 1             # <<<<<<<<<<<<<<
 * cdef tuple VALUE_TYPES = ('Flag', 'Integer', 'Float', 'String')
 * cdef tuple METADATA_TYPES = ('FILTER', 'INFO', 'FORMAT', 'CONTIG', 'STRUCTURED', 'GENERIC')
*/
  __pyx_v_5pysam_7libcbcf_MAX_POS = 0x7fffffff;

  /* "pysam/libcbcf.pyx":135
 * 
 * cdef int MAX_POS = (1 << 31) - 1
 * cdef tuple VALUE_TYPES = ('Flag', 'Integer', 'Float', 'String')             # <<<<<<<<<<<<<<
 * cdef tuple METADATA_TYPES = ('FILTER', 'INFO', 'FORMAT', 'CONTIG', 'STRUCTURED', 'GENERIC')
 * cdef tuple METADATA_LENGTHS = ('FIXED', 'VARIABLE', 'A', 'G', 'R')
*/
  __Pyx_INCREF(__pyx_mstate_global->__pyx_tuple[8]);
  __Pyx_XGOTREF(__pyx_v_5pysam_7libcbcf_VALUE_TYPES);
  __Pyx_DECREF_SET(__pyx_v_5pysam_7libcbcf_VALUE_TYPES, __pyx_mstate_global->__pyx_tuple[8]);
  __Pyx_GIVEREF(__pyx_mstate_global->__pyx_tuple[8]);

  /* "pysam/libcbcf.pyx":136
 * cdef int MAX_POS = (1 << 31) - 1
 * cdef tuple VALUE_TYPES = ('Flag', 'Integer', 'Float', 'String')
 * cdef tuple METADATA_TYPES = ('FILTER', 'INFO', 'FORMAT', 'CONTIG', 'STRUCTURED', 'GENERIC')             # <<<<<<<<<<<<<<
 * cdef tuple METADATA_LENGTHS = ('FIXED', 'VARIABLE', 'A', 'G', 'R')
 * 
*/
  __Pyx_INCREF(__pyx_mstate_global->__pyx_tuple[9]);
  __Pyx_XGOTREF(__pyx_v_5pysam_7libcbcf_METADATA_TYPES);
  __Pyx_DECREF_SET(__pyx_v_5pysam_7libcbcf_METADATA_TYPES, __pyx_mstate_global->__pyx_tuple[9]);
  __Pyx_GIVEREF(__pyx_mstate_global->__pyx_tuple[9]);

  /* "pysam/libcbcf.pyx":137
 * cdef tuple VALUE_TYPES = ('Flag', 'Integer', 'Float', 'String')
 * cdef tuple METADATA_TYPES = ('FILTER', 'INFO', 'FORMAT', 'CONTIG', 'STRUCTURED', 'GENERIC')
 * cdef tuple METADATA_LENGTHS = ('FIXED', 'VARIABLE', 'A', 'G', 'R')             # <<<<<<<<<<<<<<
 * 
 * 
*/
  __Pyx_INCREF(__pyx_mstate_global->__pyx_tuple[10]);
  __Pyx_XGOTREF(__pyx_v_5pysam_7libcbcf_METADATA_LENGTHS);
  __Pyx_DECREF_SET(__pyx_v_5pysam_7libcbcf_METADATA_LENGTHS, __pyx_mstate_global->__pyx_tuple[10]);
  __Pyx_GIVEREF(__pyx_mstate_global->__pyx_tuple[10]);

  /* "pysam/libcbcf.pyx":154
 * ########################################################################
 * 
 * cdef object _nothing = object()             # <<<<<<<<<<<<<<
 * 
 * ########################################################################
*/
  __pyx_t_2 = NULL;
  __Pyx_INCREF(__pyx_builtin_object);
  __pyx_t_4 = __pyx_builtin_object; 
  __pyx_t_5 = 1;
  {
    PyObject *__pyx_callargs[2] = {__pyx_t_2, NULL};
    __pyx_t_3 = __Pyx_PyObject_FastCall(__pyx_t_4, __pyx_callargs+__pyx_t_5, (1-__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;
    if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 154, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
  }
  __Pyx_XGOTREF(__pyx_v_5pysam_7libcbcf__nothing);
  __Pyx_DECREF_SET(__pyx_v_5pysam_7libcbcf__nothing, __pyx_t_3);
  __Pyx_GIVEREF(__pyx_t_3);
  __pyx_t_3 = 0;

  /* "pysam/libcbcf.pyx":161
 * ########################################################################
 * 
 * cdef dict bcf_str_cache = {}             # <<<<<<<<<<<<<<
 * 
 * cdef inline bcf_str_cache_get_charptr(const char* s):
*/
  __pyx_t_3 = __Pyx_PyDict_NewPresized(0); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 161, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_XGOTREF(__pyx_v_5pysam_7libcbcf_bcf_str_cache);
  __Pyx_DECREF_SET(__pyx_v_5pysam_7libcbcf_bcf_str_cache, ((PyObject*)__pyx_t_3));
  __Pyx_GIVEREF(__pyx_t_3);
  __pyx_t_3 = 0;

  /* "pysam/libcbcf.pyx":1313
 *                 yield bcf_str_cache_get_charptr(r.keys[i])
 * 
 *     def get(self, key, default=None):             # <<<<<<<<<<<<<<
 *         """D.get(k[,d]) -> D[k] if k in D, else d.  d defaults to None."""
 *         try:
*/
  __pyx_t_3 = __Pyx_CyFunction_New(&__pyx_mdef_5pysam_7libcbcf_19VariantHeaderRecord_12get, __Pyx_CYFUNCTION_CCLASS, __pyx_mstate_global->__pyx_n_u_VariantHeaderRecord_get, NULL, __pyx_mstate_global->__pyx_n_u_pysam_libcbcf, __pyx_mstate_global->__pyx_d, ((PyObject *)__pyx_mstate_global->__pyx_codeobj_tab[41])); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1313, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_CyFunction_SetDefaultsTuple(__pyx_t_3, __pyx_mstate_global->__pyx_tuple[0]);
  if (__Pyx_SetItemOnTypeDict(__pyx_mstate_global->__pyx_ptype_5pysam_7libcbcf_VariantHeaderRecord, __pyx_mstate_global->__pyx_n_u_get, __pyx_t_3) < 0) __PYX_ERR(0, 1313, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;

  /* "pysam/libcbcf.pyx":1328
 *             return True
 * 
 *     def iterkeys(self):             # <<<<<<<<<<<<<<
 *         """D.iterkeys() -> an iterator over the keys of D"""
 *         return iter(self)
*/
  __pyx_t_3 = __Pyx_CyFunction_New(&__pyx_mdef_5pysam_7libcbcf_19VariantHeaderRecord_16iterkeys, __Pyx_CYFUNCTION_CCLASS, __pyx_mstate_global->__pyx_n_u_VariantHeaderRecord_iterkeys, NULL, __pyx_mstate_global->__pyx_n_u_pysam_libcbcf, __pyx_mstate_global->__pyx_d, ((PyObject *)__pyx_mstate_global->__pyx_codeobj_tab[43])); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1328, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  if (__Pyx_SetItemOnTypeDict(__pyx_mstate_global->__pyx_ptype_5pysam_7libcbcf_VariantHeaderRecord, __pyx_mstate_global->__pyx_n_u_iterkeys, __pyx_t_3) < 0) __PYX_ERR(0, 1328, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;

  /* "pysam/libcbcf.pyx":1332
 *         return iter(self)
 * 
 *     def itervalues(self):             # <<<<<<<<<<<<<<
 *         """D.itervalues() -> an iterator over the values of D"""
 *         cdef bcf_hrec_t *r = self.ptr
*/
  __pyx_t_3 = __Pyx_CyFunction_New(&__pyx_mdef_5pysam_7libcbcf_19VariantHeaderRecord_18itervalues, __Pyx_CYFUNCTION_CCLASS, __pyx_mstate_global->__pyx_n_u_VariantHeaderRecord_itervalues, NULL, __pyx_mstate_global->__pyx_n_u_pysam_libcbcf, __pyx_mstate_global->__pyx_d, ((PyObject *)__pyx_mstate_global->__pyx_codeobj_tab[44])); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1332, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  if (__Pyx_SetItemOnTypeDict(__pyx_mstate_global->__pyx_ptype_5pysam_7libcbcf_VariantHeaderRecord, __pyx_mstate_global->__pyx_n_u_itervalues, __pyx_t_3) < 0) __PYX_ERR(0, 1332, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;

  /* "pysam/libcbcf.pyx":1342
 *                 yield charptr_to_str(r.vals[i]) if r.vals[i] else None
 * 
 *     def iteritems(self):             # <<<<<<<<<<<<<<
 *         """D.iteritems() -> an iterator over the (key, value) items of D"""
 *         cdef bcf_hrec_t *r = self.ptr
*/
  __pyx_t_3 = __Pyx_CyFunction_New(&__pyx_mdef_5pysam_7libcbcf_19VariantHeaderRecord_21iteritems, __Pyx_CYFUNCTION_CCLASS, __pyx_mstate_global->__pyx_n_u_VariantHeaderRecord_iteritems, NULL, __pyx_mstate_global->__pyx_n_u_pysam_libcbcf, __pyx_mstate_global->__pyx_d, ((PyObject *)__pyx_mstate_global->__pyx_codeobj_tab[45])); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1342, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  if (__Pyx_SetItemOnTypeDict(__pyx_mstate_global->__pyx_ptype_5pysam_7libcbcf_VariantHeaderRecord, __pyx_mstate_global->__pyx_n_u_iteritems, __pyx_t_3) < 0) __PYX_ERR(0, 1342, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;

  /* "pysam/libcbcf.pyx":1352
 *                 yield (bcf_str_cache_get_charptr(r.keys[i]), charptr_to_str(r.vals[i]) if r.vals[i] else None)
 * 
 *     def keys(self):             # <<<<<<<<<<<<<<
 *         """D.keys() -> list of D's keys"""
 *         return list(self)
*/
  __pyx_t_3 = __Pyx_CyFunction_New(&__pyx_mdef_5pysam_7libcbcf_19VariantHeaderRecord_24keys, __Pyx_CYFUNCTION_CCLASS, __pyx_mstate_global->__pyx_n_u_VariantHeaderRecord_keys, NULL, __pyx_mstate_global->__pyx_n_u_pysam_libcbcf, __pyx_mstate_global->__pyx_d, ((PyObject *)__pyx_mstate_global->__pyx_codeobj_tab[46])); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1352, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  if (__Pyx_SetItemOnTypeDict(__pyx_mstate_global->__pyx_ptype_5pysam_7libcbcf_VariantHeaderRecord, __pyx_mstate_global->__pyx_n_u_keys, __pyx_t_3) < 0) __PYX_ERR(0, 1352, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;

  /* "pysam/libcbcf.pyx":1356
 *         return list(self)
 * 
 *     def items(self):             # <<<<<<<<<<<<<<
 *         """D.items() -> list of D's (key, value) pairs, as 2-tuples"""
 *         return list(self.iteritems())
*/
  __pyx_t_3 = __Pyx_CyFunction_New(&__pyx_mdef_5pysam_7libcbcf_19VariantHeaderRecord_26items, __Pyx_CYFUNCTION_CCLASS, __pyx_mstate_global->__pyx_n_u_VariantHeaderRecord_items, NULL, __pyx_mstate_global->__pyx_n_u_pysam_libcbcf, __pyx_mstate_global->__pyx_d, ((PyObject *)__pyx_mstate_global->__pyx_codeobj_tab[47])); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1356, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  if (__Pyx_SetItemOnTypeDict(__pyx_mstate_global->__pyx_ptype_5pysam_7libcbcf_VariantHeaderRecord, __pyx_mstate_global->__pyx_n_u_items, __pyx_t_3) < 0) __PYX_ERR(0, 1356, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;

  /* "pysam/libcbcf.pyx":1360
 *         return list(self.iteritems())
 * 
 *     def values(self):             # <<<<<<<<<<<<<<
 *         """D.values() -> list of D's values"""
 *         return list(self.itervalues())
*/
  __pyx_t_3 = __Pyx_CyFunction_New(&__pyx_mdef_5pysam_7libcbcf_19VariantHeaderRecord_28values, __Pyx_CYFUNCTION_CCLASS, __pyx_mstate_global->__pyx_n_u_VariantHeaderRecord_values, NULL, __pyx_mstate_global->__pyx_n_u_pysam_libcbcf, __pyx_mstate_global->__pyx_d, ((PyObject *)__pyx_mstate_global->__pyx_codeobj_tab[48])); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1360, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  if (__Pyx_SetItemOnTypeDict(__pyx_mstate_global->__pyx_ptype_5pysam_7libcbcf_VariantHeaderRecord, __pyx_mstate_global->__pyx_n_u_values, __pyx_t_3) < 0) __PYX_ERR(0, 1360, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;

  /* "pysam/libcbcf.pyx":1364
 *         return list(self.itervalues())
 * 
 *     def update(self, items=None, **kwargs):             # <<<<<<<<<<<<<<
 *         """D.update([E, ]**F) -> None.
 * 
*/
  __pyx_t_3 = __Pyx_CyFunction_New(&__pyx_mdef_5pysam_7libcbcf_19VariantHeaderRecord_30update, __Pyx_CYFUNCTION_CCLASS, __pyx_mstate_global->__pyx_n_u_VariantHeaderRecord_update, NULL, __pyx_mstate_global->__pyx_n_u_pysam_libcbcf, __pyx_mstate_global->__pyx_d, ((PyObject *)__pyx_mstate_global->__pyx_codeobj_tab[49])); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1364, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_CyFunction_SetDefaultsTuple(__pyx_t_3, __pyx_mstate_global->__pyx_tuple[0]);
  if (__Pyx_SetItemOnTypeDict(__pyx_mstate_global->__pyx_ptype_5pysam_7libcbcf_VariantHeaderRecord, __pyx_mstate_global->__pyx_n_u_update, __pyx_t_3) < 0) __PYX_ERR(0, 1364, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;

  /* "pysam/libcbcf.pyx":1376
 *                 self[k] = v
 * 
 *     def pop(self, key, default=_nothing):             # <<<<<<<<<<<<<<
 *         try:
 *             value = self[key]
*/
  __Pyx_INCREF(__pyx_v_5pysam_7libcbcf__nothing);
  __pyx_mstate_global->__pyx_k__3 = __pyx_v_5pysam_7libcbcf__nothing;
  __Pyx_GIVEREF(__pyx_v_5pysam_7libcbcf__nothing);
  __pyx_t_3 = PyTuple_Pack(1, __pyx_v_5pysam_7libcbcf__nothing); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1376, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __pyx_t_4 = __Pyx_CyFunction_New(&__pyx_mdef_5pysam_7libcbcf_19VariantHeaderRecord_32pop, __Pyx_CYFUNCTION_CCLASS, __pyx_mstate_global->__pyx_n_u_VariantHeaderRecord_pop, NULL, __pyx_mstate_global->__pyx_n_u_pysam_libcbcf, __pyx_mstate_global->__pyx_d, ((PyObject *)__pyx_mstate_global->__pyx_codeobj_tab[50])); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1376, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  __Pyx_CyFunction_SetDefaultsTuple(__pyx_t_4, __pyx_t_3);
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  if (__Pyx_SetItemOnTypeDict(__pyx_mstate_global->__pyx_ptype_5pysam_7libcbcf_VariantHeaderRecord, __pyx_mstate_global->__pyx_n_u_pop, __pyx_t_4) < 0) __PYX_ERR(0, 1376, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;

  /* "pysam/libcbcf.pyx":1387
 * 
 *     # Mappings are not hashable by default, but subclasses can change this
 *     __hash__ = None             # <<<<<<<<<<<<<<
 * 
 *     #TODO: implement __richcmp__
*/
  if (__Pyx_SetItemOnTypeDict(__pyx_mstate_global->__pyx_ptype_5pysam_7libcbcf_VariantHeaderRecord, __pyx_mstate_global->__pyx_n_u_hash, Py_None) < 0) __PYX_ERR(0, 1387, __pyx_L1_error)

  /* "pysam/libcbcf.pyx":1411
 * 
 *     # FIXME: Not safe -- causes trivial segfaults at the moment
 *     def remove(self):             # <<<<<<<<<<<<<<
 *         cdef bcf_hdr_t *hdr = self.header.ptr
 *         cdef bcf_hrec_t *r = self.ptr
*/
  __pyx_t_4 = __Pyx_CyFunction_New(&__pyx_mdef_5pysam_7libcbcf_19VariantHeaderRecord_36remove, __Pyx_CYFUNCTION_CCLASS, __pyx_mstate_global->__pyx_n_u_VariantHeaderRecord_remove, NULL, __pyx_mstate_global->__pyx_n_u_pysam_libcbcf, __pyx_mstate_global->__pyx_d, ((PyObject *)__pyx_mstate_global->__pyx_codeobj_tab[52])); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1411, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  if (__Pyx_SetItemOnTypeDict(__pyx_mstate_global->__pyx_ptype_5pysam_7libcbcf_VariantHeaderRecord, __pyx_mstate_global->__pyx_n_u_remove, __pyx_t_4) < 0) __PYX_ERR(0, 1411, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;

  /* "(tree fragment)":1
 * def __reduce_cython__(self):             # <<<<<<<<<<<<<<
 *     raise TypeError, "self.ptr cannot be converted to a Python object for pickling"
 * def __setstate_cython__(self, __pyx_state):
*/
  __pyx_t_4 = __Pyx_CyFunction_New(&__pyx_mdef_5pysam_7libcbcf_19VariantHeaderRecord_38__reduce_cython__, __Pyx_CYFUNCTION_CCLASS, __pyx_mstate_global->__pyx_n_u_VariantHeaderRecord___reduce_cyt, NULL, __pyx_mstate_global->__pyx_n_u_pysam_libcbcf, __pyx_mstate_global->__pyx_d, ((PyObject *)__pyx_mstate_global->__pyx_codeobj_tab[54])); if (unlikely(!__pyx_t_4)) __PYX_ERR(4, 1, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  if (PyDict_SetItem(__pyx_mstate_global->__pyx_d, __pyx_mstate_global->__pyx_n_u_reduce_cython, __pyx_t_4) < 0) __PYX_ERR(4, 1, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;

  /* "(tree fragment)":3
 * def __reduce_cython__(self):
 *     raise TypeError, "self.ptr cannot be converted to a Python object for pickling"
 * def __setstate_cython__(self, __pyx_state):             # <<<<<<<<<<<<<<
 *     raise TypeError, "self.ptr cannot be converted to a Python object for pickling"
*/
  __pyx_t_4 = __Pyx_CyFunction_New(&__pyx_mdef_5pysam_7libcbcf_19VariantHeaderRecord_40__setstate_cython__, __Pyx_CYFUNCTION_CCLASS, __pyx_mstate_global->__pyx_n_u_VariantHeaderRecord___setstate_c, NULL, __pyx_mstate_global->__pyx_n_u_pysam_libcbcf, __pyx_mstate_global->__pyx_d, ((PyObject *)__pyx_mstate_global->__pyx_codeobj_tab[55])); if (unlikely(!__pyx_t_4)) __PYX_ERR(4, 3, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  if (PyDict_SetItem(__pyx_mstate_global->__pyx_d, __pyx_mstate_global->__pyx_n_u_setstate_cython, __pyx_t_4) < 0) __PYX_ERR(4, 3, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;

  /* "pysam/libcbcf.pyx":1458
 *             yield makeVariantHeaderRecord(self.header, self.header.ptr.hrec[i])
 * 
 *     __hash__ = None             # <<<<<<<<<<<<<<
 * 
 * 
*/
  if (__Pyx_SetItemOnTypeDict(__pyx_mstate_global->__pyx_ptype_5pysam_7libcbcf_VariantHeaderRecords, __pyx_mstate_global->__pyx_n_u_hash, Py_None) < 0) __PYX_ERR(0, 1458, __pyx_L1_error)

  /* "(tree fragment)":1
 * def __reduce_cython__(self):             # <<<<<<<<<<<<<<
 *     cdef tuple state
 *     cdef object _dict
*/
  __pyx_t_4 = __Pyx_CyFunction_New(&__pyx_mdef_5pysam_7libcbcf_20VariantHeaderRecords_12__reduce_cython__, __Pyx_CYFUNCTION_CCLASS, __pyx_mstate_global->__pyx_n_u_VariantHeaderRecords___reduce_cy, NULL, __pyx_mstate_global->__pyx_n_u_pysam_libcbcf, __pyx_mstate_global->__pyx_d, ((PyObject *)__pyx_mstate_global->__pyx_codeobj_tab[63])); if (unlikely(!__pyx_t_4)) __PYX_ERR(4, 1, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  if (__Pyx_SetItemOnTypeDict(__pyx_mstate_global->__pyx_ptype_5pysam_7libcbcf_VariantHeaderRecords, __pyx_mstate_global->__pyx_n_u_reduce_cython, __pyx_t_4) < 0) __PYX_ERR(4, 1, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;

  /* "(tree fragment)":16
 *     else:
 *         return __pyx_unpickle_VariantHeaderRecords, (type(self), 0x1e0584a, state)
 * def __setstate_cython__(self, __pyx_state):             # <<<<<<<<<<<<<<
 *     __pyx_unpickle_VariantHeaderRecords__set_state(self, __pyx_state)
*/
  __pyx_t_4 = __Pyx_CyFunction_New(&__pyx_mdef_5pysam_7libcbcf_20VariantHeaderRecords_14__setstate_cython__, __Pyx_CYFUNCTION_CCLASS, __pyx_mstate_global->__pyx_n_u_VariantHeaderRecords___setstate, NULL, __pyx_mstate_global->__pyx_n_u_pysam_libcbcf, __pyx_mstate_global->__pyx_d, ((PyObject *)__pyx_mstate_global->__pyx_codeobj_tab[64])); if (unlikely(!__pyx_t_4)) __PYX_ERR(4, 16, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  if (__Pyx_SetItemOnTypeDict(__pyx_mstate_global->__pyx_ptype_5pysam_7libcbcf_VariantHeaderRecords, __pyx_mstate_global->__pyx_n_u_setstate_cython, __pyx_t_4) < 0) __PYX_ERR(4, 16, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;

  /* "pysam/libcbcf.pyx":1536
 *         return makeVariantHeaderRecord(self.header, hrec)
 * 
 *     def remove_header(self):             # <<<<<<<<<<<<<<
 *         cdef bcf_hdr_t *hdr = self.header.ptr
 *         cdef const char *key = hdr.id[BCF_DT_ID][self.id].key
*/
  __pyx_t_4 = __Pyx_CyFunction_New(&__pyx_mdef_5pysam_7libcbcf_15VariantMetadata_3remove_header, __Pyx_CYFUNCTION_CCLASS, __pyx_mstate_global->__pyx_n_u_VariantMetadata_remove_header, NULL, __pyx_mstate_global->__pyx_n_u_pysam_libcbcf, __pyx_mstate_global->__pyx_d, ((PyObject *)__pyx_mstate_global->__pyx_codeobj_tab[73])); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1536, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  if (__Pyx_SetItemOnTypeDict(__pyx_mstate_global->__pyx_ptype_5pysam_7libcbcf_VariantMetadata, __pyx_mstate_global->__pyx_n_u_remove_header, __pyx_t_4) < 0) __PYX_ERR(0, 1536, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;

  /* "(tree fragment)":1
 * def __reduce_cython__(self):             # <<<<<<<<<<<<<<
 *     cdef tuple state
 *     cdef object _dict
*/
  __pyx_t_4 = __Pyx_CyFunction_New(&__pyx_mdef_5pysam_7libcbcf_15VariantMetadata_5__reduce_cython__, __Pyx_CYFUNCTION_CCLASS, __pyx_mstate_global->__pyx_n_u_VariantMetadata___reduce_cython, NULL, __pyx_mstate_global->__pyx_n_u_pysam_libcbcf, __pyx_mstate_global->__pyx_d, ((PyObject *)__pyx_mstate_global->__pyx_codeobj_tab[75])); if (unlikely(!__pyx_t_4)) __PYX_ERR(4, 1, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  if (__Pyx_SetItemOnTypeDict(__pyx_mstate_global->__pyx_ptype_5pysam_7libcbcf_VariantMetadata, __pyx_mstate_global->__pyx_n_u_reduce_cython, __pyx_t_4) < 0) __PYX_ERR(4, 1, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;

  /* "(tree fragment)":16
 *     else:
 *         return __pyx_unpickle_VariantMetadata, (type(self), 0xcd1335f, state)
 * def __setstate_cython__(self, __pyx_state):             # <<<<<<<<<<<<<<
 *     __pyx_unpickle_VariantMetadata__set_state(self, __pyx_state)
*/
  __pyx_t_4 = __Pyx_CyFunction_New(&__pyx_mdef_5pysam_7libcbcf_15VariantMetadata_7__setstate_cython__, __Pyx_CYFUNCTION_CCLASS, __pyx_mstate_global->__pyx_n_u_VariantMetadata___setstate_cytho, NULL, __pyx_mstate_global->__pyx_n_u_pysam_libcbcf, __pyx_mstate_global->__pyx_d, ((PyObject *)__pyx_mstate_global->__pyx_codeobj_tab[76])); if (unlikely(!__pyx_t_4)) __PYX_ERR(4, 16, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  if (__Pyx_SetItemOnTypeDict(__pyx_mstate_global->__pyx_ptype_5pysam_7libcbcf_VariantMetadata, __pyx_mstate_global->__pyx_n_u_setstate_cython, __pyx_t_4) < 0) __PYX_ERR(4, 16, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;

  /* "pysam/libcbcf.pyx":1565
 *         raise TypeError('this class cannot be instantiated from Python')
 * 
 *     def add(self, id, number, type, description, **kwargs):             # <<<<<<<<<<<<<<
 *         """Add a new filter, info or format record"""
 *         if id in self:
*/
  __pyx_t_4 = __Pyx_CyFunction_New(&__pyx_mdef_5pysam_7libcbcf_21VariantHeaderMetadata_3add, __Pyx_CYFUNCTION_CCLASS, __pyx_mstate_global->__pyx_n_u_VariantHeaderMetadata_add, NULL, __pyx_mstate_global->__pyx_n_u_pysam_libcbcf, __pyx_mstate_global->__pyx_d, ((PyObject *)__pyx_mstate_global->__pyx_codeobj_tab[79])); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1565, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  if (__Pyx_SetItemOnTypeDict(__pyx_mstate_global->__pyx_ptype_5pysam_7libcbcf_VariantHeaderMetadata, __pyx_mstate_global->__pyx_n_u_add, __pyx_t_4) < 0) __PYX_ERR(0, 1565, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;

  /* "pysam/libcbcf.pyx":1625
 *         return makeVariantMetadata(self.header, self.type, kh_val_vdict(d, k).id)
 * 
 *     def remove_header(self, key):             # <<<<<<<<<<<<<<
 *         cdef bcf_hdr_t *hdr = self.header.ptr
 *         cdef vdict_t *d = <vdict_t *>hdr.dict[BCF_DT_ID]
*/
  __pyx_t_4 = __Pyx_CyFunction_New(&__pyx_mdef_5pysam_7libcbcf_21VariantHeaderMetadata_11remove_header, __Pyx_CYFUNCTION_CCLASS, __pyx_mstate_global->__pyx_n_u_VariantHeaderMetadata_remove_hea, NULL, __pyx_mstate_global->__pyx_n_u_pysam_libcbcf, __pyx_mstate_global->__pyx_d, ((PyObject *)__pyx_mstate_global->__pyx_codeobj_tab[83])); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1625, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  if (__Pyx_SetItemOnTypeDict(__pyx_mstate_global->__pyx_ptype_5pysam_7libcbcf_VariantHeaderMetadata, __pyx_mstate_global->__pyx_n_u_remove_header, __pyx_t_4) < 0) __PYX_ERR(0, 1625, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;

  /* "pysam/libcbcf.pyx":1638
 *         #bcf_hdr_sync(hdr)
 * 
 *     def clear_header(self):             # <<<<<<<<<<<<<<
 *         cdef bcf_hdr_t *hdr = self.header.ptr
 *         bcf_hdr_remove(hdr, self.type, NULL)
*/
  __pyx_t_4 = __Pyx_CyFunction_New(&__pyx_mdef_5pysam_7libcbcf_21VariantHeaderMetadata_13clear_header, __Pyx_CYFUNCTION_CCLASS, __pyx_mstate_global->__pyx_n_u_VariantHeaderMetadata_clear_head, NULL, __pyx_mstate_global->__pyx_n_u_pysam_libcbcf, __pyx_mstate_global->__pyx_d, ((PyObject *)__pyx_mstate_global->__pyx_codeobj_tab[84])); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1638, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  if (__Pyx_SetItemOnTypeDict(__pyx_mstate_global->__pyx_ptype_5pysam_7libcbcf_VariantHeaderMetadata, __pyx_mstate_global->__pyx_n_u_clear_header, __pyx_t_4) < 0) __PYX_ERR(0, 1638, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;

  /* "pysam/libcbcf.pyx":1653
 *                 yield bcf_str_cache_get_charptr(idpair.key)
 * 
 *     def get(self, key, default=None):             # <<<<<<<<<<<<<<
 *         """D.get(k[,d]) -> D[k] if k in D, else d.  d defaults to None."""
 *         try:
*/
  __pyx_t_4 = __Pyx_CyFunction_New(&__pyx_mdef_5pysam_7libcbcf_21VariantHeaderMetadata_18get, __Pyx_CYFUNCTION_CCLASS, __pyx_mstate_global->__pyx_n_u_VariantHeaderMetadata_get, NULL, __pyx_mstate_global->__pyx_n_u_pysam_libcbcf, __pyx_mstate_global->__pyx_d, ((PyObject *)__pyx_mstate_global->__pyx_codeobj_tab[86])); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1653, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  __Pyx_CyFunction_SetDefaultsTuple(__pyx_t_4, __pyx_mstate_global->__pyx_tuple[0]);
  if (__Pyx_SetItemOnTypeDict(__pyx_mstate_global->__pyx_ptype_5pysam_7libcbcf_VariantHeaderMetadata, __pyx_mstate_global->__pyx_n_u_get, __pyx_t_4) < 0) __PYX_ERR(0, 1653, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;

  /* "pysam/libcbcf.pyx":1668
 *             return True
 * 
 *     def iterkeys(self):             # <<<<<<<<<<<<<<
 *         """D.iterkeys() -> an iterator over the keys of D"""
 *         return iter(self)
*/
  __pyx_t_4 = __Pyx_CyFunction_New(&__pyx_mdef_5pysam_7libcbcf_21VariantHeaderMetadata_22iterkeys, __Pyx_CYFUNCTION_CCLASS, __pyx_mstate_global->__pyx_n_u_VariantHeaderMetadata_iterkeys, NULL, __pyx_mstate_global->__pyx_n_u_pysam_libcbcf, __pyx_mstate_global->__pyx_d, ((PyObject *)__pyx_mstate_global->__pyx_codeobj_tab[88])); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1668, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  if (__Pyx_SetItemOnTypeDict(__pyx_mstate_global->__pyx_ptype_5pysam_7libcbcf_VariantHeaderMetadata, __pyx_mstate_global->__pyx_n_u_iterkeys, __pyx_t_4) < 0) __PYX_ERR(0, 1668, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;

  /* "pysam/libcbcf.pyx":1672
 *         return iter(self)
 * 
 *     def itervalues(self):             # <<<<<<<<<<<<<<
 *         """D.itervalues() -> an iterator over the values of D"""
 *         for key in self:
*/
  __pyx_t_4 = __Pyx_CyFunction_New(&__pyx_mdef_5pysam_7libcbcf_21VariantHeaderMetadata_24itervalues, __Pyx_CYFUNCTION_CCLASS, __pyx_mstate_global->__pyx_n_u_VariantHeaderMetadata_itervalues, NULL, __pyx_mstate_global->__pyx_n_u_pysam_libcbcf, __pyx_mstate_global->__pyx_d, ((PyObject *)__pyx_mstate_global->__pyx_codeobj_tab[89])); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1672, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  if (__Pyx_SetItemOnTypeDict(__pyx_mstate_global->__pyx_ptype_5pysam_7libcbcf_VariantHeaderMetadata, __pyx_mstate_global->__pyx_n_u_itervalues, __pyx_t_4) < 0) __PYX_ERR(0, 1672, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;

  /* "pysam/libcbcf.pyx":1677
 *             yield self[key]
 * 
 *     def iteritems(self):             # <<<<<<<<<<<<<<
 *         """D.iteritems() -> an iterator over the (key, value) items of D"""
 *         for key in self:
*/
  __pyx_t_4 = __Pyx_CyFunction_New(&__pyx_mdef_5pysam_7libcbcf_21VariantHeaderMetadata_27iteritems, __Pyx_CYFUNCTION_CCLASS, __pyx_mstate_global->__pyx_n_u_VariantHeaderMetadata_iteritems, NULL, __pyx_mstate_global->__pyx_n_u_pysam_libcbcf, __pyx_mstate_global->__pyx_d, ((PyObject *)__pyx_mstate_global->__pyx_codeobj_tab[90])); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1677, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  if (__Pyx_SetItemOnTypeDict(__pyx_mstate_global->__pyx_ptype_5pysam_7libcbcf_VariantHeaderMetadata, __pyx_mstate_global->__pyx_n_u_iteritems, __pyx_t_4) < 0) __PYX_ERR(0, 1677, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;

  /* "pysam/libcbcf.pyx":1682
 *             yield (key, self[key])
 * 
 *     def keys(self):             # <<<<<<<<<<<<<<
 *         """D.keys() -> list of D's keys"""
 *         return list(self)
*/
  __pyx_t_4 = __Pyx_CyFunction_New(&__pyx_mdef_5pysam_7libcbcf_21VariantHeaderMetadata_30keys, __Pyx_CYFUNCTION_CCLASS, __pyx_mstate_global->__pyx_n_u_VariantHeaderMetadata_keys, NULL, __pyx_mstate_global->__pyx_n_u_pysam_libcbcf, __pyx_mstate_global->__pyx_d, ((PyObject *)__pyx_mstate_global->__pyx_codeobj_tab[91])); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1682, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  if (__Pyx_SetItemOnTypeDict(__pyx_mstate_global->__pyx_ptype_5pysam_7libcbcf_VariantHeaderMetadata, __pyx_mstate_global->__pyx_n_u_keys, __pyx_t_4) < 0) __PYX_ERR(0, 1682, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;

  /* "pysam/libcbcf.pyx":1686
 *         return list(self)
 * 
 *     def items(self):             # <<<<<<<<<<<<<<
 *         """D.items() -> list of D's (key, value) pairs, as 2-tuples"""
 *         return list(self.iteritems())
*/
  __pyx_t_4 = __Pyx_CyFunction_New(&__pyx_mdef_5pysam_7libcbcf_21VariantHeaderMetadata_32items, __Pyx_CYFUNCTION_CCLASS, __pyx_mstate_global->__pyx_n_u_VariantHeaderMetadata_items, NULL, __pyx_mstate_global->__pyx_n_u_pysam_libcbcf, __pyx_mstate_global->__pyx_d, ((PyObject *)__pyx_mstate_global->__pyx_codeobj_tab[92])); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1686, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  if (__Pyx_SetItemOnTypeDict(__pyx_mstate_global->__pyx_ptype_5pysam_7libcbcf_VariantHeaderMetadata, __pyx_mstate_global->__pyx_n_u_items, __pyx_t_4) < 0) __PYX_ERR(0, 1686, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;

  /* "pysam/libcbcf.pyx":1690
 *         return list(self.iteritems())
 * 
 *     def values(self):             # <<<<<<<<<<<<<<
 *         """D.values() -> list of D's values"""
 *         return list(self.itervalues())
*/
  __pyx_t_4 = __Pyx_CyFunction_New(&__pyx_mdef_5pysam_7libcbcf_21VariantHeaderMetadata_34values, __Pyx_CYFUNCTION_CCLASS, __pyx_mstate_global->__pyx_n_u_VariantHeaderMetadata_values, NULL, __pyx_mstate_global->__pyx_n_u_pysam_libcbcf, __pyx_mstate_global->__pyx_d, ((PyObject *)__pyx_mstate_global->__pyx_codeobj_tab[93])); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1690, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  if (__Pyx_SetItemOnTypeDict(__pyx_mstate_global->__pyx_ptype_5pysam_7libcbcf_VariantHeaderMetadata, __pyx_mstate_global->__pyx_n_u_values, __pyx_t_4) < 0) __PYX_ERR(0, 1690, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;

  /* "pysam/libcbcf.pyx":1695
 * 
 *     # Mappings are not hashable by default, but subclasses can change this
 *     __hash__ = None             # <<<<<<<<<<<<<<
 * 
 *     #TODO: implement __richcmp__
*/
  if (__Pyx_SetItemOnTypeDict(__pyx_mstate_global->__pyx_ptype_5pysam_7libcbcf_VariantHeaderMetadata, __pyx_mstate_global->__pyx_n_u_hash, Py_None) < 0) __PYX_ERR(0, 1695, __pyx_L1_error)

  /* "(tree fragment)":1
 * def __reduce_cython__(self):             # <<<<<<<<<<<<<<
 *     cdef tuple state
 *     cdef object _dict
*/
  __pyx_t_4 = __Pyx_CyFunction_New(&__pyx_mdef_5pysam_7libcbcf_21VariantHeaderMetadata_36__reduce_cython__, __Pyx_CYFUNCTION_CCLASS, __pyx_mstate_global->__pyx_n_u_VariantHeaderMetadata___reduce_c, NULL, __pyx_mstate_global->__pyx_n_u_pysam_libcbcf, __pyx_mstate_global->__pyx_d, ((PyObject *)__pyx_mstate_global->__pyx_codeobj_tab[95])); if (unlikely(!__pyx_t_4)) __PYX_ERR(4, 1, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  if (__Pyx_SetItemOnTypeDict(__pyx_mstate_global->__pyx_ptype_5pysam_7libcbcf_VariantHeaderMetadata, __pyx_mstate_global->__pyx_n_u_reduce_cython, __pyx_t_4) < 0) __PYX_ERR(4, 1, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;

  /* "(tree fragment)":16
 *     else:
 *         return __pyx_unpickle_VariantHeaderMetadata, (type(self), 0x816ca43, state)
 * def __setstate_cython__(self, __pyx_state):             # <<<<<<<<<<<<<<
 *     __pyx_unpickle_VariantHeaderMetadata__set_state(self, __pyx_state)
*/
  __pyx_t_4 = __Pyx_CyFunction_New(&__pyx_mdef_5pysam_7libcbcf_21VariantHeaderMetadata_38__setstate_cython__, __Pyx_CYFUNCTION_CCLASS, __pyx_mstate_global->__pyx_n_u_VariantHeaderMetadata___setstate, NULL, __pyx_mstate_global->__pyx_n_u_pysam_libcbcf, __pyx_mstate_global->__pyx_d, ((PyObject *)__pyx_mstate_global->__pyx_codeobj_tab[96])); if (unlikely(!__pyx_t_4)) __PYX_ERR(4, 16, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  if (__Pyx_SetItemOnTypeDict(__pyx_mstate_global->__pyx_ptype_5pysam_7libcbcf_VariantHeaderMetadata, __pyx_mstate_global->__pyx_n_u_setstate_cython, __pyx_t_4) < 0) __PYX_ERR(4, 16, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;

  /* "pysam/libcbcf.pyx":1741
 *         return makeVariantHeaderRecord(self.header, hrec)
 * 
 *     def remove_header(self):             # <<<<<<<<<<<<<<
 *         cdef bcf_hdr_t *hdr = self.header.ptr
 *         cdef const char *key = hdr.id[BCF_DT_CTG][self.id].key
*/
  __pyx_t_4 = __Pyx_CyFunction_New(&__pyx_mdef_5pysam_7libcbcf_13VariantContig_3remove_header, __Pyx_CYFUNCTION_CCLASS, __pyx_mstate_global->__pyx_n_u_VariantContig_remove_header, NULL, __pyx_mstate_global->__pyx_n_u_pysam_libcbcf, __pyx_mstate_global->__pyx_d, ((PyObject *)__pyx_mstate_global->__pyx_codeobj_tab[103])); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1741, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  if (__Pyx_SetItemOnTypeDict(__pyx_mstate_global->__pyx_ptype_5pysam_7libcbcf_VariantContig, __pyx_mstate_global->__pyx_n_u_remove_header, __pyx_t_4) < 0) __PYX_ERR(0, 1741, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;

  /* "(tree fragment)":1
 * def __reduce_cython__(self):             # <<<<<<<<<<<<<<
 *     cdef tuple state
 *     cdef object _dict
*/
  __pyx_t_4 = __Pyx_CyFunction_New(&__pyx_mdef_5pysam_7libcbcf_13VariantContig_5__reduce_cython__, __Pyx_CYFUNCTION_CCLASS, __pyx_mstate_global->__pyx_n_u_VariantContig___reduce_cython, NULL, __pyx_mstate_global->__pyx_n_u_pysam_libcbcf, __pyx_mstate_global->__pyx_d, ((PyObject *)__pyx_mstate_global->__pyx_codeobj_tab[105])); if (unlikely(!__pyx_t_4)) __PYX_ERR(4, 1, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  if (__Pyx_SetItemOnTypeDict(__pyx_mstate_global->__pyx_ptype_5pysam_7libcbcf_VariantContig, __pyx_mstate_global->__pyx_n_u_reduce_cython, __pyx_t_4) < 0) __PYX_ERR(4, 1, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;

  /* "(tree fragment)":16
 *     else:
 *         return __pyx_unpickle_VariantContig, (type(self), 0x2572060, state)
 * def __setstate_cython__(self, __pyx_state):             # <<<<<<<<<<<<<<
 *     __pyx_unpickle_VariantContig__set_state(self, __pyx_state)
*/
  __pyx_t_4 = __Pyx_CyFunction_New(&__pyx_mdef_5pysam_7libcbcf_13VariantContig_7__setstate_cython__, __Pyx_CYFUNCTION_CCLASS, __pyx_mstate_global->__pyx_n_u_VariantContig___setstate_cython, NULL, __pyx_mstate_global->__pyx_n_u_pysam_libcbcf, __pyx_mstate_global->__pyx_d, ((PyObject *)__pyx_mstate_global->__pyx_codeobj_tab[106])); if (unlikely(!__pyx_t_4)) __PYX_ERR(4, 16, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  if (__Pyx_SetItemOnTypeDict(__pyx_mstate_global->__pyx_ptype_5pysam_7libcbcf_VariantContig, __pyx_mstate_global->__pyx_n_u_setstate_cython, __pyx_t_4) < 0) __PYX_ERR(4, 16, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;

  /* "pysam/libcbcf.pyx":1797
 *         return makeVariantContig(self.header, id)
 * 
 *     def remove_header(self, key):             # <<<<<<<<<<<<<<
 *         cdef bcf_hdr_t *hdr = self.header.ptr
 *         cdef int index
*/
  __pyx_t_4 = __Pyx_CyFunction_New(&__pyx_mdef_5pysam_7libcbcf_20VariantHeaderContigs_9remove_header, __Pyx_CYFUNCTION_CCLASS, __pyx_mstate_global->__pyx_n_u_VariantHeaderContigs_remove_head, NULL, __pyx_mstate_global->__pyx_n_u_pysam_libcbcf, __pyx_mstate_global->__pyx_d, ((PyObject *)__pyx_mstate_global->__pyx_codeobj_tab[112])); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1797, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  if (__Pyx_SetItemOnTypeDict(__pyx_mstate_global->__pyx_ptype_5pysam_7libcbcf_VariantHeaderContigs, __pyx_mstate_global->__pyx_n_u_remove_header, __pyx_t_4) < 0) __PYX_ERR(0, 1797, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;

  /* "pysam/libcbcf.pyx":1818
 *         bcf_hdr_remove(hdr, BCF_HL_CTG, ckey)
 * 
 *     def clear_header(self):             # <<<<<<<<<<<<<<
 *         cdef bcf_hdr_t *hdr = self.header.ptr
 *         bcf_hdr_remove(hdr, BCF_HL_CTG, NULL)
*/
  __pyx_t_4 = __Pyx_CyFunction_New(&__pyx_mdef_5pysam_7libcbcf_20VariantHeaderContigs_11clear_header, __Pyx_CYFUNCTION_CCLASS, __pyx_mstate_global->__pyx_n_u_VariantHeaderContigs_clear_heade, NULL, __pyx_mstate_global->__pyx_n_u_pysam_libcbcf, __pyx_mstate_global->__pyx_d, ((PyObject *)__pyx_mstate_global->__pyx_codeobj_tab[113])); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1818, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  if (__Pyx_SetItemOnTypeDict(__pyx_mstate_global->__pyx_ptype_5pysam_7libcbcf_VariantHeaderContigs, __pyx_mstate_global->__pyx_n_u_clear_header, __pyx_t_4) < 0) __PYX_ERR(0, 1818, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;

  /* "pysam/libcbcf.pyx":1833
 *             yield bcf_str_cache_get_charptr(bcf_hdr_id2name(hdr, i))
 * 
 *     def get(self, key, default=None):             # <<<<<<<<<<<<<<
 *         """D.get(k[,d]) -> D[k] if k in D, else d.  d defaults to None."""
 *         try:
*/
  __pyx_t_4 = __Pyx_CyFunction_New(&__pyx_mdef_5pysam_7libcbcf_20VariantHeaderContigs_16get, __Pyx_CYFUNCTION_CCLASS, __pyx_mstate_global->__pyx_n_u_VariantHeaderContigs_get, NULL, __pyx_mstate_global->__pyx_n_u_pysam_libcbcf, __pyx_mstate_global->__pyx_d, ((PyObject *)__pyx_mstate_global->__pyx_codeobj_tab[115])); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1833, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  __Pyx_CyFunction_SetDefaultsTuple(__pyx_t_4, __pyx_mstate_global->__pyx_tuple[0]);
  if (__Pyx_SetItemOnTypeDict(__pyx_mstate_global->__pyx_ptype_5pysam_7libcbcf_VariantHeaderContigs, __pyx_mstate_global->__pyx_n_u_get, __pyx_t_4) < 0) __PYX_ERR(0, 1833, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;

  /* "pysam/libcbcf.pyx":1848
 *             return True
 * 
 *     def iterkeys(self):             # <<<<<<<<<<<<<<
 *         """D.iterkeys() -> an iterator over the keys of D"""
 *         return iter(self)
*/
  __pyx_t_4 = __Pyx_CyFunction_New(&__pyx_mdef_5pysam_7libcbcf_20VariantHeaderContigs_20iterkeys, __Pyx_CYFUNCTION_CCLASS, __pyx_mstate_global->__pyx_n_u_VariantHeaderContigs_iterkeys, NULL, __pyx_mstate_global->__pyx_n_u_pysam_libcbcf, __pyx_mstate_global->__pyx_d, ((PyObject *)__pyx_mstate_global->__pyx_codeobj_tab[117])); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1848, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  if (__Pyx_SetItemOnTypeDict(__pyx_mstate_global->__pyx_ptype_5pysam_7libcbcf_VariantHeaderContigs, __pyx_mstate_global->__pyx_n_u_iterkeys, __pyx_t_4) < 0) __PYX_ERR(0, 1848, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;

  /* "pysam/libcbcf.pyx":1852
 *         return iter(self)
 * 
 *     def itervalues(self):             # <<<<<<<<<<<<<<
 *         """D.itervalues() -> an iterator over the values of D"""
 *         for key in self:
*/
  __pyx_t_4 = __Pyx_CyFunction_New(&__pyx_mdef_5pysam_7libcbcf_20VariantHeaderContigs_22itervalues, __Pyx_CYFUNCTION_CCLASS, __pyx_mstate_global->__pyx_n_u_VariantHeaderContigs_itervalues, NULL, __pyx_mstate_global->__pyx_n_u_pysam_libcbcf, __pyx_mstate_global->__pyx_d, ((PyObject *)__pyx_mstate_global->__pyx_codeobj_tab[118])); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1852, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  if (__Pyx_SetItemOnTypeDict(__pyx_mstate_global->__pyx_ptype_5pysam_7libcbcf_VariantHeaderContigs, __pyx_mstate_global->__pyx_n_u_itervalues, __pyx_t_4) < 0) __PYX_ERR(0, 1852, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;

  /* "pysam/libcbcf.pyx":1857
 *             yield self[key]
 * 
 *     def iteritems(self):             # <<<<<<<<<<<<<<
 *         """D.iteritems() -> an iterator over the (key, value) items of D"""
 *         for key in self:
*/
  __pyx_t_4 = __Pyx_CyFunction_New(&__pyx_mdef_5pysam_7libcbcf_20VariantHeaderContigs_25iteritems, __Pyx_CYFUNCTION_CCLASS, __pyx_mstate_global->__pyx_n_u_VariantHeaderContigs_iteritems, NULL, __pyx_mstate_global->__pyx_n_u_pysam_libcbcf, __pyx_mstate_global->__pyx_d, ((PyObject *)__pyx_mstate_global->__pyx_codeobj_tab[119])); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1857, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  if (__Pyx_SetItemOnTypeDict(__pyx_mstate_global->__pyx_ptype_5pysam_7libcbcf_VariantHeaderContigs, __pyx_mstate_global->__pyx_n_u_iteritems, __pyx_t_4) < 0) __PYX_ERR(0, 1857, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;

  /* "pysam/libcbcf.pyx":1862
 *             yield (key, self[key])
 * 
 *     def keys(self):             # <<<<<<<<<<<<<<
 *         """D.keys() -> list of D's keys"""
 *         return list(self)
*/
  __pyx_t_4 = __Pyx_CyFunction_New(&__pyx_mdef_5pysam_7libcbcf_20VariantHeaderContigs_28keys, __Pyx_CYFUNCTION_CCLASS, __pyx_mstate_global->__pyx_n_u_VariantHeaderContigs_keys, NULL, __pyx_mstate_global->__pyx_n_u_pysam_libcbcf, __pyx_mstate_global->__pyx_d, ((PyObject *)__pyx_mstate_global->__pyx_codeobj_tab[120])); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1862, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  if (__Pyx_SetItemOnTypeDict(__pyx_mstate_global->__pyx_ptype_5pysam_7libcbcf_VariantHeaderContigs, __pyx_mstate_global->__pyx_n_u_keys, __pyx_t_4) < 0) __PYX_ERR(0, 1862, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;

  /* "pysam/libcbcf.pyx":1866
 *         return list(self)
 * 
 *     def items(self):             # <<<<<<<<<<<<<<
 *         """D.items() -> list of D's (key, value) pairs, as 2-tuples"""
 *         return list(self.iteritems())
*/
  __pyx_t_4 = __Pyx_CyFunction_New(&__pyx_mdef_5pysam_7libcbcf_20VariantHeaderContigs_30items, __Pyx_CYFUNCTION_CCLASS, __pyx_mstate_global->__pyx_n_u_VariantHeaderContigs_items, NULL, __pyx_mstate_global->__pyx_n_u_pysam_libcbcf, __pyx_mstate_global->__pyx_d, ((PyObject *)__pyx_mstate_global->__pyx_codeobj_tab[121])); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1866, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  if (__Pyx_SetItemOnTypeDict(__pyx_mstate_global->__pyx_ptype_5pysam_7libcbcf_VariantHeaderContigs, __pyx_mstate_global->__pyx_n_u_items, __pyx_t_4) < 0) __PYX_ERR(0, 1866, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;

  /* "pysam/libcbcf.pyx":1870
 *         return list(self.iteritems())
 * 
 *     def values(self):             # <<<<<<<<<<<<<<
 *         """D.values() -> list of D's values"""
 *         return list(self.itervalues())
*/
  __pyx_t_4 = __Pyx_CyFunction_New(&__pyx_mdef_5pysam_7libcbcf_20VariantHeaderContigs_32values, __Pyx_CYFUNCTION_CCLASS, __pyx_mstate_global->__pyx_n_u_VariantHeaderContigs_values, NULL, __pyx_mstate_global->__pyx_n_u_pysam_libcbcf, __pyx_mstate_global->__pyx_d, ((PyObject *)__pyx_mstate_global->__pyx_codeobj_tab[122])); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1870, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  if (__Pyx_SetItemOnTypeDict(__pyx_mstate_global->__pyx_ptype_5pysam_7libcbcf_VariantHeaderContigs, __pyx_mstate_global->__pyx_n_u_values, __pyx_t_4) < 0) __PYX_ERR(0, 1870, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;

  /* "pysam/libcbcf.pyx":1875
 * 
 *     # Mappings are not hashable by default, but subclasses can change this
 *     __hash__ = None             # <<<<<<<<<<<<<<
 * 
 *     #TODO: implement __richcmp__
*/
  if (__Pyx_SetItemOnTypeDict(__pyx_mstate_global->__pyx_ptype_5pysam_7libcbcf_VariantHeaderContigs, __pyx_mstate_global->__pyx_n_u_hash, Py_None) < 0) __PYX_ERR(0, 1875, __pyx_L1_error)

  /* "pysam/libcbcf.pyx":1879
 *     #TODO: implement __richcmp__
 * 
 *     def add(self, id, length=None, **kwargs):             # <<<<<<<<<<<<<<
 *         """Add a new contig record"""
 *         if id in self:
*/
  __pyx_t_4 = __Pyx_CyFunction_New(&__pyx_mdef_5pysam_7libcbcf_20VariantHeaderContigs_34add, __Pyx_CYFUNCTION_CCLASS, __pyx_mstate_global->__pyx_n_u_VariantHeaderContigs_add, NULL, __pyx_mstate_global->__pyx_n_u_pysam_libcbcf, __pyx_mstate_global->__pyx_d, ((PyObject *)__pyx_mstate_global->__pyx_codeobj_tab[123])); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1879, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  __Pyx_CyFunction_SetDefaultsTuple(__pyx_t_4, __pyx_mstate_global->__pyx_tuple[0]);
  if (__Pyx_SetItemOnTypeDict(__pyx_mstate_global->__pyx_ptype_5pysam_7libcbcf_VariantHeaderContigs, __pyx_mstate_global->__pyx_n_u_add, __pyx_t_4) < 0) __PYX_ERR(0, 1879, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;

  /* "(tree fragment)":1
 * def __reduce_cython__(self):             # <<<<<<<<<<<<<<
 *     cdef tuple state
 *     cdef object _dict
*/
  __pyx_t_4 = __Pyx_CyFunction_New(&__pyx_mdef_5pysam_7libcbcf_20VariantHeaderContigs_36__reduce_cython__, __Pyx_CYFUNCTION_CCLASS, __pyx_mstate_global->__pyx_n_u_VariantHeaderContigs___reduce_cy, NULL, __pyx_mstate_global->__pyx_n_u_pysam_libcbcf, __pyx_mstate_global->__pyx_d, ((PyObject *)__pyx_mstate_global->__pyx_codeobj_tab[125])); if (unlikely(!__pyx_t_4)) __PYX_ERR(4, 1, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  if (__Pyx_SetItemOnTypeDict(__pyx_mstate_global->__pyx_ptype_5pysam_7libcbcf_VariantHeaderContigs, __pyx_mstate_global->__pyx_n_u_reduce_cython, __pyx_t_4) < 0) __PYX_ERR(4, 1, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;

  /* "(tree fragment)":16
 *     else:
 *         return __pyx_unpickle_VariantHeaderContigs, (type(self), 0x1e0584a, state)
 * def __setstate_cython__(self, __pyx_state):             # <<<<<<<<<<<<<<
 *     __pyx_unpickle_VariantHeaderContigs__set_state(self, __pyx_state)
*/
  __pyx_t_4 = __Pyx_CyFunction_New(&__pyx_mdef_5pysam_7libcbcf_20VariantHeaderContigs_38__setstate_cython__, __Pyx_CYFUNCTION_CCLASS, __pyx_mstate_global->__pyx_n_u_VariantHeaderContigs___setstate, NULL, __pyx_mstate_global->__pyx_n_u_pysam_libcbcf, __pyx_mstate_global->__pyx_d, ((PyObject *)__pyx_mstate_global->__pyx_codeobj_tab[126])); if (unlikely(!__pyx_t_4)) __PYX_ERR(4, 16, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  if (__Pyx_SetItemOnTypeDict(__pyx_mstate_global->__pyx_ptype_5pysam_7libcbcf_VariantHeaderContigs, __pyx_mstate_global->__pyx_n_u_setstate_cython, __pyx_t_4) < 0) __PYX_ERR(4, 16, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;

  /* "pysam/libcbcf.pyx":1938
 * 
 *     # Mappings are not hashable by default, but subclasses can change this
 *     __hash__ = None             # <<<<<<<<<<<<<<
 * 
 *     #TODO: implement __richcmp__
*/
  if (__Pyx_SetItemOnTypeDict(__pyx_mstate_global->__pyx_ptype_5pysam_7libcbcf_VariantHeaderSamples, __pyx_mstate_global->__pyx_n_u_hash, Py_None) < 0) __PYX_ERR(0, 1938, __pyx_L1_error)

  /* "pysam/libcbcf.pyx":1942
 *     #TODO: implement __richcmp__
 * 
 *     def add(self, name):             # <<<<<<<<<<<<<<
 *         """Add a new sample"""
 *         self.header.add_sample(name)
*/
  __pyx_t_4 = __Pyx_CyFunction_New(&__pyx_mdef_5pysam_7libcbcf_20VariantHeaderSamples_14add, __Pyx_CYFUNCTION_CCLASS, __pyx_mstate_global->__pyx_n_u_VariantHeaderSamples_add, NULL, __pyx_mstate_global->__pyx_n_u_pysam_libcbcf, __pyx_mstate_global->__pyx_d, ((PyObject *)__pyx_mstate_global->__pyx_codeobj_tab[134])); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1942, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  if (__Pyx_SetItemOnTypeDict(__pyx_mstate_global->__pyx_ptype_5pysam_7libcbcf_VariantHeaderSamples, __pyx_mstate_global->__pyx_n_u_add, __pyx_t_4) < 0) __PYX_ERR(0, 1942, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;

  /* "(tree fragment)":1
 * def __reduce_cython__(self):             # <<<<<<<<<<<<<<
 *     cdef tuple state
 *     cdef object _dict
*/
  __pyx_t_4 = __Pyx_CyFunction_New(&__pyx_mdef_5pysam_7libcbcf_20VariantHeaderSamples_16__reduce_cython__, __Pyx_CYFUNCTION_CCLASS, __pyx_mstate_global->__pyx_n_u_VariantHeaderSamples___reduce_cy, NULL, __pyx_mstate_global->__pyx_n_u_pysam_libcbcf, __pyx_mstate_global->__pyx_d, ((PyObject *)__pyx_mstate_global->__pyx_codeobj_tab[136])); if (unlikely(!__pyx_t_4)) __PYX_ERR(4, 1, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  if (__Pyx_SetItemOnTypeDict(__pyx_mstate_global->__pyx_ptype_5pysam_7libcbcf_VariantHeaderSamples, __pyx_mstate_global->__pyx_n_u_reduce_cython, __pyx_t_4) < 0) __PYX_ERR(4, 1, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;

  /* "(tree fragment)":16
 *     else:
 *         return __pyx_unpickle_VariantHeaderSamples, (type(self), 0x1e0584a, state)
 * def __setstate_cython__(self, __pyx_state):             # <<<<<<<<<<<<<<
 *     __pyx_unpickle_VariantHeaderSamples__set_state(self, __pyx_state)
*/
  __pyx_t_4 = __Pyx_CyFunction_New(&__pyx_mdef_5pysam_7libcbcf_20VariantHeaderSamples_18__setstate_cython__, __Pyx_CYFUNCTION_CCLASS, __pyx_mstate_global->__pyx_n_u_VariantHeaderSamples___setstate, NULL, __pyx_mstate_global->__pyx_n_u_pysam_libcbcf, __pyx_mstate_global->__pyx_d, ((PyObject *)__pyx_mstate_global->__pyx_codeobj_tab[137])); if (unlikely(!__pyx_t_4)) __PYX_ERR(4, 16, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  if (__Pyx_SetItemOnTypeDict(__pyx_mstate_global->__pyx_ptype_5pysam_7libcbcf_VariantHeaderSamples, __pyx_mstate_global->__pyx_n_u_setstate_cython, __pyx_t_4) < 0) __PYX_ERR(4, 16, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;

  /* "pysam/libcbcf.pyx":1981
 *         return self.ptr != NULL
 * 
 *     def copy(self):             # <<<<<<<<<<<<<<
 *         return makeVariantHeader(bcf_hdr_dup(self.ptr))
 * 
*/
  __pyx_t_4 = __Pyx_CyFunction_New(&__pyx_mdef_5pysam_7libcbcf_13VariantHeader_9copy, __Pyx_CYFUNCTION_CCLASS, __pyx_mstate_global->__pyx_n_u_VariantHeader_copy, NULL, __pyx_mstate_global->__pyx_n_u_pysam_libcbcf, __pyx_mstate_global->__pyx_d, ((PyObject *)__pyx_mstate_global->__pyx_codeobj_tab[143])); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1981, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  if (__Pyx_SetItemOnTypeDict(__pyx_mstate_global->__pyx_ptype_5pysam_7libcbcf_VariantHeader, __pyx_mstate_global->__pyx_n_u_copy, __pyx_t_4) < 0) __PYX_ERR(0, 1981, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;

  /* "pysam/libcbcf.pyx":1984
 *         return makeVariantHeader(bcf_hdr_dup(self.ptr))
 * 
 *     def merge(self, VariantHeader header):             # <<<<<<<<<<<<<<
 *         if header is None:
 *             raise ValueError('header must not be None')
*/
  __pyx_t_4 = __Pyx_CyFunction_New(&__pyx_mdef_5pysam_7libcbcf_13VariantHeader_11merge, __Pyx_CYFUNCTION_CCLASS, __pyx_mstate_global->__pyx_n_u_VariantHeader_merge, NULL, __pyx_mstate_global->__pyx_n_u_pysam_libcbcf, __pyx_mstate_global->__pyx_d, ((PyObject *)__pyx_mstate_global->__pyx_codeobj_tab[144])); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1984, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  if (__Pyx_SetItemOnTypeDict(__pyx_mstate_global->__pyx_ptype_5pysam_7libcbcf_VariantHeader, __pyx_mstate_global->__pyx_n_u_merge, __pyx_t_4) < 0) __PYX_ERR(0, 1984, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;

  /* "pysam/libcbcf.pyx":2076
 *         return ret
 * 
 *     def new_record(self, contig=None, start=0, stop=0, alleles=None,             # <<<<<<<<<<<<<<
 *                          id=None, qual=None, filter=None, info=None, samples=None,
 *                          **kwargs):
*/
  __pyx_t_4 = __Pyx_CyFunction_New(&__pyx_mdef_5pysam_7libcbcf_13VariantHeader_15new_record, __Pyx_CYFUNCTION_CCLASS, __pyx_mstate_global->__pyx_n_u_VariantHeader_new_record, NULL, __pyx_mstate_global->__pyx_n_u_pysam_libcbcf, __pyx_mstate_global->__pyx_d, ((PyObject *)__pyx_mstate_global->__pyx_codeobj_tab[155])); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 2076, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  __Pyx_CyFunction_SetDefaultsTuple(__pyx_t_4, __pyx_mstate_global->__pyx_tuple[11]);
  if (__Pyx_SetItemOnTypeDict(__pyx_mstate_global->__pyx_ptype_5pysam_7libcbcf_VariantHeader, __pyx_mstate_global->__pyx_n_u_new_record, __pyx_t_4) < 0) __PYX_ERR(0, 2076, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;

  /* "pysam/libcbcf.pyx":2122
 *         return rec
 * 
 *     def add_record(self, VariantHeaderRecord record):             # <<<<<<<<<<<<<<
 *         """Add an existing :class:`VariantHeaderRecord` to this header"""
 *         if record is None:
*/
  __pyx_t_4 = __Pyx_CyFunction_New(&__pyx_mdef_5pysam_7libcbcf_13VariantHeader_17add_record, __Pyx_CYFUNCTION_CCLASS, __pyx_mstate_global->__pyx_n_u_VariantHeader_add_record, NULL, __pyx_mstate_global->__pyx_n_u_pysam_libcbcf, __pyx_mstate_global->__pyx_d, ((PyObject *)__pyx_mstate_global->__pyx_codeobj_tab[156])); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 2122, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  if (__Pyx_SetItemOnTypeDict(__pyx_mstate_global->__pyx_ptype_5pysam_7libcbcf_VariantHeader, __pyx_mstate_global->__pyx_n_u_add_record, __pyx_t_4) < 0) __PYX_ERR(0, 2122, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;

  /* "pysam/libcbcf.pyx":2133
 *         self._hdr_sync()
 * 
 *     def add_line(self, line):             # <<<<<<<<<<<<<<
 *         """Add a metadata line to this header"""
 *         bline = force_bytes(line)
*/
  __pyx_t_4 = __Pyx_CyFunction_New(&__pyx_mdef_5pysam_7libcbcf_13VariantHeader_19add_line, __Pyx_CYFUNCTION_CCLASS, __pyx_mstate_global->__pyx_n_u_VariantHeader_add_line, NULL, __pyx_mstate_global->__pyx_n_u_pysam_libcbcf, __pyx_mstate_global->__pyx_d, ((PyObject *)__pyx_mstate_global->__pyx_codeobj_tab[157])); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 2133, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  if (__Pyx_SetItemOnTypeDict(__pyx_mstate_global->__pyx_ptype_5pysam_7libcbcf_VariantHeader, __pyx_mstate_global->__pyx_n_u_add_line, __pyx_t_4) < 0) __PYX_ERR(0, 2133, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;

  /* "pysam/libcbcf.pyx":2142
 * 
 * 
 *     def add_meta(self, key, value=None, items=None):             # <<<<<<<<<<<<<<
 *         """Add metadata to this header"""
 *         if not ((value is not None) ^ (items is not None)):
*/
  __pyx_t_4 = __Pyx_CyFunction_New(&__pyx_mdef_5pysam_7libcbcf_13VariantHeader_21add_meta, __Pyx_CYFUNCTION_CCLASS, __pyx_mstate_global->__pyx_n_u_VariantHeader_add_meta, NULL, __pyx_mstate_global->__pyx_n_u_pysam_libcbcf, __pyx_mstate_global->__pyx_d, ((PyObject *)__pyx_mstate_global->__pyx_codeobj_tab[158])); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 2142, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  __Pyx_CyFunction_SetDefaultsTuple(__pyx_t_4, __pyx_mstate_global->__pyx_tuple[12]);
  if (__Pyx_SetItemOnTypeDict(__pyx_mstate_global->__pyx_ptype_5pysam_7libcbcf_VariantHeader, __pyx_mstate_global->__pyx_n_u_add_meta, __pyx_t_4) < 0) __PYX_ERR(0, 2142, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;

  /* "pysam/libcbcf.pyx":2186
 *                 raise MemoryError('unable to reallocate VariantHeader')
 * 
 *     def add_sample(self, name):             # <<<<<<<<<<<<<<
 *         """Add a new sample to this header"""
 *         self._add_sample(name)
*/
  __pyx_t_4 = __Pyx_CyFunction_New(&__pyx_mdef_5pysam_7libcbcf_13VariantHeader_23add_sample, __Pyx_CYFUNCTION_CCLASS, __pyx_mstate_global->__pyx_n_u_VariantHeader_add_sample, NULL, __pyx_mstate_global->__pyx_n_u_pysam_libcbcf, __pyx_mstate_global->__pyx_d, ((PyObject *)__pyx_mstate_global->__pyx_codeobj_tab[161])); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 2186, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  if (__Pyx_SetItemOnTypeDict(__pyx_mstate_global->__pyx_ptype_5pysam_7libcbcf_VariantHeader, __pyx_mstate_global->__pyx_n_u_add_sample, __pyx_t_4) < 0) __PYX_ERR(0, 2186, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;

  /* "pysam/libcbcf.pyx":2191
 *         self._hdr_sync()
 * 
 *     def add_samples(self, *args):             # <<<<<<<<<<<<<<
 *         """Add several new samples to this header.
 *         This function takes multiple arguments, each of which may
*/
  __pyx_t_4 = __Pyx_CyFunction_New(&__pyx_mdef_5pysam_7libcbcf_13VariantHeader_25add_samples, __Pyx_CYFUNCTION_CCLASS, __pyx_mstate_global->__pyx_n_u_VariantHeader_add_samples, NULL, __pyx_mstate_global->__pyx_n_u_pysam_libcbcf, __pyx_mstate_global->__pyx_d, ((PyObject *)__pyx_mstate_global->__pyx_codeobj_tab[162])); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 2191, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  if (__Pyx_SetItemOnTypeDict(__pyx_mstate_global->__pyx_ptype_5pysam_7libcbcf_VariantHeader, __pyx_mstate_global->__pyx_n_u_add_samples, __pyx_t_4) < 0) __PYX_ERR(0, 2191, __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_5pysam_7libcbcf_13VariantHeader_27__reduce_cython__, __Pyx_CYFUNCTION_CCLASS, __pyx_mstate_global->__pyx_n_u_VariantHeader___reduce_cython, NULL, __pyx_mstate_global->__pyx_n_u_pysam_libcbcf, __pyx_mstate_global->__pyx_d, ((PyObject *)__pyx_mstate_global->__pyx_codeobj_tab[163])); if (unlikely(!__pyx_t_4)) __PYX_ERR(4, 1, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  if (PyDict_SetItem(__pyx_mstate_global->__pyx_d, __pyx_mstate_global->__pyx_n_u_reduce_cython, __pyx_t_4) < 0) __PYX_ERR(4, 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_5pysam_7libcbcf_13VariantHeader_29__setstate_cython__, __Pyx_CYFUNCTION_CCLASS, __pyx_mstate_global->__pyx_n_u_VariantHeader___setstate_cython, NULL, __pyx_mstate_global->__pyx_n_u_pysam_libcbcf, __pyx_mstate_global->__pyx_d, ((PyObject *)__pyx_mstate_global->__pyx_codeobj_tab[164])); if (unlikely(!__pyx_t_4)) __PYX_ERR(4, 3, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  if (PyDict_SetItem(__pyx_mstate_global->__pyx_d, __pyx_mstate_global->__pyx_n_u_setstate_cython, __pyx_t_4) < 0) __PYX_ERR(4, 3, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;

  /* "pysam/libcbcf.pyx":2275
 *         return makeVariantMetadata(self.record.header, BCF_HL_FLT, id)
 * 
 *     def add(self, key):             # <<<<<<<<<<<<<<
 *         """Add a new filter"""
 *         cdef bcf_hdr_t *hdr = self.record.header.ptr
*/
  __pyx_t_4 = __Pyx_CyFunction_New(&__pyx_mdef_5pysam_7libcbcf_19VariantRecordFilter_9add, __Pyx_CYFUNCTION_CCLASS, __pyx_mstate_global->__pyx_n_u_VariantRecordFilter_add, NULL, __pyx_mstate_global->__pyx_n_u_pysam_libcbcf, __pyx_mstate_global->__pyx_d, ((PyObject *)__pyx_mstate_global->__pyx_codeobj_tab[171])); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 2275, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  if (__Pyx_SetItemOnTypeDict(__pyx_mstate_global->__pyx_ptype_5pysam_7libcbcf_VariantRecordFilter, __pyx_mstate_global->__pyx_n_u_add, __pyx_t_4) < 0) __PYX_ERR(0, 2275, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;

  /* "pysam/libcbcf.pyx":2317
 *         bcf_remove_filter(hdr, r, id, 0)
 * 
 *     def clear(self):             # <<<<<<<<<<<<<<
 *         """Clear all filters"""
 *         cdef bcf1_t *r = self.record.ptr
*/
  __pyx_t_4 = __Pyx_CyFunction_New(&__pyx_mdef_5pysam_7libcbcf_19VariantRecordFilter_13clear, __Pyx_CYFUNCTION_CCLASS, __pyx_mstate_global->__pyx_n_u_VariantRecordFilter_clear, NULL, __pyx_mstate_global->__pyx_n_u_pysam_libcbcf, __pyx_mstate_global->__pyx_d, ((PyObject *)__pyx_mstate_global->__pyx_codeobj_tab[173])); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 2317, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  if (__Pyx_SetItemOnTypeDict(__pyx_mstate_global->__pyx_ptype_5pysam_7libcbcf_VariantRecordFilter, __pyx_mstate_global->__pyx_n_u_clear, __pyx_t_4) < 0) __PYX_ERR(0, 2317, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;

  /* "pysam/libcbcf.pyx":2331
 *             yield bcf_str_cache_get_charptr(bcf_hdr_int2id(hdr, BCF_DT_ID, r.d.flt[i]))
 * 
 *     def get(self, key, default=None):             # <<<<<<<<<<<<<<
 *         """D.get(k[,d]) -> D[k] if k in D, else d.  d defaults to None."""
 *         try:
*/
  __pyx_t_4 = __Pyx_CyFunction_New(&__pyx_mdef_5pysam_7libcbcf_19VariantRecordFilter_18get, __Pyx_CYFUNCTION_CCLASS, __pyx_mstate_global->__pyx_n_u_VariantRecordFilter_get, NULL, __pyx_mstate_global->__pyx_n_u_pysam_libcbcf, __pyx_mstate_global->__pyx_d, ((PyObject *)__pyx_mstate_global->__pyx_codeobj_tab[175])); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 2331, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  __Pyx_CyFunction_SetDefaultsTuple(__pyx_t_4, __pyx_mstate_global->__pyx_tuple[0]);
  if (__Pyx_SetItemOnTypeDict(__pyx_mstate_global->__pyx_ptype_5pysam_7libcbcf_VariantRecordFilter, __pyx_mstate_global->__pyx_n_u_get, __pyx_t_4) < 0) __PYX_ERR(0, 2331, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;

  /* "pysam/libcbcf.pyx":2344
 *         return bcf_has_filter(hdr, r, bkey) == 1
 * 
 *     def iterkeys(self):             # <<<<<<<<<<<<<<
 *         """D.iterkeys() -> an iterator over the keys of D"""
 *         return iter(self)
*/
  __pyx_t_4 = __Pyx_CyFunction_New(&__pyx_mdef_5pysam_7libcbcf_19VariantRecordFilter_22iterkeys, __Pyx_CYFUNCTION_CCLASS, __pyx_mstate_global->__pyx_n_u_VariantRecordFilter_iterkeys, NULL, __pyx_mstate_global->__pyx_n_u_pysam_libcbcf, __pyx_mstate_global->__pyx_d, ((PyObject *)__pyx_mstate_global->__pyx_codeobj_tab[177])); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 2344, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  if (__Pyx_SetItemOnTypeDict(__pyx_mstate_global->__pyx_ptype_5pysam_7libcbcf_VariantRecordFilter, __pyx_mstate_global->__pyx_n_u_iterkeys, __pyx_t_4) < 0) __PYX_ERR(0, 2344, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;

  /* "pysam/libcbcf.pyx":2348
 *         return iter(self)
 * 
 *     def itervalues(self):             # <<<<<<<<<<<<<<
 *         """D.itervalues() -> an iterator over the values of D"""
 *         for key in self:
*/
  __pyx_t_4 = __Pyx_CyFunction_New(&__pyx_mdef_5pysam_7libcbcf_19VariantRecordFilter_24itervalues, __Pyx_CYFUNCTION_CCLASS, __pyx_mstate_global->__pyx_n_u_VariantRecordFilter_itervalues, NULL, __pyx_mstate_global->__pyx_n_u_pysam_libcbcf, __pyx_mstate_global->__pyx_d, ((PyObject *)__pyx_mstate_global->__pyx_codeobj_tab[178])); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 2348, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  if (__Pyx_SetItemOnTypeDict(__pyx_mstate_global->__pyx_ptype_5pysam_7libcbcf_VariantRecordFilter, __pyx_mstate_global->__pyx_n_u_itervalues, __pyx_t_4) < 0) __PYX_ERR(0, 2348, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;

  /* "pysam/libcbcf.pyx":2353
 *             yield self[key]
 * 
 *     def iteritems(self):             # <<<<<<<<<<<<<<
 *         """D.iteritems() -> an iterator over the (key, value) items of D"""
 *         for key in self:
*/
  __pyx_t_4 = __Pyx_CyFunction_New(&__pyx_mdef_5pysam_7libcbcf_19VariantRecordFilter_27iteritems, __Pyx_CYFUNCTION_CCLASS, __pyx_mstate_global->__pyx_n_u_VariantRecordFilter_iteritems, NULL, __pyx_mstate_global->__pyx_n_u_pysam_libcbcf, __pyx_mstate_global->__pyx_d, ((PyObject *)__pyx_mstate_global->__pyx_codeobj_tab[179])); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 2353, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  if (__Pyx_SetItemOnTypeDict(__pyx_mstate_global->__pyx_ptype_5pysam_7libcbcf_VariantRecordFilter, __pyx_mstate_global->__pyx_n_u_iteritems, __pyx_t_4) < 0) __PYX_ERR(0, 2353, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;

  /* "pysam/libcbcf.pyx":2358
 *             yield (key, self[key])
 * 
 *     def keys(self):             # <<<<<<<<<<<<<<
 *         """D.keys() -> list of D's keys"""
 *         return list(self)
*/
  __pyx_t_4 = __Pyx_CyFunction_New(&__pyx_mdef_5pysam_7libcbcf_19VariantRecordFilter_30keys, __Pyx_CYFUNCTION_CCLASS, __pyx_mstate_global->__pyx_n_u_VariantRecordFilter_keys, NULL, __pyx_mstate_global->__pyx_n_u_pysam_libcbcf, __pyx_mstate_global->__pyx_d, ((PyObject *)__pyx_mstate_global->__pyx_codeobj_tab[180])); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 2358, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  if (__Pyx_SetItemOnTypeDict(__pyx_mstate_global->__pyx_ptype_5pysam_7libcbcf_VariantRecordFilter, __pyx_mstate_global->__pyx_n_u_keys, __pyx_t_4) < 0) __PYX_ERR(0, 2358, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;

  /* "pysam/libcbcf.pyx":2362
 *         return list(self)
 * 
 *     def items(self):             # <<<<<<<<<<<<<<
 *         """D.items() -> list of D's (key, value) pairs, as 2-tuples"""
 *         return list(self.iteritems())
*/
  __pyx_t_4 = __Pyx_CyFunction_New(&__pyx_mdef_5pysam_7libcbcf_19VariantRecordFilter_32items, __Pyx_CYFUNCTION_CCLASS, __pyx_mstate_global->__pyx_n_u_VariantRecordFilter_items, NULL, __pyx_mstate_global->__pyx_n_u_pysam_libcbcf, __pyx_mstate_global->__pyx_d, ((PyObject *)__pyx_mstate_global->__pyx_codeobj_tab[181])); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 2362, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  if (__Pyx_SetItemOnTypeDict(__pyx_mstate_global->__pyx_ptype_5pysam_7libcbcf_VariantRecordFilter, __pyx_mstate_global->__pyx_n_u_items, __pyx_t_4) < 0) __PYX_ERR(0, 2362, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;

  /* "pysam/libcbcf.pyx":2366
 *         return list(self.iteritems())
 * 
 *     def values(self):             # <<<<<<<<<<<<<<
 *         """D.values() -> list of D's values"""
 *         return list(self.itervalues())
*/
  __pyx_t_4 = __Pyx_CyFunction_New(&__pyx_mdef_5pysam_7libcbcf_19VariantRecordFilter_34values, __Pyx_CYFUNCTION_CCLASS, __pyx_mstate_global->__pyx_n_u_VariantRecordFilter_values, NULL, __pyx_mstate_global->__pyx_n_u_pysam_libcbcf, __pyx_mstate_global->__pyx_d, ((PyObject *)__pyx_mstate_global->__pyx_codeobj_tab[182])); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 2366, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  if (__Pyx_SetItemOnTypeDict(__pyx_mstate_global->__pyx_ptype_5pysam_7libcbcf_VariantRecordFilter, __pyx_mstate_global->__pyx_n_u_values, __pyx_t_4) < 0) __PYX_ERR(0, 2366, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;

  /* "pysam/libcbcf.pyx":2385
 * 
 *     # Mappings are not hashable by default, but subclasses can change this
 *     __hash__ = None             # <<<<<<<<<<<<<<
 * 
 *     #TODO: implement __richcmp__
*/
  if (__Pyx_SetItemOnTypeDict(__pyx_mstate_global->__pyx_ptype_5pysam_7libcbcf_VariantRecordFilter, __pyx_mstate_global->__pyx_n_u_hash, Py_None) < 0) __PYX_ERR(0, 2385, __pyx_L1_error)

  /* "(tree fragment)":1
 * def __reduce_cython__(self):             # <<<<<<<<<<<<<<
 *     cdef tuple state
 *     cdef object _dict
*/
  __pyx_t_4 = __Pyx_CyFunction_New(&__pyx_mdef_5pysam_7libcbcf_19VariantRecordFilter_38__reduce_cython__, __Pyx_CYFUNCTION_CCLASS, __pyx_mstate_global->__pyx_n_u_VariantRecordFilter___reduce_cyt, NULL, __pyx_mstate_global->__pyx_n_u_pysam_libcbcf, __pyx_mstate_global->__pyx_d, ((PyObject *)__pyx_mstate_global->__pyx_codeobj_tab[184])); if (unlikely(!__pyx_t_4)) __PYX_ERR(4, 1, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  if (__Pyx_SetItemOnTypeDict(__pyx_mstate_global->__pyx_ptype_5pysam_7libcbcf_VariantRecordFilter, __pyx_mstate_global->__pyx_n_u_reduce_cython, __pyx_t_4) < 0) __PYX_ERR(4, 1, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;

  /* "(tree fragment)":16
 *     else:
 *         return __pyx_unpickle_VariantRecordFilter, (type(self), 0x70ce871, state)
 * def __setstate_cython__(self, __pyx_state):             # <<<<<<<<<<<<<<
 *     __pyx_unpickle_VariantRecordFilter__set_state(self, __pyx_state)
*/
  __pyx_t_4 = __Pyx_CyFunction_New(&__pyx_mdef_5pysam_7libcbcf_19VariantRecordFilter_40__setstate_cython__, __Pyx_CYFUNCTION_CCLASS, __pyx_mstate_global->__pyx_n_u_VariantRecordFilter___setstate_c, NULL, __pyx_mstate_global->__pyx_n_u_pysam_libcbcf, __pyx_mstate_global->__pyx_d, ((PyObject *)__pyx_mstate_global->__pyx_codeobj_tab[185])); if (unlikely(!__pyx_t_4)) __PYX_ERR(4, 16, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  if (__Pyx_SetItemOnTypeDict(__pyx_mstate_global->__pyx_ptype_5pysam_7libcbcf_VariantRecordFilter, __pyx_mstate_global->__pyx_n_u_setstate_cython, __pyx_t_4) < 0) __PYX_ERR(4, 16, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;

  /* "pysam/libcbcf.pyx":2451
 *             raise ValueError('Unable to delete FORMAT')
 * 
 *     def clear(self):             # <<<<<<<<<<<<<<
 *         """Clear all formats for all samples within the associated
 *            :class:`VariantRecord` instance"""
*/
  __pyx_t_4 = __Pyx_CyFunction_New(&__pyx_mdef_5pysam_7libcbcf_19VariantRecordFormat_11clear, __Pyx_CYFUNCTION_CCLASS, __pyx_mstate_global->__pyx_n_u_VariantRecordFormat_clear, NULL, __pyx_mstate_global->__pyx_n_u_pysam_libcbcf, __pyx_mstate_global->__pyx_d, ((PyObject *)__pyx_mstate_global->__pyx_codeobj_tab[192])); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 2451, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  if (__Pyx_SetItemOnTypeDict(__pyx_mstate_global->__pyx_ptype_5pysam_7libcbcf_VariantRecordFormat, __pyx_mstate_global->__pyx_n_u_clear, __pyx_t_4) < 0) __PYX_ERR(0, 2451, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;

  /* "pysam/libcbcf.pyx":2478
 *                 yield bcf_str_cache_get_charptr(bcf_hdr_int2id(hdr, BCF_DT_ID, fmt.id))
 * 
 *     def get(self, key, default=None):             # <<<<<<<<<<<<<<
 *         """D.get(k[,d]) -> D[k] if k in D, else d.  d defaults to None."""
 *         try:
*/
  __pyx_t_4 = __Pyx_CyFunction_New(&__pyx_mdef_5pysam_7libcbcf_19VariantRecordFormat_16get, __Pyx_CYFUNCTION_CCLASS, __pyx_mstate_global->__pyx_n_u_VariantRecordFormat_get, NULL, __pyx_mstate_global->__pyx_n_u_pysam_libcbcf, __pyx_mstate_global->__pyx_d, ((PyObject *)__pyx_mstate_global->__pyx_codeobj_tab[194])); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 2478, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  __Pyx_CyFunction_SetDefaultsTuple(__pyx_t_4, __pyx_mstate_global->__pyx_tuple[0]);
  if (__Pyx_SetItemOnTypeDict(__pyx_mstate_global->__pyx_ptype_5pysam_7libcbcf_VariantRecordFormat, __pyx_mstate_global->__pyx_n_u_get, __pyx_t_4) < 0) __PYX_ERR(0, 2478, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;

  /* "pysam/libcbcf.pyx":2492
 *         return fmt != NULL and fmt.p != NULL
 * 
 *     def iterkeys(self):             # <<<<<<<<<<<<<<
 *         """D.iterkeys() -> an iterator over the keys of D"""
 *         return iter(self)
*/
  __pyx_t_4 = __Pyx_CyFunction_New(&__pyx_mdef_5pysam_7libcbcf_19VariantRecordFormat_20iterkeys, __Pyx_CYFUNCTION_CCLASS, __pyx_mstate_global->__pyx_n_u_VariantRecordFormat_iterkeys, NULL, __pyx_mstate_global->__pyx_n_u_pysam_libcbcf, __pyx_mstate_global->__pyx_d, ((PyObject *)__pyx_mstate_global->__pyx_codeobj_tab[196])); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 2492, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  if (__Pyx_SetItemOnTypeDict(__pyx_mstate_global->__pyx_ptype_5pysam_7libcbcf_VariantRecordFormat, __pyx_mstate_global->__pyx_n_u_iterkeys, __pyx_t_4) < 0) __PYX_ERR(0, 2492, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;

  /* "pysam/libcbcf.pyx":2496
 *         return iter(self)
 * 
 *     def itervalues(self):             # <<<<<<<<<<<<<<
 *         """D.itervalues() -> an iterator over the values of D"""
 *         for key in self:
*/
  __pyx_t_4 = __Pyx_CyFunction_New(&__pyx_mdef_5pysam_7libcbcf_19VariantRecordFormat_22itervalues, __Pyx_CYFUNCTION_CCLASS, __pyx_mstate_global->__pyx_n_u_VariantRecordFormat_itervalues, NULL, __pyx_mstate_global->__pyx_n_u_pysam_libcbcf, __pyx_mstate_global->__pyx_d, ((PyObject *)__pyx_mstate_global->__pyx_codeobj_tab[197])); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 2496, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  if (__Pyx_SetItemOnTypeDict(__pyx_mstate_global->__pyx_ptype_5pysam_7libcbcf_VariantRecordFormat, __pyx_mstate_global->__pyx_n_u_itervalues, __pyx_t_4) < 0) __PYX_ERR(0, 2496, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;

  /* "pysam/libcbcf.pyx":2501
 *             yield self[key]
 * 
 *     def iteritems(self):             # <<<<<<<<<<<<<<
 *         """D.iteritems() -> an iterator over the (key, value) items of D"""
 *         for key in self:
*/
  __pyx_t_4 = __Pyx_CyFunction_New(&__pyx_mdef_5pysam_7libcbcf_19VariantRecordFormat_25iteritems, __Pyx_CYFUNCTION_CCLASS, __pyx_mstate_global->__pyx_n_u_VariantRecordFormat_iteritems, NULL, __pyx_mstate_global->__pyx_n_u_pysam_libcbcf, __pyx_mstate_global->__pyx_d, ((PyObject *)__pyx_mstate_global->__pyx_codeobj_tab[198])); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 2501, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  if (__Pyx_SetItemOnTypeDict(__pyx_mstate_global->__pyx_ptype_5pysam_7libcbcf_VariantRecordFormat, __pyx_mstate_global->__pyx_n_u_iteritems, __pyx_t_4) < 0) __PYX_ERR(0, 2501, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;

  /* "pysam/libcbcf.pyx":2506
 *             yield (key, self[key])
 * 
 *     def keys(self):             # <<<<<<<<<<<<<<
 *         """D.keys() -> list of D's keys"""
 *         return list(self)
*/
  __pyx_t_4 = __Pyx_CyFunction_New(&__pyx_mdef_5pysam_7libcbcf_19VariantRecordFormat_28keys, __Pyx_CYFUNCTION_CCLASS, __pyx_mstate_global->__pyx_n_u_VariantRecordFormat_keys, NULL, __pyx_mstate_global->__pyx_n_u_pysam_libcbcf, __pyx_mstate_global->__pyx_d, ((PyObject *)__pyx_mstate_global->__pyx_codeobj_tab[199])); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 2506, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  if (__Pyx_SetItemOnTypeDict(__pyx_mstate_global->__pyx_ptype_5pysam_7libcbcf_VariantRecordFormat, __pyx_mstate_global->__pyx_n_u_keys, __pyx_t_4) < 0) __PYX_ERR(0, 2506, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;

  /* "pysam/libcbcf.pyx":2510
 *         return list(self)
 * 
 *     def items(self):             # <<<<<<<<<<<<<<
 *         """D.items() -> list of D's (key, value) pairs, as 2-tuples"""
 *         return list(self.iteritems())
*/
  __pyx_t_4 = __Pyx_CyFunction_New(&__pyx_mdef_5pysam_7libcbcf_19VariantRecordFormat_30items, __Pyx_CYFUNCTION_CCLASS, __pyx_mstate_global->__pyx_n_u_VariantRecordFormat_items, NULL, __pyx_mstate_global->__pyx_n_u_pysam_libcbcf, __pyx_mstate_global->__pyx_d, ((PyObject *)__pyx_mstate_global->__pyx_codeobj_tab[200])); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 2510, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  if (__Pyx_SetItemOnTypeDict(__pyx_mstate_global->__pyx_ptype_5pysam_7libcbcf_VariantRecordFormat, __pyx_mstate_global->__pyx_n_u_items, __pyx_t_4) < 0) __PYX_ERR(0, 2510, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;

  /* "pysam/libcbcf.pyx":2514
 *         return list(self.iteritems())
 * 
 *     def values(self):             # <<<<<<<<<<<<<<
 *         """D.values() -> list of D's values"""
 *         return list(self.itervalues())
*/
  __pyx_t_4 = __Pyx_CyFunction_New(&__pyx_mdef_5pysam_7libcbcf_19VariantRecordFormat_32values, __Pyx_CYFUNCTION_CCLASS, __pyx_mstate_global->__pyx_n_u_VariantRecordFormat_values, NULL, __pyx_mstate_global->__pyx_n_u_pysam_libcbcf, __pyx_mstate_global->__pyx_d, ((PyObject *)__pyx_mstate_global->__pyx_codeobj_tab[201])); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 2514, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  if (__Pyx_SetItemOnTypeDict(__pyx_mstate_global->__pyx_ptype_5pysam_7libcbcf_VariantRecordFormat, __pyx_mstate_global->__pyx_n_u_values, __pyx_t_4) < 0) __PYX_ERR(0, 2514, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;

  /* "pysam/libcbcf.pyx":2519
 * 
 *     # Mappings are not hashable by default, but subclasses can change this
 *     __hash__ = None             # <<<<<<<<<<<<<<
 * 
 *     #TODO: implement __richcmp__
*/
  if (__Pyx_SetItemOnTypeDict(__pyx_mstate_global->__pyx_ptype_5pysam_7libcbcf_VariantRecordFormat, __pyx_mstate_global->__pyx_n_u_hash, Py_None) < 0) __PYX_ERR(0, 2519, __pyx_L1_error)

  /* "(tree fragment)":1
 * def __reduce_cython__(self):             # <<<<<<<<<<<<<<
 *     cdef tuple state
 *     cdef object _dict
*/
  __pyx_t_4 = __Pyx_CyFunction_New(&__pyx_mdef_5pysam_7libcbcf_19VariantRecordFormat_34__reduce_cython__, __Pyx_CYFUNCTION_CCLASS, __pyx_mstate_global->__pyx_n_u_VariantRecordFormat___reduce_cyt, NULL, __pyx_mstate_global->__pyx_n_u_pysam_libcbcf, __pyx_mstate_global->__pyx_d, ((PyObject *)__pyx_mstate_global->__pyx_codeobj_tab[202])); if (unlikely(!__pyx_t_4)) __PYX_ERR(4, 1, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  if (__Pyx_SetItemOnTypeDict(__pyx_mstate_global->__pyx_ptype_5pysam_7libcbcf_VariantRecordFormat, __pyx_mstate_global->__pyx_n_u_reduce_cython, __pyx_t_4) < 0) __PYX_ERR(4, 1, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;

  /* "(tree fragment)":16
 *     else:
 *         return __pyx_unpickle_VariantRecordFormat, (type(self), 0x70ce871, state)
 * def __setstate_cython__(self, __pyx_state):             # <<<<<<<<<<<<<<
 *     __pyx_unpickle_VariantRecordFormat__set_state(self, __pyx_state)
*/
  __pyx_t_4 = __Pyx_CyFunction_New(&__pyx_mdef_5pysam_7libcbcf_19VariantRecordFormat_36__setstate_cython__, __Pyx_CYFUNCTION_CCLASS, __pyx_mstate_global->__pyx_n_u_VariantRecordFormat___setstate_c, NULL, __pyx_mstate_global->__pyx_n_u_pysam_libcbcf, __pyx_mstate_global->__pyx_d, ((PyObject *)__pyx_mstate_global->__pyx_codeobj_tab[203])); if (unlikely(!__pyx_t_4)) __PYX_ERR(4, 16, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  if (__Pyx_SetItemOnTypeDict(__pyx_mstate_global->__pyx_ptype_5pysam_7libcbcf_VariantRecordFormat, __pyx_mstate_global->__pyx_n_u_setstate_cython, __pyx_t_4) < 0) __PYX_ERR(4, 16, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;

  /* "pysam/libcbcf.pyx":2653
 *             raise ValueError('Unable to delete INFO')
 * 
 *     def clear(self):             # <<<<<<<<<<<<<<
 *         """Clear all info data"""
 *         cdef bcf_hdr_t *hdr = self.record.header.ptr
*/
  __pyx_t_4 = __Pyx_CyFunction_New(&__pyx_mdef_5pysam_7libcbcf_17VariantRecordInfo_13clear, __Pyx_CYFUNCTION_CCLASS, __pyx_mstate_global->__pyx_n_u_VariantRecordInfo_clear, NULL, __pyx_mstate_global->__pyx_n_u_pysam_libcbcf, __pyx_mstate_global->__pyx_d, ((PyObject *)__pyx_mstate_global->__pyx_codeobj_tab[211])); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 2653, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  if (__Pyx_SetItemOnTypeDict(__pyx_mstate_global->__pyx_ptype_5pysam_7libcbcf_VariantRecordInfo, __pyx_mstate_global->__pyx_n_u_clear, __pyx_t_4) < 0) __PYX_ERR(0, 2653, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;

  /* "pysam/libcbcf.pyx":2690
 *                     yield bcf_str_cache_get_charptr(key)
 * 
 *     def get(self, key, default=None):             # <<<<<<<<<<<<<<
 *         """D.get(k[,d]) -> D[k] if k in D, else d.  d defaults to None."""
 *         cdef bcf_hdr_t *hdr = self.record.header.ptr
*/
  __pyx_t_4 = __Pyx_CyFunction_New(&__pyx_mdef_5pysam_7libcbcf_17VariantRecordInfo_18get, __Pyx_CYFUNCTION_CCLASS, __pyx_mstate_global->__pyx_n_u_VariantRecordInfo_get, NULL, __pyx_mstate_global->__pyx_n_u_pysam_libcbcf, __pyx_mstate_global->__pyx_d, ((PyObject *)__pyx_mstate_global->__pyx_codeobj_tab[213])); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 2690, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  __Pyx_CyFunction_SetDefaultsTuple(__pyx_t_4, __pyx_mstate_global->__pyx_tuple[0]);
  if (__Pyx_SetItemOnTypeDict(__pyx_mstate_global->__pyx_ptype_5pysam_7libcbcf_VariantRecordInfo, __pyx_mstate_global->__pyx_n_u_get, __pyx_t_4) < 0) __PYX_ERR(0, 2690, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;

  /* "pysam/libcbcf.pyx":2736
 *         return info != NULL and info.vptr != NULL
 * 
 *     def iterkeys(self):             # <<<<<<<<<<<<<<
 *         """D.iterkeys() -> an iterator over the keys of D"""
 *         return iter(self)
*/
  __pyx_t_4 = __Pyx_CyFunction_New(&__pyx_mdef_5pysam_7libcbcf_17VariantRecordInfo_22iterkeys, __Pyx_CYFUNCTION_CCLASS, __pyx_mstate_global->__pyx_n_u_VariantRecordInfo_iterkeys, NULL, __pyx_mstate_global->__pyx_n_u_pysam_libcbcf, __pyx_mstate_global->__pyx_d, ((PyObject *)__pyx_mstate_global->__pyx_codeobj_tab[215])); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 2736, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  if (__Pyx_SetItemOnTypeDict(__pyx_mstate_global->__pyx_ptype_5pysam_7libcbcf_VariantRecordInfo, __pyx_mstate_global->__pyx_n_u_iterkeys, __pyx_t_4) < 0) __PYX_ERR(0, 2736, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;

  /* "pysam/libcbcf.pyx":2740
 *         return iter(self)
 * 
 *     def itervalues(self):             # <<<<<<<<<<<<<<
 *         """D.itervalues() -> an iterator over the values of D"""
 *         cdef bcf_hdr_t *hdr = self.record.header.ptr
*/
  __pyx_t_4 = __Pyx_CyFunction_New(&__pyx_mdef_5pysam_7libcbcf_17VariantRecordInfo_24itervalues, __Pyx_CYFUNCTION_CCLASS, __pyx_mstate_global->__pyx_n_u_VariantRecordInfo_itervalues, NULL, __pyx_mstate_global->__pyx_n_u_pysam_libcbcf, __pyx_mstate_global->__pyx_d, ((PyObject *)__pyx_mstate_global->__pyx_codeobj_tab[216])); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 2740, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  if (__Pyx_SetItemOnTypeDict(__pyx_mstate_global->__pyx_ptype_5pysam_7libcbcf_VariantRecordInfo, __pyx_mstate_global->__pyx_n_u_itervalues, __pyx_t_4) < 0) __PYX_ERR(0, 2740, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;

  /* "pysam/libcbcf.pyx":2758
 *                     yield bcf_info_get_value(self.record, info)
 * 
 *     def iteritems(self):             # <<<<<<<<<<<<<<
 *         """D.iteritems() -> an iterator over the (key, value) items of D"""
 *         cdef bcf_hdr_t *hdr = self.record.header.ptr
*/
  __pyx_t_4 = __Pyx_CyFunction_New(&__pyx_mdef_5pysam_7libcbcf_17VariantRecordInfo_27iteritems, __Pyx_CYFUNCTION_CCLASS, __pyx_mstate_global->__pyx_n_u_VariantRecordInfo_iteritems, NULL, __pyx_mstate_global->__pyx_n_u_pysam_libcbcf, __pyx_mstate_global->__pyx_d, ((PyObject *)__pyx_mstate_global->__pyx_codeobj_tab[217])); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 2758, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  if (__Pyx_SetItemOnTypeDict(__pyx_mstate_global->__pyx_ptype_5pysam_7libcbcf_VariantRecordInfo, __pyx_mstate_global->__pyx_n_u_iteritems, __pyx_t_4) < 0) __PYX_ERR(0, 2758, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;

  /* "pysam/libcbcf.pyx":2777
 *                     yield bcf_str_cache_get_charptr(key), value
 * 
 *     def keys(self):             # <<<<<<<<<<<<<<
 *         """D.keys() -> list of D's keys"""
 *         return list(self)
*/
  __pyx_t_4 = __Pyx_CyFunction_New(&__pyx_mdef_5pysam_7libcbcf_17VariantRecordInfo_30keys, __Pyx_CYFUNCTION_CCLASS, __pyx_mstate_global->__pyx_n_u_VariantRecordInfo_keys, NULL, __pyx_mstate_global->__pyx_n_u_pysam_libcbcf, __pyx_mstate_global->__pyx_d, ((PyObject *)__pyx_mstate_global->__pyx_codeobj_tab[218])); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 2777, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  if (__Pyx_SetItemOnTypeDict(__pyx_mstate_global->__pyx_ptype_5pysam_7libcbcf_VariantRecordInfo, __pyx_mstate_global->__pyx_n_u_keys, __pyx_t_4) < 0) __PYX_ERR(0, 2777, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;

  /* "pysam/libcbcf.pyx":2781
 *         return list(self)
 * 
 *     def items(self):             # <<<<<<<<<<<<<<
 *         """D.items() -> list of D's (key, value) pairs, as 2-tuples"""
 *         return list(self.iteritems())
*/
  __pyx_t_4 = __Pyx_CyFunction_New(&__pyx_mdef_5pysam_7libcbcf_17VariantRecordInfo_32items, __Pyx_CYFUNCTION_CCLASS, __pyx_mstate_global->__pyx_n_u_VariantRecordInfo_items, NULL, __pyx_mstate_global->__pyx_n_u_pysam_libcbcf, __pyx_mstate_global->__pyx_d, ((PyObject *)__pyx_mstate_global->__pyx_codeobj_tab[219])); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 2781, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  if (__Pyx_SetItemOnTypeDict(__pyx_mstate_global->__pyx_ptype_5pysam_7libcbcf_VariantRecordInfo, __pyx_mstate_global->__pyx_n_u_items, __pyx_t_4) < 0) __PYX_ERR(0, 2781, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;

  /* "pysam/libcbcf.pyx":2785
 *         return list(self.iteritems())
 * 
 *     def values(self):             # <<<<<<<<<<<<<<
 *         """D.values() -> list of D's values"""
 *         return list(self.itervalues())
*/
  __pyx_t_4 = __Pyx_CyFunction_New(&__pyx_mdef_5pysam_7libcbcf_17VariantRecordInfo_34values, __Pyx_CYFUNCTION_CCLASS, __pyx_mstate_global->__pyx_n_u_VariantRecordInfo_values, NULL, __pyx_mstate_global->__pyx_n_u_pysam_libcbcf, __pyx_mstate_global->__pyx_d, ((PyObject *)__pyx_mstate_global->__pyx_codeobj_tab[220])); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 2785, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  if (__Pyx_SetItemOnTypeDict(__pyx_mstate_global->__pyx_ptype_5pysam_7libcbcf_VariantRecordInfo, __pyx_mstate_global->__pyx_n_u_values, __pyx_t_4) < 0) __PYX_ERR(0, 2785, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;

  /* "pysam/libcbcf.pyx":2789
 *         return list(self.itervalues())
 * 
 *     def update(self, items=None, **kwargs):             # <<<<<<<<<<<<<<
 *         """D.update([E, ]**F) -> None.
 * 
*/
  __pyx_t_4 = __Pyx_CyFunction_New(&__pyx_mdef_5pysam_7libcbcf_17VariantRecordInfo_36update, __Pyx_CYFUNCTION_CCLASS, __pyx_mstate_global->__pyx_n_u_VariantRecordInfo_update, NULL, __pyx_mstate_global->__pyx_n_u_pysam_libcbcf, __pyx_mstate_global->__pyx_d, ((PyObject *)__pyx_mstate_global->__pyx_codeobj_tab[221])); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 2789, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  __Pyx_CyFunction_SetDefaultsTuple(__pyx_t_4, __pyx_mstate_global->__pyx_tuple[0]);
  if (__Pyx_SetItemOnTypeDict(__pyx_mstate_global->__pyx_ptype_5pysam_7libcbcf_VariantRecordInfo, __pyx_mstate_global->__pyx_n_u_update, __pyx_t_4) < 0) __PYX_ERR(0, 2789, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;

  /* "pysam/libcbcf.pyx":2803
 *                 self[k] = v
 * 
 *     def pop(self, key, default=_nothing):             # <<<<<<<<<<<<<<
 *         cdef bcf_hdr_t *hdr = self.record.header.ptr
 *         cdef bcf1_t *r = self.record.ptr
*/
  __Pyx_INCREF(__pyx_v_5pysam_7libcbcf__nothing);
  __pyx_mstate_global->__pyx_k__6 = __pyx_v_5pysam_7libcbcf__nothing;
  __Pyx_GIVEREF(__pyx_v_5pysam_7libcbcf__nothing);
  __pyx_t_4 = PyTuple_Pack(1, __pyx_v_5pysam_7libcbcf__nothing); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 2803, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  __pyx_t_3 = __Pyx_CyFunction_New(&__pyx_mdef_5pysam_7libcbcf_17VariantRecordInfo_38pop, __Pyx_CYFUNCTION_CCLASS, __pyx_mstate_global->__pyx_n_u_VariantRecordInfo_pop, NULL, __pyx_mstate_global->__pyx_n_u_pysam_libcbcf, __pyx_mstate_global->__pyx_d, ((PyObject *)__pyx_mstate_global->__pyx_codeobj_tab[222])); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 2803, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_CyFunction_SetDefaultsTuple(__pyx_t_3, __pyx_t_4);
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  if (__Pyx_SetItemOnTypeDict(__pyx_mstate_global->__pyx_ptype_5pysam_7libcbcf_VariantRecordInfo, __pyx_mstate_global->__pyx_n_u_pop, __pyx_t_3) < 0) __PYX_ERR(0, 2803, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;

  /* "pysam/libcbcf.pyx":2856
 * 
 *     # Mappings are not hashable by default, but subclasses can change this
 *     __hash__ = None             # <<<<<<<<<<<<<<
 * 
 * 
*/
  if (__Pyx_SetItemOnTypeDict(__pyx_mstate_global->__pyx_ptype_5pysam_7libcbcf_VariantRecordInfo, __pyx_mstate_global->__pyx_n_u_hash, Py_None) < 0) __PYX_ERR(0, 2856, __pyx_L1_error)

  /* "(tree fragment)":1
 * def __reduce_cython__(self):             # <<<<<<<<<<<<<<
 *     cdef tuple state
 *     cdef object _dict
*/
  __pyx_t_3 = __Pyx_CyFunction_New(&__pyx_mdef_5pysam_7libcbcf_17VariantRecordInfo_42__reduce_cython__, __Pyx_CYFUNCTION_CCLASS, __pyx_mstate_global->__pyx_n_u_VariantRecordInfo___reduce_cytho, NULL, __pyx_mstate_global->__pyx_n_u_pysam_libcbcf, __pyx_mstate_global->__pyx_d, ((PyObject *)__pyx_mstate_global->__pyx_codeobj_tab[224])); if (unlikely(!__pyx_t_3)) __PYX_ERR(4, 1, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  if (__Pyx_SetItemOnTypeDict(__pyx_mstate_global->__pyx_ptype_5pysam_7libcbcf_VariantRecordInfo, __pyx_mstate_global->__pyx_n_u_reduce_cython, __pyx_t_3) < 0) __PYX_ERR(4, 1, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;

  /* "(tree fragment)":16
 *     else:
 *         return __pyx_unpickle_VariantRecordInfo, (type(self), 0x70ce871, state)
 * def __setstate_cython__(self, __pyx_state):             # <<<<<<<<<<<<<<
 *     __pyx_unpickle_VariantRecordInfo__set_state(self, __pyx_state)
*/
  __pyx_t_3 = __Pyx_CyFunction_New(&__pyx_mdef_5pysam_7libcbcf_17VariantRecordInfo_44__setstate_cython__, __Pyx_CYFUNCTION_CCLASS, __pyx_mstate_global->__pyx_n_u_VariantRecordInfo___setstate_cyt, NULL, __pyx_mstate_global->__pyx_n_u_pysam_libcbcf, __pyx_mstate_global->__pyx_d, ((PyObject *)__pyx_mstate_global->__pyx_codeobj_tab[225])); if (unlikely(!__pyx_t_3)) __PYX_ERR(4, 16, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  if (__Pyx_SetItemOnTypeDict(__pyx_mstate_global->__pyx_ptype_5pysam_7libcbcf_VariantRecordInfo, __pyx_mstate_global->__pyx_n_u_setstate_cython, __pyx_t_3) < 0) __PYX_ERR(4, 16, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;

  /* "pysam/libcbcf.pyx":2909
 *             yield charptr_to_str(hdr.samples[i])
 * 
 *     def get(self, key, default=None):             # <<<<<<<<<<<<<<
 *         """D.get(k[,d]) -> D[k] if k in D, else d.  d defaults to None."""
 *         try:
*/
  __pyx_t_3 = __Pyx_CyFunction_New(&__pyx_mdef_5pysam_7libcbcf_20VariantRecordSamples_12get, __Pyx_CYFUNCTION_CCLASS, __pyx_mstate_global->__pyx_n_u_VariantRecordSamples_get, NULL, __pyx_mstate_global->__pyx_n_u_pysam_libcbcf, __pyx_mstate_global->__pyx_d, ((PyObject *)__pyx_mstate_global->__pyx_codeobj_tab[232])); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 2909, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_CyFunction_SetDefaultsTuple(__pyx_t_3, __pyx_mstate_global->__pyx_tuple[0]);
  if (__Pyx_SetItemOnTypeDict(__pyx_mstate_global->__pyx_ptype_5pysam_7libcbcf_VariantRecordSamples, __pyx_mstate_global->__pyx_n_u_get, __pyx_t_3) < 0) __PYX_ERR(0, 2909, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;

  /* "pysam/libcbcf.pyx":2934
 *         return 0 <= sample_index < n
 * 
 *     def iterkeys(self):             # <<<<<<<<<<<<<<
 *         """D.iterkeys() -> an iterator over the keys of D"""
 *         return iter(self)
*/
  __pyx_t_3 = __Pyx_CyFunction_New(&__pyx_mdef_5pysam_7libcbcf_20VariantRecordSamples_16iterkeys, __Pyx_CYFUNCTION_CCLASS, __pyx_mstate_global->__pyx_n_u_VariantRecordSamples_iterkeys, NULL, __pyx_mstate_global->__pyx_n_u_pysam_libcbcf, __pyx_mstate_global->__pyx_d, ((PyObject *)__pyx_mstate_global->__pyx_codeobj_tab[234])); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 2934, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  if (__Pyx_SetItemOnTypeDict(__pyx_mstate_global->__pyx_ptype_5pysam_7libcbcf_VariantRecordSamples, __pyx_mstate_global->__pyx_n_u_iterkeys, __pyx_t_3) < 0) __PYX_ERR(0, 2934, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;

  /* "pysam/libcbcf.pyx":2938
 *         return iter(self)
 * 
 *     def itervalues(self):             # <<<<<<<<<<<<<<
 *         """D.itervalues() -> an iterator over the values of D"""
 *         cdef bcf_hdr_t *hdr = self.record.header.ptr
*/
  __pyx_t_3 = __Pyx_CyFunction_New(&__pyx_mdef_5pysam_7libcbcf_20VariantRecordSamples_18itervalues, __Pyx_CYFUNCTION_CCLASS, __pyx_mstate_global->__pyx_n_u_VariantRecordSamples_itervalues, NULL, __pyx_mstate_global->__pyx_n_u_pysam_libcbcf, __pyx_mstate_global->__pyx_d, ((PyObject *)__pyx_mstate_global->__pyx_codeobj_tab[235])); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 2938, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  if (__Pyx_SetItemOnTypeDict(__pyx_mstate_global->__pyx_ptype_5pysam_7libcbcf_VariantRecordSamples, __pyx_mstate_global->__pyx_n_u_itervalues, __pyx_t_3) < 0) __PYX_ERR(0, 2938, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;

  /* "pysam/libcbcf.pyx":2947
 *             yield makeVariantRecordSample(self.record, i)
 * 
 *     def iteritems(self):             # <<<<<<<<<<<<<<
 *         """D.iteritems() -> an iterator over the (key, value) items of D"""
 *         cdef bcf_hdr_t *hdr = self.record.header.ptr
*/
  __pyx_t_3 = __Pyx_CyFunction_New(&__pyx_mdef_5pysam_7libcbcf_20VariantRecordSamples_21iteritems, __Pyx_CYFUNCTION_CCLASS, __pyx_mstate_global->__pyx_n_u_VariantRecordSamples_iteritems, NULL, __pyx_mstate_global->__pyx_n_u_pysam_libcbcf, __pyx_mstate_global->__pyx_d, ((PyObject *)__pyx_mstate_global->__pyx_codeobj_tab[236])); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 2947, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  if (__Pyx_SetItemOnTypeDict(__pyx_mstate_global->__pyx_ptype_5pysam_7libcbcf_VariantRecordSamples, __pyx_mstate_global->__pyx_n_u_iteritems, __pyx_t_3) < 0) __PYX_ERR(0, 2947, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;

  /* "pysam/libcbcf.pyx":2956
 *             yield (charptr_to_str(hdr.samples[i]), makeVariantRecordSample(self.record, i))
 * 
 *     def keys(self):             # <<<<<<<<<<<<<<
 *         """D.keys() -> list of D's keys"""
 *         return list(self)
*/
  __pyx_t_3 = __Pyx_CyFunction_New(&__pyx_mdef_5pysam_7libcbcf_20VariantRecordSamples_24keys, __Pyx_CYFUNCTION_CCLASS, __pyx_mstate_global->__pyx_n_u_VariantRecordSamples_keys, NULL, __pyx_mstate_global->__pyx_n_u_pysam_libcbcf, __pyx_mstate_global->__pyx_d, ((PyObject *)__pyx_mstate_global->__pyx_codeobj_tab[237])); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 2956, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  if (__Pyx_SetItemOnTypeDict(__pyx_mstate_global->__pyx_ptype_5pysam_7libcbcf_VariantRecordSamples, __pyx_mstate_global->__pyx_n_u_keys, __pyx_t_3) < 0) __PYX_ERR(0, 2956, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;

  /* "pysam/libcbcf.pyx":2960
 *         return list(self)
 * 
 *     def items(self):             # <<<<<<<<<<<<<<
 *         """D.items() -> list of D's (key, value) pairs, as 2-tuples"""
 *         return list(self.iteritems())
*/
  __pyx_t_3 = __Pyx_CyFunction_New(&__pyx_mdef_5pysam_7libcbcf_20VariantRecordSamples_26items, __Pyx_CYFUNCTION_CCLASS, __pyx_mstate_global->__pyx_n_u_VariantRecordSamples_items, NULL, __pyx_mstate_global->__pyx_n_u_pysam_libcbcf, __pyx_mstate_global->__pyx_d, ((PyObject *)__pyx_mstate_global->__pyx_codeobj_tab[238])); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 2960, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  if (__Pyx_SetItemOnTypeDict(__pyx_mstate_global->__pyx_ptype_5pysam_7libcbcf_VariantRecordSamples, __pyx_mstate_global->__pyx_n_u_items, __pyx_t_3) < 0) __PYX_ERR(0, 2960, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;

  /* "pysam/libcbcf.pyx":2964
 *         return list(self.iteritems())
 * 
 *     def values(self):             # <<<<<<<<<<<<<<
 *         """D.values() -> list of D's values"""
 *         return list(self.itervalues())
*/
  __pyx_t_3 = __Pyx_CyFunction_New(&__pyx_mdef_5pysam_7libcbcf_20VariantRecordSamples_28values, __Pyx_CYFUNCTION_CCLASS, __pyx_mstate_global->__pyx_n_u_VariantRecordSamples_values, NULL, __pyx_mstate_global->__pyx_n_u_pysam_libcbcf, __pyx_mstate_global->__pyx_d, ((PyObject *)__pyx_mstate_global->__pyx_codeobj_tab[239])); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 2964, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  if (__Pyx_SetItemOnTypeDict(__pyx_mstate_global->__pyx_ptype_5pysam_7libcbcf_VariantRecordSamples, __pyx_mstate_global->__pyx_n_u_values, __pyx_t_3) < 0) __PYX_ERR(0, 2964, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;

  /* "pysam/libcbcf.pyx":2968
 *         return list(self.itervalues())
 * 
 *     def update(self, items=None, **kwargs):             # <<<<<<<<<<<<<<
 *         """D.update([E, ]**F) -> None.
 * 
*/
  __pyx_t_3 = __Pyx_CyFunction_New(&__pyx_mdef_5pysam_7libcbcf_20VariantRecordSamples_30update, __Pyx_CYFUNCTION_CCLASS, __pyx_mstate_global->__pyx_n_u_VariantRecordSamples_update, NULL, __pyx_mstate_global->__pyx_n_u_pysam_libcbcf, __pyx_mstate_global->__pyx_d, ((PyObject *)__pyx_mstate_global->__pyx_codeobj_tab[240])); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 2968, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_CyFunction_SetDefaultsTuple(__pyx_t_3, __pyx_mstate_global->__pyx_tuple[0]);
  if (__Pyx_SetItemOnTypeDict(__pyx_mstate_global->__pyx_ptype_5pysam_7libcbcf_VariantRecordSamples, __pyx_mstate_global->__pyx_n_u_update, __pyx_t_3) < 0) __PYX_ERR(0, 2968, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;

  /* "pysam/libcbcf.pyx":2980
 *                 self[k] = v
 * 
 *     def pop(self, key, default=_nothing):             # <<<<<<<<<<<<<<
 *         try:
 *             value = self[key]
*/
  __Pyx_INCREF(__pyx_v_5pysam_7libcbcf__nothing);
  __pyx_mstate_global->__pyx_k__7 = __pyx_v_5pysam_7libcbcf__nothing;
  __Pyx_GIVEREF(__pyx_v_5pysam_7libcbcf__nothing);
  __pyx_t_3 = PyTuple_Pack(1, __pyx_v_5pysam_7libcbcf__nothing); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 2980, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __pyx_t_4 = __Pyx_CyFunction_New(&__pyx_mdef_5pysam_7libcbcf_20VariantRecordSamples_32pop, __Pyx_CYFUNCTION_CCLASS, __pyx_mstate_global->__pyx_n_u_VariantRecordSamples_pop, NULL, __pyx_mstate_global->__pyx_n_u_pysam_libcbcf, __pyx_mstate_global->__pyx_d, ((PyObject *)__pyx_mstate_global->__pyx_codeobj_tab[241])); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 2980, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  __Pyx_CyFunction_SetDefaultsTuple(__pyx_t_4, __pyx_t_3);
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  if (__Pyx_SetItemOnTypeDict(__pyx_mstate_global->__pyx_ptype_5pysam_7libcbcf_VariantRecordSamples, __pyx_mstate_global->__pyx_n_u_pop, __pyx_t_4) < 0) __PYX_ERR(0, 2980, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;

  /* "pysam/libcbcf.pyx":3005
 * 
 *     # Mappings are not hashable by default, but subclasses can change this
 *     __hash__ = None             # <<<<<<<<<<<<<<
 * 
 * 
*/
  if (__Pyx_SetItemOnTypeDict(__pyx_mstate_global->__pyx_ptype_5pysam_7libcbcf_VariantRecordSamples, __pyx_mstate_global->__pyx_n_u_hash, Py_None) < 0) __PYX_ERR(0, 3005, __pyx_L1_error)

  /* "(tree fragment)":1
 * def __reduce_cython__(self):             # <<<<<<<<<<<<<<
 *     cdef tuple state
 *     cdef object _dict
*/
  __pyx_t_4 = __Pyx_CyFunction_New(&__pyx_mdef_5pysam_7libcbcf_20VariantRecordSamples_36__reduce_cython__, __Pyx_CYFUNCTION_CCLASS, __pyx_mstate_global->__pyx_n_u_VariantRecordSamples___reduce_cy, NULL, __pyx_mstate_global->__pyx_n_u_pysam_libcbcf, __pyx_mstate_global->__pyx_d, ((PyObject *)__pyx_mstate_global->__pyx_codeobj_tab[243])); if (unlikely(!__pyx_t_4)) __PYX_ERR(4, 1, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  if (__Pyx_SetItemOnTypeDict(__pyx_mstate_global->__pyx_ptype_5pysam_7libcbcf_VariantRecordSamples, __pyx_mstate_global->__pyx_n_u_reduce_cython, __pyx_t_4) < 0) __PYX_ERR(4, 1, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;

  /* "(tree fragment)":16
 *     else:
 *         return __pyx_unpickle_VariantRecordSamples, (type(self), 0x70ce871, state)
 * def __setstate_cython__(self, __pyx_state):             # <<<<<<<<<<<<<<
 *     __pyx_unpickle_VariantRecordSamples__set_state(self, __pyx_state)
*/
  __pyx_t_4 = __Pyx_CyFunction_New(&__pyx_mdef_5pysam_7libcbcf_20VariantRecordSamples_38__setstate_cython__, __Pyx_CYFUNCTION_CCLASS, __pyx_mstate_global->__pyx_n_u_VariantRecordSamples___setstate, NULL, __pyx_mstate_global->__pyx_n_u_pysam_libcbcf, __pyx_mstate_global->__pyx_d, ((PyObject *)__pyx_mstate_global->__pyx_codeobj_tab[244])); if (unlikely(!__pyx_t_4)) __PYX_ERR(4, 16, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  if (__Pyx_SetItemOnTypeDict(__pyx_mstate_global->__pyx_ptype_5pysam_7libcbcf_VariantRecordSamples, __pyx_mstate_global->__pyx_n_u_setstate_cython, __pyx_t_4) < 0) __PYX_ERR(4, 16, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;

  /* "pysam/libcbcf.pyx":3029
 *             self.ptr = NULL
 * 
 *     def copy(self):             # <<<<<<<<<<<<<<
 *         """return a copy of this VariantRecord object"""
 *         return makeVariantRecord(self.header, bcf_dup(self.ptr))
*/
  __pyx_t_4 = __Pyx_CyFunction_New(&__pyx_mdef_5pysam_7libcbcf_13VariantRecord_5copy, __Pyx_CYFUNCTION_CCLASS, __pyx_mstate_global->__pyx_n_u_VariantRecord_copy, NULL, __pyx_mstate_global->__pyx_n_u_pysam_libcbcf, __pyx_mstate_global->__pyx_d, ((PyObject *)__pyx_mstate_global->__pyx_codeobj_tab[248])); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 3029, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  if (__Pyx_SetItemOnTypeDict(__pyx_mstate_global->__pyx_ptype_5pysam_7libcbcf_VariantRecord, __pyx_mstate_global->__pyx_n_u_copy, __pyx_t_4) < 0) __PYX_ERR(0, 3029, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;

  /* "pysam/libcbcf.pyx":3033
 *         return makeVariantRecord(self.header, bcf_dup(self.ptr))
 * 
 *     def translate(self, VariantHeader dst_header):             # <<<<<<<<<<<<<<
 *         if dst_header is None:
 *             raise ValueError('dst_header must not be None')
*/
  __pyx_t_4 = __Pyx_CyFunction_New(&__pyx_mdef_5pysam_7libcbcf_13VariantRecord_7translate, __Pyx_CYFUNCTION_CCLASS, __pyx_mstate_global->__pyx_n_u_VariantRecord_translate, NULL, __pyx_mstate_global->__pyx_n_u_pysam_libcbcf, __pyx_mstate_global->__pyx_d, ((PyObject *)__pyx_mstate_global->__pyx_codeobj_tab[249])); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 3033, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  if (__Pyx_SetItemOnTypeDict(__pyx_mstate_global->__pyx_ptype_5pysam_7libcbcf_VariantRecord, __pyx_mstate_global->__pyx_n_u_translate, __pyx_t_4) < 0) __PYX_ERR(0, 3033, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;

  /* "(tree fragment)":1
 * def __reduce_cython__(self):             # <<<<<<<<<<<<<<
 *     raise TypeError, "self.ptr cannot be converted to a Python object for pickling"
 * def __setstate_cython__(self, __pyx_state):
*/
  __pyx_t_4 = __Pyx_CyFunction_New(&__pyx_mdef_5pysam_7libcbcf_13VariantRecord_13__reduce_cython__, __Pyx_CYFUNCTION_CCLASS, __pyx_mstate_global->__pyx_n_u_VariantRecord___reduce_cython, NULL, __pyx_mstate_global->__pyx_n_u_pysam_libcbcf, __pyx_mstate_global->__pyx_d, ((PyObject *)__pyx_mstate_global->__pyx_codeobj_tab[282])); if (unlikely(!__pyx_t_4)) __PYX_ERR(4, 1, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  if (PyDict_SetItem(__pyx_mstate_global->__pyx_d, __pyx_mstate_global->__pyx_n_u_reduce_cython, __pyx_t_4) < 0) __PYX_ERR(4, 1, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;

  /* "(tree fragment)":3
 * def __reduce_cython__(self):
 *     raise TypeError, "self.ptr cannot be converted to a Python object for pickling"
 * def __setstate_cython__(self, __pyx_state):             # <<<<<<<<<<<<<<
 *     raise TypeError, "self.ptr cannot be converted to a Python object for pickling"
*/
  __pyx_t_4 = __Pyx_CyFunction_New(&__pyx_mdef_5pysam_7libcbcf_13VariantRecord_15__setstate_cython__, __Pyx_CYFUNCTION_CCLASS, __pyx_mstate_global->__pyx_n_u_VariantRecord___setstate_cython, NULL, __pyx_mstate_global->__pyx_n_u_pysam_libcbcf, __pyx_mstate_global->__pyx_d, ((PyObject *)__pyx_mstate_global->__pyx_codeobj_tab[283])); if (unlikely(!__pyx_t_4)) __PYX_ERR(4, 3, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  if (PyDict_SetItem(__pyx_mstate_global->__pyx_d, __pyx_mstate_global->__pyx_n_u_setstate_cython, __pyx_t_4) < 0) __PYX_ERR(4, 3, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;

  /* "pysam/libcbcf.pyx":3547
 *         bcf_format_del_value(self, key)
 * 
 *     def clear(self):             # <<<<<<<<<<<<<<
 *         """Clear all format data (including genotype) for this sample"""
 *         cdef bcf_hdr_t *hdr = self.record.header.ptr
*/
  __pyx_t_4 = __Pyx_CyFunction_New(&__pyx_mdef_5pysam_7libcbcf_19VariantRecordSample_13clear, __Pyx_CYFUNCTION_CCLASS, __pyx_mstate_global->__pyx_n_u_VariantRecordSample_clear, NULL, __pyx_mstate_global->__pyx_n_u_pysam_libcbcf, __pyx_mstate_global->__pyx_d, ((PyObject *)__pyx_mstate_global->__pyx_codeobj_tab[302])); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 3547, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  if (__Pyx_SetItemOnTypeDict(__pyx_mstate_global->__pyx_ptype_5pysam_7libcbcf_VariantRecordSample, __pyx_mstate_global->__pyx_n_u_clear, __pyx_t_4) < 0) __PYX_ERR(0, 3547, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;

  /* "pysam/libcbcf.pyx":3570
 *                 yield bcf_str_cache_get_charptr(bcf_hdr_int2id(hdr, BCF_DT_ID, fmt.id))
 * 
 *     def get(self, key, default=None):             # <<<<<<<<<<<<<<
 *         """D.get(k[,d]) -> D[k] if k in D, else d.  d defaults to None."""
 *         try:
*/
  __pyx_t_4 = __Pyx_CyFunction_New(&__pyx_mdef_5pysam_7libcbcf_19VariantRecordSample_18get, __Pyx_CYFUNCTION_CCLASS, __pyx_mstate_global->__pyx_n_u_VariantRecordSample_get, NULL, __pyx_mstate_global->__pyx_n_u_pysam_libcbcf, __pyx_mstate_global->__pyx_d, ((PyObject *)__pyx_mstate_global->__pyx_codeobj_tab[304])); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 3570, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  __Pyx_CyFunction_SetDefaultsTuple(__pyx_t_4, __pyx_mstate_global->__pyx_tuple[0]);
  if (__Pyx_SetItemOnTypeDict(__pyx_mstate_global->__pyx_ptype_5pysam_7libcbcf_VariantRecordSample, __pyx_mstate_global->__pyx_n_u_get, __pyx_t_4) < 0) __PYX_ERR(0, 3570, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;

  /* "pysam/libcbcf.pyx":3584
 *         return fmt != NULL and fmt.p != NULL
 * 
 *     def iterkeys(self):             # <<<<<<<<<<<<<<
 *         """D.iterkeys() -> an iterator over the keys of D"""
 *         return iter(self)
*/
  __pyx_t_4 = __Pyx_CyFunction_New(&__pyx_mdef_5pysam_7libcbcf_19VariantRecordSample_22iterkeys, __Pyx_CYFUNCTION_CCLASS, __pyx_mstate_global->__pyx_n_u_VariantRecordSample_iterkeys, NULL, __pyx_mstate_global->__pyx_n_u_pysam_libcbcf, __pyx_mstate_global->__pyx_d, ((PyObject *)__pyx_mstate_global->__pyx_codeobj_tab[306])); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 3584, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  if (__Pyx_SetItemOnTypeDict(__pyx_mstate_global->__pyx_ptype_5pysam_7libcbcf_VariantRecordSample, __pyx_mstate_global->__pyx_n_u_iterkeys, __pyx_t_4) < 0) __PYX_ERR(0, 3584, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;

  /* "pysam/libcbcf.pyx":3588
 *         return iter(self)
 * 
 *     def itervalues(self):             # <<<<<<<<<<<<<<
 *         """D.itervalues() -> an iterator over the values of D"""
 *         for key in self:
*/
  __pyx_t_4 = __Pyx_CyFunction_New(&__pyx_mdef_5pysam_7libcbcf_19VariantRecordSample_24itervalues, __Pyx_CYFUNCTION_CCLASS, __pyx_mstate_global->__pyx_n_u_VariantRecordSample_itervalues, NULL, __pyx_mstate_global->__pyx_n_u_pysam_libcbcf, __pyx_mstate_global->__pyx_d, ((PyObject *)__pyx_mstate_global->__pyx_codeobj_tab[307])); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 3588, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  if (__Pyx_SetItemOnTypeDict(__pyx_mstate_global->__pyx_ptype_5pysam_7libcbcf_VariantRecordSample, __pyx_mstate_global->__pyx_n_u_itervalues, __pyx_t_4) < 0) __PYX_ERR(0, 3588, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;

  /* "pysam/libcbcf.pyx":3593
 *             yield self[key]
 * 
 *     def iteritems(self):             # <<<<<<<<<<<<<<
 *         """D.iteritems() -> an iterator over the (key, value) items of D"""
 *         for key in self:
*/
  __pyx_t_4 = __Pyx_CyFunction_New(&__pyx_mdef_5pysam_7libcbcf_19VariantRecordSample_27iteritems, __Pyx_CYFUNCTION_CCLASS, __pyx_mstate_global->__pyx_n_u_VariantRecordSample_iteritems, NULL, __pyx_mstate_global->__pyx_n_u_pysam_libcbcf, __pyx_mstate_global->__pyx_d, ((PyObject *)__pyx_mstate_global->__pyx_codeobj_tab[308])); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 3593, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  if (__Pyx_SetItemOnTypeDict(__pyx_mstate_global->__pyx_ptype_5pysam_7libcbcf_VariantRecordSample, __pyx_mstate_global->__pyx_n_u_iteritems, __pyx_t_4) < 0) __PYX_ERR(0, 3593, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;

  /* "pysam/libcbcf.pyx":3598
 *             yield (key, self[key])
 * 
 *     def keys(self):             # <<<<<<<<<<<<<<
 *         """D.keys() -> list of D's keys"""
 *         return list(self)
*/
  __pyx_t_4 = __Pyx_CyFunction_New(&__pyx_mdef_5pysam_7libcbcf_19VariantRecordSample_30keys, __Pyx_CYFUNCTION_CCLASS, __pyx_mstate_global->__pyx_n_u_VariantRecordSample_keys, NULL, __pyx_mstate_global->__pyx_n_u_pysam_libcbcf, __pyx_mstate_global->__pyx_d, ((PyObject *)__pyx_mstate_global->__pyx_codeobj_tab[309])); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 3598, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  if (__Pyx_SetItemOnTypeDict(__pyx_mstate_global->__pyx_ptype_5pysam_7libcbcf_VariantRecordSample, __pyx_mstate_global->__pyx_n_u_keys, __pyx_t_4) < 0) __PYX_ERR(0, 3598, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;

  /* "pysam/libcbcf.pyx":3602
 *         return list(self)
 * 
 *     def items(self):             # <<<<<<<<<<<<<<
 *         """D.items() -> list of D's (key, value) pairs, as 2-tuples"""
 *         return list(self.iteritems())
*/
  __pyx_t_4 = __Pyx_CyFunction_New(&__pyx_mdef_5pysam_7libcbcf_19VariantRecordSample_32items, __Pyx_CYFUNCTION_CCLASS, __pyx_mstate_global->__pyx_n_u_VariantRecordSample_items, NULL, __pyx_mstate_global->__pyx_n_u_pysam_libcbcf, __pyx_mstate_global->__pyx_d, ((PyObject *)__pyx_mstate_global->__pyx_codeobj_tab[310])); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 3602, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  if (__Pyx_SetItemOnTypeDict(__pyx_mstate_global->__pyx_ptype_5pysam_7libcbcf_VariantRecordSample, __pyx_mstate_global->__pyx_n_u_items, __pyx_t_4) < 0) __PYX_ERR(0, 3602, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;

  /* "pysam/libcbcf.pyx":3606
 *         return list(self.iteritems())
 * 
 *     def values(self):             # <<<<<<<<<<<<<<
 *         """D.values() -> list of D's values"""
 *         return list(self.itervalues())
*/
  __pyx_t_4 = __Pyx_CyFunction_New(&__pyx_mdef_5pysam_7libcbcf_19VariantRecordSample_34values, __Pyx_CYFUNCTION_CCLASS, __pyx_mstate_global->__pyx_n_u_VariantRecordSample_values, NULL, __pyx_mstate_global->__pyx_n_u_pysam_libcbcf, __pyx_mstate_global->__pyx_d, ((PyObject *)__pyx_mstate_global->__pyx_codeobj_tab[311])); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 3606, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  if (__Pyx_SetItemOnTypeDict(__pyx_mstate_global->__pyx_ptype_5pysam_7libcbcf_VariantRecordSample, __pyx_mstate_global->__pyx_n_u_values, __pyx_t_4) < 0) __PYX_ERR(0, 3606, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;

  /* "pysam/libcbcf.pyx":3610
 *         return list(self.itervalues())
 * 
 *     def update(self, items=None, **kwargs):             # <<<<<<<<<<<<<<
 *         """D.update([E, ]**F) -> None.
 * 
*/
  __pyx_t_4 = __Pyx_CyFunction_New(&__pyx_mdef_5pysam_7libcbcf_19VariantRecordSample_36update, __Pyx_CYFUNCTION_CCLASS, __pyx_mstate_global->__pyx_n_u_VariantRecordSample_update, NULL, __pyx_mstate_global->__pyx_n_u_pysam_libcbcf, __pyx_mstate_global->__pyx_d, ((PyObject *)__pyx_mstate_global->__pyx_codeobj_tab[312])); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 3610, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  __Pyx_CyFunction_SetDefaultsTuple(__pyx_t_4, __pyx_mstate_global->__pyx_tuple[0]);
  if (__Pyx_SetItemOnTypeDict(__pyx_mstate_global->__pyx_ptype_5pysam_7libcbcf_VariantRecordSample, __pyx_mstate_global->__pyx_n_u_update, __pyx_t_4) < 0) __PYX_ERR(0, 3610, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;

  /* "pysam/libcbcf.pyx":3622
 *                 self[k] = v
 * 
 *     def pop(self, key, default=_nothing):             # <<<<<<<<<<<<<<
 *         try:
 *             value = self[key]
*/
  __Pyx_INCREF(__pyx_v_5pysam_7libcbcf__nothing);
  __pyx_mstate_global->__pyx_k__9 = __pyx_v_5pysam_7libcbcf__nothing;
  __Pyx_GIVEREF(__pyx_v_5pysam_7libcbcf__nothing);
  __pyx_t_4 = PyTuple_Pack(1, __pyx_v_5pysam_7libcbcf__nothing); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 3622, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  __pyx_t_3 = __Pyx_CyFunction_New(&__pyx_mdef_5pysam_7libcbcf_19VariantRecordSample_38pop, __Pyx_CYFUNCTION_CCLASS, __pyx_mstate_global->__pyx_n_u_VariantRecordSample_pop, NULL, __pyx_mstate_global->__pyx_n_u_pysam_libcbcf, __pyx_mstate_global->__pyx_d, ((PyObject *)__pyx_mstate_global->__pyx_codeobj_tab[313])); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 3622, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_CyFunction_SetDefaultsTuple(__pyx_t_3, __pyx_t_4);
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  if (__Pyx_SetItemOnTypeDict(__pyx_mstate_global->__pyx_ptype_5pysam_7libcbcf_VariantRecordSample, __pyx_mstate_global->__pyx_n_u_pop, __pyx_t_3) < 0) __PYX_ERR(0, 3622, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;

  /* "pysam/libcbcf.pyx":3644
 * 
 *     # Mappings are not hashable by default, but subclasses can change this
 *     __hash__ = None             # <<<<<<<<<<<<<<
 * 
 * 
*/
  if (__Pyx_SetItemOnTypeDict(__pyx_mstate_global->__pyx_ptype_5pysam_7libcbcf_VariantRecordSample, __pyx_mstate_global->__pyx_n_u_hash, Py_None) < 0) __PYX_ERR(0, 3644, __pyx_L1_error)

  /* "(tree fragment)":1
 * def __reduce_cython__(self):             # <<<<<<<<<<<<<<
 *     cdef tuple state
 *     cdef object _dict
*/
  __pyx_t_3 = __Pyx_CyFunction_New(&__pyx_mdef_5pysam_7libcbcf_19VariantRecordSample_42__reduce_cython__, __Pyx_CYFUNCTION_CCLASS, __pyx_mstate_global->__pyx_n_u_VariantRecordSample___reduce_cyt, NULL, __pyx_mstate_global->__pyx_n_u_pysam_libcbcf, __pyx_mstate_global->__pyx_d, ((PyObject *)__pyx_mstate_global->__pyx_codeobj_tab[316])); if (unlikely(!__pyx_t_3)) __PYX_ERR(4, 1, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  if (__Pyx_SetItemOnTypeDict(__pyx_mstate_global->__pyx_ptype_5pysam_7libcbcf_VariantRecordSample, __pyx_mstate_global->__pyx_n_u_reduce_cython, __pyx_t_3) < 0) __PYX_ERR(4, 1, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;

  /* "(tree fragment)":16
 *     else:
 *         return __pyx_unpickle_VariantRecordSample, (type(self), 0xeeb89f3, state)
 * def __setstate_cython__(self, __pyx_state):             # <<<<<<<<<<<<<<
 *     __pyx_unpickle_VariantRecordSample__set_state(self, __pyx_state)
*/
  __pyx_t_3 = __Pyx_CyFunction_New(&__pyx_mdef_5pysam_7libcbcf_19VariantRecordSample_44__setstate_cython__, __Pyx_CYFUNCTION_CCLASS, __pyx_mstate_global->__pyx_n_u_VariantRecordSample___setstate_c, NULL, __pyx_mstate_global->__pyx_n_u_pysam_libcbcf, __pyx_mstate_global->__pyx_d, ((PyObject *)__pyx_mstate_global->__pyx_codeobj_tab[317])); if (unlikely(!__pyx_t_3)) __PYX_ERR(4, 16, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  if (__Pyx_SetItemOnTypeDict(__pyx_mstate_global->__pyx_ptype_5pysam_7libcbcf_VariantRecordSample, __pyx_mstate_global->__pyx_n_u_setstate_cython, __pyx_t_3) < 0) __PYX_ERR(4, 16, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;

  /* "pysam/libcbcf.pyx":3684
 *         return iter(self.refs)
 * 
 *     def get(self, key, default=None):             # <<<<<<<<<<<<<<
 *         """D.get(k[,d]) -> D[k] if k in D, else d.  d defaults to None."""
 *         try:
*/
  __pyx_t_3 = __Pyx_CyFunction_New(&__pyx_mdef_5pysam_7libcbcf_9BaseIndex_11get, __Pyx_CYFUNCTION_CCLASS, __pyx_mstate_global->__pyx_n_u_BaseIndex_get, NULL, __pyx_mstate_global->__pyx_n_u_pysam_libcbcf, __pyx_mstate_global->__pyx_d, ((PyObject *)__pyx_mstate_global->__pyx_codeobj_tab[324])); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 3684, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_CyFunction_SetDefaultsTuple(__pyx_t_3, __pyx_mstate_global->__pyx_tuple[0]);
  if (__Pyx_SetItemOnTypeDict(__pyx_mstate_global->__pyx_ptype_5pysam_7libcbcf_BaseIndex, __pyx_mstate_global->__pyx_n_u_get, __pyx_t_3) < 0) __PYX_ERR(0, 3684, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;

  /* "pysam/libcbcf.pyx":3699
 *             return True
 * 
 *     def iterkeys(self):             # <<<<<<<<<<<<<<
 *         """D.iterkeys() -> an iterator over the keys of D"""
 *         return iter(self)
*/
  __pyx_t_3 = __Pyx_CyFunction_New(&__pyx_mdef_5pysam_7libcbcf_9BaseIndex_15iterkeys, __Pyx_CYFUNCTION_CCLASS, __pyx_mstate_global->__pyx_n_u_BaseIndex_iterkeys, NULL, __pyx_mstate_global->__pyx_n_u_pysam_libcbcf, __pyx_mstate_global->__pyx_d, ((PyObject *)__pyx_mstate_global->__pyx_codeobj_tab[326])); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 3699, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  if (__Pyx_SetItemOnTypeDict(__pyx_mstate_global->__pyx_ptype_5pysam_7libcbcf_BaseIndex, __pyx_mstate_global->__pyx_n_u_iterkeys, __pyx_t_3) < 0) __PYX_ERR(0, 3699, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;

  /* "pysam/libcbcf.pyx":3703
 *         return iter(self)
 * 
 *     def itervalues(self):             # <<<<<<<<<<<<<<
 *         """D.itervalues() -> an iterator over the values of D"""
 *         for key in self:
*/
  __pyx_t_3 = __Pyx_CyFunction_New(&__pyx_mdef_5pysam_7libcbcf_9BaseIndex_17itervalues, __Pyx_CYFUNCTION_CCLASS, __pyx_mstate_global->__pyx_n_u_BaseIndex_itervalues, NULL, __pyx_mstate_global->__pyx_n_u_pysam_libcbcf, __pyx_mstate_global->__pyx_d, ((PyObject *)__pyx_mstate_global->__pyx_codeobj_tab[327])); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 3703, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  if (__Pyx_SetItemOnTypeDict(__pyx_mstate_global->__pyx_ptype_5pysam_7libcbcf_BaseIndex, __pyx_mstate_global->__pyx_n_u_itervalues, __pyx_t_3) < 0) __PYX_ERR(0, 3703, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;

  /* "pysam/libcbcf.pyx":3708
 *             yield self[key]
 * 
 *     def iteritems(self):             # <<<<<<<<<<<<<<
 *         """D.iteritems() -> an iterator over the (key, value) items of D"""
 *         for key in self:
*/
  __pyx_t_3 = __Pyx_CyFunction_New(&__pyx_mdef_5pysam_7libcbcf_9BaseIndex_20iteritems, __Pyx_CYFUNCTION_CCLASS, __pyx_mstate_global->__pyx_n_u_BaseIndex_iteritems, NULL, __pyx_mstate_global->__pyx_n_u_pysam_libcbcf, __pyx_mstate_global->__pyx_d, ((PyObject *)__pyx_mstate_global->__pyx_codeobj_tab[328])); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 3708, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  if (__Pyx_SetItemOnTypeDict(__pyx_mstate_global->__pyx_ptype_5pysam_7libcbcf_BaseIndex, __pyx_mstate_global->__pyx_n_u_iteritems, __pyx_t_3) < 0) __PYX_ERR(0, 3708, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;

  /* "pysam/libcbcf.pyx":3713
 *             yield (key, self[key])
 * 
 *     def keys(self):             # <<<<<<<<<<<<<<
 *         """D.keys() -> list of D's keys"""
 *         return list(self)
*/
  __pyx_t_3 = __Pyx_CyFunction_New(&__pyx_mdef_5pysam_7libcbcf_9BaseIndex_23keys, __Pyx_CYFUNCTION_CCLASS, __pyx_mstate_global->__pyx_n_u_BaseIndex_keys, NULL, __pyx_mstate_global->__pyx_n_u_pysam_libcbcf, __pyx_mstate_global->__pyx_d, ((PyObject *)__pyx_mstate_global->__pyx_codeobj_tab[329])); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 3713, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  if (__Pyx_SetItemOnTypeDict(__pyx_mstate_global->__pyx_ptype_5pysam_7libcbcf_BaseIndex, __pyx_mstate_global->__pyx_n_u_keys, __pyx_t_3) < 0) __PYX_ERR(0, 3713, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;

  /* "pysam/libcbcf.pyx":3717
 *         return list(self)
 * 
 *     def items(self):             # <<<<<<<<<<<<<<
 *         """D.items() -> list of D's (key, value) pairs, as 2-tuples"""
 *         return list(self.iteritems())
*/
  __pyx_t_3 = __Pyx_CyFunction_New(&__pyx_mdef_5pysam_7libcbcf_9BaseIndex_25items, __Pyx_CYFUNCTION_CCLASS, __pyx_mstate_global->__pyx_n_u_BaseIndex_items, NULL, __pyx_mstate_global->__pyx_n_u_pysam_libcbcf, __pyx_mstate_global->__pyx_d, ((PyObject *)__pyx_mstate_global->__pyx_codeobj_tab[330])); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 3717, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  if (__Pyx_SetItemOnTypeDict(__pyx_mstate_global->__pyx_ptype_5pysam_7libcbcf_BaseIndex, __pyx_mstate_global->__pyx_n_u_items, __pyx_t_3) < 0) __PYX_ERR(0, 3717, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;

  /* "pysam/libcbcf.pyx":3721
 *         return list(self.iteritems())
 * 
 *     def values(self):             # <<<<<<<<<<<<<<
 *         """D.values() -> list of D's values"""
 *         return list(self.itervalues())
*/
  __pyx_t_3 = __Pyx_CyFunction_New(&__pyx_mdef_5pysam_7libcbcf_9BaseIndex_27values, __Pyx_CYFUNCTION_CCLASS, __pyx_mstate_global->__pyx_n_u_BaseIndex_values, NULL, __pyx_mstate_global->__pyx_n_u_pysam_libcbcf, __pyx_mstate_global->__pyx_d, ((PyObject *)__pyx_mstate_global->__pyx_codeobj_tab[331])); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 3721, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  if (__Pyx_SetItemOnTypeDict(__pyx_mstate_global->__pyx_ptype_5pysam_7libcbcf_BaseIndex, __pyx_mstate_global->__pyx_n_u_values, __pyx_t_3) < 0) __PYX_ERR(0, 3721, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;

  /* "pysam/libcbcf.pyx":3725
 *         return list(self.itervalues())
 * 
 *     def update(self, items=None, **kwargs):             # <<<<<<<<<<<<<<
 *         """D.update([E, ]**F) -> None.
 * 
*/
  __pyx_t_3 = __Pyx_CyFunction_New(&__pyx_mdef_5pysam_7libcbcf_9BaseIndex_29update, __Pyx_CYFUNCTION_CCLASS, __pyx_mstate_global->__pyx_n_u_BaseIndex_update, NULL, __pyx_mstate_global->__pyx_n_u_pysam_libcbcf, __pyx_mstate_global->__pyx_d, ((PyObject *)__pyx_mstate_global->__pyx_codeobj_tab[332])); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 3725, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_CyFunction_SetDefaultsTuple(__pyx_t_3, __pyx_mstate_global->__pyx_tuple[0]);
  if (__Pyx_SetItemOnTypeDict(__pyx_mstate_global->__pyx_ptype_5pysam_7libcbcf_BaseIndex, __pyx_mstate_global->__pyx_n_u_update, __pyx_t_3) < 0) __PYX_ERR(0, 3725, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;

  /* "pysam/libcbcf.pyx":3737
 *                 self[k] = v
 * 
 *     def pop(self, key, default=_nothing):             # <<<<<<<<<<<<<<
 *         try:
 *             value = self[key]
*/
  __Pyx_INCREF(__pyx_v_5pysam_7libcbcf__nothing);
  __pyx_mstate_global->__pyx_k__10 = __pyx_v_5pysam_7libcbcf__nothing;
  __Pyx_GIVEREF(__pyx_v_5pysam_7libcbcf__nothing);
  __pyx_t_3 = PyTuple_Pack(1, __pyx_v_5pysam_7libcbcf__nothing); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 3737, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __pyx_t_4 = __Pyx_CyFunction_New(&__pyx_mdef_5pysam_7libcbcf_9BaseIndex_31pop, __Pyx_CYFUNCTION_CCLASS, __pyx_mstate_global->__pyx_n_u_BaseIndex_pop, NULL, __pyx_mstate_global->__pyx_n_u_pysam_libcbcf, __pyx_mstate_global->__pyx_d, ((PyObject *)__pyx_mstate_global->__pyx_codeobj_tab[333])); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 3737, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  __Pyx_CyFunction_SetDefaultsTuple(__pyx_t_4, __pyx_t_3);
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  if (__Pyx_SetItemOnTypeDict(__pyx_mstate_global->__pyx_ptype_5pysam_7libcbcf_BaseIndex, __pyx_mstate_global->__pyx_n_u_pop, __pyx_t_4) < 0) __PYX_ERR(0, 3737, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;

  /* "pysam/libcbcf.pyx":3748
 * 
 *     # Mappings are not hashable by default, but subclasses can change this
 *     __hash__ = None             # <<<<<<<<<<<<<<
 * 
 *     #TODO: implement __richcmp__
*/
  if (__Pyx_SetItemOnTypeDict(__pyx_mstate_global->__pyx_ptype_5pysam_7libcbcf_BaseIndex, __pyx_mstate_global->__pyx_n_u_hash, Py_None) < 0) __PYX_ERR(0, 3748, __pyx_L1_error)

  /* "(tree fragment)":1
 * def __reduce_cython__(self):             # <<<<<<<<<<<<<<
 *     cdef tuple state
 *     cdef object _dict
*/
  __pyx_t_4 = __Pyx_CyFunction_New(&__pyx_mdef_5pysam_7libcbcf_9BaseIndex_33__reduce_cython__, __Pyx_CYFUNCTION_CCLASS, __pyx_mstate_global->__pyx_n_u_BaseIndex___reduce_cython, NULL, __pyx_mstate_global->__pyx_n_u_pysam_libcbcf, __pyx_mstate_global->__pyx_d, ((PyObject *)__pyx_mstate_global->__pyx_codeobj_tab[334])); if (unlikely(!__pyx_t_4)) __PYX_ERR(4, 1, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  if (__Pyx_SetItemOnTypeDict(__pyx_mstate_global->__pyx_ptype_5pysam_7libcbcf_BaseIndex, __pyx_mstate_global->__pyx_n_u_reduce_cython, __pyx_t_4) < 0) __PYX_ERR(4, 1, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;

  /* "(tree fragment)":16
 *     else:
 *         return __pyx_unpickle_BaseIndex, (type(self), 0x7898a51, state)
 * def __setstate_cython__(self, __pyx_state):             # <<<<<<<<<<<<<<
 *     __pyx_unpickle_BaseIndex__set_state(self, __pyx_state)
*/
  __pyx_t_4 = __Pyx_CyFunction_New(&__pyx_mdef_5pysam_7libcbcf_9BaseIndex_35__setstate_cython__, __Pyx_CYFUNCTION_CCLASS, __pyx_mstate_global->__pyx_n_u_BaseIndex___setstate_cython, NULL, __pyx_mstate_global->__pyx_n_u_pysam_libcbcf, __pyx_mstate_global->__pyx_d, ((PyObject *)__pyx_mstate_global->__pyx_codeobj_tab[335])); if (unlikely(!__pyx_t_4)) __PYX_ERR(4, 16, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  if (__Pyx_SetItemOnTypeDict(__pyx_mstate_global->__pyx_ptype_5pysam_7libcbcf_BaseIndex, __pyx_mstate_global->__pyx_n_u_setstate_cython, __pyx_t_4) < 0) __PYX_ERR(4, 16, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;

  /* "pysam/libcbcf.pyx":3773
 *             self.ptr = NULL
 * 
 *     def fetch(self, bcf, contig, start, stop, reopen):             # <<<<<<<<<<<<<<
 *         return BCFIterator(bcf, contig, start, stop, reopen)
 * 
*/
  __pyx_t_4 = __Pyx_CyFunction_New(&__pyx_mdef_5pysam_7libcbcf_8BCFIndex_5fetch, __Pyx_CYFUNCTION_CCLASS, __pyx_mstate_global->__pyx_n_u_BCFIndex_fetch, NULL, __pyx_mstate_global->__pyx_n_u_pysam_libcbcf, __pyx_mstate_global->__pyx_d, ((PyObject *)__pyx_mstate_global->__pyx_codeobj_tab[338])); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 3773, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  if (__Pyx_SetItemOnTypeDict(__pyx_mstate_global->__pyx_ptype_5pysam_7libcbcf_BCFIndex, __pyx_mstate_global->__pyx_n_u_fetch, __pyx_t_4) < 0) __PYX_ERR(0, 3773, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;

  /* "(tree fragment)":1
 * def __reduce_cython__(self):             # <<<<<<<<<<<<<<
 *     raise TypeError, "self.ptr cannot be converted to a Python object for pickling"
 * def __setstate_cython__(self, __pyx_state):
*/
  __pyx_t_4 = __Pyx_CyFunction_New(&__pyx_mdef_5pysam_7libcbcf_8BCFIndex_7__reduce_cython__, __Pyx_CYFUNCTION_CCLASS, __pyx_mstate_global->__pyx_n_u_BCFIndex___reduce_cython, NULL, __pyx_mstate_global->__pyx_n_u_pysam_libcbcf, __pyx_mstate_global->__pyx_d, ((PyObject *)__pyx_mstate_global->__pyx_codeobj_tab[340])); if (unlikely(!__pyx_t_4)) __PYX_ERR(4, 1, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  if (PyDict_SetItem(__pyx_mstate_global->__pyx_d, __pyx_mstate_global->__pyx_n_u_reduce_cython, __pyx_t_4) < 0) __PYX_ERR(4, 1, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;

  /* "(tree fragment)":3
 * def __reduce_cython__(self):
 *     raise TypeError, "self.ptr cannot be converted to a Python object for pickling"
 * def __setstate_cython__(self, __pyx_state):             # <<<<<<<<<<<<<<
 *     raise TypeError, "self.ptr cannot be converted to a Python object for pickling"
*/
  __pyx_t_4 = __Pyx_CyFunction_New(&__pyx_mdef_5pysam_7libcbcf_8BCFIndex_9__setstate_cython__, __Pyx_CYFUNCTION_CCLASS, __pyx_mstate_global->__pyx_n_u_BCFIndex___setstate_cython, NULL, __pyx_mstate_global->__pyx_n_u_pysam_libcbcf, __pyx_mstate_global->__pyx_d, ((PyObject *)__pyx_mstate_global->__pyx_codeobj_tab[341])); if (unlikely(!__pyx_t_4)) __PYX_ERR(4, 3, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  if (PyDict_SetItem(__pyx_mstate_global->__pyx_d, __pyx_mstate_global->__pyx_n_u_setstate_cython, __pyx_t_4) < 0) __PYX_ERR(4, 3, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;

  /* "pysam/libcbcf.pyx":3812
 *             self.ptr = NULL
 * 
 *     def fetch(self, bcf, contig, start, stop, reopen):             # <<<<<<<<<<<<<<
 *         return TabixIterator(bcf, contig, start, stop, reopen)
 * 
*/
  __pyx_t_4 = __Pyx_CyFunction_New(&__pyx_mdef_5pysam_7libcbcf_10TabixIndex_5fetch, __Pyx_CYFUNCTION_CCLASS, __pyx_mstate_global->__pyx_n_u_TabixIndex_fetch, NULL, __pyx_mstate_global->__pyx_n_u_pysam_libcbcf, __pyx_mstate_global->__pyx_d, ((PyObject *)__pyx_mstate_global->__pyx_codeobj_tab[345])); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 3812, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  if (__Pyx_SetItemOnTypeDict(__pyx_mstate_global->__pyx_ptype_5pysam_7libcbcf_TabixIndex, __pyx_mstate_global->__pyx_n_u_fetch, __pyx_t_4) < 0) __PYX_ERR(0, 3812, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;

  /* "(tree fragment)":1
 * def __reduce_cython__(self):             # <<<<<<<<<<<<<<
 *     raise TypeError, "self.ptr cannot be converted to a Python object for pickling"
 * def __setstate_cython__(self, __pyx_state):
*/
  __pyx_t_4 = __Pyx_CyFunction_New(&__pyx_mdef_5pysam_7libcbcf_10TabixIndex_7__reduce_cython__, __Pyx_CYFUNCTION_CCLASS, __pyx_mstate_global->__pyx_n_u_TabixIndex___reduce_cython, NULL, __pyx_mstate_global->__pyx_n_u_pysam_libcbcf, __pyx_mstate_global->__pyx_d, ((PyObject *)__pyx_mstate_global->__pyx_codeobj_tab[346])); if (unlikely(!__pyx_t_4)) __PYX_ERR(4, 1, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  if (PyDict_SetItem(__pyx_mstate_global->__pyx_d, __pyx_mstate_global->__pyx_n_u_reduce_cython, __pyx_t_4) < 0) __PYX_ERR(4, 1, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;

  /* "(tree fragment)":3
 * def __reduce_cython__(self):
 *     raise TypeError, "self.ptr cannot be converted to a Python object for pickling"
 * def __setstate_cython__(self, __pyx_state):             # <<<<<<<<<<<<<<
 *     raise TypeError, "self.ptr cannot be converted to a Python object for pickling"
*/
  __pyx_t_4 = __Pyx_CyFunction_New(&__pyx_mdef_5pysam_7libcbcf_10TabixIndex_9__setstate_cython__, __Pyx_CYFUNCTION_CCLASS, __pyx_mstate_global->__pyx_n_u_TabixIndex___setstate_cython, NULL, __pyx_mstate_global->__pyx_n_u_pysam_libcbcf, __pyx_mstate_global->__pyx_d, ((PyObject *)__pyx_mstate_global->__pyx_codeobj_tab[347])); if (unlikely(!__pyx_t_4)) __PYX_ERR(4, 3, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  if (PyDict_SetItem(__pyx_mstate_global->__pyx_d, __pyx_mstate_global->__pyx_n_u_setstate_cython, __pyx_t_4) < 0) __PYX_ERR(4, 3, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;

  /* "(tree fragment)":1
 * def __reduce_cython__(self):             # <<<<<<<<<<<<<<
 *     raise TypeError, "self.iter cannot be converted to a Python object for pickling"
 * def __setstate_cython__(self, __pyx_state):
*/
  __pyx_t_4 = __Pyx_CyFunction_New(&__pyx_mdef_5pysam_7libcbcf_12BaseIterator_1__reduce_cython__, __Pyx_CYFUNCTION_CCLASS, __pyx_mstate_global->__pyx_n_u_BaseIterator___reduce_cython, NULL, __pyx_mstate_global->__pyx_n_u_pysam_libcbcf, __pyx_mstate_global->__pyx_d, ((PyObject *)__pyx_mstate_global->__pyx_codeobj_tab[349])); if (unlikely(!__pyx_t_4)) __PYX_ERR(4, 1, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  if (PyDict_SetItem(__pyx_mstate_global->__pyx_d, __pyx_mstate_global->__pyx_n_u_reduce_cython, __pyx_t_4) < 0) __PYX_ERR(4, 1, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;

  /* "(tree fragment)":3
 * def __reduce_cython__(self):
 *     raise TypeError, "self.iter cannot be converted to a Python object for pickling"
 * def __setstate_cython__(self, __pyx_state):             # <<<<<<<<<<<<<<
 *     raise TypeError, "self.iter cannot be converted to a Python object for pickling"
*/
  __pyx_t_4 = __Pyx_CyFunction_New(&__pyx_mdef_5pysam_7libcbcf_12BaseIterator_3__setstate_cython__, __Pyx_CYFUNCTION_CCLASS, __pyx_mstate_global->__pyx_n_u_BaseIterator___setstate_cython, NULL, __pyx_mstate_global->__pyx_n_u_pysam_libcbcf, __pyx_mstate_global->__pyx_d, ((PyObject *)__pyx_mstate_global->__pyx_codeobj_tab[350])); if (unlikely(!__pyx_t_4)) __PYX_ERR(4, 3, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  if (PyDict_SetItem(__pyx_mstate_global->__pyx_d, __pyx_mstate_global->__pyx_n_u_setstate_cython, __pyx_t_4) < 0) __PYX_ERR(4, 3, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;

  /* "(tree fragment)":1
 * def __reduce_cython__(self):             # <<<<<<<<<<<<<<
 *     raise TypeError, "self.iter cannot be converted to a Python object for pickling"
 * def __setstate_cython__(self, __pyx_state):
*/
  __pyx_t_4 = __Pyx_CyFunction_New(&__pyx_mdef_5pysam_7libcbcf_11BCFIterator_9__reduce_cython__, __Pyx_CYFUNCTION_CCLASS, __pyx_mstate_global->__pyx_n_u_BCFIterator___reduce_cython, NULL, __pyx_mstate_global->__pyx_n_u_pysam_libcbcf, __pyx_mstate_global->__pyx_d, ((PyObject *)__pyx_mstate_global->__pyx_codeobj_tab[356])); if (unlikely(!__pyx_t_4)) __PYX_ERR(4, 1, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  if (PyDict_SetItem(__pyx_mstate_global->__pyx_d, __pyx_mstate_global->__pyx_n_u_reduce_cython, __pyx_t_4) < 0) __PYX_ERR(4, 1, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;

  /* "(tree fragment)":3
 * def __reduce_cython__(self):
 *     raise TypeError, "self.iter cannot be converted to a Python object for pickling"
 * def __setstate_cython__(self, __pyx_state):             # <<<<<<<<<<<<<<
 *     raise TypeError, "self.iter cannot be converted to a Python object for pickling"
*/
  __pyx_t_4 = __Pyx_CyFunction_New(&__pyx_mdef_5pysam_7libcbcf_11BCFIterator_11__setstate_cython__, __Pyx_CYFUNCTION_CCLASS, __pyx_mstate_global->__pyx_n_u_BCFIterator___setstate_cython, NULL, __pyx_mstate_global->__pyx_n_u_pysam_libcbcf, __pyx_mstate_global->__pyx_d, ((PyObject *)__pyx_mstate_global->__pyx_codeobj_tab[357])); if (unlikely(!__pyx_t_4)) __PYX_ERR(4, 3, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  if (PyDict_SetItem(__pyx_mstate_global->__pyx_d, __pyx_mstate_global->__pyx_n_u_setstate_cython, __pyx_t_4) < 0) __PYX_ERR(4, 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_5pysam_7libcbcf_13TabixIterator_11__reduce_cython__, __Pyx_CYFUNCTION_CCLASS, __pyx_mstate_global->__pyx_n_u_TabixIterator___reduce_cython, NULL, __pyx_mstate_global->__pyx_n_u_pysam_libcbcf, __pyx_mstate_global->__pyx_d, ((PyObject *)__pyx_mstate_global->__pyx_codeobj_tab[363])); if (unlikely(!__pyx_t_4)) __PYX_ERR(4, 1, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  if (PyDict_SetItem(__pyx_mstate_global->__pyx_d, __pyx_mstate_global->__pyx_n_u_reduce_cython, __pyx_t_4) < 0) __PYX_ERR(4, 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_5pysam_7libcbcf_13TabixIterator_13__setstate_cython__, __Pyx_CYFUNCTION_CCLASS, __pyx_mstate_global->__pyx_n_u_TabixIterator___setstate_cython, NULL, __pyx_mstate_global->__pyx_n_u_pysam_libcbcf, __pyx_mstate_global->__pyx_d, ((PyObject *)__pyx_mstate_global->__pyx_codeobj_tab[364])); if (unlikely(!__pyx_t_4)) __PYX_ERR(4, 3, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  if (PyDict_SetItem(__pyx_mstate_global->__pyx_d, __pyx_mstate_global->__pyx_n_u_setstate_cython, __pyx_t_4) < 0) __PYX_ERR(4, 3, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;

  /* "pysam/libcbcf.pyx":4137
 *             raise OSError_from_errno("Closing failed", self.filename)
 * 
 *     def close(self):             # <<<<<<<<<<<<<<
 *         """closes the :class:`pysam.VariantFile`."""
 *         if not self.htsfile:
*/
  __pyx_t_4 = __Pyx_CyFunction_New(&__pyx_mdef_5pysam_7libcbcf_11VariantFile_7close, __Pyx_CYFUNCTION_CCLASS, __pyx_mstate_global->__pyx_n_u_VariantFile_close, NULL, __pyx_mstate_global->__pyx_n_u_pysam_libcbcf, __pyx_mstate_global->__pyx_d, ((PyObject *)__pyx_mstate_global->__pyx_codeobj_tab[368])); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 4137, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  if (__Pyx_SetItemOnTypeDict(__pyx_mstate_global->__pyx_ptype_5pysam_7libcbcf_VariantFile, __pyx_mstate_global->__pyx_n_u_close, __pyx_t_4) < 0) __PYX_ERR(0, 4137, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;

  /* "pysam/libcbcf.pyx":4199
 *         return makeVariantRecord(self.header, record)
 * 
 *     def copy(self):             # <<<<<<<<<<<<<<
 *         if not self.is_open:
 *             raise ValueError
*/
  __pyx_t_4 = __Pyx_CyFunction_New(&__pyx_mdef_5pysam_7libcbcf_11VariantFile_13copy, __Pyx_CYFUNCTION_CCLASS, __pyx_mstate_global->__pyx_n_u_VariantFile_copy, NULL, __pyx_mstate_global->__pyx_n_u_pysam_libcbcf, __pyx_mstate_global->__pyx_d, ((PyObject *)__pyx_mstate_global->__pyx_codeobj_tab[371])); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 4199, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  if (__Pyx_SetItemOnTypeDict(__pyx_mstate_global->__pyx_ptype_5pysam_7libcbcf_VariantFile, __pyx_mstate_global->__pyx_n_u_copy, __pyx_t_4) < 0) __PYX_ERR(0, 4199, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;

  /* "pysam/libcbcf.pyx":4237
 *         return vars
 * 
 *     def open(self, filename, mode='r',             # <<<<<<<<<<<<<<
 *              index_filename=None,
 *              VariantHeader header=None,
*/
  __pyx_t_4 = __Pyx_CyFunction_New(&__pyx_mdef_5pysam_7libcbcf_11VariantFile_15open, __Pyx_CYFUNCTION_CCLASS, __pyx_mstate_global->__pyx_n_u_VariantFile_open, NULL, __pyx_mstate_global->__pyx_n_u_pysam_libcbcf, __pyx_mstate_global->__pyx_d, ((PyObject *)__pyx_mstate_global->__pyx_codeobj_tab[372])); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 4237, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  __Pyx_CyFunction_SetDefaultsTuple(__pyx_t_4, __pyx_mstate_global->__pyx_tuple[13]);
  if (__Pyx_SetItemOnTypeDict(__pyx_mstate_global->__pyx_ptype_5pysam_7libcbcf_VariantFile, __pyx_mstate_global->__pyx_n_u_open, __pyx_t_4) < 0) __PYX_ERR(0, 4237, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;

  /* "pysam/libcbcf.pyx":4382
 *             raise ValueError('unknown mode {}'.format(mode))
 * 
 *     def reset(self):             # <<<<<<<<<<<<<<
 *         """reset file position to beginning of file just after the header."""
 *         return self.seek(self.start_offset)
*/
  __pyx_t_4 = __Pyx_CyFunction_New(&__pyx_mdef_5pysam_7libcbcf_11VariantFile_17reset, __Pyx_CYFUNCTION_CCLASS, __pyx_mstate_global->__pyx_n_u_VariantFile_reset, NULL, __pyx_mstate_global->__pyx_n_u_pysam_libcbcf, __pyx_mstate_global->__pyx_d, ((PyObject *)__pyx_mstate_global->__pyx_codeobj_tab[373])); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 4382, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  if (__Pyx_SetItemOnTypeDict(__pyx_mstate_global->__pyx_ptype_5pysam_7libcbcf_VariantFile, __pyx_mstate_global->__pyx_n_u_reset, __pyx_t_4) < 0) __PYX_ERR(0, 4382, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;

  /* "pysam/libcbcf.pyx":4386
 *         return self.seek(self.start_offset)
 * 
 *     def is_valid_tid(self, tid):             # <<<<<<<<<<<<<<
 *         """
 *         return True if the numerical :term:`tid` is valid; False otherwise.
*/
  __pyx_t_4 = __Pyx_CyFunction_New(&__pyx_mdef_5pysam_7libcbcf_11VariantFile_19is_valid_tid, __Pyx_CYFUNCTION_CCLASS, __pyx_mstate_global->__pyx_n_u_VariantFile_is_valid_tid, NULL, __pyx_mstate_global->__pyx_n_u_pysam_libcbcf, __pyx_mstate_global->__pyx_d, ((PyObject *)__pyx_mstate_global->__pyx_codeobj_tab[374])); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 4386, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  if (__Pyx_SetItemOnTypeDict(__pyx_mstate_global->__pyx_ptype_5pysam_7libcbcf_VariantFile, __pyx_mstate_global->__pyx_n_u_is_valid_tid, __pyx_t_4) < 0) __PYX_ERR(0, 4386, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;

  /* "pysam/libcbcf.pyx":4399
 *         return 0 <= rid < hdr.n[BCF_DT_CTG]
 * 
 *     def get_tid(self, reference):             # <<<<<<<<<<<<<<
 *         """
 *         return the numerical :term:`tid` corresponding to
*/
  __pyx_t_4 = __Pyx_CyFunction_New(&__pyx_mdef_5pysam_7libcbcf_11VariantFile_21get_tid, __Pyx_CYFUNCTION_CCLASS, __pyx_mstate_global->__pyx_n_u_VariantFile_get_tid, NULL, __pyx_mstate_global->__pyx_n_u_pysam_libcbcf, __pyx_mstate_global->__pyx_d, ((PyObject *)__pyx_mstate_global->__pyx_codeobj_tab[375])); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 4399, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  if (__Pyx_SetItemOnTypeDict(__pyx_mstate_global->__pyx_ptype_5pysam_7libcbcf_VariantFile, __pyx_mstate_global->__pyx_n_u_get_tid, __pyx_t_4) < 0) __PYX_ERR(0, 4399, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;

  /* "pysam/libcbcf.pyx":4414
 *         return kh_val_vdict(d, k).id if k != kh_end(d) else -1
 * 
 *     def get_reference_name(self, tid):             # <<<<<<<<<<<<<<
 *         """
 *         return :term:`reference` name corresponding to numerical :term:`tid`
*/
  __pyx_t_4 = __Pyx_CyFunction_New(&__pyx_mdef_5pysam_7libcbcf_11VariantFile_23get_reference_name, __Pyx_CYFUNCTION_CCLASS, __pyx_mstate_global->__pyx_n_u_VariantFile_get_reference_name, NULL, __pyx_mstate_global->__pyx_n_u_pysam_libcbcf, __pyx_mstate_global->__pyx_d, ((PyObject *)__pyx_mstate_global->__pyx_codeobj_tab[376])); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 4414, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  if (__Pyx_SetItemOnTypeDict(__pyx_mstate_global->__pyx_ptype_5pysam_7libcbcf_VariantFile, __pyx_mstate_global->__pyx_n_u_get_reference_name, __pyx_t_4) < 0) __PYX_ERR(0, 4414, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;

  /* "pysam/libcbcf.pyx":4427
 *         return bcf_str_cache_get_charptr(bcf_hdr_id2name(hdr, rid))
 * 
 *     def fetch(self, contig=None, start=None, stop=None, region=None, reopen=False, end=None, reference=None):             # <<<<<<<<<<<<<<
 *         """fetch records in a :term:`region`, specified either by
 *         :term:`contig`, *start*, and *end* (which are 0-based, half-open);
*/
  __pyx_t_4 = __Pyx_CyFunction_New(&__pyx_mdef_5pysam_7libcbcf_11VariantFile_25fetch, __Pyx_CYFUNCTION_CCLASS, __pyx_mstate_global->__pyx_n_u_VariantFile_fetch, NULL, __pyx_mstate_global->__pyx_n_u_pysam_libcbcf, __pyx_mstate_global->__pyx_d, ((PyObject *)__pyx_mstate_global->__pyx_codeobj_tab[377])); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 4427, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  __Pyx_CyFunction_SetDefaultsTuple(__pyx_t_4, __pyx_mstate_global->__pyx_tuple[14]);
  if (__Pyx_SetItemOnTypeDict(__pyx_mstate_global->__pyx_ptype_5pysam_7libcbcf_VariantFile, __pyx_mstate_global->__pyx_n_u_fetch, __pyx_t_4) < 0) __PYX_ERR(0, 4427, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;

  /* "pysam/libcbcf.pyx":4473
 *         return self.index.fetch(self, contig, start, stop, reopen)
 * 
 *     def new_record(self, *args, **kwargs):             # <<<<<<<<<<<<<<
 *         """Create a new empty :class:`VariantRecord`.
 * 
*/
  __pyx_t_4 = __Pyx_CyFunction_New(&__pyx_mdef_5pysam_7libcbcf_11VariantFile_27new_record, __Pyx_CYFUNCTION_CCLASS, __pyx_mstate_global->__pyx_n_u_VariantFile_new_record, NULL, __pyx_mstate_global->__pyx_n_u_pysam_libcbcf, __pyx_mstate_global->__pyx_d, ((PyObject *)__pyx_mstate_global->__pyx_codeobj_tab[378])); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 4473, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  if (__Pyx_SetItemOnTypeDict(__pyx_mstate_global->__pyx_ptype_5pysam_7libcbcf_VariantFile, __pyx_mstate_global->__pyx_n_u_new_record, __pyx_t_4) < 0) __PYX_ERR(0, 4473, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;

  /* "pysam/libcbcf.pyx":4480
 *         return self.header.new_record(*args, **kwargs)
 * 
 *     cpdef int write(self, VariantRecord record) except -1:             # <<<<<<<<<<<<<<
 *         """
 *         write a single :class:`pysam.VariantRecord` to disk.
*/
  __pyx_t_4 = __Pyx_CyFunction_New(&__pyx_mdef_5pysam_7libcbcf_11VariantFile_29write, __Pyx_CYFUNCTION_CCLASS, __pyx_mstate_global->__pyx_n_u_VariantFile_write, NULL, __pyx_mstate_global->__pyx_n_u_pysam_libcbcf, __pyx_mstate_global->__pyx_d, ((PyObject *)__pyx_mstate_global->__pyx_codeobj_tab[379])); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 4480, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  if (__Pyx_SetItemOnTypeDict(__pyx_mstate_global->__pyx_ptype_5pysam_7libcbcf_VariantFile, __pyx_mstate_global->__pyx_n_u_write, __pyx_t_4) < 0) __PYX_ERR(0, 4480, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;

  /* "pysam/libcbcf.pyx":4523
 *         return ret
 * 
 *     def subset_samples(self, include_samples):             # <<<<<<<<<<<<<<
 *         """
 *         Read only a subset of samples to reduce processing time and memory.
*/
  __pyx_t_4 = __Pyx_CyFunction_New(&__pyx_mdef_5pysam_7libcbcf_11VariantFile_31subset_samples, __Pyx_CYFUNCTION_CCLASS, __pyx_mstate_global->__pyx_n_u_VariantFile_subset_samples, NULL, __pyx_mstate_global->__pyx_n_u_pysam_libcbcf, __pyx_mstate_global->__pyx_d, ((PyObject *)__pyx_mstate_global->__pyx_codeobj_tab[380])); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 4523, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  if (__Pyx_SetItemOnTypeDict(__pyx_mstate_global->__pyx_ptype_5pysam_7libcbcf_VariantFile, __pyx_mstate_global->__pyx_n_u_subset_samples, __pyx_t_4) < 0) __PYX_ERR(0, 4523, __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_5pysam_7libcbcf_11VariantFile_33__reduce_cython__, __Pyx_CYFUNCTION_CCLASS, __pyx_mstate_global->__pyx_n_u_VariantFile___reduce_cython, NULL, __pyx_mstate_global->__pyx_n_u_pysam_libcbcf, __pyx_mstate_global->__pyx_d, ((PyObject *)__pyx_mstate_global->__pyx_codeobj_tab[386])); if (unlikely(!__pyx_t_4)) __PYX_ERR(4, 1, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  if (PyDict_SetItem(__pyx_mstate_global->__pyx_d, __pyx_mstate_global->__pyx_n_u_reduce_cython, __pyx_t_4) < 0) __PYX_ERR(4, 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_5pysam_7libcbcf_11VariantFile_35__setstate_cython__, __Pyx_CYFUNCTION_CCLASS, __pyx_mstate_global->__pyx_n_u_VariantFile___setstate_cython, NULL, __pyx_mstate_global->__pyx_n_u_pysam_libcbcf, __pyx_mstate_global->__pyx_d, ((PyObject *)__pyx_mstate_global->__pyx_codeobj_tab[387])); if (unlikely(!__pyx_t_4)) __PYX_ERR(4, 3, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  if (PyDict_SetItem(__pyx_mstate_global->__pyx_d, __pyx_mstate_global->__pyx_n_u_setstate_cython, __pyx_t_4) < 0) __PYX_ERR(4, 3, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;

  /* "(tree fragment)":1
 * def __pyx_unpickle_VariantHeaderRecords(__pyx_type, long __pyx_checksum, __pyx_state):             # <<<<<<<<<<<<<<
 *     cdef object __pyx_PickleError
 *     cdef object __pyx_result
*/
  __pyx_t_4 = __Pyx_CyFunction_New(&__pyx_mdef_5pysam_7libcbcf_1__pyx_unpickle_VariantHeaderRecords, 0, __pyx_mstate_global->__pyx_n_u_pyx_unpickle_VariantHeaderReco, NULL, __pyx_mstate_global->__pyx_n_u_pysam_libcbcf, __pyx_mstate_global->__pyx_d, ((PyObject *)__pyx_mstate_global->__pyx_codeobj_tab[388])); if (unlikely(!__pyx_t_4)) __PYX_ERR(4, 1, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  if (PyDict_SetItem(__pyx_mstate_global->__pyx_d, __pyx_mstate_global->__pyx_n_u_pyx_unpickle_VariantHeaderReco, __pyx_t_4) < 0) __PYX_ERR(4, 1, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;

  /* "(tree fragment)":11
 *         __pyx_unpickle_VariantHeaderRecords__set_state(<VariantHeaderRecords> __pyx_result, __pyx_state)
 *     return __pyx_result
 * cdef __pyx_unpickle_VariantHeaderRecords__set_state(VariantHeaderRecords __pyx_result, tuple __pyx_state):             # <<<<<<<<<<<<<<
 *     __pyx_result.header = __pyx_state[0]
 *     if len(__pyx_state) > 1 and hasattr(__pyx_result, '__dict__'):
*/
  __pyx_t_4 = __Pyx_CyFunction_New(&__pyx_mdef_5pysam_7libcbcf_3__pyx_unpickle_VariantMetadata, 0, __pyx_mstate_global->__pyx_n_u_pyx_unpickle_VariantMetadata, NULL, __pyx_mstate_global->__pyx_n_u_pysam_libcbcf, __pyx_mstate_global->__pyx_d, ((PyObject *)__pyx_mstate_global->__pyx_codeobj_tab[390])); if (unlikely(!__pyx_t_4)) __PYX_ERR(4, 1, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  if (PyDict_SetItem(__pyx_mstate_global->__pyx_d, __pyx_mstate_global->__pyx_n_u_pyx_unpickle_VariantMetadata, __pyx_t_4) < 0) __PYX_ERR(4, 1, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;

  /* "(tree fragment)":1
 * def __pyx_unpickle_VariantHeaderMetadata(__pyx_type, long __pyx_checksum, __pyx_state):             # <<<<<<<<<<<<<<
 *     cdef object __pyx_PickleError
 *     cdef object __pyx_result
*/
  __pyx_t_4 = __Pyx_CyFunction_New(&__pyx_mdef_5pysam_7libcbcf_5__pyx_unpickle_VariantHeaderMetadata, 0, __pyx_mstate_global->__pyx_n_u_pyx_unpickle_VariantHeaderMeta, NULL, __pyx_mstate_global->__pyx_n_u_pysam_libcbcf, __pyx_mstate_global->__pyx_d, ((PyObject *)__pyx_mstate_global->__pyx_codeobj_tab[392])); if (unlikely(!__pyx_t_4)) __PYX_ERR(4, 1, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  if (PyDict_SetItem(__pyx_mstate_global->__pyx_d, __pyx_mstate_global->__pyx_n_u_pyx_unpickle_VariantHeaderMeta, __pyx_t_4) < 0) __PYX_ERR(4, 1, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;

  /* "(tree fragment)":11
 *         __pyx_unpickle_VariantHeaderMetadata__set_state(<VariantHeaderMetadata> __pyx_result, __pyx_state)
 *     return __pyx_result
 * cdef __pyx_unpickle_VariantHeaderMetadata__set_state(VariantHeaderMetadata __pyx_result, tuple __pyx_state):             # <<<<<<<<<<<<<<
 *     __pyx_result.header = __pyx_state[0]; __pyx_result.type = __pyx_state[1]
 *     if len(__pyx_state) > 2 and hasattr(__pyx_result, '__dict__'):
*/
  __pyx_t_4 = __Pyx_CyFunction_New(&__pyx_mdef_5pysam_7libcbcf_7__pyx_unpickle_VariantContig, 0, __pyx_mstate_global->__pyx_n_u_pyx_unpickle_VariantContig, NULL, __pyx_mstate_global->__pyx_n_u_pysam_libcbcf, __pyx_mstate_global->__pyx_d, ((PyObject *)__pyx_mstate_global->__pyx_codeobj_tab[394])); if (unlikely(!__pyx_t_4)) __PYX_ERR(4, 1, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  if (PyDict_SetItem(__pyx_mstate_global->__pyx_d, __pyx_mstate_global->__pyx_n_u_pyx_unpickle_VariantContig, __pyx_t_4) < 0) __PYX_ERR(4, 1, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;

  /* "(tree fragment)":1
 * def __pyx_unpickle_VariantHeaderContigs(__pyx_type, long __pyx_checksum, __pyx_state):             # <<<<<<<<<<<<<<
 *     cdef object __pyx_PickleError
 *     cdef object __pyx_result
*/
  __pyx_t_4 = __Pyx_CyFunction_New(&__pyx_mdef_5pysam_7libcbcf_9__pyx_unpickle_VariantHeaderContigs, 0, __pyx_mstate_global->__pyx_n_u_pyx_unpickle_VariantHeaderCont, NULL, __pyx_mstate_global->__pyx_n_u_pysam_libcbcf, __pyx_mstate_global->__pyx_d, ((PyObject *)__pyx_mstate_global->__pyx_codeobj_tab[396])); if (unlikely(!__pyx_t_4)) __PYX_ERR(4, 1, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  if (PyDict_SetItem(__pyx_mstate_global->__pyx_d, __pyx_mstate_global->__pyx_n_u_pyx_unpickle_VariantHeaderCont, __pyx_t_4) < 0) __PYX_ERR(4, 1, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;

  /* "(tree fragment)":11
 *         __pyx_unpickle_VariantHeaderContigs__set_state(<VariantHeaderContigs> __pyx_result, __pyx_state)
 *     return __pyx_result
 * cdef __pyx_unpickle_VariantHeaderContigs__set_state(VariantHeaderContigs __pyx_result, tuple __pyx_state):             # <<<<<<<<<<<<<<
 *     __pyx_result.header = __pyx_state[0]
 *     if len(__pyx_state) > 1 and hasattr(__pyx_result, '__dict__'):
*/
  __pyx_t_4 = __Pyx_CyFunction_New(&__pyx_mdef_5pysam_7libcbcf_11__pyx_unpickle_VariantHeaderSamples, 0, __pyx_mstate_global->__pyx_n_u_pyx_unpickle_VariantHeaderSamp, NULL, __pyx_mstate_global->__pyx_n_u_pysam_libcbcf, __pyx_mstate_global->__pyx_d, ((PyObject *)__pyx_mstate_global->__pyx_codeobj_tab[398])); if (unlikely(!__pyx_t_4)) __PYX_ERR(4, 1, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  if (PyDict_SetItem(__pyx_mstate_global->__pyx_d, __pyx_mstate_global->__pyx_n_u_pyx_unpickle_VariantHeaderSamp, __pyx_t_4) < 0) __PYX_ERR(4, 1, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;

  /* "(tree fragment)":1
 * def __pyx_unpickle_VariantRecordFilter(__pyx_type, long __pyx_checksum, __pyx_state):             # <<<<<<<<<<<<<<
 *     cdef object __pyx_PickleError
 *     cdef object __pyx_result
*/
  __pyx_t_4 = __Pyx_CyFunction_New(&__pyx_mdef_5pysam_7libcbcf_13__pyx_unpickle_VariantRecordFilter, 0, __pyx_mstate_global->__pyx_n_u_pyx_unpickle_VariantRecordFilt, NULL, __pyx_mstate_global->__pyx_n_u_pysam_libcbcf, __pyx_mstate_global->__pyx_d, ((PyObject *)__pyx_mstate_global->__pyx_codeobj_tab[400])); if (unlikely(!__pyx_t_4)) __PYX_ERR(4, 1, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  if (PyDict_SetItem(__pyx_mstate_global->__pyx_d, __pyx_mstate_global->__pyx_n_u_pyx_unpickle_VariantRecordFilt, __pyx_t_4) < 0) __PYX_ERR(4, 1, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;

  /* "(tree fragment)":11
 *         __pyx_unpickle_VariantRecordFilter__set_state(<VariantRecordFilter> __pyx_result, __pyx_state)
 *     return __pyx_result
 * cdef __pyx_unpickle_VariantRecordFilter__set_state(VariantRecordFilter __pyx_result, tuple __pyx_state):             # <<<<<<<<<<<<<<
 *     __pyx_result.record = __pyx_state[0]
 *     if len(__pyx_state) > 1 and hasattr(__pyx_result, '__dict__'):
*/
  __pyx_t_4 = __Pyx_CyFunction_New(&__pyx_mdef_5pysam_7libcbcf_15__pyx_unpickle_VariantRecordFormat, 0, __pyx_mstate_global->__pyx_n_u_pyx_unpickle_VariantRecordForm, NULL, __pyx_mstate_global->__pyx_n_u_pysam_libcbcf, __pyx_mstate_global->__pyx_d, ((PyObject *)__pyx_mstate_global->__pyx_codeobj_tab[402])); if (unlikely(!__pyx_t_4)) __PYX_ERR(4, 1, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  if (PyDict_SetItem(__pyx_mstate_global->__pyx_d, __pyx_mstate_global->__pyx_n_u_pyx_unpickle_VariantRecordForm, __pyx_t_4) < 0) __PYX_ERR(4, 1, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;

  /* "(tree fragment)":1
 * def __pyx_unpickle_VariantRecordInfo(__pyx_type, long __pyx_checksum, __pyx_state):             # <<<<<<<<<<<<<<
 *     cdef object __pyx_PickleError
 *     cdef object __pyx_result
*/
  __pyx_t_4 = __Pyx_CyFunction_New(&__pyx_mdef_5pysam_7libcbcf_17__pyx_unpickle_VariantRecordInfo, 0, __pyx_mstate_global->__pyx_n_u_pyx_unpickle_VariantRecordInfo, NULL, __pyx_mstate_global->__pyx_n_u_pysam_libcbcf, __pyx_mstate_global->__pyx_d, ((PyObject *)__pyx_mstate_global->__pyx_codeobj_tab[404])); if (unlikely(!__pyx_t_4)) __PYX_ERR(4, 1, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  if (PyDict_SetItem(__pyx_mstate_global->__pyx_d, __pyx_mstate_global->__pyx_n_u_pyx_unpickle_VariantRecordInfo, __pyx_t_4) < 0) __PYX_ERR(4, 1, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;

  /* "(tree fragment)":11
 *         __pyx_unpickle_VariantRecordInfo__set_state(<VariantRecordInfo> __pyx_result, __pyx_state)
 *     return __pyx_result
 * cdef __pyx_unpickle_VariantRecordInfo__set_state(VariantRecordInfo __pyx_result, tuple __pyx_state):             # <<<<<<<<<<<<<<
 *     __pyx_result.record = __pyx_state[0]
 *     if len(__pyx_state) > 1 and hasattr(__pyx_result, '__dict__'):
*/
  __pyx_t_4 = __Pyx_CyFunction_New(&__pyx_mdef_5pysam_7libcbcf_19__pyx_unpickle_VariantRecordSamples, 0, __pyx_mstate_global->__pyx_n_u_pyx_unpickle_VariantRecordSamp, NULL, __pyx_mstate_global->__pyx_n_u_pysam_libcbcf, __pyx_mstate_global->__pyx_d, ((PyObject *)__pyx_mstate_global->__pyx_codeobj_tab[406])); if (unlikely(!__pyx_t_4)) __PYX_ERR(4, 1, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  if (PyDict_SetItem(__pyx_mstate_global->__pyx_d, __pyx_mstate_global->__pyx_n_u_pyx_unpickle_VariantRecordSamp, __pyx_t_4) < 0) __PYX_ERR(4, 1, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;

  /* "(tree fragment)":1
 * def __pyx_unpickle_VariantRecordSample(__pyx_type, long __pyx_checksum, __pyx_state):             # <<<<<<<<<<<<<<
 *     cdef object __pyx_PickleError
 *     cdef object __pyx_result
*/
  __pyx_t_4 = __Pyx_CyFunction_New(&__pyx_mdef_5pysam_7libcbcf_21__pyx_unpickle_VariantRecordSample, 0, __pyx_mstate_global->__pyx_n_u_pyx_unpickle_VariantRecordSamp_2, NULL, __pyx_mstate_global->__pyx_n_u_pysam_libcbcf, __pyx_mstate_global->__pyx_d, ((PyObject *)__pyx_mstate_global->__pyx_codeobj_tab[408])); if (unlikely(!__pyx_t_4)) __PYX_ERR(4, 1, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  if (PyDict_SetItem(__pyx_mstate_global->__pyx_d, __pyx_mstate_global->__pyx_n_u_pyx_unpickle_VariantRecordSamp_2, __pyx_t_4) < 0) __PYX_ERR(4, 1, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;

  /* "(tree fragment)":11
 *         __pyx_unpickle_VariantRecordSample__set_state(<VariantRecordSample> __pyx_result, __pyx_state)
 *     return __pyx_result
 * cdef __pyx_unpickle_VariantRecordSample__set_state(VariantRecordSample __pyx_result, tuple __pyx_state):             # <<<<<<<<<<<<<<
 *     __pyx_result.index = __pyx_state[0]; __pyx_result.record = __pyx_state[1]
 *     if len(__pyx_state) > 2 and hasattr(__pyx_result, '__dict__'):
*/
  __pyx_t_4 = __Pyx_CyFunction_New(&__pyx_mdef_5pysam_7libcbcf_23__pyx_unpickle_BaseIndex, 0, __pyx_mstate_global->__pyx_n_u_pyx_unpickle_BaseIndex, NULL, __pyx_mstate_global->__pyx_n_u_pysam_libcbcf, __pyx_mstate_global->__pyx_d, ((PyObject *)__pyx_mstate_global->__pyx_codeobj_tab[410])); if (unlikely(!__pyx_t_4)) __PYX_ERR(4, 1, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  if (PyDict_SetItem(__pyx_mstate_global->__pyx_d, __pyx_mstate_global->__pyx_n_u_pyx_unpickle_BaseIndex, __pyx_t_4) < 0) __PYX_ERR(4, 1, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;

  /* "pysam/libcbcf.pyx":1
 * # cython: language_level=3             # <<<<<<<<<<<<<<
 * # cython: embedsignature=True
 * # cython: profile=True
*/
  __pyx_t_4 = __Pyx_PyDict_NewPresized(0); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  if (PyDict_SetItem(__pyx_mstate_global->__pyx_d, __pyx_mstate_global->__pyx_n_u_test, __pyx_t_4) < 0) __PYX_ERR(0, 1, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  __Pyx_TraceReturnValue(Py_None, 13, 0, __PYX_ERR(0, 1, __pyx_L1_error));
  __Pyx_PyMonitoring_ExitScope(0);

  /*--- Wrapped vars code ---*/

  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_TraceException(__pyx_lineno, 0, 0);
  __Pyx_TraceExceptionUnwind(13, 0);
  if (__pyx_m) {
    if (__pyx_mstate->__pyx_d && stringtab_initialized) {
      __Pyx_AddTraceback("init pysam.libcbcf", __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 pysam.libcbcf");
  }
  __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 ### */

typedef struct {
    const char *s;
#if 179 <= 65535
    const unsigned short n;
#elif 179 / 2 < INT_MAX
    const unsigned int n;
#elif 179 / 2 < LONG_MAX
    const unsigned long n;
#else
    const Py_ssize_t n;
#endif
#if 1 <= 31
    const unsigned int encoding : 5;
#elif 1 <= 255
    const unsigned char encoding;
#elif 1 <= 65535
    const unsigned short encoding;
#else
    const Py_ssize_t encoding;
#endif
    const unsigned int is_unicode : 1;
    const unsigned int intern : 1;
} __Pyx_StringTabEntry;
static const char * const __pyx_string_tab_encodings[] = { 0 };
static const __Pyx_StringTabEntry __pyx_string_tab[] = {
  {__pyx_k_, sizeof(__pyx_k_), 0, 0, 0}, /* PyObject cname: __pyx_kp_b_ */
  {__pyx_k_, sizeof(__pyx_k_), 0, 1, 0}, /* PyObject cname: __pyx_kp_u_ */
  {__pyx_k_A, sizeof(__pyx_k_A), 0, 1, 1}, /* PyObject cname: __pyx_n_u_A */
  {__pyx_k_ALT, sizeof(__pyx_k_ALT), 0, 1, 1}, /* PyObject cname: __pyx_n_u_ALT */
  {__pyx_k_AssertionError, sizeof(__pyx_k_AssertionError), 0, 1, 1}, /* PyObject cname: __pyx_n_u_AssertionError */
  {__pyx_k_BCFIndex, sizeof(__pyx_k_BCFIndex), 0, 1, 1}, /* PyObject cname: __pyx_n_u_BCFIndex */
  {__pyx_k_BCFIndex___reduce_cython, sizeof(__pyx_k_BCFIndex___reduce_cython), 0, 1, 1}, /* PyObject cname: __pyx_n_u_BCFIndex___reduce_cython */
  {__pyx_k_BCFIndex___setstate_cython, sizeof(__pyx_k_BCFIndex___setstate_cython), 0, 1, 1}, /* PyObject cname: __pyx_n_u_BCFIndex___setstate_cython */
  {__pyx_k_BCFIndex_fetch, sizeof(__pyx_k_BCFIndex_fetch), 0, 1, 1}, /* PyObject cname: __pyx_n_u_BCFIndex_fetch */
  {__pyx_k_BCFIterator, sizeof(__pyx_k_BCFIterator), 0, 1, 1}, /* PyObject cname: __pyx_n_u_BCFIterator */
  {__pyx_k_BCFIterator___reduce_cython, sizeof(__pyx_k_BCFIterator___reduce_cython), 0, 1, 1}, /* PyObject cname: __pyx_n_u_BCFIterator___reduce_cython */
  {__pyx_k_BCFIterator___setstate_cython, sizeof(__pyx_k_BCFIterator___setstate_cython), 0, 1, 1}, /* PyObject cname: __pyx_n_u_BCFIterator___setstate_cython */
  {__pyx_k_BND, sizeof(__pyx_k_BND), 0, 1, 1}, /* PyObject cname: __pyx_n_u_BND */
  {__pyx_k_BaseIndex, sizeof(__pyx_k_BaseIndex), 0, 1, 1}, /* PyObject cname: __pyx_n_u_BaseIndex */
  {__pyx_k_BaseIndex___reduce_cython, sizeof(__pyx_k_BaseIndex___reduce_cython), 0, 1, 1}, /* PyObject cname: __pyx_n_u_BaseIndex___reduce_cython */
  {__pyx_k_BaseIndex___setstate_cython, sizeof(__pyx_k_BaseIndex___setstate_cython), 0, 1, 1}, /* PyObject cname: __pyx_n_u_BaseIndex___setstate_cython */
  {__pyx_k_BaseIndex_get, sizeof(__pyx_k_BaseIndex_get), 0, 1, 1}, /* PyObject cname: __pyx_n_u_BaseIndex_get */
  {__pyx_k_BaseIndex_items, sizeof(__pyx_k_BaseIndex_items), 0, 1, 1}, /* PyObject cname: __pyx_n_u_BaseIndex_items */
  {__pyx_k_BaseIndex_iteritems, sizeof(__pyx_k_BaseIndex_iteritems), 0, 1, 1}, /* PyObject cname: __pyx_n_u_BaseIndex_iteritems */
  {__pyx_k_BaseIndex_iterkeys, sizeof(__pyx_k_BaseIndex_iterkeys), 0, 1, 1}, /* PyObject cname: __pyx_n_u_BaseIndex_iterkeys */
  {__pyx_k_BaseIndex_itervalues, sizeof(__pyx_k_BaseIndex_itervalues), 0, 1, 1}, /* PyObject cname: __pyx_n_u_BaseIndex_itervalues */
  {__pyx_k_BaseIndex_keys, sizeof(__pyx_k_BaseIndex_keys), 0, 1, 1}, /* PyObject cname: __pyx_n_u_BaseIndex_keys */
  {__pyx_k_BaseIndex_pop, sizeof(__pyx_k_BaseIndex_pop), 0, 1, 1}, /* PyObject cname: __pyx_n_u_BaseIndex_pop */
  {__pyx_k_BaseIndex_update, sizeof(__pyx_k_BaseIndex_update), 0, 1, 1}, /* PyObject cname: __pyx_n_u_BaseIndex_update */
  {__pyx_k_BaseIndex_values, sizeof(__pyx_k_BaseIndex_values), 0, 1, 1}, /* PyObject cname: __pyx_n_u_BaseIndex_values */
  {__pyx_k_BaseIterator, sizeof(__pyx_k_BaseIterator), 0, 1, 1}, /* PyObject cname: __pyx_n_u_BaseIterator */
  {__pyx_k_BaseIterator___reduce_cython, sizeof(__pyx_k_BaseIterator___reduce_cython), 0, 1, 1}, /* PyObject cname: __pyx_n_u_BaseIterator___reduce_cython */
  {__pyx_k_BaseIterator___setstate_cython, sizeof(__pyx_k_BaseIterator___setstate_cython), 0, 1, 1}, /* PyObject cname: __pyx_n_u_BaseIterator___setstate_cython */
  {__pyx_k_CONTIG, sizeof(__pyx_k_CONTIG), 0, 1, 1}, /* PyObject cname: __pyx_n_u_CONTIG */
  {__pyx_k_Can_t_write_headers, sizeof(__pyx_k_Can_t_write_headers), 0, 1, 0}, /* PyObject cname: __pyx_kp_u_Can_t_write_headers */
  {__pyx_k_Can_t_write_record, sizeof(__pyx_k_Can_t_write_record), 0, 1, 0}, /* PyObject cname: __pyx_kp_u_Can_t_write_record */
  {__pyx_k_Cannot_add_extra_threads_when_ig, sizeof(__pyx_k_Cannot_add_extra_threads_when_ig), 0, 1, 0}, /* PyObject cname: __pyx_kp_u_Cannot_add_extra_threads_when_ig */
  {__pyx_k_Cannot_copy_arrays_with_src_valu, sizeof(__pyx_k_Cannot_copy_arrays_with_src_valu), 0, 1, 0}, /* PyObject cname: __pyx_kp_u_Cannot_copy_arrays_with_src_valu */
  {__pyx_k_Cannot_create_empty_array, sizeof(__pyx_k_Cannot_create_empty_array), 0, 1, 0}, /* PyObject cname: __pyx_kp_u_Cannot_create_empty_array */
  {__pyx_k_Cannot_re_open_htsfile, sizeof(__pyx_k_Cannot_re_open_htsfile), 0, 1, 0}, /* PyObject cname: __pyx_kp_u_Cannot_re_open_htsfile */
  {__pyx_k_Cannot_set_phased_before_genotyp, sizeof(__pyx_k_Cannot_set_phased_before_genotyp), 0, 1, 0}, /* PyObject cname: __pyx_kp_u_Cannot_set_phased_before_genotyp */
  {__pyx_k_Cannot_specify_an_index_filename, sizeof(__pyx_k_Cannot_specify_an_index_filename), 0, 1, 0}, /* PyObject cname: __pyx_kp_u_Cannot_specify_an_index_filename */
  {__pyx_k_Cannot_translate_record_Number_o, sizeof(__pyx_k_Cannot_translate_record_Number_o), 0, 1, 0}, /* PyObject cname: __pyx_kp_u_Cannot_translate_record_Number_o */
  {__pyx_k_Closing_failed, sizeof(__pyx_k_Closing_failed), 0, 1, 0}, /* PyObject cname: __pyx_kp_u_Closing_failed */
  {__pyx_k_Could_not_allocate_VCF_header_re, sizeof(__pyx_k_Could_not_allocate_VCF_header_re), 0, 1, 0}, /* PyObject cname: __pyx_kp_u_Could_not_allocate_VCF_header_re */
  {__pyx_k_Could_not_open_variant_file, sizeof(__pyx_k_Could_not_open_variant_file), 0, 1, 0}, /* PyObject cname: __pyx_kp_u_Could_not_open_variant_file */
  {__pyx_k_Description, sizeof(__pyx_k_Description), 0, 1, 1}, /* PyObject cname: __pyx_n_u_Description */
  {__pyx_k_Duplicated_sample_name, sizeof(__pyx_k_Duplicated_sample_name), 0, 1, 0}, /* PyObject cname: __pyx_kp_u_Duplicated_sample_name */
  {__pyx_k_END, sizeof(__pyx_k_END), 0, 0, 1}, /* PyObject cname: __pyx_n_b_END */
  {__pyx_k_END, sizeof(__pyx_k_END), 0, 1, 1}, /* PyObject cname: __pyx_n_u_END */
  {__pyx_k_END_is_a_reserved_attribute_acce, sizeof(__pyx_k_END_is_a_reserved_attribute_acce), 0, 1, 0}, /* PyObject cname: __pyx_kp_u_END_is_a_reserved_attribute_acce */
  {__pyx_k_Error_extracting_ID, sizeof(__pyx_k_Error_extracting_ID), 0, 1, 0}, /* PyObject cname: __pyx_kp_u_Error_extracting_ID */
  {__pyx_k_Error_s_reading_record, sizeof(__pyx_k_Error_s_reading_record), 0, 1, 0}, /* PyObject cname: __pyx_kp_u_Error_s_reading_record */
  {__pyx_k_Error_unpacking_VariantRecord, sizeof(__pyx_k_Error_unpacking_VariantRecord), 0, 1, 0}, /* PyObject cname: __pyx_kp_u_Error_unpacking_VariantRecord */
  {__pyx_k_Error_updating_alleles, sizeof(__pyx_k_Error_updating_alleles), 0, 1, 0}, /* PyObject cname: __pyx_kp_u_Error_updating_alleles */
  {__pyx_k_Error_updating_id, sizeof(__pyx_k_Error_updating_id), 0, 1, 0}, /* PyObject cname: __pyx_kp_u_Error_updating_id */
  {__pyx_k_FILTER, sizeof(__pyx_k_FILTER), 0, 1, 1}, /* PyObject cname: __pyx_n_u_FILTER */
  {__pyx_k_FIXED, sizeof(__pyx_k_FIXED), 0, 1, 1}, /* PyObject cname: __pyx_n_u_FIXED */
  {__pyx_k_FORMAT, sizeof(__pyx_k_FORMAT), 0, 1, 1}, /* PyObject cname: __pyx_n_u_FORMAT */
  {__pyx_k_Flag, sizeof(__pyx_k_Flag), 0, 1, 1}, /* PyObject cname: __pyx_n_u_Flag */
  {__pyx_k_Flag_types_are_not_allowed_on_FO, sizeof(__pyx_k_Flag_types_are_not_allowed_on_FO), 0, 1, 0}, /* PyObject cname: __pyx_kp_u_Flag_types_are_not_allowed_on_FO */
  {__pyx_k_Flag_values_must_be_True_False_N, sizeof(__pyx_k_Flag_values_must_be_True_False_N), 0, 1, 0}, /* PyObject cname: __pyx_kp_u_Flag_values_must_be_True_False_N */
  {__pyx_k_Float, sizeof(__pyx_k_Float), 0, 1, 1}, /* PyObject cname: __pyx_n_u_Float */
  {__pyx_k_G, sizeof(__pyx_k_G), 0, 1, 1}, /* PyObject cname: __pyx_n_u_G */
  {__pyx_k_GENERIC, sizeof(__pyx_k_GENERIC), 0, 1, 1}, /* PyObject cname: __pyx_n_u_GENERIC */
  {__pyx_k_GT, sizeof(__pyx_k_GT), 0, 1, 1}, /* PyObject cname: __pyx_n_u_GT */
  {__pyx_k_Header_already_exists_for_contig, sizeof(__pyx_k_Header_already_exists_for_contig), 0, 1, 0}, /* PyObject cname: __pyx_kp_u_Header_already_exists_for_contig */
  {__pyx_k_Header_already_exists_for_id, sizeof(__pyx_k_Header_already_exists_for_id), 0, 1, 0}, /* PyObject cname: __pyx_kp_u_Header_already_exists_for_id */
  {__pyx_k_ID, sizeof(__pyx_k_ID), 0, 1, 1}, /* PyObject cname: __pyx_n_u_ID */
  {__pyx_k_INDEL, sizeof(__pyx_k_INDEL), 0, 1, 1}, /* PyObject cname: __pyx_n_u_INDEL */
  {__pyx_k_INFO, sizeof(__pyx_k_INFO), 0, 1, 1}, /* PyObject cname: __pyx_n_u_INFO */
  {__pyx_k_IOError, sizeof(__pyx_k_IOError), 0, 1, 1}, /* PyObject cname: __pyx_n_u_IOError */
  {__pyx_k_I_O_operation_on_closed_file, sizeof(__pyx_k_I_O_operation_on_closed_file), 0, 1, 0}, /* PyObject cname: __pyx_kp_u_I_O_operation_on_closed_file */
  {__pyx_k_Incompatible_checksums_0x_x_vs_0, sizeof(__pyx_k_Incompatible_checksums_0x_x_vs_0), 0, 1, 0}, /* PyObject cname: __pyx_kp_u_Incompatible_checksums_0x_x_vs_0 */
  {__pyx_k_Incompatible_checksums_0x_x_vs_0_2, sizeof(__pyx_k_Incompatible_checksums_0x_x_vs_0_2), 0, 1, 0}, /* PyObject cname: __pyx_kp_u_Incompatible_checksums_0x_x_vs_0_2 */
  {__pyx_k_Incompatible_checksums_0x_x_vs_0_3, sizeof(__pyx_k_Incompatible_checksums_0x_x_vs_0_3), 0, 1, 0}, /* PyObject cname: __pyx_kp_u_Incompatible_checksums_0x_x_vs_0_3 */
  {__pyx_k_Incompatible_checksums_0x_x_vs_0_4, sizeof(__pyx_k_Incompatible_checksums_0x_x_vs_0_4), 0, 1, 0}, /* PyObject cname: __pyx_kp_u_Incompatible_checksums_0x_x_vs_0_4 */
  {__pyx_k_Incompatible_checksums_0x_x_vs_0_5, sizeof(__pyx_k_Incompatible_checksums_0x_x_vs_0_5), 0, 1, 0}, /* PyObject cname: __pyx_kp_u_Incompatible_checksums_0x_x_vs_0_5 */
  {__pyx_k_Incompatible_checksums_0x_x_vs_0_6, sizeof(__pyx_k_Incompatible_checksums_0x_x_vs_0_6), 0, 1, 0}, /* PyObject cname: __pyx_kp_u_Incompatible_checksums_0x_x_vs_0_6 */
  {__pyx_k_Incompatible_checksums_0x_x_vs_0_7, sizeof(__pyx_k_Incompatible_checksums_0x_x_vs_0_7), 0, 1, 0}, /* PyObject cname: __pyx_kp_u_Incompatible_checksums_0x_x_vs_0_7 */
  {__pyx_k_IndexError, sizeof(__pyx_k_IndexError), 0, 1, 1}, /* PyObject cname: __pyx_n_u_IndexError */
  {__pyx_k_Integer, sizeof(__pyx_k_Integer), 0, 1, 1}, /* PyObject cname: __pyx_n_u_Integer */
  {__pyx_k_Integer_value_too_small_large_to, sizeof(__pyx_k_Integer_value_too_small_large_to), 0, 1, 0}, /* PyObject cname: __pyx_kp_u_Integer_value_too_small_large_to */
  {__pyx_k_Invalid_INFO_field, sizeof(__pyx_k_Invalid_INFO_field), 0, 1, 0}, /* PyObject cname: __pyx_kp_u_Invalid_INFO_field */
  {__pyx_k_Invalid_VariantRecord_Number_of, sizeof(__pyx_k_Invalid_VariantRecord_Number_of), 0, 1, 0}, /* PyObject cname: __pyx_kp_u_Invalid_VariantRecord_Number_of */
  {__pyx_k_Invalid_allele_index, sizeof(__pyx_k_Invalid_allele_index), 0, 1, 0}, /* PyObject cname: __pyx_kp_u_Invalid_allele_index */
  {__pyx_k_Invalid_chromosome_contig, sizeof(__pyx_k_Invalid_chromosome_contig), 0, 1, 0}, /* PyObject cname: __pyx_kp_u_Invalid_chromosome_contig */
  {__pyx_k_Invalid_filter, sizeof(__pyx_k_Invalid_filter), 0, 1, 0}, /* PyObject cname: __pyx_kp_u_Invalid_filter */
  {__pyx_k_Invalid_header, sizeof(__pyx_k_Invalid_header), 0, 1, 0}, /* PyObject cname: __pyx_kp_u_Invalid_header */
  {__pyx_k_Invalid_header_id, sizeof(__pyx_k_Invalid_header_id), 0, 1, 0}, /* PyObject cname: __pyx_kp_u_Invalid_header_id */
  {__pyx_k_Invalid_header_record_index, sizeof(__pyx_k_Invalid_header_record_index), 0, 1, 0}, /* PyObject cname: __pyx_kp_u_Invalid_header_record_index */
  {__pyx_k_Invalid_index_object, sizeof(__pyx_k_Invalid_index_object), 0, 1, 0}, /* PyObject cname: __pyx_kp_u_Invalid_index_object */
  {__pyx_k_Invalid_tid, sizeof(__pyx_k_Invalid_tid), 0, 1, 0}, /* PyObject cname: __pyx_kp_u_Invalid_tid */
  {__pyx_k_KeyError, sizeof(__pyx_k_KeyError), 0, 1, 1}, /* PyObject cname: __pyx_n_u_KeyError */
  {__pyx_k_MAX_POS, sizeof(__pyx_k_MAX_POS), 0, 1, 1}, /* PyObject cname: __pyx_n_u_MAX_POS */
  {__pyx_k_METADATA_LENGTHS, sizeof(__pyx_k_METADATA_LENGTHS), 0, 1, 1}, /* PyObject cname: __pyx_n_u_METADATA_LENGTHS */
  {__pyx_k_METADATA_TYPES, sizeof(__pyx_k_METADATA_TYPES), 0, 1, 1}, /* PyObject cname: __pyx_n_u_METADATA_TYPES */
  {__pyx_k_MNP, sizeof(__pyx_k_MNP), 0, 1, 1}, /* PyObject cname: __pyx_n_u_MNP */
  {__pyx_k_MemoryError, sizeof(__pyx_k_MemoryError), 0, 1, 1}, /* PyObject cname: __pyx_n_u_MemoryError */
  {__pyx_k_NON_REF, sizeof(__pyx_k_NON_REF), 0, 1, 0}, /* PyObject cname: __pyx_kp_u_NON_REF */
  {__pyx_k_NotImplemented, sizeof(__pyx_k_NotImplemented), 0, 1, 1}, /* PyObject cname: __pyx_n_u_NotImplemented */
  {__pyx_k_Note_that_Cython_is_deliberately, sizeof(__pyx_k_Note_that_Cython_is_deliberately), 0, 1, 0}, /* PyObject cname: __pyx_kp_u_Note_that_Cython_is_deliberately */
  {__pyx_k_Number, sizeof(__pyx_k_Number), 0, 1, 1}, /* PyObject cname: __pyx_n_u_Number */
  {__pyx_k_Number_must_be_None_when_adding, sizeof(__pyx_k_Number_must_be_None_when_adding), 0, 1, 0}, /* PyObject cname: __pyx_kp_u_Number_must_be_None_when_adding */
  {__pyx_k_OTHER, sizeof(__pyx_k_OTHER), 0, 1, 1}, /* PyObject cname: __pyx_n_u_OTHER */
  {__pyx_k_OVERLAP, sizeof(__pyx_k_OVERLAP), 0, 1, 1}, /* PyObject cname: __pyx_n_u_OVERLAP */
  {__pyx_k_One_or_more_of_the_supplied_samp, sizeof(__pyx_k_One_or_more_of_the_supplied_samp), 0, 1, 0}, /* PyObject cname: __pyx_kp_u_One_or_more_of_the_supplied_samp */
  {__pyx_k_PASS, sizeof(__pyx_k_PASS), 0, 1, 1}, /* PyObject cname: __pyx_n_u_PASS */
  {__pyx_k_PickleError, sizeof(__pyx_k_PickleError), 0, 1, 1}, /* PyObject cname: __pyx_n_u_PickleError */
  {__pyx_k_Position_must_be_positive, sizeof(__pyx_k_Position_must_be_positive), 0, 1, 0}, /* PyObject cname: __pyx_kp_u_Position_must_be_positive */
  {__pyx_k_R, sizeof(__pyx_k_R), 0, 1, 1}, /* PyObject cname: __pyx_n_u_R */
  {__pyx_k_REF, sizeof(__pyx_k_REF), 0, 1, 1}, /* PyObject cname: __pyx_n_u_REF */
  {__pyx_k_SNP, sizeof(__pyx_k_SNP), 0, 1, 1}, /* PyObject cname: __pyx_n_u_SNP */
  {__pyx_k_STRUCTURED, sizeof(__pyx_k_STRUCTURED), 0, 1, 1}, /* PyObject cname: __pyx_n_u_STRUCTURED */
  {__pyx_k_Start_coordinate_must_be_non_neg, sizeof(__pyx_k_Start_coordinate_must_be_non_neg), 0, 1, 0}, /* PyObject cname: __pyx_kp_u_Start_coordinate_must_be_non_neg */
  {__pyx_k_StopIteration, sizeof(__pyx_k_StopIteration), 0, 1, 1}, /* PyObject cname: __pyx_n_u_StopIteration */
  {__pyx_k_Stop_coordinate_must_be_non_nega, sizeof(__pyx_k_Stop_coordinate_must_be_non_nega), 0, 1, 0}, /* PyObject cname: __pyx_kp_u_Stop_coordinate_must_be_non_nega */
  {__pyx_k_Stop_position_of_the_interval, sizeof(__pyx_k_Stop_position_of_the_interval), 0, 1, 0}, /* PyObject cname: __pyx_kp_u_Stop_position_of_the_interval */
  {__pyx_k_String, sizeof(__pyx_k_String), 0, 1, 1}, /* PyObject cname: __pyx_n_u_String */
  {__pyx_k_TabixIndex, sizeof(__pyx_k_TabixIndex), 0, 1, 1}, /* PyObject cname: __pyx_n_u_TabixIndex */
  {__pyx_k_TabixIndex___reduce_cython, sizeof(__pyx_k_TabixIndex___reduce_cython), 0, 1, 1}, /* PyObject cname: __pyx_n_u_TabixIndex___reduce_cython */
  {__pyx_k_TabixIndex___setstate_cython, sizeof(__pyx_k_TabixIndex___setstate_cython), 0, 1, 1}, /* PyObject cname: __pyx_n_u_TabixIndex___setstate_cython */
  {__pyx_k_TabixIndex_fetch, sizeof(__pyx_k_TabixIndex_fetch), 0, 1, 1}, /* PyObject cname: __pyx_n_u_TabixIndex_fetch */
  {__pyx_k_TabixIterator, sizeof(__pyx_k_TabixIterator), 0, 1, 1}, /* PyObject cname: __pyx_n_u_TabixIterator */
  {__pyx_k_TabixIterator___reduce_cython, sizeof(__pyx_k_TabixIterator___reduce_cython), 0, 1, 1}, /* PyObject cname: __pyx_n_u_TabixIterator___reduce_cython */
  {__pyx_k_TabixIterator___setstate_cython, sizeof(__pyx_k_TabixIterator___setstate_cython), 0, 1, 1}, /* PyObject cname: __pyx_n_u_TabixIterator___setstate_cython */
  {__pyx_k_Type, sizeof(__pyx_k_Type), 0, 1, 1}, /* PyObject cname: __pyx_n_u_Type */
  {__pyx_k_TypeError, sizeof(__pyx_k_TypeError), 0, 1, 1}, /* PyObject cname: __pyx_n_u_TypeError */
  {__pyx_k_Type_must_be_None_when_adding_a, sizeof(__pyx_k_Type_must_be_None_when_adding_a), 0, 1, 0}, /* PyObject cname: __pyx_kp_u_Type_must_be_None_when_adding_a */
  {__pyx_k_Unable_to_delete_END, sizeof(__pyx_k_Unable_to_delete_END), 0, 1, 0}, /* PyObject cname: __pyx_kp_u_Unable_to_delete_END */
  {__pyx_k_Unable_to_delete_FORMAT, sizeof(__pyx_k_Unable_to_delete_FORMAT), 0, 1, 0}, /* PyObject cname: __pyx_kp_u_Unable_to_delete_FORMAT */
  {__pyx_k_Unable_to_delete_INFO, sizeof(__pyx_k_Unable_to_delete_INFO), 0, 1, 0}, /* PyObject cname: __pyx_kp_u_Unable_to_delete_INFO */
  {__pyx_k_Unable_to_fetch_next_record, sizeof(__pyx_k_Unable_to_fetch_next_record), 0, 1, 0}, /* PyObject cname: __pyx_kp_u_Unable_to_fetch_next_record */
  {__pyx_k_Unable_to_update_INFO_values, sizeof(__pyx_k_Unable_to_update_INFO_values), 0, 1, 0}, /* PyObject cname: __pyx_kp_u_Unable_to_update_INFO_values */
  {__pyx_k_Unable_to_update_format_values, sizeof(__pyx_k_Unable_to_update_format_values), 0, 1, 0}, /* PyObject cname: __pyx_kp_u_Unable_to_update_format_values */
  {__pyx_k_Unknown_INFO_field, sizeof(__pyx_k_Unknown_INFO_field), 0, 1, 0}, /* PyObject cname: __pyx_kp_u_Unknown_INFO_field */
  {__pyx_k_Unknown_allele, sizeof(__pyx_k_Unknown_allele), 0, 1, 0}, /* PyObject cname: __pyx_kp_u_Unknown_allele */
  {__pyx_k_Unknown_format_length, sizeof(__pyx_k_Unknown_format_length), 0, 1, 0}, /* PyObject cname: __pyx_kp_u_Unknown_format_length */
  {__pyx_k_Unsupported_FORMAT_type, sizeof(__pyx_k_Unsupported_FORMAT_type), 0, 1, 0}, /* PyObject cname: __pyx_kp_u_Unsupported_FORMAT_type */
  {__pyx_k_Unsupported_INFO_type, sizeof(__pyx_k_Unsupported_INFO_type), 0, 1, 0}, /* PyObject cname: __pyx_kp_u_Unsupported_INFO_type */
  {__pyx_k_Use_allele_indices_to_set_intege, sizeof(__pyx_k_Use_allele_indices_to_set_intege), 0, 1, 0}, /* PyObject cname: __pyx_kp_u_Use_allele_indices_to_set_intege */
  {__pyx_k_VALUE_TYPES, sizeof(__pyx_k_VALUE_TYPES), 0, 1, 1}, /* PyObject cname: __pyx_n_u_VALUE_TYPES */
  {__pyx_k_VARIABLE, sizeof(__pyx_k_VARIABLE), 0, 1, 1}, /* PyObject cname: __pyx_n_u_VARIABLE */
  {__pyx_k_ValueError, sizeof(__pyx_k_ValueError), 0, 1, 1}, /* PyObject cname: __pyx_n_u_ValueError */
  {__pyx_k_VariantContig, sizeof(__pyx_k_VariantContig), 0, 1, 1}, /* PyObject cname: __pyx_n_u_VariantContig */
  {__pyx_k_VariantContig___reduce_cython, sizeof(__pyx_k_VariantContig___reduce_cython), 0, 1, 1}, /* PyObject cname: __pyx_n_u_VariantContig___reduce_cython */
  {__pyx_k_VariantContig___setstate_cython, sizeof(__pyx_k_VariantContig___setstate_cython), 0, 1, 1}, /* PyObject cname: __pyx_n_u_VariantContig___setstate_cython */
  {__pyx_k_VariantContig_remove_header, sizeof(__pyx_k_VariantContig_remove_header), 0, 1, 1}, /* PyObject cname: __pyx_n_u_VariantContig_remove_header */
  {__pyx_k_VariantFile, sizeof(__pyx_k_VariantFile), 0, 1, 1}, /* PyObject cname: __pyx_n_u_VariantFile */
  {__pyx_k_VariantFile___reduce_cython, sizeof(__pyx_k_VariantFile___reduce_cython), 0, 1, 1}, /* PyObject cname: __pyx_n_u_VariantFile___reduce_cython */
  {__pyx_k_VariantFile___setstate_cython, sizeof(__pyx_k_VariantFile___setstate_cython), 0, 1, 1}, /* PyObject cname: __pyx_n_u_VariantFile___setstate_cython */
  {__pyx_k_VariantFile_close, sizeof(__pyx_k_VariantFile_close), 0, 1, 1}, /* PyObject cname: __pyx_n_u_VariantFile_close */
  {__pyx_k_VariantFile_copy, sizeof(__pyx_k_VariantFile_copy), 0, 1, 1}, /* PyObject cname: __pyx_n_u_VariantFile_copy */
  {__pyx_k_VariantFile_fetch, sizeof(__pyx_k_VariantFile_fetch), 0, 1, 1}, /* PyObject cname: __pyx_n_u_VariantFile_fetch */
  {__pyx_k_VariantFile_get_reference_name, sizeof(__pyx_k_VariantFile_get_reference_name), 0, 1, 1}, /* PyObject cname: __pyx_n_u_VariantFile_get_reference_name */
  {__pyx_k_VariantFile_get_tid, sizeof(__pyx_k_VariantFile_get_tid), 0, 1, 1}, /* PyObject cname: __pyx_n_u_VariantFile_get_tid */
  {__pyx_k_VariantFile_is_valid_tid, sizeof(__pyx_k_VariantFile_is_valid_tid), 0, 1, 1}, /* PyObject cname: __pyx_n_u_VariantFile_is_valid_tid */
  {__pyx_k_VariantFile_new_record, sizeof(__pyx_k_VariantFile_new_record), 0, 1, 1}, /* PyObject cname: __pyx_n_u_VariantFile_new_record */
  {__pyx_k_VariantFile_open, sizeof(__pyx_k_VariantFile_open), 0, 1, 1}, /* PyObject cname: __pyx_n_u_VariantFile_open */
  {__pyx_k_VariantFile_reset, sizeof(__pyx_k_VariantFile_reset), 0, 1, 1}, /* PyObject cname: __pyx_n_u_VariantFile_reset */
  {__pyx_k_VariantFile_subset_samples, sizeof(__pyx_k_VariantFile_subset_samples), 0, 1, 1}, /* PyObject cname: __pyx_n_u_VariantFile_subset_samples */
  {__pyx_k_VariantFile_write, sizeof(__pyx_k_VariantFile_write), 0, 1, 1}, /* PyObject cname: __pyx_n_u_VariantFile_write */
  {__pyx_k_VariantHeader, sizeof(__pyx_k_VariantHeader), 0, 1, 1}, /* PyObject cname: __pyx_n_u_VariantHeader */
  {__pyx_k_VariantHeaderContigs, sizeof(__pyx_k_VariantHeaderContigs), 0, 1, 1}, /* PyObject cname: __pyx_n_u_VariantHeaderContigs */
  {__pyx_k_VariantHeaderContigs___iter, sizeof(__pyx_k_VariantHeaderContigs___iter), 0, 1, 1}, /* PyObject cname: __pyx_n_u_VariantHeaderContigs___iter */
  {__pyx_k_VariantHeaderContigs___reduce_cy, sizeof(__pyx_k_VariantHeaderContigs___reduce_cy), 0, 1, 1}, /* PyObject cname: __pyx_n_u_VariantHeaderContigs___reduce_cy */
  {__pyx_k_VariantHeaderContigs___setstate, sizeof(__pyx_k_VariantHeaderContigs___setstate), 0, 1, 1}, /* PyObject cname: __pyx_n_u_VariantHeaderContigs___setstate */
  {__pyx_k_VariantHeaderContigs_add, sizeof(__pyx_k_VariantHeaderContigs_add), 0, 1, 1}, /* PyObject cname: __pyx_n_u_VariantHeaderContigs_add */
  {__pyx_k_VariantHeaderContigs_clear_heade, sizeof(__pyx_k_VariantHeaderContigs_clear_heade), 0, 1, 1}, /* PyObject cname: __pyx_n_u_VariantHeaderContigs_clear_heade */
  {__pyx_k_VariantHeaderContigs_get, sizeof(__pyx_k_VariantHeaderContigs_get), 0, 1, 1}, /* PyObject cname: __pyx_n_u_VariantHeaderContigs_get */
  {__pyx_k_VariantHeaderContigs_items, sizeof(__pyx_k_VariantHeaderContigs_items), 0, 1, 1}, /* PyObject cname: __pyx_n_u_VariantHeaderContigs_items */
  {__pyx_k_VariantHeaderContigs_iteritems, sizeof(__pyx_k_VariantHeaderContigs_iteritems), 0, 1, 1}, /* PyObject cname: __pyx_n_u_VariantHeaderContigs_iteritems */
  {__pyx_k_VariantHeaderContigs_iterkeys, sizeof(__pyx_k_VariantHeaderContigs_iterkeys), 0, 1, 1}, /* PyObject cname: __pyx_n_u_VariantHeaderContigs_iterkeys */
  {__pyx_k_VariantHeaderContigs_itervalues, sizeof(__pyx_k_VariantHeaderContigs_itervalues), 0, 1, 1}, /* PyObject cname: __pyx_n_u_VariantHeaderContigs_itervalues */
  {__pyx_k_VariantHeaderContigs_keys, sizeof(__pyx_k_VariantHeaderContigs_keys), 0, 1, 1}, /* PyObject cname: __pyx_n_u_VariantHeaderContigs_keys */
  {__pyx_k_VariantHeaderContigs_remove_head, sizeof(__pyx_k_VariantHeaderContigs_remove_head), 0, 1, 1}, /* PyObject cname: __pyx_n_u_VariantHeaderContigs_remove_head */
  {__pyx_k_VariantHeaderContigs_values, sizeof(__pyx_k_VariantHeaderContigs_values), 0, 1, 1}, /* PyObject cname: __pyx_n_u_VariantHeaderContigs_values */
  {__pyx_k_VariantHeaderMetadata, sizeof(__pyx_k_VariantHeaderMetadata), 0, 1, 1}, /* PyObject cname: __pyx_n_u_VariantHeaderMetadata */
  {__pyx_k_VariantHeaderMetadata___iter, sizeof(__pyx_k_VariantHeaderMetadata___iter), 0, 1, 1}, /* PyObject cname: __pyx_n_u_VariantHeaderMetadata___iter */
  {__pyx_k_VariantHeaderMetadata___reduce_c, sizeof(__pyx_k_VariantHeaderMetadata___reduce_c), 0, 1, 1}, /* PyObject cname: __pyx_n_u_VariantHeaderMetadata___reduce_c */
  {__pyx_k_VariantHeaderMetadata___setstate, sizeof(__pyx_k_VariantHeaderMetadata___setstate), 0, 1, 1}, /* PyObject cname: __pyx_n_u_VariantHeaderMetadata___setstate */
  {__pyx_k_VariantHeaderMetadata_add, sizeof(__pyx_k_VariantHeaderMetadata_add), 0, 1, 1}, /* PyObject cname: __pyx_n_u_VariantHeaderMetadata_add */
  {__pyx_k_VariantHeaderMetadata_clear_head, sizeof(__pyx_k_VariantHeaderMetadata_clear_head), 0, 1, 1}, /* PyObject cname: __pyx_n_u_VariantHeaderMetadata_clear_head */
  {__pyx_k_VariantHeaderMetadata_get, sizeof(__pyx_k_VariantHeaderMetadata_get), 0, 1, 1}, /* PyObject cname: __pyx_n_u_VariantHeaderMetadata_get */
  {__pyx_k_VariantHeaderMetadata_items, sizeof(__pyx_k_VariantHeaderMetadata_items), 0, 1, 1}, /* PyObject cname: __pyx_n_u_VariantHeaderMetadata_items */
  {__pyx_k_VariantHeaderMetadata_iteritems, sizeof(__pyx_k_VariantHeaderMetadata_iteritems), 0, 1, 1}, /* PyObject cname: __pyx_n_u_VariantHeaderMetadata_iteritems */
  {__pyx_k_VariantHeaderMetadata_iterkeys, sizeof(__pyx_k_VariantHeaderMetadata_iterkeys), 0, 1, 1}, /* PyObject cname: __pyx_n_u_VariantHeaderMetadata_iterkeys */
  {__pyx_k_VariantHeaderMetadata_itervalues, sizeof(__pyx_k_VariantHeaderMetadata_itervalues), 0, 1, 1}, /* PyObject cname: __pyx_n_u_VariantHeaderMetadata_itervalues */
  {__pyx_k_VariantHeaderMetadata_keys, sizeof(__pyx_k_VariantHeaderMetadata_keys), 0, 1, 1}, /* PyObject cname: __pyx_n_u_VariantHeaderMetadata_keys */
  {__pyx_k_VariantHeaderMetadata_remove_hea, sizeof(__pyx_k_VariantHeaderMetadata_remove_hea), 0, 1, 1}, /* PyObject cname: __pyx_n_u_VariantHeaderMetadata_remove_hea */
  {__pyx_k_VariantHeaderMetadata_values, sizeof(__pyx_k_VariantHeaderMetadata_values), 0, 1, 1}, /* PyObject cname: __pyx_n_u_VariantHeaderMetadata_values */
  {__pyx_k_VariantHeaderRecord, sizeof(__pyx_k_VariantHeaderRecord), 0, 1, 1}, /* PyObject cname: __pyx_n_u_VariantHeaderRecord */
  {__pyx_k_VariantHeaderRecord___get___loca, sizeof(__pyx_k_VariantHeaderRecord___get___loca), 0, 1, 1}, /* PyObject cname: __pyx_n_u_VariantHeaderRecord___get___loca */
  {__pyx_k_VariantHeaderRecord___iter, sizeof(__pyx_k_VariantHeaderRecord___iter), 0, 1, 1}, /* PyObject cname: __pyx_n_u_VariantHeaderRecord___iter */
  {__pyx_k_VariantHeaderRecord___reduce_cyt, sizeof(__pyx_k_VariantHeaderRecord___reduce_cyt), 0, 1, 1}, /* PyObject cname: __pyx_n_u_VariantHeaderRecord___reduce_cyt */
  {__pyx_k_VariantHeaderRecord___setstate_c, sizeof(__pyx_k_VariantHeaderRecord___setstate_c), 0, 1, 1}, /* PyObject cname: __pyx_n_u_VariantHeaderRecord___setstate_c */
  {__pyx_k_VariantHeaderRecord_get, sizeof(__pyx_k_VariantHeaderRecord_get), 0, 1, 1}, /* PyObject cname: __pyx_n_u_VariantHeaderRecord_get */
  {__pyx_k_VariantHeaderRecord_items, sizeof(__pyx_k_VariantHeaderRecord_items), 0, 1, 1}, /* PyObject cname: __pyx_n_u_VariantHeaderRecord_items */
  {__pyx_k_VariantHeaderRecord_iteritems, sizeof(__pyx_k_VariantHeaderRecord_iteritems), 0, 1, 1}, /* PyObject cname: __pyx_n_u_VariantHeaderRecord_iteritems */
  {__pyx_k_VariantHeaderRecord_iterkeys, sizeof(__pyx_k_VariantHeaderRecord_iterkeys), 0, 1, 1}, /* PyObject cname: __pyx_n_u_VariantHeaderRecord_iterkeys */
  {__pyx_k_VariantHeaderRecord_itervalues, sizeof(__pyx_k_VariantHeaderRecord_itervalues), 0, 1, 1}, /* PyObject cname: __pyx_n_u_VariantHeaderRecord_itervalues */
  {__pyx_k_VariantHeaderRecord_keys, sizeof(__pyx_k_VariantHeaderRecord_keys), 0, 1, 1}, /* PyObject cname: __pyx_n_u_VariantHeaderRecord_keys */
  {__pyx_k_VariantHeaderRecord_pop, sizeof(__pyx_k_VariantHeaderRecord_pop), 0, 1, 1}, /* PyObject cname: __pyx_n_u_VariantHeaderRecord_pop */
  {__pyx_k_VariantHeaderRecord_remove, sizeof(__pyx_k_VariantHeaderRecord_remove), 0, 1, 1}, /* PyObject cname: __pyx_n_u_VariantHeaderRecord_remove */
  {__pyx_k_VariantHeaderRecord_update, sizeof(__pyx_k_VariantHeaderRecord_update), 0, 1, 1}, /* PyObject cname: __pyx_n_u_VariantHeaderRecord_update */
  {__pyx_k_VariantHeaderRecord_values, sizeof(__pyx_k_VariantHeaderRecord_values), 0, 1, 1}, /* PyObject cname: __pyx_n_u_VariantHeaderRecord_values */
  {__pyx_k_VariantHeaderRecords, sizeof(__pyx_k_VariantHeaderRecords), 0, 1, 1}, /* PyObject cname: __pyx_n_u_VariantHeaderRecords */
  {__pyx_k_VariantHeaderRecords___iter, sizeof(__pyx_k_VariantHeaderRecords___iter), 0, 1, 1}, /* PyObject cname: __pyx_n_u_VariantHeaderRecords___iter */
  {__pyx_k_VariantHeaderRecords___reduce_cy, sizeof(__pyx_k_VariantHeaderRecords___reduce_cy), 0, 1, 1}, /* PyObject cname: __pyx_n_u_VariantHeaderRecords___reduce_cy */
  {__pyx_k_VariantHeaderRecords___setstate, sizeof(__pyx_k_VariantHeaderRecords___setstate), 0, 1, 1}, /* PyObject cname: __pyx_n_u_VariantHeaderRecords___setstate */
  {__pyx_k_VariantHeaderSamples, sizeof(__pyx_k_VariantHeaderSamples), 0, 1, 1}, /* PyObject cname: __pyx_n_u_VariantHeaderSamples */
  {__pyx_k_VariantHeaderSamples___iter, sizeof(__pyx_k_VariantHeaderSamples___iter), 0, 1, 1}, /* PyObject cname: __pyx_n_u_VariantHeaderSamples___iter */
  {__pyx_k_VariantHeaderSamples___reduce_cy, sizeof(__pyx_k_VariantHeaderSamples___reduce_cy), 0, 1, 1}, /* PyObject cname: __pyx_n_u_VariantHeaderSamples___reduce_cy */
  {__pyx_k_VariantHeaderSamples___setstate, sizeof(__pyx_k_VariantHeaderSamples___setstate), 0, 1, 1}, /* PyObject cname: __pyx_n_u_VariantHeaderSamples___setstate */
  {__pyx_k_VariantHeaderSamples_add, sizeof(__pyx_k_VariantHeaderSamples_add), 0, 1, 1}, /* PyObject cname: __pyx_n_u_VariantHeaderSamples_add */
  {__pyx_k_VariantHeader___reduce_cython, sizeof(__pyx_k_VariantHeader___reduce_cython), 0, 1, 1}, /* PyObject cname: __pyx_n_u_VariantHeader___reduce_cython */
  {__pyx_k_VariantHeader___setstate_cython, sizeof(__pyx_k_VariantHeader___setstate_cython), 0, 1, 1}, /* PyObject cname: __pyx_n_u_VariantHeader___setstate_cython */
  {__pyx_k_VariantHeader_add_line, sizeof(__pyx_k_VariantHeader_add_line), 0, 1, 1}, /* PyObject cname: __pyx_n_u_VariantHeader_add_line */
  {__pyx_k_VariantHeader_add_meta, sizeof(__pyx_k_VariantHeader_add_meta), 0, 1, 1}, /* PyObject cname: __pyx_n_u_VariantHeader_add_meta */
  {__pyx_k_VariantHeader_add_record, sizeof(__pyx_k_VariantHeader_add_record), 0, 1, 1}, /* PyObject cname: __pyx_n_u_VariantHeader_add_record */
  {__pyx_k_VariantHeader_add_sample, sizeof(__pyx_k_VariantHeader_add_sample), 0, 1, 1}, /* PyObject cname: __pyx_n_u_VariantHeader_add_sample */
  {__pyx_k_VariantHeader_add_samples, sizeof(__pyx_k_VariantHeader_add_samples), 0, 1, 1}, /* PyObject cname: __pyx_n_u_VariantHeader_add_samples */
  {__pyx_k_VariantHeader_copy, sizeof(__pyx_k_VariantHeader_copy), 0, 1, 1}, /* PyObject cname: __pyx_n_u_VariantHeader_copy */
  {__pyx_k_VariantHeader_merge, sizeof(__pyx_k_VariantHeader_merge), 0, 1, 1}, /* PyObject cname: __pyx_n_u_VariantHeader_merge */
  {__pyx_k_VariantHeader_new_record, sizeof(__pyx_k_VariantHeader_new_record), 0, 1, 1}, /* PyObject cname: __pyx_n_u_VariantHeader_new_record */
  {__pyx_k_VariantMetadata, sizeof(__pyx_k_VariantMetadata), 0, 1, 1}, /* PyObject cname: __pyx_n_u_VariantMetadata */
  {__pyx_k_VariantMetadata___reduce_cython, sizeof(__pyx_k_VariantMetadata___reduce_cython), 0, 1, 1}, /* PyObject cname: __pyx_n_u_VariantMetadata___reduce_cython */
  {__pyx_k_VariantMetadata___setstate_cytho, sizeof(__pyx_k_VariantMetadata___setstate_cytho), 0, 1, 1}, /* PyObject cname: __pyx_n_u_VariantMetadata___setstate_cytho */
  {__pyx_k_VariantMetadata_remove_header, sizeof(__pyx_k_VariantMetadata_remove_header), 0, 1, 1}, /* PyObject cname: __pyx_n_u_VariantMetadata_remove_header */
  {__pyx_k_VariantRecord, sizeof(__pyx_k_VariantRecord), 0, 1, 1}, /* PyObject cname: __pyx_n_u_VariantRecord */
  {__pyx_k_VariantRecordFilter, sizeof(__pyx_k_VariantRecordFilter), 0, 1, 1}, /* PyObject cname: __pyx_n_u_VariantRecordFilter */
  {__pyx_k_VariantRecordFilter___iter, sizeof(__pyx_k_VariantRecordFilter___iter), 0, 1, 1}, /* PyObject cname: __pyx_n_u_VariantRecordFilter___iter */
  {__pyx_k_VariantRecordFilter___reduce_cyt, sizeof(__pyx_k_VariantRecordFilter___reduce_cyt), 0, 1, 1}, /* PyObject cname: __pyx_n_u_VariantRecordFilter___reduce_cyt */
  {__pyx_k_VariantRecordFilter___setstate_c, sizeof(__pyx_k_VariantRecordFilter___setstate_c), 0, 1, 1}, /* PyObject cname: __pyx_n_u_VariantRecordFilter___setstate_c */
  {__pyx_k_VariantRecordFilter_add, sizeof(__pyx_k_VariantRecordFilter_add), 0, 1, 1}, /* PyObject cname: __pyx_n_u_VariantRecordFilter_add */
  {__pyx_k_VariantRecordFilter_clear, sizeof(__pyx_k_VariantRecordFilter_clear), 0, 1, 1}, /* PyObject cname: __pyx_n_u_VariantRecordFilter_clear */
  {__pyx_k_VariantRecordFilter_get, sizeof(__pyx_k_VariantRecordFilter_get), 0, 1, 1}, /* PyObject cname: __pyx_n_u_VariantRecordFilter_get */
  {__pyx_k_VariantRecordFilter_items, sizeof(__pyx_k_VariantRecordFilter_items), 0, 1, 1}, /* PyObject cname: __pyx_n_u_VariantRecordFilter_items */
  {__pyx_k_VariantRecordFilter_iteritems, sizeof(__pyx_k_VariantRecordFilter_iteritems), 0, 1, 1}, /* PyObject cname: __pyx_n_u_VariantRecordFilter_iteritems */
  {__pyx_k_VariantRecordFilter_iterkeys, sizeof(__pyx_k_VariantRecordFilter_iterkeys), 0, 1, 1}, /* PyObject cname: __pyx_n_u_VariantRecordFilter_iterkeys */
  {__pyx_k_VariantRecordFilter_itervalues, sizeof(__pyx_k_VariantRecordFilter_itervalues), 0, 1, 1}, /* PyObject cname: __pyx_n_u_VariantRecordFilter_itervalues */
  {__pyx_k_VariantRecordFilter_keys, sizeof(__pyx_k_VariantRecordFilter_keys), 0, 1, 1}, /* PyObject cname: __pyx_n_u_VariantRecordFilter_keys */
  {__pyx_k_VariantRecordFilter_values, sizeof(__pyx_k_VariantRecordFilter_values), 0, 1, 1}, /* PyObject cname: __pyx_n_u_VariantRecordFilter_values */
  {__pyx_k_VariantRecordFormat, sizeof(__pyx_k_VariantRecordFormat), 0, 1, 1}, /* PyObject cname: __pyx_n_u_VariantRecordFormat */
  {__pyx_k_VariantRecordFormat___iter, sizeof(__pyx_k_VariantRecordFormat___iter), 0, 1, 1}, /* PyObject cname: __pyx_n_u_VariantRecordFormat___iter */
  {__pyx_k_VariantRecordFormat___reduce_cyt, sizeof(__pyx_k_VariantRecordFormat___reduce_cyt), 0, 1, 1}, /* PyObject cname: __pyx_n_u_VariantRecordFormat___reduce_cyt */
  {__pyx_k_VariantRecordFormat___setstate_c, sizeof(__pyx_k_VariantRecordFormat___setstate_c), 0, 1, 1}, /* PyObject cname: __pyx_n_u_VariantRecordFormat___setstate_c */
  {__pyx_k_VariantRecordFormat_clear, sizeof(__pyx_k_VariantRecordFormat_clear), 0, 1, 1}, /* PyObject cname: __pyx_n_u_VariantRecordFormat_clear */
  {__pyx_k_VariantRecordFormat_get, sizeof(__pyx_k_VariantRecordFormat_get), 0, 1, 1}, /* PyObject cname: __pyx_n_u_VariantRecordFormat_get */
  {__pyx_k_VariantRecordFormat_items, sizeof(__pyx_k_VariantRecordFormat_items), 0, 1, 1}, /* PyObject cname: __pyx_n_u_VariantRecordFormat_items */
  {__pyx_k_VariantRecordFormat_iteritems, sizeof(__pyx_k_VariantRecordFormat_iteritems), 0, 1, 1}, /* PyObject cname: __pyx_n_u_VariantRecordFormat_iteritems */
  {__pyx_k_VariantRecordFormat_iterkeys, sizeof(__pyx_k_VariantRecordFormat_iterkeys), 0, 1, 1}, /* PyObject cname: __pyx_n_u_VariantRecordFormat_iterkeys */
  {__pyx_k_VariantRecordFormat_itervalues, sizeof(__pyx_k_VariantRecordFormat_itervalues), 0, 1, 1}, /* PyObject cname: __pyx_n_u_VariantRecordFormat_itervalues */
  {__pyx_k_VariantRecordFormat_keys, sizeof(__pyx_k_VariantRecordFormat_keys), 0, 1, 1}, /* PyObject cname: __pyx_n_u_VariantRecordFormat_keys */
  {__pyx_k_VariantRecordFormat_values, sizeof(__pyx_k_VariantRecordFormat_values), 0, 1, 1}, /* PyObject cname: __pyx_n_u_VariantRecordFormat_values */
  {__pyx_k_VariantRecordInfo, sizeof(__pyx_k_VariantRecordInfo), 0, 1, 1}, /* PyObject cname: __pyx_n_u_VariantRecordInfo */
  {__pyx_k_VariantRecordInfo___iter, sizeof(__pyx_k_VariantRecordInfo___iter), 0, 1, 1}, /* PyObject cname: __pyx_n_u_VariantRecordInfo___iter */
  {__pyx_k_VariantRecordInfo___reduce_cytho, sizeof(__pyx_k_VariantRecordInfo___reduce_cytho), 0, 1, 1}, /* PyObject cname: __pyx_n_u_VariantRecordInfo___reduce_cytho */
  {__pyx_k_VariantRecordInfo___setstate_cyt, sizeof(__pyx_k_VariantRecordInfo___setstate_cyt), 0, 1, 1}, /* PyObject cname: __pyx_n_u_VariantRecordInfo___setstate_cyt */
  {__pyx_k_VariantRecordInfo_clear, sizeof(__pyx_k_VariantRecordInfo_clear), 0, 1, 1}, /* PyObject cname: __pyx_n_u_VariantRecordInfo_clear */
  {__pyx_k_VariantRecordInfo_get, sizeof(__pyx_k_VariantRecordInfo_get), 0, 1, 1}, /* PyObject cname: __pyx_n_u_VariantRecordInfo_get */
  {__pyx_k_VariantRecordInfo_items, sizeof(__pyx_k_VariantRecordInfo_items), 0, 1, 1}, /* PyObject cname: __pyx_n_u_VariantRecordInfo_items */
  {__pyx_k_VariantRecordInfo_iteritems, sizeof(__pyx_k_VariantRecordInfo_iteritems), 0, 1, 1}, /* PyObject cname: __pyx_n_u_VariantRecordInfo_iteritems */
  {__pyx_k_VariantRecordInfo_iterkeys, sizeof(__pyx_k_VariantRecordInfo_iterkeys), 0, 1, 1}, /* PyObject cname: __pyx_n_u_VariantRecordInfo_iterkeys */
  {__pyx_k_VariantRecordInfo_itervalues, sizeof(__pyx_k_VariantRecordInfo_itervalues), 0, 1, 1}, /* PyObject cname: __pyx_n_u_VariantRecordInfo_itervalues */
  {__pyx_k_VariantRecordInfo_keys, sizeof(__pyx_k_VariantRecordInfo_keys), 0, 1, 1}, /* PyObject cname: __pyx_n_u_VariantRecordInfo_keys */
  {__pyx_k_VariantRecordInfo_pop, sizeof(__pyx_k_VariantRecordInfo_pop), 0, 1, 1}, /* PyObject cname: __pyx_n_u_VariantRecordInfo_pop */
  {__pyx_k_VariantRecordInfo_update, sizeof(__pyx_k_VariantRecordInfo_update), 0, 1, 1}, /* PyObject cname: __pyx_n_u_VariantRecordInfo_update */
  {__pyx_k_VariantRecordInfo_values, sizeof(__pyx_k_VariantRecordInfo_values), 0, 1, 1}, /* PyObject cname: __pyx_n_u_VariantRecordInfo_values */
  {__pyx_k_VariantRecordSample, sizeof(__pyx_k_VariantRecordSample), 0, 1, 1}, /* PyObject cname: __pyx_n_u_VariantRecordSample */
  {__pyx_k_VariantRecordSample___iter, sizeof(__pyx_k_VariantRecordSample___iter), 0, 1, 1}, /* PyObject cname: __pyx_n_u_VariantRecordSample___iter */
  {__pyx_k_VariantRecordSample___reduce_cyt, sizeof(__pyx_k_VariantRecordSample___reduce_cyt), 0, 1, 1}, /* PyObject cname: __pyx_n_u_VariantRecordSample___reduce_cyt */
  {__pyx_k_VariantRecordSample___set___loca, sizeof(__pyx_k_VariantRecordSample___set___loca), 0, 1, 1}, /* PyObject cname: __pyx_n_u_VariantRecordSample___set___loca */
  {__pyx_k_VariantRecordSample___setstate_c, sizeof(__pyx_k_VariantRecordSample___setstate_c), 0, 1, 1}, /* PyObject cname: __pyx_n_u_VariantRecordSample___setstate_c */
  {__pyx_k_VariantRecordSample_clear, sizeof(__pyx_k_VariantRecordSample_clear), 0, 1, 1}, /* PyObject cname: __pyx_n_u_VariantRecordSample_clear */
  {__pyx_k_VariantRecordSample_get, sizeof(__pyx_k_VariantRecordSample_get), 0, 1, 1}, /* PyObject cname: __pyx_n_u_VariantRecordSample_get */
  {__pyx_k_VariantRecordSample_items, sizeof(__pyx_k_VariantRecordSample_items), 0, 1, 1}, /* PyObject cname: __pyx_n_u_VariantRecordSample_items */
  {__pyx_k_VariantRecordSample_iteritems, sizeof(__pyx_k_VariantRecordSample_iteritems), 0, 1, 1}, /* PyObject cname: __pyx_n_u_VariantRecordSample_iteritems */
  {__pyx_k_VariantRecordSample_iterkeys, sizeof(__pyx_k_VariantRecordSample_iterkeys), 0, 1, 1}, /* PyObject cname: __pyx_n_u_VariantRecordSample_iterkeys */
  {__pyx_k_VariantRecordSample_itervalues, sizeof(__pyx_k_VariantRecordSample_itervalues), 0, 1, 1}, /* PyObject cname: __pyx_n_u_VariantRecordSample_itervalues */
  {__pyx_k_VariantRecordSample_keys, sizeof(__pyx_k_VariantRecordSample_keys), 0, 1, 1}, /* PyObject cname: __pyx_n_u_VariantRecordSample_keys */
  {__pyx_k_VariantRecordSample_pop, sizeof(__pyx_k_VariantRecordSample_pop), 0, 1, 1}, /* PyObject cname: __pyx_n_u_VariantRecordSample_pop */
  {__pyx_k_VariantRecordSample_update, sizeof(__pyx_k_VariantRecordSample_update), 0, 1, 1}, /* PyObject cname: __pyx_n_u_VariantRecordSample_update */
  {__pyx_k_VariantRecordSample_values, sizeof(__pyx_k_VariantRecordSample_values), 0, 1, 1}, /* PyObject cname: __pyx_n_u_VariantRecordSample_values */
  {__pyx_k_VariantRecordSamples, sizeof(__pyx_k_VariantRecordSamples), 0, 1, 1}, /* PyObject cname: __pyx_n_u_VariantRecordSamples */
  {__pyx_k_VariantRecordSamples___iter, sizeof(__pyx_k_VariantRecordSamples___iter), 0, 1, 1}, /* PyObject cname: __pyx_n_u_VariantRecordSamples___iter */
  {__pyx_k_VariantRecordSamples___reduce_cy, sizeof(__pyx_k_VariantRecordSamples___reduce_cy), 0, 1, 1}, /* PyObject cname: __pyx_n_u_VariantRecordSamples___reduce_cy */
  {__pyx_k_VariantRecordSamples___setstate, sizeof(__pyx_k_VariantRecordSamples___setstate), 0, 1, 1}, /* PyObject cname: __pyx_n_u_VariantRecordSamples___setstate */
  {__pyx_k_VariantRecordSamples_get, sizeof(__pyx_k_VariantRecordSamples_get), 0, 1, 1}, /* PyObject cname: __pyx_n_u_VariantRecordSamples_get */
  {__pyx_k_VariantRecordSamples_items, sizeof(__pyx_k_VariantRecordSamples_items), 0, 1, 1}, /* PyObject cname: __pyx_n_u_VariantRecordSamples_items */
  {__pyx_k_VariantRecordSamples_iteritems, sizeof(__pyx_k_VariantRecordSamples_iteritems), 0, 1, 1}, /* PyObject cname: __pyx_n_u_VariantRecordSamples_iteritems */
  {__pyx_k_VariantRecordSamples_iterkeys, sizeof(__pyx_k_VariantRecordSamples_iterkeys), 0, 1, 1}, /* PyObject cname: __pyx_n_u_VariantRecordSamples_iterkeys */
  {__pyx_k_VariantRecordSamples_itervalues, sizeof(__pyx_k_VariantRecordSamples_itervalues), 0, 1, 1}, /* PyObject cname: __pyx_n_u_VariantRecordSamples_itervalues */
  {__pyx_k_VariantRecordSamples_keys, sizeof(__pyx_k_VariantRecordSamples_keys), 0, 1, 1}, /* PyObject cname: __pyx_n_u_VariantRecordSamples_keys */
  {__pyx_k_VariantRecordSamples_pop, sizeof(__pyx_k_VariantRecordSamples_pop), 0, 1, 1}, /* PyObject cname: __pyx_n_u_VariantRecordSamples_pop */
  {__pyx_k_VariantRecordSamples_update, sizeof(__pyx_k_VariantRecordSamples_update), 0, 1, 1}, /* PyObject cname: __pyx_n_u_VariantRecordSamples_update */
  {__pyx_k_VariantRecordSamples_values, sizeof(__pyx_k_VariantRecordSamples_values), 0, 1, 1}, /* PyObject cname: __pyx_n_u_VariantRecordSamples_values */
  {__pyx_k_VariantRecord___reduce_cython, sizeof(__pyx_k_VariantRecord___reduce_cython), 0, 1, 1}, /* PyObject cname: __pyx_n_u_VariantRecord___reduce_cython */
  {__pyx_k_VariantRecord___setstate_cython, sizeof(__pyx_k_VariantRecord___setstate_cython), 0, 1, 1}, /* PyObject cname: __pyx_n_u_VariantRecord___setstate_cython */
  {__pyx_k_VariantRecord_copy, sizeof(__pyx_k_VariantRecord_copy), 0, 1, 1}, /* PyObject cname: __pyx_n_u_VariantRecord_copy */
  {__pyx_k_VariantRecord_translate, sizeof(__pyx_k_VariantRecord_translate), 0, 1, 1}, /* PyObject cname: __pyx_n_u_VariantRecord_translate */
  {__pyx_k__11, sizeof(__pyx_k__11), 0, 0, 0}, /* PyObject cname: __pyx_kp_b__11 */
  {__pyx_k__12, sizeof(__pyx_k__12), 0, 1, 0}, /* PyObject cname: __pyx_kp_u__12 */
  {__pyx_k__17, sizeof(__pyx_k__17), 0, 1, 1}, /* PyObject cname: __pyx_n_u__17 */
  {__pyx_k__2, sizeof(__pyx_k__2), 0, 0, 0}, /* PyObject cname: __pyx_kp_b__2 */
  {__pyx_k__2, sizeof(__pyx_k__2), 0, 1, 0}, /* PyObject cname: __pyx_kp_u__2 */
  {__pyx_k__4, sizeof(__pyx_k__4), 0, 0, 0}, /* PyObject cname: __pyx_kp_b__4 */
  {__pyx_k__4, sizeof(__pyx_k__4), 0, 1, 0}, /* PyObject cname: __pyx_kp_u__4 */
  {__pyx_k__5, sizeof(__pyx_k__5), 0, 1, 0}, /* PyObject cname: __pyx_kp_u__5 */
  {__pyx_k__8, sizeof(__pyx_k__8), 0, 1, 0}, /* PyObject cname: __pyx_kp_u__8 */
  {__pyx_k_a, sizeof(__pyx_k_a), 0, 1, 1}, /* PyObject cname: __pyx_n_u_a */
  {__pyx_k_add, sizeof(__pyx_k_add), 0, 1, 1}, /* PyObject cname: __pyx_n_u_add */
  {__pyx_k_add_line, sizeof(__pyx_k_add_line), 0, 1, 1}, /* PyObject cname: __pyx_n_u_add_line */
  {__pyx_k_add_meta, sizeof(__pyx_k_add_meta), 0, 1, 1}, /* PyObject cname: __pyx_n_u_add_meta */
  {__pyx_k_add_note, sizeof(__pyx_k_add_note), 0, 1, 0}, /* PyObject cname: __pyx_kp_u_add_note */
  {__pyx_k_add_record, sizeof(__pyx_k_add_record), 0, 1, 1}, /* PyObject cname: __pyx_n_u_add_record */
  {__pyx_k_add_sample, sizeof(__pyx_k_add_sample), 0, 1, 1}, /* PyObject cname: __pyx_n_u_add_sample */
  {__pyx_k_add_sample_2, sizeof(__pyx_k_add_sample_2), 0, 1, 1}, /* PyObject cname: __pyx_n_u_add_sample_2 */
  {__pyx_k_add_samples, sizeof(__pyx_k_add_samples), 0, 1, 1}, /* PyObject cname: __pyx_n_u_add_samples */
  {__pyx_k_all, sizeof(__pyx_k_all), 0, 1, 1}, /* PyObject cname: __pyx_n_u_all */
  {__pyx_k_allele, sizeof(__pyx_k_allele), 0, 1, 1}, /* PyObject cname: __pyx_n_u_allele */
  {__pyx_k_alleles, sizeof(__pyx_k_alleles), 0, 1, 1}, /* PyObject cname: __pyx_n_u_alleles */
  {__pyx_k_append, sizeof(__pyx_k_append), 0, 1, 1}, /* PyObject cname: __pyx_n_u_append */
  {__pyx_k_arg, sizeof(__pyx_k_arg), 0, 1, 1}, /* PyObject cname: __pyx_n_u_arg */
  {__pyx_k_args, sizeof(__pyx_k_args), 0, 1, 1}, /* PyObject cname: __pyx_n_u_args */
  {__pyx_k_asyncio_coroutines, sizeof(__pyx_k_asyncio_coroutines), 0, 1, 1}, /* PyObject cname: __pyx_n_u_asyncio_coroutines */
  {__pyx_k_bcf, sizeof(__pyx_k_bcf), 0, 1, 1}, /* PyObject cname: __pyx_n_u_bcf */
  {__pyx_k_bcf_2, sizeof(__pyx_k_bcf_2), 0, 1, 0}, /* PyObject cname: __pyx_kp_u_bcf_2 */
  {__pyx_k_bcf_array_to_object, sizeof(__pyx_k_bcf_array_to_object), 0, 1, 1}, /* PyObject cname: __pyx_n_u_bcf_array_to_object */
  {__pyx_k_bcf_array_to_object_locals_genex, sizeof(__pyx_k_bcf_array_to_object_locals_genex), 0, 1, 1}, /* PyObject cname: __pyx_n_u_bcf_array_to_object_locals_genex */
  {__pyx_k_bcf_check_values, sizeof(__pyx_k_bcf_check_values), 0, 1, 1}, /* PyObject cname: __pyx_n_u_bcf_check_values */
  {__pyx_k_bcf_check_values_locals_genexpr, sizeof(__pyx_k_bcf_check_values_locals_genexpr), 0, 1, 1}, /* PyObject cname: __pyx_n_u_bcf_check_values_locals_genexpr */
  {__pyx_k_bcf_copy_expand_array, sizeof(__pyx_k_bcf_copy_expand_array), 0, 1, 1}, /* PyObject cname: __pyx_n_u_bcf_copy_expand_array */
  {__pyx_k_bcf_empty_array, sizeof(__pyx_k_bcf_empty_array), 0, 1, 1}, /* PyObject cname: __pyx_n_u_bcf_empty_array */
  {__pyx_k_bcf_encode_alleles, sizeof(__pyx_k_bcf_encode_alleles), 0, 1, 1}, /* PyObject cname: __pyx_n_u_bcf_encode_alleles */
  {__pyx_k_bcf_format_del_value, sizeof(__pyx_k_bcf_format_del_value), 0, 1, 1}, /* PyObject cname: __pyx_n_u_bcf_format_del_value */
  {__pyx_k_bcf_format_get_allele_indices, sizeof(__pyx_k_bcf_format_get_allele_indices), 0, 1, 1}, /* PyObject cname: __pyx_n_u_bcf_format_get_allele_indices */
  {__pyx_k_bcf_format_get_alleles, sizeof(__pyx_k_bcf_format_get_alleles), 0, 1, 1}, /* PyObject cname: __pyx_n_u_bcf_format_get_alleles */
  {__pyx_k_bcf_format_get_value, sizeof(__pyx_k_bcf_format_get_value), 0, 1, 1}, /* PyObject cname: __pyx_n_u_bcf_format_get_value */
  {__pyx_k_bcf_format_set_value, sizeof(__pyx_k_bcf_format_set_value), 0, 1, 1}, /* PyObject cname: __pyx_n_u_bcf_format_set_value */
  {__pyx_k_bcf_geno_combinations, sizeof(__pyx_k_bcf_geno_combinations), 0, 1, 1}, /* PyObject cname: __pyx_n_u_bcf_geno_combinations */
  {__pyx_k_bcf_genotype_count, sizeof(__pyx_k_bcf_genotype_count), 0, 1, 1}, /* PyObject cname: __pyx_n_u_bcf_genotype_count */
  {__pyx_k_bcf_get_value_count, sizeof(__pyx_k_bcf_get_value_count), 0, 1, 1}, /* PyObject cname: __pyx_n_u_bcf_get_value_count */
  {__pyx_k_bcf_hdr_format_failed, sizeof(__pyx_k_bcf_hdr_format_failed), 0, 1, 0}, /* PyObject cname: __pyx_kp_u_bcf_hdr_format_failed */
  {__pyx_k_bcf_hdr_set_samples_failed_ret, sizeof(__pyx_k_bcf_hdr_set_samples_failed_ret), 0, 1, 0}, /* PyObject cname: __pyx_kp_u_bcf_hdr_set_samples_failed_ret */
  {__pyx_k_bcf_header_get_info_id, sizeof(__pyx_k_bcf_header_get_info_id), 0, 1, 1}, /* PyObject cname: __pyx_n_u_bcf_header_get_info_id */
  {__pyx_k_bcf_header_remove_hrec, sizeof(__pyx_k_bcf_header_remove_hrec), 0, 1, 1}, /* PyObject cname: __pyx_n_u_bcf_header_remove_hrec */
  {__pyx_k_bcf_index_required, sizeof(__pyx_k_bcf_index_required), 0, 1, 0}, /* PyObject cname: __pyx_kp_u_bcf_index_required */
  {__pyx_k_bcf_info_del_value, sizeof(__pyx_k_bcf_info_del_value), 0, 1, 1}, /* PyObject cname: __pyx_n_u_bcf_info_del_value */
  {__pyx_k_bcf_info_get_value, sizeof(__pyx_k_bcf_info_get_value), 0, 1, 1}, /* PyObject cname: __pyx_n_u_bcf_info_get_value */
  {__pyx_k_bcf_info_set_value, sizeof(__pyx_k_bcf_info_set_value), 0, 1, 1}, /* PyObject cname: __pyx_n_u_bcf_info_set_value */
  {__pyx_k_bcf_must_not_be_None, sizeof(__pyx_k_bcf_must_not_be_None), 0, 1, 0}, /* PyObject cname: __pyx_kp_u_bcf_must_not_be_None */
  {__pyx_k_bcf_object_to_array, sizeof(__pyx_k_bcf_object_to_array), 0, 1, 1}, /* PyObject cname: __pyx_n_u_bcf_object_to_array */
  {__pyx_k_bcf_object_to_array_locals_genex, sizeof(__pyx_k_bcf_object_to_array_locals_genex), 0, 1, 1}, /* PyObject cname: __pyx_n_u_bcf_object_to_array_locals_genex */
  {__pyx_k_bcf_sample_get_phased, sizeof(__pyx_k_bcf_sample_get_phased), 0, 1, 1}, /* PyObject cname: __pyx_n_u_bcf_sample_get_phased */
  {__pyx_k_bcf_sample_set_phased, sizeof(__pyx_k_bcf_sample_set_phased), 0, 1, 1}, /* PyObject cname: __pyx_n_u_bcf_sample_set_phased */
  {__pyx_k_bcf_str_cache, sizeof(__pyx_k_bcf_str_cache), 0, 1, 1}, /* PyObject cname: __pyx_n_u_bcf_str_cache */
  {__pyx_k_bcf_str_cache_get_charptr, sizeof(__pyx_k_bcf_str_cache_get_charptr), 0, 1, 1}, /* PyObject cname: __pyx_n_u_bcf_str_cache_get_charptr */
  {__pyx_k_bcf_sync_end, sizeof(__pyx_k_bcf_sync_end), 0, 1, 1}, /* PyObject cname: __pyx_n_u_bcf_sync_end */
  {__pyx_k_bcguz, sizeof(__pyx_k_bcguz), 0, 1, 1}, /* PyObject cname: __pyx_n_u_bcguz */
  {__pyx_k_bcguz0123456789ex, sizeof(__pyx_k_bcguz0123456789ex), 0, 1, 1}, /* PyObject cname: __pyx_n_u_bcguz0123456789ex */
  {__pyx_k_bchrom, sizeof(__pyx_k_bchrom), 0, 1, 1}, /* PyObject cname: __pyx_n_u_bchrom */
  {__pyx_k_bgzfp, sizeof(__pyx_k_bgzfp), 0, 1, 1}, /* PyObject cname: __pyx_n_u_bgzfp */
  {__pyx_k_bid, sizeof(__pyx_k_bid), 0, 1, 1}, /* PyObject cname: __pyx_n_u_bid */
  {__pyx_k_bkey, sizeof(__pyx_k_bkey), 0, 1, 1}, /* PyObject cname: __pyx_n_u_bkey */
  {__pyx_k_bline, sizeof(__pyx_k_bline), 0, 1, 1}, /* PyObject cname: __pyx_n_u_bline */
  {__pyx_k_bool, sizeof(__pyx_k_bool), 0, 1, 1}, /* PyObject cname: __pyx_n_u_bool */
  {__pyx_k_bt_len, sizeof(__pyx_k_bt_len), 0, 1, 1}, /* PyObject cname: __pyx_n_u_bt_len */
  {__pyx_k_bt_type, sizeof(__pyx_k_bt_type), 0, 1, 1}, /* PyObject cname: __pyx_n_u_bt_type */
  {__pyx_k_c, sizeof(__pyx_k_c), 0, 1, 1}, /* PyObject cname: __pyx_n_u_c */
  {__pyx_k_cannot_convert_deleted_record_to, sizeof(__pyx_k_cannot_convert_deleted_record_to), 0, 1, 0}, /* PyObject cname: __pyx_kp_u_cannot_convert_deleted_record_to */
  {__pyx_k_cannot_create_VariantHeader, sizeof(__pyx_k_cannot_create_VariantHeader), 0, 1, 0}, /* PyObject cname: __pyx_kp_u_cannot_create_VariantHeader */
  {__pyx_k_cannot_create_VariantRecord, sizeof(__pyx_k_cannot_create_VariantRecord), 0, 1, 0}, /* PyObject cname: __pyx_kp_u_cannot_create_VariantRecord */
  {__pyx_k_cannot_create_VariantRecordSampl, sizeof(__pyx_k_cannot_create_VariantRecordSampl), 0, 1, 0}, /* PyObject cname: __pyx_kp_u_cannot_create_VariantRecordSampl */
  {__pyx_k_cannot_fetch_from_Variantfile_op, sizeof(__pyx_k_cannot_fetch_from_Variantfile_op), 0, 1, 0}, /* PyObject cname: __pyx_kp_u_cannot_fetch_from_Variantfile_op */
  {__pyx_k_cannot_find_metadata_key, sizeof(__pyx_k_cannot_find_metadata_key), 0, 1, 0}, /* PyObject cname: __pyx_kp_u_cannot_find_metadata_key */
  {__pyx_k_cannot_iterate_over_Variantfile, sizeof(__pyx_k_cannot_iterate_over_Variantfile), 0, 1, 0}, /* PyObject cname: __pyx_kp_u_cannot_iterate_over_Variantfile */
  {__pyx_k_cannot_set_null_allele, sizeof(__pyx_k_cannot_set_null_allele), 0, 1, 0}, /* PyObject cname: __pyx_kp_u_cannot_set_null_allele */
  {__pyx_k_cannot_set_null_alt_allele, sizeof(__pyx_k_cannot_set_null_alt_allele), 0, 1, 0}, /* PyObject cname: __pyx_kp_u_cannot_set_null_alt_allele */
  {__pyx_k_cannot_subset_samples_after_fetc, sizeof(__pyx_k_cannot_subset_samples_after_fetc), 0, 1, 0}, /* PyObject cname: __pyx_kp_u_cannot_subset_samples_after_fetc */
  {__pyx_k_cannot_subset_samples_from_Varia, sizeof(__pyx_k_cannot_subset_samples_from_Varia), 0, 1, 0}, /* PyObject cname: __pyx_kp_u_cannot_subset_samples_from_Varia */
  {__pyx_k_cannot_write_to_a_Variantfile_op, sizeof(__pyx_k_cannot_write_to_a_Variantfile_op), 0, 1, 0}, /* PyObject cname: __pyx_kp_u_cannot_write_to_a_Variantfile_op */
  {__pyx_k_cfilename, sizeof(__pyx_k_cfilename), 0, 1, 1}, /* PyObject cname: __pyx_n_u_cfilename */
  {__pyx_k_char_array_to_tuple, sizeof(__pyx_k_char_array_to_tuple), 0, 1, 1}, /* PyObject cname: __pyx_n_u_char_array_to_tuple */
  {__pyx_k_char_array_to_tuple_locals_genex, sizeof(__pyx_k_char_array_to_tuple_locals_genex), 0, 1, 1}, /* PyObject cname: __pyx_n_u_char_array_to_tuple_locals_genex */
  {__pyx_k_check_header_id, sizeof(__pyx_k_check_header_id), 0, 1, 1}, /* PyObject cname: __pyx_n_u_check_header_id */
  {__pyx_k_check_truncation, sizeof(__pyx_k_check_truncation), 0, 1, 1}, /* PyObject cname: __pyx_n_u_check_truncation */
  {__pyx_k_cindex_filename, sizeof(__pyx_k_cindex_filename), 0, 1, 1}, /* PyObject cname: __pyx_n_u_cindex_filename */
  {__pyx_k_cinit, sizeof(__pyx_k_cinit), 0, 1, 1}, /* PyObject cname: __pyx_n_u_cinit */
  {__pyx_k_ckey, sizeof(__pyx_k_ckey), 0, 1, 1}, /* PyObject cname: __pyx_n_u_ckey */
  {__pyx_k_class_getitem, sizeof(__pyx_k_class_getitem), 0, 1, 1}, /* PyObject cname: __pyx_n_u_class_getitem */
  {__pyx_k_clear, sizeof(__pyx_k_clear), 0, 1, 1}, /* PyObject cname: __pyx_n_u_clear */
  {__pyx_k_clear_header, sizeof(__pyx_k_clear_header), 0, 1, 1}, /* PyObject cname: __pyx_n_u_clear_header */
  {__pyx_k_cline_in_traceback, sizeof(__pyx_k_cline_in_traceback), 0, 1, 1}, /* PyObject cname: __pyx_n_u_cline_in_traceback */
  {__pyx_k_close, sizeof(__pyx_k_close), 0, 1, 1}, /* PyObject cname: __pyx_n_u_close */
  {__pyx_k_cmode, sizeof(__pyx_k_cmode), 0, 1, 1}, /* PyObject cname: __pyx_n_u_cmode */
  {__pyx_k_cmp, sizeof(__pyx_k_cmp), 0, 1, 1}, /* PyObject cname: __pyx_n_u_cmp */
  {__pyx_k_comb, sizeof(__pyx_k_comb), 0, 1, 1}, /* PyObject cname: __pyx_n_u_comb */
  {__pyx_k_contains, sizeof(__pyx_k_contains), 0, 1, 1}, /* PyObject cname: __pyx_n_u_contains */
  {__pyx_k_contig, sizeof(__pyx_k_contig), 0, 1, 1}, /* PyObject cname: __pyx_n_u_contig */
  {__pyx_k_contig_must_be_specified, sizeof(__pyx_k_contig_must_be_specified), 0, 1, 0}, /* PyObject cname: __pyx_kp_u_contig_must_be_specified */
  {__pyx_k_copy, sizeof(__pyx_k_copy), 0, 1, 1}, /* PyObject cname: __pyx_n_u_copy */
  {__pyx_k_could_not_open_file_mode, sizeof(__pyx_k_could_not_open_file_mode), 0, 1, 0}, /* PyObject cname: __pyx_kp_u_could_not_open_file_mode */
  {__pyx_k_could_not_open_variant_file, sizeof(__pyx_k_could_not_open_variant_file), 0, 1, 0}, /* PyObject cname: __pyx_kp_u_could_not_open_variant_file */
  {__pyx_k_count, sizeof(__pyx_k_count), 0, 1, 1}, /* PyObject cname: __pyx_n_u_count */
  {__pyx_k_cstart, sizeof(__pyx_k_cstart), 0, 1, 1}, /* PyObject cname: __pyx_n_u_cstart */
  {__pyx_k_cstop, sizeof(__pyx_k_cstop), 0, 1, 1}, /* PyObject cname: __pyx_n_u_cstop */
  {__pyx_k_d, sizeof(__pyx_k_d), 0, 1, 1}, /* PyObject cname: __pyx_n_u_d */
  {__pyx_k_data, sizeof(__pyx_k_data), 0, 1, 1}, /* PyObject cname: __pyx_n_u_data */
  {__pyx_k_dealloc, sizeof(__pyx_k_dealloc), 0, 1, 1}, /* PyObject cname: __pyx_n_u_dealloc */
  {__pyx_k_default, sizeof(__pyx_k_default), 0, 1, 1}, /* PyObject cname: __pyx_n_u_default */
  {__pyx_k_del, sizeof(__pyx_k_del), 0, 1, 1}, /* PyObject cname: __pyx_n_u_del */
  {__pyx_k_delitem, sizeof(__pyx_k_delitem), 0, 1, 1}, /* PyObject cname: __pyx_n_u_delitem */
  {__pyx_k_descr, sizeof(__pyx_k_descr), 0, 1, 1}, /* PyObject cname: __pyx_n_u_descr */
  {__pyx_k_description, sizeof(__pyx_k_description), 0, 1, 1}, /* PyObject cname: __pyx_n_u_description */
  {__pyx_k_dict, sizeof(__pyx_k_dict), 0, 1, 1}, /* PyObject cname: __pyx_n_u_dict */
  {__pyx_k_dict_2, sizeof(__pyx_k_dict_2), 0, 1, 1}, /* PyObject cname: __pyx_n_u_dict_2 */
  {__pyx_k_disable, sizeof(__pyx_k_disable), 0, 1, 0}, /* PyObject cname: __pyx_kp_u_disable */
  {__pyx_k_drop_samples, sizeof(__pyx_k_drop_samples), 0, 1, 1}, /* PyObject cname: __pyx_n_u_drop_samples */
  {__pyx_k_dst_data, sizeof(__pyx_k_dst_data), 0, 1, 1}, /* PyObject cname: __pyx_n_u_dst_data */
  {__pyx_k_dst_hdr, sizeof(__pyx_k_dst_hdr), 0, 1, 1}, /* PyObject cname: __pyx_n_u_dst_hdr */
  {__pyx_k_dst_header, sizeof(__pyx_k_dst_header), 0, 1, 1}, /* PyObject cname: __pyx_n_u_dst_header */
  {__pyx_k_dst_header_must_not_be_None, sizeof(__pyx_k_dst_header_must_not_be_None), 0, 1, 0}, /* PyObject cname: __pyx_kp_u_dst_header_must_not_be_None */
  {__pyx_k_dst_type, sizeof(__pyx_k_dst_type), 0, 1, 1}, /* PyObject cname: __pyx_n_u_dst_type */
  {__pyx_k_dst_values, sizeof(__pyx_k_dst_values), 0, 1, 1}, /* PyObject cname: __pyx_n_u_dst_values */
  {__pyx_k_duplicate_filehandle, sizeof(__pyx_k_duplicate_filehandle), 0, 1, 1}, /* PyObject cname: __pyx_n_u_duplicate_filehandle */
  {__pyx_k_either_value_or_items_must_be_sp, sizeof(__pyx_k_either_value_or_items_must_be_sp), 0, 1, 0}, /* PyObject cname: __pyx_kp_u_either_value_or_items_must_be_sp */
  {__pyx_k_enable, sizeof(__pyx_k_enable), 0, 1, 0}, /* PyObject cname: __pyx_kp_u_enable */
  {__pyx_k_end, sizeof(__pyx_k_end), 0, 1, 1}, /* PyObject cname: __pyx_n_u_end */
  {__pyx_k_endswith, sizeof(__pyx_k_endswith), 0, 1, 1}, /* PyObject cname: __pyx_n_u_endswith */
  {__pyx_k_enumerate, sizeof(__pyx_k_enumerate), 0, 1, 1}, /* PyObject cname: __pyx_n_u_enumerate */
  {__pyx_k_errcode, sizeof(__pyx_k_errcode), 0, 1, 1}, /* PyObject cname: __pyx_n_u_errcode */
  {__pyx_k_error_in_bcf_subset_format, sizeof(__pyx_k_error_in_bcf_subset_format), 0, 1, 0}, /* PyObject cname: __pyx_kp_u_error_in_bcf_subset_format */
  {__pyx_k_error_in_vcf_parse, sizeof(__pyx_k_error_in_vcf_parse), 0, 1, 0}, /* PyObject cname: __pyx_kp_u_error_in_vcf_parse */
  {__pyx_k_f, sizeof(__pyx_k_f), 0, 1, 1}, /* PyObject cname: __pyx_n_u_f */
  {__pyx_k_fetch, sizeof(__pyx_k_fetch), 0, 1, 1}, /* PyObject cname: __pyx_n_u_fetch */
  {__pyx_k_fetch_requires_an_index, sizeof(__pyx_k_fetch_requires_an_index), 0, 1, 0}, /* PyObject cname: __pyx_kp_u_fetch_requires_an_index */
  {__pyx_k_file_does_not_have_valid_header, sizeof(__pyx_k_file_does_not_have_valid_header), 0, 1, 0}, /* PyObject cname: __pyx_kp_u_file_does_not_have_valid_header */
  {__pyx_k_filename, sizeof(__pyx_k_filename), 0, 1, 1}, /* PyObject cname: __pyx_n_u_filename */
  {__pyx_k_filter, sizeof(__pyx_k_filter), 0, 1, 1}, /* PyObject cname: __pyx_n_u_filter */
  {__pyx_k_fmt, sizeof(__pyx_k_fmt), 0, 1, 1}, /* PyObject cname: __pyx_n_u_fmt */
  {__pyx_k_fmt_id, sizeof(__pyx_k_fmt_id), 0, 1, 1}, /* PyObject cname: __pyx_n_u_fmt_id */
  {__pyx_k_format, sizeof(__pyx_k_format), 0, 1, 1}, /* PyObject cname: __pyx_n_u_format */
  {__pyx_k_format_modes, sizeof(__pyx_k_format_modes), 0, 1, 1}, /* PyObject cname: __pyx_n_u_format_modes */
  {__pyx_k_free_after, sizeof(__pyx_k_free_after), 0, 1, 1}, /* PyObject cname: __pyx_n_u_free_after */
  {__pyx_k_func, sizeof(__pyx_k_func), 0, 1, 1}, /* PyObject cname: __pyx_n_u_func */
  {__pyx_k_gc, sizeof(__pyx_k_gc), 0, 1, 0}, /* PyObject cname: __pyx_kp_u_gc */
  {__pyx_k_genexpr, sizeof(__pyx_k_genexpr), 0, 1, 1}, /* PyObject cname: __pyx_n_u_genexpr */
  {__pyx_k_genotype_is_only_valid_as_a_form, sizeof(__pyx_k_genotype_is_only_valid_as_a_form), 0, 1, 0}, /* PyObject cname: __pyx_kp_u_genotype_is_only_valid_as_a_form */
  {__pyx_k_get, sizeof(__pyx_k_get), 0, 1, 1}, /* PyObject cname: __pyx_n_u_get */
  {__pyx_k_get_2, sizeof(__pyx_k_get_2), 0, 1, 1}, /* PyObject cname: __pyx_n_u_get_2 */
  {__pyx_k_get_reference_name, sizeof(__pyx_k_get_reference_name), 0, 1, 1}, /* PyObject cname: __pyx_n_u_get_reference_name */
  {__pyx_k_get_tid, sizeof(__pyx_k_get_tid), 0, 1, 1}, /* PyObject cname: __pyx_n_u_get_tid */
  {__pyx_k_getitem, sizeof(__pyx_k_getitem), 0, 1, 1}, /* PyObject cname: __pyx_n_u_getitem */
  {__pyx_k_getstate, sizeof(__pyx_k_getstate), 0, 1, 1}, /* PyObject cname: __pyx_n_u_getstate */
  {__pyx_k_gz, sizeof(__pyx_k_gz), 0, 1, 0}, /* PyObject cname: __pyx_kp_u_gz */
  {__pyx_k_has_symbolic_allele, sizeof(__pyx_k_has_symbolic_allele), 0, 1, 1}, /* PyObject cname: __pyx_n_u_has_symbolic_allele */
  {__pyx_k_hash, sizeof(__pyx_k_hash), 0, 1, 1}, /* PyObject cname: __pyx_n_u_hash */
  {__pyx_k_hdr, sizeof(__pyx_k_hdr), 0, 1, 1}, /* PyObject cname: __pyx_n_u_hdr */
  {__pyx_k_hdr_sync, sizeof(__pyx_k_hdr_sync), 0, 1, 1}, /* PyObject cname: __pyx_n_u_hdr_sync */
  {__pyx_k_header, sizeof(__pyx_k_header), 0, 1, 1}, /* PyObject cname: __pyx_n_u_header */
  {__pyx_k_header_must_not_be_None, sizeof(__pyx_k_header_must_not_be_None), 0, 1, 0}, /* PyObject cname: __pyx_kp_u_header_must_not_be_None */
  {__pyx_k_hl_type, sizeof(__pyx_k_hl_type), 0, 1, 1}, /* PyObject cname: __pyx_n_u_hl_type */
  {__pyx_k_hlen, sizeof(__pyx_k_hlen), 0, 1, 1}, /* PyObject cname: __pyx_n_u_hlen */
  {__pyx_k_hrec, sizeof(__pyx_k_hrec), 0, 1, 1}, /* PyObject cname: __pyx_n_u_hrec */
  {__pyx_k_hrec_str, sizeof(__pyx_k_hrec_str), 0, 1, 1}, /* PyObject cname: __pyx_n_u_hrec_str */
  {__pyx_k_ht_type, sizeof(__pyx_k_ht_type), 0, 1, 1}, /* PyObject cname: __pyx_n_u_ht_type */
  {__pyx_k_i, sizeof(__pyx_k_i), 0, 1, 1}, /* PyObject cname: __pyx_n_u_i */
  {__pyx_k_id, sizeof(__pyx_k_id), 0, 1, 1}, /* PyObject cname: __pyx_n_u_id */
  {__pyx_k_idpair, sizeof(__pyx_k_idpair), 0, 1, 1}, /* PyObject cname: __pyx_n_u_idpair */
  {__pyx_k_idstr, sizeof(__pyx_k_idstr), 0, 1, 1}, /* PyObject cname: __pyx_n_u_idstr */
  {__pyx_k_idx, sizeof(__pyx_k_idx), 0, 1, 1}, /* PyObject cname: __pyx_n_u_idx */
  {__pyx_k_ignore_truncation, sizeof(__pyx_k_ignore_truncation), 0, 1, 1}, /* PyObject cname: __pyx_n_u_ignore_truncation */
  {__pyx_k_include_samples, sizeof(__pyx_k_include_samples), 0, 1, 1}, /* PyObject cname: __pyx_n_u_include_samples */
  {__pyx_k_index, sizeof(__pyx_k_index), 0, 1, 1}, /* PyObject cname: __pyx_n_u_index */
  {__pyx_k_index_filename, sizeof(__pyx_k_index_filename), 0, 1, 1}, /* PyObject cname: __pyx_n_u_index_filename */
  {__pyx_k_info, sizeof(__pyx_k_info), 0, 1, 1}, /* PyObject cname: __pyx_n_u_info */
  {__pyx_k_info_id, sizeof(__pyx_k_info_id), 0, 1, 1}, /* PyObject cname: __pyx_n_u_info_id */
  {__pyx_k_init, sizeof(__pyx_k_init), 0, 1, 1}, /* PyObject cname: __pyx_n_u_init */
  {__pyx_k_initializing, sizeof(__pyx_k_initializing), 0, 1, 1}, /* PyObject cname: __pyx_n_u_initializing */
  {__pyx_k_invalid_FORMAT, sizeof(__pyx_k_invalid_FORMAT), 0, 1, 0}, /* PyObject cname: __pyx_kp_u_invalid_FORMAT */
  {__pyx_k_invalid_VariantHeader, sizeof(__pyx_k_invalid_VariantHeader), 0, 1, 0}, /* PyObject cname: __pyx_kp_u_invalid_VariantHeader */
  {__pyx_k_invalid_VariantRecord, sizeof(__pyx_k_invalid_VariantRecord), 0, 1, 0}, /* PyObject cname: __pyx_kp_u_invalid_VariantRecord */
  {__pyx_k_invalid_character_found, sizeof(__pyx_k_invalid_character_found), 0, 1, 0}, /* PyObject cname: __pyx_kp_u_invalid_character_found */
  {__pyx_k_invalid_contig, sizeof(__pyx_k_invalid_contig), 0, 1, 0}, /* PyObject cname: __pyx_kp_u_invalid_contig */
  {__pyx_k_invalid_contig_2, sizeof(__pyx_k_invalid_contig_2), 0, 1, 0}, /* PyObject cname: __pyx_kp_u_invalid_contig_2 */
  {__pyx_k_invalid_contig_id, sizeof(__pyx_k_invalid_contig_id), 0, 1, 0}, /* PyObject cname: __pyx_kp_u_invalid_contig_id */
  {__pyx_k_invalid_contig_index, sizeof(__pyx_k_invalid_contig_index), 0, 1, 0}, /* PyObject cname: __pyx_kp_u_invalid_contig_index */
  {__pyx_k_invalid_file_mode_is_it_VCF_BCF, sizeof(__pyx_k_invalid_file_mode_is_it_VCF_BCF), 0, 1, 0}, /* PyObject cname: __pyx_kp_u_invalid_file_mode_is_it_VCF_BCF */
  {__pyx_k_invalid_filter_index, sizeof(__pyx_k_invalid_filter_index), 0, 1, 0}, /* PyObject cname: __pyx_kp_u_invalid_filter_index */
  {__pyx_k_invalid_header_line, sizeof(__pyx_k_invalid_header_line), 0, 1, 0}, /* PyObject cname: __pyx_kp_u_invalid_header_line */
  {__pyx_k_invalid_header_record_index, sizeof(__pyx_k_invalid_header_record_index), 0, 1, 0}, /* PyObject cname: __pyx_kp_u_invalid_header_record_index */
  {__pyx_k_invalid_key, sizeof(__pyx_k_invalid_key), 0, 1, 0}, /* PyObject cname: __pyx_kp_u_invalid_key */
  {__pyx_k_invalid_metadata_id, sizeof(__pyx_k_invalid_metadata_id), 0, 1, 0}, /* PyObject cname: __pyx_kp_u_invalid_metadata_id */
  {__pyx_k_invalid_metadata_type, sizeof(__pyx_k_invalid_metadata_type), 0, 1, 0}, /* PyObject cname: __pyx_kp_u_invalid_metadata_type */
  {__pyx_k_invalid_mode_options, sizeof(__pyx_k_invalid_mode_options), 0, 1, 0}, /* PyObject cname: __pyx_kp_u_invalid_mode_options */
  {__pyx_k_invalid_modes, sizeof(__pyx_k_invalid_modes), 0, 1, 1}, /* PyObject cname: __pyx_n_u_invalid_modes */
  {__pyx_k_invalid_number_of_columns, sizeof(__pyx_k_invalid_number_of_columns), 0, 1, 0}, /* PyObject cname: __pyx_kp_u_invalid_number_of_columns */
  {__pyx_k_invalid_reference_id, sizeof(__pyx_k_invalid_reference_id), 0, 1, 0}, /* PyObject cname: __pyx_kp_u_invalid_reference_id */
  {__pyx_k_invalid_sample_index, sizeof(__pyx_k_invalid_sample_index), 0, 1, 0}, /* PyObject cname: __pyx_kp_u_invalid_sample_index */
  {__pyx_k_invalid_sample_name, sizeof(__pyx_k_invalid_sample_name), 0, 1, 0}, /* PyObject cname: __pyx_kp_u_invalid_sample_name */
  {__pyx_k_invalid_tag, sizeof(__pyx_k_invalid_tag), 0, 1, 0}, /* PyObject cname: __pyx_kp_u_invalid_tag */
  {__pyx_k_invalid_value_for_Float_format, sizeof(__pyx_k_invalid_value_for_Float_format), 0, 1, 0}, /* PyObject cname: __pyx_kp_u_invalid_value_for_Float_format */
  {__pyx_k_invalid_value_for_Integer_format, sizeof(__pyx_k_invalid_value_for_Integer_format), 0, 1, 0}, /* PyObject cname: __pyx_kp_u_invalid_value_for_Integer_format */
  {__pyx_k_is_coroutine, sizeof(__pyx_k_is_coroutine), 0, 1, 1}, /* PyObject cname: __pyx_n_u_is_coroutine */
  {__pyx_k_is_gt_fmt, sizeof(__pyx_k_is_gt_fmt), 0, 1, 1}, /* PyObject cname: __pyx_n_u_is_gt_fmt */
  {__pyx_k_is_open, sizeof(__pyx_k_is_open), 0, 1, 1}, /* PyObject cname: __pyx_n_u_is_open */
  {__pyx_k_is_valid_tid, sizeof(__pyx_k_is_valid_tid), 0, 1, 1}, /* PyObject cname: __pyx_n_u_is_valid_tid */
  {__pyx_k_isenabled, sizeof(__pyx_k_isenabled), 0, 1, 0}, /* PyObject cname: __pyx_kp_u_isenabled */
  {__pyx_k_items, sizeof(__pyx_k_items), 0, 1, 1}, /* PyObject cname: __pyx_n_u_items */
  {__pyx_k_iter, sizeof(__pyx_k_iter), 0, 1, 1}, /* PyObject cname: __pyx_n_u_iter */
  {__pyx_k_iteritems, sizeof(__pyx_k_iteritems), 0, 1, 1}, /* PyObject cname: __pyx_n_u_iteritems */
  {__pyx_k_iterkeys, sizeof(__pyx_k_iterkeys), 0, 1, 1}, /* PyObject cname: __pyx_n_u_iterkeys */
  {__pyx_k_itervalues, sizeof(__pyx_k_itervalues), 0, 1, 1}, /* PyObject cname: __pyx_n_u_itervalues */
  {__pyx_k_join, sizeof(__pyx_k_join), 0, 1, 1}, /* PyObject cname: __pyx_n_u_join */
  {__pyx_k_k, sizeof(__pyx_k_k), 0, 1, 1}, /* PyObject cname: __pyx_n_u_k */
  {__pyx_k_key, sizeof(__pyx_k_key), 0, 1, 1}, /* PyObject cname: __pyx_n_u_key */
  {__pyx_k_keys, sizeof(__pyx_k_keys), 0, 1, 1}, /* PyObject cname: __pyx_n_u_keys */
  {__pyx_k_kwargs, sizeof(__pyx_k_kwargs), 0, 1, 1}, /* PyObject cname: __pyx_n_u_kwargs */
  {__pyx_k_l, sizeof(__pyx_k_l), 0, 1, 1}, /* PyObject cname: __pyx_n_u_l */
  {__pyx_k_len, sizeof(__pyx_k_len), 0, 1, 1}, /* PyObject cname: __pyx_n_u_len */
  {__pyx_k_length, sizeof(__pyx_k_length), 0, 1, 1}, /* PyObject cname: __pyx_n_u_length */
  {__pyx_k_limits_violated, sizeof(__pyx_k_limits_violated), 0, 1, 0}, /* PyObject cname: __pyx_kp_u_limits_violated */
  {__pyx_k_line, sizeof(__pyx_k_line), 0, 1, 1}, /* PyObject cname: __pyx_n_u_line */
  {__pyx_k_m, sizeof(__pyx_k_m), 0, 1, 1}, /* PyObject cname: __pyx_n_u_m */
  {__pyx_k_main, sizeof(__pyx_k_main), 0, 1, 1}, /* PyObject cname: __pyx_n_u_main */
  {__pyx_k_makeBCFIndex, sizeof(__pyx_k_makeBCFIndex), 0, 1, 1}, /* PyObject cname: __pyx_n_u_makeBCFIndex */
  {__pyx_k_makeTabixIndex, sizeof(__pyx_k_makeTabixIndex), 0, 1, 1}, /* PyObject cname: __pyx_n_u_makeTabixIndex */
  {__pyx_k_makeVariantContig, sizeof(__pyx_k_makeVariantContig), 0, 1, 1}, /* PyObject cname: __pyx_n_u_makeVariantContig */
  {__pyx_k_makeVariantHeader, sizeof(__pyx_k_makeVariantHeader), 0, 1, 1}, /* PyObject cname: __pyx_n_u_makeVariantHeader */
  {__pyx_k_makeVariantHeaderContigs, sizeof(__pyx_k_makeVariantHeaderContigs), 0, 1, 1}, /* PyObject cname: __pyx_n_u_makeVariantHeaderContigs */
  {__pyx_k_makeVariantHeaderMetadata, sizeof(__pyx_k_makeVariantHeaderMetadata), 0, 1, 1}, /* PyObject cname: __pyx_n_u_makeVariantHeaderMetadata */
  {__pyx_k_makeVariantHeaderRecord, sizeof(__pyx_k_makeVariantHeaderRecord), 0, 1, 1}, /* PyObject cname: __pyx_n_u_makeVariantHeaderRecord */
  {__pyx_k_makeVariantHeaderRecords, sizeof(__pyx_k_makeVariantHeaderRecords), 0, 1, 1}, /* PyObject cname: __pyx_n_u_makeVariantHeaderRecords */
  {__pyx_k_makeVariantHeaderSamples, sizeof(__pyx_k_makeVariantHeaderSamples), 0, 1, 1}, /* PyObject cname: __pyx_n_u_makeVariantHeaderSamples */
  {__pyx_k_makeVariantMetadata, sizeof(__pyx_k_makeVariantMetadata), 0, 1, 1}, /* PyObject cname: __pyx_n_u_makeVariantMetadata */
  {__pyx_k_makeVariantRecord, sizeof(__pyx_k_makeVariantRecord), 0, 1, 1}, /* PyObject cname: __pyx_n_u_makeVariantRecord */
  {__pyx_k_makeVariantRecordFilter, sizeof(__pyx_k_makeVariantRecordFilter), 0, 1, 1}, /* PyObject cname: __pyx_n_u_makeVariantRecordFilter */
  {__pyx_k_makeVariantRecordFormat, sizeof(__pyx_k_makeVariantRecordFormat), 0, 1, 1}, /* PyObject cname: __pyx_n_u_makeVariantRecordFormat */
  {__pyx_k_makeVariantRecordInfo, sizeof(__pyx_k_makeVariantRecordInfo), 0, 1, 1}, /* PyObject cname: __pyx_n_u_makeVariantRecordInfo */
  {__pyx_k_makeVariantRecordSample, sizeof(__pyx_k_makeVariantRecordSample), 0, 1, 1}, /* PyObject cname: __pyx_n_u_makeVariantRecordSample */
  {__pyx_k_makeVariantRecordSamples, sizeof(__pyx_k_makeVariantRecordSamples), 0, 1, 1}, /* PyObject cname: __pyx_n_u_makeVariantRecordSamples */
  {__pyx_k_merge, sizeof(__pyx_k_merge), 0, 1, 1}, /* PyObject cname: __pyx_n_u_merge */
  {__pyx_k_missing_d_requested_samples, sizeof(__pyx_k_missing_d_requested_samples), 0, 1, 0}, /* PyObject cname: __pyx_kp_u_missing_d_requested_samples */
  {__pyx_k_mode, sizeof(__pyx_k_mode), 0, 1, 1}, /* PyObject cname: __pyx_n_u_mode */
  {__pyx_k_mode_contains_conflicting_format, sizeof(__pyx_k_mode_contains_conflicting_format), 0, 1, 0}, /* PyObject cname: __pyx_kp_u_mode_contains_conflicting_format */
  {__pyx_k_mode_must_begin_with_r_w_or_a, sizeof(__pyx_k_mode_must_begin_with_r_w_or_a), 0, 1, 0}, /* PyObject cname: __pyx_kp_u_mode_must_begin_with_r_w_or_a */
  {__pyx_k_module, sizeof(__pyx_k_module), 0, 1, 1}, /* PyObject cname: __pyx_n_u_module */
  {__pyx_k_msg, sizeof(__pyx_k_msg), 0, 1, 1}, /* PyObject cname: __pyx_n_u_msg */
  {__pyx_k_must_set_at_least_2_alleles, sizeof(__pyx_k_must_set_at_least_2_alleles), 0, 1, 0}, /* PyObject cname: __pyx_kp_u_must_set_at_least_2_alleles */
  {__pyx_k_n, sizeof(__pyx_k_n), 0, 1, 1}, /* PyObject cname: __pyx_n_u_n */
  {__pyx_k_name, sizeof(__pyx_k_name), 0, 1, 1}, /* PyObject cname: __pyx_n_u_name */
  {__pyx_k_name_2, sizeof(__pyx_k_name_2), 0, 1, 1}, /* PyObject cname: __pyx_n_u_name_2 */
  {__pyx_k_new, sizeof(__pyx_k_new), 0, 1, 1}, /* PyObject cname: __pyx_n_u_new */
  {__pyx_k_new_record, sizeof(__pyx_k_new_record), 0, 1, 1}, /* PyObject cname: __pyx_n_u_new_record */
  {__pyx_k_next, sizeof(__pyx_k_next), 0, 1, 1}, /* PyObject cname: __pyx_n_u_next */
  {__pyx_k_next_2, sizeof(__pyx_k_next_2), 0, 1, 1}, /* PyObject cname: __pyx_n_u_next_2 */
  {__pyx_k_no_default___reduce___due_to_non, sizeof(__pyx_k_no_default___reduce___due_to_non), 0, 1, 0}, /* PyObject cname: __pyx_kp_u_no_default___reduce___due_to_non */
  {__pyx_k_nothing, sizeof(__pyx_k_nothing), 0, 1, 1}, /* PyObject cname: __pyx_n_u_nothing */
  {__pyx_k_number, sizeof(__pyx_k_number), 0, 1, 1}, /* PyObject cname: __pyx_n_u_number */
  {__pyx_k_o, sizeof(__pyx_k_o), 0, 1, 1}, /* PyObject cname: __pyx_n_u_o */
  {__pyx_k_object, sizeof(__pyx_k_object), 0, 1, 1}, /* PyObject cname: __pyx_n_u_object */
  {__pyx_k_op, sizeof(__pyx_k_op), 0, 1, 1}, /* PyObject cname: __pyx_n_u_op */
  {__pyx_k_open, sizeof(__pyx_k_open), 0, 1, 1}, /* PyObject cname: __pyx_n_u_open */
  {__pyx_k_os, sizeof(__pyx_k_os), 0, 1, 1}, /* PyObject cname: __pyx_n_u_os */
  {__pyx_k_other, sizeof(__pyx_k_other), 0, 1, 1}, /* PyObject cname: __pyx_n_u_other */
  {__pyx_k_p, sizeof(__pyx_k_p), 0, 1, 1}, /* PyObject cname: __pyx_n_u_p */
  {__pyx_k_parse_region, sizeof(__pyx_k_parse_region), 0, 1, 1}, /* PyObject cname: __pyx_n_u_parse_region */
  {__pyx_k_phased, sizeof(__pyx_k_phased), 0, 1, 1}, /* PyObject cname: __pyx_n_u_phased */
  {__pyx_k_pickle, sizeof(__pyx_k_pickle), 0, 1, 1}, /* PyObject cname: __pyx_n_u_pickle */
  {__pyx_k_ploidy, sizeof(__pyx_k_ploidy), 0, 1, 1}, /* PyObject cname: __pyx_n_u_ploidy */
  {__pyx_k_pop, sizeof(__pyx_k_pop), 0, 1, 1}, /* PyObject cname: __pyx_n_u_pop */
  {__pyx_k_ptr, sizeof(__pyx_k_ptr), 0, 1, 1}, /* PyObject cname: __pyx_n_u_ptr */
  {__pyx_k_pysam_libcbcf, sizeof(__pyx_k_pysam_libcbcf), 0, 1, 1}, /* PyObject cname: __pyx_n_u_pysam_libcbcf */
  {__pyx_k_pysam_libcbcf_pxd, sizeof(__pyx_k_pysam_libcbcf_pxd), 0, 1, 0}, /* PyObject cname: __pyx_kp_u_pysam_libcbcf_pxd */
  {__pyx_k_pysam_libcbcf_pyx, sizeof(__pyx_k_pysam_libcbcf_pyx), 0, 1, 0}, /* PyObject cname: __pyx_kp_u_pysam_libcbcf_pyx */
  {__pyx_k_pysam_utils, sizeof(__pyx_k_pysam_utils), 0, 1, 1}, /* PyObject cname: __pyx_n_u_pysam_utils */
  {__pyx_k_pyx_PickleError, sizeof(__pyx_k_pyx_PickleError), 0, 1, 1}, /* PyObject cname: __pyx_n_u_pyx_PickleError */
  {__pyx_k_pyx_checksum, sizeof(__pyx_k_pyx_checksum), 0, 1, 1}, /* PyObject cname: __pyx_n_u_pyx_checksum */
  {__pyx_k_pyx_result, sizeof(__pyx_k_pyx_result), 0, 1, 1}, /* PyObject cname: __pyx_n_u_pyx_result */
  {__pyx_k_pyx_state, sizeof(__pyx_k_pyx_state), 0, 1, 1}, /* PyObject cname: __pyx_n_u_pyx_state */
  {__pyx_k_pyx_type, sizeof(__pyx_k_pyx_type), 0, 1, 1}, /* PyObject cname: __pyx_n_u_pyx_type */
  {__pyx_k_pyx_unpickle_BaseIndex, sizeof(__pyx_k_pyx_unpickle_BaseIndex), 0, 1, 1}, /* PyObject cname: __pyx_n_u_pyx_unpickle_BaseIndex */
  {__pyx_k_pyx_unpickle_BaseIndex__set_st, sizeof(__pyx_k_pyx_unpickle_BaseIndex__set_st), 0, 1, 1}, /* PyObject cname: __pyx_n_u_pyx_unpickle_BaseIndex__set_st */
  {__pyx_k_pyx_unpickle_VariantContig, sizeof(__pyx_k_pyx_unpickle_VariantContig), 0, 1, 1}, /* PyObject cname: __pyx_n_u_pyx_unpickle_VariantContig */
  {__pyx_k_pyx_unpickle_VariantContig__se, sizeof(__pyx_k_pyx_unpickle_VariantContig__se), 0, 1, 1}, /* PyObject cname: __pyx_n_u_pyx_unpickle_VariantContig__se */
  {__pyx_k_pyx_unpickle_VariantHeaderCont, sizeof(__pyx_k_pyx_unpickle_VariantHeaderCont), 0, 1, 1}, /* PyObject cname: __pyx_n_u_pyx_unpickle_VariantHeaderCont */
  {__pyx_k_pyx_unpickle_VariantHeaderCont_2, sizeof(__pyx_k_pyx_unpickle_VariantHeaderCont_2), 0, 1, 1}, /* PyObject cname: __pyx_n_u_pyx_unpickle_VariantHeaderCont_2 */
  {__pyx_k_pyx_unpickle_VariantHeaderMeta, sizeof(__pyx_k_pyx_unpickle_VariantHeaderMeta), 0, 1, 1}, /* PyObject cname: __pyx_n_u_pyx_unpickle_VariantHeaderMeta */
  {__pyx_k_pyx_unpickle_VariantHeaderMeta_2, sizeof(__pyx_k_pyx_unpickle_VariantHeaderMeta_2), 0, 1, 1}, /* PyObject cname: __pyx_n_u_pyx_unpickle_VariantHeaderMeta_2 */
  {__pyx_k_pyx_unpickle_VariantHeaderReco, sizeof(__pyx_k_pyx_unpickle_VariantHeaderReco), 0, 1, 1}, /* PyObject cname: __pyx_n_u_pyx_unpickle_VariantHeaderReco */
  {__pyx_k_pyx_unpickle_VariantHeaderReco_2, sizeof(__pyx_k_pyx_unpickle_VariantHeaderReco_2), 0, 1, 1}, /* PyObject cname: __pyx_n_u_pyx_unpickle_VariantHeaderReco_2 */
  {__pyx_k_pyx_unpickle_VariantHeaderSamp, sizeof(__pyx_k_pyx_unpickle_VariantHeaderSamp), 0, 1, 1}, /* PyObject cname: __pyx_n_u_pyx_unpickle_VariantHeaderSamp */
  {__pyx_k_pyx_unpickle_VariantHeaderSamp_2, sizeof(__pyx_k_pyx_unpickle_VariantHeaderSamp_2), 0, 1, 1}, /* PyObject cname: __pyx_n_u_pyx_unpickle_VariantHeaderSamp_2 */
  {__pyx_k_pyx_unpickle_VariantMetadata, sizeof(__pyx_k_pyx_unpickle_VariantMetadata), 0, 1, 1}, /* PyObject cname: __pyx_n_u_pyx_unpickle_VariantMetadata */
  {__pyx_k_pyx_unpickle_VariantMetadata_2, sizeof(__pyx_k_pyx_unpickle_VariantMetadata_2), 0, 1, 1}, /* PyObject cname: __pyx_n_u_pyx_unpickle_VariantMetadata_2 */
  {__pyx_k_pyx_unpickle_VariantRecordFilt, sizeof(__pyx_k_pyx_unpickle_VariantRecordFilt), 0, 1, 1}, /* PyObject cname: __pyx_n_u_pyx_unpickle_VariantRecordFilt */
  {__pyx_k_pyx_unpickle_VariantRecordFilt_2, sizeof(__pyx_k_pyx_unpickle_VariantRecordFilt_2), 0, 1, 1}, /* PyObject cname: __pyx_n_u_pyx_unpickle_VariantRecordFilt_2 */
  {__pyx_k_pyx_unpickle_VariantRecordForm, sizeof(__pyx_k_pyx_unpickle_VariantRecordForm), 0, 1, 1}, /* PyObject cname: __pyx_n_u_pyx_unpickle_VariantRecordForm */
  {__pyx_k_pyx_unpickle_VariantRecordForm_2, sizeof(__pyx_k_pyx_unpickle_VariantRecordForm_2), 0, 1, 1}, /* PyObject cname: __pyx_n_u_pyx_unpickle_VariantRecordForm_2 */
  {__pyx_k_pyx_unpickle_VariantRecordInfo, sizeof(__pyx_k_pyx_unpickle_VariantRecordInfo), 0, 1, 1}, /* PyObject cname: __pyx_n_u_pyx_unpickle_VariantRecordInfo */
  {__pyx_k_pyx_unpickle_VariantRecordInfo_2, sizeof(__pyx_k_pyx_unpickle_VariantRecordInfo_2), 0, 1, 1}, /* PyObject cname: __pyx_n_u_pyx_unpickle_VariantRecordInfo_2 */
  {__pyx_k_pyx_unpickle_VariantRecordSamp, sizeof(__pyx_k_pyx_unpickle_VariantRecordSamp), 0, 1, 1}, /* PyObject cname: __pyx_n_u_pyx_unpickle_VariantRecordSamp */
  {__pyx_k_pyx_unpickle_VariantRecordSamp_2, sizeof(__pyx_k_pyx_unpickle_VariantRecordSamp_2), 0, 1, 1}, /* PyObject cname: __pyx_n_u_pyx_unpickle_VariantRecordSamp_2 */
  {__pyx_k_pyx_unpickle_VariantRecordSamp_3, sizeof(__pyx_k_pyx_unpickle_VariantRecordSamp_3), 0, 1, 1}, /* PyObject cname: __pyx_n_u_pyx_unpickle_VariantRecordSamp_3 */
  {__pyx_k_pyx_unpickle_VariantRecordSamp_4, sizeof(__pyx_k_pyx_unpickle_VariantRecordSamp_4), 0, 1, 1}, /* PyObject cname: __pyx_n_u_pyx_unpickle_VariantRecordSamp_4 */
  {__pyx_k_pyx_vtable, sizeof(__pyx_k_pyx_vtable), 0, 1, 1}, /* PyObject cname: __pyx_n_u_pyx_vtable */
  {__pyx_k_qual, sizeof(__pyx_k_qual), 0, 1, 1}, /* PyObject cname: __pyx_n_u_qual */
  {__pyx_k_qualname, sizeof(__pyx_k_qualname), 0, 1, 1}, /* PyObject cname: __pyx_n_u_qualname */
  {__pyx_k_quoted, sizeof(__pyx_k_quoted), 0, 1, 1}, /* PyObject cname: __pyx_n_u_quoted */
  {__pyx_k_r, sizeof(__pyx_k_r), 0, 0, 1}, /* PyObject cname: __pyx_n_b_r */
  {__pyx_k_r, sizeof(__pyx_k_r), 0, 1, 1}, /* PyObject cname: __pyx_n_u_r */
  {__pyx_k_range, sizeof(__pyx_k_range), 0, 1, 1}, /* PyObject cname: __pyx_n_u_range */
  {__pyx_k_realloc, sizeof(__pyx_k_realloc), 0, 1, 1}, /* PyObject cname: __pyx_n_u_realloc */
  {__pyx_k_rec, sizeof(__pyx_k_rec), 0, 1, 1}, /* PyObject cname: __pyx_n_u_rec */
  {__pyx_k_record, sizeof(__pyx_k_record), 0, 1, 1}, /* PyObject cname: __pyx_n_u_record */
  {__pyx_k_record_must_not_be_None, sizeof(__pyx_k_record_must_not_be_None), 0, 1, 0}, /* PyObject cname: __pyx_kp_u_record_must_not_be_None */
  {__pyx_k_records, sizeof(__pyx_k_records), 0, 1, 1}, /* PyObject cname: __pyx_n_u_records */
  {__pyx_k_reduce, sizeof(__pyx_k_reduce), 0, 1, 1}, /* PyObject cname: __pyx_n_u_reduce */
  {__pyx_k_reduce_cython, sizeof(__pyx_k_reduce_cython), 0, 1, 1}, /* PyObject cname: __pyx_n_u_reduce_cython */
  {__pyx_k_reduce_ex, sizeof(__pyx_k_reduce_ex), 0, 1, 1}, /* PyObject cname: __pyx_n_u_reduce_ex */
  {__pyx_k_ref, sizeof(__pyx_k_ref), 0, 1, 1}, /* PyObject cname: __pyx_n_u_ref */
  {__pyx_k_ref_allele_must_not_be_null, sizeof(__pyx_k_ref_allele_must_not_be_null), 0, 1, 0}, /* PyObject cname: __pyx_kp_u_ref_allele_must_not_be_null */
  {__pyx_k_reference, sizeof(__pyx_k_reference), 0, 1, 1}, /* PyObject cname: __pyx_n_u_reference */
  {__pyx_k_refs, sizeof(__pyx_k_refs), 0, 1, 1}, /* PyObject cname: __pyx_n_u_refs */
  {__pyx_k_region, sizeof(__pyx_k_region), 0, 1, 1}, /* PyObject cname: __pyx_n_u_region */
  {__pyx_k_remap, sizeof(__pyx_k_remap), 0, 1, 1}, /* PyObject cname: __pyx_n_u_remap */
  {__pyx_k_remove, sizeof(__pyx_k_remove), 0, 1, 1}, /* PyObject cname: __pyx_n_u_remove */
  {__pyx_k_remove_header, sizeof(__pyx_k_remove_header), 0, 1, 1}, /* PyObject cname: __pyx_n_u_remove_header */
  {__pyx_k_reopen, sizeof(__pyx_k_reopen), 0, 1, 1}, /* PyObject cname: __pyx_n_u_reopen */
  {__pyx_k_res, sizeof(__pyx_k_res), 0, 1, 1}, /* PyObject cname: __pyx_n_u_res */
  {__pyx_k_reset, sizeof(__pyx_k_reset), 0, 1, 1}, /* PyObject cname: __pyx_n_u_reset */
  {__pyx_k_result, sizeof(__pyx_k_result), 0, 1, 1}, /* PyObject cname: __pyx_n_u_result */
  {__pyx_k_ret, sizeof(__pyx_k_ret), 0, 1, 1}, /* PyObject cname: __pyx_n_u_ret */
  {__pyx_k_reversed, sizeof(__pyx_k_reversed), 0, 1, 1}, /* PyObject cname: __pyx_n_u_reversed */
  {__pyx_k_richcmp, sizeof(__pyx_k_richcmp), 0, 1, 1}, /* PyObject cname: __pyx_n_u_richcmp */
  {__pyx_k_rid, sizeof(__pyx_k_rid), 0, 1, 1}, /* PyObject cname: __pyx_n_u_rid */
  {__pyx_k_rlen, sizeof(__pyx_k_rlen), 0, 1, 1}, /* PyObject cname: __pyx_n_u_rlen */
  {__pyx_k_rwa, sizeof(__pyx_k_rwa), 0, 1, 1}, /* PyObject cname: __pyx_n_u_rwa */
  {__pyx_k_s, sizeof(__pyx_k_s), 0, 1, 1}, /* PyObject cname: __pyx_n_u_s */
  {__pyx_k_sample, sizeof(__pyx_k_sample), 0, 1, 1}, /* PyObject cname: __pyx_n_u_sample */
  {__pyx_k_sample_index, sizeof(__pyx_k_sample_index), 0, 1, 1}, /* PyObject cname: __pyx_n_u_sample_index */
  {__pyx_k_sample_must_not_be_None, sizeof(__pyx_k_sample_must_not_be_None), 0, 1, 0}, /* PyObject cname: __pyx_kp_u_sample_must_not_be_None */
  {__pyx_k_samples, sizeof(__pyx_k_samples), 0, 1, 1}, /* PyObject cname: __pyx_n_u_samples */
  {__pyx_k_scalar, sizeof(__pyx_k_scalar), 0, 1, 1}, /* PyObject cname: __pyx_n_u_scalar */
  {__pyx_k_seek, sizeof(__pyx_k_seek), 0, 1, 1}, /* PyObject cname: __pyx_n_u_seek */
  {__pyx_k_self, sizeof(__pyx_k_self), 0, 1, 1}, /* PyObject cname: __pyx_n_u_self */
  {__pyx_k_self_iter_cannot_be_converted_to, sizeof(__pyx_k_self_iter_cannot_be_converted_to), 0, 1, 0}, /* PyObject cname: __pyx_kp_u_self_iter_cannot_be_converted_to */
  {__pyx_k_self_ptr_cannot_be_converted_to, sizeof(__pyx_k_self_ptr_cannot_be_converted_to), 0, 1, 0}, /* PyObject cname: __pyx_kp_u_self_ptr_cannot_be_converted_to */
  {__pyx_k_send, sizeof(__pyx_k_send), 0, 1, 1}, /* PyObject cname: __pyx_n_u_send */
  {__pyx_k_set, sizeof(__pyx_k_set), 0, 1, 1}, /* PyObject cname: __pyx_n_u_set */
  {__pyx_k_set_name, sizeof(__pyx_k_set_name), 0, 1, 1}, /* PyObject cname: __pyx_n_u_set_name */
  {__pyx_k_setitem, sizeof(__pyx_k_setitem), 0, 1, 1}, /* PyObject cname: __pyx_n_u_setitem */
  {__pyx_k_setstate, sizeof(__pyx_k_setstate), 0, 1, 1}, /* PyObject cname: __pyx_n_u_setstate */
  {__pyx_k_setstate_cython, sizeof(__pyx_k_setstate_cython), 0, 1, 1}, /* PyObject cname: __pyx_n_u_setstate_cython */
  {__pyx_k_spec, sizeof(__pyx_k_spec), 0, 1, 1}, /* PyObject cname: __pyx_n_u_spec */
  {__pyx_k_split, sizeof(__pyx_k_split), 0, 1, 1}, /* PyObject cname: __pyx_n_u_split */
  {__pyx_k_src_data, sizeof(__pyx_k_src_data), 0, 1, 1}, /* PyObject cname: __pyx_n_u_src_data */
  {__pyx_k_src_hdr, sizeof(__pyx_k_src_hdr), 0, 1, 1}, /* PyObject cname: __pyx_n_u_src_hdr */
  {__pyx_k_src_type, sizeof(__pyx_k_src_type), 0, 1, 1}, /* PyObject cname: __pyx_n_u_src_type */
  {__pyx_k_src_values, sizeof(__pyx_k_src_values), 0, 1, 1}, /* PyObject cname: __pyx_n_u_src_values */
  {__pyx_k_start, sizeof(__pyx_k_start), 0, 1, 1}, /* PyObject cname: __pyx_n_u_start */
  {__pyx_k_startswith, sizeof(__pyx_k_startswith), 0, 1, 1}, /* PyObject cname: __pyx_n_u_startswith */
  {__pyx_k_state, sizeof(__pyx_k_state), 0, 1, 1}, /* PyObject cname: __pyx_n_u_state */
  {__pyx_k_stop, sizeof(__pyx_k_stop), 0, 1, 1}, /* PyObject cname: __pyx_n_u_stop */
  {__pyx_k_stop_BCFIterator, sizeof(__pyx_k_stop_BCFIterator), 0, 1, 1}, /* PyObject cname: __pyx_n_u_stop_BCFIterator */
  {__pyx_k_str, sizeof(__pyx_k_str), 0, 1, 1}, /* PyObject cname: __pyx_n_u_str */
  {__pyx_k_stringsource, sizeof(__pyx_k_stringsource), 0, 1, 0}, /* PyObject cname: __pyx_kp_u_stringsource */
  {__pyx_k_strip, sizeof(__pyx_k_strip), 0, 1, 1}, /* PyObject cname: __pyx_n_u_strip */
  {__pyx_k_subset_samples, sizeof(__pyx_k_subset_samples), 0, 1, 1}, /* PyObject cname: __pyx_n_u_subset_samples */
  {__pyx_k_subset_samples_2, sizeof(__pyx_k_subset_samples_2), 0, 1, 1}, /* PyObject cname: __pyx_n_u_subset_samples_2 */
  {__pyx_k_sys, sizeof(__pyx_k_sys), 0, 1, 1}, /* PyObject cname: __pyx_n_u_sys */
  {__pyx_k_tabix_index_required, sizeof(__pyx_k_tabix_index_required), 0, 1, 0}, /* PyObject cname: __pyx_kp_u_tabix_index_required */
  {__pyx_k_tell, sizeof(__pyx_k_tell), 0, 1, 1}, /* PyObject cname: __pyx_n_u_tell */
  {__pyx_k_test, sizeof(__pyx_k_test), 0, 1, 1}, /* PyObject cname: __pyx_n_u_test */
  {__pyx_k_this_class_cannot_be_instantiate, sizeof(__pyx_k_this_class_cannot_be_instantiate), 0, 1, 0}, /* PyObject cname: __pyx_kp_u_this_class_cannot_be_instantiate */
  {__pyx_k_threads, sizeof(__pyx_k_threads), 0, 1, 1}, /* PyObject cname: __pyx_n_u_threads */
  {__pyx_k_throw, sizeof(__pyx_k_throw), 0, 1, 1}, /* PyObject cname: __pyx_n_u_throw */
  {__pyx_k_tid, sizeof(__pyx_k_tid), 0, 1, 1}, /* PyObject cname: __pyx_n_u_tid */
  {__pyx_k_tidx, sizeof(__pyx_k_tidx), 0, 1, 1}, /* PyObject cname: __pyx_n_u_tidx */
  {__pyx_k_tp, sizeof(__pyx_k_tp), 0, 1, 1}, /* PyObject cname: __pyx_n_u_tp */
  {__pyx_k_translate, sizeof(__pyx_k_translate), 0, 1, 1}, /* PyObject cname: __pyx_n_u_translate */
  {__pyx_k_truncated_file, sizeof(__pyx_k_truncated_file), 0, 1, 0}, /* PyObject cname: __pyx_kp_u_truncated_file */
  {__pyx_k_type, sizeof(__pyx_k_type), 0, 1, 1}, /* PyObject cname: __pyx_n_u_type */
  {__pyx_k_unable_to_allocate_BCF_record, sizeof(__pyx_k_unable_to_allocate_BCF_record), 0, 1, 0}, /* PyObject cname: __pyx_kp_u_unable_to_allocate_BCF_record */
  {__pyx_k_unable_to_fetch, sizeof(__pyx_k_unable_to_fetch), 0, 1, 0}, /* PyObject cname: __pyx_kp_u_unable_to_fetch */
  {__pyx_k_unable_to_fetch_next_record, sizeof(__pyx_k_unable_to_fetch_next_record), 0, 1, 0}, /* PyObject cname: __pyx_kp_u_unable_to_fetch_next_record */
  {__pyx_k_unable_to_parse_next_record, sizeof(__pyx_k_unable_to_parse_next_record), 0, 1, 0}, /* PyObject cname: __pyx_kp_u_unable_to_parse_next_record */
  {__pyx_k_unable_to_reallocate_VariantHead, sizeof(__pyx_k_unable_to_reallocate_VariantHead), 0, 1, 0}, /* PyObject cname: __pyx_kp_u_unable_to_reallocate_VariantHead */
  {__pyx_k_unknown_INFO, sizeof(__pyx_k_unknown_INFO), 0, 1, 0}, /* PyObject cname: __pyx_kp_u_unknown_INFO */
  {__pyx_k_unknown_format, sizeof(__pyx_k_unknown_format), 0, 1, 0}, /* PyObject cname: __pyx_kp_u_unknown_format */
  {__pyx_k_unknown_mode, sizeof(__pyx_k_unknown_mode), 0, 1, 0}, /* PyObject cname: __pyx_kp_u_unknown_mode */
  {__pyx_k_unknown_type_specified, sizeof(__pyx_k_unknown_type_specified), 0, 1, 0}, /* PyObject cname: __pyx_kp_u_unknown_type_specified */
  {__pyx_k_unquoted_str, sizeof(__pyx_k_unquoted_str), 0, 1, 1}, /* PyObject cname: __pyx_n_u_unquoted_str */
  {__pyx_k_unsupported_header_type_code, sizeof(__pyx_k_unsupported_header_type_code), 0, 1, 0}, /* PyObject cname: __pyx_kp_u_unsupported_header_type_code */
  {__pyx_k_unsupported_info_type_code, sizeof(__pyx_k_unsupported_info_type_code), 0, 1, 0}, /* PyObject cname: __pyx_kp_u_unsupported_info_type_code */
  {__pyx_k_unsupported_type, sizeof(__pyx_k_unsupported_type), 0, 1, 0}, /* PyObject cname: __pyx_kp_u_unsupported_type */
  {__pyx_k_unsupported_types, sizeof(__pyx_k_unsupported_types), 0, 1, 0}, /* PyObject cname: __pyx_kp_u_unsupported_types */
  {__pyx_k_update, sizeof(__pyx_k_update), 0, 1, 1}, /* PyObject cname: __pyx_n_u_update */
  {__pyx_k_upper, sizeof(__pyx_k_upper), 0, 1, 1}, /* PyObject cname: __pyx_n_u_upper */
  {__pyx_k_use_setstate, sizeof(__pyx_k_use_setstate), 0, 1, 1}, /* PyObject cname: __pyx_n_u_use_setstate */
  {__pyx_k_utf_8, sizeof(__pyx_k_utf_8), 0, 1, 0}, /* PyObject cname: __pyx_kp_u_utf_8 */
  {__pyx_k_v, sizeof(__pyx_k_v), 0, 1, 1}, /* PyObject cname: __pyx_n_u_v */
  {__pyx_k_v_type, sizeof(__pyx_k_v_type), 0, 1, 1}, /* PyObject cname: __pyx_n_u_v_type */
  {__pyx_k_value, sizeof(__pyx_k_value), 0, 1, 1}, /* PyObject cname: __pyx_n_u_value */
  {__pyx_k_value_count, sizeof(__pyx_k_value_count), 0, 1, 1}, /* PyObject cname: __pyx_n_u_value_count */
  {__pyx_k_value_expected_to_be_scalar_give, sizeof(__pyx_k_value_expected_to_be_scalar_give), 0, 1, 0}, /* PyObject cname: __pyx_kp_u_value_expected_to_be_scalar_give */
  {__pyx_k_values, sizeof(__pyx_k_values), 0, 1, 1}, /* PyObject cname: __pyx_n_u_values */
  {__pyx_k_values_expected_to_be_tuple_give, sizeof(__pyx_k_values_expected_to_be_tuple_give), 0, 1, 0}, /* PyObject cname: __pyx_kp_u_values_expected_to_be_tuple_give */
  {__pyx_k_vars, sizeof(__pyx_k_vars), 0, 1, 1}, /* PyObject cname: __pyx_n_u_vars */
  {__pyx_k_vcf_format_failed, sizeof(__pyx_k_vcf_format_failed), 0, 1, 0}, /* PyObject cname: __pyx_kp_u_vcf_format_failed */
  {__pyx_k_vlen, sizeof(__pyx_k_vlen), 0, 1, 1}, /* PyObject cname: __pyx_n_u_vlen */
  {__pyx_k_w, sizeof(__pyx_k_w), 0, 0, 1}, /* PyObject cname: __pyx_n_b_w */
  {__pyx_k_w, sizeof(__pyx_k_w), 0, 1, 1}, /* PyObject cname: __pyx_n_u_w */
  {__pyx_k_wb, sizeof(__pyx_k_wb), 0, 1, 1}, /* PyObject cname: __pyx_n_u_wb */
  {__pyx_k_wb0, sizeof(__pyx_k_wb0), 0, 1, 1}, /* PyObject cname: __pyx_n_u_wb0 */
  {__pyx_k_wbu, sizeof(__pyx_k_wbu), 0, 1, 1}, /* PyObject cname: __pyx_n_u_wbu */
  {__pyx_k_write, sizeof(__pyx_k_write), 0, 1, 1}, /* PyObject cname: __pyx_n_u_write */
  {__pyx_k_wz, sizeof(__pyx_k_wz), 0, 1, 1}, /* PyObject cname: __pyx_n_u_wz */
  {__pyx_k_x, sizeof(__pyx_k_x), 0, 1, 1}, /* PyObject cname: __pyx_n_u_x */
  {__pyx_k_z, sizeof(__pyx_k_z), 0, 1, 1}, /* PyObject cname: __pyx_n_u_z */
  {0, 0, 0, 0, 0}
};
/* InitStrings.proto */
static int __Pyx_InitStrings(__Pyx_StringTabEntry const *t, PyObject **target, const char* const* encoding_names);

/* #### Code section: cached_builtins ### */

static int __Pyx_InitCachedBuiltins(__pyx_mstatetype *__pyx_mstate) {
  CYTHON_UNUSED_VAR(__pyx_mstate);
  __pyx_builtin_object = __Pyx_GetBuiltinName(__pyx_mstate->__pyx_n_u_object); if (!__pyx_builtin_object) __PYX_ERR(0, 154, __pyx_L1_error)
  __pyx_builtin_range = __Pyx_GetBuiltinName(__pyx_mstate->__pyx_n_u_range); if (!__pyx_builtin_range) __PYX_ERR(0, 205, __pyx_L1_error)
  __pyx_builtin_ValueError = __Pyx_GetBuiltinName(__pyx_mstate->__pyx_n_u_ValueError); if (!__pyx_builtin_ValueError) __PYX_ERR(0, 244, __pyx_L1_error)
  __pyx_builtin_AssertionError = __Pyx_GetBuiltinName(__pyx_mstate->__pyx_n_u_AssertionError); if (!__pyx_builtin_AssertionError) __PYX_ERR(0, 253, __pyx_L1_error)
  __pyx_builtin_TypeError = __Pyx_GetBuiltinName(__pyx_mstate->__pyx_n_u_TypeError); if (!__pyx_builtin_TypeError) __PYX_ERR(0, 330, __pyx_L1_error)
  __pyx_builtin_KeyError = __Pyx_GetBuiltinName(__pyx_mstate->__pyx_n_u_KeyError); if (!__pyx_builtin_KeyError) __PYX_ERR(0, 698, __pyx_L1_error)
  __pyx_builtin_IndexError = __Pyx_GetBuiltinName(__pyx_mstate->__pyx_n_u_IndexError); if (!__pyx_builtin_IndexError) __PYX_ERR(0, 1450, __pyx_L1_error)
  __pyx_builtin_MemoryError = __Pyx_GetBuiltinName(__pyx_mstate->__pyx_n_u_MemoryError); if (!__pyx_builtin_MemoryError) __PYX_ERR(0, 2088, __pyx_L1_error)
  __pyx_builtin_enumerate = __Pyx_GetBuiltinName(__pyx_mstate->__pyx_n_u_enumerate); if (!__pyx_builtin_enumerate) __PYX_ERR(0, 2117, __pyx_L1_error)
  __pyx_builtin_NotImplemented = __Pyx_GetBuiltinName(__pyx_mstate->__pyx_n_u_NotImplemented); if (!__pyx_builtin_NotImplemented) __PYX_ERR(0, 2372, __pyx_L1_error)
  __pyx_builtin_reversed = __Pyx_GetBuiltinName(__pyx_mstate->__pyx_n_u_reversed); if (!__pyx_builtin_reversed) __PYX_ERR(0, 2460, __pyx_L1_error)
  __pyx_builtin_IOError = __Pyx_GetBuiltinName(__pyx_mstate->__pyx_n_u_IOError); if (!__pyx_builtin_IOError) __PYX_ERR(0, 3883, __pyx_L1_error)
  __pyx_builtin_StopIteration = __Pyx_GetBuiltinName(__pyx_mstate->__pyx_n_u_StopIteration); if (!__pyx_builtin_StopIteration) __PYX_ERR(0, 3897, __pyx_L1_error)
  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);

  /* "pysam/libcbcf.pyx":339
 *             value = ()
 *         else:
 *             value = (None,)*count             # <<<<<<<<<<<<<<
 *     elif scalar and len(value) == 1:
 *         value = value[0]
*/
  __pyx_mstate_global->__pyx_tuple[0] = PyTuple_New(1); if (unlikely(!__pyx_mstate_global->__pyx_tuple[0])) __PYX_ERR(0, 339, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_mstate_global->__pyx_tuple[0]);
  __Pyx_INCREF(Py_None);
  __Pyx_GIVEREF(Py_None);
  if (__Pyx_PyTuple_SET_ITEM(__pyx_mstate_global->__pyx_tuple[0], 0, Py_None) != (0)) __PYX_ERR(0, 339, __pyx_L1_error);
  __Pyx_GIVEREF(__pyx_mstate_global->__pyx_tuple[0]);

  /* "pysam/libcbcf.pyx":4275
 *         self.duplicate_filehandle = duplicate_filehandle
 * 
 *         format_modes = [m for m in mode[1:] if m in 'bcguz']             # <<<<<<<<<<<<<<
 *         if len(format_modes) > 1:
 *             raise ValueError('mode contains conflicting format specifiers: {}'.format(''.join(format_modes)))
*/
  __pyx_mstate_global->__pyx_slice[0] = PySlice_New(__pyx_mstate_global->__pyx_int_1, Py_None, Py_None); if (unlikely(!__pyx_mstate_global->__pyx_slice[0])) __PYX_ERR(0, 4275, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_mstate_global->__pyx_slice[0]);
  __Pyx_GIVEREF(__pyx_mstate_global->__pyx_slice[0]);

  /* "(tree fragment)":4
 *     cdef object __pyx_PickleError
 *     cdef object __pyx_result
 *     if __pyx_checksum not in (0x1e0584a, 0x594fd16, 0x099fb99):             # <<<<<<<<<<<<<<
 *         from pickle import PickleError as __pyx_PickleError
 *         raise __pyx_PickleError, "Incompatible checksums (0x%x vs (0x1e0584a, 0x594fd16, 0x099fb99) = (header))" % __pyx_checksum
*/
  __pyx_mstate_global->__pyx_tuple[1] = PyTuple_Pack(3, __pyx_mstate_global->__pyx_int_31479882, __pyx_mstate_global->__pyx_int_93650198, __pyx_mstate_global->__pyx_int_10091417); if (unlikely(!__pyx_mstate_global->__pyx_tuple[1])) __PYX_ERR(4, 4, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_mstate_global->__pyx_tuple[1]);
  __Pyx_GIVEREF(__pyx_mstate_global->__pyx_tuple[1]);
  __pyx_mstate_global->__pyx_tuple[2] = PyTuple_Pack(3, __pyx_mstate_global->__pyx_int_215036767, __pyx_mstate_global->__pyx_int_168021462, __pyx_mstate_global->__pyx_int_164668780); if (unlikely(!__pyx_mstate_global->__pyx_tuple[2])) __PYX_ERR(4, 4, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_mstate_global->__pyx_tuple[2]);
  __Pyx_GIVEREF(__pyx_mstate_global->__pyx_tuple[2]);
  __pyx_mstate_global->__pyx_tuple[3] = PyTuple_Pack(3, __pyx_mstate_global->__pyx_int_135711299, __pyx_mstate_global->__pyx_int_10698032, __pyx_mstate_global->__pyx_int_248899179); if (unlikely(!__pyx_mstate_global->__pyx_tuple[3])) __PYX_ERR(4, 4, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_mstate_global->__pyx_tuple[3]);
  __Pyx_GIVEREF(__pyx_mstate_global->__pyx_tuple[3]);
  __pyx_mstate_global->__pyx_tuple[4] = PyTuple_Pack(3, __pyx_mstate_global->__pyx_int_39264352, __pyx_mstate_global->__pyx_int_145625440, __pyx_mstate_global->__pyx_int_199651019); if (unlikely(!__pyx_mstate_global->__pyx_tuple[4])) __PYX_ERR(4, 4, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_mstate_global->__pyx_tuple[4]);
  __Pyx_GIVEREF(__pyx_mstate_global->__pyx_tuple[4]);
  __pyx_mstate_global->__pyx_tuple[5] = PyTuple_Pack(3, __pyx_mstate_global->__pyx_int_118286449, __pyx_mstate_global->__pyx_int_41264896, __pyx_mstate_global->__pyx_int_232881935); if (unlikely(!__pyx_mstate_global->__pyx_tuple[5])) __PYX_ERR(4, 4, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_mstate_global->__pyx_tuple[5]);
  __Pyx_GIVEREF(__pyx_mstate_global->__pyx_tuple[5]);
  __pyx_mstate_global->__pyx_tuple[6] = PyTuple_Pack(3, __pyx_mstate_global->__pyx_int_250317299, __pyx_mstate_global->__pyx_int_94171383, __pyx_mstate_global->__pyx_int_97976187); if (unlikely(!__pyx_mstate_global->__pyx_tuple[6])) __PYX_ERR(4, 4, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_mstate_global->__pyx_tuple[6]);
  __Pyx_GIVEREF(__pyx_mstate_global->__pyx_tuple[6]);
  __pyx_mstate_global->__pyx_tuple[7] = PyTuple_Pack(3, __pyx_mstate_global->__pyx_int_126454353, __pyx_mstate_global->__pyx_int_33440904, __pyx_mstate_global->__pyx_int_227765731); if (unlikely(!__pyx_mstate_global->__pyx_tuple[7])) __PYX_ERR(4, 4, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_mstate_global->__pyx_tuple[7]);
  __Pyx_GIVEREF(__pyx_mstate_global->__pyx_tuple[7]);

  /* "pysam/libcbcf.pyx":135
 * 
 * cdef int MAX_POS = (1 << 31) - 1
 * cdef tuple VALUE_TYPES = ('Flag', 'Integer', 'Float', 'String')             # <<<<<<<<<<<<<<
 * cdef tuple METADATA_TYPES = ('FILTER', 'INFO', 'FORMAT', 'CONTIG', 'STRUCTURED', 'GENERIC')
 * cdef tuple METADATA_LENGTHS = ('FIXED', 'VARIABLE', 'A', 'G', 'R')
*/
  __pyx_mstate_global->__pyx_tuple[8] = PyTuple_Pack(4, __pyx_mstate_global->__pyx_n_u_Flag, __pyx_mstate_global->__pyx_n_u_Integer, __pyx_mstate_global->__pyx_n_u_Float, __pyx_mstate_global->__pyx_n_u_String); if (unlikely(!__pyx_mstate_global->__pyx_tuple[8])) __PYX_ERR(0, 135, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_mstate_global->__pyx_tuple[8]);
  __Pyx_GIVEREF(__pyx_mstate_global->__pyx_tuple[8]);

  /* "pysam/libcbcf.pyx":136
 * cdef int MAX_POS = (1 << 31) - 1
 * cdef tuple VALUE_TYPES = ('Flag', 'Integer', 'Float', 'String')
 * cdef tuple METADATA_TYPES = ('FILTER', 'INFO', 'FORMAT', 'CONTIG', 'STRUCTURED', 'GENERIC')             # <<<<<<<<<<<<<<
 * cdef tuple METADATA_LENGTHS = ('FIXED', 'VARIABLE', 'A', 'G', 'R')
 * 
*/
  __pyx_mstate_global->__pyx_tuple[9] = PyTuple_Pack(6, __pyx_mstate_global->__pyx_n_u_FILTER, __pyx_mstate_global->__pyx_n_u_INFO, __pyx_mstate_global->__pyx_n_u_FORMAT, __pyx_mstate_global->__pyx_n_u_CONTIG, __pyx_mstate_global->__pyx_n_u_STRUCTURED, __pyx_mstate_global->__pyx_n_u_GENERIC); if (unlikely(!__pyx_mstate_global->__pyx_tuple[9])) __PYX_ERR(0, 136, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_mstate_global->__pyx_tuple[9]);
  __Pyx_GIVEREF(__pyx_mstate_global->__pyx_tuple[9]);

  /* "pysam/libcbcf.pyx":137
 * cdef tuple VALUE_TYPES = ('Flag', 'Integer', 'Float', 'String')
 * cdef tuple METADATA_TYPES = ('FILTER', 'INFO', 'FORMAT', 'CONTIG', 'STRUCTURED', 'GENERIC')
 * cdef tuple METADATA_LENGTHS = ('FIXED', 'VARIABLE', 'A', 'G', 'R')             # <<<<<<<<<<<<<<
 * 
 * 
*/
  __pyx_mstate_global->__pyx_tuple[10] = PyTuple_Pack(5, __pyx_mstate_global->__pyx_n_u_FIXED, __pyx_mstate_global->__pyx_n_u_VARIABLE, __pyx_mstate_global->__pyx_n_u_A, __pyx_mstate_global->__pyx_n_u_G, __pyx_mstate_global->__pyx_n_u_R); if (unlikely(!__pyx_mstate_global->__pyx_tuple[10])) __PYX_ERR(0, 137, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_mstate_global->__pyx_tuple[10]);
  __Pyx_GIVEREF(__pyx_mstate_global->__pyx_tuple[10]);

  /* "pysam/libcbcf.pyx":2076
 *         return ret
 * 
 *     def new_record(self, contig=None, start=0, stop=0, alleles=None,             # <<<<<<<<<<<<<<
 *                          id=None, qual=None, filter=None, info=None, samples=None,
 *                          **kwargs):
*/
  __pyx_mstate_global->__pyx_tuple[11] = PyTuple_Pack(9, Py_None, __pyx_mstate_global->__pyx_int_0, __pyx_mstate_global->__pyx_int_0, Py_None, Py_None, Py_None, Py_None, Py_None, Py_None); if (unlikely(!__pyx_mstate_global->__pyx_tuple[11])) __PYX_ERR(0, 2076, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_mstate_global->__pyx_tuple[11]);
  __Pyx_GIVEREF(__pyx_mstate_global->__pyx_tuple[11]);

  /* "pysam/libcbcf.pyx":2142
 * 
 * 
 *     def add_meta(self, key, value=None, items=None):             # <<<<<<<<<<<<<<
 *         """Add metadata to this header"""
 *         if not ((value is not None) ^ (items is not None)):
*/
  __pyx_mstate_global->__pyx_tuple[12] = PyTuple_Pack(2, Py_None, Py_None); if (unlikely(!__pyx_mstate_global->__pyx_tuple[12])) __PYX_ERR(0, 2142, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_mstate_global->__pyx_tuple[12]);
  __Pyx_GIVEREF(__pyx_mstate_global->__pyx_tuple[12]);

  /* "pysam/libcbcf.pyx":4237
 *         return vars
 * 
 *     def open(self, filename, mode='r',             # <<<<<<<<<<<<<<
 *              index_filename=None,
 *              VariantHeader header=None,
*/
  __pyx_mstate_global->__pyx_tuple[13] = PyTuple_Pack(7, __pyx_mstate_global->__pyx_n_u_r, Py_None, Py_None, Py_False, Py_True, Py_False, __pyx_mstate_global->__pyx_int_1); if (unlikely(!__pyx_mstate_global->__pyx_tuple[13])) __PYX_ERR(0, 4237, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_mstate_global->__pyx_tuple[13]);
  __Pyx_GIVEREF(__pyx_mstate_global->__pyx_tuple[13]);

  /* "pysam/libcbcf.pyx":4427
 *         return bcf_str_cache_get_charptr(bcf_hdr_id2name(hdr, rid))
 * 
 *     def fetch(self, contig=None, start=None, stop=None, region=None, reopen=False, end=None, reference=None):             # <<<<<<<<<<<<<<
 *         """fetch records in a :term:`region`, specified either by
 *         :term:`contig`, *start*, and *end* (which are 0-based, half-open);
*/
  __pyx_mstate_global->__pyx_tuple[14] = PyTuple_Pack(7, Py_None, Py_None, Py_None, Py_None, Py_False, Py_None, Py_None); if (unlikely(!__pyx_mstate_global->__pyx_tuple[14])) __PYX_ERR(0, 4427, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_mstate_global->__pyx_tuple[14]);
  __Pyx_GIVEREF(__pyx_mstate_global->__pyx_tuple[14]);
  __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);
  __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_PyBytes_Type__split.type = (PyObject*)(&PyBytes_Type);
  __pyx_mstate->__pyx_umethod_PyBytes_Type__split.method_name = &__pyx_mstate->__pyx_n_u_split;
  __pyx_mstate->__pyx_umethod_PyUnicode_Type__format.type = (PyObject*)(&PyUnicode_Type);
  __pyx_mstate->__pyx_umethod_PyUnicode_Type__format.method_name = &__pyx_mstate->__pyx_n_u_format;
  if (__Pyx_InitStrings(__pyx_string_tab, __pyx_mstate->__pyx_string_tab, __pyx_string_tab_encodings) < 0) __PYX_ERR(0, 1, __pyx_L1_error);
  __pyx_mstate->__pyx_int_0 = PyLong_FromLong(0); if (unlikely(!__pyx_mstate->__pyx_int_0)) __PYX_ERR(0, 1, __pyx_L1_error)
  __pyx_mstate->__pyx_int_1 = PyLong_FromLong(1); if (unlikely(!__pyx_mstate->__pyx_int_1)) __PYX_ERR(0, 1, __pyx_L1_error)
  __pyx_mstate->__pyx_int_2 = PyLong_FromLong(2); if (unlikely(!__pyx_mstate->__pyx_int_2)) __PYX_ERR(0, 1, __pyx_L1_error)
  __pyx_mstate->__pyx_int_10091417 = PyLong_FromLong(10091417L); if (unlikely(!__pyx_mstate->__pyx_int_10091417)) __PYX_ERR(0, 1, __pyx_L1_error)
  __pyx_mstate->__pyx_int_10698032 = PyLong_FromLong(10698032L); if (unlikely(!__pyx_mstate->__pyx_int_10698032)) __PYX_ERR(0, 1, __pyx_L1_error)
  __pyx_mstate->__pyx_int_31479882 = PyLong_FromLong(31479882L); if (unlikely(!__pyx_mstate->__pyx_int_31479882)) __PYX_ERR(0, 1, __pyx_L1_error)
  __pyx_mstate->__pyx_int_33440904 = PyLong_FromLong(33440904L); if (unlikely(!__pyx_mstate->__pyx_int_33440904)) __PYX_ERR(0, 1, __pyx_L1_error)
  __pyx_mstate->__pyx_int_39264352 = PyLong_FromLong(39264352L); if (unlikely(!__pyx_mstate->__pyx_int_39264352)) __PYX_ERR(0, 1, __pyx_L1_error)
  __pyx_mstate->__pyx_int_41264896 = PyLong_FromLong(41264896L); if (unlikely(!__pyx_mstate->__pyx_int_41264896)) __PYX_ERR(0, 1, __pyx_L1_error)
  __pyx_mstate->__pyx_int_93650198 = PyLong_FromLong(93650198L); if (unlikely(!__pyx_mstate->__pyx_int_93650198)) __PYX_ERR(0, 1, __pyx_L1_error)
  __pyx_mstate->__pyx_int_94171383 = PyLong_FromLong(94171383L); if (unlikely(!__pyx_mstate->__pyx_int_94171383)) __PYX_ERR(0, 1, __pyx_L1_error)
  __pyx_mstate->__pyx_int_97976187 = PyLong_FromLong(97976187L); if (unlikely(!__pyx_mstate->__pyx_int_97976187)) __PYX_ERR(0, 1, __pyx_L1_error)
  __pyx_mstate->__pyx_int_118286449 = PyLong_FromLong(118286449L); if (unlikely(!__pyx_mstate->__pyx_int_118286449)) __PYX_ERR(0, 1, __pyx_L1_error)
  __pyx_mstate->__pyx_int_126454353 = PyLong_FromLong(126454353L); if (unlikely(!__pyx_mstate->__pyx_int_126454353)) __PYX_ERR(0, 1, __pyx_L1_error)
  __pyx_mstate->__pyx_int_135711299 = PyLong_FromLong(135711299L); if (unlikely(!__pyx_mstate->__pyx_int_135711299)) __PYX_ERR(0, 1, __pyx_L1_error)
  __pyx_mstate->__pyx_int_145625440 = PyLong_FromLong(145625440L); if (unlikely(!__pyx_mstate->__pyx_int_145625440)) __PYX_ERR(0, 1, __pyx_L1_error)
  __pyx_mstate->__pyx_int_164668780 = PyLong_FromLong(164668780L); if (unlikely(!__pyx_mstate->__pyx_int_164668780)) __PYX_ERR(0, 1, __pyx_L1_error)
  __pyx_mstate->__pyx_int_168021462 = PyLong_FromLong(168021462L); if (unlikely(!__pyx_mstate->__pyx_int_168021462)) __PYX_ERR(0, 1, __pyx_L1_error)
  __pyx_mstate->__pyx_int_199651019 = PyLong_FromLong(199651019L); if (unlikely(!__pyx_mstate->__pyx_int_199651019)) __PYX_ERR(0, 1, __pyx_L1_error)
  __pyx_mstate->__pyx_int_215036767 = PyLong_FromLong(215036767L); if (unlikely(!__pyx_mstate->__pyx_int_215036767)) __PYX_ERR(0, 1, __pyx_L1_error)
  __pyx_mstate->__pyx_int_227765731 = PyLong_FromLong(227765731L); if (unlikely(!__pyx_mstate->__pyx_int_227765731)) __PYX_ERR(0, 1, __pyx_L1_error)
  __pyx_mstate->__pyx_int_232881935 = PyLong_FromLong(232881935L); if (unlikely(!__pyx_mstate->__pyx_int_232881935)) __PYX_ERR(0, 1, __pyx_L1_error)
  __pyx_mstate->__pyx_int_248899179 = PyLong_FromLong(248899179L); if (unlikely(!__pyx_mstate->__pyx_int_248899179)) __PYX_ERR(0, 1, __pyx_L1_error)
  __pyx_mstate->__pyx_int_250317299 = PyLong_FromLong(250317299L); if (unlikely(!__pyx_mstate->__pyx_int_250317299)) __PYX_ERR(0, 1, __pyx_L1_error)
  __pyx_mstate->__pyx_int_4294967294 = PyLong_FromString("4294967294", 0, 0); if (unlikely(!__pyx_mstate->__pyx_int_4294967294)) __PYX_ERR(0, 1, __pyx_L1_error)
  __pyx_mstate->__pyx_int_neg_1 = PyLong_FromLong(-1); if (unlikely(!__pyx_mstate->__pyx_int_neg_1)) __PYX_ERR(0, 1, __pyx_L1_error)
  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 : 13;
            unsigned int line_table_length : 15;
        } __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,
        const char *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 = {1, 0, 0, 7, (unsigned int)(CO_OPTIMIZED|CO_NEWLOCALS), 163, 74};
    PyObject* const varnames[] = {__pyx_mstate->__pyx_n_u_s, __pyx_mstate->__pyx_n_u_MAX_POS, __pyx_mstate->__pyx_n_u_VALUE_TYPES, __pyx_mstate->__pyx_n_u_METADATA_TYPES, __pyx_mstate->__pyx_n_u_METADATA_LENGTHS, __pyx_mstate->__pyx_n_u_nothing, __pyx_mstate->__pyx_n_u_bcf_str_cache};
    __pyx_mstate_global->__pyx_codeobj_tab[0] = __Pyx_PyCode_New(descr, varnames, __pyx_mstate->__pyx_kp_u_pysam_libcbcf_pyx, __pyx_mstate->__pyx_n_u_bcf_str_cache_get_charptr, __pyx_k_r_A_q_q_q_q_xq_as_Q_1_1, tuple_dedup_map); if (unlikely(!__pyx_mstate_global->__pyx_codeobj_tab[0])) goto bad;
  }
  {
    const __Pyx_PyCode_New_function_description descr = {2, 0, 0, 8, (unsigned int)(CO_OPTIMIZED|CO_NEWLOCALS), 183, 107};
    PyObject* const varnames[] = {__pyx_mstate->__pyx_n_u_n, __pyx_mstate->__pyx_n_u_k, __pyx_mstate->__pyx_n_u_MAX_POS, __pyx_mstate->__pyx_n_u_VALUE_TYPES, __pyx_mstate->__pyx_n_u_METADATA_TYPES, __pyx_mstate->__pyx_n_u_METADATA_LENGTHS, __pyx_mstate->__pyx_n_u_nothing, __pyx_mstate->__pyx_n_u_bcf_str_cache};
    __pyx_mstate_global->__pyx_codeobj_tab[1] = __Pyx_PyCode_New(descr, varnames, __pyx_mstate->__pyx_kp_u_pysam_libcbcf_pyx, __pyx_mstate->__pyx_n_u_comb, __pyx_k_A_r_1_q_3a_q_2Rs_Bb_2Rr_U_3b_Q, tuple_dedup_map); if (unlikely(!__pyx_mstate_global->__pyx_codeobj_tab[1])) goto bad;
  }
  {
    const __Pyx_PyCode_New_function_description descr = {2, 0, 0, 8, (unsigned int)(CO_OPTIMIZED|CO_NEWLOCALS), 212, 26};
    PyObject* const varnames[] = {__pyx_mstate->__pyx_n_u_ploidy, __pyx_mstate->__pyx_n_u_alleles, __pyx_mstate->__pyx_n_u_MAX_POS, __pyx_mstate->__pyx_n_u_VALUE_TYPES, __pyx_mstate->__pyx_n_u_METADATA_TYPES, __pyx_mstate->__pyx_n_u_METADATA_LENGTHS, __pyx_mstate->__pyx_n_u_nothing, __pyx_mstate->__pyx_n_u_bcf_str_cache};
    __pyx_mstate_global->__pyx_codeobj_tab[2] = __Pyx_PyCode_New(descr, varnames, __pyx_mstate->__pyx_kp_u_pysam_libcbcf_pyx, __pyx_mstate->__pyx_n_u_bcf_geno_combinations, __pyx_k_Gq_4q_3a, tuple_dedup_map); if (unlikely(!__pyx_mstate_global->__pyx_codeobj_tab[2])) goto bad;
  }
  {
    const __Pyx_PyCode_New_function_description descr = {3, 0, 0, 9, (unsigned int)(CO_OPTIMIZED|CO_NEWLOCALS), 233, 42};
    PyObject* const varnames[] = {__pyx_mstate->__pyx_n_u_hdr, __pyx_mstate->__pyx_n_u_hl_type, __pyx_mstate->__pyx_n_u_id, __pyx_mstate->__pyx_n_u_MAX_POS, __pyx_mstate->__pyx_n_u_VALUE_TYPES, __pyx_mstate->__pyx_n_u_METADATA_TYPES, __pyx_mstate->__pyx_n_u_METADATA_LENGTHS, __pyx_mstate->__pyx_n_u_nothing, __pyx_mstate->__pyx_n_u_bcf_str_cache};
    __pyx_mstate_global->__pyx_codeobj_tab[3] = __Pyx_PyCode_New(descr, varnames, __pyx_mstate->__pyx_kp_u_pysam_libcbcf_pyx, __pyx_mstate->__pyx_n_u_check_header_id, __pyx_k_3c_4s_Cr_T1FauIUV, tuple_dedup_map); if (unlikely(!__pyx_mstate_global->__pyx_codeobj_tab[3])) goto bad;
  }
  {
    const __Pyx_PyCode_New_function_description descr = {2, 0, 0, 8, (unsigned int)(CO_OPTIMIZED|CO_NEWLOCALS), 237, 28};
    PyObject* const varnames[] = {__pyx_mstate->__pyx_n_u_hdr, __pyx_mstate->__pyx_n_u_fmt_id, __pyx_mstate->__pyx_n_u_MAX_POS, __pyx_mstate->__pyx_n_u_VALUE_TYPES, __pyx_mstate->__pyx_n_u_METADATA_TYPES, __pyx_mstate->__pyx_n_u_METADATA_LENGTHS, __pyx_mstate->__pyx_n_u_nothing, __pyx_mstate->__pyx_n_u_bcf_str_cache};
    __pyx_mstate_global->__pyx_codeobj_tab[4] = __Pyx_PyCode_New(descr, varnames, __pyx_mstate->__pyx_kp_u_pysam_libcbcf_pyx, __pyx_mstate->__pyx_n_u_is_gt_fmt, __pyx_k_6_k_1, tuple_dedup_map); if (unlikely(!__pyx_mstate_global->__pyx_codeobj_tab[4])) goto bad;
  }
  {
    const __Pyx_PyCode_New_function_description descr = {3, 0, 0, 9, (unsigned int)(CO_OPTIMIZED|CO_NEWLOCALS), 241, 172};
    PyObject* const varnames[] = {__pyx_mstate->__pyx_n_u_hdr, __pyx_mstate->__pyx_n_u_rec, __pyx_mstate->__pyx_n_u_sample, __pyx_mstate->__pyx_n_u_MAX_POS, __pyx_mstate->__pyx_n_u_VALUE_TYPES, __pyx_mstate->__pyx_n_u_METADATA_TYPES, __pyx_mstate->__pyx_n_u_METADATA_LENGTHS, __pyx_mstate->__pyx_n_u_nothing, __pyx_mstate->__pyx_n_u_bcf_str_cache};
    __pyx_mstate_global->__pyx_codeobj_tab[5] = __Pyx_PyCode_New(descr, varnames, __pyx_mstate->__pyx_kp_u_pysam_libcbcf_pyx, __pyx_mstate->__pyx_n_u_bcf_genotype_count, __pyx_k_TTU_wb_j_1_1_1E_axq_t3b_4q_q_4r, tuple_dedup_map); if (unlikely(!__pyx_mstate_global->__pyx_codeobj_tab[5])) goto bad;
  }
  {
    const __Pyx_PyCode_New_function_description descr = {0, 0, 0, 1, (unsigned int)(CO_OPTIMIZED|CO_NEWLOCALS|CO_GENERATOR), 271, 2};
    PyObject* const varnames[] = {__pyx_mstate->__pyx_n_u_i};
    __pyx_mstate_global->__pyx_codeobj_tab[6] = __Pyx_PyCode_New(descr, varnames, __pyx_mstate->__pyx_kp_u_pysam_libcbcf_pyx, __pyx_mstate->__pyx_n_u_genexpr, __pyx_k_A_2, tuple_dedup_map); if (unlikely(!__pyx_mstate_global->__pyx_codeobj_tab[6])) goto bad;
  }
  {
    const __Pyx_PyCode_New_function_description descr = {3, 0, 0, 9, (unsigned int)(CO_OPTIMIZED|CO_NEWLOCALS), 267, 45};
    PyObject* const varnames[] = {__pyx_mstate->__pyx_n_u_a, __pyx_mstate->__pyx_n_u_n, __pyx_mstate->__pyx_n_u_free_after, __pyx_mstate->__pyx_n_u_MAX_POS, __pyx_mstate->__pyx_n_u_VALUE_TYPES, __pyx_mstate->__pyx_n_u_METADATA_TYPES, __pyx_mstate->__pyx_n_u_METADATA_LENGTHS, __pyx_mstate->__pyx_n_u_nothing, __pyx_mstate->__pyx_n_u_bcf_str_cache};
    __pyx_mstate_global->__pyx_codeobj_tab[7] = __Pyx_PyCode_New(descr, varnames, __pyx_mstate->__pyx_kp_u_pysam_libcbcf_pyx, __pyx_mstate->__pyx_n_u_char_array_to_tuple, __pyx_k_I_t1_q__A_d, tuple_dedup_map); if (unlikely(!__pyx_mstate_global->__pyx_codeobj_tab[7])) goto bad;
  }
  {
    const __Pyx_PyCode_New_function_description descr = {0, 0, 0, 1, (unsigned int)(CO_OPTIMIZED|CO_NEWLOCALS|CO_GENERATOR), 302, 2};
    PyObject* const varnames[] = {__pyx_mstate->__pyx_n_u_v};
    __pyx_mstate_global->__pyx_codeobj_tab[8] = __Pyx_PyCode_New(descr, varnames, __pyx_mstate->__pyx_kp_u_pysam_libcbcf_pyx, __pyx_mstate->__pyx_n_u_genexpr, __pyx_k__13, tuple_dedup_map); if (unlikely(!__pyx_mstate_global->__pyx_codeobj_tab[8])) goto bad;
  }
  {
    const __Pyx_PyCode_New_function_description descr = {5, 0, 0, 11, (unsigned int)(CO_OPTIMIZED|CO_NEWLOCALS), 277, 462};
    PyObject* const varnames[] = {__pyx_mstate->__pyx_n_u_data, __pyx_mstate->__pyx_n_u_type, __pyx_mstate->__pyx_n_u_n, __pyx_mstate->__pyx_n_u_count, __pyx_mstate->__pyx_n_u_scalar, __pyx_mstate->__pyx_n_u_MAX_POS, __pyx_mstate->__pyx_n_u_VALUE_TYPES, __pyx_mstate->__pyx_n_u_METADATA_TYPES, __pyx_mstate->__pyx_n_u_METADATA_LENGTHS, __pyx_mstate->__pyx_n_u_nothing, __pyx_mstate->__pyx_n_u_bcf_str_cache};
    __pyx_mstate_global->__pyx_codeobj_tab[9] = __Pyx_PyCode_New(descr, varnames, __pyx_mstate->__pyx_kp_u_pysam_libcbcf_pyx, __pyx_mstate->__pyx_n_u_bcf_array_to_object, __pyx_k_t5_2S_q_uCq_4q_A_uAQas_Q_A_E_1, tuple_dedup_map); if (unlikely(!__pyx_mstate_global->__pyx_codeobj_tab[9])) goto bad;
  }
  {
    const __Pyx_PyCode_New_function_description descr = {0, 0, 0, 1, (unsigned int)(CO_OPTIMIZED|CO_NEWLOCALS|CO_GENERATOR), 360, 2};
    PyObject* const varnames[] = {__pyx_mstate->__pyx_n_u_v};
    __pyx_mstate_global->__pyx_codeobj_tab[10] = __Pyx_PyCode_New(descr, varnames, __pyx_mstate->__pyx_kp_u_pysam_libcbcf_pyx, __pyx_mstate->__pyx_n_u_genexpr, __pyx_k_q, tuple_dedup_map); if (unlikely(!__pyx_mstate_global->__pyx_codeobj_tab[10])) goto bad;
  }
  {
    const __Pyx_PyCode_New_function_description descr = {5, 0, 0, 11, (unsigned int)(CO_OPTIMIZED|CO_NEWLOCALS), 348, 436};
    PyObject* const varnames[] = {__pyx_mstate->__pyx_n_u_values, __pyx_mstate->__pyx_n_u_data, __pyx_mstate->__pyx_n_u_bt_type, __pyx_mstate->__pyx_n_u_n, __pyx_mstate->__pyx_n_u_vlen, __pyx_mstate->__pyx_n_u_MAX_POS, __pyx_mstate->__pyx_n_u_VALUE_TYPES, __pyx_mstate->__pyx_n_u_METADATA_TYPES, __pyx_mstate->__pyx_n_u_METADATA_LENGTHS, __pyx_mstate->__pyx_n_u_nothing, __pyx_mstate->__pyx_n_u_bcf_str_cache};
    __pyx_mstate_global->__pyx_codeobj_tab[11] = __Pyx_PyCode_New(descr, varnames, __pyx_mstate->__pyx_kp_u_pysam_libcbcf_pyx, __pyx_mstate->__pyx_n_u_bcf_object_to_array, __pyx_k_3aq_s_xs_4z_5_T_aq_Qa_3a_awhha, tuple_dedup_map); if (unlikely(!__pyx_mstate_global->__pyx_codeobj_tab[11])) goto bad;
  }
  {
    const __Pyx_PyCode_New_function_description descr = {3, 0, 0, 9, (unsigned int)(CO_OPTIMIZED|CO_NEWLOCALS), 402, 217};
    PyObject* const varnames[] = {__pyx_mstate->__pyx_n_u_type, __pyx_mstate->__pyx_n_u_n, __pyx_mstate->__pyx_n_u_vlen, __pyx_mstate->__pyx_n_u_MAX_POS, __pyx_mstate->__pyx_n_u_VALUE_TYPES, __pyx_mstate->__pyx_n_u_METADATA_TYPES, __pyx_mstate->__pyx_n_u_METADATA_LENGTHS, __pyx_mstate->__pyx_n_u_nothing, __pyx_mstate->__pyx_n_u_bcf_str_cache};
    __pyx_mstate_global->__pyx_codeobj_tab[12] = __Pyx_PyCode_New(descr, varnames, __pyx_mstate->__pyx_kp_u_pysam_libcbcf_pyx, __pyx_mstate->__pyx_n_u_bcf_empty_array, __pyx_k_r_A_j_uCq_AQ_E_aq_j_c_q_HA_E_aq, tuple_dedup_map); if (unlikely(!__pyx_mstate_global->__pyx_codeobj_tab[12])) goto bad;
  }
  {
    const __Pyx_PyCode_New_function_description descr = {7, 0, 0, 13, (unsigned int)(CO_OPTIMIZED|CO_NEWLOCALS), 432, 496};
    PyObject* const varnames[] = {__pyx_mstate->__pyx_n_u_src_data, __pyx_mstate->__pyx_n_u_src_type, __pyx_mstate->__pyx_n_u_src_values, __pyx_mstate->__pyx_n_u_dst_data, __pyx_mstate->__pyx_n_u_dst_type, __pyx_mstate->__pyx_n_u_dst_values, __pyx_mstate->__pyx_n_u_vlen, __pyx_mstate->__pyx_n_u_MAX_POS, __pyx_mstate->__pyx_n_u_VALUE_TYPES, __pyx_mstate->__pyx_n_u_METADATA_TYPES, __pyx_mstate->__pyx_n_u_METADATA_LENGTHS, __pyx_mstate->__pyx_n_u_nothing, __pyx_mstate->__pyx_n_u_bcf_str_cache};
    __pyx_mstate_global->__pyx_codeobj_tab[13] = __Pyx_PyCode_New(descr, varnames, __pyx_mstate->__pyx_kp_u_pysam_libcbcf_pyx, __pyx_mstate->__pyx_n_u_bcf_copy_expand_array, __pyx_k_A_j_PPWWXXdde_y_q_HA_HA_a_Q_E_a, tuple_dedup_map); if (unlikely(!__pyx_mstate_global->__pyx_codeobj_tab[13])) goto bad;
  }
  {
    const __Pyx_PyCode_New_function_description descr = {6, 0, 0, 12, (unsigned int)(CO_OPTIMIZED|CO_NEWLOCALS), 501, 249};
    PyObject* const varnames[] = {__pyx_mstate->__pyx_n_u_record, __pyx_mstate->__pyx_n_u_hl_type, __pyx_mstate->__pyx_n_u_id, __pyx_mstate->__pyx_n_u_count, __pyx_mstate->__pyx_n_u_scalar, __pyx_mstate->__pyx_n_u_sample, __pyx_mstate->__pyx_n_u_MAX_POS, __pyx_mstate->__pyx_n_u_VALUE_TYPES, __pyx_mstate->__pyx_n_u_METADATA_TYPES, __pyx_mstate->__pyx_n_u_METADATA_LENGTHS, __pyx_mstate->__pyx_n_u_nothing, __pyx_mstate->__pyx_n_u_bcf_str_cache};
    __pyx_mstate_global->__pyx_codeobj_tab[14] = __Pyx_PyCode_New(descr, varnames, __pyx_mstate->__pyx_kp_u_pysam_libcbcf_pyx, __pyx_mstate->__pyx_n_u_bcf_get_value_count, __pyx_k_wc_j_q_V1_t_5_j_q_Ya_q_Ya_5_xs, tuple_dedup_map); if (unlikely(!__pyx_mstate_global->__pyx_codeobj_tab[14])) goto bad;
  }
  {
    const __Pyx_PyCode_New_function_description descr = {2, 0, 0, 8, (unsigned int)(CO_OPTIMIZED|CO_NEWLOCALS), 534, 323};
    PyObject* const varnames[] = {__pyx_mstate->__pyx_n_u_record, __pyx_mstate->__pyx_n_u_z, __pyx_mstate->__pyx_n_u_MAX_POS, __pyx_mstate->__pyx_n_u_VALUE_TYPES, __pyx_mstate->__pyx_n_u_METADATA_TYPES, __pyx_mstate->__pyx_n_u_METADATA_LENGTHS, __pyx_mstate->__pyx_n_u_nothing, __pyx_mstate->__pyx_n_u_bcf_str_cache};
    __pyx_mstate_global->__pyx_codeobj_tab[15] = __Pyx_PyCode_New(descr, varnames, __pyx_mstate->__pyx_kp_u_pysam_libcbcf_pyx, __pyx_mstate->__pyx_n_u_bcf_info_get_value, __pyx_k_wc_j_q_q_QfAWAYa_q_S_O1E_avS_A, tuple_dedup_map); if (unlikely(!__pyx_mstate_global->__pyx_codeobj_tab[15])) goto bad;
  }
  {
    const __Pyx_PyCode_New_function_description descr = {0, 0, 0, 1, (unsigned int)(CO_OPTIMIZED|CO_NEWLOCALS|CO_GENERATOR), 614, 2};
    PyObject* const varnames[] = {__pyx_mstate->__pyx_n_u_v};
    __pyx_mstate_global->__pyx_codeobj_tab[16] = __Pyx_PyCode_New(descr, varnames, __pyx_mstate->__pyx_kp_u_pysam_libcbcf_pyx, __pyx_mstate->__pyx_n_u_genexpr, __pyx_k_1, tuple_dedup_map); if (unlikely(!__pyx_mstate_global->__pyx_codeobj_tab[16])) goto bad;
  }
  {
    const __Pyx_PyCode_New_function_description descr = {11, 0, 0, 17, (unsigned int)(CO_OPTIMIZED|CO_NEWLOCALS), 575, 566};
    PyObject* const varnames[] = {__pyx_mstate->__pyx_n_u_record, __pyx_mstate->__pyx_n_u_value, __pyx_mstate->__pyx_n_u_sample, __pyx_mstate->__pyx_n_u_hl_type, __pyx_mstate->__pyx_n_u_ht_type, __pyx_mstate->__pyx_n_u_id, __pyx_mstate->__pyx_n_u_bt_type, __pyx_mstate->__pyx_n_u_bt_len, __pyx_mstate->__pyx_n_u_value_count, __pyx_mstate->__pyx_n_u_scalar, __pyx_mstate->__pyx_n_u_realloc, __pyx_mstate->__pyx_n_u_MAX_POS, __pyx_mstate->__pyx_n_u_VALUE_TYPES, __pyx_mstate->__pyx_n_u_METADATA_TYPES, __pyx_mstate->__pyx_n_u_METADATA_LENGTHS, __pyx_mstate->__pyx_n_u_nothing, __pyx_mstate->__pyx_n_u_bcf_str_cache};
    __pyx_mstate_global->__pyx_codeobj_tab[17] = __Pyx_PyCode_New(descr, varnames, __pyx_mstate->__pyx_kp_u_pysam_libcbcf_pyx, __pyx_mstate->__pyx_n_u_bcf_check_values, __pyx_k_wc_j_q_Qk_Zq_m1_xs_1E_Kt9AV7_1F, tuple_dedup_map); if (unlikely(!__pyx_mstate_global->__pyx_codeobj_tab[17])) goto bad;
  }
  {
    const __Pyx_PyCode_New_function_description descr = {2, 0, 0, 8, (unsigned int)(CO_OPTIMIZED|CO_NEWLOCALS), 640, 231};
    PyObject* const varnames[] = {__pyx_mstate->__pyx_n_u_record, __pyx_mstate->__pyx_n_u_values, __pyx_mstate->__pyx_n_u_MAX_POS, __pyx_mstate->__pyx_n_u_VALUE_TYPES, __pyx_mstate->__pyx_n_u_METADATA_TYPES, __pyx_mstate->__pyx_n_u_METADATA_LENGTHS, __pyx_mstate->__pyx_n_u_nothing, __pyx_mstate->__pyx_n_u_bcf_str_cache};
    __pyx_mstate_global->__pyx_codeobj_tab[18] = __Pyx_PyCode_New(descr, varnames, __pyx_mstate->__pyx_kp_u_pysam_libcbcf_pyx, __pyx_mstate->__pyx_n_u_bcf_encode_alleles, __pyx_k_wc_j_V1_AQ_wc_q_t_QivQ_6_A_WAQ, tuple_dedup_map); if (unlikely(!__pyx_mstate_global->__pyx_codeobj_tab[18])) goto bad;
  }
  {
    const __Pyx_PyCode_New_function_description descr = {3, 0, 0, 9, (unsigned int)(CO_OPTIMIZED|CO_NEWLOCALS), 677, 446};
    PyObject* const varnames[] = {__pyx_mstate->__pyx_n_u_record, __pyx_mstate->__pyx_n_u_key, __pyx_mstate->__pyx_n_u_value, __pyx_mstate->__pyx_n_u_MAX_POS, __pyx_mstate->__pyx_n_u_VALUE_TYPES, __pyx_mstate->__pyx_n_u_METADATA_TYPES, __pyx_mstate->__pyx_n_u_METADATA_LENGTHS, __pyx_mstate->__pyx_n_u_nothing, __pyx_mstate->__pyx_n_u_bcf_str_cache};
    __pyx_mstate_global->__pyx_codeobj_tab[19] = __Pyx_PyCode_New(descr, varnames, __pyx_mstate->__pyx_kp_u_pysam_libcbcf_pyx, __pyx_mstate->__pyx_n_u_bcf_info_set_value, __pyx_k_wc_j_q_V1_C1_z_A_j_k_L_c_q_a_a, tuple_dedup_map); if (unlikely(!__pyx_mstate_global->__pyx_codeobj_tab[19])) goto bad;
  }
  {
    const __Pyx_PyCode_New_function_description descr = {2, 0, 0, 8, (unsigned int)(CO_OPTIMIZED|CO_NEWLOCALS), 767, 165};
    PyObject* const varnames[] = {__pyx_mstate->__pyx_n_u_record, __pyx_mstate->__pyx_n_u_key, __pyx_mstate->__pyx_n_u_MAX_POS, __pyx_mstate->__pyx_n_u_VALUE_TYPES, __pyx_mstate->__pyx_n_u_METADATA_TYPES, __pyx_mstate->__pyx_n_u_METADATA_LENGTHS, __pyx_mstate->__pyx_n_u_nothing, __pyx_mstate->__pyx_n_u_bcf_str_cache};
    __pyx_mstate_global->__pyx_codeobj_tab[20] = __Pyx_PyCode_New(descr, varnames, __pyx_mstate->__pyx_kp_u_pysam_libcbcf_pyx, __pyx_mstate->__pyx_n_u_bcf_info_del_value, __pyx_k_wc_j_q_V1_z_A_j_k_L_c_t1_haq_q, tuple_dedup_map); if (unlikely(!__pyx_mstate_global->__pyx_codeobj_tab[20])) goto bad;
  }
  {
    const __Pyx_PyCode_New_function_description descr = {2, 0, 0, 8, (unsigned int)(CO_OPTIMIZED|CO_NEWLOCALS), 797, 255};
    PyObject* const varnames[] = {__pyx_mstate->__pyx_n_u_sample, __pyx_mstate->__pyx_n_u_key, __pyx_mstate->__pyx_n_u_MAX_POS, __pyx_mstate->__pyx_n_u_VALUE_TYPES, __pyx_mstate->__pyx_n_u_METADATA_TYPES, __pyx_mstate->__pyx_n_u_METADATA_LENGTHS, __pyx_mstate->__pyx_n_u_nothing, __pyx_mstate->__pyx_n_u_bcf_str_cache};
    __pyx_mstate_global->__pyx_codeobj_tab[21] = __Pyx_PyCode_New(descr, varnames, __pyx_mstate->__pyx_kp_u_pysam_libcbcf_pyx, __pyx_mstate->__pyx_n_u_bcf_format_get_value, __pyx_k_wc_j_wa_V7_z_1_j_k_Qe3a_t4s_c_h, tuple_dedup_map); if (unlikely(!__pyx_mstate_global->__pyx_codeobj_tab[21])) goto bad;
  }
  {
    const __Pyx_PyCode_New_function_description descr = {3, 0, 0, 9, (unsigned int)(CO_OPTIMIZED|CO_NEWLOCALS), 830, 714};
    PyObject* const varnames[] = {__pyx_mstate->__pyx_n_u_sample, __pyx_mstate->__pyx_n_u_key, __pyx_mstate->__pyx_n_u_value, __pyx_mstate->__pyx_n_u_MAX_POS, __pyx_mstate->__pyx_n_u_VALUE_TYPES, __pyx_mstate->__pyx_n_u_METADATA_TYPES, __pyx_mstate->__pyx_n_u_METADATA_LENGTHS, __pyx_mstate->__pyx_n_u_nothing, __pyx_mstate->__pyx_n_u_bcf_str_cache};
    __pyx_mstate_global->__pyx_codeobj_tab[22] = __Pyx_PyCode_New(descr, varnames, __pyx_mstate->__pyx_kp_u_pysam_libcbcf_pyx, __pyx_mstate->__pyx_n_u_bcf_format_set_value, __pyx_k_wc_j_t3a_j_AQ_wa_V7_z_1_j_k_Qe3, tuple_dedup_map); if (unlikely(!__pyx_mstate_global->__pyx_codeobj_tab[22])) goto bad;
  }
  {
    const __Pyx_PyCode_New_function_description descr = {2, 0, 0, 8, (unsigned int)(CO_OPTIMIZED|CO_NEWLOCALS), 922, 183};
    PyObject* const varnames[] = {__pyx_mstate->__pyx_n_u_sample, __pyx_mstate->__pyx_n_u_key, __pyx_mstate->__pyx_n_u_MAX_POS, __pyx_mstate->__pyx_n_u_VALUE_TYPES, __pyx_mstate->__pyx_n_u_METADATA_TYPES, __pyx_mstate->__pyx_n_u_METADATA_LENGTHS, __pyx_mstate->__pyx_n_u_nothing, __pyx_mstate->__pyx_n_u_bcf_str_cache};
    __pyx_mstate_global->__pyx_codeobj_tab[23] = __Pyx_PyCode_New(descr, varnames, __pyx_mstate->__pyx_kp_u_pysam_libcbcf_pyx, __pyx_mstate->__pyx_n_u_bcf_format_del_value, __pyx_k_wc_j_wa_V7_z_1_j_k_Qe3a_t4s_c_h_2, tuple_dedup_map); if (unlikely(!__pyx_mstate_global->__pyx_codeobj_tab[23])) goto bad;
  }
  {
    const __Pyx_PyCode_New_function_description descr = {1, 0, 0, 7, (unsigned int)(CO_OPTIMIZED|CO_NEWLOCALS), 952, 493};
    PyObject* const varnames[] = {__pyx_mstate->__pyx_n_u_sample, __pyx_mstate->__pyx_n_u_MAX_POS, __pyx_mstate->__pyx_n_u_VALUE_TYPES, __pyx_mstate->__pyx_n_u_METADATA_TYPES, __pyx_mstate->__pyx_n_u_METADATA_LENGTHS, __pyx_mstate->__pyx_n_u_nothing, __pyx_mstate->__pyx_n_u_bcf_str_cache};
    __pyx_mstate_global->__pyx_codeobj_tab[24] = __Pyx_PyCode_New(descr, varnames, __pyx_mstate->__pyx_kp_u_pysam_libcbcf_pyx, __pyx_mstate->__pyx_n_u_bcf_format_get_allele_indices, __pyx_k_wc_j_wa_V7_Qa_z_1_j_vWBb_6_2S_A, tuple_dedup_map); if (unlikely(!__pyx_mstate_global->__pyx_codeobj_tab[24])) goto bad;
  }
  {
    const __Pyx_PyCode_New_function_description descr = {1, 0, 0, 7, (unsigned int)(CO_OPTIMIZED|CO_NEWLOCALS), 1012, 484};
    PyObject* const varnames[] = {__pyx_mstate->__pyx_n_u_sample, __pyx_mstate->__pyx_n_u_MAX_POS, __pyx_mstate->__pyx_n_u_VALUE_TYPES, __pyx_mstate->__pyx_n_u_METADATA_TYPES, __pyx_mstate->__pyx_n_u_METADATA_LENGTHS, __pyx_mstate->__pyx_n_u_nothing, __pyx_mstate->__pyx_n_u_bcf_str_cache};
    __pyx_mstate_global->__pyx_codeobj_tab[25] = __Pyx_PyCode_New(descr, varnames, __pyx_mstate->__pyx_kp_u_pysam_libcbcf_pyx, __pyx_mstate->__pyx_n_u_bcf_format_get_alleles, __pyx_k_wc_j_wa_V7_AQ_z_1_j_AQ_vWBb_6_9, tuple_dedup_map); if (unlikely(!__pyx_mstate_global->__pyx_codeobj_tab[25])) goto bad;
  }
  {
    const __Pyx_PyCode_New_function_description descr = {1, 0, 0, 7, (unsigned int)(CO_OPTIMIZED|CO_NEWLOCALS), 1063, 467};
    PyObject* const varnames[] = {__pyx_mstate->__pyx_n_u_sample, __pyx_mstate->__pyx_n_u_MAX_POS, __pyx_mstate->__pyx_n_u_VALUE_TYPES, __pyx_mstate->__pyx_n_u_METADATA_TYPES, __pyx_mstate->__pyx_n_u_METADATA_LENGTHS, __pyx_mstate->__pyx_n_u_nothing, __pyx_mstate->__pyx_n_u_bcf_str_cache};
    __pyx_mstate_global->__pyx_codeobj_tab[26] = __Pyx_PyCode_New(descr, varnames, __pyx_mstate->__pyx_kp_u_pysam_libcbcf_pyx, __pyx_mstate->__pyx_n_u_bcf_sample_get_phased, __pyx_k_q_wc_j_wa_V7_Qa_z_1_j_vWBb_6_2S, tuple_dedup_map); if (unlikely(!__pyx_mstate_global->__pyx_codeobj_tab[26])) goto bad;
  }
  {
    const __Pyx_PyCode_New_function_description descr = {2, 0, 0, 8, (unsigned int)(CO_OPTIMIZED|CO_NEWLOCALS), 1126, 444};
    PyObject* const varnames[] = {__pyx_mstate->__pyx_n_u_sample, __pyx_mstate->__pyx_n_u_phased, __pyx_mstate->__pyx_n_u_MAX_POS, __pyx_mstate->__pyx_n_u_VALUE_TYPES, __pyx_mstate->__pyx_n_u_METADATA_TYPES, __pyx_mstate->__pyx_n_u_METADATA_LENGTHS, __pyx_mstate->__pyx_n_u_nothing, __pyx_mstate->__pyx_n_u_bcf_str_cache};
    __pyx_mstate_global->__pyx_codeobj_tab[27] = __Pyx_PyCode_New(descr, varnames, __pyx_mstate->__pyx_kp_u_pysam_libcbcf_pyx, __pyx_mstate->__pyx_n_u_bcf_sample_set_phased, __pyx_k_wc_j_wa_V7_Qa_z_1_j_vWBb_6_2S_A_2, tuple_dedup_map); if (unlikely(!__pyx_mstate_global->__pyx_codeobj_tab[27])) goto bad;
  }
  {
    const __Pyx_PyCode_New_function_description descr = {1, 0, 0, 7, (unsigned int)(CO_OPTIMIZED|CO_NEWLOCALS), 1179, 230};
    PyObject* const varnames[] = {__pyx_mstate->__pyx_n_u_record, __pyx_mstate->__pyx_n_u_MAX_POS, __pyx_mstate->__pyx_n_u_VALUE_TYPES, __pyx_mstate->__pyx_n_u_METADATA_TYPES, __pyx_mstate->__pyx_n_u_METADATA_LENGTHS, __pyx_mstate->__pyx_n_u_nothing, __pyx_mstate->__pyx_n_u_bcf_str_cache};
    __pyx_mstate_global->__pyx_codeobj_tab[28] = __Pyx_PyCode_New(descr, varnames, __pyx_mstate->__pyx_kp_u_pysam_libcbcf_pyx, __pyx_mstate->__pyx_n_u_bcf_sync_end, __pyx_k_q_AV7_vU_QfA_t_axuD_d_CvTQWWZZ, tuple_dedup_map); if (unlikely(!__pyx_mstate_global->__pyx_codeobj_tab[28])) goto bad;
  }
  {
    const __Pyx_PyCode_New_function_description descr = {1, 0, 0, 7, (unsigned int)(CO_OPTIMIZED|CO_NEWLOCALS), 1209, 82};
    PyObject* const varnames[] = {__pyx_mstate->__pyx_n_u_record, __pyx_mstate->__pyx_n_u_MAX_POS, __pyx_mstate->__pyx_n_u_VALUE_TYPES, __pyx_mstate->__pyx_n_u_METADATA_TYPES, __pyx_mstate->__pyx_n_u_METADATA_LENGTHS, __pyx_mstate->__pyx_n_u_nothing, __pyx_mstate->__pyx_n_u_bcf_str_cache};
    __pyx_mstate_global->__pyx_codeobj_tab[29] = __Pyx_PyCode_New(descr, varnames, __pyx_mstate->__pyx_kp_u_pysam_libcbcf_pyx, __pyx_mstate->__pyx_n_u_has_symbolic_allele, __pyx_k_1_U_3fD_fD_3as_U_c_Qe2S_1_1_1, tuple_dedup_map); if (unlikely(!__pyx_mstate_global->__pyx_codeobj_tab[29])) goto bad;
  }
  {
    const __Pyx_PyCode_New_function_description descr = {2, 0, 0, 8, (unsigned int)(CO_OPTIMIZED|CO_NEWLOCALS), 1226, 152};
    PyObject* const varnames[] = {__pyx_mstate->__pyx_n_u_header, __pyx_mstate->__pyx_n_u_i, __pyx_mstate->__pyx_n_u_MAX_POS, __pyx_mstate->__pyx_n_u_VALUE_TYPES, __pyx_mstate->__pyx_n_u_METADATA_TYPES, __pyx_mstate->__pyx_n_u_METADATA_LENGTHS, __pyx_mstate->__pyx_n_u_nothing, __pyx_mstate->__pyx_n_u_bcf_str_cache};
    __pyx_mstate_global->__pyx_codeobj_tab[30] = __Pyx_PyCode_New(descr, varnames, __pyx_mstate->__pyx_kp_u_pysam_libcbcf_pyx, __pyx_mstate->__pyx_n_u_bcf_header_remove_hrec, __pyx_k_wc_j_r_2S_S_j_CuAQ_z_r_3a_q_E_a, tuple_dedup_map); if (unlikely(!__pyx_mstate_global->__pyx_codeobj_tab[30])) goto bad;
  }
  {
    const __Pyx_PyCode_New_function_description descr = {1, 0, 0, 3, (unsigned int)(CO_OPTIMIZED|CO_NEWLOCALS|CO_VARARGS|CO_VARKEYWORDS), 1251, 11};
    PyObject* const varnames[] = {__pyx_mstate->__pyx_n_u_self, __pyx_mstate->__pyx_n_u_args, __pyx_mstate->__pyx_n_u_kwargs};
    __pyx_mstate_global->__pyx_codeobj_tab[31] = __Pyx_PyCode_New(descr, varnames, __pyx_mstate->__pyx_kp_u_pysam_libcbcf_pyx, __pyx_mstate->__pyx_n_u_init, __pyx_k_A_iq, tuple_dedup_map); if (unlikely(!__pyx_mstate_global->__pyx_codeobj_tab[31])) goto bad;
  }
  {
    const __Pyx_PyCode_New_function_description descr = {1, 0, 0, 2, (unsigned int)(CO_OPTIMIZED|CO_NEWLOCALS), 1254, 34};
    PyObject* const varnames[] = {__pyx_mstate->__pyx_n_u_self, __pyx_mstate->__pyx_n_u_r};
    __pyx_mstate_global->__pyx_codeobj_tab[32] = __Pyx_PyCode_New(descr, varnames, __pyx_mstate->__pyx_kp_u_pysam_libcbcf_pyx, __pyx_mstate->__pyx_n_u_get_2, __pyx_k_A_T_4q_1_Qaq, tuple_dedup_map); if (unlikely(!__pyx_mstate_global->__pyx_codeobj_tab[32])) goto bad;
  }
  {
    const __Pyx_PyCode_New_function_description descr = {1, 0, 0, 2, (unsigned int)(CO_OPTIMIZED|CO_NEWLOCALS), 1262, 33};
    PyObject* const varnames[] = {__pyx_mstate->__pyx_n_u_self, __pyx_mstate->__pyx_n_u_r};
    __pyx_mstate_global->__pyx_codeobj_tab[33] = __Pyx_PyCode_New(descr, varnames, __pyx_mstate->__pyx_kp_u_pysam_libcbcf_pyx, __pyx_mstate->__pyx_n_u_get_2, __pyx_k_A_T_2T_A, tuple_dedup_map); if (unlikely(!__pyx_mstate_global->__pyx_codeobj_tab[33])) goto bad;
  }
  {
    const __Pyx_PyCode_New_function_description descr = {1, 0, 0, 2, (unsigned int)(CO_OPTIMIZED|CO_NEWLOCALS), 1268, 32};
    PyObject* const varnames[] = {__pyx_mstate->__pyx_n_u_self, __pyx_mstate->__pyx_n_u_r};
    __pyx_mstate_global->__pyx_codeobj_tab[34] = __Pyx_PyCode_New(descr, varnames, __pyx_mstate->__pyx_kp_u_pysam_libcbcf_pyx, __pyx_mstate->__pyx_n_u_get_2, __pyx_k_A_T_Qa_D_Q, tuple_dedup_map); if (unlikely(!__pyx_mstate_global->__pyx_codeobj_tab[34])) goto bad;
  }
  {
    const __Pyx_PyCode_New_function_description descr = {0, 0, 0, 1, (unsigned int)(CO_OPTIMIZED|CO_NEWLOCALS|CO_GENERATOR), 1281, 2};
    PyObject* const varnames[] = {__pyx_mstate->__pyx_n_u_i};
    __pyx_mstate_global->__pyx_codeobj_tab[35] = __Pyx_PyCode_New(descr, varnames, __pyx_mstate->__pyx_kp_u_pysam_libcbcf_pyx, __pyx_mstate->__pyx_n_u_genexpr, __pyx_k_a_2, tuple_dedup_map); if (unlikely(!__pyx_mstate_global->__pyx_codeobj_tab[35])) goto bad;
  }
  {
    const __Pyx_PyCode_New_function_description descr = {1, 0, 0, 5, (unsigned int)(CO_OPTIMIZED|CO_NEWLOCALS), 1274, 32};
    PyObject* const varnames[] = {__pyx_mstate->__pyx_n_u_self, __pyx_mstate->__pyx_n_u_r, __pyx_mstate->__pyx_n_u_i, __pyx_mstate->__pyx_n_u_genexpr, __pyx_mstate->__pyx_n_u_genexpr};
    __pyx_mstate_global->__pyx_codeobj_tab[36] = __Pyx_PyCode_New(descr, varnames, __pyx_mstate->__pyx_kp_u_pysam_libcbcf_pyx, __pyx_mstate->__pyx_n_u_get_2, __pyx_k_A_T_4q_1_uBa, tuple_dedup_map); if (unlikely(!__pyx_mstate_global->__pyx_codeobj_tab[36])) goto bad;
  }
  {
    const __Pyx_PyCode_New_function_description descr = {1, 0, 0, 2, (unsigned int)(CO_OPTIMIZED|CO_NEWLOCALS), 1285, 20};
    PyObject* const varnames[] = {__pyx_mstate->__pyx_n_u_self, __pyx_mstate->__pyx_n_u_r};
    __pyx_mstate_global->__pyx_codeobj_tab[37] = __Pyx_PyCode_New(descr, varnames, __pyx_mstate->__pyx_kp_u_pysam_libcbcf_pyx, __pyx_mstate->__pyx_n_u_len, __pyx_k_A_T_q, tuple_dedup_map); if (unlikely(!__pyx_mstate_global->__pyx_codeobj_tab[37])) goto bad;
  }
  {
    const __Pyx_PyCode_New_function_description descr = {1, 0, 0, 2, (unsigned int)(CO_OPTIMIZED|CO_NEWLOCALS), 1289, 28};
    PyObject* const varnames[] = {__pyx_mstate->__pyx_n_u_self, __pyx_mstate->__pyx_n_u_r};
    __pyx_mstate_global->__pyx_codeobj_tab[38] = __Pyx_PyCode_New(descr, varnames, __pyx_mstate->__pyx_kp_u_pysam_libcbcf_pyx, __pyx_mstate->__pyx_n_u_bool, __pyx_k_A_T_r_E_QgS, tuple_dedup_map); if (unlikely(!__pyx_mstate_global->__pyx_codeobj_tab[38])) goto bad;
  }
  {
    const __Pyx_PyCode_New_function_description descr = {2, 0, 0, 5, (unsigned int)(CO_OPTIMIZED|CO_NEWLOCALS), 1293, 95};
    PyObject* const varnames[] = {__pyx_mstate->__pyx_n_u_self, __pyx_mstate->__pyx_n_u_key, __pyx_mstate->__pyx_n_u_r, __pyx_mstate->__pyx_n_u_i, __pyx_mstate->__pyx_n_u_bkey};
    __pyx_mstate_global->__pyx_codeobj_tab[39] = __Pyx_PyCode_New(descr, varnames, __pyx_mstate->__pyx_kp_u_pysam_libcbcf_pyx, __pyx_mstate->__pyx_n_u_getitem, __pyx_k_A_T_1_aq_U_1A_1E_T_q_3a_5_axq_ha, tuple_dedup_map); if (unlikely(!__pyx_mstate_global->__pyx_codeobj_tab[39])) goto bad;
  }
  {
    const __Pyx_PyCode_New_function_description descr = {1, 0, 0, 3, (unsigned int)(CO_OPTIMIZED|CO_NEWLOCALS|CO_GENERATOR), 1304, 2};
    PyObject* const varnames[] = {__pyx_mstate->__pyx_n_u_self, __pyx_mstate->__pyx_n_u_r, __pyx_mstate->__pyx_n_u_i};
    __pyx_mstate_global->__pyx_codeobj_tab[40] = __Pyx_PyCode_New(descr, varnames, __pyx_mstate->__pyx_kp_u_pysam_libcbcf_pyx, __pyx_mstate->__pyx_n_u_iter, __pyx_k_A_3, tuple_dedup_map); if (unlikely(!__pyx_mstate_global->__pyx_codeobj_tab[40])) goto bad;
  }
  {
    const __Pyx_PyCode_New_function_description descr = {3, 0, 0, 3, (unsigned int)(CO_OPTIMIZED|CO_NEWLOCALS), 1313, 25};
    PyObject* const varnames[] = {__pyx_mstate->__pyx_n_u_self, __pyx_mstate->__pyx_n_u_key, __pyx_mstate->__pyx_n_u_default};
    __pyx_mstate_global->__pyx_codeobj_tab[41] = __Pyx_PyCode_New(descr, varnames, __pyx_mstate->__pyx_kp_u_pysam_libcbcf_pyx, __pyx_mstate->__pyx_n_u_get, __pyx_k_q_4q_1, tuple_dedup_map); if (unlikely(!__pyx_mstate_global->__pyx_codeobj_tab[41])) goto bad;
  }
  {
    const __Pyx_PyCode_New_function_description descr = {2, 0, 0, 2, (unsigned int)(CO_OPTIMIZED|CO_NEWLOCALS), 1320, 25};
    PyObject* const varnames[] = {__pyx_mstate->__pyx_n_u_self, __pyx_mstate->__pyx_n_u_key};
    __pyx_mstate_global->__pyx_codeobj_tab[42] = __Pyx_PyCode_New(descr, varnames, __pyx_mstate->__pyx_kp_u_pysam_libcbcf_pyx, __pyx_mstate->__pyx_n_u_contains, __pyx_k_A_1_1, tuple_dedup_map); if (unlikely(!__pyx_mstate_global->__pyx_codeobj_tab[42])) goto bad;
  }
  {
    const __Pyx_PyCode_New_function_description descr = {1, 0, 0, 1, (unsigned int)(CO_OPTIMIZED|CO_NEWLOCALS), 1328, 11};
    PyObject* const varnames[] = {__pyx_mstate->__pyx_n_u_self};
    __pyx_mstate_global->__pyx_codeobj_tab[43] = __Pyx_PyCode_New(descr, varnames, __pyx_mstate->__pyx_kp_u_pysam_libcbcf_pyx, __pyx_mstate->__pyx_n_u_iterkeys, __pyx_k_A_t1A, tuple_dedup_map); if (unlikely(!__pyx_mstate_global->__pyx_codeobj_tab[43])) goto bad;
  }
  {
    const __Pyx_PyCode_New_function_description descr = {1, 0, 0, 3, (unsigned int)(CO_OPTIMIZED|CO_NEWLOCALS|CO_GENERATOR), 1332, 2};
    PyObject* const varnames[] = {__pyx_mstate->__pyx_n_u_self, __pyx_mstate->__pyx_n_u_r, __pyx_mstate->__pyx_n_u_i};
    __pyx_mstate_global->__pyx_codeobj_tab[44] = __Pyx_PyCode_New(descr, varnames, __pyx_mstate->__pyx_kp_u_pysam_libcbcf_pyx, __pyx_mstate->__pyx_n_u_itervalues, __pyx_k_A_3, tuple_dedup_map); if (unlikely(!__pyx_mstate_global->__pyx_codeobj_tab[44])) goto bad;
  }
  {
    const __Pyx_PyCode_New_function_description descr = {1, 0, 0, 3, (unsigned int)(CO_OPTIMIZED|CO_NEWLOCALS|CO_GENERATOR), 1342, 2};
    PyObject* const varnames[] = {__pyx_mstate->__pyx_n_u_self, __pyx_mstate->__pyx_n_u_r, __pyx_mstate->__pyx_n_u_i};
    __pyx_mstate_global->__pyx_codeobj_tab[45] = __Pyx_PyCode_New(descr, varnames, __pyx_mstate->__pyx_kp_u_pysam_libcbcf_pyx, __pyx_mstate->__pyx_n_u_iteritems, __pyx_k_A_3, tuple_dedup_map); if (unlikely(!__pyx_mstate_global->__pyx_codeobj_tab[45])) goto bad;
  }
  {
    const __Pyx_PyCode_New_function_description descr = {1, 0, 0, 1, (unsigned int)(CO_OPTIMIZED|CO_NEWLOCALS), 1352, 11};
    PyObject* const varnames[] = {__pyx_mstate->__pyx_n_u_self};
    __pyx_mstate_global->__pyx_codeobj_tab[46] = __Pyx_PyCode_New(descr, varnames, __pyx_mstate->__pyx_kp_u_pysam_libcbcf_pyx, __pyx_mstate->__pyx_n_u_keys, __pyx_k_A_t1A, tuple_dedup_map); if (unlikely(!__pyx_mstate_global->__pyx_codeobj_tab[46])) goto bad;
  }
  {
    const __Pyx_PyCode_New_function_description descr = {1, 0, 0, 1, (unsigned int)(CO_OPTIMIZED|CO_NEWLOCALS), 1356, 15};
    PyObject* const varnames[] = {__pyx_mstate->__pyx_n_u_self};
    __pyx_mstate_global->__pyx_codeobj_tab[47] = __Pyx_PyCode_New(descr, varnames, __pyx_mstate->__pyx_kp_u_pysam_libcbcf_pyx, __pyx_mstate->__pyx_n_u_items, __pyx_k_A_t1D, tuple_dedup_map); if (unlikely(!__pyx_mstate_global->__pyx_codeobj_tab[47])) goto bad;
  }
  {
    const __Pyx_PyCode_New_function_description descr = {1, 0, 0, 1, (unsigned int)(CO_OPTIMIZED|CO_NEWLOCALS), 1360, 15};
    PyObject* const varnames[] = {__pyx_mstate->__pyx_n_u_self};
    __pyx_mstate_global->__pyx_codeobj_tab[48] = __Pyx_PyCode_New(descr, varnames, __pyx_mstate->__pyx_kp_u_pysam_libcbcf_pyx, __pyx_mstate->__pyx_n_u_values, __pyx_k_A_t1D_1, tuple_dedup_map); if (unlikely(!__pyx_mstate_global->__pyx_codeobj_tab[48])) goto bad;
  }
  {
    const __Pyx_PyCode_New_function_description descr = {2, 0, 0, 5, (unsigned int)(CO_OPTIMIZED|CO_NEWLOCALS|CO_VARKEYWORDS), 1364, 56};
    PyObject* const varnames[] = {__pyx_mstate->__pyx_n_u_self, __pyx_mstate->__pyx_n_u_items, __pyx_mstate->__pyx_n_u_kwargs, __pyx_mstate->__pyx_n_u_k, __pyx_mstate->__pyx_n_u_v};
    __pyx_mstate_global->__pyx_codeobj_tab[49] = __Pyx_PyCode_New(descr, varnames, __pyx_mstate->__pyx_kp_u_pysam_libcbcf_pyx, __pyx_mstate->__pyx_n_u_update, __pyx_k_1_CuE_q_a_1_5_fA_AU, tuple_dedup_map); if (unlikely(!__pyx_mstate_global->__pyx_codeobj_tab[49])) goto bad;
  }
  {
    const __Pyx_PyCode_New_function_description descr = {3, 0, 0, 4, (unsigned int)(CO_OPTIMIZED|CO_NEWLOCALS), 1376, 51};
    PyObject* const varnames[] = {__pyx_mstate->__pyx_n_u_self, __pyx_mstate->__pyx_n_u_key, __pyx_mstate->__pyx_n_u_default, __pyx_mstate->__pyx_n_u_value};
    __pyx_mstate_global->__pyx_codeobj_tab[50] = __Pyx_PyCode_New(descr, varnames, __pyx_mstate->__pyx_kp_u_pysam_libcbcf_pyx, __pyx_mstate->__pyx_n_u_pop, __pyx_k_q_D_AQ_1_xwa_q, tuple_dedup_map); if (unlikely(!__pyx_mstate_global->__pyx_codeobj_tab[50])) goto bad;
  }
  {
    const __Pyx_PyCode_New_function_description descr = {1, 0, 0, 4, (unsigned int)(CO_OPTIMIZED|CO_NEWLOCALS), 1391, 93};
    PyObject* const varnames[] = {__pyx_mstate->__pyx_n_u_self, __pyx_mstate->__pyx_n_u_r, __pyx_mstate->__pyx_n_u_hrec_str, __pyx_mstate->__pyx_n_u_ret};
    __pyx_mstate_global->__pyx_codeobj_tab[51] = __Pyx_PyCode_New(descr, varnames, __pyx_mstate->__pyx_kp_u_pysam_libcbcf_pyx, __pyx_mstate->__pyx_n_u_str, __pyx_k_A_T_4q_AQ_XU_Q_q_1A_84xq_81_q, tuple_dedup_map); if (unlikely(!__pyx_mstate_global->__pyx_codeobj_tab[51])) goto bad;
  }
  {
    const __Pyx_PyCode_New_function_description descr = {1, 0, 0, 4, (unsigned int)(CO_OPTIMIZED|CO_NEWLOCALS), 1411, 75};
    PyObject* const varnames[] = {__pyx_mstate->__pyx_n_u_self, __pyx_mstate->__pyx_n_u_hdr, __pyx_mstate->__pyx_n_u_r, __pyx_mstate->__pyx_n_u_key};
    __pyx_mstate_global->__pyx_codeobj_tab[52] = __Pyx_PyCode_New(descr, varnames, __pyx_mstate->__pyx_kp_u_pysam_libcbcf_pyx, __pyx_mstate->__pyx_n_u_remove, __pyx_k_A_d_T_4q_q_6_AQ_auAWA_G1, tuple_dedup_map); if (unlikely(!__pyx_mstate_global->__pyx_codeobj_tab[52])) goto bad;
  }
  {
    const __Pyx_PyCode_New_function_description descr = {1, 0, 0, 1, (unsigned int)(CO_OPTIMIZED|CO_NEWLOCALS), 48, 2};
    PyObject* const varnames[] = {__pyx_mstate->__pyx_n_u_self};
    __pyx_mstate_global->__pyx_codeobj_tab[53] = __Pyx_PyCode_New(descr, varnames, __pyx_mstate->__pyx_kp_u_pysam_libcbcf_pxd, __pyx_mstate->__pyx_n_u_get_2, __pyx_k__14, tuple_dedup_map); if (unlikely(!__pyx_mstate_global->__pyx_codeobj_tab[53])) goto bad;
  }
  {
    const __Pyx_PyCode_New_function_description descr = {1, 0, 0, 1, (unsigned int)(CO_OPTIMIZED|CO_NEWLOCALS), 1, 9};
    PyObject* const varnames[] = {__pyx_mstate->__pyx_n_u_self};
    __pyx_mstate_global->__pyx_codeobj_tab[54] = __Pyx_PyCode_New(descr, varnames, __pyx_mstate->__pyx_kp_u_stringsource, __pyx_mstate->__pyx_n_u_reduce_cython, __pyx_k_Q, tuple_dedup_map); if (unlikely(!__pyx_mstate_global->__pyx_codeobj_tab[54])) goto bad;
  }
  {
    const __Pyx_PyCode_New_function_description descr = {2, 0, 0, 2, (unsigned int)(CO_OPTIMIZED|CO_NEWLOCALS), 3, 9};
    PyObject* const varnames[] = {__pyx_mstate->__pyx_n_u_self, __pyx_mstate->__pyx_n_u_pyx_state};
    __pyx_mstate_global->__pyx_codeobj_tab[55] = __Pyx_PyCode_New(descr, varnames, __pyx_mstate->__pyx_kp_u_stringsource, __pyx_mstate->__pyx_n_u_setstate_cython, __pyx_k_Q, tuple_dedup_map); if (unlikely(!__pyx_mstate_global->__pyx_codeobj_tab[55])) goto bad;
  }
  {
    const __Pyx_PyCode_New_function_description descr = {2, 0, 0, 8, (unsigned int)(CO_OPTIMIZED|CO_NEWLOCALS), 1422, 61};
    PyObject* const varnames[] = {__pyx_mstate->__pyx_n_u_header, __pyx_mstate->__pyx_n_u_hdr, __pyx_mstate->__pyx_n_u_MAX_POS, __pyx_mstate->__pyx_n_u_VALUE_TYPES, __pyx_mstate->__pyx_n_u_METADATA_TYPES, __pyx_mstate->__pyx_n_u_METADATA_LENGTHS, __pyx_mstate->__pyx_n_u_nothing, __pyx_mstate->__pyx_n_u_bcf_str_cache};
    __pyx_mstate_global->__pyx_codeobj_tab[56] = __Pyx_PyCode_New(descr, varnames, __pyx_mstate->__pyx_kp_u_pysam_libcbcf_pyx, __pyx_mstate->__pyx_n_u_makeVariantHeaderRecord, __pyx_k_t1_j_t1_q_9_A_1, tuple_dedup_map); if (unlikely(!__pyx_mstate_global->__pyx_codeobj_tab[56])) goto bad;
  }
  {
    const __Pyx_PyCode_New_function_description descr = {1, 0, 0, 3, (unsigned int)(CO_OPTIMIZED|CO_NEWLOCALS|CO_VARARGS|CO_VARKEYWORDS), 1438, 11};
    PyObject* const varnames[] = {__pyx_mstate->__pyx_n_u_self, __pyx_mstate->__pyx_n_u_args, __pyx_mstate->__pyx_n_u_kwargs};
    __pyx_mstate_global->__pyx_codeobj_tab[57] = __Pyx_PyCode_New(descr, varnames, __pyx_mstate->__pyx_kp_u_pysam_libcbcf_pyx, __pyx_mstate->__pyx_n_u_init, __pyx_k_A_iq, tuple_dedup_map); if (unlikely(!__pyx_mstate_global->__pyx_codeobj_tab[57])) goto bad;
  }
  {
    const __Pyx_PyCode_New_function_description descr = {1, 0, 0, 1, (unsigned int)(CO_OPTIMIZED|CO_NEWLOCALS), 1441, 13};
    PyObject* const varnames[] = {__pyx_mstate->__pyx_n_u_self};
    __pyx_mstate_global->__pyx_codeobj_tab[58] = __Pyx_PyCode_New(descr, varnames, __pyx_mstate->__pyx_kp_u_pysam_libcbcf_pyx, __pyx_mstate->__pyx_n_u_len, __pyx_k_A_t7_a, tuple_dedup_map); if (unlikely(!__pyx_mstate_global->__pyx_codeobj_tab[58])) goto bad;
  }
  {
    const __Pyx_PyCode_New_function_description descr = {1, 0, 0, 1, (unsigned int)(CO_OPTIMIZED|CO_NEWLOCALS), 1444, 17};
    PyObject* const varnames[] = {__pyx_mstate->__pyx_n_u_self};
    __pyx_mstate_global->__pyx_codeobj_tab[59] = __Pyx_PyCode_New(descr, varnames, __pyx_mstate->__pyx_kp_u_pysam_libcbcf_pyx, __pyx_mstate->__pyx_n_u_bool, __pyx_k_A_t7_gS, tuple_dedup_map); if (unlikely(!__pyx_mstate_global->__pyx_codeobj_tab[59])) goto bad;
  }
  {
    const __Pyx_PyCode_New_function_description descr = {2, 0, 0, 3, (unsigned int)(CO_OPTIMIZED|CO_NEWLOCALS), 1447, 63};
    PyObject* const varnames[] = {__pyx_mstate->__pyx_n_u_self, __pyx_mstate->__pyx_n_u_index, __pyx_mstate->__pyx_n_u_i};
    __pyx_mstate_global->__pyx_codeobj_tab[60] = __Pyx_PyCode_New(descr, varnames, __pyx_mstate->__pyx_kp_u_pysam_libcbcf_pyx, __pyx_mstate->__pyx_n_u_getitem, __pyx_k_A_2Rr_Bc_WD_AQ_at9D_t5, tuple_dedup_map); if (unlikely(!__pyx_mstate_global->__pyx_codeobj_tab[60])) goto bad;
  }
  {
    const __Pyx_PyCode_New_function_description descr = {1, 0, 0, 2, (unsigned int)(CO_OPTIMIZED|CO_NEWLOCALS|CO_GENERATOR), 1453, 2};
    PyObject* const varnames[] = {__pyx_mstate->__pyx_n_u_self, __pyx_mstate->__pyx_n_u_i};
    __pyx_mstate_global->__pyx_codeobj_tab[61] = __Pyx_PyCode_New(descr, varnames, __pyx_mstate->__pyx_kp_u_pysam_libcbcf_pyx, __pyx_mstate->__pyx_n_u_iter, __pyx_k_A_3, 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), 53, 2};
    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_pysam_libcbcf_pxd, __pyx_mstate->__pyx_n_u_get_2, __pyx_k__14, tuple_dedup_map); if (unlikely(!__pyx_mstate_global->__pyx_codeobj_tab[62])) goto bad;
  }
  {
    const __Pyx_PyCode_New_function_description descr = {1, 0, 0, 4, (unsigned int)(CO_OPTIMIZED|CO_NEWLOCALS), 1, 94};
    PyObject* const varnames[] = {__pyx_mstate->__pyx_n_u_self, __pyx_mstate->__pyx_n_u_state, __pyx_mstate->__pyx_n_u_dict_2, __pyx_mstate->__pyx_n_u_use_setstate};
    __pyx_mstate_global->__pyx_codeobj_tab[63] = __Pyx_PyCode_New(descr, varnames, __pyx_mstate->__pyx_kp_u_stringsource, __pyx_mstate->__pyx_n_u_reduce_cython, __pyx_k_T_G1F_a_vWA_q_t87_q_5T_GST_5T_A, 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), 16, 11};
    PyObject* const varnames[] = {__pyx_mstate->__pyx_n_u_self, __pyx_mstate->__pyx_n_u_pyx_state};
    __pyx_mstate_global->__pyx_codeobj_tab[64] = __Pyx_PyCode_New(descr, varnames, __pyx_mstate->__pyx_kp_u_stringsource, __pyx_mstate->__pyx_n_u_setstate_cython, __pyx_k_2_6, tuple_dedup_map); if (unlikely(!__pyx_mstate_global->__pyx_codeobj_tab[64])) goto bad;
  }
  {
    const __Pyx_PyCode_New_function_description descr = {1, 0, 0, 7, (unsigned int)(CO_OPTIMIZED|CO_NEWLOCALS), 1461, 42};
    PyObject* const varnames[] = {__pyx_mstate->__pyx_n_u_header, __pyx_mstate->__pyx_n_u_MAX_POS, __pyx_mstate->__pyx_n_u_VALUE_TYPES, __pyx_mstate->__pyx_n_u_METADATA_TYPES, __pyx_mstate->__pyx_n_u_METADATA_LENGTHS, __pyx_mstate->__pyx_n_u_nothing, __pyx_mstate->__pyx_n_u_bcf_str_cache};
    __pyx_mstate_global->__pyx_codeobj_tab[65] = __Pyx_PyCode_New(descr, varnames, __pyx_mstate->__pyx_kp_u_pysam_libcbcf_pyx, __pyx_mstate->__pyx_n_u_makeVariantHeaderRecords, __pyx_k_t1_j_HAQ_Q_1, tuple_dedup_map); if (unlikely(!__pyx_mstate_global->__pyx_codeobj_tab[65])) goto bad;
  }
  {
    const __Pyx_PyCode_New_function_description descr = {1, 0, 0, 3, (unsigned int)(CO_OPTIMIZED|CO_NEWLOCALS|CO_VARARGS|CO_VARKEYWORDS), 1472, 11};
    PyObject* const varnames[] = {__pyx_mstate->__pyx_n_u_self, __pyx_mstate->__pyx_n_u_args, __pyx_mstate->__pyx_n_u_kwargs};
    __pyx_mstate_global->__pyx_codeobj_tab[66] = __Pyx_PyCode_New(descr, varnames, __pyx_mstate->__pyx_kp_u_pysam_libcbcf_pyx, __pyx_mstate->__pyx_n_u_init, __pyx_k_A_iq, tuple_dedup_map); if (unlikely(!__pyx_mstate_global->__pyx_codeobj_tab[66])) goto bad;
  }
  {
    const __Pyx_PyCode_New_function_description descr = {1, 0, 0, 2, (unsigned int)(CO_OPTIMIZED|CO_NEWLOCALS), 1475, 37};
    PyObject* const varnames[] = {__pyx_mstate->__pyx_n_u_self, __pyx_mstate->__pyx_n_u_hdr};
    __pyx_mstate_global->__pyx_codeobj_tab[67] = __Pyx_PyCode_New(descr, varnames, __pyx_mstate->__pyx_kp_u_pysam_libcbcf_pyx, __pyx_mstate->__pyx_n_u_get_2, __pyx_k_A_d_Cq_4t1, 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), 1482, 11};
    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_pysam_libcbcf_pyx, __pyx_mstate->__pyx_n_u_get_2, __pyx_k_A_t1, tuple_dedup_map); if (unlikely(!__pyx_mstate_global->__pyx_codeobj_tab[68])) goto bad;
  }
  {
    const __Pyx_PyCode_New_function_description descr = {1, 0, 0, 3, (unsigned int)(CO_OPTIMIZED|CO_NEWLOCALS), 1487, 124};
    PyObject* const varnames[] = {__pyx_mstate->__pyx_n_u_self, __pyx_mstate->__pyx_n_u_hdr, __pyx_mstate->__pyx_n_u_l};
    __pyx_mstate_global->__pyx_codeobj_tab[69] = __Pyx_PyCode_New(descr, varnames, __pyx_mstate->__pyx_kp_u_pysam_libcbcf_pyx, __pyx_mstate->__pyx_n_u_get_2, __pyx_k_A_d_4_auD_t1_AQ_4vS_1_auD_t1_2S, tuple_dedup_map); if (unlikely(!__pyx_mstate_global->__pyx_codeobj_tab[69])) goto bad;
  }
  {
    const __Pyx_PyCode_New_function_description descr = {1, 0, 0, 2, (unsigned int)(CO_OPTIMIZED|CO_NEWLOCALS), 1506, 78};
    PyObject* const varnames[] = {__pyx_mstate->__pyx_n_u_self, __pyx_mstate->__pyx_n_u_hdr};
    __pyx_mstate_global->__pyx_codeobj_tab[70] = __Pyx_PyCode_New(descr, varnames, __pyx_mstate->__pyx_kp_u_pysam_libcbcf_pyx, __pyx_mstate->__pyx_n_u_get_2, __pyx_k_A_d_4_auD_t1_AQ_4vS_1_5_G4q, tuple_dedup_map); if (unlikely(!__pyx_mstate_global->__pyx_codeobj_tab[70])) goto bad;
  }
  {
    const __Pyx_PyCode_New_function_description descr = {1, 0, 0, 2, (unsigned int)(CO_OPTIMIZED|CO_NEWLOCALS), 1517, 42};
    PyObject* const varnames[] = {__pyx_mstate->__pyx_n_u_self, __pyx_mstate->__pyx_n_u_descr};
    __pyx_mstate_global->__pyx_codeobj_tab[71] = __Pyx_PyCode_New(descr, varnames, __pyx_mstate->__pyx_kp_u_pysam_libcbcf_pyx, __pyx_mstate->__pyx_n_u_get_2, __pyx_k_A_G4q_1_E_q_y, tuple_dedup_map); if (unlikely(!__pyx_mstate_global->__pyx_codeobj_tab[71])) goto bad;
  }
  {
    const __Pyx_PyCode_New_function_description descr = {1, 0, 0, 3, (unsigned int)(CO_OPTIMIZED|CO_NEWLOCALS), 1525, 94};
    PyObject* const varnames[] = {__pyx_mstate->__pyx_n_u_self, __pyx_mstate->__pyx_n_u_hdr, __pyx_mstate->__pyx_n_u_hrec};
    __pyx_mstate_global->__pyx_codeobj_tab[72] = __Pyx_PyCode_New(descr, varnames, __pyx_mstate->__pyx_kp_u_pysam_libcbcf_pyx, __pyx_mstate->__pyx_n_u_get_2, __pyx_k_A_d_4_auD_t1_AQ_3az_d_e1D_4q_1_a, tuple_dedup_map); if (unlikely(!__pyx_mstate_global->__pyx_codeobj_tab[72])) goto bad;
  }
  {
    const __Pyx_PyCode_New_function_description descr = {1, 0, 0, 3, (unsigned int)(CO_OPTIMIZED|CO_NEWLOCALS), 1536, 43};
    PyObject* const varnames[] = {__pyx_mstate->__pyx_n_u_self, __pyx_mstate->__pyx_n_u_hdr, __pyx_mstate->__pyx_n_u_key};
    __pyx_mstate_global->__pyx_codeobj_tab[73] = __Pyx_PyCode_New(descr, varnames, __pyx_mstate->__pyx_kp_u_pysam_libcbcf_pyx, __pyx_mstate->__pyx_n_u_remove_header, __pyx_k_A_d_s_Qj_T_auD_q, 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), 70, 2};
    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_pysam_libcbcf_pxd, __pyx_mstate->__pyx_n_u_get_2, __pyx_k__14, tuple_dedup_map); if (unlikely(!__pyx_mstate_global->__pyx_codeobj_tab[74])) goto bad;
  }
  {
    const __Pyx_PyCode_New_function_description descr = {1, 0, 0, 4, (unsigned int)(CO_OPTIMIZED|CO_NEWLOCALS), 1, 101};
    PyObject* const varnames[] = {__pyx_mstate->__pyx_n_u_self, __pyx_mstate->__pyx_n_u_state, __pyx_mstate->__pyx_n_u_dict_2, __pyx_mstate->__pyx_n_u_use_setstate};
    __pyx_mstate_global->__pyx_codeobj_tab[75] = __Pyx_PyCode_New(descr, varnames, __pyx_mstate->__pyx_kp_u_stringsource, __pyx_mstate->__pyx_n_u_reduce_cython, __pyx_k_T_e4q_G1F_a_vWA_q_t87_q_0_AWKwa, tuple_dedup_map); if (unlikely(!__pyx_mstate_global->__pyx_codeobj_tab[75])) goto bad;
  }
  {
    const __Pyx_PyCode_New_function_description descr = {2, 0, 0, 2, (unsigned int)(CO_OPTIMIZED|CO_NEWLOCALS), 16, 11};
    PyObject* const varnames[] = {__pyx_mstate->__pyx_n_u_self, __pyx_mstate->__pyx_n_u_pyx_state};
    __pyx_mstate_global->__pyx_codeobj_tab[76] = __Pyx_PyCode_New(descr, varnames, __pyx_mstate->__pyx_kp_u_stringsource, __pyx_mstate->__pyx_n_u_setstate_cython, __pyx_k_QfA, tuple_dedup_map); if (unlikely(!__pyx_mstate_global->__pyx_codeobj_tab[76])) goto bad;
  }
  {
    const __Pyx_PyCode_New_function_description descr = {3, 0, 0, 9, (unsigned int)(CO_OPTIMIZED|CO_NEWLOCALS), 1542, 123};
    PyObject* const varnames[] = {__pyx_mstate->__pyx_n_u_header, __pyx_mstate->__pyx_n_u_type, __pyx_mstate->__pyx_n_u_id, __pyx_mstate->__pyx_n_u_MAX_POS, __pyx_mstate->__pyx_n_u_VALUE_TYPES, __pyx_mstate->__pyx_n_u_METADATA_TYPES, __pyx_mstate->__pyx_n_u_METADATA_LENGTHS, __pyx_mstate->__pyx_n_u_nothing, __pyx_mstate->__pyx_n_u_bcf_str_cache};
    __pyx_mstate_global->__pyx_codeobj_tab[77] = __Pyx_PyCode_New(descr, varnames, __pyx_mstate->__pyx_kp_u_pysam_libcbcf_pyx, __pyx_mstate->__pyx_n_u_makeVariantMetadata, __pyx_k_t1_j_uC_e3l_e3a_j_s_Bc_CvT_1A_j, tuple_dedup_map); if (unlikely(!__pyx_mstate_global->__pyx_codeobj_tab[77])) goto bad;
  }
  {
    const __Pyx_PyCode_New_function_description descr = {1, 0, 0, 3, (unsigned int)(CO_OPTIMIZED|CO_NEWLOCALS|CO_VARARGS|CO_VARKEYWORDS), 1562, 11};
    PyObject* const varnames[] = {__pyx_mstate->__pyx_n_u_self, __pyx_mstate->__pyx_n_u_args, __pyx_mstate->__pyx_n_u_kwargs};
    __pyx_mstate_global->__pyx_codeobj_tab[78] = __Pyx_PyCode_New(descr, varnames, __pyx_mstate->__pyx_kp_u_pysam_libcbcf_pyx, __pyx_mstate->__pyx_n_u_init, __pyx_k_A_iq, tuple_dedup_map); if (unlikely(!__pyx_mstate_global->__pyx_codeobj_tab[78])) goto bad;
  }
  {
    const __Pyx_PyCode_New_function_description descr = {5, 0, 0, 7, (unsigned int)(CO_OPTIMIZED|CO_NEWLOCALS|CO_VARKEYWORDS), 1565, 196};
    PyObject* const varnames[] = {__pyx_mstate->__pyx_n_u_self, __pyx_mstate->__pyx_n_u_id, __pyx_mstate->__pyx_n_u_number, __pyx_mstate->__pyx_n_u_type, __pyx_mstate->__pyx_n_u_description, __pyx_mstate->__pyx_n_u_kwargs, __pyx_mstate->__pyx_n_u_items};
    __pyx_mstate_global->__pyx_codeobj_tab[79] = __Pyx_PyCode_New(descr, varnames, __pyx_mstate->__pyx_kp_u_pysam_libcbcf_pyx, __pyx_mstate->__pyx_n_u_add, __pyx_k_A_3c_A_gQa_4vS_wgQ_j_uG1_j_BfL_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, 5, (unsigned int)(CO_OPTIMIZED|CO_NEWLOCALS), 1591, 94};
    PyObject* const varnames[] = {__pyx_mstate->__pyx_n_u_self, __pyx_mstate->__pyx_n_u_hdr, __pyx_mstate->__pyx_n_u_idpair, __pyx_mstate->__pyx_n_u_i, __pyx_mstate->__pyx_n_u_n};
    __pyx_mstate_global->__pyx_codeobj_tab[80] = __Pyx_PyCode_New(descr, varnames, __pyx_mstate->__pyx_kp_u_pysam_libcbcf_pyx, __pyx_mstate->__pyx_n_u_len, __pyx_k_A_d_A_E_as_AQ_S_1Kr_vU_fE_V4uAT, tuple_dedup_map); if (unlikely(!__pyx_mstate_global->__pyx_codeobj_tab[80])) goto bad;
  }
  {
    const __Pyx_PyCode_New_function_description descr = {1, 0, 0, 4, (unsigned int)(CO_OPTIMIZED|CO_NEWLOCALS), 1602, 91};
    PyObject* const varnames[] = {__pyx_mstate->__pyx_n_u_self, __pyx_mstate->__pyx_n_u_hdr, __pyx_mstate->__pyx_n_u_idpair, __pyx_mstate->__pyx_n_u_i};
    __pyx_mstate_global->__pyx_codeobj_tab[81] = __Pyx_PyCode_New(descr, varnames, __pyx_mstate->__pyx_kp_u_pysam_libcbcf_pyx, __pyx_mstate->__pyx_n_u_bool, __pyx_k_A_d_E_as_AQ_S_1Kr_vU_fE_V4uAT_cQ, tuple_dedup_map); if (unlikely(!__pyx_mstate_global->__pyx_codeobj_tab[81])) goto bad;
  }
  {
    const __Pyx_PyCode_New_function_description descr = {2, 0, 0, 6, (unsigned int)(CO_OPTIMIZED|CO_NEWLOCALS), 1613, 125};
    PyObject* const varnames[] = {__pyx_mstate->__pyx_n_u_self, __pyx_mstate->__pyx_n_u_key, __pyx_mstate->__pyx_n_u_hdr, __pyx_mstate->__pyx_n_u_d, __pyx_mstate->__pyx_n_u_bkey, __pyx_mstate->__pyx_n_u_k};
    __pyx_mstate_global->__pyx_codeobj_tab[82] = __Pyx_PyCode_New(descr, varnames, __pyx_mstate->__pyx_kp_u_pysam_libcbcf_pyx, __pyx_mstate->__pyx_n_u_getitem, __pyx_k_A_d_S_Qa_Qa_as_2S_as_RuAT_c_G1A, tuple_dedup_map); if (unlikely(!__pyx_mstate_global->__pyx_codeobj_tab[82])) goto bad;
  }
  {
    const __Pyx_PyCode_New_function_description descr = {2, 0, 0, 6, (unsigned int)(CO_OPTIMIZED|CO_NEWLOCALS), 1625, 112};
    PyObject* const varnames[] = {__pyx_mstate->__pyx_n_u_self, __pyx_mstate->__pyx_n_u_key, __pyx_mstate->__pyx_n_u_hdr, __pyx_mstate->__pyx_n_u_d, __pyx_mstate->__pyx_n_u_bkey, __pyx_mstate->__pyx_n_u_k};
    __pyx_mstate_global->__pyx_codeobj_tab[83] = __Pyx_PyCode_New(descr, varnames, __pyx_mstate->__pyx_kp_u_pysam_libcbcf_pyx, __pyx_mstate->__pyx_n_u_remove_header, __pyx_k_A_d_S_Qa_Qa_as_2S_as_RuAT_c_G1A_2, tuple_dedup_map); if (unlikely(!__pyx_mstate_global->__pyx_codeobj_tab[83])) goto bad;
  }
  {
    const __Pyx_PyCode_New_function_description descr = {1, 0, 0, 2, (unsigned int)(CO_OPTIMIZED|CO_NEWLOCALS), 1638, 24};
    PyObject* const varnames[] = {__pyx_mstate->__pyx_n_u_self, __pyx_mstate->__pyx_n_u_hdr};
    __pyx_mstate_global->__pyx_codeobj_tab[84] = __Pyx_PyCode_New(descr, varnames, __pyx_mstate->__pyx_kp_u_pysam_libcbcf_pyx, __pyx_mstate->__pyx_n_u_clear_header, __pyx_k_A_d_auD_q, tuple_dedup_map); if (unlikely(!__pyx_mstate_global->__pyx_codeobj_tab[84])) goto bad;
  }
  {
    const __Pyx_PyCode_New_function_description descr = {1, 0, 0, 4, (unsigned int)(CO_OPTIMIZED|CO_NEWLOCALS|CO_GENERATOR), 1643, 2};
    PyObject* const varnames[] = {__pyx_mstate->__pyx_n_u_self, __pyx_mstate->__pyx_n_u_hdr, __pyx_mstate->__pyx_n_u_idpair, __pyx_mstate->__pyx_n_u_i};
    __pyx_mstate_global->__pyx_codeobj_tab[85] = __Pyx_PyCode_New(descr, varnames, __pyx_mstate->__pyx_kp_u_pysam_libcbcf_pyx, __pyx_mstate->__pyx_n_u_iter, __pyx_k_A_3, tuple_dedup_map); if (unlikely(!__pyx_mstate_global->__pyx_codeobj_tab[85])) goto bad;
  }
  {
    const __Pyx_PyCode_New_function_description descr = {3, 0, 0, 3, (unsigned int)(CO_OPTIMIZED|CO_NEWLOCALS), 1653, 25};
    PyObject* const varnames[] = {__pyx_mstate->__pyx_n_u_self, __pyx_mstate->__pyx_n_u_key, __pyx_mstate->__pyx_n_u_default};
    __pyx_mstate_global->__pyx_codeobj_tab[86] = __Pyx_PyCode_New(descr, varnames, __pyx_mstate->__pyx_kp_u_pysam_libcbcf_pyx, __pyx_mstate->__pyx_n_u_get, __pyx_k_q_4q_1, tuple_dedup_map); if (unlikely(!__pyx_mstate_global->__pyx_codeobj_tab[86])) goto bad;
  }
  {
    const __Pyx_PyCode_New_function_description descr = {2, 0, 0, 2, (unsigned int)(CO_OPTIMIZED|CO_NEWLOCALS), 1660, 25};
    PyObject* const varnames[] = {__pyx_mstate->__pyx_n_u_self, __pyx_mstate->__pyx_n_u_key};
    __pyx_mstate_global->__pyx_codeobj_tab[87] = __Pyx_PyCode_New(descr, varnames, __pyx_mstate->__pyx_kp_u_pysam_libcbcf_pyx, __pyx_mstate->__pyx_n_u_contains, __pyx_k_A_1_1, 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), 1668, 11};
    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_pysam_libcbcf_pyx, __pyx_mstate->__pyx_n_u_iterkeys, __pyx_k_A_t1A, tuple_dedup_map); if (unlikely(!__pyx_mstate_global->__pyx_codeobj_tab[88])) goto bad;
  }
  {
    const __Pyx_PyCode_New_function_description descr = {1, 0, 0, 2, (unsigned int)(CO_OPTIMIZED|CO_NEWLOCALS|CO_GENERATOR), 1672, 2};
    PyObject* const varnames[] = {__pyx_mstate->__pyx_n_u_self, __pyx_mstate->__pyx_n_u_key};
    __pyx_mstate_global->__pyx_codeobj_tab[89] = __Pyx_PyCode_New(descr, varnames, __pyx_mstate->__pyx_kp_u_pysam_libcbcf_pyx, __pyx_mstate->__pyx_n_u_itervalues, __pyx_k_A_3, 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|CO_GENERATOR), 1677, 2};
    PyObject* const varnames[] = {__pyx_mstate->__pyx_n_u_self, __pyx_mstate->__pyx_n_u_key};
    __pyx_mstate_global->__pyx_codeobj_tab[90] = __Pyx_PyCode_New(descr, varnames, __pyx_mstate->__pyx_kp_u_pysam_libcbcf_pyx, __pyx_mstate->__pyx_n_u_iteritems, __pyx_k_A_3, 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), 1682, 11};
    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_pysam_libcbcf_pyx, __pyx_mstate->__pyx_n_u_keys, __pyx_k_A_t1A, tuple_dedup_map); if (unlikely(!__pyx_mstate_global->__pyx_codeobj_tab[91])) goto bad;
  }
  {
    const __Pyx_PyCode_New_function_description descr = {1, 0, 0, 1, (unsigned int)(CO_OPTIMIZED|CO_NEWLOCALS), 1686, 15};
    PyObject* const varnames[] = {__pyx_mstate->__pyx_n_u_self};
    __pyx_mstate_global->__pyx_codeobj_tab[92] = __Pyx_PyCode_New(descr, varnames, __pyx_mstate->__pyx_kp_u_pysam_libcbcf_pyx, __pyx_mstate->__pyx_n_u_items, __pyx_k_A_t1D, tuple_dedup_map); if (unlikely(!__pyx_mstate_global->__pyx_codeobj_tab[92])) goto bad;
  }
  {
    const __Pyx_PyCode_New_function_description descr = {1, 0, 0, 1, (unsigned int)(CO_OPTIMIZED|CO_NEWLOCALS), 1690, 15};
    PyObject* const varnames[] = {__pyx_mstate->__pyx_n_u_self};
    __pyx_mstate_global->__pyx_codeobj_tab[93] = __Pyx_PyCode_New(descr, varnames, __pyx_mstate->__pyx_kp_u_pysam_libcbcf_pyx, __pyx_mstate->__pyx_n_u_values, __pyx_k_A_t1D_1, tuple_dedup_map); if (unlikely(!__pyx_mstate_global->__pyx_codeobj_tab[93])) goto bad;
  }
  {
    const __Pyx_PyCode_New_function_description descr = {1, 0, 0, 1, (unsigned int)(CO_OPTIMIZED|CO_NEWLOCALS), 76, 2};
    PyObject* const varnames[] = {__pyx_mstate->__pyx_n_u_self};
    __pyx_mstate_global->__pyx_codeobj_tab[94] = __Pyx_PyCode_New(descr, varnames, __pyx_mstate->__pyx_kp_u_pysam_libcbcf_pxd, __pyx_mstate->__pyx_n_u_get_2, __pyx_k__14, tuple_dedup_map); if (unlikely(!__pyx_mstate_global->__pyx_codeobj_tab[94])) goto bad;
  }
  {
    const __Pyx_PyCode_New_function_description descr = {1, 0, 0, 4, (unsigned int)(CO_OPTIMIZED|CO_NEWLOCALS), 1, 98};
    PyObject* const varnames[] = {__pyx_mstate->__pyx_n_u_self, __pyx_mstate->__pyx_n_u_state, __pyx_mstate->__pyx_n_u_dict_2, __pyx_mstate->__pyx_n_u_use_setstate};
    __pyx_mstate_global->__pyx_codeobj_tab[95] = __Pyx_PyCode_New(descr, varnames, __pyx_mstate->__pyx_kp_u_stringsource, __pyx_mstate->__pyx_n_u_reduce_cython, __pyx_k_T_a_G1F_a_vWA_q_t87_q_6d_7_WTU, tuple_dedup_map); if (unlikely(!__pyx_mstate_global->__pyx_codeobj_tab[95])) goto bad;
  }
  {
    const __Pyx_PyCode_New_function_description descr = {2, 0, 0, 2, (unsigned int)(CO_OPTIMIZED|CO_NEWLOCALS), 16, 11};
    PyObject* const varnames[] = {__pyx_mstate->__pyx_n_u_self, __pyx_mstate->__pyx_n_u_pyx_state};
    __pyx_mstate_global->__pyx_codeobj_tab[96] = __Pyx_PyCode_New(descr, varnames, __pyx_mstate->__pyx_kp_u_stringsource, __pyx_mstate->__pyx_n_u_setstate_cython, __pyx_k_31F, tuple_dedup_map); if (unlikely(!__pyx_mstate_global->__pyx_codeobj_tab[96])) goto bad;
  }
  {
    const __Pyx_PyCode_New_function_description descr = {2, 0, 0, 8, (unsigned int)(CO_OPTIMIZED|CO_NEWLOCALS), 1700, 49};
    PyObject* const varnames[] = {__pyx_mstate->__pyx_n_u_header, __pyx_mstate->__pyx_n_u_type, __pyx_mstate->__pyx_n_u_MAX_POS, __pyx_mstate->__pyx_n_u_VALUE_TYPES, __pyx_mstate->__pyx_n_u_METADATA_TYPES, __pyx_mstate->__pyx_n_u_METADATA_LENGTHS, __pyx_mstate->__pyx_n_u_nothing, __pyx_mstate->__pyx_n_u_bcf_str_cache};
    __pyx_mstate_global->__pyx_codeobj_tab[97] = __Pyx_PyCode_New(descr, varnames, __pyx_mstate->__pyx_kp_u_pysam_libcbcf_pyx, __pyx_mstate->__pyx_n_u_makeVariantHeaderMetadata, __pyx_k_t1_j_81A_1, tuple_dedup_map); if (unlikely(!__pyx_mstate_global->__pyx_codeobj_tab[97])) goto bad;
  }
  {
    const __Pyx_PyCode_New_function_description descr = {1, 0, 0, 3, (unsigned int)(CO_OPTIMIZED|CO_NEWLOCALS|CO_VARARGS|CO_VARKEYWORDS), 1713, 11};
    PyObject* const varnames[] = {__pyx_mstate->__pyx_n_u_self, __pyx_mstate->__pyx_n_u_args, __pyx_mstate->__pyx_n_u_kwargs};
    __pyx_mstate_global->__pyx_codeobj_tab[98] = __Pyx_PyCode_New(descr, varnames, __pyx_mstate->__pyx_kp_u_pysam_libcbcf_pyx, __pyx_mstate->__pyx_n_u_init, __pyx_k_A_iq, tuple_dedup_map); if (unlikely(!__pyx_mstate_global->__pyx_codeobj_tab[98])) goto bad;
  }
  {
    const __Pyx_PyCode_New_function_description descr = {1, 0, 0, 2, (unsigned int)(CO_OPTIMIZED|CO_NEWLOCALS), 1716, 37};
    PyObject* const varnames[] = {__pyx_mstate->__pyx_n_u_self, __pyx_mstate->__pyx_n_u_hdr};
    __pyx_mstate_global->__pyx_codeobj_tab[99] = __Pyx_PyCode_New(descr, varnames, __pyx_mstate->__pyx_kp_u_pysam_libcbcf_pyx, __pyx_mstate->__pyx_n_u_get_2, __pyx_k_A_d_Cq_1D_A, tuple_dedup_map); if (unlikely(!__pyx_mstate_global->__pyx_codeobj_tab[99])) goto bad;
  }
  {
    const __Pyx_PyCode_New_function_description descr = {1, 0, 0, 1, (unsigned int)(CO_OPTIMIZED|CO_NEWLOCALS), 1722, 11};
    PyObject* const varnames[] = {__pyx_mstate->__pyx_n_u_self};
    __pyx_mstate_global->__pyx_codeobj_tab[100] = __Pyx_PyCode_New(descr, varnames, __pyx_mstate->__pyx_kp_u_pysam_libcbcf_pyx, __pyx_mstate->__pyx_n_u_get_2, __pyx_k_A_t1, tuple_dedup_map); if (unlikely(!__pyx_mstate_global->__pyx_codeobj_tab[100])) goto bad;
  }
  {
    const __Pyx_PyCode_New_function_description descr = {1, 0, 0, 3, (unsigned int)(CO_OPTIMIZED|CO_NEWLOCALS), 1727, 47};
    PyObject* const varnames[] = {__pyx_mstate->__pyx_n_u_self, __pyx_mstate->__pyx_n_u_hdr, __pyx_mstate->__pyx_n_u_length};
    __pyx_mstate_global->__pyx_codeobj_tab[101] = __Pyx_PyCode_New(descr, varnames, __pyx_mstate->__pyx_kp_u_pysam_libcbcf_pyx, __pyx_mstate->__pyx_n_u_get_2, __pyx_k_A_d_s_Qk_d_e1A_z_Q, tuple_dedup_map); if (unlikely(!__pyx_mstate_global->__pyx_codeobj_tab[101])) goto bad;
  }
  {
    const __Pyx_PyCode_New_function_description descr = {1, 0, 0, 3, (unsigned int)(CO_OPTIMIZED|CO_NEWLOCALS), 1734, 52};
    PyObject* const varnames[] = {__pyx_mstate->__pyx_n_u_self, __pyx_mstate->__pyx_n_u_hdr, __pyx_mstate->__pyx_n_u_hrec};
    __pyx_mstate_global->__pyx_codeobj_tab[102] = __Pyx_PyCode_New(descr, varnames, __pyx_mstate->__pyx_kp_u_pysam_libcbcf_pyx, __pyx_mstate->__pyx_n_u_get_2, __pyx_k_A_d_3a_4t4uAQ_at9A, tuple_dedup_map); if (unlikely(!__pyx_mstate_global->__pyx_codeobj_tab[102])) goto bad;
  }
  {
    const __Pyx_PyCode_New_function_description descr = {1, 0, 0, 3, (unsigned int)(CO_OPTIMIZED|CO_NEWLOCALS), 1741, 41};
    PyObject* const varnames[] = {__pyx_mstate->__pyx_n_u_self, __pyx_mstate->__pyx_n_u_hdr, __pyx_mstate->__pyx_n_u_key};
    __pyx_mstate_global->__pyx_codeobj_tab[103] = __Pyx_PyCode_New(descr, varnames, __pyx_mstate->__pyx_kp_u_pysam_libcbcf_pyx, __pyx_mstate->__pyx_n_u_remove_header, __pyx_k_A_d_s_Qk_d_auL, tuple_dedup_map); if (unlikely(!__pyx_mstate_global->__pyx_codeobj_tab[103])) goto bad;
  }
  {
    const __Pyx_PyCode_New_function_description descr = {1, 0, 0, 1, (unsigned int)(CO_OPTIMIZED|CO_NEWLOCALS), 65, 2};
    PyObject* const varnames[] = {__pyx_mstate->__pyx_n_u_self};
    __pyx_mstate_global->__pyx_codeobj_tab[104] = __Pyx_PyCode_New(descr, varnames, __pyx_mstate->__pyx_kp_u_pysam_libcbcf_pxd, __pyx_mstate->__pyx_n_u_get_2, __pyx_k__14, tuple_dedup_map); if (unlikely(!__pyx_mstate_global->__pyx_codeobj_tab[104])) goto bad;
  }
  {
    const __Pyx_PyCode_New_function_description descr = {1, 0, 0, 4, (unsigned int)(CO_OPTIMIZED|CO_NEWLOCALS), 1, 97};
    PyObject* const varnames[] = {__pyx_mstate->__pyx_n_u_self, __pyx_mstate->__pyx_n_u_state, __pyx_mstate->__pyx_n_u_dict_2, __pyx_mstate->__pyx_n_u_use_setstate};
    __pyx_mstate_global->__pyx_codeobj_tab[105] = __Pyx_PyCode_New(descr, varnames, __pyx_mstate->__pyx_kp_u_stringsource, __pyx_mstate->__pyx_n_u_reduce_cython, __pyx_k_T_a_G1F_a_vWA_q_t87_q_d_7_WA_d, tuple_dedup_map); if (unlikely(!__pyx_mstate_global->__pyx_codeobj_tab[105])) goto bad;
  }
  {
    const __Pyx_PyCode_New_function_description descr = {2, 0, 0, 2, (unsigned int)(CO_OPTIMIZED|CO_NEWLOCALS), 16, 11};
    PyObject* const varnames[] = {__pyx_mstate->__pyx_n_u_self, __pyx_mstate->__pyx_n_u_pyx_state};
    __pyx_mstate_global->__pyx_codeobj_tab[106] = __Pyx_PyCode_New(descr, varnames, __pyx_mstate->__pyx_kp_u_stringsource, __pyx_mstate->__pyx_n_u_setstate_cython, __pyx_k_1F, tuple_dedup_map); if (unlikely(!__pyx_mstate_global->__pyx_codeobj_tab[106])) goto bad;
  }
  {
    const __Pyx_PyCode_New_function_description descr = {2, 0, 0, 8, (unsigned int)(CO_OPTIMIZED|CO_NEWLOCALS), 1747, 82};
    PyObject* const varnames[] = {__pyx_mstate->__pyx_n_u_header, __pyx_mstate->__pyx_n_u_id, __pyx_mstate->__pyx_n_u_MAX_POS, __pyx_mstate->__pyx_n_u_VALUE_TYPES, __pyx_mstate->__pyx_n_u_METADATA_TYPES, __pyx_mstate->__pyx_n_u_METADATA_LENGTHS, __pyx_mstate->__pyx_n_u_nothing, __pyx_mstate->__pyx_n_u_bcf_str_cache};
    __pyx_mstate_global->__pyx_codeobj_tab[107] = __Pyx_PyCode_New(descr, varnames, __pyx_mstate->__pyx_kp_u_pysam_libcbcf_pyx, __pyx_mstate->__pyx_n_u_makeVariantContig, __pyx_k_t1_j_s_Bc_CvT_1A_j_XQa_A_1, tuple_dedup_map); if (unlikely(!__pyx_mstate_global->__pyx_codeobj_tab[107])) goto bad;
  }
  {
    const __Pyx_PyCode_New_function_description descr = {1, 0, 0, 3, (unsigned int)(CO_OPTIMIZED|CO_NEWLOCALS|CO_VARARGS|CO_VARKEYWORDS), 1763, 11};
    PyObject* const varnames[] = {__pyx_mstate->__pyx_n_u_self, __pyx_mstate->__pyx_n_u_args, __pyx_mstate->__pyx_n_u_kwargs};
    __pyx_mstate_global->__pyx_codeobj_tab[108] = __Pyx_PyCode_New(descr, varnames, __pyx_mstate->__pyx_kp_u_pysam_libcbcf_pyx, __pyx_mstate->__pyx_n_u_init, __pyx_k_A_iq, tuple_dedup_map); if (unlikely(!__pyx_mstate_global->__pyx_codeobj_tab[108])) goto bad;
  }
  {
    const __Pyx_PyCode_New_function_description descr = {1, 0, 0, 2, (unsigned int)(CO_OPTIMIZED|CO_NEWLOCALS), 1766, 49};
    PyObject* const varnames[] = {__pyx_mstate->__pyx_n_u_self, __pyx_mstate->__pyx_n_u_hdr};
    __pyx_mstate_global->__pyx_codeobj_tab[109] = __Pyx_PyCode_New(descr, varnames, __pyx_mstate->__pyx_kp_u_pysam_libcbcf_pyx, __pyx_mstate->__pyx_n_u_len, __pyx_k_A_d_wa_U_3b_s_AQ, tuple_dedup_map); if (unlikely(!__pyx_mstate_global->__pyx_codeobj_tab[109])) goto bad;
  }
  {
    const __Pyx_PyCode_New_function_description descr = {1, 0, 0, 2, (unsigned int)(CO_OPTIMIZED|CO_NEWLOCALS), 1771, 53};
    PyObject* const varnames[] = {__pyx_mstate->__pyx_n_u_self, __pyx_mstate->__pyx_n_u_hdr};
    __pyx_mstate_global->__pyx_codeobj_tab[110] = __Pyx_PyCode_New(descr, varnames, __pyx_mstate->__pyx_kp_u_pysam_libcbcf_pyx, __pyx_mstate->__pyx_n_u_bool, __pyx_k_A_d_wa_U_3b_s_A_A, tuple_dedup_map); if (unlikely(!__pyx_mstate_global->__pyx_codeobj_tab[110])) goto bad;
  }
  {
    const __Pyx_PyCode_New_function_description descr = {2, 0, 0, 8, (unsigned int)(CO_OPTIMIZED|CO_NEWLOCALS), 1776, 164};
    PyObject* const varnames[] = {__pyx_mstate->__pyx_n_u_self, __pyx_mstate->__pyx_n_u_key, __pyx_mstate->__pyx_n_u_hdr, __pyx_mstate->__pyx_n_u_index, __pyx_mstate->__pyx_n_u_d, __pyx_mstate->__pyx_n_u_bkey, __pyx_mstate->__pyx_n_u_k, __pyx_mstate->__pyx_n_u_id};
    __pyx_mstate_global->__pyx_codeobj_tab[111] = __Pyx_PyCode_New(descr, varnames, __pyx_mstate->__pyx_kp_u_pysam_libcbcf_pyx, __pyx_mstate->__pyx_n_u_getitem, __pyx_k_A_d_Qe1_A_vRr_F_S_1_j_AT_S_Qa_Qa, tuple_dedup_map); if (unlikely(!__pyx_mstate_global->__pyx_codeobj_tab[111])) goto bad;
  }
  {
    const __Pyx_PyCode_New_function_description descr = {2, 0, 0, 7, (unsigned int)(CO_OPTIMIZED|CO_NEWLOCALS), 1797, 153};
    PyObject* const varnames[] = {__pyx_mstate->__pyx_n_u_self, __pyx_mstate->__pyx_n_u_key, __pyx_mstate->__pyx_n_u_hdr, __pyx_mstate->__pyx_n_u_index, __pyx_mstate->__pyx_n_u_ckey, __pyx_mstate->__pyx_n_u_d, __pyx_mstate->__pyx_n_u_k};
    __pyx_mstate_global->__pyx_codeobj_tab[112] = __Pyx_PyCode_New(descr, varnames, __pyx_mstate->__pyx_kp_u_pysam_libcbcf_pyx, __pyx_mstate->__pyx_n_u_remove_header, __pyx_k_A_d_Qe1_A_vRr_F_S_1_j_3c_Qd_a_3e, tuple_dedup_map); if (unlikely(!__pyx_mstate_global->__pyx_codeobj_tab[112])) goto bad;
  }
  {
    const __Pyx_PyCode_New_function_description descr = {1, 0, 0, 2, (unsigned int)(CO_OPTIMIZED|CO_NEWLOCALS), 1818, 22};
    PyObject* const varnames[] = {__pyx_mstate->__pyx_n_u_self, __pyx_mstate->__pyx_n_u_hdr};
    __pyx_mstate_global->__pyx_codeobj_tab[113] = __Pyx_PyCode_New(descr, varnames, __pyx_mstate->__pyx_kp_u_pysam_libcbcf_pyx, __pyx_mstate->__pyx_n_u_clear_header, __pyx_k_A_d_auL, tuple_dedup_map); if (unlikely(!__pyx_mstate_global->__pyx_codeobj_tab[113])) goto bad;
  }
  {
    const __Pyx_PyCode_New_function_description descr = {1, 0, 0, 5, (unsigned int)(CO_OPTIMIZED|CO_NEWLOCALS|CO_GENERATOR), 1823, 2};
    PyObject* const varnames[] = {__pyx_mstate->__pyx_n_u_self, __pyx_mstate->__pyx_n_u_hdr, __pyx_mstate->__pyx_n_u_d, __pyx_mstate->__pyx_n_u_n, __pyx_mstate->__pyx_n_u_i};
    __pyx_mstate_global->__pyx_codeobj_tab[114] = __Pyx_PyCode_New(descr, varnames, __pyx_mstate->__pyx_kp_u_pysam_libcbcf_pyx, __pyx_mstate->__pyx_n_u_iter, __pyx_k_A_3, tuple_dedup_map); if (unlikely(!__pyx_mstate_global->__pyx_codeobj_tab[114])) goto bad;
  }
  {
    const __Pyx_PyCode_New_function_description descr = {3, 0, 0, 3, (unsigned int)(CO_OPTIMIZED|CO_NEWLOCALS), 1833, 25};
    PyObject* const varnames[] = {__pyx_mstate->__pyx_n_u_self, __pyx_mstate->__pyx_n_u_key, __pyx_mstate->__pyx_n_u_default};
    __pyx_mstate_global->__pyx_codeobj_tab[115] = __Pyx_PyCode_New(descr, varnames, __pyx_mstate->__pyx_kp_u_pysam_libcbcf_pyx, __pyx_mstate->__pyx_n_u_get, __pyx_k_q_4q_1, tuple_dedup_map); if (unlikely(!__pyx_mstate_global->__pyx_codeobj_tab[115])) goto bad;
  }
  {
    const __Pyx_PyCode_New_function_description descr = {2, 0, 0, 2, (unsigned int)(CO_OPTIMIZED|CO_NEWLOCALS), 1840, 25};
    PyObject* const varnames[] = {__pyx_mstate->__pyx_n_u_self, __pyx_mstate->__pyx_n_u_key};
    __pyx_mstate_global->__pyx_codeobj_tab[116] = __Pyx_PyCode_New(descr, varnames, __pyx_mstate->__pyx_kp_u_pysam_libcbcf_pyx, __pyx_mstate->__pyx_n_u_contains, __pyx_k_A_1_1, tuple_dedup_map); if (unlikely(!__pyx_mstate_global->__pyx_codeobj_tab[116])) goto bad;
  }
  {
    const __Pyx_PyCode_New_function_description descr = {1, 0, 0, 1, (unsigned int)(CO_OPTIMIZED|CO_NEWLOCALS), 1848, 11};
    PyObject* const varnames[] = {__pyx_mstate->__pyx_n_u_self};
    __pyx_mstate_global->__pyx_codeobj_tab[117] = __Pyx_PyCode_New(descr, varnames, __pyx_mstate->__pyx_kp_u_pysam_libcbcf_pyx, __pyx_mstate->__pyx_n_u_iterkeys, __pyx_k_A_t1A, tuple_dedup_map); if (unlikely(!__pyx_mstate_global->__pyx_codeobj_tab[117])) goto bad;
  }
  {
    const __Pyx_PyCode_New_function_description descr = {1, 0, 0, 2, (unsigned int)(CO_OPTIMIZED|CO_NEWLOCALS|CO_GENERATOR), 1852, 2};
    PyObject* const varnames[] = {__pyx_mstate->__pyx_n_u_self, __pyx_mstate->__pyx_n_u_key};
    __pyx_mstate_global->__pyx_codeobj_tab[118] = __Pyx_PyCode_New(descr, varnames, __pyx_mstate->__pyx_kp_u_pysam_libcbcf_pyx, __pyx_mstate->__pyx_n_u_itervalues, __pyx_k_A_3, tuple_dedup_map); if (unlikely(!__pyx_mstate_global->__pyx_codeobj_tab[118])) goto bad;
  }
  {
    const __Pyx_PyCode_New_function_description descr = {1, 0, 0, 2, (unsigned int)(CO_OPTIMIZED|CO_NEWLOCALS|CO_GENERATOR), 1857, 2};
    PyObject* const varnames[] = {__pyx_mstate->__pyx_n_u_self, __pyx_mstate->__pyx_n_u_key};
    __pyx_mstate_global->__pyx_codeobj_tab[119] = __Pyx_PyCode_New(descr, varnames, __pyx_mstate->__pyx_kp_u_pysam_libcbcf_pyx, __pyx_mstate->__pyx_n_u_iteritems, __pyx_k_A_3, tuple_dedup_map); if (unlikely(!__pyx_mstate_global->__pyx_codeobj_tab[119])) goto bad;
  }
  {
    const __Pyx_PyCode_New_function_description descr = {1, 0, 0, 1, (unsigned int)(CO_OPTIMIZED|CO_NEWLOCALS), 1862, 11};
    PyObject* const varnames[] = {__pyx_mstate->__pyx_n_u_self};
    __pyx_mstate_global->__pyx_codeobj_tab[120] = __Pyx_PyCode_New(descr, varnames, __pyx_mstate->__pyx_kp_u_pysam_libcbcf_pyx, __pyx_mstate->__pyx_n_u_keys, __pyx_k_A_t1A, tuple_dedup_map); if (unlikely(!__pyx_mstate_global->__pyx_codeobj_tab[120])) goto bad;
  }
  {
    const __Pyx_PyCode_New_function_description descr = {1, 0, 0, 1, (unsigned int)(CO_OPTIMIZED|CO_NEWLOCALS), 1866, 15};
    PyObject* const varnames[] = {__pyx_mstate->__pyx_n_u_self};
    __pyx_mstate_global->__pyx_codeobj_tab[121] = __Pyx_PyCode_New(descr, varnames, __pyx_mstate->__pyx_kp_u_pysam_libcbcf_pyx, __pyx_mstate->__pyx_n_u_items, __pyx_k_A_t1D, tuple_dedup_map); if (unlikely(!__pyx_mstate_global->__pyx_codeobj_tab[121])) goto bad;
  }
  {
    const __Pyx_PyCode_New_function_description descr = {1, 0, 0, 1, (unsigned int)(CO_OPTIMIZED|CO_NEWLOCALS), 1870, 15};
    PyObject* const varnames[] = {__pyx_mstate->__pyx_n_u_self};
    __pyx_mstate_global->__pyx_codeobj_tab[122] = __Pyx_PyCode_New(descr, varnames, __pyx_mstate->__pyx_kp_u_pysam_libcbcf_pyx, __pyx_mstate->__pyx_n_u_values, __pyx_k_A_t1D_1, tuple_dedup_map); if (unlikely(!__pyx_mstate_global->__pyx_codeobj_tab[122])) goto bad;
  }
  {
    const __Pyx_PyCode_New_function_description descr = {3, 0, 0, 5, (unsigned int)(CO_OPTIMIZED|CO_NEWLOCALS|CO_VARKEYWORDS), 1879, 91};
    PyObject* const varnames[] = {__pyx_mstate->__pyx_n_u_self, __pyx_mstate->__pyx_n_u_id, __pyx_mstate->__pyx_n_u_length, __pyx_mstate->__pyx_n_u_kwargs, __pyx_mstate->__pyx_n_u_items};
    __pyx_mstate_global->__pyx_codeobj_tab[123] = __Pyx_PyCode_New(descr, varnames, __pyx_mstate->__pyx_kp_u_pysam_libcbcf_pyx, __pyx_mstate->__pyx_n_u_add, __pyx_k_Q_3c_A_B_AQ_7_L_vQ_G9AZvQ, tuple_dedup_map); if (unlikely(!__pyx_mstate_global->__pyx_codeobj_tab[123])) goto bad;
  }
  {
    const __Pyx_PyCode_New_function_description descr = {1, 0, 0, 1, (unsigned int)(CO_OPTIMIZED|CO_NEWLOCALS), 57, 2};
    PyObject* const varnames[] = {__pyx_mstate->__pyx_n_u_self};
    __pyx_mstate_global->__pyx_codeobj_tab[124] = __Pyx_PyCode_New(descr, varnames, __pyx_mstate->__pyx_kp_u_pysam_libcbcf_pxd, __pyx_mstate->__pyx_n_u_get_2, __pyx_k__14, tuple_dedup_map); if (unlikely(!__pyx_mstate_global->__pyx_codeobj_tab[124])) goto bad;
  }
  {
    const __Pyx_PyCode_New_function_description descr = {1, 0, 0, 4, (unsigned int)(CO_OPTIMIZED|CO_NEWLOCALS), 1, 94};
    PyObject* const varnames[] = {__pyx_mstate->__pyx_n_u_self, __pyx_mstate->__pyx_n_u_state, __pyx_mstate->__pyx_n_u_dict_2, __pyx_mstate->__pyx_n_u_use_setstate};
    __pyx_mstate_global->__pyx_codeobj_tab[125] = __Pyx_PyCode_New(descr, varnames, __pyx_mstate->__pyx_kp_u_stringsource, __pyx_mstate->__pyx_n_u_reduce_cython, __pyx_k_T_G1F_a_vWA_q_t87_q_5T_GST_5T_A, tuple_dedup_map); if (unlikely(!__pyx_mstate_global->__pyx_codeobj_tab[125])) goto bad;
  }
  {
    const __Pyx_PyCode_New_function_description descr = {2, 0, 0, 2, (unsigned int)(CO_OPTIMIZED|CO_NEWLOCALS), 16, 11};
    PyObject* const varnames[] = {__pyx_mstate->__pyx_n_u_self, __pyx_mstate->__pyx_n_u_pyx_state};
    __pyx_mstate_global->__pyx_codeobj_tab[126] = __Pyx_PyCode_New(descr, varnames, __pyx_mstate->__pyx_kp_u_stringsource, __pyx_mstate->__pyx_n_u_setstate_cython, __pyx_k_2_6, tuple_dedup_map); if (unlikely(!__pyx_mstate_global->__pyx_codeobj_tab[126])) goto bad;
  }
  {
    const __Pyx_PyCode_New_function_description descr = {1, 0, 0, 7, (unsigned int)(CO_OPTIMIZED|CO_NEWLOCALS), 1891, 42};
    PyObject* const varnames[] = {__pyx_mstate->__pyx_n_u_header, __pyx_mstate->__pyx_n_u_MAX_POS, __pyx_mstate->__pyx_n_u_VALUE_TYPES, __pyx_mstate->__pyx_n_u_METADATA_TYPES, __pyx_mstate->__pyx_n_u_METADATA_LENGTHS, __pyx_mstate->__pyx_n_u_nothing, __pyx_mstate->__pyx_n_u_bcf_str_cache};
    __pyx_mstate_global->__pyx_codeobj_tab[127] = __Pyx_PyCode_New(descr, varnames, __pyx_mstate->__pyx_kp_u_pysam_libcbcf_pyx, __pyx_mstate->__pyx_n_u_makeVariantHeaderContigs, __pyx_k_t1_j_HAQ_Q_1_2, tuple_dedup_map); if (unlikely(!__pyx_mstate_global->__pyx_codeobj_tab[127])) goto bad;
  }
  {
    const __Pyx_PyCode_New_function_description descr = {1, 0, 0, 3, (unsigned int)(CO_OPTIMIZED|CO_NEWLOCALS|CO_VARARGS|CO_VARKEYWORDS), 1903, 11};
    PyObject* const varnames[] = {__pyx_mstate->__pyx_n_u_self, __pyx_mstate->__pyx_n_u_args, __pyx_mstate->__pyx_n_u_kwargs};
    __pyx_mstate_global->__pyx_codeobj_tab[128] = __Pyx_PyCode_New(descr, varnames, __pyx_mstate->__pyx_kp_u_pysam_libcbcf_pyx, __pyx_mstate->__pyx_n_u_init, __pyx_k_A_iq, tuple_dedup_map); if (unlikely(!__pyx_mstate_global->__pyx_codeobj_tab[128])) goto bad;
  }
  {
    const __Pyx_PyCode_New_function_description descr = {1, 0, 0, 1, (unsigned int)(CO_OPTIMIZED|CO_NEWLOCALS), 1906, 16};
    PyObject* const varnames[] = {__pyx_mstate->__pyx_n_u_self};
    __pyx_mstate_global->__pyx_codeobj_tab[129] = __Pyx_PyCode_New(descr, varnames, __pyx_mstate->__pyx_kp_u_pysam_libcbcf_pyx, __pyx_mstate->__pyx_n_u_len, __pyx_k_A_q_G1, tuple_dedup_map); if (unlikely(!__pyx_mstate_global->__pyx_codeobj_tab[129])) goto bad;
  }
  {
    const __Pyx_PyCode_New_function_description descr = {1, 0, 0, 1, (unsigned int)(CO_OPTIMIZED|CO_NEWLOCALS), 1909, 20};
    PyObject* const varnames[] = {__pyx_mstate->__pyx_n_u_self};
    __pyx_mstate_global->__pyx_codeobj_tab[130] = __Pyx_PyCode_New(descr, varnames, __pyx_mstate->__pyx_kp_u_pysam_libcbcf_pyx, __pyx_mstate->__pyx_n_u_bool, __pyx_k_A_q_G6_A, tuple_dedup_map); if (unlikely(!__pyx_mstate_global->__pyx_codeobj_tab[130])) goto bad;
  }
  {
    const __Pyx_PyCode_New_function_description descr = {2, 0, 0, 5, (unsigned int)(CO_OPTIMIZED|CO_NEWLOCALS), 1912, 67};
    PyObject* const varnames[] = {__pyx_mstate->__pyx_n_u_self, __pyx_mstate->__pyx_n_u_index, __pyx_mstate->__pyx_n_u_hdr, __pyx_mstate->__pyx_n_u_n, __pyx_mstate->__pyx_n_u_i};
    __pyx_mstate_global->__pyx_codeobj_tab[131] = __Pyx_PyCode_New(descr, varnames, __pyx_mstate->__pyx_kp_u_pysam_libcbcf_pyx, __pyx_mstate->__pyx_n_u_getitem, __pyx_k_A_d_2Rr_Bc_AQ_Qc, tuple_dedup_map); if (unlikely(!__pyx_mstate_global->__pyx_codeobj_tab[131])) goto bad;
  }
  {
    const __Pyx_PyCode_New_function_description descr = {1, 0, 0, 4, (unsigned int)(CO_OPTIMIZED|CO_NEWLOCALS|CO_GENERATOR), 1922, 2};
    PyObject* const varnames[] = {__pyx_mstate->__pyx_n_u_self, __pyx_mstate->__pyx_n_u_hdr, __pyx_mstate->__pyx_n_u_i, __pyx_mstate->__pyx_n_u_n};
    __pyx_mstate_global->__pyx_codeobj_tab[132] = __Pyx_PyCode_New(descr, varnames, __pyx_mstate->__pyx_kp_u_pysam_libcbcf_pyx, __pyx_mstate->__pyx_n_u_iter, __pyx_k_A_3, tuple_dedup_map); if (unlikely(!__pyx_mstate_global->__pyx_codeobj_tab[132])) goto bad;
  }
  {
    const __Pyx_PyCode_New_function_description descr = {2, 0, 0, 6, (unsigned int)(CO_OPTIMIZED|CO_NEWLOCALS), 1929, 57};
    PyObject* const varnames[] = {__pyx_mstate->__pyx_n_u_self, __pyx_mstate->__pyx_n_u_key, __pyx_mstate->__pyx_n_u_hdr, __pyx_mstate->__pyx_n_u_d, __pyx_mstate->__pyx_n_u_bkey, __pyx_mstate->__pyx_n_u_k};
    __pyx_mstate_global->__pyx_codeobj_tab[133] = __Pyx_PyCode_New(descr, varnames, __pyx_mstate->__pyx_kp_u_pysam_libcbcf_pyx, __pyx_mstate->__pyx_n_u_contains, __pyx_k_A_d_S_Qa_Qa_as_r_F_1, tuple_dedup_map); if (unlikely(!__pyx_mstate_global->__pyx_codeobj_tab[133])) goto bad;
  }
  {
    const __Pyx_PyCode_New_function_description descr = {2, 0, 0, 2, (unsigned int)(CO_OPTIMIZED|CO_NEWLOCALS), 1942, 13};
    PyObject* const varnames[] = {__pyx_mstate->__pyx_n_u_self, __pyx_mstate->__pyx_n_u_name};
    __pyx_mstate_global->__pyx_codeobj_tab[134] = __Pyx_PyCode_New(descr, varnames, __pyx_mstate->__pyx_kp_u_pysam_libcbcf_pyx, __pyx_mstate->__pyx_n_u_add, __pyx_k_A_G_aq, tuple_dedup_map); if (unlikely(!__pyx_mstate_global->__pyx_codeobj_tab[134])) goto bad;
  }
  {
    const __Pyx_PyCode_New_function_description descr = {1, 0, 0, 1, (unsigned int)(CO_OPTIMIZED|CO_NEWLOCALS), 61, 2};
    PyObject* const varnames[] = {__pyx_mstate->__pyx_n_u_self};
    __pyx_mstate_global->__pyx_codeobj_tab[135] = __Pyx_PyCode_New(descr, varnames, __pyx_mstate->__pyx_kp_u_pysam_libcbcf_pxd, __pyx_mstate->__pyx_n_u_get_2, __pyx_k__14, tuple_dedup_map); if (unlikely(!__pyx_mstate_global->__pyx_codeobj_tab[135])) goto bad;
  }
  {
    const __Pyx_PyCode_New_function_description descr = {1, 0, 0, 4, (unsigned int)(CO_OPTIMIZED|CO_NEWLOCALS), 1, 94};
    PyObject* const varnames[] = {__pyx_mstate->__pyx_n_u_self, __pyx_mstate->__pyx_n_u_state, __pyx_mstate->__pyx_n_u_dict_2, __pyx_mstate->__pyx_n_u_use_setstate};
    __pyx_mstate_global->__pyx_codeobj_tab[136] = __Pyx_PyCode_New(descr, varnames, __pyx_mstate->__pyx_kp_u_stringsource, __pyx_mstate->__pyx_n_u_reduce_cython, __pyx_k_T_G1F_a_vWA_q_t87_q_5T_GST_5T_A, tuple_dedup_map); if (unlikely(!__pyx_mstate_global->__pyx_codeobj_tab[136])) goto bad;
  }
  {
    const __Pyx_PyCode_New_function_description descr = {2, 0, 0, 2, (unsigned int)(CO_OPTIMIZED|CO_NEWLOCALS), 16, 11};
    PyObject* const varnames[] = {__pyx_mstate->__pyx_n_u_self, __pyx_mstate->__pyx_n_u_pyx_state};
    __pyx_mstate_global->__pyx_codeobj_tab[137] = __Pyx_PyCode_New(descr, varnames, __pyx_mstate->__pyx_kp_u_stringsource, __pyx_mstate->__pyx_n_u_setstate_cython, __pyx_k_2_6, tuple_dedup_map); if (unlikely(!__pyx_mstate_global->__pyx_codeobj_tab[137])) goto bad;
  }
  {
    const __Pyx_PyCode_New_function_description descr = {1, 0, 0, 7, (unsigned int)(CO_OPTIMIZED|CO_NEWLOCALS), 1947, 42};
    PyObject* const varnames[] = {__pyx_mstate->__pyx_n_u_header, __pyx_mstate->__pyx_n_u_MAX_POS, __pyx_mstate->__pyx_n_u_VALUE_TYPES, __pyx_mstate->__pyx_n_u_METADATA_TYPES, __pyx_mstate->__pyx_n_u_METADATA_LENGTHS, __pyx_mstate->__pyx_n_u_nothing, __pyx_mstate->__pyx_n_u_bcf_str_cache};
    __pyx_mstate_global->__pyx_codeobj_tab[138] = __Pyx_PyCode_New(descr, varnames, __pyx_mstate->__pyx_kp_u_pysam_libcbcf_pyx, __pyx_mstate->__pyx_n_u_makeVariantHeaderSamples, __pyx_k_t1_j_HAQ_Q_1_2, tuple_dedup_map); if (unlikely(!__pyx_mstate_global->__pyx_codeobj_tab[138])) goto bad;
  }
  {
    const __Pyx_PyCode_New_function_description descr = {1, 0, 0, 1, (unsigned int)(CO_OPTIMIZED|CO_NEWLOCALS), 1964, 9};
    PyObject* const varnames[] = {__pyx_mstate->__pyx_n_u_self};
    __pyx_mstate_global->__pyx_codeobj_tab[139] = __Pyx_PyCode_New(descr, varnames, __pyx_mstate->__pyx_kp_u_pysam_libcbcf_pyx, __pyx_mstate->__pyx_n_u_cinit, __pyx_k_A_G1, tuple_dedup_map); if (unlikely(!__pyx_mstate_global->__pyx_codeobj_tab[139])) goto bad;
  }
  {
    const __Pyx_PyCode_New_function_description descr = {1, 0, 0, 1, (unsigned int)(CO_OPTIMIZED|CO_NEWLOCALS), 1968, 31};
    PyObject* const varnames[] = {__pyx_mstate->__pyx_n_u_self};
    __pyx_mstate_global->__pyx_codeobj_tab[140] = __Pyx_PyCode_New(descr, varnames, __pyx_mstate->__pyx_kp_u_pysam_libcbcf_pyx, __pyx_mstate->__pyx_n_u_init, __pyx_k_A_G_q_4t1_AQ, tuple_dedup_map); if (unlikely(!__pyx_mstate_global->__pyx_codeobj_tab[140])) goto bad;
  }
  {
    const __Pyx_PyCode_New_function_description descr = {1, 0, 0, 1, (unsigned int)(CO_OPTIMIZED|CO_NEWLOCALS), 1973, 25};
    PyObject* const varnames[] = {__pyx_mstate->__pyx_n_u_self};
    __pyx_mstate_global->__pyx_codeobj_tab[141] = __Pyx_PyCode_New(descr, varnames, __pyx_mstate->__pyx_kp_u_pysam_libcbcf_pyx, __pyx_mstate->__pyx_n_u_dealloc, __pyx_k_A_4q_1D_q, tuple_dedup_map); if (unlikely(!__pyx_mstate_global->__pyx_codeobj_tab[141])) goto bad;
  }
  {
    const __Pyx_PyCode_New_function_description descr = {1, 0, 0, 1, (unsigned int)(CO_OPTIMIZED|CO_NEWLOCALS), 1978, 13};
    PyObject* const varnames[] = {__pyx_mstate->__pyx_n_u_self};
    __pyx_mstate_global->__pyx_codeobj_tab[142] = __Pyx_PyCode_New(descr, varnames, __pyx_mstate->__pyx_kp_u_pysam_libcbcf_pyx, __pyx_mstate->__pyx_n_u_bool, __pyx_k_A_t5_1, tuple_dedup_map); if (unlikely(!__pyx_mstate_global->__pyx_codeobj_tab[142])) goto bad;
  }
  {
    const __Pyx_PyCode_New_function_description descr = {1, 0, 0, 1, (unsigned int)(CO_OPTIMIZED|CO_NEWLOCALS), 1981, 18};
    PyObject* const varnames[] = {__pyx_mstate->__pyx_n_u_self};
    __pyx_mstate_global->__pyx_codeobj_tab[143] = __Pyx_PyCode_New(descr, varnames, __pyx_mstate->__pyx_kp_u_pysam_libcbcf_pyx, __pyx_mstate->__pyx_n_u_copy, __pyx_k_A_AT, tuple_dedup_map); if (unlikely(!__pyx_mstate_global->__pyx_codeobj_tab[143])) goto bad;
  }
  {
    const __Pyx_PyCode_New_function_description descr = {2, 0, 0, 2, (unsigned int)(CO_OPTIMIZED|CO_NEWLOCALS), 1984, 33};
    PyObject* const varnames[] = {__pyx_mstate->__pyx_n_u_self, __pyx_mstate->__pyx_n_u_header};
    __pyx_mstate_global->__pyx_codeobj_tab[144] = __Pyx_PyCode_New(descr, varnames, __pyx_mstate->__pyx_kp_u_pysam_libcbcf_pyx, __pyx_mstate->__pyx_n_u_merge, __pyx_k_A_7_Q_AQ_Qd_a, tuple_dedup_map); if (unlikely(!__pyx_mstate_global->__pyx_codeobj_tab[144])) goto bad;
  }
  {
    const __Pyx_PyCode_New_function_description descr = {1, 0, 0, 1, (unsigned int)(CO_OPTIMIZED|CO_NEWLOCALS), 1989, 20};
    PyObject* const varnames[] = {__pyx_mstate->__pyx_n_u_self};
    __pyx_mstate_global->__pyx_codeobj_tab[145] = __Pyx_PyCode_New(descr, varnames, __pyx_mstate->__pyx_kp_u_pysam_libcbcf_pyx, __pyx_mstate->__pyx_n_u_get_2, __pyx_k_A_y_AT, tuple_dedup_map); if (unlikely(!__pyx_mstate_global->__pyx_codeobj_tab[145])) goto bad;
  }
  {
    const __Pyx_PyCode_New_function_description descr = {1, 0, 0, 1, (unsigned int)(CO_OPTIMIZED|CO_NEWLOCALS), 1994, 14};
    PyObject* const varnames[] = {__pyx_mstate->__pyx_n_u_self};
    __pyx_mstate_global->__pyx_codeobj_tab[146] = __Pyx_PyCode_New(descr, varnames, __pyx_mstate->__pyx_kp_u_pysam_libcbcf_pyx, __pyx_mstate->__pyx_n_u_get_2, __pyx_k_A_q, tuple_dedup_map); if (unlikely(!__pyx_mstate_global->__pyx_codeobj_tab[146])) goto bad;
  }
  {
    const __Pyx_PyCode_New_function_description descr = {1, 0, 0, 1, (unsigned int)(CO_OPTIMIZED|CO_NEWLOCALS), 1999, 14};
    PyObject* const varnames[] = {__pyx_mstate->__pyx_n_u_self};
    __pyx_mstate_global->__pyx_codeobj_tab[147] = __Pyx_PyCode_New(descr, varnames, __pyx_mstate->__pyx_kp_u_pysam_libcbcf_pyx, __pyx_mstate->__pyx_n_u_get_2, __pyx_k_A_q, tuple_dedup_map); if (unlikely(!__pyx_mstate_global->__pyx_codeobj_tab[147])) goto bad;
  }
  {
    const __Pyx_PyCode_New_function_description descr = {1, 0, 0, 1, (unsigned int)(CO_OPTIMIZED|CO_NEWLOCALS), 2004, 14};
    PyObject* const varnames[] = {__pyx_mstate->__pyx_n_u_self};
    __pyx_mstate_global->__pyx_codeobj_tab[148] = __Pyx_PyCode_New(descr, varnames, __pyx_mstate->__pyx_kp_u_pysam_libcbcf_pyx, __pyx_mstate->__pyx_n_u_get_2, __pyx_k_A_q, tuple_dedup_map); if (unlikely(!__pyx_mstate_global->__pyx_codeobj_tab[148])) goto bad;
  }
  {
    const __Pyx_PyCode_New_function_description descr = {1, 0, 0, 1, (unsigned int)(CO_OPTIMIZED|CO_NEWLOCALS), 2009, 16};
    PyObject* const varnames[] = {__pyx_mstate->__pyx_n_u_self};
    __pyx_mstate_global->__pyx_codeobj_tab[149] = __Pyx_PyCode_New(descr, varnames, __pyx_mstate->__pyx_kp_u_pysam_libcbcf_pyx, __pyx_mstate->__pyx_n_u_get_2, __pyx_k_A_q_2, tuple_dedup_map); if (unlikely(!__pyx_mstate_global->__pyx_codeobj_tab[149])) goto bad;
  }
  {
    const __Pyx_PyCode_New_function_description descr = {1, 0, 0, 1, (unsigned int)(CO_OPTIMIZED|CO_NEWLOCALS), 2014, 16};
    PyObject* const varnames[] = {__pyx_mstate->__pyx_n_u_self};
    __pyx_mstate_global->__pyx_codeobj_tab[150] = __Pyx_PyCode_New(descr, varnames, __pyx_mstate->__pyx_kp_u_pysam_libcbcf_pyx, __pyx_mstate->__pyx_n_u_get_2, __pyx_k_A_q_2, tuple_dedup_map); if (unlikely(!__pyx_mstate_global->__pyx_codeobj_tab[150])) goto bad;
  }
  {
    const __Pyx_PyCode_New_function_description descr = {1, 0, 0, 1, (unsigned int)(CO_OPTIMIZED|CO_NEWLOCALS), 2019, 16};
    PyObject* const varnames[] = {__pyx_mstate->__pyx_n_u_self};
    __pyx_mstate_global->__pyx_codeobj_tab[151] = __Pyx_PyCode_New(descr, varnames, __pyx_mstate->__pyx_kp_u_pysam_libcbcf_pyx, __pyx_mstate->__pyx_n_u_get_2, __pyx_k_A_q_2, tuple_dedup_map); if (unlikely(!__pyx_mstate_global->__pyx_codeobj_tab[151])) goto bad;
  }
  {
    const __Pyx_PyCode_New_function_description descr = {1, 0, 0, 2, (unsigned int)(CO_OPTIMIZED|CO_NEWLOCALS), 2024, 40};
    PyObject* const varnames[] = {__pyx_mstate->__pyx_n_u_self, __pyx_mstate->__pyx_n_u_record};
    __pyx_mstate_global->__pyx_codeobj_tab[152] = __Pyx_PyCode_New(descr, varnames, __pyx_mstate->__pyx_kp_u_pysam_libcbcf_pyx, __pyx_mstate->__pyx_n_u_get_2, __pyx_k_A_q_avWD_a_6_V3c, tuple_dedup_map); if (unlikely(!__pyx_mstate_global->__pyx_codeobj_tab[152])) goto bad;
  }
  {
    const __Pyx_PyCode_New_function_description descr = {2, 0, 0, 3, (unsigned int)(CO_OPTIMIZED|CO_NEWLOCALS), 2039, 132};
    PyObject* const varnames[] = {__pyx_mstate->__pyx_n_u_self, __pyx_mstate->__pyx_n_u_include_samples, __pyx_mstate->__pyx_n_u_ptr};
    __pyx_mstate_global->__pyx_codeobj_tab[153] = __Pyx_PyCode_New(descr, varnames, __pyx_mstate->__pyx_kp_u_pysam_libcbcf_pyx, __pyx_mstate->__pyx_n_u_subset_samples_2, __pyx_k_A_Qd_Qa_A_1_A_0_q_q_3e1A_22DA_at, tuple_dedup_map); if (unlikely(!__pyx_mstate_global->__pyx_codeobj_tab[153])) goto bad;
  }
  {
    const __Pyx_PyCode_New_function_description descr = {1, 0, 0, 4, (unsigned int)(CO_OPTIMIZED|CO_NEWLOCALS), 2059, 105};
    PyObject* const varnames[] = {__pyx_mstate->__pyx_n_u_self, __pyx_mstate->__pyx_n_u_hlen, __pyx_mstate->__pyx_n_u_line, __pyx_mstate->__pyx_n_u_ret};
    __pyx_mstate_global->__pyx_codeobj_tab[154] = __Pyx_PyCode_New(descr, varnames, __pyx_mstate->__pyx_kp_u_pysam_libcbcf_pyx, __pyx_mstate->__pyx_n_u_str, __pyx_k_A_E_U_E_fCq_b_t1_AT_AQ_4t4q_4q_Q, tuple_dedup_map); if (unlikely(!__pyx_mstate_global->__pyx_codeobj_tab[154])) goto bad;
  }
  {
    const __Pyx_PyCode_New_function_description descr = {10, 0, 0, 15, (unsigned int)(CO_OPTIMIZED|CO_NEWLOCALS|CO_VARKEYWORDS), 2076, 257};
    PyObject* const varnames[] = {__pyx_mstate->__pyx_n_u_self, __pyx_mstate->__pyx_n_u_contig, __pyx_mstate->__pyx_n_u_start, __pyx_mstate->__pyx_n_u_stop, __pyx_mstate->__pyx_n_u_alleles, __pyx_mstate->__pyx_n_u_id, __pyx_mstate->__pyx_n_u_qual, __pyx_mstate->__pyx_n_u_filter, __pyx_mstate->__pyx_n_u_info, __pyx_mstate->__pyx_n_u_samples, __pyx_mstate->__pyx_n_u_kwargs, __pyx_mstate->__pyx_n_u_rec, __pyx_mstate->__pyx_n_u_f, __pyx_mstate->__pyx_n_u_i, __pyx_mstate->__pyx_n_u_sample};
    __pyx_mstate_global->__pyx_codeobj_tab[155] = __Pyx_PyCode_New(descr, varnames, __pyx_mstate->__pyx_kp_u_pysam_libcbcf_pyx, __pyx_mstate->__pyx_n_u_new_record, __pyx_k_HKq_K_Q_q_ha_4q_Qa_4_1D_7_9A_9A, tuple_dedup_map); if (unlikely(!__pyx_mstate_global->__pyx_codeobj_tab[155])) goto bad;
  }
  {
    const __Pyx_PyCode_New_function_description descr = {2, 0, 0, 3, (unsigned int)(CO_OPTIMIZED|CO_NEWLOCALS), 2122, 49};
    PyObject* const varnames[] = {__pyx_mstate->__pyx_n_u_self, __pyx_mstate->__pyx_n_u_record, __pyx_mstate->__pyx_n_u_hrec};
    __pyx_mstate_global->__pyx_codeobj_tab[156] = __Pyx_PyCode_New(descr, varnames, __pyx_mstate->__pyx_kp_u_pysam_libcbcf_pyx, __pyx_mstate->__pyx_n_u_add_record, __pyx_k_A_7_Q_AQ_AV1_V1_Ja, tuple_dedup_map); if (unlikely(!__pyx_mstate_global->__pyx_codeobj_tab[156])) goto bad;
  }
  {
    const __Pyx_PyCode_New_function_description descr = {2, 0, 0, 3, (unsigned int)(CO_OPTIMIZED|CO_NEWLOCALS), 2133, 44};
    PyObject* const varnames[] = {__pyx_mstate->__pyx_n_u_self, __pyx_mstate->__pyx_n_u_line, __pyx_mstate->__pyx_n_u_bline};
    __pyx_mstate_global->__pyx_codeobj_tab[157] = __Pyx_PyCode_New(descr, varnames, __pyx_mstate->__pyx_kp_u_pysam_libcbcf_pyx, __pyx_mstate->__pyx_n_u_add_line, __pyx_k_A_1A_fG2Q_AQ_Ja, tuple_dedup_map); if (unlikely(!__pyx_mstate_global->__pyx_codeobj_tab[157])) goto bad;
  }
  {
    const __Pyx_PyCode_New_function_description descr = {4, 0, 0, 6, (unsigned int)(CO_OPTIMIZED|CO_NEWLOCALS), 2142, 263};
    PyObject* const varnames[] = {__pyx_mstate->__pyx_n_u_self, __pyx_mstate->__pyx_n_u_key, __pyx_mstate->__pyx_n_u_value, __pyx_mstate->__pyx_n_u_items, __pyx_mstate->__pyx_n_u_hrec, __pyx_mstate->__pyx_n_u_quoted};
    __pyx_mstate_global->__pyx_codeobj_tab[158] = __Pyx_PyCode_New(descr, varnames, __pyx_mstate->__pyx_kp_u_pysam_libcbcf_pyx, __pyx_mstate->__pyx_n_u_add_meta, __pyx_k_a_6_wfCvWA_AQ_V1Cq_Qa_vQa_vWA_I, tuple_dedup_map); if (unlikely(!__pyx_mstate_global->__pyx_codeobj_tab[158])) goto bad;
  }
  {
    const __Pyx_PyCode_New_function_description descr = {2, 0, 0, 3, (unsigned int)(CO_OPTIMIZED|CO_NEWLOCALS), 2175, 45};
    PyObject* const varnames[] = {__pyx_mstate->__pyx_n_u_self, __pyx_mstate->__pyx_n_u_name, __pyx_mstate->__pyx_n_u_ptr};
    __pyx_mstate_global->__pyx_codeobj_tab[159] = __Pyx_PyCode_New(descr, varnames, __pyx_mstate->__pyx_kp_u_pysam_libcbcf_pyx, __pyx_mstate->__pyx_n_u_add_sample_2, __pyx_k_A_1A_Qd_r_A_9, tuple_dedup_map); if (unlikely(!__pyx_mstate_global->__pyx_codeobj_tab[159])) goto bad;
  }
  {
    const __Pyx_PyCode_New_function_description descr = {1, 0, 0, 2, (unsigned int)(CO_OPTIMIZED|CO_NEWLOCALS), 2180, 38};
    PyObject* const varnames[] = {__pyx_mstate->__pyx_n_u_self, __pyx_mstate->__pyx_n_u_ptr};
    __pyx_mstate_global->__pyx_codeobj_tab[160] = __Pyx_PyCode_New(descr, varnames, __pyx_mstate->__pyx_kp_u_pysam_libcbcf_pyx, __pyx_mstate->__pyx_n_u_hdr_sync, __pyx_k_A_d_3a_1E_1_k, tuple_dedup_map); if (unlikely(!__pyx_mstate_global->__pyx_codeobj_tab[160])) goto bad;
  }
  {
    const __Pyx_PyCode_New_function_description descr = {2, 0, 0, 2, (unsigned int)(CO_OPTIMIZED|CO_NEWLOCALS), 2186, 18};
    PyObject* const varnames[] = {__pyx_mstate->__pyx_n_u_self, __pyx_mstate->__pyx_n_u_name};
    __pyx_mstate_global->__pyx_codeobj_tab[161] = __Pyx_PyCode_New(descr, varnames, __pyx_mstate->__pyx_kp_u_pysam_libcbcf_pyx, __pyx_mstate->__pyx_n_u_add_sample, __pyx_k_A_L_Ja, tuple_dedup_map); if (unlikely(!__pyx_mstate_global->__pyx_codeobj_tab[161])) goto bad;
  }
  {
    const __Pyx_PyCode_New_function_description descr = {1, 0, 0, 4, (unsigned int)(CO_OPTIMIZED|CO_NEWLOCALS|CO_VARARGS), 2191, 54};
    PyObject* const varnames[] = {__pyx_mstate->__pyx_n_u_self, __pyx_mstate->__pyx_n_u_args, __pyx_mstate->__pyx_n_u_arg, __pyx_mstate->__pyx_n_u_name};
    __pyx_mstate_global->__pyx_codeobj_tab[162] = __Pyx_PyCode_New(descr, varnames, __pyx_mstate->__pyx_kp_u_pysam_libcbcf_pyx, __pyx_mstate->__pyx_n_u_add_samples, __pyx_k_A_G1_z_q_L_HA_AQ_Ja, tuple_dedup_map); if (unlikely(!__pyx_mstate_global->__pyx_codeobj_tab[162])) goto bad;
  }
  {
    const __Pyx_PyCode_New_function_description descr = {1, 0, 0, 1, (unsigned int)(CO_OPTIMIZED|CO_NEWLOCALS), 1, 9};
    PyObject* const varnames[] = {__pyx_mstate->__pyx_n_u_self};
    __pyx_mstate_global->__pyx_codeobj_tab[163] = __Pyx_PyCode_New(descr, varnames, __pyx_mstate->__pyx_kp_u_stringsource, __pyx_mstate->__pyx_n_u_reduce_cython, __pyx_k_Q, tuple_dedup_map); if (unlikely(!__pyx_mstate_global->__pyx_codeobj_tab[163])) goto bad;
  }
  {
    const __Pyx_PyCode_New_function_description descr = {2, 0, 0, 2, (unsigned int)(CO_OPTIMIZED|CO_NEWLOCALS), 3, 9};
    PyObject* const varnames[] = {__pyx_mstate->__pyx_n_u_self, __pyx_mstate->__pyx_n_u_pyx_state};
    __pyx_mstate_global->__pyx_codeobj_tab[164] = __Pyx_PyCode_New(descr, varnames, __pyx_mstate->__pyx_kp_u_stringsource, __pyx_mstate->__pyx_n_u_setstate_cython, __pyx_k_Q, tuple_dedup_map); if (unlikely(!__pyx_mstate_global->__pyx_codeobj_tab[164])) goto bad;
  }
  {
    const __Pyx_PyCode_New_function_description descr = {1, 0, 0, 7, (unsigned int)(CO_OPTIMIZED|CO_NEWLOCALS), 2206, 41};
    PyObject* const varnames[] = {__pyx_mstate->__pyx_n_u_hdr, __pyx_mstate->__pyx_n_u_MAX_POS, __pyx_mstate->__pyx_n_u_VALUE_TYPES, __pyx_mstate->__pyx_n_u_METADATA_TYPES, __pyx_mstate->__pyx_n_u_METADATA_LENGTHS, __pyx_mstate->__pyx_n_u_nothing, __pyx_mstate->__pyx_n_u_bcf_str_cache};
    __pyx_mstate_global->__pyx_codeobj_tab[165] = __Pyx_PyCode_New(descr, varnames, __pyx_mstate->__pyx_kp_u_pysam_libcbcf_pyx, __pyx_mstate->__pyx_n_u_makeVariantHeader, __pyx_k_t1_j_XQa_1, tuple_dedup_map); if (unlikely(!__pyx_mstate_global->__pyx_codeobj_tab[165])) goto bad;
  }
  {
    const __Pyx_PyCode_New_function_description descr = {2, 0, 0, 8, (unsigned int)(CO_OPTIMIZED|CO_NEWLOCALS), 2216, 106};
    PyObject* const varnames[] = {__pyx_mstate->__pyx_n_u_hdr, __pyx_mstate->__pyx_n_u_key, __pyx_mstate->__pyx_n_u_MAX_POS, __pyx_mstate->__pyx_n_u_VALUE_TYPES, __pyx_mstate->__pyx_n_u_METADATA_TYPES, __pyx_mstate->__pyx_n_u_METADATA_LENGTHS, __pyx_mstate->__pyx_n_u_nothing, __pyx_mstate->__pyx_n_u_bcf_str_cache};
    __pyx_mstate_global->__pyx_codeobj_tab[166] = __Pyx_PyCode_New(descr, varnames, __pyx_mstate->__pyx_kp_u_pysam_libcbcf_pyx, __pyx_mstate->__pyx_n_u_bcf_header_get_info_id, __pyx_k_EQ_z_q_k_3e1A_AS_r_F_3c_Qc_5_b, tuple_dedup_map); if (unlikely(!__pyx_mstate_global->__pyx_codeobj_tab[166])) goto bad;
  }
  {
    const __Pyx_PyCode_New_function_description descr = {1, 0, 0, 3, (unsigned int)(CO_OPTIMIZED|CO_NEWLOCALS|CO_VARARGS|CO_VARKEYWORDS), 2241, 11};
    PyObject* const varnames[] = {__pyx_mstate->__pyx_n_u_self, __pyx_mstate->__pyx_n_u_args, __pyx_mstate->__pyx_n_u_kwargs};
    __pyx_mstate_global->__pyx_codeobj_tab[167] = __Pyx_PyCode_New(descr, varnames, __pyx_mstate->__pyx_kp_u_pysam_libcbcf_pyx, __pyx_mstate->__pyx_n_u_init, __pyx_k_A_iq, tuple_dedup_map); if (unlikely(!__pyx_mstate_global->__pyx_codeobj_tab[167])) goto bad;
  }
  {
    const __Pyx_PyCode_New_function_description descr = {1, 0, 0, 1, (unsigned int)(CO_OPTIMIZED|CO_NEWLOCALS), 2244, 15};
    PyObject* const varnames[] = {__pyx_mstate->__pyx_n_u_self};
    __pyx_mstate_global->__pyx_codeobj_tab[168] = __Pyx_PyCode_New(descr, varnames, __pyx_mstate->__pyx_kp_u_pysam_libcbcf_pyx, __pyx_mstate->__pyx_n_u_len, __pyx_k_A_t7_b, tuple_dedup_map); if (unlikely(!__pyx_mstate_global->__pyx_codeobj_tab[168])) goto bad;
  }
  {
    const __Pyx_PyCode_New_function_description descr = {1, 0, 0, 1, (unsigned int)(CO_OPTIMIZED|CO_NEWLOCALS), 2247, 19};
    PyObject* const varnames[] = {__pyx_mstate->__pyx_n_u_self};
    __pyx_mstate_global->__pyx_codeobj_tab[169] = __Pyx_PyCode_New(descr, varnames, __pyx_mstate->__pyx_kp_u_pysam_libcbcf_pyx, __pyx_mstate->__pyx_n_u_bool, __pyx_k_A_t7_b_s, tuple_dedup_map); if (unlikely(!__pyx_mstate_global->__pyx_codeobj_tab[169])) goto bad;
  }
  {
    const __Pyx_PyCode_New_function_description descr = {2, 0, 0, 8, (unsigned int)(CO_OPTIMIZED|CO_NEWLOCALS), 2250, 187};
    PyObject* const varnames[] = {__pyx_mstate->__pyx_n_u_self, __pyx_mstate->__pyx_n_u_key, __pyx_mstate->__pyx_n_u_hdr, __pyx_mstate->__pyx_n_u_r, __pyx_mstate->__pyx_n_u_index, __pyx_mstate->__pyx_n_u_id, __pyx_mstate->__pyx_n_u_n, __pyx_mstate->__pyx_n_u_bkey};
    __pyx_mstate_global->__pyx_codeobj_tab[170] = __Pyx_PyCode_New(descr, varnames, __pyx_mstate->__pyx_kp_u_pysam_libcbcf_pyx, __pyx_mstate->__pyx_n_u_getitem, __pyx_k_A_d_WA_Qb_Qe1_A_vRr_F_Q_j_D_t3a, tuple_dedup_map); if (unlikely(!__pyx_mstate_global->__pyx_codeobj_tab[170])) goto bad;
  }
  {
    const __Pyx_PyCode_New_function_description descr = {2, 0, 0, 6, (unsigned int)(CO_OPTIMIZED|CO_NEWLOCALS), 2275, 102};
    PyObject* const varnames[] = {__pyx_mstate->__pyx_n_u_self, __pyx_mstate->__pyx_n_u_key, __pyx_mstate->__pyx_n_u_hdr, __pyx_mstate->__pyx_n_u_r, __pyx_mstate->__pyx_n_u_id, __pyx_mstate->__pyx_n_u_bkey};
    __pyx_mstate_global->__pyx_codeobj_tab[171] = __Pyx_PyCode_New(descr, varnames, __pyx_mstate->__pyx_kp_u_pysam_libcbcf_pyx, __pyx_mstate->__pyx_n_u_add, __pyx_k_A_d_WA_4s_Qa_1E_A_4_auL_waq_auCq, tuple_dedup_map); if (unlikely(!__pyx_mstate_global->__pyx_codeobj_tab[171])) goto bad;
  }
  {
    const __Pyx_PyCode_New_function_description descr = {2, 0, 0, 8, (unsigned int)(CO_OPTIMIZED|CO_NEWLOCALS), 2292, 182};
    PyObject* const varnames[] = {__pyx_mstate->__pyx_n_u_self, __pyx_mstate->__pyx_n_u_key, __pyx_mstate->__pyx_n_u_hdr, __pyx_mstate->__pyx_n_u_r, __pyx_mstate->__pyx_n_u_index, __pyx_mstate->__pyx_n_u_id, __pyx_mstate->__pyx_n_u_n, __pyx_mstate->__pyx_n_u_bkey};
    __pyx_mstate_global->__pyx_codeobj_tab[172] = __Pyx_PyCode_New(descr, varnames, __pyx_mstate->__pyx_kp_u_pysam_libcbcf_pyx, __pyx_mstate->__pyx_n_u_delitem, __pyx_k_A_d_WA_Qb_Qe1_A_vRr_F_Q_j_D_t3a_2, tuple_dedup_map); if (unlikely(!__pyx_mstate_global->__pyx_codeobj_tab[172])) goto bad;
  }
  {
    const __Pyx_PyCode_New_function_description descr = {1, 0, 0, 2, (unsigned int)(CO_OPTIMIZED|CO_NEWLOCALS), 2317, 30};
    PyObject* const varnames[] = {__pyx_mstate->__pyx_n_u_self, __pyx_mstate->__pyx_n_u_r};
    __pyx_mstate_global->__pyx_codeobj_tab[173] = __Pyx_PyCode_New(descr, varnames, __pyx_mstate->__pyx_kp_u_pysam_libcbcf_pyx, __pyx_mstate->__pyx_n_u_clear, __pyx_k_A_WA_A_9A, tuple_dedup_map); if (unlikely(!__pyx_mstate_global->__pyx_codeobj_tab[173])) goto bad;
  }
  {
    const __Pyx_PyCode_New_function_description descr = {1, 0, 0, 4, (unsigned int)(CO_OPTIMIZED|CO_NEWLOCALS|CO_GENERATOR), 2323, 2};
    PyObject* const varnames[] = {__pyx_mstate->__pyx_n_u_self, __pyx_mstate->__pyx_n_u_hdr, __pyx_mstate->__pyx_n_u_r, __pyx_mstate->__pyx_n_u_i};
    __pyx_mstate_global->__pyx_codeobj_tab[174] = __Pyx_PyCode_New(descr, varnames, __pyx_mstate->__pyx_kp_u_pysam_libcbcf_pyx, __pyx_mstate->__pyx_n_u_iter, __pyx_k_A_3, tuple_dedup_map); if (unlikely(!__pyx_mstate_global->__pyx_codeobj_tab[174])) goto bad;
  }
  {
    const __Pyx_PyCode_New_function_description descr = {3, 0, 0, 3, (unsigned int)(CO_OPTIMIZED|CO_NEWLOCALS), 2331, 25};
    PyObject* const varnames[] = {__pyx_mstate->__pyx_n_u_self, __pyx_mstate->__pyx_n_u_key, __pyx_mstate->__pyx_n_u_default};
    __pyx_mstate_global->__pyx_codeobj_tab[175] = __Pyx_PyCode_New(descr, varnames, __pyx_mstate->__pyx_kp_u_pysam_libcbcf_pyx, __pyx_mstate->__pyx_n_u_get, __pyx_k_q_4q_1, tuple_dedup_map); if (unlikely(!__pyx_mstate_global->__pyx_codeobj_tab[175])) goto bad;
  }
  {
    const __Pyx_PyCode_New_function_description descr = {2, 0, 0, 5, (unsigned int)(CO_OPTIMIZED|CO_NEWLOCALS), 2338, 48};
    PyObject* const varnames[] = {__pyx_mstate->__pyx_n_u_self, __pyx_mstate->__pyx_n_u_key, __pyx_mstate->__pyx_n_u_hdr, __pyx_mstate->__pyx_n_u_r, __pyx_mstate->__pyx_n_u_bkey};
    __pyx_mstate_global->__pyx_codeobj_tab[176] = __Pyx_PyCode_New(descr, varnames, __pyx_mstate->__pyx_kp_u_pysam_libcbcf_pyx, __pyx_mstate->__pyx_n_u_contains, __pyx_k_A_d_WA_Qa_Qe3fCq, tuple_dedup_map); if (unlikely(!__pyx_mstate_global->__pyx_codeobj_tab[176])) goto bad;
  }
  {
    const __Pyx_PyCode_New_function_description descr = {1, 0, 0, 1, (unsigned int)(CO_OPTIMIZED|CO_NEWLOCALS), 2344, 11};
    PyObject* const varnames[] = {__pyx_mstate->__pyx_n_u_self};
    __pyx_mstate_global->__pyx_codeobj_tab[177] = __Pyx_PyCode_New(descr, varnames, __pyx_mstate->__pyx_kp_u_pysam_libcbcf_pyx, __pyx_mstate->__pyx_n_u_iterkeys, __pyx_k_A_t1A, tuple_dedup_map); if (unlikely(!__pyx_mstate_global->__pyx_codeobj_tab[177])) goto bad;
  }
  {
    const __Pyx_PyCode_New_function_description descr = {1, 0, 0, 2, (unsigned int)(CO_OPTIMIZED|CO_NEWLOCALS|CO_GENERATOR), 2348, 2};
    PyObject* const varnames[] = {__pyx_mstate->__pyx_n_u_self, __pyx_mstate->__pyx_n_u_key};
    __pyx_mstate_global->__pyx_codeobj_tab[178] = __Pyx_PyCode_New(descr, varnames, __pyx_mstate->__pyx_kp_u_pysam_libcbcf_pyx, __pyx_mstate->__pyx_n_u_itervalues, __pyx_k_A_3, tuple_dedup_map); if (unlikely(!__pyx_mstate_global->__pyx_codeobj_tab[178])) goto bad;
  }
  {
    const __Pyx_PyCode_New_function_description descr = {1, 0, 0, 2, (unsigned int)(CO_OPTIMIZED|CO_NEWLOCALS|CO_GENERATOR), 2353, 2};
    PyObject* const varnames[] = {__pyx_mstate->__pyx_n_u_self, __pyx_mstate->__pyx_n_u_key};
    __pyx_mstate_global->__pyx_codeobj_tab[179] = __Pyx_PyCode_New(descr, varnames, __pyx_mstate->__pyx_kp_u_pysam_libcbcf_pyx, __pyx_mstate->__pyx_n_u_iteritems, __pyx_k_A_3, tuple_dedup_map); if (unlikely(!__pyx_mstate_global->__pyx_codeobj_tab[179])) goto bad;
  }
  {
    const __Pyx_PyCode_New_function_description descr = {1, 0, 0, 1, (unsigned int)(CO_OPTIMIZED|CO_NEWLOCALS), 2358, 11};
    PyObject* const varnames[] = {__pyx_mstate->__pyx_n_u_self};
    __pyx_mstate_global->__pyx_codeobj_tab[180] = __Pyx_PyCode_New(descr, varnames, __pyx_mstate->__pyx_kp_u_pysam_libcbcf_pyx, __pyx_mstate->__pyx_n_u_keys, __pyx_k_A_t1A, tuple_dedup_map); if (unlikely(!__pyx_mstate_global->__pyx_codeobj_tab[180])) goto bad;
  }
  {
    const __Pyx_PyCode_New_function_description descr = {1, 0, 0, 1, (unsigned int)(CO_OPTIMIZED|CO_NEWLOCALS), 2362, 15};
    PyObject* const varnames[] = {__pyx_mstate->__pyx_n_u_self};
    __pyx_mstate_global->__pyx_codeobj_tab[181] = __Pyx_PyCode_New(descr, varnames, __pyx_mstate->__pyx_kp_u_pysam_libcbcf_pyx, __pyx_mstate->__pyx_n_u_items, __pyx_k_A_t1D, tuple_dedup_map); if (unlikely(!__pyx_mstate_global->__pyx_codeobj_tab[181])) goto bad;
  }
  {
    const __Pyx_PyCode_New_function_description descr = {1, 0, 0, 1, (unsigned int)(CO_OPTIMIZED|CO_NEWLOCALS), 2366, 15};
    PyObject* const varnames[] = {__pyx_mstate->__pyx_n_u_self};
    __pyx_mstate_global->__pyx_codeobj_tab[182] = __Pyx_PyCode_New(descr, varnames, __pyx_mstate->__pyx_kp_u_pysam_libcbcf_pyx, __pyx_mstate->__pyx_n_u_values, __pyx_k_A_t1D_1, tuple_dedup_map); if (unlikely(!__pyx_mstate_global->__pyx_codeobj_tab[182])) goto bad;
  }
  {
    const __Pyx_PyCode_New_function_description descr = {3, 0, 0, 6, (unsigned int)(CO_OPTIMIZED|CO_NEWLOCALS), 2370, 96};
    PyObject* const varnames[] = {__pyx_mstate->__pyx_n_u_self, __pyx_mstate->__pyx_n_u_other, __pyx_mstate->__pyx_n_u_op, __pyx_mstate->__pyx_n_u_s, __pyx_mstate->__pyx_n_u_o, __pyx_mstate->__pyx_n_u_cmp};
    __pyx_mstate_global->__pyx_codeobj_tab[183] = __Pyx_PyCode_New(descr, varnames, __pyx_mstate->__pyx_kp_u_pysam_libcbcf_pyx, __pyx_mstate->__pyx_n_u_richcmp, __pyx_k_A_3c_4s_Q_1_WA_gQ_G3ar_D_s_aq_3c, tuple_dedup_map); if (unlikely(!__pyx_mstate_global->__pyx_codeobj_tab[183])) goto bad;
  }
  {
    const __Pyx_PyCode_New_function_description descr = {1, 0, 0, 4, (unsigned int)(CO_OPTIMIZED|CO_NEWLOCALS), 1, 94};
    PyObject* const varnames[] = {__pyx_mstate->__pyx_n_u_self, __pyx_mstate->__pyx_n_u_state, __pyx_mstate->__pyx_n_u_dict_2, __pyx_mstate->__pyx_n_u_use_setstate};
    __pyx_mstate_global->__pyx_codeobj_tab[184] = __Pyx_PyCode_New(descr, varnames, __pyx_mstate->__pyx_kp_u_stringsource, __pyx_mstate->__pyx_n_u_reduce_cython, __pyx_k_T_G1F_a_vWA_q_t87_q_4D_7RS_4D_1, tuple_dedup_map); if (unlikely(!__pyx_mstate_global->__pyx_codeobj_tab[184])) goto bad;
  }
  {
    const __Pyx_PyCode_New_function_description descr = {2, 0, 0, 2, (unsigned int)(CO_OPTIMIZED|CO_NEWLOCALS), 16, 11};
    PyObject* const varnames[] = {__pyx_mstate->__pyx_n_u_self, __pyx_mstate->__pyx_n_u_pyx_state};
    __pyx_mstate_global->__pyx_codeobj_tab[185] = __Pyx_PyCode_New(descr, varnames, __pyx_mstate->__pyx_kp_u_stringsource, __pyx_mstate->__pyx_n_u_setstate_cython, __pyx_k_1_2, tuple_dedup_map); if (unlikely(!__pyx_mstate_global->__pyx_codeobj_tab[185])) goto bad;
  }
  {
    const __Pyx_PyCode_New_function_description descr = {1, 0, 0, 7, (unsigned int)(CO_OPTIMIZED|CO_NEWLOCALS), 2390, 42};
    PyObject* const varnames[] = {__pyx_mstate->__pyx_n_u_record, __pyx_mstate->__pyx_n_u_MAX_POS, __pyx_mstate->__pyx_n_u_VALUE_TYPES, __pyx_mstate->__pyx_n_u_METADATA_TYPES, __pyx_mstate->__pyx_n_u_METADATA_LENGTHS, __pyx_mstate->__pyx_n_u_nothing, __pyx_mstate->__pyx_n_u_bcf_str_cache};
    __pyx_mstate_global->__pyx_codeobj_tab[186] = __Pyx_PyCode_New(descr, varnames, __pyx_mstate->__pyx_kp_u_pysam_libcbcf_pyx, __pyx_mstate->__pyx_n_u_makeVariantRecordFilter, __pyx_k_t1_j_9_A_1, tuple_dedup_map); if (unlikely(!__pyx_mstate_global->__pyx_codeobj_tab[186])) goto bad;
  }
  {
    const __Pyx_PyCode_New_function_description descr = {1, 0, 0, 3, (unsigned int)(CO_OPTIMIZED|CO_NEWLOCALS|CO_VARARGS|CO_VARKEYWORDS), 2403, 11};
    PyObject* const varnames[] = {__pyx_mstate->__pyx_n_u_self, __pyx_mstate->__pyx_n_u_args, __pyx_mstate->__pyx_n_u_kwargs};
    __pyx_mstate_global->__pyx_codeobj_tab[187] = __Pyx_PyCode_New(descr, varnames, __pyx_mstate->__pyx_kp_u_pysam_libcbcf_pyx, __pyx_mstate->__pyx_n_u_init, __pyx_k_A_iq, tuple_dedup_map); if (unlikely(!__pyx_mstate_global->__pyx_codeobj_tab[187])) goto bad;
  }
  {
    const __Pyx_PyCode_New_function_description descr = {1, 0, 0, 5, (unsigned int)(CO_OPTIMIZED|CO_NEWLOCALS), 2406, 65};
    PyObject* const varnames[] = {__pyx_mstate->__pyx_n_u_self, __pyx_mstate->__pyx_n_u_hdr, __pyx_mstate->__pyx_n_u_r, __pyx_mstate->__pyx_n_u_i, __pyx_mstate->__pyx_n_u_n};
    __pyx_mstate_global->__pyx_codeobj_tab[188] = __Pyx_PyCode_New(descr, varnames, __pyx_mstate->__pyx_kp_u_pysam_libcbcf_pyx, __pyx_mstate->__pyx_n_u_len, __pyx_k_A_d_WA_E_aq_q_ar_Q_q, tuple_dedup_map); if (unlikely(!__pyx_mstate_global->__pyx_codeobj_tab[188])) goto bad;
  }
  {
    const __Pyx_PyCode_New_function_description descr = {1, 0, 0, 4, (unsigned int)(CO_OPTIMIZED|CO_NEWLOCALS), 2416, 62};
    PyObject* const varnames[] = {__pyx_mstate->__pyx_n_u_self, __pyx_mstate->__pyx_n_u_hdr, __pyx_mstate->__pyx_n_u_r, __pyx_mstate->__pyx_n_u_i};
    __pyx_mstate_global->__pyx_codeobj_tab[189] = __Pyx_PyCode_New(descr, varnames, __pyx_mstate->__pyx_kp_u_pysam_libcbcf_pyx, __pyx_mstate->__pyx_n_u_bool, __pyx_k_A_d_WA_E_aq_q_ar_q_q, tuple_dedup_map); if (unlikely(!__pyx_mstate_global->__pyx_codeobj_tab[189])) goto bad;
  }
  {
    const __Pyx_PyCode_New_function_description descr = {2, 0, 0, 6, (unsigned int)(CO_OPTIMIZED|CO_NEWLOCALS), 2426, 95};
    PyObject* const varnames[] = {__pyx_mstate->__pyx_n_u_self, __pyx_mstate->__pyx_n_u_key, __pyx_mstate->__pyx_n_u_hdr, __pyx_mstate->__pyx_n_u_r, __pyx_mstate->__pyx_n_u_bkey, __pyx_mstate->__pyx_n_u_fmt};
    __pyx_mstate_global->__pyx_codeobj_tab[190] = __Pyx_PyCode_New(descr, varnames, __pyx_mstate->__pyx_kp_u_pysam_libcbcf_pyx, __pyx_mstate->__pyx_n_u_getitem, __pyx_k_A_d_WA_Qa_k_s_4t3d_Q_waq_4wi_3a, tuple_dedup_map); if (unlikely(!__pyx_mstate_global->__pyx_codeobj_tab[190])) goto bad;
  }
  {
    const __Pyx_PyCode_New_function_description descr = {2, 0, 0, 6, (unsigned int)(CO_OPTIMIZED|CO_NEWLOCALS), 2438, 112};
    PyObject* const varnames[] = {__pyx_mstate->__pyx_n_u_self, __pyx_mstate->__pyx_n_u_key, __pyx_mstate->__pyx_n_u_hdr, __pyx_mstate->__pyx_n_u_r, __pyx_mstate->__pyx_n_u_bkey, __pyx_mstate->__pyx_n_u_fmt};
    __pyx_mstate_global->__pyx_codeobj_tab[191] = __Pyx_PyCode_New(descr, varnames, __pyx_mstate->__pyx_kp_u_pysam_libcbcf_pyx, __pyx_mstate->__pyx_n_u_delitem, __pyx_k_A_d_WA_Qa_k_s_4t3d_Q_waq_AU_V3d, tuple_dedup_map); if (unlikely(!__pyx_mstate_global->__pyx_codeobj_tab[191])) goto bad;
  }
  {
    const __Pyx_PyCode_New_function_description descr = {1, 0, 0, 6, (unsigned int)(CO_OPTIMIZED|CO_NEWLOCALS), 2451, 117};
    PyObject* const varnames[] = {__pyx_mstate->__pyx_n_u_self, __pyx_mstate->__pyx_n_u_hdr, __pyx_mstate->__pyx_n_u_r, __pyx_mstate->__pyx_n_u_fmt, __pyx_mstate->__pyx_n_u_key, __pyx_mstate->__pyx_n_u_i};
    __pyx_mstate_global->__pyx_codeobj_tab[192] = __Pyx_PyCode_New(descr, varnames, __pyx_mstate->__pyx_kp_u_pysam_libcbcf_pyx, __pyx_mstate->__pyx_n_u_clear, __pyx_k_A_d_WA_E_q_1Bd_1_s_nAU_S_AU_U_T, tuple_dedup_map); if (unlikely(!__pyx_mstate_global->__pyx_codeobj_tab[192])) goto bad;
  }
  {
    const __Pyx_PyCode_New_function_description descr = {1, 0, 0, 5, (unsigned int)(CO_OPTIMIZED|CO_NEWLOCALS|CO_GENERATOR), 2467, 2};
    PyObject* const varnames[] = {__pyx_mstate->__pyx_n_u_self, __pyx_mstate->__pyx_n_u_hdr, __pyx_mstate->__pyx_n_u_r, __pyx_mstate->__pyx_n_u_fmt, __pyx_mstate->__pyx_n_u_i};
    __pyx_mstate_global->__pyx_codeobj_tab[193] = __Pyx_PyCode_New(descr, varnames, __pyx_mstate->__pyx_kp_u_pysam_libcbcf_pyx, __pyx_mstate->__pyx_n_u_iter, __pyx_k_A_3, tuple_dedup_map); if (unlikely(!__pyx_mstate_global->__pyx_codeobj_tab[193])) goto bad;
  }
  {
    const __Pyx_PyCode_New_function_description descr = {3, 0, 0, 3, (unsigned int)(CO_OPTIMIZED|CO_NEWLOCALS), 2478, 25};
    PyObject* const varnames[] = {__pyx_mstate->__pyx_n_u_self, __pyx_mstate->__pyx_n_u_key, __pyx_mstate->__pyx_n_u_default};
    __pyx_mstate_global->__pyx_codeobj_tab[194] = __Pyx_PyCode_New(descr, varnames, __pyx_mstate->__pyx_kp_u_pysam_libcbcf_pyx, __pyx_mstate->__pyx_n_u_get, __pyx_k_q_4q_1, tuple_dedup_map); if (unlikely(!__pyx_mstate_global->__pyx_codeobj_tab[194])) goto bad;
  }
  {
    const __Pyx_PyCode_New_function_description descr = {2, 0, 0, 6, (unsigned int)(CO_OPTIMIZED|CO_NEWLOCALS), 2485, 63};
    PyObject* const varnames[] = {__pyx_mstate->__pyx_n_u_self, __pyx_mstate->__pyx_n_u_key, __pyx_mstate->__pyx_n_u_hdr, __pyx_mstate->__pyx_n_u_r, __pyx_mstate->__pyx_n_u_bkey, __pyx_mstate->__pyx_n_u_fmt};
    __pyx_mstate_global->__pyx_codeobj_tab[195] = __Pyx_PyCode_New(descr, varnames, __pyx_mstate->__pyx_kp_u_pysam_libcbcf_pyx, __pyx_mstate->__pyx_n_u_contains, __pyx_k_A_d_WA_Qa_k_s_t3e4s_S, tuple_dedup_map); if (unlikely(!__pyx_mstate_global->__pyx_codeobj_tab[195])) goto bad;
  }
  {
    const __Pyx_PyCode_New_function_description descr = {1, 0, 0, 1, (unsigned int)(CO_OPTIMIZED|CO_NEWLOCALS), 2492, 11};
    PyObject* const varnames[] = {__pyx_mstate->__pyx_n_u_self};
    __pyx_mstate_global->__pyx_codeobj_tab[196] = __Pyx_PyCode_New(descr, varnames, __pyx_mstate->__pyx_kp_u_pysam_libcbcf_pyx, __pyx_mstate->__pyx_n_u_iterkeys, __pyx_k_A_t1A, tuple_dedup_map); if (unlikely(!__pyx_mstate_global->__pyx_codeobj_tab[196])) goto bad;
  }
  {
    const __Pyx_PyCode_New_function_description descr = {1, 0, 0, 2, (unsigned int)(CO_OPTIMIZED|CO_NEWLOCALS|CO_GENERATOR), 2496, 2};
    PyObject* const varnames[] = {__pyx_mstate->__pyx_n_u_self, __pyx_mstate->__pyx_n_u_key};
    __pyx_mstate_global->__pyx_codeobj_tab[197] = __Pyx_PyCode_New(descr, varnames, __pyx_mstate->__pyx_kp_u_pysam_libcbcf_pyx, __pyx_mstate->__pyx_n_u_itervalues, __pyx_k_A_3, tuple_dedup_map); if (unlikely(!__pyx_mstate_global->__pyx_codeobj_tab[197])) goto bad;
  }
  {
    const __Pyx_PyCode_New_function_description descr = {1, 0, 0, 2, (unsigned int)(CO_OPTIMIZED|CO_NEWLOCALS|CO_GENERATOR), 2501, 2};
    PyObject* const varnames[] = {__pyx_mstate->__pyx_n_u_self, __pyx_mstate->__pyx_n_u_key};
    __pyx_mstate_global->__pyx_codeobj_tab[198] = __Pyx_PyCode_New(descr, varnames, __pyx_mstate->__pyx_kp_u_pysam_libcbcf_pyx, __pyx_mstate->__pyx_n_u_iteritems, __pyx_k_A_3, tuple_dedup_map); if (unlikely(!__pyx_mstate_global->__pyx_codeobj_tab[198])) goto bad;
  }
  {
    const __Pyx_PyCode_New_function_description descr = {1, 0, 0, 1, (unsigned int)(CO_OPTIMIZED|CO_NEWLOCALS), 2506, 11};
    PyObject* const varnames[] = {__pyx_mstate->__pyx_n_u_self};
    __pyx_mstate_global->__pyx_codeobj_tab[199] = __Pyx_PyCode_New(descr, varnames, __pyx_mstate->__pyx_kp_u_pysam_libcbcf_pyx, __pyx_mstate->__pyx_n_u_keys, __pyx_k_A_t1A, tuple_dedup_map); if (unlikely(!__pyx_mstate_global->__pyx_codeobj_tab[199])) goto bad;
  }
  {
    const __Pyx_PyCode_New_function_description descr = {1, 0, 0, 1, (unsigned int)(CO_OPTIMIZED|CO_NEWLOCALS), 2510, 15};
    PyObject* const varnames[] = {__pyx_mstate->__pyx_n_u_self};
    __pyx_mstate_global->__pyx_codeobj_tab[200] = __Pyx_PyCode_New(descr, varnames, __pyx_mstate->__pyx_kp_u_pysam_libcbcf_pyx, __pyx_mstate->__pyx_n_u_items, __pyx_k_A_t1D, tuple_dedup_map); if (unlikely(!__pyx_mstate_global->__pyx_codeobj_tab[200])) goto bad;
  }
  {
    const __Pyx_PyCode_New_function_description descr = {1, 0, 0, 1, (unsigned int)(CO_OPTIMIZED|CO_NEWLOCALS), 2514, 15};
    PyObject* const varnames[] = {__pyx_mstate->__pyx_n_u_self};
    __pyx_mstate_global->__pyx_codeobj_tab[201] = __Pyx_PyCode_New(descr, varnames, __pyx_mstate->__pyx_kp_u_pysam_libcbcf_pyx, __pyx_mstate->__pyx_n_u_values, __pyx_k_A_t1D_1, tuple_dedup_map); if (unlikely(!__pyx_mstate_global->__pyx_codeobj_tab[201])) goto bad;
  }
  {
    const __Pyx_PyCode_New_function_description descr = {1, 0, 0, 4, (unsigned int)(CO_OPTIMIZED|CO_NEWLOCALS), 1, 94};
    PyObject* const varnames[] = {__pyx_mstate->__pyx_n_u_self, __pyx_mstate->__pyx_n_u_state, __pyx_mstate->__pyx_n_u_dict_2, __pyx_mstate->__pyx_n_u_use_setstate};
    __pyx_mstate_global->__pyx_codeobj_tab[202] = __Pyx_PyCode_New(descr, varnames, __pyx_mstate->__pyx_kp_u_stringsource, __pyx_mstate->__pyx_n_u_reduce_cython, __pyx_k_T_G1F_a_vWA_q_t87_q_4D_7RS_4D_1, tuple_dedup_map); if (unlikely(!__pyx_mstate_global->__pyx_codeobj_tab[202])) goto bad;
  }
  {
    const __Pyx_PyCode_New_function_description descr = {2, 0, 0, 2, (unsigned int)(CO_OPTIMIZED|CO_NEWLOCALS), 16, 11};
    PyObject* const varnames[] = {__pyx_mstate->__pyx_n_u_self, __pyx_mstate->__pyx_n_u_pyx_state};
    __pyx_mstate_global->__pyx_codeobj_tab[203] = __Pyx_PyCode_New(descr, varnames, __pyx_mstate->__pyx_kp_u_stringsource, __pyx_mstate->__pyx_n_u_setstate_cython, __pyx_k_1_2, tuple_dedup_map); if (unlikely(!__pyx_mstate_global->__pyx_codeobj_tab[203])) goto bad;
  }
  {
    const __Pyx_PyCode_New_function_description descr = {1, 0, 0, 7, (unsigned int)(CO_OPTIMIZED|CO_NEWLOCALS), 2524, 42};
    PyObject* const varnames[] = {__pyx_mstate->__pyx_n_u_record, __pyx_mstate->__pyx_n_u_MAX_POS, __pyx_mstate->__pyx_n_u_VALUE_TYPES, __pyx_mstate->__pyx_n_u_METADATA_TYPES, __pyx_mstate->__pyx_n_u_METADATA_LENGTHS, __pyx_mstate->__pyx_n_u_nothing, __pyx_mstate->__pyx_n_u_bcf_str_cache};
    __pyx_mstate_global->__pyx_codeobj_tab[204] = __Pyx_PyCode_New(descr, varnames, __pyx_mstate->__pyx_kp_u_pysam_libcbcf_pyx, __pyx_mstate->__pyx_n_u_makeVariantRecordFormat, __pyx_k_t1_j_9_A_1, tuple_dedup_map); if (unlikely(!__pyx_mstate_global->__pyx_codeobj_tab[204])) goto bad;
  }
  {
    const __Pyx_PyCode_New_function_description descr = {1, 0, 0, 3, (unsigned int)(CO_OPTIMIZED|CO_NEWLOCALS|CO_VARARGS|CO_VARKEYWORDS), 2539, 11};
    PyObject* const varnames[] = {__pyx_mstate->__pyx_n_u_self, __pyx_mstate->__pyx_n_u_args, __pyx_mstate->__pyx_n_u_kwargs};
    __pyx_mstate_global->__pyx_codeobj_tab[205] = __Pyx_PyCode_New(descr, varnames, __pyx_mstate->__pyx_kp_u_pysam_libcbcf_pyx, __pyx_mstate->__pyx_n_u_init, __pyx_k_A_iq, tuple_dedup_map); if (unlikely(!__pyx_mstate_global->__pyx_codeobj_tab[205])) goto bad;
  }
  {
    const __Pyx_PyCode_New_function_description descr = {1, 0, 0, 7, (unsigned int)(CO_OPTIMIZED|CO_NEWLOCALS), 2542, 139};
    PyObject* const varnames[] = {__pyx_mstate->__pyx_n_u_self, __pyx_mstate->__pyx_n_u_hdr, __pyx_mstate->__pyx_n_u_r, __pyx_mstate->__pyx_n_u_info, __pyx_mstate->__pyx_n_u_key, __pyx_mstate->__pyx_n_u_i, __pyx_mstate->__pyx_n_u_count};
    __pyx_mstate_global->__pyx_codeobj_tab[206] = __Pyx_PyCode_New(descr, varnames, __pyx_mstate->__pyx_kp_u_pysam_libcbcf_pyx, __pyx_mstate->__pyx_n_u_len, __pyx_k_A_d_WA_A_Qc_b_AQ_E_aq_1ARuAQ_k_Q, tuple_dedup_map); if (unlikely(!__pyx_mstate_global->__pyx_codeobj_tab[206])) goto bad;
  }
  {
    const __Pyx_PyCode_New_function_description descr = {1, 0, 0, 6, (unsigned int)(CO_OPTIMIZED|CO_NEWLOCALS), 2560, 134};
    PyObject* const varnames[] = {__pyx_mstate->__pyx_n_u_self, __pyx_mstate->__pyx_n_u_hdr, __pyx_mstate->__pyx_n_u_r, __pyx_mstate->__pyx_n_u_info, __pyx_mstate->__pyx_n_u_key, __pyx_mstate->__pyx_n_u_i};
    __pyx_mstate_global->__pyx_codeobj_tab[207] = __Pyx_PyCode_New(descr, varnames, __pyx_mstate->__pyx_kp_u_pysam_libcbcf_pyx, __pyx_mstate->__pyx_n_u_bool, __pyx_k_A_d_WA_Qc_b_AQ_E_aq_1ARuAQ_k_Q_u, tuple_dedup_map); if (unlikely(!__pyx_mstate_global->__pyx_codeobj_tab[207])) goto bad;
  }
  {
    const __Pyx_PyCode_New_function_description descr = {2, 0, 0, 7, (unsigned int)(CO_OPTIMIZED|CO_NEWLOCALS), 2578, 247};
    PyObject* const varnames[] = {__pyx_mstate->__pyx_n_u_self, __pyx_mstate->__pyx_n_u_key, __pyx_mstate->__pyx_n_u_hdr, __pyx_mstate->__pyx_n_u_r, __pyx_mstate->__pyx_n_u_bkey, __pyx_mstate->__pyx_n_u_info, __pyx_mstate->__pyx_n_u_info_id};
    __pyx_mstate_global->__pyx_codeobj_tab[208] = __Pyx_PyCode_New(descr, varnames, __pyx_mstate->__pyx_kp_u_pysam_libcbcf_pyx, __pyx_mstate->__pyx_n_u_getitem, __pyx_k_A_d_WA_Qc_b_AQ_Qa_6_1_1_AU_Q_1_y, tuple_dedup_map); if (unlikely(!__pyx_mstate_global->__pyx_codeobj_tab[208])) goto bad;
  }
  {
    const __Pyx_PyCode_New_function_description descr = {3, 0, 0, 4, (unsigned int)(CO_OPTIMIZED|CO_NEWLOCALS), 2610, 76};
    PyObject* const varnames[] = {__pyx_mstate->__pyx_n_u_self, __pyx_mstate->__pyx_n_u_key, __pyx_mstate->__pyx_n_u_value, __pyx_mstate->__pyx_n_u_bkey};
    __pyx_mstate_global->__pyx_codeobj_tab[209] = __Pyx_PyCode_New(descr, varnames, __pyx_mstate->__pyx_kp_u_pysam_libcbcf_pyx, __pyx_mstate->__pyx_n_u_setitem, __pyx_k_A_Qa_6_1_1_Qd_Ba_AQ_4y_Q, tuple_dedup_map); if (unlikely(!__pyx_mstate_global->__pyx_codeobj_tab[209])) goto bad;
  }
  {
    const __Pyx_PyCode_New_function_description descr = {2, 0, 0, 7, (unsigned int)(CO_OPTIMIZED|CO_NEWLOCALS), 2621, 269};
    PyObject* const varnames[] = {__pyx_mstate->__pyx_n_u_self, __pyx_mstate->__pyx_n_u_key, __pyx_mstate->__pyx_n_u_hdr, __pyx_mstate->__pyx_n_u_r, __pyx_mstate->__pyx_n_u_bkey, __pyx_mstate->__pyx_n_u_info, __pyx_mstate->__pyx_n_u_info_id};
    __pyx_mstate_global->__pyx_codeobj_tab[210] = __Pyx_PyCode_New(descr, varnames, __pyx_mstate->__pyx_kp_u_pysam_libcbcf_pyx, __pyx_mstate->__pyx_n_u_delitem, __pyx_k_A_d_WA_Qa_6_1_1_Qc_b_AQ_AU_Q_1_y, tuple_dedup_map); if (unlikely(!__pyx_mstate_global->__pyx_codeobj_tab[210])) goto bad;
  }
  {
    const __Pyx_PyCode_New_function_description descr = {1, 0, 0, 6, (unsigned int)(CO_OPTIMIZED|CO_NEWLOCALS), 2653, 154};
    PyObject* const varnames[] = {__pyx_mstate->__pyx_n_u_self, __pyx_mstate->__pyx_n_u_hdr, __pyx_mstate->__pyx_n_u_r, __pyx_mstate->__pyx_n_u_info, __pyx_mstate->__pyx_n_u_key, __pyx_mstate->__pyx_n_u_i};
    __pyx_mstate_global->__pyx_codeobj_tab[211] = __Pyx_PyCode_New(descr, varnames, __pyx_mstate->__pyx_kp_u_pysam_libcbcf_pyx, __pyx_mstate->__pyx_n_u_clear, __pyx_k_A_d_WA_Qc_b_AQ_E_aq_1ARuAQ_uD_A, tuple_dedup_map); if (unlikely(!__pyx_mstate_global->__pyx_codeobj_tab[211])) goto bad;
  }
  {
    const __Pyx_PyCode_New_function_description descr = {1, 0, 0, 6, (unsigned int)(CO_OPTIMIZED|CO_NEWLOCALS|CO_GENERATOR), 2673, 2};
    PyObject* const varnames[] = {__pyx_mstate->__pyx_n_u_self, __pyx_mstate->__pyx_n_u_hdr, __pyx_mstate->__pyx_n_u_r, __pyx_mstate->__pyx_n_u_info, __pyx_mstate->__pyx_n_u_key, __pyx_mstate->__pyx_n_u_i};
    __pyx_mstate_global->__pyx_codeobj_tab[212] = __Pyx_PyCode_New(descr, varnames, __pyx_mstate->__pyx_kp_u_pysam_libcbcf_pyx, __pyx_mstate->__pyx_n_u_iter, __pyx_k_A_3, tuple_dedup_map); if (unlikely(!__pyx_mstate_global->__pyx_codeobj_tab[212])) goto bad;
  }
  {
    const __Pyx_PyCode_New_function_description descr = {3, 0, 0, 8, (unsigned int)(CO_OPTIMIZED|CO_NEWLOCALS), 2690, 210};
    PyObject* const varnames[] = {__pyx_mstate->__pyx_n_u_self, __pyx_mstate->__pyx_n_u_key, __pyx_mstate->__pyx_n_u_default, __pyx_mstate->__pyx_n_u_hdr, __pyx_mstate->__pyx_n_u_r, __pyx_mstate->__pyx_n_u_bkey, __pyx_mstate->__pyx_n_u_info, __pyx_mstate->__pyx_n_u_info_id};
    __pyx_mstate_global->__pyx_codeobj_tab[213] = __Pyx_PyCode_New(descr, varnames, __pyx_mstate->__pyx_kp_u_pysam_libcbcf_pyx, __pyx_mstate->__pyx_n_u_get, __pyx_k_q_d_WA_Qc_b_AQ_Qa_6_1_1_AU_Q_1, tuple_dedup_map); if (unlikely(!__pyx_mstate_global->__pyx_codeobj_tab[213])) goto bad;
  }
  {
    const __Pyx_PyCode_New_function_description descr = {2, 0, 0, 6, (unsigned int)(CO_OPTIMIZED|CO_NEWLOCALS), 2720, 107};
    PyObject* const varnames[] = {__pyx_mstate->__pyx_n_u_self, __pyx_mstate->__pyx_n_u_key, __pyx_mstate->__pyx_n_u_hdr, __pyx_mstate->__pyx_n_u_r, __pyx_mstate->__pyx_n_u_bkey, __pyx_mstate->__pyx_n_u_info};
    __pyx_mstate_global->__pyx_codeobj_tab[214] = __Pyx_PyCode_New(descr, varnames, __pyx_mstate->__pyx_kp_u_pysam_libcbcf_pyx, __pyx_mstate->__pyx_n_u_contains, __pyx_k_A_d_WA_Qc_b_AQ_Qa_6_1_1_AU_Q_uCu, tuple_dedup_map); if (unlikely(!__pyx_mstate_global->__pyx_codeobj_tab[214])) goto bad;
  }
  {
    const __Pyx_PyCode_New_function_description descr = {1, 0, 0, 1, (unsigned int)(CO_OPTIMIZED|CO_NEWLOCALS), 2736, 11};
    PyObject* const varnames[] = {__pyx_mstate->__pyx_n_u_self};
    __pyx_mstate_global->__pyx_codeobj_tab[215] = __Pyx_PyCode_New(descr, varnames, __pyx_mstate->__pyx_kp_u_pysam_libcbcf_pyx, __pyx_mstate->__pyx_n_u_iterkeys, __pyx_k_A_t1A, tuple_dedup_map); if (unlikely(!__pyx_mstate_global->__pyx_codeobj_tab[215])) goto bad;
  }
  {
    const __Pyx_PyCode_New_function_description descr = {1, 0, 0, 6, (unsigned int)(CO_OPTIMIZED|CO_NEWLOCALS|CO_GENERATOR), 2740, 2};
    PyObject* const varnames[] = {__pyx_mstate->__pyx_n_u_self, __pyx_mstate->__pyx_n_u_hdr, __pyx_mstate->__pyx_n_u_r, __pyx_mstate->__pyx_n_u_info, __pyx_mstate->__pyx_n_u_key, __pyx_mstate->__pyx_n_u_i};
    __pyx_mstate_global->__pyx_codeobj_tab[216] = __Pyx_PyCode_New(descr, varnames, __pyx_mstate->__pyx_kp_u_pysam_libcbcf_pyx, __pyx_mstate->__pyx_n_u_itervalues, __pyx_k_A_3, tuple_dedup_map); if (unlikely(!__pyx_mstate_global->__pyx_codeobj_tab[216])) goto bad;
  }
  {
    const __Pyx_PyCode_New_function_description descr = {1, 0, 0, 7, (unsigned int)(CO_OPTIMIZED|CO_NEWLOCALS|CO_GENERATOR), 2758, 2};
    PyObject* const varnames[] = {__pyx_mstate->__pyx_n_u_self, __pyx_mstate->__pyx_n_u_hdr, __pyx_mstate->__pyx_n_u_r, __pyx_mstate->__pyx_n_u_info, __pyx_mstate->__pyx_n_u_key, __pyx_mstate->__pyx_n_u_i, __pyx_mstate->__pyx_n_u_value};
    __pyx_mstate_global->__pyx_codeobj_tab[217] = __Pyx_PyCode_New(descr, varnames, __pyx_mstate->__pyx_kp_u_pysam_libcbcf_pyx, __pyx_mstate->__pyx_n_u_iteritems, __pyx_k_A_3, tuple_dedup_map); if (unlikely(!__pyx_mstate_global->__pyx_codeobj_tab[217])) goto bad;
  }
  {
    const __Pyx_PyCode_New_function_description descr = {1, 0, 0, 1, (unsigned int)(CO_OPTIMIZED|CO_NEWLOCALS), 2777, 11};
    PyObject* const varnames[] = {__pyx_mstate->__pyx_n_u_self};
    __pyx_mstate_global->__pyx_codeobj_tab[218] = __Pyx_PyCode_New(descr, varnames, __pyx_mstate->__pyx_kp_u_pysam_libcbcf_pyx, __pyx_mstate->__pyx_n_u_keys, __pyx_k_A_t1A, tuple_dedup_map); if (unlikely(!__pyx_mstate_global->__pyx_codeobj_tab[218])) goto bad;
  }
  {
    const __Pyx_PyCode_New_function_description descr = {1, 0, 0, 1, (unsigned int)(CO_OPTIMIZED|CO_NEWLOCALS), 2781, 15};
    PyObject* const varnames[] = {__pyx_mstate->__pyx_n_u_self};
    __pyx_mstate_global->__pyx_codeobj_tab[219] = __Pyx_PyCode_New(descr, varnames, __pyx_mstate->__pyx_kp_u_pysam_libcbcf_pyx, __pyx_mstate->__pyx_n_u_items, __pyx_k_A_t1D, tuple_dedup_map); if (unlikely(!__pyx_mstate_global->__pyx_codeobj_tab[219])) goto bad;
  }
  {
    const __Pyx_PyCode_New_function_description descr = {1, 0, 0, 1, (unsigned int)(CO_OPTIMIZED|CO_NEWLOCALS), 2785, 15};
    PyObject* const varnames[] = {__pyx_mstate->__pyx_n_u_self};
    __pyx_mstate_global->__pyx_codeobj_tab[220] = __Pyx_PyCode_New(descr, varnames, __pyx_mstate->__pyx_kp_u_pysam_libcbcf_pyx, __pyx_mstate->__pyx_n_u_values, __pyx_k_A_t1D_1, tuple_dedup_map); if (unlikely(!__pyx_mstate_global->__pyx_codeobj_tab[220])) goto bad;
  }
  {
    const __Pyx_PyCode_New_function_description descr = {2, 0, 0, 5, (unsigned int)(CO_OPTIMIZED|CO_NEWLOCALS|CO_VARKEYWORDS), 2789, 76};
    PyObject* const varnames[] = {__pyx_mstate->__pyx_n_u_self, __pyx_mstate->__pyx_n_u_items, __pyx_mstate->__pyx_n_u_kwargs, __pyx_mstate->__pyx_n_u_k, __pyx_mstate->__pyx_n_u_v};
    __pyx_mstate_global->__pyx_codeobj_tab[221] = __Pyx_PyCode_New(descr, varnames, __pyx_mstate->__pyx_kp_u_pysam_libcbcf_pyx, __pyx_mstate->__pyx_n_u_update, __pyx_k_1_CuE_q_r_A_AU_1_awa_5_fA_AU, tuple_dedup_map); if (unlikely(!__pyx_mstate_global->__pyx_codeobj_tab[221])) goto bad;
  }
  {
    const __Pyx_PyCode_New_function_description descr = {3, 0, 0, 9, (unsigned int)(CO_OPTIMIZED|CO_NEWLOCALS), 2803, 295};
    PyObject* const varnames[] = {__pyx_mstate->__pyx_n_u_self, __pyx_mstate->__pyx_n_u_key, __pyx_mstate->__pyx_n_u_default, __pyx_mstate->__pyx_n_u_hdr, __pyx_mstate->__pyx_n_u_r, __pyx_mstate->__pyx_n_u_bkey, __pyx_mstate->__pyx_n_u_info, __pyx_mstate->__pyx_n_u_info_id, __pyx_mstate->__pyx_n_u_value};
    __pyx_mstate_global->__pyx_codeobj_tab[222] = __Pyx_PyCode_New(descr, varnames, __pyx_mstate->__pyx_kp_u_pysam_libcbcf_pyx, __pyx_mstate->__pyx_n_u_pop, __pyx_k_q_d_WA_Qc_b_AQ_Qa_AU_Q_1_y_JdRS, tuple_dedup_map); if (unlikely(!__pyx_mstate_global->__pyx_codeobj_tab[222])) goto bad;
  }
  {
    const __Pyx_PyCode_New_function_description descr = {3, 0, 0, 6, (unsigned int)(CO_OPTIMIZED|CO_NEWLOCALS), 2840, 82};
    PyObject* const varnames[] = {__pyx_mstate->__pyx_n_u_self, __pyx_mstate->__pyx_n_u_other, __pyx_mstate->__pyx_n_u_op, __pyx_mstate->__pyx_n_u_s, __pyx_mstate->__pyx_n_u_o, __pyx_mstate->__pyx_n_u_cmp};
    __pyx_mstate_global->__pyx_codeobj_tab[223] = __Pyx_PyCode_New(descr, varnames, __pyx_mstate->__pyx_kp_u_pysam_libcbcf_pyx, __pyx_mstate->__pyx_n_u_richcmp, __pyx_k_A_3c_4s_Q_1_WA_gQ_AV3d_1_3c_a_q, tuple_dedup_map); if (unlikely(!__pyx_mstate_global->__pyx_codeobj_tab[223])) goto bad;
  }
  {
    const __Pyx_PyCode_New_function_description descr = {1, 0, 0, 4, (unsigned int)(CO_OPTIMIZED|CO_NEWLOCALS), 1, 94};
    PyObject* const varnames[] = {__pyx_mstate->__pyx_n_u_self, __pyx_mstate->__pyx_n_u_state, __pyx_mstate->__pyx_n_u_dict_2, __pyx_mstate->__pyx_n_u_use_setstate};
    __pyx_mstate_global->__pyx_codeobj_tab[224] = __Pyx_PyCode_New(descr, varnames, __pyx_mstate->__pyx_kp_u_stringsource, __pyx_mstate->__pyx_n_u_reduce_cython, __pyx_k_T_G1F_a_vWA_q_t87_q_2_awk_PQ_2, tuple_dedup_map); if (unlikely(!__pyx_mstate_global->__pyx_codeobj_tab[224])) goto bad;
  }
  {
    const __Pyx_PyCode_New_function_description descr = {2, 0, 0, 2, (unsigned int)(CO_OPTIMIZED|CO_NEWLOCALS), 16, 11};
    PyObject* const varnames[] = {__pyx_mstate->__pyx_n_u_self, __pyx_mstate->__pyx_n_u_pyx_state};
    __pyx_mstate_global->__pyx_codeobj_tab[225] = __Pyx_PyCode_New(descr, varnames, __pyx_mstate->__pyx_kp_u_stringsource, __pyx_mstate->__pyx_n_u_setstate_cython, __pyx_k_q_a, tuple_dedup_map); if (unlikely(!__pyx_mstate_global->__pyx_codeobj_tab[225])) goto bad;
  }
  {
    const __Pyx_PyCode_New_function_description descr = {1, 0, 0, 7, (unsigned int)(CO_OPTIMIZED|CO_NEWLOCALS), 2859, 42};
    PyObject* const varnames[] = {__pyx_mstate->__pyx_n_u_record, __pyx_mstate->__pyx_n_u_MAX_POS, __pyx_mstate->__pyx_n_u_VALUE_TYPES, __pyx_mstate->__pyx_n_u_METADATA_TYPES, __pyx_mstate->__pyx_n_u_METADATA_LENGTHS, __pyx_mstate->__pyx_n_u_nothing, __pyx_mstate->__pyx_n_u_bcf_str_cache};
    __pyx_mstate_global->__pyx_codeobj_tab[226] = __Pyx_PyCode_New(descr, varnames, __pyx_mstate->__pyx_kp_u_pysam_libcbcf_pyx, __pyx_mstate->__pyx_n_u_makeVariantRecordInfo, __pyx_k_t1_j_381A_1, tuple_dedup_map); if (unlikely(!__pyx_mstate_global->__pyx_codeobj_tab[226])) goto bad;
  }
  {
    const __Pyx_PyCode_New_function_description descr = {1, 0, 0, 3, (unsigned int)(CO_OPTIMIZED|CO_NEWLOCALS|CO_VARARGS|CO_VARKEYWORDS), 2871, 11};
    PyObject* const varnames[] = {__pyx_mstate->__pyx_n_u_self, __pyx_mstate->__pyx_n_u_args, __pyx_mstate->__pyx_n_u_kwargs};
    __pyx_mstate_global->__pyx_codeobj_tab[227] = __Pyx_PyCode_New(descr, varnames, __pyx_mstate->__pyx_kp_u_pysam_libcbcf_pyx, __pyx_mstate->__pyx_n_u_init, __pyx_k_A_iq, tuple_dedup_map); if (unlikely(!__pyx_mstate_global->__pyx_codeobj_tab[227])) goto bad;
  }
  {
    const __Pyx_PyCode_New_function_description descr = {1, 0, 0, 1, (unsigned int)(CO_OPTIMIZED|CO_NEWLOCALS), 2874, 13};
    PyObject* const varnames[] = {__pyx_mstate->__pyx_n_u_self};
    __pyx_mstate_global->__pyx_codeobj_tab[228] = __Pyx_PyCode_New(descr, varnames, __pyx_mstate->__pyx_kp_u_pysam_libcbcf_pyx, __pyx_mstate->__pyx_n_u_len, __pyx_k_A_t7_a, tuple_dedup_map); if (unlikely(!__pyx_mstate_global->__pyx_codeobj_tab[228])) goto bad;
  }
  {
    const __Pyx_PyCode_New_function_description descr = {1, 0, 0, 1, (unsigned int)(CO_OPTIMIZED|CO_NEWLOCALS), 2877, 17};
    PyObject* const varnames[] = {__pyx_mstate->__pyx_n_u_self};
    __pyx_mstate_global->__pyx_codeobj_tab[229] = __Pyx_PyCode_New(descr, varnames, __pyx_mstate->__pyx_kp_u_pysam_libcbcf_pyx, __pyx_mstate->__pyx_n_u_bool, __pyx_k_A_t7_j_1, tuple_dedup_map); if (unlikely(!__pyx_mstate_global->__pyx_codeobj_tab[229])) goto bad;
  }
  {
    const __Pyx_PyCode_New_function_description descr = {2, 0, 0, 9, (unsigned int)(CO_OPTIMIZED|CO_NEWLOCALS), 2880, 138};
    PyObject* const varnames[] = {__pyx_mstate->__pyx_n_u_self, __pyx_mstate->__pyx_n_u_key, __pyx_mstate->__pyx_n_u_hdr, __pyx_mstate->__pyx_n_u_r, __pyx_mstate->__pyx_n_u_n, __pyx_mstate->__pyx_n_u_sample_index, __pyx_mstate->__pyx_n_u_d, __pyx_mstate->__pyx_n_u_k, __pyx_mstate->__pyx_n_u_bkey};
    __pyx_mstate_global->__pyx_codeobj_tab[230] = __Pyx_PyCode_New(descr, varnames, __pyx_mstate->__pyx_kp_u_pysam_libcbcf_pyx, __pyx_mstate->__pyx_n_u_getitem, __pyx_k_A_d_WA_T_A_Qe1_1_aq_a_Ba_ha_8_q, tuple_dedup_map); if (unlikely(!__pyx_mstate_global->__pyx_codeobj_tab[230])) goto bad;
  }
  {
    const __Pyx_PyCode_New_function_description descr = {1, 0, 0, 5, (unsigned int)(CO_OPTIMIZED|CO_NEWLOCALS|CO_GENERATOR), 2901, 2};
    PyObject* const varnames[] = {__pyx_mstate->__pyx_n_u_self, __pyx_mstate->__pyx_n_u_hdr, __pyx_mstate->__pyx_n_u_r, __pyx_mstate->__pyx_n_u_i, __pyx_mstate->__pyx_n_u_n};
    __pyx_mstate_global->__pyx_codeobj_tab[231] = __Pyx_PyCode_New(descr, varnames, __pyx_mstate->__pyx_kp_u_pysam_libcbcf_pyx, __pyx_mstate->__pyx_n_u_iter, __pyx_k_A_3, tuple_dedup_map); if (unlikely(!__pyx_mstate_global->__pyx_codeobj_tab[231])) goto bad;
  }
  {
    const __Pyx_PyCode_New_function_description descr = {3, 0, 0, 3, (unsigned int)(CO_OPTIMIZED|CO_NEWLOCALS), 2909, 25};
    PyObject* const varnames[] = {__pyx_mstate->__pyx_n_u_self, __pyx_mstate->__pyx_n_u_key, __pyx_mstate->__pyx_n_u_default};
    __pyx_mstate_global->__pyx_codeobj_tab[232] = __Pyx_PyCode_New(descr, varnames, __pyx_mstate->__pyx_kp_u_pysam_libcbcf_pyx, __pyx_mstate->__pyx_n_u_get, __pyx_k_q_4q_1, tuple_dedup_map); if (unlikely(!__pyx_mstate_global->__pyx_codeobj_tab[232])) goto bad;
  }
  {
    const __Pyx_PyCode_New_function_description descr = {2, 0, 0, 9, (unsigned int)(CO_OPTIMIZED|CO_NEWLOCALS), 2916, 109};
    PyObject* const varnames[] = {__pyx_mstate->__pyx_n_u_self, __pyx_mstate->__pyx_n_u_key, __pyx_mstate->__pyx_n_u_hdr, __pyx_mstate->__pyx_n_u_r, __pyx_mstate->__pyx_n_u_n, __pyx_mstate->__pyx_n_u_sample_index, __pyx_mstate->__pyx_n_u_d, __pyx_mstate->__pyx_n_u_k, __pyx_mstate->__pyx_n_u_bkey};
    __pyx_mstate_global->__pyx_codeobj_tab[233] = __Pyx_PyCode_New(descr, varnames, __pyx_mstate->__pyx_kp_u_pysam_libcbcf_pyx, __pyx_mstate->__pyx_n_u_contains, __pyx_k_A_d_WA_T_A_Qe1_1_aq_a_Ba_ha_8_q_2, tuple_dedup_map); if (unlikely(!__pyx_mstate_global->__pyx_codeobj_tab[233])) goto bad;
  }
  {
    const __Pyx_PyCode_New_function_description descr = {1, 0, 0, 1, (unsigned int)(CO_OPTIMIZED|CO_NEWLOCALS), 2934, 11};
    PyObject* const varnames[] = {__pyx_mstate->__pyx_n_u_self};
    __pyx_mstate_global->__pyx_codeobj_tab[234] = __Pyx_PyCode_New(descr, varnames, __pyx_mstate->__pyx_kp_u_pysam_libcbcf_pyx, __pyx_mstate->__pyx_n_u_iterkeys, __pyx_k_A_t1A, tuple_dedup_map); if (unlikely(!__pyx_mstate_global->__pyx_codeobj_tab[234])) goto bad;
  }
  {
    const __Pyx_PyCode_New_function_description descr = {1, 0, 0, 5, (unsigned int)(CO_OPTIMIZED|CO_NEWLOCALS|CO_GENERATOR), 2938, 2};
    PyObject* const varnames[] = {__pyx_mstate->__pyx_n_u_self, __pyx_mstate->__pyx_n_u_hdr, __pyx_mstate->__pyx_n_u_r, __pyx_mstate->__pyx_n_u_i, __pyx_mstate->__pyx_n_u_n};
    __pyx_mstate_global->__pyx_codeobj_tab[235] = __Pyx_PyCode_New(descr, varnames, __pyx_mstate->__pyx_kp_u_pysam_libcbcf_pyx, __pyx_mstate->__pyx_n_u_itervalues, __pyx_k_A_3, tuple_dedup_map); if (unlikely(!__pyx_mstate_global->__pyx_codeobj_tab[235])) goto bad;
  }
  {
    const __Pyx_PyCode_New_function_description descr = {1, 0, 0, 5, (unsigned int)(CO_OPTIMIZED|CO_NEWLOCALS|CO_GENERATOR), 2947, 2};
    PyObject* const varnames[] = {__pyx_mstate->__pyx_n_u_self, __pyx_mstate->__pyx_n_u_hdr, __pyx_mstate->__pyx_n_u_r, __pyx_mstate->__pyx_n_u_i, __pyx_mstate->__pyx_n_u_n};
    __pyx_mstate_global->__pyx_codeobj_tab[236] = __Pyx_PyCode_New(descr, varnames, __pyx_mstate->__pyx_kp_u_pysam_libcbcf_pyx, __pyx_mstate->__pyx_n_u_iteritems, __pyx_k_A_3, tuple_dedup_map); if (unlikely(!__pyx_mstate_global->__pyx_codeobj_tab[236])) goto bad;
  }
  {
    const __Pyx_PyCode_New_function_description descr = {1, 0, 0, 1, (unsigned int)(CO_OPTIMIZED|CO_NEWLOCALS), 2956, 11};
    PyObject* const varnames[] = {__pyx_mstate->__pyx_n_u_self};
    __pyx_mstate_global->__pyx_codeobj_tab[237] = __Pyx_PyCode_New(descr, varnames, __pyx_mstate->__pyx_kp_u_pysam_libcbcf_pyx, __pyx_mstate->__pyx_n_u_keys, __pyx_k_A_t1A, tuple_dedup_map); if (unlikely(!__pyx_mstate_global->__pyx_codeobj_tab[237])) goto bad;
  }
  {
    const __Pyx_PyCode_New_function_description descr = {1, 0, 0, 1, (unsigned int)(CO_OPTIMIZED|CO_NEWLOCALS), 2960, 15};
    PyObject* const varnames[] = {__pyx_mstate->__pyx_n_u_self};
    __pyx_mstate_global->__pyx_codeobj_tab[238] = __Pyx_PyCode_New(descr, varnames, __pyx_mstate->__pyx_kp_u_pysam_libcbcf_pyx, __pyx_mstate->__pyx_n_u_items, __pyx_k_A_t1D, tuple_dedup_map); if (unlikely(!__pyx_mstate_global->__pyx_codeobj_tab[238])) goto bad;
  }
  {
    const __Pyx_PyCode_New_function_description descr = {1, 0, 0, 1, (unsigned int)(CO_OPTIMIZED|CO_NEWLOCALS), 2964, 15};
    PyObject* const varnames[] = {__pyx_mstate->__pyx_n_u_self};
    __pyx_mstate_global->__pyx_codeobj_tab[239] = __Pyx_PyCode_New(descr, varnames, __pyx_mstate->__pyx_kp_u_pysam_libcbcf_pyx, __pyx_mstate->__pyx_n_u_values, __pyx_k_A_t1D_1, tuple_dedup_map); if (unlikely(!__pyx_mstate_global->__pyx_codeobj_tab[239])) goto bad;
  }
  {
    const __Pyx_PyCode_New_function_description descr = {2, 0, 0, 5, (unsigned int)(CO_OPTIMIZED|CO_NEWLOCALS|CO_VARKEYWORDS), 2968, 56};
    PyObject* const varnames[] = {__pyx_mstate->__pyx_n_u_self, __pyx_mstate->__pyx_n_u_items, __pyx_mstate->__pyx_n_u_kwargs, __pyx_mstate->__pyx_n_u_k, __pyx_mstate->__pyx_n_u_v};
    __pyx_mstate_global->__pyx_codeobj_tab[240] = __Pyx_PyCode_New(descr, varnames, __pyx_mstate->__pyx_kp_u_pysam_libcbcf_pyx, __pyx_mstate->__pyx_n_u_update, __pyx_k_1_CuE_q_a_1_5_fA_AU, tuple_dedup_map); if (unlikely(!__pyx_mstate_global->__pyx_codeobj_tab[240])) goto bad;
  }
  {
    const __Pyx_PyCode_New_function_description descr = {3, 0, 0, 4, (unsigned int)(CO_OPTIMIZED|CO_NEWLOCALS), 2980, 51};
    PyObject* const varnames[] = {__pyx_mstate->__pyx_n_u_self, __pyx_mstate->__pyx_n_u_key, __pyx_mstate->__pyx_n_u_default, __pyx_mstate->__pyx_n_u_value};
    __pyx_mstate_global->__pyx_codeobj_tab[241] = __Pyx_PyCode_New(descr, varnames, __pyx_mstate->__pyx_kp_u_pysam_libcbcf_pyx, __pyx_mstate->__pyx_n_u_pop, __pyx_k_q_D_AQ_1_xwa_q, tuple_dedup_map); if (unlikely(!__pyx_mstate_global->__pyx_codeobj_tab[241])) goto bad;
  }
  {
    const __Pyx_PyCode_New_function_description descr = {3, 0, 0, 6, (unsigned int)(CO_OPTIMIZED|CO_NEWLOCALS), 2990, 93};
    PyObject* const varnames[] = {__pyx_mstate->__pyx_n_u_self, __pyx_mstate->__pyx_n_u_other, __pyx_mstate->__pyx_n_u_op, __pyx_mstate->__pyx_n_u_s, __pyx_mstate->__pyx_n_u_o, __pyx_mstate->__pyx_n_u_cmp};
    __pyx_mstate_global->__pyx_codeobj_tab[242] = __Pyx_PyCode_New(descr, varnames, __pyx_mstate->__pyx_kp_u_pysam_libcbcf_pyx, __pyx_mstate->__pyx_n_u_richcmp, __pyx_k_A_3c_4s_Q_1_WA_gQ_Cq_d_CuGST_3c, tuple_dedup_map); if (unlikely(!__pyx_mstate_global->__pyx_codeobj_tab[242])) goto bad;
  }
  {
    const __Pyx_PyCode_New_function_description descr = {1, 0, 0, 4, (unsigned int)(CO_OPTIMIZED|CO_NEWLOCALS), 1, 94};
    PyObject* const varnames[] = {__pyx_mstate->__pyx_n_u_self, __pyx_mstate->__pyx_n_u_state, __pyx_mstate->__pyx_n_u_dict_2, __pyx_mstate->__pyx_n_u_use_setstate};
    __pyx_mstate_global->__pyx_codeobj_tab[243] = __Pyx_PyCode_New(descr, varnames, __pyx_mstate->__pyx_kp_u_stringsource, __pyx_mstate->__pyx_n_u_reduce_cython, __pyx_k_T_G1F_a_vWA_q_t87_q_5T_GST_5T_A, tuple_dedup_map); if (unlikely(!__pyx_mstate_global->__pyx_codeobj_tab[243])) goto bad;
  }
  {
    const __Pyx_PyCode_New_function_description descr = {2, 0, 0, 2, (unsigned int)(CO_OPTIMIZED|CO_NEWLOCALS), 16, 11};
    PyObject* const varnames[] = {__pyx_mstate->__pyx_n_u_self, __pyx_mstate->__pyx_n_u_pyx_state};
    __pyx_mstate_global->__pyx_codeobj_tab[244] = __Pyx_PyCode_New(descr, varnames, __pyx_mstate->__pyx_kp_u_stringsource, __pyx_mstate->__pyx_n_u_setstate_cython, __pyx_k_2_6, tuple_dedup_map); if (unlikely(!__pyx_mstate_global->__pyx_codeobj_tab[244])) goto bad;
  }
  {
    const __Pyx_PyCode_New_function_description descr = {1, 0, 0, 7, (unsigned int)(CO_OPTIMIZED|CO_NEWLOCALS), 3008, 43};
    PyObject* const varnames[] = {__pyx_mstate->__pyx_n_u_record, __pyx_mstate->__pyx_n_u_MAX_POS, __pyx_mstate->__pyx_n_u_VALUE_TYPES, __pyx_mstate->__pyx_n_u_METADATA_TYPES, __pyx_mstate->__pyx_n_u_METADATA_LENGTHS, __pyx_mstate->__pyx_n_u_nothing, __pyx_mstate->__pyx_n_u_bcf_str_cache};
    __pyx_mstate_global->__pyx_codeobj_tab[245] = __Pyx_PyCode_New(descr, varnames, __pyx_mstate->__pyx_kp_u_pysam_libcbcf_pyx, __pyx_mstate->__pyx_n_u_makeVariantRecordSamples, __pyx_k_t1_j_HA_Q_1, tuple_dedup_map); if (unlikely(!__pyx_mstate_global->__pyx_codeobj_tab[245])) goto bad;
  }
  {
    const __Pyx_PyCode_New_function_description descr = {1, 0, 0, 3, (unsigned int)(CO_OPTIMIZED|CO_NEWLOCALS|CO_VARARGS|CO_VARKEYWORDS), 3021, 11};
    PyObject* const varnames[] = {__pyx_mstate->__pyx_n_u_self, __pyx_mstate->__pyx_n_u_args, __pyx_mstate->__pyx_n_u_kwargs};
    __pyx_mstate_global->__pyx_codeobj_tab[246] = __Pyx_PyCode_New(descr, varnames, __pyx_mstate->__pyx_kp_u_pysam_libcbcf_pyx, __pyx_mstate->__pyx_n_u_init, __pyx_k_A_iq, tuple_dedup_map); if (unlikely(!__pyx_mstate_global->__pyx_codeobj_tab[246])) goto bad;
  }
  {
    const __Pyx_PyCode_New_function_description descr = {1, 0, 0, 1, (unsigned int)(CO_OPTIMIZED|CO_NEWLOCALS), 3024, 25};
    PyObject* const varnames[] = {__pyx_mstate->__pyx_n_u_self};
    __pyx_mstate_global->__pyx_codeobj_tab[247] = __Pyx_PyCode_New(descr, varnames, __pyx_mstate->__pyx_kp_u_pysam_libcbcf_pyx, __pyx_mstate->__pyx_n_u_dealloc, __pyx_k_A_4q_Q_q, tuple_dedup_map); if (unlikely(!__pyx_mstate_global->__pyx_codeobj_tab[247])) goto bad;
  }
  {
    const __Pyx_PyCode_New_function_description descr = {1, 0, 0, 1, (unsigned int)(CO_OPTIMIZED|CO_NEWLOCALS), 3029, 22};
    PyObject* const varnames[] = {__pyx_mstate->__pyx_n_u_self};
    __pyx_mstate_global->__pyx_codeobj_tab[248] = __Pyx_PyCode_New(descr, varnames, __pyx_mstate->__pyx_kp_u_pysam_libcbcf_pyx, __pyx_mstate->__pyx_n_u_copy, __pyx_k_A_YgQd, tuple_dedup_map); if (unlikely(!__pyx_mstate_global->__pyx_codeobj_tab[248])) goto bad;
  }
  {
    const __Pyx_PyCode_New_function_description descr = {2, 0, 0, 5, (unsigned int)(CO_OPTIMIZED|CO_NEWLOCALS), 3033, 115};
    PyObject* const varnames[] = {__pyx_mstate->__pyx_n_u_self, __pyx_mstate->__pyx_n_u_dst_header, __pyx_mstate->__pyx_n_u_src_hdr, __pyx_mstate->__pyx_n_u_dst_hdr, __pyx_mstate->__pyx_n_u_msg};
    __pyx_mstate_global->__pyx_codeobj_tab[249] = __Pyx_PyCode_New(descr, varnames, __pyx_mstate->__pyx_kp_u_pysam_libcbcf_pyx, __pyx_mstate->__pyx_n_u_translate, __pyx_k_A_c_AQ_gQ_A_83a_t4z_4AQ_a_j_G1D, tuple_dedup_map); if (unlikely(!__pyx_mstate_global->__pyx_codeobj_tab[249])) goto bad;
  }
  {
    const __Pyx_PyCode_New_function_description descr = {1, 0, 0, 1, (unsigned int)(CO_OPTIMIZED|CO_NEWLOCALS), 3048, 13};
    PyObject* const varnames[] = {__pyx_mstate->__pyx_n_u_self};
    __pyx_mstate_global->__pyx_codeobj_tab[250] = __Pyx_PyCode_New(descr, varnames, __pyx_mstate->__pyx_kp_u_pysam_libcbcf_pyx, __pyx_mstate->__pyx_n_u_get_2, __pyx_k_A_t4q, tuple_dedup_map); if (unlikely(!__pyx_mstate_global->__pyx_codeobj_tab[250])) goto bad;
  }
  {
    const __Pyx_PyCode_New_function_description descr = {2, 0, 0, 4, (unsigned int)(CO_OPTIMIZED|CO_NEWLOCALS), 3053, 75};
    PyObject* const varnames[] = {__pyx_mstate->__pyx_n_u_self, __pyx_mstate->__pyx_n_u_value, __pyx_mstate->__pyx_n_u_hdr, __pyx_mstate->__pyx_n_u_r};
    __pyx_mstate_global->__pyx_codeobj_tab[251] = __Pyx_PyCode_New(descr, varnames, __pyx_mstate->__pyx_kp_u_pysam_libcbcf_pyx, __pyx_mstate->__pyx_n_u_set, __pyx_k_A_d_Q_2Rr_Bc_Ba_3d_S_ARq_AQ_D_q, tuple_dedup_map); if (unlikely(!__pyx_mstate_global->__pyx_codeobj_tab[251])) goto bad;
  }
  {
    const __Pyx_PyCode_New_function_description descr = {1, 0, 0, 3, (unsigned int)(CO_OPTIMIZED|CO_NEWLOCALS), 3061, 70};
    PyObject* const varnames[] = {__pyx_mstate->__pyx_n_u_self, __pyx_mstate->__pyx_n_u_hdr, __pyx_mstate->__pyx_n_u_rid};
    __pyx_mstate_global->__pyx_codeobj_tab[252] = __Pyx_PyCode_New(descr, varnames, __pyx_mstate->__pyx_kp_u_pysam_libcbcf_pyx, __pyx_mstate->__pyx_n_u_get_2, __pyx_k_A_d_t4q_4r_3d_S_1_AQ_a, tuple_dedup_map); if (unlikely(!__pyx_mstate_global->__pyx_codeobj_tab[252])) goto bad;
  }
  {
    const __Pyx_PyCode_New_function_description descr = {2, 0, 0, 5, (unsigned int)(CO_OPTIMIZED|CO_NEWLOCALS), 3070, 78};
    PyObject* const varnames[] = {__pyx_mstate->__pyx_n_u_self, __pyx_mstate->__pyx_n_u_value, __pyx_mstate->__pyx_n_u_d, __pyx_mstate->__pyx_n_u_bchrom, __pyx_mstate->__pyx_n_u_k};
    __pyx_mstate_global->__pyx_codeobj_tab[253] = __Pyx_PyCode_New(descr, varnames, __pyx_mstate->__pyx_kp_u_pysam_libcbcf_pyx, __pyx_mstate->__pyx_n_u_set, __pyx_k_A_D_t5_AQ_Qc_2S_aq_AQ_D_1Cr, tuple_dedup_map); if (unlikely(!__pyx_mstate_global->__pyx_codeobj_tab[253])) goto bad;
  }
  {
    const __Pyx_PyCode_New_function_description descr = {1, 0, 0, 3, (unsigned int)(CO_OPTIMIZED|CO_NEWLOCALS), 3079, 70};
    PyObject* const varnames[] = {__pyx_mstate->__pyx_n_u_self, __pyx_mstate->__pyx_n_u_hdr, __pyx_mstate->__pyx_n_u_rid};
    __pyx_mstate_global->__pyx_codeobj_tab[254] = __Pyx_PyCode_New(descr, varnames, __pyx_mstate->__pyx_kp_u_pysam_libcbcf_pyx, __pyx_mstate->__pyx_n_u_get_2, __pyx_k_A_d_t4q_4r_3d_S_1_AQ_a, tuple_dedup_map); if (unlikely(!__pyx_mstate_global->__pyx_codeobj_tab[254])) goto bad;
  }
  {
    const __Pyx_PyCode_New_function_description descr = {2, 0, 0, 5, (unsigned int)(CO_OPTIMIZED|CO_NEWLOCALS), 3088, 78};
    PyObject* const varnames[] = {__pyx_mstate->__pyx_n_u_self, __pyx_mstate->__pyx_n_u_value, __pyx_mstate->__pyx_n_u_d, __pyx_mstate->__pyx_n_u_bchrom, __pyx_mstate->__pyx_n_u_k};
    __pyx_mstate_global->__pyx_codeobj_tab[255] = __Pyx_PyCode_New(descr, varnames, __pyx_mstate->__pyx_kp_u_pysam_libcbcf_pyx, __pyx_mstate->__pyx_n_u_set, __pyx_k_A_D_t5_AQ_Qc_2S_aq_AQ_D_1Cr, tuple_dedup_map); if (unlikely(!__pyx_mstate_global->__pyx_codeobj_tab[255])) goto bad;
  }
  {
    const __Pyx_PyCode_New_function_description descr = {1, 0, 0, 1, (unsigned int)(CO_OPTIMIZED|CO_NEWLOCALS), 3097, 17};
    PyObject* const varnames[] = {__pyx_mstate->__pyx_n_u_self};
    __pyx_mstate_global->__pyx_codeobj_tab[256] = __Pyx_PyCode_New(descr, varnames, __pyx_mstate->__pyx_kp_u_pysam_libcbcf_pyx, __pyx_mstate->__pyx_n_u_get_2, __pyx_k_A_t4uBa, tuple_dedup_map); if (unlikely(!__pyx_mstate_global->__pyx_codeobj_tab[256])) goto bad;
  }
  {
    const __Pyx_PyCode_New_function_description descr = {2, 0, 0, 3, (unsigned int)(CO_OPTIMIZED|CO_NEWLOCALS), 3102, 45};
    PyObject* const varnames[] = {__pyx_mstate->__pyx_n_u_self, __pyx_mstate->__pyx_n_u_value, __pyx_mstate->__pyx_n_u_p};
    __pyx_mstate_global->__pyx_codeobj_tab[257] = __Pyx_PyCode_New(descr, varnames, __pyx_mstate->__pyx_kp_u_pysam_libcbcf_pyx, __pyx_mstate->__pyx_n_u_set, __pyx_k_A_Q_2Rq_AQ_D_r_1_AQ, tuple_dedup_map); if (unlikely(!__pyx_mstate_global->__pyx_codeobj_tab[257])) goto bad;
  }
  {
    const __Pyx_PyCode_New_function_description descr = {1, 0, 0, 1, (unsigned int)(CO_OPTIMIZED|CO_NEWLOCALS), 3110, 13};
    PyObject* const varnames[] = {__pyx_mstate->__pyx_n_u_self};
    __pyx_mstate_global->__pyx_codeobj_tab[258] = __Pyx_PyCode_New(descr, varnames, __pyx_mstate->__pyx_kp_u_pysam_libcbcf_pyx, __pyx_mstate->__pyx_n_u_get_2, __pyx_k_A_t4q, tuple_dedup_map); if (unlikely(!__pyx_mstate_global->__pyx_codeobj_tab[258])) goto bad;
  }
  {
    const __Pyx_PyCode_New_function_description descr = {2, 0, 0, 3, (unsigned int)(CO_OPTIMIZED|CO_NEWLOCALS), 3115, 41};
    PyObject* const varnames[] = {__pyx_mstate->__pyx_n_u_self, __pyx_mstate->__pyx_n_u_value, __pyx_mstate->__pyx_n_u_s};
    __pyx_mstate_global->__pyx_codeobj_tab[259] = __Pyx_PyCode_New(descr, varnames, __pyx_mstate->__pyx_kp_u_pysam_libcbcf_pyx, __pyx_mstate->__pyx_n_u_set, __pyx_k_A_Q_2Rq_AQ_D_q_AQ, tuple_dedup_map); if (unlikely(!__pyx_mstate_global->__pyx_codeobj_tab[259])) goto bad;
  }
  {
    const __Pyx_PyCode_New_function_description descr = {1, 0, 0, 1, (unsigned int)(CO_OPTIMIZED|CO_NEWLOCALS), 3123, 21};
    PyObject* const varnames[] = {__pyx_mstate->__pyx_n_u_self};
    __pyx_mstate_global->__pyx_codeobj_tab[260] = __Pyx_PyCode_New(descr, varnames, __pyx_mstate->__pyx_kp_u_pysam_libcbcf_pyx, __pyx_mstate->__pyx_n_u_get_2, __pyx_k_A_t4uBd_a, tuple_dedup_map); if (unlikely(!__pyx_mstate_global->__pyx_codeobj_tab[260])) goto bad;
  }
  {
    const __Pyx_PyCode_New_function_description descr = {2, 0, 0, 3, (unsigned int)(CO_OPTIMIZED|CO_NEWLOCALS), 3128, 49};
    PyObject* const varnames[] = {__pyx_mstate->__pyx_n_u_self, __pyx_mstate->__pyx_n_u_value, __pyx_mstate->__pyx_n_u_s};
    __pyx_mstate_global->__pyx_codeobj_tab[261] = __Pyx_PyCode_New(descr, varnames, __pyx_mstate->__pyx_kp_u_pysam_libcbcf_pyx, __pyx_mstate->__pyx_n_u_set, __pyx_k_A_Q_2Rq_AQ_D_D_A_AQ, tuple_dedup_map); if (unlikely(!__pyx_mstate_global->__pyx_codeobj_tab[261])) goto bad;
  }
  {
    const __Pyx_PyCode_New_function_description descr = {1, 0, 0, 1, (unsigned int)(CO_OPTIMIZED|CO_NEWLOCALS), 3136, 13};
    PyObject* const varnames[] = {__pyx_mstate->__pyx_n_u_self};
    __pyx_mstate_global->__pyx_codeobj_tab[262] = __Pyx_PyCode_New(descr, varnames, __pyx_mstate->__pyx_kp_u_pysam_libcbcf_pyx, __pyx_mstate->__pyx_n_u_get_2, __pyx_k_A_t4q, tuple_dedup_map); if (unlikely(!__pyx_mstate_global->__pyx_codeobj_tab[262])) goto bad;
  }
  {
    const __Pyx_PyCode_New_function_description descr = {2, 0, 0, 3, (unsigned int)(CO_OPTIMIZED|CO_NEWLOCALS), 3141, 23};
    PyObject* const varnames[] = {__pyx_mstate->__pyx_n_u_self, __pyx_mstate->__pyx_n_u_value, __pyx_mstate->__pyx_n_u_r};
    __pyx_mstate_global->__pyx_codeobj_tab[263] = __Pyx_PyCode_New(descr, varnames, __pyx_mstate->__pyx_kp_u_pysam_libcbcf_pyx, __pyx_mstate->__pyx_n_u_set, __pyx_k_A_Q_D_AQ, tuple_dedup_map); if (unlikely(!__pyx_mstate_global->__pyx_codeobj_tab[263])) goto bad;
  }
  {
    const __Pyx_PyCode_New_function_description descr = {1, 0, 0, 1, (unsigned int)(CO_OPTIMIZED|CO_NEWLOCALS), 3147, 28};
    PyObject* const varnames[] = {__pyx_mstate->__pyx_n_u_self};
    __pyx_mstate_global->__pyx_codeobj_tab[264] = __Pyx_PyCode_New(descr, varnames, __pyx_mstate->__pyx_kp_u_pysam_libcbcf_pyx, __pyx_mstate->__pyx_n_u_get_2, __pyx_k_A_t4y_8_T_Q, tuple_dedup_map); if (unlikely(!__pyx_mstate_global->__pyx_codeobj_tab[264])) goto bad;
  }
  {
    const __Pyx_PyCode_New_function_description descr = {2, 0, 0, 2, (unsigned int)(CO_OPTIMIZED|CO_NEWLOCALS), 3152, 35};
    PyObject* const varnames[] = {__pyx_mstate->__pyx_n_u_self, __pyx_mstate->__pyx_n_u_value};
    __pyx_mstate_global->__pyx_codeobj_tab[265] = __Pyx_PyCode_New(descr, varnames, __pyx_mstate->__pyx_kp_u_pysam_libcbcf_pyx, __pyx_mstate->__pyx_n_u_set, __pyx_k_A_6_HA_4t7, tuple_dedup_map); if (unlikely(!__pyx_mstate_global->__pyx_codeobj_tab[265])) goto bad;
  }
  {
    const __Pyx_PyCode_New_function_description descr = {1, 0, 0, 2, (unsigned int)(CO_OPTIMIZED|CO_NEWLOCALS), 3168, 84};
    PyObject* const varnames[] = {__pyx_mstate->__pyx_n_u_self, __pyx_mstate->__pyx_n_u_r};
    __pyx_mstate_global->__pyx_codeobj_tab[266] = __Pyx_PyCode_New(descr, varnames, __pyx_mstate->__pyx_kp_u_pysam_libcbcf_pyx, __pyx_mstate->__pyx_n_u_get_2, __pyx_k_A_Q_Qc_Rq_AQ_ARvS_AQ_Qar_D_Q, tuple_dedup_map); if (unlikely(!__pyx_mstate_global->__pyx_codeobj_tab[266])) goto bad;
  }
  {
    const __Pyx_PyCode_New_function_description descr = {2, 0, 0, 5, (unsigned int)(CO_OPTIMIZED|CO_NEWLOCALS), 3180, 93};
    PyObject* const varnames[] = {__pyx_mstate->__pyx_n_u_self, __pyx_mstate->__pyx_n_u_value, __pyx_mstate->__pyx_n_u_r, __pyx_mstate->__pyx_n_u_idstr, __pyx_mstate->__pyx_n_u_bid};
    __pyx_mstate_global->__pyx_codeobj_tab[267] = __Pyx_PyCode_New(descr, varnames, __pyx_mstate->__pyx_kp_u_pysam_libcbcf_pyx, __pyx_mstate->__pyx_n_u_set, __pyx_k_A_Q_Qc_Rq_AQ_1_6_Qa_A_WF_fG2Q_AQ, tuple_dedup_map); if (unlikely(!__pyx_mstate_global->__pyx_codeobj_tab[267])) goto bad;
  }
  {
    const __Pyx_PyCode_New_function_description descr = {1, 0, 0, 2, (unsigned int)(CO_OPTIMIZED|CO_NEWLOCALS), 3192, 60};
    PyObject* const varnames[] = {__pyx_mstate->__pyx_n_u_self, __pyx_mstate->__pyx_n_u_r};
    __pyx_mstate_global->__pyx_codeobj_tab[268] = __Pyx_PyCode_New(descr, varnames, __pyx_mstate->__pyx_kp_u_pysam_libcbcf_pyx, __pyx_mstate->__pyx_n_u_get_2, __pyx_k_A_Q_Qc_Rq_AQ_Qar, tuple_dedup_map); if (unlikely(!__pyx_mstate_global->__pyx_codeobj_tab[268])) goto bad;
  }
  {
    const __Pyx_PyCode_New_function_description descr = {2, 0, 0, 5, (unsigned int)(CO_OPTIMIZED|CO_NEWLOCALS), 3200, 132};
    PyObject* const varnames[] = {__pyx_mstate->__pyx_n_u_self, __pyx_mstate->__pyx_n_u_value, __pyx_mstate->__pyx_n_u_r, __pyx_mstate->__pyx_n_u_alleles, __pyx_mstate->__pyx_n_u_i};
    __pyx_mstate_global->__pyx_codeobj_tab[269] = __Pyx_PyCode_New(descr, varnames, __pyx_mstate->__pyx_kp_u_pysam_libcbcf_pyx, __pyx_mstate->__pyx_n_u_set, __pyx_k_A_Q_Qc_Rq_AQ_4q_AQ_1A_1Bhd_1_aq, tuple_dedup_map); if (unlikely(!__pyx_mstate_global->__pyx_codeobj_tab[269])) goto bad;
  }
  {
    const __Pyx_PyCode_New_function_description descr = {1, 0, 0, 5, (unsigned int)(CO_OPTIMIZED|CO_NEWLOCALS), 3217, 115};
    PyObject* const varnames[] = {__pyx_mstate->__pyx_n_u_self, __pyx_mstate->__pyx_n_u_r, __pyx_mstate->__pyx_n_u_res, __pyx_mstate->__pyx_n_u_i, __pyx_mstate->__pyx_n_u_a};
    __pyx_mstate_global->__pyx_codeobj_tab[270] = __Pyx_PyCode_New(descr, varnames, __pyx_mstate->__pyx_kp_u_pysam_libcbcf_pyx, __pyx_mstate->__pyx_n_u_get_2, __pyx_k_A_Q_Qc_Rq_AQ_4q_1_AQa_E_aq_aq_AU, tuple_dedup_map); if (unlikely(!__pyx_mstate_global->__pyx_codeobj_tab[270])) goto bad;
  }
  {
    const __Pyx_PyCode_New_function_description descr = {2, 0, 0, 6, (unsigned int)(CO_OPTIMIZED|CO_NEWLOCALS), 3232, 195};
    PyObject* const varnames[] = {__pyx_mstate->__pyx_n_u_self, __pyx_mstate->__pyx_n_u_values, __pyx_mstate->__pyx_n_u_r, __pyx_mstate->__pyx_n_u_rlen, __pyx_mstate->__pyx_n_u_value, __pyx_mstate->__pyx_n_u_v};
    __pyx_mstate_global->__pyx_codeobj_tab[271] = __Pyx_PyCode_New(descr, varnames, __pyx_mstate->__pyx_kp_u_pysam_libcbcf_pyx, __pyx_mstate->__pyx_n_u_set, __pyx_k_A_Q_Qc_Rq_AQ_Qc_U_3axr_AQ_4s_AQ, tuple_dedup_map); if (unlikely(!__pyx_mstate_global->__pyx_codeobj_tab[271])) goto bad;
  }
  {
    const __Pyx_PyCode_New_function_description descr = {1, 0, 0, 5, (unsigned int)(CO_OPTIMIZED|CO_NEWLOCALS), 3263, 135};
    PyObject* const varnames[] = {__pyx_mstate->__pyx_n_u_self, __pyx_mstate->__pyx_n_u_r, __pyx_mstate->__pyx_n_u_res, __pyx_mstate->__pyx_n_u_i, __pyx_mstate->__pyx_n_u_a};
    __pyx_mstate_global->__pyx_codeobj_tab[272] = __Pyx_PyCode_New(descr, varnames, __pyx_mstate->__pyx_kp_u_pysam_libcbcf_pyx, __pyx_mstate->__pyx_n_u_get_2, __pyx_k_A_Q_Qc_Rq_AQ_1Jb_T_A_1_AQj_E_as, tuple_dedup_map); if (unlikely(!__pyx_mstate_global->__pyx_codeobj_tab[272])) goto bad;
  }
  {
    const __Pyx_PyCode_New_function_description descr = {2, 0, 0, 5, (unsigned int)(CO_OPTIMIZED|CO_NEWLOCALS), 3278, 119};
    PyObject* const varnames[] = {__pyx_mstate->__pyx_n_u_self, __pyx_mstate->__pyx_n_u_value, __pyx_mstate->__pyx_n_u_r, __pyx_mstate->__pyx_n_u_ref, __pyx_mstate->__pyx_n_u_v};
    __pyx_mstate_global->__pyx_codeobj_tab[273] = __Pyx_PyCode_New(descr, varnames, __pyx_mstate->__pyx_kp_u_pysam_libcbcf_pyx, __pyx_mstate->__pyx_n_u_set, __pyx_k_A_Q_Qc_Rq_AQ_AS_E_4s_AQ_q_7_6_HD, tuple_dedup_map); if (unlikely(!__pyx_mstate_global->__pyx_codeobj_tab[273])) goto bad;
  }
  {
    const __Pyx_PyCode_New_function_description descr = {1, 0, 0, 1, (unsigned int)(CO_OPTIMIZED|CO_NEWLOCALS), 3291, 40};
    PyObject* const varnames[] = {__pyx_mstate->__pyx_n_u_self};
    __pyx_mstate_global->__pyx_codeobj_tab[274] = __Pyx_PyCode_New(descr, varnames, __pyx_mstate->__pyx_kp_u_pysam_libcbcf_pyx, __pyx_mstate->__pyx_n_u_get_2, __pyx_k_A_Qd_Ba_AQ_aq, tuple_dedup_map); if (unlikely(!__pyx_mstate_global->__pyx_codeobj_tab[274])) goto bad;
  }
  {
    const __Pyx_PyCode_New_function_description descr = {1, 0, 0, 1, (unsigned int)(CO_OPTIMIZED|CO_NEWLOCALS), 3298, 40};
    PyObject* const varnames[] = {__pyx_mstate->__pyx_n_u_self};
    __pyx_mstate_global->__pyx_codeobj_tab[275] = __Pyx_PyCode_New(descr, varnames, __pyx_mstate->__pyx_kp_u_pysam_libcbcf_pyx, __pyx_mstate->__pyx_n_u_get_2, __pyx_k_A_Qd_Rq_AQ_AQ, tuple_dedup_map); if (unlikely(!__pyx_mstate_global->__pyx_codeobj_tab[275])) goto bad;
  }
  {
    const __Pyx_PyCode_New_function_description descr = {1, 0, 0, 1, (unsigned int)(CO_OPTIMIZED|CO_NEWLOCALS), 3305, 40};
    PyObject* const varnames[] = {__pyx_mstate->__pyx_n_u_self};
    __pyx_mstate_global->__pyx_codeobj_tab[276] = __Pyx_PyCode_New(descr, varnames, __pyx_mstate->__pyx_kp_u_pysam_libcbcf_pyx, __pyx_mstate->__pyx_n_u_get_2, __pyx_k_A_Qd_Ba_AQ_aq, tuple_dedup_map); if (unlikely(!__pyx_mstate_global->__pyx_codeobj_tab[276])) goto bad;
  }
  {
    const __Pyx_PyCode_New_function_description descr = {1, 0, 0, 1, (unsigned int)(CO_OPTIMIZED|CO_NEWLOCALS), 3312, 40};
    PyObject* const varnames[] = {__pyx_mstate->__pyx_n_u_self};
    __pyx_mstate_global->__pyx_codeobj_tab[277] = __Pyx_PyCode_New(descr, varnames, __pyx_mstate->__pyx_kp_u_pysam_libcbcf_pyx, __pyx_mstate->__pyx_n_u_get_2, __pyx_k_A_Qd_Ba_AQ_q, tuple_dedup_map); if (unlikely(!__pyx_mstate_global->__pyx_codeobj_tab[277])) goto bad;
  }
  {
    const __Pyx_PyCode_New_function_description descr = {1, 0, 0, 6, (unsigned int)(CO_OPTIMIZED|CO_NEWLOCALS), 3320, 147};
    PyObject* const varnames[] = {__pyx_mstate->__pyx_n_u_self, __pyx_mstate->__pyx_n_u_r, __pyx_mstate->__pyx_n_u_result, __pyx_mstate->__pyx_n_u_i, __pyx_mstate->__pyx_n_u_tp, __pyx_mstate->__pyx_n_u_v_type};
    __pyx_mstate_global->__pyx_codeobj_tab[278] = __Pyx_PyCode_New(descr, varnames, __pyx_mstate->__pyx_kp_u_pysam_libcbcf_pyx, __pyx_mstate->__pyx_n_u_get_2, __pyx_k_T_1AQ_U_1A_Q_3c_Q_1_Q_1_Q_1_Q_1, tuple_dedup_map); if (unlikely(!__pyx_mstate_global->__pyx_codeobj_tab[278])) goto bad;
  }
  {
    const __Pyx_PyCode_New_function_description descr = {3, 0, 0, 6, (unsigned int)(CO_OPTIMIZED|CO_NEWLOCALS), 3347, 237};
    PyObject* const varnames[] = {__pyx_mstate->__pyx_n_u_self, __pyx_mstate->__pyx_n_u_other, __pyx_mstate->__pyx_n_u_op, __pyx_mstate->__pyx_n_u_s, __pyx_mstate->__pyx_n_u_o, __pyx_mstate->__pyx_n_u_cmp};
    __pyx_mstate_global->__pyx_codeobj_tab[279] = __Pyx_PyCode_New(descr, varnames, __pyx_mstate->__pyx_kp_u_pysam_libcbcf_pyx, __pyx_mstate->__pyx_n_u_richcmp, __pyx_k_A_3c_4s_Q_1_Q_a_S_a_l_Qa_Ql_Qa_2, tuple_dedup_map); if (unlikely(!__pyx_mstate_global->__pyx_codeobj_tab[279])) goto bad;
  }
  {
    const __Pyx_PyCode_New_function_description descr = {1, 0, 0, 4, (unsigned int)(CO_OPTIMIZED|CO_NEWLOCALS), 3373, 111};
    PyObject* const varnames[] = {__pyx_mstate->__pyx_n_u_self, __pyx_mstate->__pyx_n_u_line, __pyx_mstate->__pyx_n_u_c, __pyx_mstate->__pyx_n_u_ret};
    __pyx_mstate_global->__pyx_codeobj_tab[280] = __Pyx_PyCode_New(descr, varnames, __pyx_mstate->__pyx_kp_u_pysam_libcbcf_pyx, __pyx_mstate->__pyx_n_u_str, __pyx_k_A_E_U_E_Qd_t6_t1_AT_AQ_4t4q_4q_Q, tuple_dedup_map); if (unlikely(!__pyx_mstate_global->__pyx_codeobj_tab[280])) goto bad;
  }
  {
    const __Pyx_PyCode_New_function_description descr = {1, 0, 0, 1, (unsigned int)(CO_OPTIMIZED|CO_NEWLOCALS), 81, 2};
    PyObject* const varnames[] = {__pyx_mstate->__pyx_n_u_self};
    __pyx_mstate_global->__pyx_codeobj_tab[281] = __Pyx_PyCode_New(descr, varnames, __pyx_mstate->__pyx_kp_u_pysam_libcbcf_pxd, __pyx_mstate->__pyx_n_u_get_2, __pyx_k__14, tuple_dedup_map); if (unlikely(!__pyx_mstate_global->__pyx_codeobj_tab[281])) goto bad;
  }
  {
    const __Pyx_PyCode_New_function_description descr = {1, 0, 0, 1, (unsigned int)(CO_OPTIMIZED|CO_NEWLOCALS), 1, 9};
    PyObject* const varnames[] = {__pyx_mstate->__pyx_n_u_self};
    __pyx_mstate_global->__pyx_codeobj_tab[282] = __Pyx_PyCode_New(descr, varnames, __pyx_mstate->__pyx_kp_u_stringsource, __pyx_mstate->__pyx_n_u_reduce_cython, __pyx_k_Q, tuple_dedup_map); if (unlikely(!__pyx_mstate_global->__pyx_codeobj_tab[282])) goto bad;
  }
  {
    const __Pyx_PyCode_New_function_description descr = {2, 0, 0, 2, (unsigned int)(CO_OPTIMIZED|CO_NEWLOCALS), 3, 9};
    PyObject* const varnames[] = {__pyx_mstate->__pyx_n_u_self, __pyx_mstate->__pyx_n_u_pyx_state};
    __pyx_mstate_global->__pyx_codeobj_tab[283] = __Pyx_PyCode_New(descr, varnames, __pyx_mstate->__pyx_kp_u_stringsource, __pyx_mstate->__pyx_n_u_setstate_cython, __pyx_k_Q, tuple_dedup_map); if (unlikely(!__pyx_mstate_global->__pyx_codeobj_tab[283])) goto bad;
  }
  {
    const __Pyx_PyCode_New_function_description descr = {2, 0, 0, 8, (unsigned int)(CO_OPTIMIZED|CO_NEWLOCALS), 3400, 210};
    PyObject* const varnames[] = {__pyx_mstate->__pyx_n_u_header, __pyx_mstate->__pyx_n_u_r, __pyx_mstate->__pyx_n_u_MAX_POS, __pyx_mstate->__pyx_n_u_VALUE_TYPES, __pyx_mstate->__pyx_n_u_METADATA_TYPES, __pyx_mstate->__pyx_n_u_METADATA_LENGTHS, __pyx_mstate->__pyx_n_u_nothing, __pyx_mstate->__pyx_n_u_bcf_str_cache};
    __pyx_mstate_global->__pyx_codeobj_tab[284] = __Pyx_PyCode_New(descr, varnames, __pyx_mstate->__pyx_kp_u_pysam_libcbcf_pyx, __pyx_mstate->__pyx_n_u_makeVariantRecord, __pyx_k_t1_j_t1_j_q_a_1IRq_waq_1IRq_waq, tuple_dedup_map); if (unlikely(!__pyx_mstate_global->__pyx_codeobj_tab[284])) goto bad;
  }
  {
    const __Pyx_PyCode_New_function_description descr = {1, 0, 0, 3, (unsigned int)(CO_OPTIMIZED|CO_NEWLOCALS|CO_VARARGS|CO_VARKEYWORDS), 3446, 11};
    PyObject* const varnames[] = {__pyx_mstate->__pyx_n_u_self, __pyx_mstate->__pyx_n_u_args, __pyx_mstate->__pyx_n_u_kwargs};
    __pyx_mstate_global->__pyx_codeobj_tab[285] = __Pyx_PyCode_New(descr, varnames, __pyx_mstate->__pyx_kp_u_pysam_libcbcf_pyx, __pyx_mstate->__pyx_n_u_init, __pyx_k_A_iq, tuple_dedup_map); if (unlikely(!__pyx_mstate_global->__pyx_codeobj_tab[285])) goto bad;
  }
  {
    const __Pyx_PyCode_New_function_description descr = {1, 0, 0, 4, (unsigned int)(CO_OPTIMIZED|CO_NEWLOCALS), 3449, 78};
    PyObject* const varnames[] = {__pyx_mstate->__pyx_n_u_self, __pyx_mstate->__pyx_n_u_hdr, __pyx_mstate->__pyx_n_u_r, __pyx_mstate->__pyx_n_u_n};
    __pyx_mstate_global->__pyx_codeobj_tab[286] = __Pyx_PyCode_New(descr, varnames, __pyx_mstate->__pyx_kp_u_pysam_libcbcf_pyx, __pyx_mstate->__pyx_n_u_get_2, __pyx_k_A_d_WA_4wb_T_1_AQ_Qc_a, tuple_dedup_map); if (unlikely(!__pyx_mstate_global->__pyx_codeobj_tab[286])) goto bad;
  }
  {
    const __Pyx_PyCode_New_function_description descr = {1, 0, 0, 1, (unsigned int)(CO_OPTIMIZED|CO_NEWLOCALS), 3461, 14};
    PyObject* const varnames[] = {__pyx_mstate->__pyx_n_u_self};
    __pyx_mstate_global->__pyx_codeobj_tab[287] = __Pyx_PyCode_New(descr, varnames, __pyx_mstate->__pyx_kp_u_pysam_libcbcf_pyx, __pyx_mstate->__pyx_n_u_get_2, __pyx_k_A_AQ, tuple_dedup_map); if (unlikely(!__pyx_mstate_global->__pyx_codeobj_tab[287])) goto bad;
  }
  {
    const __Pyx_PyCode_New_function_description descr = {2, 0, 0, 2, (unsigned int)(CO_OPTIMIZED|CO_NEWLOCALS), 3466, 11};
    PyObject* const varnames[] = {__pyx_mstate->__pyx_n_u_self, __pyx_mstate->__pyx_n_u_value};
    __pyx_mstate_global->__pyx_codeobj_tab[288] = __Pyx_PyCode_New(descr, varnames, __pyx_mstate->__pyx_kp_u_pysam_libcbcf_pyx, __pyx_mstate->__pyx_n_u_set, __pyx_k_A_AXQ, tuple_dedup_map); if (unlikely(!__pyx_mstate_global->__pyx_codeobj_tab[288])) goto bad;
  }
  {
    const __Pyx_PyCode_New_function_description descr = {1, 0, 0, 1, (unsigned int)(CO_OPTIMIZED|CO_NEWLOCALS), 3470, 11};
    PyObject* const varnames[] = {__pyx_mstate->__pyx_n_u_self};
    __pyx_mstate_global->__pyx_codeobj_tab[289] = __Pyx_PyCode_New(descr, varnames, __pyx_mstate->__pyx_kp_u_pysam_libcbcf_pyx, __pyx_mstate->__pyx_n_u_del, __pyx_k_A_AXQ, tuple_dedup_map); if (unlikely(!__pyx_mstate_global->__pyx_codeobj_tab[289])) goto bad;
  }
  {
    const __Pyx_PyCode_New_function_description descr = {1, 0, 0, 1, (unsigned int)(CO_OPTIMIZED|CO_NEWLOCALS), 3474, 14};
    PyObject* const varnames[] = {__pyx_mstate->__pyx_n_u_self};
    __pyx_mstate_global->__pyx_codeobj_tab[290] = __Pyx_PyCode_New(descr, varnames, __pyx_mstate->__pyx_kp_u_pysam_libcbcf_pyx, __pyx_mstate->__pyx_n_u_get_2, __pyx_k_A_Qa, tuple_dedup_map); if (unlikely(!__pyx_mstate_global->__pyx_codeobj_tab[290])) goto bad;
  }
  {
    const __Pyx_PyCode_New_function_description descr = {0, 0, 0, 1, (unsigned int)(CO_OPTIMIZED|CO_NEWLOCALS|CO_GENERATOR), 3489, 2};
    PyObject* const varnames[] = {__pyx_mstate->__pyx_n_u_x};
    __pyx_mstate_global->__pyx_codeobj_tab[291] = __Pyx_PyCode_New(descr, varnames, __pyx_mstate->__pyx_kp_u_pysam_libcbcf_pyx, __pyx_mstate->__pyx_n_u_genexpr, __pyx_k__15, tuple_dedup_map); if (unlikely(!__pyx_mstate_global->__pyx_codeobj_tab[291])) goto bad;
  }
  {
    const __Pyx_PyCode_New_function_description descr = {0, 0, 0, 1, (unsigned int)(CO_OPTIMIZED|CO_NEWLOCALS|CO_GENERATOR), 3494, 2};
    PyObject* const varnames[] = {__pyx_mstate->__pyx_n_u_allele};
    __pyx_mstate_global->__pyx_codeobj_tab[292] = __Pyx_PyCode_New(descr, varnames, __pyx_mstate->__pyx_kp_u_pysam_libcbcf_pyx, __pyx_mstate->__pyx_n_u_genexpr, __pyx_k__16, tuple_dedup_map); if (unlikely(!__pyx_mstate_global->__pyx_codeobj_tab[292])) goto bad;
  }
  {
    const __Pyx_PyCode_New_function_description descr = {2, 0, 0, 5, (unsigned int)(CO_OPTIMIZED|CO_NEWLOCALS), 3479, 88};
    PyObject* const varnames[] = {__pyx_mstate->__pyx_n_u_self, __pyx_mstate->__pyx_n_u_value, __pyx_mstate->__pyx_n_u_genexpr, __pyx_mstate->__pyx_n_u_genexpr, __pyx_mstate->__pyx_n_u_genexpr};
    __pyx_mstate_global->__pyx_codeobj_tab[293] = __Pyx_PyCode_New(descr, varnames, __pyx_mstate->__pyx_kp_u_pysam_libcbcf_pyx, __pyx_mstate->__pyx_n_u_set, __pyx_k_A_5_7_U_E_CvS_AQ_AQ, tuple_dedup_map); if (unlikely(!__pyx_mstate_global->__pyx_codeobj_tab[293])) goto bad;
  }
  {
    const __Pyx_PyCode_New_function_description descr = {1, 0, 0, 1, (unsigned int)(CO_OPTIMIZED|CO_NEWLOCALS), 3499, 11};
    PyObject* const varnames[] = {__pyx_mstate->__pyx_n_u_self};
    __pyx_mstate_global->__pyx_codeobj_tab[294] = __Pyx_PyCode_New(descr, varnames, __pyx_mstate->__pyx_kp_u_pysam_libcbcf_pyx, __pyx_mstate->__pyx_n_u_del, __pyx_k_A_AXQ, tuple_dedup_map); if (unlikely(!__pyx_mstate_global->__pyx_codeobj_tab[294])) goto bad;
  }
  {
    const __Pyx_PyCode_New_function_description descr = {1, 0, 0, 1, (unsigned int)(CO_OPTIMIZED|CO_NEWLOCALS), 3503, 14};
    PyObject* const varnames[] = {__pyx_mstate->__pyx_n_u_self};
    __pyx_mstate_global->__pyx_codeobj_tab[295] = __Pyx_PyCode_New(descr, varnames, __pyx_mstate->__pyx_kp_u_pysam_libcbcf_pyx, __pyx_mstate->__pyx_n_u_get_2, __pyx_k_A_AQ_2, tuple_dedup_map); if (unlikely(!__pyx_mstate_global->__pyx_codeobj_tab[295])) goto bad;
  }
  {
    const __Pyx_PyCode_New_function_description descr = {2, 0, 0, 2, (unsigned int)(CO_OPTIMIZED|CO_NEWLOCALS), 3508, 11};
    PyObject* const varnames[] = {__pyx_mstate->__pyx_n_u_self, __pyx_mstate->__pyx_n_u_value};
    __pyx_mstate_global->__pyx_codeobj_tab[296] = __Pyx_PyCode_New(descr, varnames, __pyx_mstate->__pyx_kp_u_pysam_libcbcf_pyx, __pyx_mstate->__pyx_n_u_set, __pyx_k_A_QfA, tuple_dedup_map); if (unlikely(!__pyx_mstate_global->__pyx_codeobj_tab[296])) goto bad;
  }
  {
    const __Pyx_PyCode_New_function_description descr = {1, 0, 0, 5, (unsigned int)(CO_OPTIMIZED|CO_NEWLOCALS), 3512, 89};
    PyObject* const varnames[] = {__pyx_mstate->__pyx_n_u_self, __pyx_mstate->__pyx_n_u_hdr, __pyx_mstate->__pyx_n_u_r, __pyx_mstate->__pyx_n_u_i, __pyx_mstate->__pyx_n_u_n};
    __pyx_mstate_global->__pyx_codeobj_tab[297] = __Pyx_PyCode_New(descr, varnames, __pyx_mstate->__pyx_kp_u_pysam_libcbcf_pyx, __pyx_mstate->__pyx_n_u_len, __pyx_k_A_d_WA_Qc_Rq_AQ_E_aq_q_ar_Q_q, tuple_dedup_map); if (unlikely(!__pyx_mstate_global->__pyx_codeobj_tab[297])) goto bad;
  }
  {
    const __Pyx_PyCode_New_function_description descr = {1, 0, 0, 4, (unsigned int)(CO_OPTIMIZED|CO_NEWLOCALS), 3525, 86};
    PyObject* const varnames[] = {__pyx_mstate->__pyx_n_u_self, __pyx_mstate->__pyx_n_u_hdr, __pyx_mstate->__pyx_n_u_r, __pyx_mstate->__pyx_n_u_i};
    __pyx_mstate_global->__pyx_codeobj_tab[298] = __Pyx_PyCode_New(descr, varnames, __pyx_mstate->__pyx_kp_u_pysam_libcbcf_pyx, __pyx_mstate->__pyx_n_u_bool, __pyx_k_A_d_WA_Qc_Rq_AQ_E_aq_q_ar_q_q, tuple_dedup_map); if (unlikely(!__pyx_mstate_global->__pyx_codeobj_tab[298])) goto bad;
  }
  {
    const __Pyx_PyCode_New_function_description descr = {2, 0, 0, 2, (unsigned int)(CO_OPTIMIZED|CO_NEWLOCALS), 3538, 14};
    PyObject* const varnames[] = {__pyx_mstate->__pyx_n_u_self, __pyx_mstate->__pyx_n_u_key};
    __pyx_mstate_global->__pyx_codeobj_tab[299] = __Pyx_PyCode_New(descr, varnames, __pyx_mstate->__pyx_kp_u_pysam_libcbcf_pyx, __pyx_mstate->__pyx_n_u_getitem, __pyx_k_A_1F, tuple_dedup_map); if (unlikely(!__pyx_mstate_global->__pyx_codeobj_tab[299])) goto bad;
  }
  {
    const __Pyx_PyCode_New_function_description descr = {3, 0, 0, 3, (unsigned int)(CO_OPTIMIZED|CO_NEWLOCALS), 3541, 13};
    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[300] = __Pyx_PyCode_New(descr, varnames, __pyx_mstate->__pyx_kp_u_pysam_libcbcf_pyx, __pyx_mstate->__pyx_n_u_setitem, __pyx_k_A_AV5, tuple_dedup_map); if (unlikely(!__pyx_mstate_global->__pyx_codeobj_tab[300])) goto bad;
  }
  {
    const __Pyx_PyCode_New_function_description descr = {2, 0, 0, 2, (unsigned int)(CO_OPTIMIZED|CO_NEWLOCALS), 3544, 11};
    PyObject* const varnames[] = {__pyx_mstate->__pyx_n_u_self, __pyx_mstate->__pyx_n_u_key};
    __pyx_mstate_global->__pyx_codeobj_tab[301] = __Pyx_PyCode_New(descr, varnames, __pyx_mstate->__pyx_kp_u_pysam_libcbcf_pyx, __pyx_mstate->__pyx_n_u_delitem, __pyx_k_A_AV1, tuple_dedup_map); if (unlikely(!__pyx_mstate_global->__pyx_codeobj_tab[301])) goto bad;
  }
  {
    const __Pyx_PyCode_New_function_description descr = {1, 0, 0, 5, (unsigned int)(CO_OPTIMIZED|CO_NEWLOCALS), 3547, 78};
    PyObject* const varnames[] = {__pyx_mstate->__pyx_n_u_self, __pyx_mstate->__pyx_n_u_hdr, __pyx_mstate->__pyx_n_u_r, __pyx_mstate->__pyx_n_u_fmt, __pyx_mstate->__pyx_n_u_i};
    __pyx_mstate_global->__pyx_codeobj_tab[302] = __Pyx_PyCode_New(descr, varnames, __pyx_mstate->__pyx_kp_u_pysam_libcbcf_pyx, __pyx_mstate->__pyx_n_u_clear, __pyx_k_A_d_WA_E_aq_1Bd_1_s_AV_Q, tuple_dedup_map); if (unlikely(!__pyx_mstate_global->__pyx_codeobj_tab[302])) goto bad;
  }
  {
    const __Pyx_PyCode_New_function_description descr = {1, 0, 0, 5, (unsigned int)(CO_OPTIMIZED|CO_NEWLOCALS|CO_GENERATOR), 3559, 2};
    PyObject* const varnames[] = {__pyx_mstate->__pyx_n_u_self, __pyx_mstate->__pyx_n_u_hdr, __pyx_mstate->__pyx_n_u_r, __pyx_mstate->__pyx_n_u_fmt, __pyx_mstate->__pyx_n_u_i};
    __pyx_mstate_global->__pyx_codeobj_tab[303] = __Pyx_PyCode_New(descr, varnames, __pyx_mstate->__pyx_kp_u_pysam_libcbcf_pyx, __pyx_mstate->__pyx_n_u_iter, __pyx_k_A_3, tuple_dedup_map); if (unlikely(!__pyx_mstate_global->__pyx_codeobj_tab[303])) goto bad;
  }
  {
    const __Pyx_PyCode_New_function_description descr = {3, 0, 0, 3, (unsigned int)(CO_OPTIMIZED|CO_NEWLOCALS), 3570, 25};
    PyObject* const varnames[] = {__pyx_mstate->__pyx_n_u_self, __pyx_mstate->__pyx_n_u_key, __pyx_mstate->__pyx_n_u_default};
    __pyx_mstate_global->__pyx_codeobj_tab[304] = __Pyx_PyCode_New(descr, varnames, __pyx_mstate->__pyx_kp_u_pysam_libcbcf_pyx, __pyx_mstate->__pyx_n_u_get, __pyx_k_q_4q_1, tuple_dedup_map); if (unlikely(!__pyx_mstate_global->__pyx_codeobj_tab[304])) goto bad;
  }
  {
    const __Pyx_PyCode_New_function_description descr = {2, 0, 0, 6, (unsigned int)(CO_OPTIMIZED|CO_NEWLOCALS), 3577, 63};
    PyObject* const varnames[] = {__pyx_mstate->__pyx_n_u_self, __pyx_mstate->__pyx_n_u_key, __pyx_mstate->__pyx_n_u_hdr, __pyx_mstate->__pyx_n_u_r, __pyx_mstate->__pyx_n_u_bkey, __pyx_mstate->__pyx_n_u_fmt};
    __pyx_mstate_global->__pyx_codeobj_tab[305] = __Pyx_PyCode_New(descr, varnames, __pyx_mstate->__pyx_kp_u_pysam_libcbcf_pyx, __pyx_mstate->__pyx_n_u_contains, __pyx_k_A_d_WA_Qa_k_s_t3e4s_S, tuple_dedup_map); if (unlikely(!__pyx_mstate_global->__pyx_codeobj_tab[305])) goto bad;
  }
  {
    const __Pyx_PyCode_New_function_description descr = {1, 0, 0, 1, (unsigned int)(CO_OPTIMIZED|CO_NEWLOCALS), 3584, 11};
    PyObject* const varnames[] = {__pyx_mstate->__pyx_n_u_self};
    __pyx_mstate_global->__pyx_codeobj_tab[306] = __Pyx_PyCode_New(descr, varnames, __pyx_mstate->__pyx_kp_u_pysam_libcbcf_pyx, __pyx_mstate->__pyx_n_u_iterkeys, __pyx_k_A_t1A, tuple_dedup_map); if (unlikely(!__pyx_mstate_global->__pyx_codeobj_tab[306])) goto bad;
  }
  {
    const __Pyx_PyCode_New_function_description descr = {1, 0, 0, 2, (unsigned int)(CO_OPTIMIZED|CO_NEWLOCALS|CO_GENERATOR), 3588, 2};
    PyObject* const varnames[] = {__pyx_mstate->__pyx_n_u_self, __pyx_mstate->__pyx_n_u_key};
    __pyx_mstate_global->__pyx_codeobj_tab[307] = __Pyx_PyCode_New(descr, varnames, __pyx_mstate->__pyx_kp_u_pysam_libcbcf_pyx, __pyx_mstate->__pyx_n_u_itervalues, __pyx_k_A_3, tuple_dedup_map); if (unlikely(!__pyx_mstate_global->__pyx_codeobj_tab[307])) goto bad;
  }
  {
    const __Pyx_PyCode_New_function_description descr = {1, 0, 0, 2, (unsigned int)(CO_OPTIMIZED|CO_NEWLOCALS|CO_GENERATOR), 3593, 2};
    PyObject* const varnames[] = {__pyx_mstate->__pyx_n_u_self, __pyx_mstate->__pyx_n_u_key};
    __pyx_mstate_global->__pyx_codeobj_tab[308] = __Pyx_PyCode_New(descr, varnames, __pyx_mstate->__pyx_kp_u_pysam_libcbcf_pyx, __pyx_mstate->__pyx_n_u_iteritems, __pyx_k_A_3, tuple_dedup_map); if (unlikely(!__pyx_mstate_global->__pyx_codeobj_tab[308])) goto bad;
  }
  {
    const __Pyx_PyCode_New_function_description descr = {1, 0, 0, 1, (unsigned int)(CO_OPTIMIZED|CO_NEWLOCALS), 3598, 11};
    PyObject* const varnames[] = {__pyx_mstate->__pyx_n_u_self};
    __pyx_mstate_global->__pyx_codeobj_tab[309] = __Pyx_PyCode_New(descr, varnames, __pyx_mstate->__pyx_kp_u_pysam_libcbcf_pyx, __pyx_mstate->__pyx_n_u_keys, __pyx_k_A_t1A, tuple_dedup_map); if (unlikely(!__pyx_mstate_global->__pyx_codeobj_tab[309])) goto bad;
  }
  {
    const __Pyx_PyCode_New_function_description descr = {1, 0, 0, 1, (unsigned int)(CO_OPTIMIZED|CO_NEWLOCALS), 3602, 15};
    PyObject* const varnames[] = {__pyx_mstate->__pyx_n_u_self};
    __pyx_mstate_global->__pyx_codeobj_tab[310] = __Pyx_PyCode_New(descr, varnames, __pyx_mstate->__pyx_kp_u_pysam_libcbcf_pyx, __pyx_mstate->__pyx_n_u_items, __pyx_k_A_t1D, tuple_dedup_map); if (unlikely(!__pyx_mstate_global->__pyx_codeobj_tab[310])) goto bad;
  }
  {
    const __Pyx_PyCode_New_function_description descr = {1, 0, 0, 1, (unsigned int)(CO_OPTIMIZED|CO_NEWLOCALS), 3606, 15};
    PyObject* const varnames[] = {__pyx_mstate->__pyx_n_u_self};
    __pyx_mstate_global->__pyx_codeobj_tab[311] = __Pyx_PyCode_New(descr, varnames, __pyx_mstate->__pyx_kp_u_pysam_libcbcf_pyx, __pyx_mstate->__pyx_n_u_values, __pyx_k_A_t1D_1, tuple_dedup_map); if (unlikely(!__pyx_mstate_global->__pyx_codeobj_tab[311])) goto bad;
  }
  {
    const __Pyx_PyCode_New_function_description descr = {2, 0, 0, 5, (unsigned int)(CO_OPTIMIZED|CO_NEWLOCALS|CO_VARKEYWORDS), 3610, 56};
    PyObject* const varnames[] = {__pyx_mstate->__pyx_n_u_self, __pyx_mstate->__pyx_n_u_items, __pyx_mstate->__pyx_n_u_kwargs, __pyx_mstate->__pyx_n_u_k, __pyx_mstate->__pyx_n_u_v};
    __pyx_mstate_global->__pyx_codeobj_tab[312] = __Pyx_PyCode_New(descr, varnames, __pyx_mstate->__pyx_kp_u_pysam_libcbcf_pyx, __pyx_mstate->__pyx_n_u_update, __pyx_k_1_CuE_q_a_1_5_fA_AU, tuple_dedup_map); if (unlikely(!__pyx_mstate_global->__pyx_codeobj_tab[312])) goto bad;
  }
  {
    const __Pyx_PyCode_New_function_description descr = {3, 0, 0, 4, (unsigned int)(CO_OPTIMIZED|CO_NEWLOCALS), 3622, 51};
    PyObject* const varnames[] = {__pyx_mstate->__pyx_n_u_self, __pyx_mstate->__pyx_n_u_key, __pyx_mstate->__pyx_n_u_default, __pyx_mstate->__pyx_n_u_value};
    __pyx_mstate_global->__pyx_codeobj_tab[313] = __Pyx_PyCode_New(descr, varnames, __pyx_mstate->__pyx_kp_u_pysam_libcbcf_pyx, __pyx_mstate->__pyx_n_u_pop, __pyx_k_q_D_AQ_1_xwa_q, tuple_dedup_map); if (unlikely(!__pyx_mstate_global->__pyx_codeobj_tab[313])) goto bad;
  }
  {
    const __Pyx_PyCode_New_function_description descr = {3, 0, 0, 4, (unsigned int)(CO_OPTIMIZED|CO_NEWLOCALS), 3632, 62};
    PyObject* const varnames[] = {__pyx_mstate->__pyx_n_u_self, __pyx_mstate->__pyx_n_u_other, __pyx_mstate->__pyx_n_u_op, __pyx_mstate->__pyx_n_u_cmp};
    __pyx_mstate_global->__pyx_codeobj_tab[314] = __Pyx_PyCode_New(descr, varnames, __pyx_mstate->__pyx_kp_u_pysam_libcbcf_pyx, __pyx_mstate->__pyx_n_u_richcmp, __pyx_k_A_3c_4s_Q_1_AV3d_1_3c_a_q, tuple_dedup_map); if (unlikely(!__pyx_mstate_global->__pyx_codeobj_tab[314])) goto bad;
  }
  {
    const __Pyx_PyCode_New_function_description descr = {1, 0, 0, 1, (unsigned int)(CO_OPTIMIZED|CO_NEWLOCALS), 103, 2};
    PyObject* const varnames[] = {__pyx_mstate->__pyx_n_u_self};
    __pyx_mstate_global->__pyx_codeobj_tab[315] = __Pyx_PyCode_New(descr, varnames, __pyx_mstate->__pyx_kp_u_pysam_libcbcf_pxd, __pyx_mstate->__pyx_n_u_get_2, __pyx_k__13, tuple_dedup_map); if (unlikely(!__pyx_mstate_global->__pyx_codeobj_tab[315])) goto bad;
  }
  {
    const __Pyx_PyCode_New_function_description descr = {1, 0, 0, 4, (unsigned int)(CO_OPTIMIZED|CO_NEWLOCALS), 1, 98};
    PyObject* const varnames[] = {__pyx_mstate->__pyx_n_u_self, __pyx_mstate->__pyx_n_u_state, __pyx_mstate->__pyx_n_u_dict_2, __pyx_mstate->__pyx_n_u_use_setstate};
    __pyx_mstate_global->__pyx_codeobj_tab[316] = __Pyx_PyCode_New(descr, varnames, __pyx_mstate->__pyx_kp_u_stringsource, __pyx_mstate->__pyx_n_u_reduce_cython, __pyx_k_T_Q_G1F_a_vWA_q_t87_q_4D_7RS_4D, tuple_dedup_map); if (unlikely(!__pyx_mstate_global->__pyx_codeobj_tab[316])) goto bad;
  }
  {
    const __Pyx_PyCode_New_function_description descr = {2, 0, 0, 2, (unsigned int)(CO_OPTIMIZED|CO_NEWLOCALS), 16, 11};
    PyObject* const varnames[] = {__pyx_mstate->__pyx_n_u_self, __pyx_mstate->__pyx_n_u_pyx_state};
    __pyx_mstate_global->__pyx_codeobj_tab[317] = __Pyx_PyCode_New(descr, varnames, __pyx_mstate->__pyx_kp_u_stringsource, __pyx_mstate->__pyx_n_u_setstate_cython, __pyx_k_1_2, tuple_dedup_map); if (unlikely(!__pyx_mstate_global->__pyx_codeobj_tab[317])) goto bad;
  }
  {
    const __Pyx_PyCode_New_function_description descr = {2, 0, 0, 8, (unsigned int)(CO_OPTIMIZED|CO_NEWLOCALS), 3647, 57};
    PyObject* const varnames[] = {__pyx_mstate->__pyx_n_u_record, __pyx_mstate->__pyx_n_u_sample_index, __pyx_mstate->__pyx_n_u_MAX_POS, __pyx_mstate->__pyx_n_u_VALUE_TYPES, __pyx_mstate->__pyx_n_u_METADATA_TYPES, __pyx_mstate->__pyx_n_u_METADATA_LENGTHS, __pyx_mstate->__pyx_n_u_nothing, __pyx_mstate->__pyx_n_u_bcf_str_cache};
    __pyx_mstate_global->__pyx_codeobj_tab[318] = __Pyx_PyCode_New(descr, varnames, __pyx_mstate->__pyx_kp_u_pysam_libcbcf_pyx, __pyx_mstate->__pyx_n_u_makeVariantRecordSample, __pyx_k_t7_A_j_9_A_1_1, tuple_dedup_map); if (unlikely(!__pyx_mstate_global->__pyx_codeobj_tab[318])) goto bad;
  }
  {
    const __Pyx_PyCode_New_function_description descr = {1, 0, 0, 1, (unsigned int)(CO_OPTIMIZED|CO_NEWLOCALS), 3665, 16};
    PyObject* const varnames[] = {__pyx_mstate->__pyx_n_u_self};
    __pyx_mstate_global->__pyx_codeobj_tab[319] = __Pyx_PyCode_New(descr, varnames, __pyx_mstate->__pyx_kp_u_pysam_libcbcf_pyx, __pyx_mstate->__pyx_n_u_init, __pyx_k_A_HA_IQ, tuple_dedup_map); if (unlikely(!__pyx_mstate_global->__pyx_codeobj_tab[319])) goto bad;
  }
  {
    const __Pyx_PyCode_New_function_description descr = {1, 0, 0, 1, (unsigned int)(CO_OPTIMIZED|CO_NEWLOCALS), 3669, 13};
    PyObject* const varnames[] = {__pyx_mstate->__pyx_n_u_self};
    __pyx_mstate_global->__pyx_codeobj_tab[320] = __Pyx_PyCode_New(descr, varnames, __pyx_mstate->__pyx_kp_u_pysam_libcbcf_pyx, __pyx_mstate->__pyx_n_u_len, __pyx_k_A_s_4q, tuple_dedup_map); if (unlikely(!__pyx_mstate_global->__pyx_codeobj_tab[320])) goto bad;
  }
  {
    const __Pyx_PyCode_New_function_description descr = {1, 0, 0, 1, (unsigned int)(CO_OPTIMIZED|CO_NEWLOCALS), 3672, 17};
    PyObject* const varnames[] = {__pyx_mstate->__pyx_n_u_self};
    __pyx_mstate_global->__pyx_codeobj_tab[321] = __Pyx_PyCode_New(descr, varnames, __pyx_mstate->__pyx_kp_u_pysam_libcbcf_pyx, __pyx_mstate->__pyx_n_u_bool, __pyx_k_A_s_4wc, tuple_dedup_map); if (unlikely(!__pyx_mstate_global->__pyx_codeobj_tab[321])) goto bad;
  }
  {
    const __Pyx_PyCode_New_function_description descr = {2, 0, 0, 2, (unsigned int)(CO_OPTIMIZED|CO_NEWLOCALS), 3675, 35};
    PyObject* const varnames[] = {__pyx_mstate->__pyx_n_u_self, __pyx_mstate->__pyx_n_u_key};
    __pyx_mstate_global->__pyx_codeobj_tab[322] = __Pyx_PyCode_New(descr, varnames, __pyx_mstate->__pyx_kp_u_pysam_libcbcf_pyx, __pyx_mstate->__pyx_n_u_getitem, __pyx_k_A_Qe1_4uAQ_4waq, tuple_dedup_map); if (unlikely(!__pyx_mstate_global->__pyx_codeobj_tab[322])) goto bad;
  }
  {
    const __Pyx_PyCode_New_function_description descr = {1, 0, 0, 1, (unsigned int)(CO_OPTIMIZED|CO_NEWLOCALS), 3681, 13};
    PyObject* const varnames[] = {__pyx_mstate->__pyx_n_u_self};
    __pyx_mstate_global->__pyx_codeobj_tab[323] = __Pyx_PyCode_New(descr, varnames, __pyx_mstate->__pyx_kp_u_pysam_libcbcf_pyx, __pyx_mstate->__pyx_n_u_iter, __pyx_k_A_t1D_2, tuple_dedup_map); if (unlikely(!__pyx_mstate_global->__pyx_codeobj_tab[323])) goto bad;
  }
  {
    const __Pyx_PyCode_New_function_description descr = {3, 0, 0, 3, (unsigned int)(CO_OPTIMIZED|CO_NEWLOCALS), 3684, 25};
    PyObject* const varnames[] = {__pyx_mstate->__pyx_n_u_self, __pyx_mstate->__pyx_n_u_key, __pyx_mstate->__pyx_n_u_default};
    __pyx_mstate_global->__pyx_codeobj_tab[324] = __Pyx_PyCode_New(descr, varnames, __pyx_mstate->__pyx_kp_u_pysam_libcbcf_pyx, __pyx_mstate->__pyx_n_u_get, __pyx_k_q_4q_1, tuple_dedup_map); if (unlikely(!__pyx_mstate_global->__pyx_codeobj_tab[324])) goto bad;
  }
  {
    const __Pyx_PyCode_New_function_description descr = {2, 0, 0, 2, (unsigned int)(CO_OPTIMIZED|CO_NEWLOCALS), 3691, 25};
    PyObject* const varnames[] = {__pyx_mstate->__pyx_n_u_self, __pyx_mstate->__pyx_n_u_key};
    __pyx_mstate_global->__pyx_codeobj_tab[325] = __Pyx_PyCode_New(descr, varnames, __pyx_mstate->__pyx_kp_u_pysam_libcbcf_pyx, __pyx_mstate->__pyx_n_u_contains, __pyx_k_A_1_1, tuple_dedup_map); if (unlikely(!__pyx_mstate_global->__pyx_codeobj_tab[325])) goto bad;
  }
  {
    const __Pyx_PyCode_New_function_description descr = {1, 0, 0, 1, (unsigned int)(CO_OPTIMIZED|CO_NEWLOCALS), 3699, 11};
    PyObject* const varnames[] = {__pyx_mstate->__pyx_n_u_self};
    __pyx_mstate_global->__pyx_codeobj_tab[326] = __Pyx_PyCode_New(descr, varnames, __pyx_mstate->__pyx_kp_u_pysam_libcbcf_pyx, __pyx_mstate->__pyx_n_u_iterkeys, __pyx_k_A_t1A, tuple_dedup_map); if (unlikely(!__pyx_mstate_global->__pyx_codeobj_tab[326])) goto bad;
  }
  {
    const __Pyx_PyCode_New_function_description descr = {1, 0, 0, 2, (unsigned int)(CO_OPTIMIZED|CO_NEWLOCALS|CO_GENERATOR), 3703, 2};
    PyObject* const varnames[] = {__pyx_mstate->__pyx_n_u_self, __pyx_mstate->__pyx_n_u_key};
    __pyx_mstate_global->__pyx_codeobj_tab[327] = __Pyx_PyCode_New(descr, varnames, __pyx_mstate->__pyx_kp_u_pysam_libcbcf_pyx, __pyx_mstate->__pyx_n_u_itervalues, __pyx_k_A_3, tuple_dedup_map); if (unlikely(!__pyx_mstate_global->__pyx_codeobj_tab[327])) goto bad;
  }
  {
    const __Pyx_PyCode_New_function_description descr = {1, 0, 0, 2, (unsigned int)(CO_OPTIMIZED|CO_NEWLOCALS|CO_GENERATOR), 3708, 2};
    PyObject* const varnames[] = {__pyx_mstate->__pyx_n_u_self, __pyx_mstate->__pyx_n_u_key};
    __pyx_mstate_global->__pyx_codeobj_tab[328] = __Pyx_PyCode_New(descr, varnames, __pyx_mstate->__pyx_kp_u_pysam_libcbcf_pyx, __pyx_mstate->__pyx_n_u_iteritems, __pyx_k_A_3, tuple_dedup_map); if (unlikely(!__pyx_mstate_global->__pyx_codeobj_tab[328])) goto bad;
  }
  {
    const __Pyx_PyCode_New_function_description descr = {1, 0, 0, 1, (unsigned int)(CO_OPTIMIZED|CO_NEWLOCALS), 3713, 11};
    PyObject* const varnames[] = {__pyx_mstate->__pyx_n_u_self};
    __pyx_mstate_global->__pyx_codeobj_tab[329] = __Pyx_PyCode_New(descr, varnames, __pyx_mstate->__pyx_kp_u_pysam_libcbcf_pyx, __pyx_mstate->__pyx_n_u_keys, __pyx_k_A_t1A, tuple_dedup_map); if (unlikely(!__pyx_mstate_global->__pyx_codeobj_tab[329])) goto bad;
  }
  {
    const __Pyx_PyCode_New_function_description descr = {1, 0, 0, 1, (unsigned int)(CO_OPTIMIZED|CO_NEWLOCALS), 3717, 15};
    PyObject* const varnames[] = {__pyx_mstate->__pyx_n_u_self};
    __pyx_mstate_global->__pyx_codeobj_tab[330] = __Pyx_PyCode_New(descr, varnames, __pyx_mstate->__pyx_kp_u_pysam_libcbcf_pyx, __pyx_mstate->__pyx_n_u_items, __pyx_k_A_t1D, tuple_dedup_map); if (unlikely(!__pyx_mstate_global->__pyx_codeobj_tab[330])) goto bad;
  }
  {
    const __Pyx_PyCode_New_function_description descr = {1, 0, 0, 1, (unsigned int)(CO_OPTIMIZED|CO_NEWLOCALS), 3721, 15};
    PyObject* const varnames[] = {__pyx_mstate->__pyx_n_u_self};
    __pyx_mstate_global->__pyx_codeobj_tab[331] = __Pyx_PyCode_New(descr, varnames, __pyx_mstate->__pyx_kp_u_pysam_libcbcf_pyx, __pyx_mstate->__pyx_n_u_values, __pyx_k_A_t1D_1, tuple_dedup_map); if (unlikely(!__pyx_mstate_global->__pyx_codeobj_tab[331])) goto bad;
  }
  {
    const __Pyx_PyCode_New_function_description descr = {2, 0, 0, 5, (unsigned int)(CO_OPTIMIZED|CO_NEWLOCALS|CO_VARKEYWORDS), 3725, 56};
    PyObject* const varnames[] = {__pyx_mstate->__pyx_n_u_self, __pyx_mstate->__pyx_n_u_items, __pyx_mstate->__pyx_n_u_kwargs, __pyx_mstate->__pyx_n_u_k, __pyx_mstate->__pyx_n_u_v};
    __pyx_mstate_global->__pyx_codeobj_tab[332] = __Pyx_PyCode_New(descr, varnames, __pyx_mstate->__pyx_kp_u_pysam_libcbcf_pyx, __pyx_mstate->__pyx_n_u_update, __pyx_k_1_CuE_q_a_1_5_fA_AU, tuple_dedup_map); if (unlikely(!__pyx_mstate_global->__pyx_codeobj_tab[332])) goto bad;
  }
  {
    const __Pyx_PyCode_New_function_description descr = {3, 0, 0, 4, (unsigned int)(CO_OPTIMIZED|CO_NEWLOCALS), 3737, 51};
    PyObject* const varnames[] = {__pyx_mstate->__pyx_n_u_self, __pyx_mstate->__pyx_n_u_key, __pyx_mstate->__pyx_n_u_default, __pyx_mstate->__pyx_n_u_value};
    __pyx_mstate_global->__pyx_codeobj_tab[333] = __Pyx_PyCode_New(descr, varnames, __pyx_mstate->__pyx_kp_u_pysam_libcbcf_pyx, __pyx_mstate->__pyx_n_u_pop, __pyx_k_q_D_AQ_1_xwa_q, tuple_dedup_map); if (unlikely(!__pyx_mstate_global->__pyx_codeobj_tab[333])) goto bad;
  }
  {
    const __Pyx_PyCode_New_function_description descr = {1, 0, 0, 4, (unsigned int)(CO_OPTIMIZED|CO_NEWLOCALS), 1, 107};
    PyObject* const varnames[] = {__pyx_mstate->__pyx_n_u_self, __pyx_mstate->__pyx_n_u_state, __pyx_mstate->__pyx_n_u_dict_2, __pyx_mstate->__pyx_n_u_use_setstate};
    __pyx_mstate_global->__pyx_codeobj_tab[334] = __Pyx_PyCode_New(descr, varnames, __pyx_mstate->__pyx_kp_u_stringsource, __pyx_mstate->__pyx_n_u_reduce_cython, __pyx_k_T_a_G1F_a_vWA_q_t87_s_fG1_q_awk, tuple_dedup_map); if (unlikely(!__pyx_mstate_global->__pyx_codeobj_tab[334])) goto bad;
  }
  {
    const __Pyx_PyCode_New_function_description descr = {2, 0, 0, 2, (unsigned int)(CO_OPTIMIZED|CO_NEWLOCALS), 16, 11};
    PyObject* const varnames[] = {__pyx_mstate->__pyx_n_u_self, __pyx_mstate->__pyx_n_u_pyx_state};
    __pyx_mstate_global->__pyx_codeobj_tab[335] = __Pyx_PyCode_New(descr, varnames, __pyx_mstate->__pyx_kp_u_stringsource, __pyx_mstate->__pyx_n_u_setstate_cython, __pyx_k_q_a_2, tuple_dedup_map); if (unlikely(!__pyx_mstate_global->__pyx_codeobj_tab[335])) goto bad;
  }
  {
    const __Pyx_PyCode_New_function_description descr = {1, 0, 0, 5, (unsigned int)(CO_OPTIMIZED|CO_NEWLOCALS), 3755, 104};
    PyObject* const varnames[] = {__pyx_mstate->__pyx_n_u_self, __pyx_mstate->__pyx_n_u_n, __pyx_mstate->__pyx_n_u_refs, __pyx_mstate->__pyx_n_u_i, __pyx_mstate->__pyx_n_u_r};
    __pyx_mstate_global->__pyx_codeobj_tab[336] = __Pyx_PyCode_New(descr, varnames, __pyx_mstate->__pyx_kp_u_pysam_libcbcf_pyx, __pyx_mstate->__pyx_n_u_init, __pyx_k_A_HA_Ja_4t1_AQ_31D_d_qPQ_H_q_nF, tuple_dedup_map); if (unlikely(!__pyx_mstate_global->__pyx_codeobj_tab[336])) goto bad;
  }
  {
    const __Pyx_PyCode_New_function_description descr = {1, 0, 0, 1, (unsigned int)(CO_OPTIMIZED|CO_NEWLOCALS), 3768, 25};
    PyObject* const varnames[] = {__pyx_mstate->__pyx_n_u_self};
    __pyx_mstate_global->__pyx_codeobj_tab[337] = __Pyx_PyCode_New(descr, varnames, __pyx_mstate->__pyx_kp_u_pysam_libcbcf_pyx, __pyx_mstate->__pyx_n_u_dealloc, __pyx_k_A_4q_1D_q, tuple_dedup_map); if (unlikely(!__pyx_mstate_global->__pyx_codeobj_tab[337])) goto bad;
  }
  {
    const __Pyx_PyCode_New_function_description descr = {6, 0, 0, 6, (unsigned int)(CO_OPTIMIZED|CO_NEWLOCALS), 3773, 19};
    PyObject* const varnames[] = {__pyx_mstate->__pyx_n_u_self, __pyx_mstate->__pyx_n_u_bcf, __pyx_mstate->__pyx_n_u_contig, __pyx_mstate->__pyx_n_u_start, __pyx_mstate->__pyx_n_u_stop, __pyx_mstate->__pyx_n_u_reopen};
    __pyx_mstate_global->__pyx_codeobj_tab[338] = __Pyx_PyCode_New(descr, varnames, __pyx_mstate->__pyx_kp_u_pysam_libcbcf_pyx, __pyx_mstate->__pyx_n_u_fetch, __pyx_k_A_5_vQ, tuple_dedup_map); if (unlikely(!__pyx_mstate_global->__pyx_codeobj_tab[338])) goto bad;
  }
  {
    const __Pyx_PyCode_New_function_description descr = {1, 0, 0, 1, (unsigned int)(CO_OPTIMIZED|CO_NEWLOCALS), 112, 2};
    PyObject* const varnames[] = {__pyx_mstate->__pyx_n_u_self};
    __pyx_mstate_global->__pyx_codeobj_tab[339] = __Pyx_PyCode_New(descr, varnames, __pyx_mstate->__pyx_kp_u_pysam_libcbcf_pxd, __pyx_mstate->__pyx_n_u_get_2, __pyx_k__14, tuple_dedup_map); if (unlikely(!__pyx_mstate_global->__pyx_codeobj_tab[339])) goto bad;
  }
  {
    const __Pyx_PyCode_New_function_description descr = {1, 0, 0, 1, (unsigned int)(CO_OPTIMIZED|CO_NEWLOCALS), 1, 9};
    PyObject* const varnames[] = {__pyx_mstate->__pyx_n_u_self};
    __pyx_mstate_global->__pyx_codeobj_tab[340] = __Pyx_PyCode_New(descr, varnames, __pyx_mstate->__pyx_kp_u_stringsource, __pyx_mstate->__pyx_n_u_reduce_cython, __pyx_k_Q, tuple_dedup_map); if (unlikely(!__pyx_mstate_global->__pyx_codeobj_tab[340])) goto bad;
  }
  {
    const __Pyx_PyCode_New_function_description descr = {2, 0, 0, 2, (unsigned int)(CO_OPTIMIZED|CO_NEWLOCALS), 3, 9};
    PyObject* const varnames[] = {__pyx_mstate->__pyx_n_u_self, __pyx_mstate->__pyx_n_u_pyx_state};
    __pyx_mstate_global->__pyx_codeobj_tab[341] = __Pyx_PyCode_New(descr, varnames, __pyx_mstate->__pyx_kp_u_stringsource, __pyx_mstate->__pyx_n_u_setstate_cython, __pyx_k_Q, tuple_dedup_map); if (unlikely(!__pyx_mstate_global->__pyx_codeobj_tab[341])) goto bad;
  }
  {
    const __Pyx_PyCode_New_function_description descr = {2, 0, 0, 8, (unsigned int)(CO_OPTIMIZED|CO_NEWLOCALS), 3777, 67};
    PyObject* const varnames[] = {__pyx_mstate->__pyx_n_u_header, __pyx_mstate->__pyx_n_u_idx, __pyx_mstate->__pyx_n_u_MAX_POS, __pyx_mstate->__pyx_n_u_VALUE_TYPES, __pyx_mstate->__pyx_n_u_METADATA_TYPES, __pyx_mstate->__pyx_n_u_METADATA_LENGTHS, __pyx_mstate->__pyx_n_u_nothing, __pyx_mstate->__pyx_n_u_bcf_str_cache};
    __pyx_mstate_global->__pyx_codeobj_tab[342] = __Pyx_PyCode_New(descr, varnames, __pyx_mstate->__pyx_kp_u_pysam_libcbcf_pyx, __pyx_mstate->__pyx_n_u_makeBCFIndex, __pyx_k_t1_q_t1_j_1_1_1, tuple_dedup_map); if (unlikely(!__pyx_mstate_global->__pyx_codeobj_tab[342])) goto bad;
  }
  {
    const __Pyx_PyCode_New_function_description descr = {1, 0, 0, 5, (unsigned int)(CO_OPTIMIZED|CO_NEWLOCALS), 3794, 96};
    PyObject* const varnames[] = {__pyx_mstate->__pyx_n_u_self, __pyx_mstate->__pyx_n_u_n, __pyx_mstate->__pyx_n_u_refs, __pyx_mstate->__pyx_n_u_i, __pyx_mstate->__pyx_n_u_r};
    __pyx_mstate_global->__pyx_codeobj_tab[343] = __Pyx_PyCode_New(descr, varnames, __pyx_mstate->__pyx_kp_u_pysam_libcbcf_pyx, __pyx_mstate->__pyx_n_u_init, __pyx_k_A_HA_Ja_4t1_AQ_Qd_H_q_nF_A_Jb_D, tuple_dedup_map); if (unlikely(!__pyx_mstate_global->__pyx_codeobj_tab[343])) goto bad;
  }
  {
    const __Pyx_PyCode_New_function_description descr = {1, 0, 0, 1, (unsigned int)(CO_OPTIMIZED|CO_NEWLOCALS), 3807, 25};
    PyObject* const varnames[] = {__pyx_mstate->__pyx_n_u_self};
    __pyx_mstate_global->__pyx_codeobj_tab[344] = __Pyx_PyCode_New(descr, varnames, __pyx_mstate->__pyx_kp_u_pysam_libcbcf_pyx, __pyx_mstate->__pyx_n_u_dealloc, __pyx_k_A_4q_q_A_q, tuple_dedup_map); if (unlikely(!__pyx_mstate_global->__pyx_codeobj_tab[344])) goto bad;
  }
  {
    const __Pyx_PyCode_New_function_description descr = {6, 0, 0, 6, (unsigned int)(CO_OPTIMIZED|CO_NEWLOCALS), 3812, 19};
    PyObject* const varnames[] = {__pyx_mstate->__pyx_n_u_self, __pyx_mstate->__pyx_n_u_bcf, __pyx_mstate->__pyx_n_u_contig, __pyx_mstate->__pyx_n_u_start, __pyx_mstate->__pyx_n_u_stop, __pyx_mstate->__pyx_n_u_reopen};
    __pyx_mstate_global->__pyx_codeobj_tab[345] = __Pyx_PyCode_New(descr, varnames, __pyx_mstate->__pyx_kp_u_pysam_libcbcf_pyx, __pyx_mstate->__pyx_n_u_fetch, __pyx_k_A_AU_q, tuple_dedup_map); if (unlikely(!__pyx_mstate_global->__pyx_codeobj_tab[345])) goto bad;
  }
  {
    const __Pyx_PyCode_New_function_description descr = {1, 0, 0, 1, (unsigned int)(CO_OPTIMIZED|CO_NEWLOCALS), 1, 9};
    PyObject* const varnames[] = {__pyx_mstate->__pyx_n_u_self};
    __pyx_mstate_global->__pyx_codeobj_tab[346] = __Pyx_PyCode_New(descr, varnames, __pyx_mstate->__pyx_kp_u_stringsource, __pyx_mstate->__pyx_n_u_reduce_cython, __pyx_k_Q, tuple_dedup_map); if (unlikely(!__pyx_mstate_global->__pyx_codeobj_tab[346])) goto bad;
  }
  {
    const __Pyx_PyCode_New_function_description descr = {2, 0, 0, 2, (unsigned int)(CO_OPTIMIZED|CO_NEWLOCALS), 3, 9};
    PyObject* const varnames[] = {__pyx_mstate->__pyx_n_u_self, __pyx_mstate->__pyx_n_u_pyx_state};
    __pyx_mstate_global->__pyx_codeobj_tab[347] = __Pyx_PyCode_New(descr, varnames, __pyx_mstate->__pyx_kp_u_stringsource, __pyx_mstate->__pyx_n_u_setstate_cython, __pyx_k_Q, tuple_dedup_map); if (unlikely(!__pyx_mstate_global->__pyx_codeobj_tab[347])) goto bad;
  }
  {
    const __Pyx_PyCode_New_function_description descr = {1, 0, 0, 7, (unsigned int)(CO_OPTIMIZED|CO_NEWLOCALS), 3816, 44};
    PyObject* const varnames[] = {__pyx_mstate->__pyx_n_u_idx, __pyx_mstate->__pyx_n_u_MAX_POS, __pyx_mstate->__pyx_n_u_VALUE_TYPES, __pyx_mstate->__pyx_n_u_METADATA_TYPES, __pyx_mstate->__pyx_n_u_METADATA_LENGTHS, __pyx_mstate->__pyx_n_u_nothing, __pyx_mstate->__pyx_n_u_bcf_str_cache};
    __pyx_mstate_global->__pyx_codeobj_tab[348] = __Pyx_PyCode_New(descr, varnames, __pyx_mstate->__pyx_kp_u_pysam_libcbcf_pyx, __pyx_mstate->__pyx_n_u_makeTabixIndex, __pyx_k_t1_q_Jhaq_1, tuple_dedup_map); if (unlikely(!__pyx_mstate_global->__pyx_codeobj_tab[348])) goto bad;
  }
  {
    const __Pyx_PyCode_New_function_description descr = {1, 0, 0, 1, (unsigned int)(CO_OPTIMIZED|CO_NEWLOCALS), 1, 9};
    PyObject* const varnames[] = {__pyx_mstate->__pyx_n_u_self};
    __pyx_mstate_global->__pyx_codeobj_tab[349] = __Pyx_PyCode_New(descr, varnames, __pyx_mstate->__pyx_kp_u_stringsource, __pyx_mstate->__pyx_n_u_reduce_cython, __pyx_k_Q, tuple_dedup_map); if (unlikely(!__pyx_mstate_global->__pyx_codeobj_tab[349])) goto bad;
  }
  {
    const __Pyx_PyCode_New_function_description descr = {2, 0, 0, 2, (unsigned int)(CO_OPTIMIZED|CO_NEWLOCALS), 3, 9};
    PyObject* const varnames[] = {__pyx_mstate->__pyx_n_u_self, __pyx_mstate->__pyx_n_u_pyx_state};
    __pyx_mstate_global->__pyx_codeobj_tab[350] = __Pyx_PyCode_New(descr, varnames, __pyx_mstate->__pyx_kp_u_stringsource, __pyx_mstate->__pyx_n_u_setstate_cython, __pyx_k_Q, tuple_dedup_map); if (unlikely(!__pyx_mstate_global->__pyx_codeobj_tab[350])) goto bad;
  }
  {
    const __Pyx_PyCode_New_function_description descr = {2, 0, 0, 8, (unsigned int)(CO_OPTIMIZED|CO_NEWLOCALS), 3839, 27};
    PyObject* const varnames[] = {__pyx_mstate->__pyx_n_u_self, __pyx_mstate->__pyx_n_u_record, __pyx_mstate->__pyx_n_u_MAX_POS, __pyx_mstate->__pyx_n_u_VALUE_TYPES, __pyx_mstate->__pyx_n_u_METADATA_TYPES, __pyx_mstate->__pyx_n_u_METADATA_LENGTHS, __pyx_mstate->__pyx_n_u_nothing, __pyx_mstate->__pyx_n_u_bcf_str_cache};
    __pyx_mstate_global->__pyx_codeobj_tab[351] = __Pyx_PyCode_New(descr, varnames, __pyx_mstate->__pyx_kp_u_pysam_libcbcf_pyx, __pyx_mstate->__pyx_n_u_stop_BCFIterator, __pyx_k_1D, tuple_dedup_map); if (unlikely(!__pyx_mstate_global->__pyx_codeobj_tab[351])) goto bad;
  }
  {
    const __Pyx_PyCode_New_function_description descr = {6, 0, 0, 10, (unsigned int)(CO_OPTIMIZED|CO_NEWLOCALS), 3848, 242};
    PyObject* const varnames[] = {__pyx_mstate->__pyx_n_u_self, __pyx_mstate->__pyx_n_u_bcf, __pyx_mstate->__pyx_n_u_contig, __pyx_mstate->__pyx_n_u_start, __pyx_mstate->__pyx_n_u_stop, __pyx_mstate->__pyx_n_u_reopen, __pyx_mstate->__pyx_n_u_index, __pyx_mstate->__pyx_n_u_rid, __pyx_mstate->__pyx_n_u_cstart, __pyx_mstate->__pyx_n_u_cstop};
    __pyx_mstate_global->__pyx_codeobj_tab[352] = __Pyx_PyCode_New(descr, varnames, __pyx_mstate->__pyx_kp_u_pysam_libcbcf_pyx, __pyx_mstate->__pyx_n_u_init, __pyx_k_mST_4s_AQ_7_Q_AQ_4z_XQ_AQ_c_G1, tuple_dedup_map); if (unlikely(!__pyx_mstate_global->__pyx_codeobj_tab[352])) goto bad;
  }
  {
    const __Pyx_PyCode_New_function_description descr = {1, 0, 0, 1, (unsigned int)(CO_OPTIMIZED|CO_NEWLOCALS), 3887, 25};
    PyObject* const varnames[] = {__pyx_mstate->__pyx_n_u_self};
    __pyx_mstate_global->__pyx_codeobj_tab[353] = __Pyx_PyCode_New(descr, varnames, __pyx_mstate->__pyx_kp_u_pysam_libcbcf_pyx, __pyx_mstate->__pyx_n_u_dealloc, __pyx_k_A_4q_1D, tuple_dedup_map); if (unlikely(!__pyx_mstate_global->__pyx_codeobj_tab[353])) goto bad;
  }
  {
    const __Pyx_PyCode_New_function_description descr = {1, 0, 0, 1, (unsigned int)(CO_OPTIMIZED|CO_NEWLOCALS), 3892, 7};
    PyObject* const varnames[] = {__pyx_mstate->__pyx_n_u_self};
    __pyx_mstate_global->__pyx_codeobj_tab[354] = __Pyx_PyCode_New(descr, varnames, __pyx_mstate->__pyx_kp_u_pysam_libcbcf_pyx, __pyx_mstate->__pyx_n_u_iter, __pyx_k_A_q_3, tuple_dedup_map); if (unlikely(!__pyx_mstate_global->__pyx_codeobj_tab[354])) goto bad;
  }
  {
    const __Pyx_PyCode_New_function_description descr = {1, 0, 0, 3, (unsigned int)(CO_OPTIMIZED|CO_NEWLOCALS), 3895, 218};
    PyObject* const varnames[] = {__pyx_mstate->__pyx_n_u_self, __pyx_mstate->__pyx_n_u_record, __pyx_mstate->__pyx_n_u_ret};
    __pyx_mstate_global->__pyx_codeobj_tab[355] = __Pyx_PyCode_New(descr, varnames, __pyx_mstate->__pyx_kp_u_pysam_libcbcf_pyx, __pyx_mstate->__pyx_n_u_next_2, __pyx_k_A_4t1_iq_4q_Qa_ha_4t1_at4z_WA_4r, tuple_dedup_map); if (unlikely(!__pyx_mstate_global->__pyx_codeobj_tab[355])) goto bad;
  }
  {
    const __Pyx_PyCode_New_function_description descr = {1, 0, 0, 1, (unsigned int)(CO_OPTIMIZED|CO_NEWLOCALS), 1, 9};
    PyObject* const varnames[] = {__pyx_mstate->__pyx_n_u_self};
    __pyx_mstate_global->__pyx_codeobj_tab[356] = __Pyx_PyCode_New(descr, varnames, __pyx_mstate->__pyx_kp_u_stringsource, __pyx_mstate->__pyx_n_u_reduce_cython, __pyx_k_Q, tuple_dedup_map); if (unlikely(!__pyx_mstate_global->__pyx_codeobj_tab[356])) goto bad;
  }
  {
    const __Pyx_PyCode_New_function_description descr = {2, 0, 0, 2, (unsigned int)(CO_OPTIMIZED|CO_NEWLOCALS), 3, 9};
    PyObject* const varnames[] = {__pyx_mstate->__pyx_n_u_self, __pyx_mstate->__pyx_n_u_pyx_state};
    __pyx_mstate_global->__pyx_codeobj_tab[357] = __Pyx_PyCode_New(descr, varnames, __pyx_mstate->__pyx_kp_u_stringsource, __pyx_mstate->__pyx_n_u_setstate_cython, __pyx_k_Q, tuple_dedup_map); if (unlikely(!__pyx_mstate_global->__pyx_codeobj_tab[357])) goto bad;
  }
  {
    const __Pyx_PyCode_New_function_description descr = {1, 0, 0, 3, (unsigned int)(CO_OPTIMIZED|CO_NEWLOCALS|CO_VARARGS|CO_VARKEYWORDS), 3934, 29};
    PyObject* const varnames[] = {__pyx_mstate->__pyx_n_u_self, __pyx_mstate->__pyx_n_u_args, __pyx_mstate->__pyx_n_u_kwargs};
    __pyx_mstate_global->__pyx_codeobj_tab[358] = __Pyx_PyCode_New(descr, varnames, __pyx_mstate->__pyx_kp_u_pysam_libcbcf_pyx, __pyx_mstate->__pyx_n_u_cinit, __pyx_k_A_L_Q_L_Q_L_Q, tuple_dedup_map); if (unlikely(!__pyx_mstate_global->__pyx_codeobj_tab[358])) goto bad;
  }
  {
    const __Pyx_PyCode_New_function_description descr = {6, 0, 0, 10, (unsigned int)(CO_OPTIMIZED|CO_NEWLOCALS), 3939, 221};
    PyObject* const varnames[] = {__pyx_mstate->__pyx_n_u_self, __pyx_mstate->__pyx_n_u_bcf, __pyx_mstate->__pyx_n_u_contig, __pyx_mstate->__pyx_n_u_start, __pyx_mstate->__pyx_n_u_stop, __pyx_mstate->__pyx_n_u_reopen, __pyx_mstate->__pyx_n_u_index, __pyx_mstate->__pyx_n_u_rid, __pyx_mstate->__pyx_n_u_cstart, __pyx_mstate->__pyx_n_u_cstop};
    __pyx_mstate_global->__pyx_codeobj_tab[359] = __Pyx_PyCode_New(descr, varnames, __pyx_mstate->__pyx_kp_u_pysam_libcbcf_pyx, __pyx_mstate->__pyx_n_u_init, __pyx_k_mST_4s_AQ_4z_XQ_AQ_1_G1_IQ_waq, tuple_dedup_map); if (unlikely(!__pyx_mstate_global->__pyx_codeobj_tab[359])) goto bad;
  }
  {
    const __Pyx_PyCode_New_function_description descr = {1, 0, 0, 1, (unsigned int)(CO_OPTIMIZED|CO_NEWLOCALS), 3974, 72};
    PyObject* const varnames[] = {__pyx_mstate->__pyx_n_u_self};
    __pyx_mstate_global->__pyx_codeobj_tab[360] = __Pyx_PyCode_New(descr, varnames, __pyx_mstate->__pyx_kp_u_pysam_libcbcf_pyx, __pyx_mstate->__pyx_n_u_dealloc, __pyx_k_A_4q_1D_4_1_L_Q_L_Q_L_Q, tuple_dedup_map); if (unlikely(!__pyx_mstate_global->__pyx_codeobj_tab[360])) goto bad;
  }
  {
    const __Pyx_PyCode_New_function_description descr = {1, 0, 0, 1, (unsigned int)(CO_OPTIMIZED|CO_NEWLOCALS), 3986, 7};
    PyObject* const varnames[] = {__pyx_mstate->__pyx_n_u_self};
    __pyx_mstate_global->__pyx_codeobj_tab[361] = __Pyx_PyCode_New(descr, varnames, __pyx_mstate->__pyx_kp_u_pysam_libcbcf_pyx, __pyx_mstate->__pyx_n_u_iter, __pyx_k_A_q_3, tuple_dedup_map); if (unlikely(!__pyx_mstate_global->__pyx_codeobj_tab[361])) goto bad;
  }
  {
    const __Pyx_PyCode_New_function_description descr = {1, 0, 0, 3, (unsigned int)(CO_OPTIMIZED|CO_NEWLOCALS), 3989, 241};
    PyObject* const varnames[] = {__pyx_mstate->__pyx_n_u_self, __pyx_mstate->__pyx_n_u_ret, __pyx_mstate->__pyx_n_u_record};
    __pyx_mstate_global->__pyx_codeobj_tab[362] = __Pyx_PyCode_New(descr, varnames, __pyx_mstate->__pyx_kp_u_pysam_libcbcf_pyx, __pyx_mstate->__pyx_n_u_next_2, __pyx_k_A_4t1_at4z_V6_WATQR_4r_1D_t4q_T, tuple_dedup_map); if (unlikely(!__pyx_mstate_global->__pyx_codeobj_tab[362])) goto bad;
  }
  {
    const __Pyx_PyCode_New_function_description descr = {1, 0, 0, 1, (unsigned int)(CO_OPTIMIZED|CO_NEWLOCALS), 1, 9};
    PyObject* const varnames[] = {__pyx_mstate->__pyx_n_u_self};
    __pyx_mstate_global->__pyx_codeobj_tab[363] = __Pyx_PyCode_New(descr, varnames, __pyx_mstate->__pyx_kp_u_stringsource, __pyx_mstate->__pyx_n_u_reduce_cython, __pyx_k_Q, tuple_dedup_map); if (unlikely(!__pyx_mstate_global->__pyx_codeobj_tab[363])) goto bad;
  }
  {
    const __Pyx_PyCode_New_function_description descr = {2, 0, 0, 2, (unsigned int)(CO_OPTIMIZED|CO_NEWLOCALS), 3, 9};
    PyObject* const varnames[] = {__pyx_mstate->__pyx_n_u_self, __pyx_mstate->__pyx_n_u_pyx_state};
    __pyx_mstate_global->__pyx_codeobj_tab[364] = __Pyx_PyCode_New(descr, varnames, __pyx_mstate->__pyx_kp_u_stringsource, __pyx_mstate->__pyx_n_u_setstate_cython, __pyx_k_Q, tuple_dedup_map); if (unlikely(!__pyx_mstate_global->__pyx_codeobj_tab[364])) goto bad;
  }
  {
    const __Pyx_PyCode_New_function_description descr = {1, 0, 0, 3, (unsigned int)(CO_OPTIMIZED|CO_NEWLOCALS|CO_VARARGS|CO_VARKEYWORDS), 4098, 9};
    PyObject* const varnames[] = {__pyx_mstate->__pyx_n_u_self, __pyx_mstate->__pyx_n_u_args, __pyx_mstate->__pyx_n_u_kwargs};
    __pyx_mstate_global->__pyx_codeobj_tab[365] = __Pyx_PyCode_New(descr, varnames, __pyx_mstate->__pyx_kp_u_pysam_libcbcf_pyx, __pyx_mstate->__pyx_n_u_cinit, __pyx_k_A_Kq, tuple_dedup_map); if (unlikely(!__pyx_mstate_global->__pyx_codeobj_tab[365])) goto bad;
  }
  {
    const __Pyx_PyCode_New_function_description descr = {1, 0, 0, 3, (unsigned int)(CO_OPTIMIZED|CO_NEWLOCALS|CO_VARARGS|CO_VARKEYWORDS), 4101, 109};
    PyObject* const varnames[] = {__pyx_mstate->__pyx_n_u_self, __pyx_mstate->__pyx_n_u_args, __pyx_mstate->__pyx_n_u_kwargs};
    __pyx_mstate_global->__pyx_codeobj_tab[366] = __Pyx_PyCode_New(descr, varnames, __pyx_mstate->__pyx_kp_u_pysam_libcbcf_pyx, __pyx_mstate->__pyx_n_u_init, __pyx_k_A_a_a_a_a_a_a_a_a_a_a_a_q_E_81, tuple_dedup_map); if (unlikely(!__pyx_mstate_global->__pyx_codeobj_tab[366])) goto bad;
  }
  {
    const __Pyx_PyCode_New_function_description descr = {1, 0, 0, 2, (unsigned int)(CO_OPTIMIZED|CO_NEWLOCALS), 4117, 154};
    PyObject* const varnames[] = {__pyx_mstate->__pyx_n_u_self, __pyx_mstate->__pyx_n_u_ret};
    __pyx_mstate_global->__pyx_codeobj_tab[367] = __Pyx_PyCode_New(descr, varnames, __pyx_mstate->__pyx_kp_u_pysam_libcbcf_pyx, __pyx_mstate->__pyx_n_u_dealloc, __pyx_k_A_4t9Ct4q_4xz_T_Q_m1D_gQ_t2Rt6_A, tuple_dedup_map); if (unlikely(!__pyx_mstate_global->__pyx_codeobj_tab[367])) goto bad;
  }
  {
    const __Pyx_PyCode_New_function_description descr = {1, 0, 0, 2, (unsigned int)(CO_OPTIMIZED|CO_NEWLOCALS), 4137, 146};
    PyObject* const varnames[] = {__pyx_mstate->__pyx_n_u_self, __pyx_mstate->__pyx_n_u_ret};
    __pyx_mstate_global->__pyx_codeobj_tab[368] = __Pyx_PyCode_New(descr, varnames, __pyx_mstate->__pyx_kp_u_pysam_libcbcf_pyx, __pyx_mstate->__pyx_n_u_close, __pyx_k_A_4t1_4xz_T_Q_m1D_gQ_t2Rt6_A_A_i, tuple_dedup_map); if (unlikely(!__pyx_mstate_global->__pyx_codeobj_tab[368])) goto bad;
  }
  {
    const __Pyx_PyCode_New_function_description descr = {1, 0, 0, 1, (unsigned int)(CO_OPTIMIZED|CO_NEWLOCALS), 4158, 50};
    PyObject* const varnames[] = {__pyx_mstate->__pyx_n_u_self};
    __pyx_mstate_global->__pyx_codeobj_tab[369] = __Pyx_PyCode_New(descr, varnames, __pyx_mstate->__pyx_kp_u_pysam_libcbcf_pyx, __pyx_mstate->__pyx_n_u_iter, __pyx_k_A_4t1_AQ_4xq_AQ_N_q, tuple_dedup_map); if (unlikely(!__pyx_mstate_global->__pyx_codeobj_tab[369])) goto bad;
  }
  {
    const __Pyx_PyCode_New_function_description descr = {1, 0, 0, 4, (unsigned int)(CO_OPTIMIZED|CO_NEWLOCALS), 4168, 176};
    PyObject* const varnames[] = {__pyx_mstate->__pyx_n_u_self, __pyx_mstate->__pyx_n_u_ret, __pyx_mstate->__pyx_n_u_errcode, __pyx_mstate->__pyx_n_u_record};
    __pyx_mstate_global->__pyx_codeobj_tab[370] = __Pyx_PyCode_New(descr, varnames, __pyx_mstate->__pyx_kp_u_pysam_libcbcf_pyx, __pyx_mstate->__pyx_n_u_next_2, __pyx_k_A_iq_4q_Qa_ha_4q_1D_gV1_4r_fA_q, tuple_dedup_map); if (unlikely(!__pyx_mstate_global->__pyx_codeobj_tab[370])) goto bad;
  }
  {
    const __Pyx_PyCode_New_function_description descr = {1, 0, 0, 3, (unsigned int)(CO_OPTIMIZED|CO_NEWLOCALS), 4199, 228};
    PyObject* const varnames[] = {__pyx_mstate->__pyx_n_u_self, __pyx_mstate->__pyx_n_u_vars, __pyx_mstate->__pyx_n_u_hdr};
    __pyx_mstate_global->__pyx_codeobj_tab[371] = __Pyx_PyCode_New(descr, varnames, __pyx_mstate->__pyx_kp_u_pysam_libcbcf_pyx, __pyx_mstate->__pyx_n_u_copy, __pyx_k_A_4t1_81A_Kt_4t1_AQ_d_d_d_d_d_d, tuple_dedup_map); if (unlikely(!__pyx_mstate_global->__pyx_codeobj_tab[371])) goto bad;
  }
  {
    const __Pyx_PyCode_New_function_description descr = {9, 0, 0, 20, (unsigned int)(CO_OPTIMIZED|CO_NEWLOCALS), 4237, 879};
    PyObject* const varnames[] = {__pyx_mstate->__pyx_n_u_self, __pyx_mstate->__pyx_n_u_filename, __pyx_mstate->__pyx_n_u_mode, __pyx_mstate->__pyx_n_u_index_filename, __pyx_mstate->__pyx_n_u_header, __pyx_mstate->__pyx_n_u_drop_samples, __pyx_mstate->__pyx_n_u_duplicate_filehandle, __pyx_mstate->__pyx_n_u_ignore_truncation, __pyx_mstate->__pyx_n_u_threads, __pyx_mstate->__pyx_n_u_hdr, __pyx_mstate->__pyx_n_u_bgzfp, __pyx_mstate->__pyx_n_u_idx, __pyx_mstate->__pyx_n_u_tidx, __pyx_mstate->__pyx_n_u_cfilename, __pyx_mstate->__pyx_n_u_cindex_filename, __pyx_mstate->__pyx_n_u_cmode, __pyx_mstate->__pyx_n_u_format_modes, __pyx_mstate->__pyx_n_u_invalid_modes, __pyx_mstate->__pyx_n_u_m, __pyx_mstate->__pyx_n_u_m};
    __pyx_mstate_global->__pyx_codeobj_tab[372] = __Pyx_PyCode_New(descr, varnames, __pyx_mstate->__pyx_kp_u_pysam_libcbcf_pyx, __pyx_mstate->__pyx_n_u_open, __pyx_k_Q_82Rt1_AQ_Kq_4q_a_4uCt1Cwa_AQ, tuple_dedup_map); if (unlikely(!__pyx_mstate_global->__pyx_codeobj_tab[372])) goto bad;
  }
  {
    const __Pyx_PyCode_New_function_description descr = {1, 0, 0, 1, (unsigned int)(CO_OPTIMIZED|CO_NEWLOCALS), 4382, 15};
    PyObject* const varnames[] = {__pyx_mstate->__pyx_n_u_self};
    __pyx_mstate_global->__pyx_codeobj_tab[373] = __Pyx_PyCode_New(descr, varnames, __pyx_mstate->__pyx_kp_u_pysam_libcbcf_pyx, __pyx_mstate->__pyx_n_u_reset, __pyx_k_A_t5_Q, tuple_dedup_map); if (unlikely(!__pyx_mstate_global->__pyx_codeobj_tab[373])) goto bad;
  }
  {
    const __Pyx_PyCode_New_function_description descr = {2, 0, 0, 4, (unsigned int)(CO_OPTIMIZED|CO_NEWLOCALS), 4386, 53};
    PyObject* const varnames[] = {__pyx_mstate->__pyx_n_u_self, __pyx_mstate->__pyx_n_u_tid, __pyx_mstate->__pyx_n_u_hdr, __pyx_mstate->__pyx_n_u_rid};
    __pyx_mstate_global->__pyx_codeobj_tab[374] = __Pyx_PyCode_New(descr, varnames, __pyx_mstate->__pyx_kp_u_pysam_libcbcf_pyx, __pyx_mstate->__pyx_n_u_is_valid_tid, __pyx_k_A_4t1_AQ_d_q_r_F_Rq, tuple_dedup_map); if (unlikely(!__pyx_mstate_global->__pyx_codeobj_tab[374])) goto bad;
  }
  {
    const __Pyx_PyCode_New_function_description descr = {2, 0, 0, 4, (unsigned int)(CO_OPTIMIZED|CO_NEWLOCALS), 4399, 84};
    PyObject* const varnames[] = {__pyx_mstate->__pyx_n_u_self, __pyx_mstate->__pyx_n_u_reference, __pyx_mstate->__pyx_n_u_d, __pyx_mstate->__pyx_n_u_k};
    __pyx_mstate_global->__pyx_codeobj_tab[375] = __Pyx_PyCode_New(descr, varnames, __pyx_mstate->__pyx_kp_u_pysam_libcbcf_pyx, __pyx_mstate->__pyx_n_u_get_tid, __pyx_k_A_4t1_AQ_D_t5_Kq_Qc_1Cr_V1IQ, tuple_dedup_map); if (unlikely(!__pyx_mstate_global->__pyx_codeobj_tab[375])) goto bad;
  }
  {
    const __Pyx_PyCode_New_function_description descr = {2, 0, 0, 4, (unsigned int)(CO_OPTIMIZED|CO_NEWLOCALS), 4414, 84};
    PyObject* const varnames[] = {__pyx_mstate->__pyx_n_u_self, __pyx_mstate->__pyx_n_u_tid, __pyx_mstate->__pyx_n_u_hdr, __pyx_mstate->__pyx_n_u_rid};
    __pyx_mstate_global->__pyx_codeobj_tab[376] = __Pyx_PyCode_New(descr, varnames, __pyx_mstate->__pyx_kp_u_pysam_libcbcf_pyx, __pyx_mstate->__pyx_n_u_get_reference_name, __pyx_k_A_4t1_AQ_d_q_4r_3d_S_1_AQ_a, tuple_dedup_map); if (unlikely(!__pyx_mstate_global->__pyx_codeobj_tab[376])) goto bad;
  }
  {
    const __Pyx_PyCode_New_function_description descr = {8, 0, 0, 11, (unsigned int)(CO_OPTIMIZED|CO_NEWLOCALS), 4427, 217};
    PyObject* const varnames[] = {__pyx_mstate->__pyx_n_u_self, __pyx_mstate->__pyx_n_u_contig, __pyx_mstate->__pyx_n_u_start, __pyx_mstate->__pyx_n_u_stop, __pyx_mstate->__pyx_n_u_region, __pyx_mstate->__pyx_n_u_reopen, __pyx_mstate->__pyx_n_u_end, __pyx_mstate->__pyx_n_u_reference, __pyx_mstate->__pyx_n_u_bcf, __pyx_mstate->__pyx_n_u__17, __pyx_mstate->__pyx_n_u_tid};
    __pyx_mstate_global->__pyx_codeobj_tab[377] = __Pyx_PyCode_New(descr, varnames, __pyx_mstate->__pyx_kp_u_pysam_libcbcf_pyx, __pyx_mstate->__pyx_n_u_fetch, __pyx_k_KWggh_4t1_AQ_4xq_AQ_7_U_gS_a_e6, tuple_dedup_map); if (unlikely(!__pyx_mstate_global->__pyx_codeobj_tab[377])) goto bad;
  }
  {
    const __Pyx_PyCode_New_function_description descr = {1, 0, 0, 3, (unsigned int)(CO_OPTIMIZED|CO_NEWLOCALS|CO_VARARGS|CO_VARKEYWORDS), 4473, 19};
    PyObject* const varnames[] = {__pyx_mstate->__pyx_n_u_self, __pyx_mstate->__pyx_n_u_args, __pyx_mstate->__pyx_n_u_kwargs};
    __pyx_mstate_global->__pyx_codeobj_tab[378] = __Pyx_PyCode_New(descr, varnames, __pyx_mstate->__pyx_kp_u_pysam_libcbcf_pyx, __pyx_mstate->__pyx_n_u_new_record, __pyx_k_A_t7_Rxq, tuple_dedup_map); if (unlikely(!__pyx_mstate_global->__pyx_codeobj_tab[378])) goto bad;
  }
  {
    const __Pyx_PyCode_New_function_description descr = {2, 0, 0, 2, (unsigned int)(CO_OPTIMIZED|CO_NEWLOCALS), 4480, 249};
    PyObject* const varnames[] = {__pyx_mstate->__pyx_n_u_self, __pyx_mstate->__pyx_n_u_record};
    __pyx_mstate_global->__pyx_codeobj_tab[379] = __Pyx_PyCode_New(descr, varnames, __pyx_mstate->__pyx_kp_u_pysam_libcbcf_pyx, __pyx_mstate->__pyx_n_u_write, __pyx_k_8_7_Q_AQ_4t1_AQ_4t81_AQ_4t1_m1D, tuple_dedup_map); if (unlikely(!__pyx_mstate_global->__pyx_codeobj_tab[379])) goto bad;
  }
  {
    const __Pyx_PyCode_New_function_description descr = {2, 0, 0, 2, (unsigned int)(CO_OPTIMIZED|CO_NEWLOCALS), 4523, 85};
    PyObject* const varnames[] = {__pyx_mstate->__pyx_n_u_self, __pyx_mstate->__pyx_n_u_include_samples};
    __pyx_mstate_global->__pyx_codeobj_tab[380] = __Pyx_PyCode_New(descr, varnames, __pyx_mstate->__pyx_kp_u_pysam_libcbcf_pyx, __pyx_mstate->__pyx_n_u_subset_samples, __pyx_k_A_4t1_AQ_4xq_AQ_4q_AQ_G_1A_4q, tuple_dedup_map); if (unlikely(!__pyx_mstate_global->__pyx_codeobj_tab[380])) goto bad;
  }
  {
    const __Pyx_PyCode_New_function_description descr = {1, 0, 0, 1, (unsigned int)(CO_OPTIMIZED|CO_NEWLOCALS), 135, 2};
    PyObject* const varnames[] = {__pyx_mstate->__pyx_n_u_self};
    __pyx_mstate_global->__pyx_codeobj_tab[381] = __Pyx_PyCode_New(descr, varnames, __pyx_mstate->__pyx_kp_u_pysam_libcbcf_pxd, __pyx_mstate->__pyx_n_u_get_2, __pyx_k__18, tuple_dedup_map); if (unlikely(!__pyx_mstate_global->__pyx_codeobj_tab[381])) goto bad;
  }
  {
    const __Pyx_PyCode_New_function_description descr = {1, 0, 0, 1, (unsigned int)(CO_OPTIMIZED|CO_NEWLOCALS), 136, 2};
    PyObject* const varnames[] = {__pyx_mstate->__pyx_n_u_self};
    __pyx_mstate_global->__pyx_codeobj_tab[382] = __Pyx_PyCode_New(descr, varnames, __pyx_mstate->__pyx_kp_u_pysam_libcbcf_pxd, __pyx_mstate->__pyx_n_u_get_2, __pyx_k__18, tuple_dedup_map); if (unlikely(!__pyx_mstate_global->__pyx_codeobj_tab[382])) goto bad;
  }
  {
    const __Pyx_PyCode_New_function_description descr = {1, 0, 0, 1, (unsigned int)(CO_OPTIMIZED|CO_NEWLOCALS), 138, 2};
    PyObject* const varnames[] = {__pyx_mstate->__pyx_n_u_self};
    __pyx_mstate_global->__pyx_codeobj_tab[383] = __Pyx_PyCode_New(descr, varnames, __pyx_mstate->__pyx_kp_u_pysam_libcbcf_pxd, __pyx_mstate->__pyx_n_u_get_2, __pyx_k__18, tuple_dedup_map); if (unlikely(!__pyx_mstate_global->__pyx_codeobj_tab[383])) goto bad;
  }
  {
    const __Pyx_PyCode_New_function_description descr = {1, 0, 0, 1, (unsigned int)(CO_OPTIMIZED|CO_NEWLOCALS), 141, 2};
    PyObject* const varnames[] = {__pyx_mstate->__pyx_n_u_self};
    __pyx_mstate_global->__pyx_codeobj_tab[384] = __Pyx_PyCode_New(descr, varnames, __pyx_mstate->__pyx_kp_u_pysam_libcbcf_pxd, __pyx_mstate->__pyx_n_u_get_2, __pyx_k_Q_2, tuple_dedup_map); if (unlikely(!__pyx_mstate_global->__pyx_codeobj_tab[384])) goto bad;
  }
  {
    const __Pyx_PyCode_New_function_description descr = {1, 0, 0, 1, (unsigned int)(CO_OPTIMIZED|CO_NEWLOCALS), 142, 2};
    PyObject* const varnames[] = {__pyx_mstate->__pyx_n_u_self};
    __pyx_mstate_global->__pyx_codeobj_tab[385] = __Pyx_PyCode_New(descr, varnames, __pyx_mstate->__pyx_kp_u_pysam_libcbcf_pxd, __pyx_mstate->__pyx_n_u_get_2, __pyx_k_Q_2, tuple_dedup_map); if (unlikely(!__pyx_mstate_global->__pyx_codeobj_tab[385])) goto bad;
  }
  {
    const __Pyx_PyCode_New_function_description descr = {1, 0, 0, 1, (unsigned int)(CO_OPTIMIZED|CO_NEWLOCALS), 1, 9};
    PyObject* const varnames[] = {__pyx_mstate->__pyx_n_u_self};
    __pyx_mstate_global->__pyx_codeobj_tab[386] = __Pyx_PyCode_New(descr, varnames, __pyx_mstate->__pyx_kp_u_stringsource, __pyx_mstate->__pyx_n_u_reduce_cython, __pyx_k_Q, tuple_dedup_map); if (unlikely(!__pyx_mstate_global->__pyx_codeobj_tab[386])) goto bad;
  }
  {
    const __Pyx_PyCode_New_function_description descr = {2, 0, 0, 2, (unsigned int)(CO_OPTIMIZED|CO_NEWLOCALS), 3, 9};
    PyObject* const varnames[] = {__pyx_mstate->__pyx_n_u_self, __pyx_mstate->__pyx_n_u_pyx_state};
    __pyx_mstate_global->__pyx_codeobj_tab[387] = __Pyx_PyCode_New(descr, varnames, __pyx_mstate->__pyx_kp_u_stringsource, __pyx_mstate->__pyx_n_u_setstate_cython, __pyx_k_Q, tuple_dedup_map); if (unlikely(!__pyx_mstate_global->__pyx_codeobj_tab[387])) goto bad;
  }
  {
    const __Pyx_PyCode_New_function_description descr = {3, 0, 0, 5, (unsigned int)(CO_OPTIMIZED|CO_NEWLOCALS), 1, 78};
    PyObject* const varnames[] = {__pyx_mstate->__pyx_n_u_pyx_type, __pyx_mstate->__pyx_n_u_pyx_checksum, __pyx_mstate->__pyx_n_u_pyx_state, __pyx_mstate->__pyx_n_u_pyx_PickleError, __pyx_mstate->__pyx_n_u_pyx_result};
    __pyx_mstate_global->__pyx_codeobj_tab[388] = __Pyx_PyCode_New(descr, varnames, __pyx_mstate->__pyx_kp_u_stringsource, __pyx_mstate->__pyx_n_u_pyx_unpickle_VariantHeaderReco, __pyx_k_hk_A_1_qqsst_xq_7_6a7Nn_1, tuple_dedup_map); if (unlikely(!__pyx_mstate_global->__pyx_codeobj_tab[388])) goto bad;
  }
  {
    const __Pyx_PyCode_New_function_description descr = {2, 0, 0, 8, (unsigned int)(CO_OPTIMIZED|CO_NEWLOCALS), 11, 51};
    PyObject* const varnames[] = {__pyx_mstate->__pyx_n_u_pyx_result, __pyx_mstate->__pyx_n_u_pyx_state, __pyx_mstate->__pyx_n_u_MAX_POS, __pyx_mstate->__pyx_n_u_VALUE_TYPES, __pyx_mstate->__pyx_n_u_METADATA_TYPES, __pyx_mstate->__pyx_n_u_METADATA_LENGTHS, __pyx_mstate->__pyx_n_u_nothing, __pyx_mstate->__pyx_n_u_bcf_str_cache};
    __pyx_mstate_global->__pyx_codeobj_tab[389] = __Pyx_PyCode_New(descr, varnames, __pyx_mstate->__pyx_kp_u_stringsource, __pyx_mstate->__pyx_n_u_pyx_unpickle_VariantHeaderReco_2, __pyx_k_Qa_s_D_q_a_IWA, tuple_dedup_map); if (unlikely(!__pyx_mstate_global->__pyx_codeobj_tab[389])) goto bad;
  }
  {
    const __Pyx_PyCode_New_function_description descr = {3, 0, 0, 5, (unsigned int)(CO_OPTIMIZED|CO_NEWLOCALS), 1, 77};
    PyObject* const varnames[] = {__pyx_mstate->__pyx_n_u_pyx_type, __pyx_mstate->__pyx_n_u_pyx_checksum, __pyx_mstate->__pyx_n_u_pyx_state, __pyx_mstate->__pyx_n_u_pyx_PickleError, __pyx_mstate->__pyx_n_u_pyx_result};
    __pyx_mstate_global->__pyx_codeobj_tab[390] = __Pyx_PyCode_New(descr, varnames, __pyx_mstate->__pyx_kp_u_stringsource, __pyx_mstate->__pyx_n_u_pyx_unpickle_VariantMetadata, __pyx_k_hk_A_1_1_7_1_2DNRS_1, tuple_dedup_map); if (unlikely(!__pyx_mstate_global->__pyx_codeobj_tab[390])) goto bad;
  }
  {
    const __Pyx_PyCode_New_function_description descr = {2, 0, 0, 8, (unsigned int)(CO_OPTIMIZED|CO_NEWLOCALS), 11, 75};
    PyObject* const varnames[] = {__pyx_mstate->__pyx_n_u_pyx_result, __pyx_mstate->__pyx_n_u_pyx_state, __pyx_mstate->__pyx_n_u_MAX_POS, __pyx_mstate->__pyx_n_u_VALUE_TYPES, __pyx_mstate->__pyx_n_u_METADATA_TYPES, __pyx_mstate->__pyx_n_u_METADATA_LENGTHS, __pyx_mstate->__pyx_n_u_nothing, __pyx_mstate->__pyx_n_u_bcf_str_cache};
    __pyx_mstate_global->__pyx_codeobj_tab[391] = __Pyx_PyCode_New(descr, varnames, __pyx_mstate->__pyx_kp_u_stringsource, __pyx_mstate->__pyx_n_u_pyx_unpickle_VariantMetadata_2, __pyx_k_Qd_fKq_LX_kkllm_s_D_q_a_IWA, tuple_dedup_map); if (unlikely(!__pyx_mstate_global->__pyx_codeobj_tab[391])) goto bad;
  }
  {
    const __Pyx_PyCode_New_function_description descr = {3, 0, 0, 5, (unsigned int)(CO_OPTIMIZED|CO_NEWLOCALS), 1, 79};
    PyObject* const varnames[] = {__pyx_mstate->__pyx_n_u_pyx_type, __pyx_mstate->__pyx_n_u_pyx_checksum, __pyx_mstate->__pyx_n_u_pyx_state, __pyx_mstate->__pyx_n_u_pyx_PickleError, __pyx_mstate->__pyx_n_u_pyx_result};
    __pyx_mstate_global->__pyx_codeobj_tab[392] = __Pyx_PyCode_New(descr, varnames, __pyx_mstate->__pyx_kp_u_stringsource, __pyx_mstate->__pyx_n_u_pyx_unpickle_VariantHeaderMeta, __pyx_k_hk_A_1_wwyyz_7_7q8PP___1, tuple_dedup_map); if (unlikely(!__pyx_mstate_global->__pyx_codeobj_tab[392])) goto bad;
  }
  {
    const __Pyx_PyCode_New_function_description descr = {2, 0, 0, 8, (unsigned int)(CO_OPTIMIZED|CO_NEWLOCALS), 11, 61};
    PyObject* const varnames[] = {__pyx_mstate->__pyx_n_u_pyx_result, __pyx_mstate->__pyx_n_u_pyx_state, __pyx_mstate->__pyx_n_u_MAX_POS, __pyx_mstate->__pyx_n_u_VALUE_TYPES, __pyx_mstate->__pyx_n_u_METADATA_TYPES, __pyx_mstate->__pyx_n_u_METADATA_LENGTHS, __pyx_mstate->__pyx_n_u_nothing, __pyx_mstate->__pyx_n_u_bcf_str_cache};
    __pyx_mstate_global->__pyx_codeobj_tab[393] = __Pyx_PyCode_New(descr, varnames, __pyx_mstate->__pyx_kp_u_stringsource, __pyx_mstate->__pyx_n_u_pyx_unpickle_VariantHeaderMeta_2, __pyx_k_Qd_hk_s_D_q_a_IWA, tuple_dedup_map); if (unlikely(!__pyx_mstate_global->__pyx_codeobj_tab[393])) goto bad;
  }
  {
    const __Pyx_PyCode_New_function_description descr = {3, 0, 0, 5, (unsigned int)(CO_OPTIMIZED|CO_NEWLOCALS), 1, 76};
    PyObject* const varnames[] = {__pyx_mstate->__pyx_n_u_pyx_type, __pyx_mstate->__pyx_n_u_pyx_checksum, __pyx_mstate->__pyx_n_u_pyx_state, __pyx_mstate->__pyx_n_u_pyx_PickleError, __pyx_mstate->__pyx_n_u_pyx_result};
    __pyx_mstate_global->__pyx_codeobj_tab[394] = __Pyx_PyCode_New(descr, varnames, __pyx_mstate->__pyx_kp_u_stringsource, __pyx_mstate->__pyx_n_u_pyx_unpickle_VariantContig, __pyx_k_hk_A_1_uuwwx_7_q0_a_1, tuple_dedup_map); if (unlikely(!__pyx_mstate_global->__pyx_codeobj_tab[394])) goto bad;
  }
  {
    const __Pyx_PyCode_New_function_description descr = {2, 0, 0, 8, (unsigned int)(CO_OPTIMIZED|CO_NEWLOCALS), 11, 61};
    PyObject* const varnames[] = {__pyx_mstate->__pyx_n_u_pyx_result, __pyx_mstate->__pyx_n_u_pyx_state, __pyx_mstate->__pyx_n_u_MAX_POS, __pyx_mstate->__pyx_n_u_VALUE_TYPES, __pyx_mstate->__pyx_n_u_METADATA_TYPES, __pyx_mstate->__pyx_n_u_METADATA_LENGTHS, __pyx_mstate->__pyx_n_u_nothing, __pyx_mstate->__pyx_n_u_bcf_str_cache};
    __pyx_mstate_global->__pyx_codeobj_tab[395] = __Pyx_PyCode_New(descr, varnames, __pyx_mstate->__pyx_kp_u_stringsource, __pyx_mstate->__pyx_n_u_pyx_unpickle_VariantContig__se, __pyx_k_Qd_fKq_s_D_q_a_IWA, tuple_dedup_map); if (unlikely(!__pyx_mstate_global->__pyx_codeobj_tab[395])) goto bad;
  }
  {
    const __Pyx_PyCode_New_function_description descr = {3, 0, 0, 5, (unsigned int)(CO_OPTIMIZED|CO_NEWLOCALS), 1, 78};
    PyObject* const varnames[] = {__pyx_mstate->__pyx_n_u_pyx_type, __pyx_mstate->__pyx_n_u_pyx_checksum, __pyx_mstate->__pyx_n_u_pyx_state, __pyx_mstate->__pyx_n_u_pyx_PickleError, __pyx_mstate->__pyx_n_u_pyx_result};
    __pyx_mstate_global->__pyx_codeobj_tab[396] = __Pyx_PyCode_New(descr, varnames, __pyx_mstate->__pyx_kp_u_stringsource, __pyx_mstate->__pyx_n_u_pyx_unpickle_VariantHeaderCont, __pyx_k_hk_A_1_qqsst_xq_7_6a7Nn_1, tuple_dedup_map); if (unlikely(!__pyx_mstate_global->__pyx_codeobj_tab[396])) goto bad;
  }
  {
    const __Pyx_PyCode_New_function_description descr = {2, 0, 0, 8, (unsigned int)(CO_OPTIMIZED|CO_NEWLOCALS), 11, 51};
    PyObject* const varnames[] = {__pyx_mstate->__pyx_n_u_pyx_result, __pyx_mstate->__pyx_n_u_pyx_state, __pyx_mstate->__pyx_n_u_MAX_POS, __pyx_mstate->__pyx_n_u_VALUE_TYPES, __pyx_mstate->__pyx_n_u_METADATA_TYPES, __pyx_mstate->__pyx_n_u_METADATA_LENGTHS, __pyx_mstate->__pyx_n_u_nothing, __pyx_mstate->__pyx_n_u_bcf_str_cache};
    __pyx_mstate_global->__pyx_codeobj_tab[397] = __Pyx_PyCode_New(descr, varnames, __pyx_mstate->__pyx_kp_u_stringsource, __pyx_mstate->__pyx_n_u_pyx_unpickle_VariantHeaderCont_2, __pyx_k_Qa_s_D_q_a_IWA, tuple_dedup_map); if (unlikely(!__pyx_mstate_global->__pyx_codeobj_tab[397])) goto bad;
  }
  {
    const __Pyx_PyCode_New_function_description descr = {3, 0, 0, 5, (unsigned int)(CO_OPTIMIZED|CO_NEWLOCALS), 1, 78};
    PyObject* const varnames[] = {__pyx_mstate->__pyx_n_u_pyx_type, __pyx_mstate->__pyx_n_u_pyx_checksum, __pyx_mstate->__pyx_n_u_pyx_state, __pyx_mstate->__pyx_n_u_pyx_PickleError, __pyx_mstate->__pyx_n_u_pyx_result};
    __pyx_mstate_global->__pyx_codeobj_tab[398] = __Pyx_PyCode_New(descr, varnames, __pyx_mstate->__pyx_kp_u_stringsource, __pyx_mstate->__pyx_n_u_pyx_unpickle_VariantHeaderSamp, __pyx_k_hk_A_1_qqsst_xq_7_6a7Nn_1, tuple_dedup_map); if (unlikely(!__pyx_mstate_global->__pyx_codeobj_tab[398])) goto bad;
  }
  {
    const __Pyx_PyCode_New_function_description descr = {2, 0, 0, 8, (unsigned int)(CO_OPTIMIZED|CO_NEWLOCALS), 11, 51};
    PyObject* const varnames[] = {__pyx_mstate->__pyx_n_u_pyx_result, __pyx_mstate->__pyx_n_u_pyx_state, __pyx_mstate->__pyx_n_u_MAX_POS, __pyx_mstate->__pyx_n_u_VALUE_TYPES, __pyx_mstate->__pyx_n_u_METADATA_TYPES, __pyx_mstate->__pyx_n_u_METADATA_LENGTHS, __pyx_mstate->__pyx_n_u_nothing, __pyx_mstate->__pyx_n_u_bcf_str_cache};
    __pyx_mstate_global->__pyx_codeobj_tab[399] = __Pyx_PyCode_New(descr, varnames, __pyx_mstate->__pyx_kp_u_stringsource, __pyx_mstate->__pyx_n_u_pyx_unpickle_VariantHeaderSamp_2, __pyx_k_Qa_s_D_q_a_IWA, tuple_dedup_map); if (unlikely(!__pyx_mstate_global->__pyx_codeobj_tab[399])) goto bad;
  }
  {
    const __Pyx_PyCode_New_function_description descr = {3, 0, 0, 5, (unsigned int)(CO_OPTIMIZED|CO_NEWLOCALS), 1, 78};
    PyObject* const varnames[] = {__pyx_mstate->__pyx_n_u_pyx_type, __pyx_mstate->__pyx_n_u_pyx_checksum, __pyx_mstate->__pyx_n_u_pyx_state, __pyx_mstate->__pyx_n_u_pyx_PickleError, __pyx_mstate->__pyx_n_u_pyx_result};
    __pyx_mstate_global->__pyx_codeobj_tab[400] = __Pyx_PyCode_New(descr, varnames, __pyx_mstate->__pyx_kp_u_stringsource, __pyx_mstate->__pyx_n_u_pyx_unpickle_VariantRecordFilt, __pyx_k_hk_A_1_qqsst_haq_7_5Q6LNZ_1, tuple_dedup_map); if (unlikely(!__pyx_mstate_global->__pyx_codeobj_tab[400])) goto bad;
  }
  {
    const __Pyx_PyCode_New_function_description descr = {2, 0, 0, 8, (unsigned int)(CO_OPTIMIZED|CO_NEWLOCALS), 11, 51};
    PyObject* const varnames[] = {__pyx_mstate->__pyx_n_u_pyx_result, __pyx_mstate->__pyx_n_u_pyx_state, __pyx_mstate->__pyx_n_u_MAX_POS, __pyx_mstate->__pyx_n_u_VALUE_TYPES, __pyx_mstate->__pyx_n_u_METADATA_TYPES, __pyx_mstate->__pyx_n_u_METADATA_LENGTHS, __pyx_mstate->__pyx_n_u_nothing, __pyx_mstate->__pyx_n_u_bcf_str_cache};
    __pyx_mstate_global->__pyx_codeobj_tab[401] = __Pyx_PyCode_New(descr, varnames, __pyx_mstate->__pyx_kp_u_stringsource, __pyx_mstate->__pyx_n_u_pyx_unpickle_VariantRecordFilt_2, __pyx_k_Qa_s_D_q_a_IWA, tuple_dedup_map); if (unlikely(!__pyx_mstate_global->__pyx_codeobj_tab[401])) goto bad;
  }
  {
    const __Pyx_PyCode_New_function_description descr = {3, 0, 0, 5, (unsigned int)(CO_OPTIMIZED|CO_NEWLOCALS), 1, 78};
    PyObject* const varnames[] = {__pyx_mstate->__pyx_n_u_pyx_type, __pyx_mstate->__pyx_n_u_pyx_checksum, __pyx_mstate->__pyx_n_u_pyx_state, __pyx_mstate->__pyx_n_u_pyx_PickleError, __pyx_mstate->__pyx_n_u_pyx_result};
    __pyx_mstate_global->__pyx_codeobj_tab[402] = __Pyx_PyCode_New(descr, varnames, __pyx_mstate->__pyx_kp_u_stringsource, __pyx_mstate->__pyx_n_u_pyx_unpickle_VariantRecordForm, __pyx_k_hk_A_1_qqsst_haq_7_5Q6LNZ_1, tuple_dedup_map); if (unlikely(!__pyx_mstate_global->__pyx_codeobj_tab[402])) goto bad;
  }
  {
    const __Pyx_PyCode_New_function_description descr = {2, 0, 0, 8, (unsigned int)(CO_OPTIMIZED|CO_NEWLOCALS), 11, 51};
    PyObject* const varnames[] = {__pyx_mstate->__pyx_n_u_pyx_result, __pyx_mstate->__pyx_n_u_pyx_state, __pyx_mstate->__pyx_n_u_MAX_POS, __pyx_mstate->__pyx_n_u_VALUE_TYPES, __pyx_mstate->__pyx_n_u_METADATA_TYPES, __pyx_mstate->__pyx_n_u_METADATA_LENGTHS, __pyx_mstate->__pyx_n_u_nothing, __pyx_mstate->__pyx_n_u_bcf_str_cache};
    __pyx_mstate_global->__pyx_codeobj_tab[403] = __Pyx_PyCode_New(descr, varnames, __pyx_mstate->__pyx_kp_u_stringsource, __pyx_mstate->__pyx_n_u_pyx_unpickle_VariantRecordForm_2, __pyx_k_Qa_s_D_q_a_IWA, tuple_dedup_map); if (unlikely(!__pyx_mstate_global->__pyx_codeobj_tab[403])) goto bad;
  }
  {
    const __Pyx_PyCode_New_function_description descr = {3, 0, 0, 5, (unsigned int)(CO_OPTIMIZED|CO_NEWLOCALS), 1, 78};
    PyObject* const varnames[] = {__pyx_mstate->__pyx_n_u_pyx_type, __pyx_mstate->__pyx_n_u_pyx_checksum, __pyx_mstate->__pyx_n_u_pyx_state, __pyx_mstate->__pyx_n_u_pyx_PickleError, __pyx_mstate->__pyx_n_u_pyx_result};
    __pyx_mstate_global->__pyx_codeobj_tab[404] = __Pyx_PyCode_New(descr, varnames, __pyx_mstate->__pyx_kp_u_stringsource, __pyx_mstate->__pyx_n_u_pyx_unpickle_VariantRecordInfo, __pyx_k_hk_A_1_qqsst_HAQ_7_314H_VW_1, tuple_dedup_map); if (unlikely(!__pyx_mstate_global->__pyx_codeobj_tab[404])) goto bad;
  }
  {
    const __Pyx_PyCode_New_function_description descr = {2, 0, 0, 8, (unsigned int)(CO_OPTIMIZED|CO_NEWLOCALS), 11, 51};
    PyObject* const varnames[] = {__pyx_mstate->__pyx_n_u_pyx_result, __pyx_mstate->__pyx_n_u_pyx_state, __pyx_mstate->__pyx_n_u_MAX_POS, __pyx_mstate->__pyx_n_u_VALUE_TYPES, __pyx_mstate->__pyx_n_u_METADATA_TYPES, __pyx_mstate->__pyx_n_u_METADATA_LENGTHS, __pyx_mstate->__pyx_n_u_nothing, __pyx_mstate->__pyx_n_u_bcf_str_cache};
    __pyx_mstate_global->__pyx_codeobj_tab[405] = __Pyx_PyCode_New(descr, varnames, __pyx_mstate->__pyx_kp_u_stringsource, __pyx_mstate->__pyx_n_u_pyx_unpickle_VariantRecordInfo_2, __pyx_k_Qa_s_D_q_a_IWA, tuple_dedup_map); if (unlikely(!__pyx_mstate_global->__pyx_codeobj_tab[405])) goto bad;
  }
  {
    const __Pyx_PyCode_New_function_description descr = {3, 0, 0, 5, (unsigned int)(CO_OPTIMIZED|CO_NEWLOCALS), 1, 78};
    PyObject* const varnames[] = {__pyx_mstate->__pyx_n_u_pyx_type, __pyx_mstate->__pyx_n_u_pyx_checksum, __pyx_mstate->__pyx_n_u_pyx_state, __pyx_mstate->__pyx_n_u_pyx_PickleError, __pyx_mstate->__pyx_n_u_pyx_result};
    __pyx_mstate_global->__pyx_codeobj_tab[406] = __Pyx_PyCode_New(descr, varnames, __pyx_mstate->__pyx_kp_u_stringsource, __pyx_mstate->__pyx_n_u_pyx_unpickle_VariantRecordSamp, __pyx_k_hk_A_1_qqsst_xq_7_6a7Nn_1, tuple_dedup_map); if (unlikely(!__pyx_mstate_global->__pyx_codeobj_tab[406])) goto bad;
  }
  {
    const __Pyx_PyCode_New_function_description descr = {2, 0, 0, 8, (unsigned int)(CO_OPTIMIZED|CO_NEWLOCALS), 11, 51};
    PyObject* const varnames[] = {__pyx_mstate->__pyx_n_u_pyx_result, __pyx_mstate->__pyx_n_u_pyx_state, __pyx_mstate->__pyx_n_u_MAX_POS, __pyx_mstate->__pyx_n_u_VALUE_TYPES, __pyx_mstate->__pyx_n_u_METADATA_TYPES, __pyx_mstate->__pyx_n_u_METADATA_LENGTHS, __pyx_mstate->__pyx_n_u_nothing, __pyx_mstate->__pyx_n_u_bcf_str_cache};
    __pyx_mstate_global->__pyx_codeobj_tab[407] = __Pyx_PyCode_New(descr, varnames, __pyx_mstate->__pyx_kp_u_stringsource, __pyx_mstate->__pyx_n_u_pyx_unpickle_VariantRecordSamp_3, __pyx_k_Qa_s_D_q_a_IWA, tuple_dedup_map); if (unlikely(!__pyx_mstate_global->__pyx_codeobj_tab[407])) goto bad;
  }
  {
    const __Pyx_PyCode_New_function_description descr = {3, 0, 0, 5, (unsigned int)(CO_OPTIMIZED|CO_NEWLOCALS), 1, 78};
    PyObject* const varnames[] = {__pyx_mstate->__pyx_n_u_pyx_type, __pyx_mstate->__pyx_n_u_pyx_checksum, __pyx_mstate->__pyx_n_u_pyx_state, __pyx_mstate->__pyx_n_u_pyx_PickleError, __pyx_mstate->__pyx_n_u_pyx_result};
    __pyx_mstate_global->__pyx_codeobj_tab[408] = __Pyx_PyCode_New(descr, varnames, __pyx_mstate->__pyx_kp_u_stringsource, __pyx_mstate->__pyx_n_u_pyx_unpickle_VariantRecordSamp_2, __pyx_k_hk_A_1_xxzz_haq_7_5Q6LNZ_1, tuple_dedup_map); if (unlikely(!__pyx_mstate_global->__pyx_codeobj_tab[408])) goto bad;
  }
  {
    const __Pyx_PyCode_New_function_description descr = {2, 0, 0, 8, (unsigned int)(CO_OPTIMIZED|CO_NEWLOCALS), 11, 61};
    PyObject* const varnames[] = {__pyx_mstate->__pyx_n_u_pyx_result, __pyx_mstate->__pyx_n_u_pyx_state, __pyx_mstate->__pyx_n_u_MAX_POS, __pyx_mstate->__pyx_n_u_VALUE_TYPES, __pyx_mstate->__pyx_n_u_METADATA_TYPES, __pyx_mstate->__pyx_n_u_METADATA_LENGTHS, __pyx_mstate->__pyx_n_u_nothing, __pyx_mstate->__pyx_n_u_bcf_str_cache};
    __pyx_mstate_global->__pyx_codeobj_tab[409] = __Pyx_PyCode_New(descr, varnames, __pyx_mstate->__pyx_kp_u_stringsource, __pyx_mstate->__pyx_n_u_pyx_unpickle_VariantRecordSamp_4, __pyx_k_AT_Z_1_s_D_q_a_IWA, tuple_dedup_map); if (unlikely(!__pyx_mstate_global->__pyx_codeobj_tab[409])) goto bad;
  }
  {
    const __Pyx_PyCode_New_function_description descr = {3, 0, 0, 5, (unsigned int)(CO_OPTIMIZED|CO_NEWLOCALS), 1, 75};
    PyObject* const varnames[] = {__pyx_mstate->__pyx_n_u_pyx_type, __pyx_mstate->__pyx_n_u_pyx_checksum, __pyx_mstate->__pyx_n_u_pyx_state, __pyx_mstate->__pyx_n_u_pyx_PickleError, __pyx_mstate->__pyx_n_u_pyx_result};
    __pyx_mstate_global->__pyx_codeobj_tab[410] = __Pyx_PyCode_New(descr, varnames, __pyx_mstate->__pyx_kp_u_stringsource, __pyx_mstate->__pyx_n_u_pyx_unpickle_BaseIndex, __pyx_k_hk_A_1_wwyyz_9HAQ_7_1L_a_1, tuple_dedup_map); if (unlikely(!__pyx_mstate_global->__pyx_codeobj_tab[410])) goto bad;
  }
  {
    const __Pyx_PyCode_New_function_description descr = {2, 0, 0, 8, (unsigned int)(CO_OPTIMIZED|CO_NEWLOCALS), 11, 61};
    PyObject* const varnames[] = {__pyx_mstate->__pyx_n_u_pyx_result, __pyx_mstate->__pyx_n_u_pyx_state, __pyx_mstate->__pyx_n_u_MAX_POS, __pyx_mstate->__pyx_n_u_VALUE_TYPES, __pyx_mstate->__pyx_n_u_METADATA_TYPES, __pyx_mstate->__pyx_n_u_METADATA_LENGTHS, __pyx_mstate->__pyx_n_u_nothing, __pyx_mstate->__pyx_n_u_bcf_str_cache};
    __pyx_mstate_global->__pyx_codeobj_tab[411] = __Pyx_PyCode_New(descr, varnames, __pyx_mstate->__pyx_kp_u_stringsource, __pyx_mstate->__pyx_n_u_pyx_unpickle_BaseIndex__set_st, __pyx_k_Qd_hk_s_D_q_a_IWA, tuple_dedup_map); if (unlikely(!__pyx_mstate_global->__pyx_codeobj_tab[411])) 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)

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

  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 */
#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 */
#if CYTHON_FAST_THREAD_STATE
static CYTHON_INLINE void __Pyx_ErrRestoreInState(PyThreadState *tstate, PyObject *type, PyObject *value, PyObject *tb) {
#if PY_VERSION_HEX >= 0x030C00A6
    PyObject *tmp_value;
    assert(type == NULL || (value != NULL && type == (PyObject*) Py_TYPE(value)));
    if (value) {
        #if CYTHON_COMPILING_IN_CPYTHON
        if (unlikely(((PyBaseExceptionObject*) value)->traceback != tb))
        #endif
            PyException_SetTraceback(value, tb);
    }
    tmp_value = tstate->current_exception;
    tstate->current_exception = value;
    Py_XDECREF(tmp_value);
    Py_XDECREF(type);
    Py_XDECREF(tb);
#else
    PyObject *tmp_type, *tmp_value, *tmp_tb;
    tmp_type = tstate->curexc_type;
    tmp_value = tstate->curexc_value;
    tmp_tb = tstate->curexc_traceback;
    tstate->curexc_type = type;
    tstate->curexc_value = value;
    tstate->curexc_traceback = tb;
    Py_XDECREF(tmp_type);
    Py_XDECREF(tmp_value);
    Py_XDECREF(tmp_tb);
#endif
}
static CYTHON_INLINE void __Pyx_ErrFetchInState(PyThreadState *tstate, PyObject **type, PyObject **value, PyObject **tb) {
#if PY_VERSION_HEX >= 0x030C00A6
    PyObject* exc_value;
    exc_value = tstate->current_exception;
    tstate->current_exception = 0;
    *value = exc_value;
    *type = NULL;
    *tb = NULL;
    if (exc_value) {
        *type = (PyObject*) Py_TYPE(exc_value);
        Py_INCREF(*type);
        #if CYTHON_COMPILING_IN_CPYTHON
        *tb = ((PyBaseExceptionObject*) exc_value)->traceback;
        Py_XINCREF(*tb);
        #else
        *tb = PyException_GetTraceback(exc_value);
        #endif
    }
#else
    *type = tstate->curexc_type;
    *value = tstate->curexc_value;
    *tb = tstate->curexc_traceback;
    tstate->curexc_type = 0;
    tstate->curexc_value = 0;
    tstate->curexc_traceback = 0;
#endif
}
#endif

/* PyObjectGetAttrStr */
#if CYTHON_USE_TYPE_SLOTS
static CYTHON_INLINE PyObject* __Pyx_PyObject_GetAttrStr(PyObject* obj, PyObject* attr_name) {
    PyTypeObject* tp = Py_TYPE(obj);
    if (likely(tp->tp_getattro))
        return tp->tp_getattro(obj, attr_name);
    return PyObject_GetAttr(obj, attr_name);
}
#endif

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

/* TupleAndListFromArray */
#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++) {
        if (unlikely(__Pyx_PyTuple_SET_ITEM(res, i, src[i]) < 0)) {
            Py_DECREF(res);
            return NULL;
        }
        Py_INCREF(src[i]);
    }
    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 */
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 */
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

/* Profile */
#if CYTHON_PROFILE || CYTHON_TRACE
#if CYTHON_TRACE && !CYTHON_USE_SYS_MONITORING
static int __Pyx_call_line_trace_func(PyThreadState *tstate, PyFrameObject *frame, int line) {
    int ret;
    PyObject *type, *value, *traceback;
    __Pyx_ErrFetchInState(tstate, &type, &value, &traceback);
    __Pyx_PyFrame_SetLineNumber(frame, line);
    __Pyx_EnterTracing(tstate);
    ret = tstate->c_tracefunc(tstate->c_traceobj, frame, PyTrace_LINE, NULL);
    __Pyx_LeaveTracing(tstate);
    if (likely(!ret)) {
        __Pyx_ErrRestoreInState(tstate, type, value, traceback);
    } else {
        Py_XDECREF(type);
        Py_XDECREF(value);
        Py_XDECREF(traceback);
    }
    return ret;
}
#endif
CYTHON_UNUSED static PyCodeObject *__Pyx_createFrameCodeObject(const char *funcname, const char *srcfile, int firstlineno) {
    PyCodeObject *py_code = PyCode_NewEmpty(srcfile, funcname, firstlineno);
    if (likely(py_code)) {
        py_code->co_flags |= CO_OPTIMIZED | CO_NEWLOCALS;
    }
    return py_code;
}
#if CYTHON_USE_SYS_MONITORING
CYTHON_UNUSED static int __Pyx__TraceStartFunc(PyMonitoringState *state_array, PyObject *code_obj, int offset, int skip_event) {
    int ret;
    __pyx_monitoring_version_type version = 0;
    ret = PyMonitoring_EnterScope(state_array, &version, __Pyx_MonitoringEventTypes, __Pyx_MonitoringEventTypes_CyFunc_count);
    if (unlikely(ret == -1)) return -1;
    return skip_event ? 0 : PyMonitoring_FirePyStartEvent(&state_array[__Pyx_Monitoring_PY_START], code_obj, offset);
}
CYTHON_UNUSED static int __Pyx__TraceStartGen(PyMonitoringState *state_array, __pyx_monitoring_version_type *version, PyObject *code_obj, int offset) {
    int ret;
    ret = PyMonitoring_EnterScope(state_array, version, __Pyx_MonitoringEventTypes, __Pyx_MonitoringEventTypes_CyGen_count);
    if (unlikely(ret == -1)) return -1;
    return PyMonitoring_FirePyStartEvent(&state_array[__Pyx_Monitoring_PY_START], code_obj, offset);
}
CYTHON_UNUSED static int __Pyx__TraceResumeGen(PyMonitoringState *state_array, __pyx_monitoring_version_type *version, PyObject *code_obj, int offset) {
    int ret;
    ret = PyMonitoring_EnterScope(state_array, version, __Pyx_MonitoringEventTypes, __Pyx_MonitoringEventTypes_CyGen_count);
    if (unlikely(ret == -1)) return -1;
    return PyMonitoring_FirePyResumeEvent(&state_array[__Pyx_Monitoring_PY_RESUME], code_obj, offset);
}
CYTHON_UNUSED static void __Pyx__TraceException(PyMonitoringState *monitoring_state, PyObject *code_obj, int offset, int reraised) {
    if (reraised) {
        (void) PyMonitoring_FireReraiseEvent(monitoring_state, code_obj, offset);
    } else {
        (void) PyMonitoring_FireRaiseEvent(monitoring_state, code_obj, offset);
    }
}
#if CYTHON_TRACE
CYTHON_UNUSED static int __Pyx__TraceLine(PyMonitoringState *monitoring_state, PyObject *code_obj, int line, int offset) {
    int ret;
    PyObject *exc = PyErr_GetRaisedException();
    ret = PyMonitoring_FireLineEvent(monitoring_state, code_obj, offset, line);
    if (exc) PyErr_SetRaisedException(exc);
    return ret;
}
#endif
#else
static int __Pyx_TraceSetupAndCall(PyCodeObject** code,
                                   PyFrameObject** frame,
                                   PyThreadState* tstate,
                                   const char *funcname,
                                   const char *srcfile,
                                   int firstlineno,
                                   int skip_event) {
    if (*frame == NULL || !CYTHON_PROFILE_REUSE_FRAME) {
        int needs_new_code_obj = (*code == NULL);
        if (needs_new_code_obj) {
            *code = __Pyx_createFrameCodeObject(funcname, srcfile, firstlineno);
            if (*code == NULL) return 0;
        }
        *frame = PyFrame_New(
            tstate,                          /*PyThreadState *tstate*/
            *code,                           /*PyCodeObject *code*/
            __pyx_mstate_global->__pyx_d,    /*PyObject *globals*/
            0                                /*PyObject *locals*/
        );
        if (needs_new_code_obj && !CYTHON_PROFILE_REUSE_CODEOBJ)
            Py_CLEAR(*code); // otherwise the reference is owned externally
        if (*frame == NULL) return 0;
        if (CYTHON_TRACE && (*frame)->f_trace == NULL) {
            Py_INCREF(Py_None);
            (*frame)->f_trace = Py_None;
        }
    }
    if (!skip_event) {
        PyObject *type, *value, *traceback;
        int retval = 1;
        __Pyx_PyFrame_SetLineNumber(*frame, firstlineno);
        __Pyx_EnterTracing(tstate);
        __Pyx_ErrFetchInState(tstate, &type, &value, &traceback);
        #if CYTHON_TRACE
        if (tstate->c_tracefunc)
            retval = tstate->c_tracefunc(tstate->c_traceobj, *frame, PyTrace_CALL, NULL) == 0;
        if (retval && tstate->c_profilefunc)
        #endif
            retval = tstate->c_profilefunc(tstate->c_profileobj, *frame, PyTrace_CALL, NULL) == 0;
        __Pyx_LeaveTracing(tstate);
        if (unlikely(!retval)) {
            Py_XDECREF(type);
            Py_XDECREF(value);
            Py_XDECREF(traceback);
            return -1;
        }
        __Pyx_ErrRestoreInState(tstate, type, value, traceback);
    }
    return __Pyx_IsTracing(tstate, 0, 0);
}
#endif
#endif

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

/* PyFunctionFastCall */
#if CYTHON_FAST_PYCALL && !CYTHON_VECTORCALL
static PyObject* __Pyx_PyFunction_FastCallNoKw(PyCodeObject *co, PyObject *const *args, Py_ssize_t na,
                                               PyObject *globals) {
    PyFrameObject *f;
    PyThreadState *tstate = __Pyx_PyThreadState_Current;
    PyObject **fastlocals;
    Py_ssize_t i;
    PyObject *result;
    assert(globals != NULL);
    /* XXX Perhaps we should create a specialized
       PyFrame_New() that doesn't take locals, but does
       take builtins without sanity checking them.
       */
    assert(tstate != NULL);
    f = PyFrame_New(tstate, co, globals, NULL);
    if (f == NULL) {
        return NULL;
    }
    fastlocals = __Pyx_PyFrame_GetLocalsplus(f);
    for (i = 0; i < na; i++) {
        Py_INCREF(*args);
        fastlocals[i] = *args++;
    }
    result = PyEval_EvalFrameEx(f,0);
    ++tstate->recursion_depth;
    Py_DECREF(f);
    --tstate->recursion_depth;
    return result;
}
static PyObject *__Pyx_PyFunction_FastCallDict(PyObject *func, PyObject *const *args, Py_ssize_t nargs, PyObject *kwargs) {
    PyCodeObject *co = (PyCodeObject *)PyFunction_GET_CODE(func);
    PyObject *globals = PyFunction_GET_GLOBALS(func);
    PyObject *argdefs = PyFunction_GET_DEFAULTS(func);
    PyObject *closure;
    PyObject *kwdefs;
    PyObject *kwtuple, **k;
    PyObject **d;
    Py_ssize_t nd;
    Py_ssize_t nk;
    PyObject *result;
    assert(kwargs == NULL || PyDict_Check(kwargs));
    nk = kwargs ? PyDict_Size(kwargs) : 0;
    if (unlikely(Py_EnterRecursiveCall(" while calling a Python object"))) {
        return NULL;
    }
    if (
            co->co_kwonlyargcount == 0 &&
            likely(kwargs == NULL || nk == 0) &&
            co->co_flags == (CO_OPTIMIZED | CO_NEWLOCALS | CO_NOFREE)) {
        if (argdefs == NULL && co->co_argcount == nargs) {
            result = __Pyx_PyFunction_FastCallNoKw(co, args, nargs, globals);
            goto done;
        }
        else if (nargs == 0 && argdefs != NULL
                 && co->co_argcount == Py_SIZE(argdefs)) {
            /* function called with no arguments, but all parameters have
               a default value: use default values as arguments .*/
            args = &PyTuple_GET_ITEM(argdefs, 0);
            result =__Pyx_PyFunction_FastCallNoKw(co, args, Py_SIZE(argdefs), globals);
            goto done;
        }
    }
    if (kwargs != NULL) {
        Py_ssize_t pos, i;
        kwtuple = PyTuple_New(2 * nk);
        if (kwtuple == NULL) {
            result = NULL;
            goto done;
        }
        k = &PyTuple_GET_ITEM(kwtuple, 0);
        pos = i = 0;
        while (PyDict_Next(kwargs, &pos, &k[i], &k[i+1])) {
            Py_INCREF(k[i]);
            Py_INCREF(k[i+1]);
            i += 2;
        }
        nk = i / 2;
    }
    else {
        kwtuple = NULL;
        k = NULL;
    }
    closure = PyFunction_GET_CLOSURE(func);
    kwdefs = PyFunction_GET_KW_DEFAULTS(func);
    if (argdefs != NULL) {
        d = &PyTuple_GET_ITEM(argdefs, 0);
        nd = Py_SIZE(argdefs);
    }
    else {
        d = NULL;
        nd = 0;
    }
    result = PyEval_EvalCodeEx((PyObject*)co, globals, (PyObject *)NULL,
                               args, (int)nargs,
                               k, (int)nk,
                               d, (int)nd, kwdefs, closure);
    Py_XDECREF(kwtuple);
done:
    Py_LeaveRecursiveCall();
    return result;
}
#endif

/* PyObjectCall */
#if CYTHON_COMPILING_IN_CPYTHON
static CYTHON_INLINE PyObject* __Pyx_PyObject_Call(PyObject *func, PyObject *arg, PyObject *kw) {
    PyObject *result;
    ternaryfunc call = Py_TYPE(func)->tp_call;
    if (unlikely(!call))
        return PyObject_Call(func, arg, kw);
    if (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 */
#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 */
#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 PY_VERSION_HEX < 0x030800B1
    #if CYTHON_FAST_PYCCALL
    if (PyCFunction_Check(func)) {
        if (kwargs) {
            return _PyCFunction_FastCallDict(func, args, nargs, kwargs);
        } else {
            return _PyCFunction_FastCallKeywords(func, args, nargs, NULL);
        }
    }
    if (!kwargs && __Pyx_IS_TYPE(func, &PyMethodDescr_Type)) {
        return _PyMethodDescr_FastCallKeywords(func, args, nargs, NULL);
    }
    #endif
    #if CYTHON_FAST_PYCALL
    if (PyFunction_Check(func)) {
        return __Pyx_PyFunction_FastCallDict(func, args, nargs, kwargs);
    }
    #endif
    #endif
    if (kwargs == NULL) {
        #if CYTHON_VECTORCALL && !CYTHON_COMPILING_IN_LIMITED_API
        vectorcallfunc f = __Pyx_PyVectorcall_Function(func);
        if (f) {
            return f(func, args, _nargs, NULL);
        }
        #elif defined(__Pyx_CyFunction_USED) && CYTHON_BACKPORT_VECTORCALL
        if (__Pyx_CyFunction_CheckExact(func)) {
            __pyx_vectorcallfunc f = __Pyx_CyFunction_func_vectorcall(func);
            if (f) return f(func, args, _nargs, NULL);
        }
        #elif CYTHON_COMPILING_IN_LIMITED_API && CYTHON_VECTORCALL
        return PyObject_Vectorcall(func, args, _nargs, NULL);
        #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
}

/* 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, x;
#ifdef HAVE_LONG_LONG
    const PY_LONG_LONG llb = intval;
    PY_LONG_LONG lla, llx;
#endif
    if (unlikely(__Pyx_PyLong_IsZero(op1))) {
        return __Pyx_NewRef(op2);
    }
    if (likely(__Pyx_PyLong_IsCompact(op1))) {
        a = __Pyx_PyLong_CompactValue(op1);
    } else {
        const digit* digits = __Pyx_PyLong_Digits(op1);
        const Py_ssize_t size = __Pyx_PyLong_SignedDigitCount(op1);
        switch (size) {
            case -2:
                if (8 * sizeof(long) - 1 > 2 * PyLong_SHIFT) {
                    a = -(long) (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]));
                    break;
                #ifdef HAVE_LONG_LONG
                } else if (8 * sizeof(PY_LONG_LONG) - 1 > 2 * PyLong_SHIFT) {
                    lla = -(PY_LONG_LONG) (((((unsigned PY_LONG_LONG)digits[1]) << PyLong_SHIFT) | (unsigned PY_LONG_LONG)digits[0]));
                    goto long_long;
                #endif
                }
                CYTHON_FALLTHROUGH;
            case 2:
                if (8 * sizeof(long) - 1 > 2 * PyLong_SHIFT) {
                    a = (long) (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]));
                    break;
                #ifdef HAVE_LONG_LONG
                } else if (8 * sizeof(PY_LONG_LONG) - 1 > 2 * PyLong_SHIFT) {
                    lla = (PY_LONG_LONG) (((((unsigned PY_LONG_LONG)digits[1]) << PyLong_SHIFT) | (unsigned PY_LONG_LONG)digits[0]));
                    goto long_long;
                #endif
                }
                CYTHON_FALLTHROUGH;
            case -3:
                if (8 * sizeof(long) - 1 > 3 * PyLong_SHIFT) {
                    a = -(long) (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]));
                    break;
                #ifdef HAVE_LONG_LONG
                } else if (8 * sizeof(PY_LONG_LONG) - 1 > 3 * PyLong_SHIFT) {
                    lla = -(PY_LONG_LONG) (((((((unsigned PY_LONG_LONG)digits[2]) << PyLong_SHIFT) | (unsigned PY_LONG_LONG)digits[1]) << PyLong_SHIFT) | (unsigned PY_LONG_LONG)digits[0]));
                    goto long_long;
                #endif
                }
                CYTHON_FALLTHROUGH;
            case 3:
                if (8 * sizeof(long) - 1 > 3 * PyLong_SHIFT) {
                    a = (long) (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]));
                    break;
                #ifdef HAVE_LONG_LONG
                } else if (8 * sizeof(PY_LONG_LONG) - 1 > 3 * PyLong_SHIFT) {
                    lla = (PY_LONG_LONG) (((((((unsigned PY_LONG_LONG)digits[2]) << PyLong_SHIFT) | (unsigned PY_LONG_LONG)digits[1]) << PyLong_SHIFT) | (unsigned PY_LONG_LONG)digits[0]));
                    goto long_long;
                #endif
                }
                CYTHON_FALLTHROUGH;
            case -4:
                if (8 * sizeof(long) - 1 > 4 * PyLong_SHIFT) {
                    a = -(long) (((((((((unsigned long)digits[3]) << PyLong_SHIFT) | (unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]));
                    break;
                #ifdef HAVE_LONG_LONG
                } else if (8 * sizeof(PY_LONG_LONG) - 1 > 4 * PyLong_SHIFT) {
                    lla = -(PY_LONG_LONG) (((((((((unsigned PY_LONG_LONG)digits[3]) << PyLong_SHIFT) | (unsigned PY_LONG_LONG)digits[2]) << PyLong_SHIFT) | (unsigned PY_LONG_LONG)digits[1]) << PyLong_SHIFT) | (unsigned PY_LONG_LONG)digits[0]));
                    goto long_long;
                #endif
                }
                CYTHON_FALLTHROUGH;
            case 4:
                if (8 * sizeof(long) - 1 > 4 * PyLong_SHIFT) {
                    a = (long) (((((((((unsigned long)digits[3]) << PyLong_SHIFT) | (unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]));
                    break;
                #ifdef HAVE_LONG_LONG
                } else if (8 * sizeof(PY_LONG_LONG) - 1 > 4 * PyLong_SHIFT) {
                    lla = (PY_LONG_LONG) (((((((((unsigned PY_LONG_LONG)digits[3]) << PyLong_SHIFT) | (unsigned PY_LONG_LONG)digits[2]) << PyLong_SHIFT) | (unsigned PY_LONG_LONG)digits[1]) << PyLong_SHIFT) | (unsigned PY_LONG_LONG)digits[0]));
                    goto long_long;
                #endif
                }
                CYTHON_FALLTHROUGH;
            default: return PyLong_Type.tp_as_number->nb_add(op1, op2);
        }
    }
            x = a + b;
        return PyLong_FromLong(x);
#ifdef HAVE_LONG_LONG
    long_long:
            llx = lla + llb;
        return PyLong_FromLongLong(llx);
#endif
    return __Pyx_Fallback___Pyx_PyLong_AddObjC(op1, op2, inplace);
    
    
}
#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

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

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

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

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

/* GetTopmostException */
#if CYTHON_USE_EXC_INFO_STACK && CYTHON_FAST_THREAD_STATE
static _PyErr_StackItem *
__Pyx_PyErr_GetTopmostException(PyThreadState *tstate)
{
    _PyErr_StackItem *exc_info = tstate->exc_info;
    while ((exc_info->exc_value == NULL || exc_info->exc_value == Py_None) &&
           exc_info->previous_item != NULL)
    {
        exc_info = exc_info->previous_item;
    }
    return exc_info;
}
#endif

/* SaveResetException */
#if CYTHON_FAST_THREAD_STATE
static CYTHON_INLINE void __Pyx__ExceptionSave(PyThreadState *tstate, PyObject **type, PyObject **value, PyObject **tb) {
  #if CYTHON_USE_EXC_INFO_STACK && PY_VERSION_HEX >= 0x030B00a4
    _PyErr_StackItem *exc_info = __Pyx_PyErr_GetTopmostException(tstate);
    PyObject *exc_value = exc_info->exc_value;
    if (exc_value == NULL || exc_value == Py_None) {
        *value = NULL;
        *type = NULL;
        *tb = NULL;
    } else {
        *value = exc_value;
        Py_INCREF(*value);
        *type = (PyObject*) Py_TYPE(exc_value);
        Py_INCREF(*type);
        *tb = PyException_GetTraceback(exc_value);
    }
  #elif CYTHON_USE_EXC_INFO_STACK
    _PyErr_StackItem *exc_info = __Pyx_PyErr_GetTopmostException(tstate);
    *type = exc_info->exc_type;
    *value = exc_info->exc_value;
    *tb = exc_info->exc_traceback;
    Py_XINCREF(*type);
    Py_XINCREF(*value);
    Py_XINCREF(*tb);
  #else
    *type = tstate->exc_type;
    *value = tstate->exc_value;
    *tb = tstate->exc_traceback;
    Py_XINCREF(*type);
    Py_XINCREF(*value);
    Py_XINCREF(*tb);
  #endif
}
static CYTHON_INLINE void __Pyx__ExceptionReset(PyThreadState *tstate, PyObject *type, PyObject *value, PyObject *tb) {
  #if CYTHON_USE_EXC_INFO_STACK && PY_VERSION_HEX >= 0x030B00a4
    _PyErr_StackItem *exc_info = tstate->exc_info;
    PyObject *tmp_value = exc_info->exc_value;
    exc_info->exc_value = value;
    Py_XDECREF(tmp_value);
    Py_XDECREF(type);
    Py_XDECREF(tb);
  #else
    PyObject *tmp_type, *tmp_value, *tmp_tb;
    #if CYTHON_USE_EXC_INFO_STACK
    _PyErr_StackItem *exc_info = tstate->exc_info;
    tmp_type = exc_info->exc_type;
    tmp_value = exc_info->exc_value;
    tmp_tb = exc_info->exc_traceback;
    exc_info->exc_type = type;
    exc_info->exc_value = value;
    exc_info->exc_traceback = tb;
    #else
    tmp_type = tstate->exc_type;
    tmp_value = tstate->exc_value;
    tmp_tb = tstate->exc_traceback;
    tstate->exc_type = type;
    tstate->exc_value = value;
    tstate->exc_traceback = tb;
    #endif
    Py_XDECREF(tmp_type);
    Py_XDECREF(tmp_value);
    Py_XDECREF(tmp_tb);
  #endif
}
#endif

/* RaiseUnboundLocalError */
static void __Pyx_RaiseUnboundLocalError(const char *varname) {
    PyErr_Format(PyExc_UnboundLocalError, "local variable '%s' referenced before assignment", varname);
}

/* PyObjectCall2Args */
static CYTHON_INLINE PyObject* __Pyx_PyObject_Call2Args(PyObject* function, PyObject* arg1, PyObject* arg2) {
    PyObject *args[3] = {NULL, arg1, arg2};
    return __Pyx_PyObject_FastCall(function, args+1, 2 | __Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET);
}

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

/* CallUnboundCMethod1 */
#if CYTHON_COMPILING_IN_CPYTHON
static CYTHON_INLINE PyObject* __Pyx_CallUnboundCMethod1(__Pyx_CachedCFunction* cfunc, PyObject* self, PyObject* arg) {
    int was_initialized =  __Pyx_CachedCFunction_GetAndSetInitializing(cfunc);
    if (likely(was_initialized == 2 && cfunc->func)) {
        int flag = cfunc->flag;
        if (flag == METH_O) {
            return __Pyx_CallCFunction(cfunc, self, arg);
        } else if (flag == METH_FASTCALL) {
            return __Pyx_CallCFunctionFast(cfunc, self, &arg, 1);
        } else if (flag == (METH_FASTCALL | METH_KEYWORDS)) {
            return __Pyx_CallCFunctionFastWithKeywords(cfunc, self, &arg, 1, 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__CallUnboundCMethod1(&tmp_cfunc, self, arg);
    }
#endif
    PyObject* result = __Pyx__CallUnboundCMethod1(cfunc, self, arg);
    __Pyx_CachedCFunction_SetFinishedInitializing(cfunc);
    return result;
}
#endif
static PyObject* __Pyx__CallUnboundCMethod1(__Pyx_CachedCFunction* cfunc, PyObject* self, PyObject* arg){
    PyObject *result = NULL;
    if (unlikely(!cfunc->func && !cfunc->method) && unlikely(__Pyx_TryUnpackUnboundCMethod(cfunc) < 0)) return NULL;
#if CYTHON_COMPILING_IN_CPYTHON
    if (cfunc->func && (cfunc->flag & METH_VARARGS)) {
        PyObject *args = PyTuple_New(1);
        if (unlikely(!args)) return NULL;
        Py_INCREF(arg);
        PyTuple_SET_ITEM(args, 0, arg);
        if (cfunc->flag & METH_KEYWORDS)
            result = __Pyx_CallCFunctionWithKeywords(cfunc, self, args, NULL);
        else
            result = __Pyx_CallCFunction(cfunc, self, args);
        Py_DECREF(args);
    } else
#endif
    {
        result = __Pyx_PyObject_Call2Args(cfunc->method, self, arg);
    }
    return result;
}

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

/* PyObjectCallOneArg */
static CYTHON_INLINE PyObject* __Pyx_PyObject_CallOneArg(PyObject *func, PyObject *arg) {
    PyObject *args[2] = {NULL, arg};
    return __Pyx_PyObject_FastCall(func, args+1, 1 | __Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET);
}

/* PyObjectGetMethod */
static int __Pyx_PyObject_GetMethod(PyObject *obj, PyObject *name, PyObject **method) {
    PyObject *attr;
#if CYTHON_UNPACK_METHODS && CYTHON_COMPILING_IN_CPYTHON && CYTHON_USE_PYTYPE_LOOKUP
    __Pyx_TypeName type_name;
    PyTypeObject *tp = Py_TYPE(obj);
    PyObject *descr;
    descrgetfunc f = NULL;
    PyObject **dictptr, *dict;
    int meth_found = 0;
    assert (*method == NULL);
    if (unlikely(tp->tp_getattro != PyObject_GenericGetAttr)) {
        attr = __Pyx_PyObject_GetAttrStr(obj, name);
        goto try_unpack;
    }
    if (unlikely(tp->tp_dict == NULL) && unlikely(PyType_Ready(tp) < 0)) {
        return 0;
    }
    descr = _PyType_Lookup(tp, name);
    if (likely(descr != NULL)) {
        Py_INCREF(descr);
#if defined(Py_TPFLAGS_METHOD_DESCRIPTOR) && Py_TPFLAGS_METHOD_DESCRIPTOR
        if (__Pyx_PyType_HasFeature(Py_TYPE(descr), Py_TPFLAGS_METHOD_DESCRIPTOR))
#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;
}

/* PyObjectCallMethod1 */
#if !(CYTHON_VECTORCALL && __PYX_LIMITED_VERSION_HEX >= 0x030C0000)
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
    PyObject *args[2] = {obj, arg};
    (void) __Pyx_PyObject_GetMethod;
    (void) __Pyx_PyObject_CallOneArg;
    (void) __Pyx_PyObject_Call2Args;
    return PyObject_VectorcallMethod(method_name, args, 2 | PY_VECTORCALL_ARGUMENTS_OFFSET, NULL);
#else
    PyObject *method = NULL, *result;
    int is_method = __Pyx_PyObject_GetMethod(obj, method_name, &method);
    if (likely(is_method)) {
        result = __Pyx_PyObject_Call2Args(method, obj, arg);
        Py_DECREF(method);
        return result;
    }
    if (unlikely(!method)) return NULL;
    return __Pyx__PyObject_CallMethod1(method, arg);
#endif
}

/* append */
static CYTHON_INLINE int __Pyx_PyObject_Append(PyObject* L, PyObject* x) {
    if (likely(PyList_CheckExact(L))) {
        if (unlikely(__Pyx_PyList_Append(L, x) < 0)) return -1;
    } else {
        PyObject* retval = __Pyx_PyObject_CallMethod1(L, __pyx_mstate_global->__pyx_n_u_append, x);
        if (unlikely(!retval))
            return -1;
        Py_DECREF(retval);
    }
    return 0;
}

/* PySequenceMultiply */
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) {
#if CYTHON_USE_TYPE_SLOTS
    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
#endif
    {
        return __Pyx_PySequence_Multiply_Generic(seq, mul);
    }
}

/* GetItemInt */
static PyObject *__Pyx_GetItemInt_Generic(PyObject *o, PyObject* j) {
    PyObject *r;
    if (unlikely(!j)) return NULL;
    r = PyObject_GetItem(o, j);
    Py_DECREF(j);
    return r;
}
static CYTHON_INLINE PyObject *__Pyx_GetItemInt_List_Fast(PyObject *o, Py_ssize_t i,
                                                              CYTHON_NCP_UNUSED int wraparound,
                                                              CYTHON_NCP_UNUSED int boundscheck) {
#if CYTHON_ASSUME_SAFE_MACROS && CYTHON_ASSUME_SAFE_SIZE && !CYTHON_AVOID_BORROWED_REFS && !CYTHON_AVOID_THREAD_UNSAFE_BORROWED_REFS
    Py_ssize_t wrapped_i = i;
    if (wraparound & unlikely(i < 0)) {
        wrapped_i += PyList_GET_SIZE(o);
    }
    if ((!boundscheck) || likely(__Pyx_is_valid_index(wrapped_i, PyList_GET_SIZE(o)))) {
        PyObject *r = PyList_GET_ITEM(o, wrapped_i);
        Py_INCREF(r);
        return r;
    }
    return __Pyx_GetItemInt_Generic(o, PyLong_FromSsize_t(i));
#else
    return PySequence_GetItem(o, i);
#endif
}
static CYTHON_INLINE PyObject *__Pyx_GetItemInt_Tuple_Fast(PyObject *o, Py_ssize_t i,
                                                              CYTHON_NCP_UNUSED int wraparound,
                                                              CYTHON_NCP_UNUSED int boundscheck) {
#if CYTHON_ASSUME_SAFE_MACROS && CYTHON_ASSUME_SAFE_SIZE && !CYTHON_AVOID_BORROWED_REFS
    Py_ssize_t wrapped_i = i;
    if (wraparound & unlikely(i < 0)) {
        wrapped_i += PyTuple_GET_SIZE(o);
    }
    if ((!boundscheck) || likely(__Pyx_is_valid_index(wrapped_i, PyTuple_GET_SIZE(o)))) {
        PyObject *r = PyTuple_GET_ITEM(o, wrapped_i);
        Py_INCREF(r);
        return r;
    }
    return __Pyx_GetItemInt_Generic(o, PyLong_FromSsize_t(i));
#else
    return PySequence_GetItem(o, i);
#endif
}
static CYTHON_INLINE PyObject *__Pyx_GetItemInt_Fast(PyObject *o, Py_ssize_t i, int is_list,
                                                     CYTHON_NCP_UNUSED int wraparound,
                                                     CYTHON_NCP_UNUSED int boundscheck) {
#if CYTHON_ASSUME_SAFE_MACROS && CYTHON_ASSUME_SAFE_SIZE && !CYTHON_AVOID_BORROWED_REFS && CYTHON_USE_TYPE_SLOTS
    if (is_list || PyList_CheckExact(o)) {
        Py_ssize_t n = ((!wraparound) | likely(i >= 0)) ? i : i + PyList_GET_SIZE(o);
        if ((!boundscheck) || (likely(__Pyx_is_valid_index(n, PyList_GET_SIZE(o))))) {
            return __Pyx_PyList_GetItemRef(o, n);
        }
    }
    else if (PyTuple_CheckExact(o)) {
        Py_ssize_t n = ((!wraparound) | likely(i >= 0)) ? i : i + PyTuple_GET_SIZE(o);
        if ((!boundscheck) || likely(__Pyx_is_valid_index(n, PyTuple_GET_SIZE(o)))) {
            PyObject *r = PyTuple_GET_ITEM(o, n);
            Py_INCREF(r);
            return r;
        }
    } else {
        PyMappingMethods *mm = Py_TYPE(o)->tp_as_mapping;
        PySequenceMethods *sm = Py_TYPE(o)->tp_as_sequence;
        if (mm && mm->mp_subscript) {
            PyObject *r, *key = PyLong_FromSsize_t(i);
            if (unlikely(!key)) return NULL;
            r = mm->mp_subscript(o, key);
            Py_DECREF(key);
            return r;
        }
        if (likely(sm && sm->sq_item)) {
            if (wraparound && unlikely(i < 0) && likely(sm->sq_length)) {
                Py_ssize_t l = sm->sq_length(o);
                if (likely(l >= 0)) {
                    i += l;
                } else {
                    if (!PyErr_ExceptionMatches(PyExc_OverflowError))
                        return NULL;
                    PyErr_Clear();
                }
            }
            return sm->sq_item(o, i);
        }
    }
#else
    if (is_list || !PyMapping_Check(o)) {
        return PySequence_GetItem(o, i);
    }
#endif
    return __Pyx_GetItemInt_Generic(o, PyLong_FromSsize_t(i));
}

/* StringJoin */
static CYTHON_INLINE PyObject* __Pyx_PyBytes_Join(PyObject* sep, PyObject* values) {
    (void) __Pyx_PyObject_CallMethod1;
#if !CYTHON_COMPILING_IN_LIMITED_API && PY_VERSION_HEX >= 0x030e0000 || defined(PyBytes_Join)
    return PyBytes_Join(sep, values);
#elif CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX < 0x030d0000 || defined(_PyBytes_Join)
    return _PyBytes_Join(sep, values);
#else
    return __Pyx_PyObject_CallMethod1(sep, __pyx_mstate_global->__pyx_n_u_join, values);
#endif
}

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

/* PyLongCompare */
static CYTHON_INLINE int __Pyx_PyLong_BoolNeObjC(PyObject *op1, PyObject *op2, long intval, long inplace) {
    CYTHON_MAYBE_UNUSED_VAR(intval);
    CYTHON_UNUSED_VAR(inplace);
    if (op1 == op2) {
        return 0;
    }
    #if CYTHON_USE_PYLONG_INTERNALS
    if (likely(PyLong_CheckExact(op1))) {
        int unequal;
        unsigned long uintval;
        Py_ssize_t size = __Pyx_PyLong_DigitCount(op1);
        const digit* digits = __Pyx_PyLong_Digits(op1);
        if (intval == 0) {
            return (__Pyx_PyLong_IsZero(op1) != 1);
        } else if (intval < 0) {
            if (__Pyx_PyLong_IsNonNeg(op1))
                return 1;
            intval = -intval;
        } else {
            if (__Pyx_PyLong_IsNeg(op1))
                return 1;
        }
        uintval = (unsigned long) intval;
#if PyLong_SHIFT * 4 < SIZEOF_LONG*8
        if (uintval >> (PyLong_SHIFT * 4)) {
            unequal = (size != 5) || (digits[0] != (uintval & (unsigned long) PyLong_MASK))
                 | (digits[1] != ((uintval >> (1 * PyLong_SHIFT)) & (unsigned long) PyLong_MASK)) | (digits[2] != ((uintval >> (2 * PyLong_SHIFT)) & (unsigned long) PyLong_MASK)) | (digits[3] != ((uintval >> (3 * PyLong_SHIFT)) & (unsigned long) PyLong_MASK)) | (digits[4] != ((uintval >> (4 * PyLong_SHIFT)) & (unsigned long) PyLong_MASK));
        } else
#endif
#if PyLong_SHIFT * 3 < SIZEOF_LONG*8
        if (uintval >> (PyLong_SHIFT * 3)) {
            unequal = (size != 4) || (digits[0] != (uintval & (unsigned long) PyLong_MASK))
                 | (digits[1] != ((uintval >> (1 * PyLong_SHIFT)) & (unsigned long) PyLong_MASK)) | (digits[2] != ((uintval >> (2 * PyLong_SHIFT)) & (unsigned long) PyLong_MASK)) | (digits[3] != ((uintval >> (3 * PyLong_SHIFT)) & (unsigned long) PyLong_MASK));
        } else
#endif
#if PyLong_SHIFT * 2 < SIZEOF_LONG*8
        if (uintval >> (PyLong_SHIFT * 2)) {
            unequal = (size != 3) || (digits[0] != (uintval & (unsigned long) PyLong_MASK))
                 | (digits[1] != ((uintval >> (1 * PyLong_SHIFT)) & (unsigned long) PyLong_MASK)) | (digits[2] != ((uintval >> (2 * PyLong_SHIFT)) & (unsigned long) PyLong_MASK));
        } else
#endif
#if PyLong_SHIFT * 1 < SIZEOF_LONG*8
        if (uintval >> (PyLong_SHIFT * 1)) {
            unequal = (size != 2) || (digits[0] != (uintval & (unsigned long) PyLong_MASK))
                 | (digits[1] != ((uintval >> (1 * PyLong_SHIFT)) & (unsigned long) PyLong_MASK));
        } else
#endif
            unequal = (size != 1) || (((unsigned long) digits[0]) != (uintval & (unsigned long) PyLong_MASK));
        return (unequal != 0);
    }
    #endif
    if (PyFloat_CheckExact(op1)) {
        const long b = intval;
        double a = __Pyx_PyFloat_AS_DOUBLE(op1);
        return ((double)a != (double)b);
    }
    return __Pyx_PyObject_IsTrueAndDecref(
        PyObject_RichCompare(op1, op2, Py_NE));
}

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

/* PyObjectVectorCallKwBuilder */
#if CYTHON_VECTORCALL
static int __Pyx_VectorcallBuilder_AddArg(PyObject *key, PyObject *value, PyObject *builder, PyObject **args, int n) {
    (void)__Pyx_PyObject_FastCallDict;
    if (__Pyx_PyTuple_SET_ITEM(builder, n, key) != (0)) return -1;
    Py_INCREF(key);
    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

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

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

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

/* 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)
{
    Py_ssize_t pos = 0;
    PyObject *key = NULL;
    __Pyx_BEGIN_CRITICAL_SECTION(kwds);
    while (PyDict_Next(kwds, &pos, &key, NULL)) {
        PyObject** const *name = first_kw_arg;
        while (*name && (**name != key)) name++;
        if (!*name) {
            #if CYTHON_AVOID_BORROWED_REFS
            Py_INCREF(key);
            #endif
            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();
    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;
}
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);
}

/* ObjectGetItem */
#if CYTHON_USE_TYPE_SLOTS
static PyObject *__Pyx_PyObject_GetIndex(PyObject *obj, PyObject *index) {
    PyObject *runerr = NULL;
    Py_ssize_t key_value;
    key_value = __Pyx_PyIndex_AsSsize_t(index);
    if (likely(key_value != -1 || !(runerr = PyErr_Occurred()))) {
        return __Pyx_GetItemInt_Fast(obj, key_value, 0, 1, 1);
    }
    if (PyErr_GivenExceptionMatches(runerr, PyExc_OverflowError)) {
        __Pyx_TypeName index_type_name = __Pyx_PyType_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 {
        Py_ssize_t pos = 0;
#if !CYTHON_COMPILING_IN_PYPY || defined(PyArg_ValidateKeywordArguments)
        if (unlikely(!PyArg_ValidateKeywordArguments(kwds))) return;
#endif
        PyDict_Next(kwds, &pos, &key, NULL);
        Py_INCREF(key);
    }
    if (likely(key)) {
        PyErr_Format(PyExc_TypeError,
            "%s() got an unexpected keyword argument '%U'",
            function_name, key);
        Py_DECREF(key);
    }
}

/* IterFinish */
static CYTHON_INLINE int __Pyx_IterFinish(void) {
    PyObject* exc_type;
    __Pyx_PyThreadState_declare
    __Pyx_PyThreadState_assign
    exc_type = __Pyx_PyErr_CurrentExceptionType();
    if (unlikely(exc_type)) {
        if (unlikely(!__Pyx_PyErr_GivenExceptionMatches(exc_type, PyExc_StopIteration)))
            return -1;
        __Pyx_PyErr_Clear();
        return 0;
    }
    return 0;
}

/* PyObjectCallNoArg */
static CYTHON_INLINE PyObject* __Pyx_PyObject_CallNoArg(PyObject *func) {
    PyObject *arg[2] = {NULL, NULL};
    return __Pyx_PyObject_FastCall(func, arg + 1, 0 | __Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET);
}

/* PyObjectCallMethod0 */
static PyObject* __Pyx_PyObject_CallMethod0(PyObject* obj, PyObject* method_name) {
    PyObject *method = NULL, *result = NULL;
    int is_method = __Pyx_PyObject_GetMethod(obj, method_name, &method);
    if (likely(is_method)) {
        result = __Pyx_PyObject_CallOneArg(method, obj);
        Py_DECREF(method);
        return result;
    }
    if (unlikely(!method)) goto bad;
    result = __Pyx_PyObject_CallNoArg(method);
    Py_DECREF(method);
bad:
    return result;
}

/* RaiseNeedMoreValuesToUnpack */
static CYTHON_INLINE void __Pyx_RaiseNeedMoreValuesError(Py_ssize_t index) {
    PyErr_Format(PyExc_ValueError,
                 "need more than %" CYTHON_FORMAT_SSIZE_T "d value%.1s to unpack",
                 index, (index == 1) ? "" : "s");
}

/* RaiseTooManyValuesToUnpack */
static CYTHON_INLINE void __Pyx_RaiseTooManyValuesError(Py_ssize_t expected) {
    PyErr_Format(PyExc_ValueError,
                 "too many values to unpack (expected %" CYTHON_FORMAT_SSIZE_T "d)", expected);
}

/* UnpackItemEndCheck */
static int __Pyx_IternextUnpackEndCheck(PyObject *retval, Py_ssize_t expected) {
    if (unlikely(retval)) {
        Py_DECREF(retval);
        __Pyx_RaiseTooManyValuesError(expected);
        return -1;
    }
    return __Pyx_IterFinish();
}

/* RaiseNoneIterError */
static CYTHON_INLINE void __Pyx_RaiseNoneNotIterableError(void) {
    PyErr_SetString(PyExc_TypeError, "'NoneType' object is not iterable");
}

/* UnpackTupleError */
static void __Pyx_UnpackTupleError(PyObject *t, Py_ssize_t index) {
    if (t == Py_None) {
      __Pyx_RaiseNoneNotIterableError();
    } else {
      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 */
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_COMPILING_IN_PYPY
#include <string.h>
#endif
static CYTHON_INLINE PyObject* __Pyx_dict_iterator(PyObject* iterable, int is_dict, PyObject* method_name,
                                                   Py_ssize_t* p_orig_length, int* p_source_is_dict) {
    is_dict = is_dict || likely(PyDict_CheckExact(iterable));
    *p_source_is_dict = is_dict;
    if (is_dict) {
#if !CYTHON_COMPILING_IN_PYPY
        *p_orig_length = PyDict_Size(iterable);
        Py_INCREF(iterable);
        return iterable;
#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_COMPILING_IN_PYPY
        if (PyTuple_CheckExact(iterable) || PyList_CheckExact(iterable))
            return iterable;
#endif
        iter = PyObject_GetIter(iterable);
        Py_DECREF(iterable);
        return iter;
    }
    return PyObject_GetIter(iterable);
}
#if !CYTHON_COMPILING_IN_PYPY
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_COMPILING_IN_PYPY
    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;
        #if CYTHON_AVOID_THREAD_UNSAFE_BORROWED_REFS
        next_item = PyList_GetItemRef(iter_obj, pos);
        if (unlikely(!next_item)) return -1;
        #elif CYTHON_ASSUME_SAFE_MACROS
        next_item = PyList_GET_ITEM(iter_obj, pos);
        Py_INCREF(next_item);
        #else
        next_item = PyList_GetItem(iter_obj, pos);
        if (unlikely(!next_item)) return -1;
        Py_INCREF(next_item);
        #endif
    } 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;
}

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

/* 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 */
static CYTHON_INLINE PyObject* __Pyx_PyDict_Items(PyObject* d) {
    return __Pyx_CallUnboundCMethod0(&__pyx_mstate_global->__pyx_umethod_PyDict_Type_items, d);
}

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

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

/* DictGetItem */
#if !CYTHON_COMPILING_IN_PYPY
static PyObject *__Pyx_PyDict_GetItem(PyObject *d, PyObject* key) {
    PyObject *value;
    if (unlikely(__Pyx_PyDict_GetItemRef(d, key, &value) == 0)) { // no value, no error
        if (unlikely(PyTuple_Check(key))) {
            PyObject* args = PyTuple_Pack(1, key);
            if (likely(args)) {
                PyErr_SetObject(PyExc_KeyError, args);
                Py_DECREF(args);
            }
        } else {
            PyErr_SetObject(PyExc_KeyError, key);
        }
    }
    return value;
}
#endif

/* py_dict_pop_ignore */
static CYTHON_INLINE int __Pyx_PyDict_Pop_ignore(PyObject *d, PyObject *key, PyObject *default_value) {
#if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX >= 0x030d00A2 || defined(PyDict_Pop)
    int result = PyDict_Pop(d, key, NULL);
    CYTHON_UNUSED_VAR(default_value);
    return (unlikely(result == -1)) ? -1 : 0;
#else
    PyObject *value;
    CYTHON_UNUSED_VAR(default_value);
    #if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX < 0x030d0000
    value = _PyDict_Pop(d, key, Py_None);
    #else
    value = __Pyx_CallUnboundCMethod2(&__pyx_mstate_global->__pyx_umethod_PyDict_Type_pop, d, key, Py_None);
    #endif
    if (unlikely(value == NULL))
        return -1;
    Py_DECREF(value);
    return 0;
#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,
                                               CYTHON_NCP_UNUSED int wraparound, CYTHON_NCP_UNUSED int boundscheck) {
#if CYTHON_ASSUME_SAFE_MACROS && CYTHON_ASSUME_SAFE_SIZE && !CYTHON_AVOID_BORROWED_REFS && CYTHON_USE_TYPE_SLOTS
    if (is_list || PyList_CheckExact(o)) {
        Py_ssize_t n = (!wraparound) ? i : ((likely(i >= 0)) ? i : i + PyList_GET_SIZE(o));
        if ((!boundscheck) || likely(__Pyx_is_valid_index(n, PyList_GET_SIZE(o)))) {
            Py_INCREF(v);
#if CYTHON_AVOID_THREAD_UNSAFE_BORROWED_REFS
            PyList_SetItem(o, n, v);
#else
            PyObject* old = PyList_GET_ITEM(o, n);
            PyList_SET_ITEM(o, n, v);
            Py_DECREF(old);
#endif
            return 1;
        }
    } else {
        PyMappingMethods *mm = Py_TYPE(o)->tp_as_mapping;
        PySequenceMethods *sm = Py_TYPE(o)->tp_as_sequence;
        if (mm && mm->mp_ass_subscript) {
            int r;
            PyObject *key = PyLong_FromSsize_t(i);
            if (unlikely(!key)) return -1;
            r = mm->mp_ass_subscript(o, key, v);
            Py_DECREF(key);
            return r;
        }
        if (likely(sm && sm->sq_ass_item)) {
            if (wraparound && unlikely(i < 0) && likely(sm->sq_length)) {
                Py_ssize_t l = sm->sq_length(o);
                if (likely(l >= 0)) {
                    i += l;
                } else {
                    if (!PyErr_ExceptionMatches(PyExc_OverflowError))
                        return -1;
                    PyErr_Clear();
                }
            }
            return sm->sq_ass_item(o, i, v);
        }
    }
#else
    if (is_list || !PyMapping_Check(o))
    {
        return PySequence_SetItem(o, i, v);
    }
#endif
    return __Pyx_SetItemInt_Generic(o, PyLong_FromSsize_t(i), v);
}

/* PyLongBinop */
#if !CYTHON_COMPILING_IN_PYPY
static PyObject* __Pyx_Fallback___Pyx_PyLong_SubtractObjC(PyObject *op1, PyObject *op2, int inplace) {
    return (inplace ? PyNumber_InPlaceSubtract : PyNumber_Subtract)(op1, op2);
}
#if CYTHON_USE_PYLONG_INTERNALS
static PyObject* __Pyx_Unpacked___Pyx_PyLong_SubtractObjC(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, x;
#ifdef HAVE_LONG_LONG
    const PY_LONG_LONG llb = intval;
    PY_LONG_LONG lla, llx;
#endif
    if (unlikely(__Pyx_PyLong_IsZero(op1))) {
        return PyLong_FromLong(-intval);
    }
    if (likely(__Pyx_PyLong_IsCompact(op1))) {
        a = __Pyx_PyLong_CompactValue(op1);
    } else {
        const digit* digits = __Pyx_PyLong_Digits(op1);
        const Py_ssize_t size = __Pyx_PyLong_SignedDigitCount(op1);
        switch (size) {
            case -2:
                if (8 * sizeof(long) - 1 > 2 * PyLong_SHIFT) {
                    a = -(long) (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]));
                    break;
                #ifdef HAVE_LONG_LONG
                } else if (8 * sizeof(PY_LONG_LONG) - 1 > 2 * PyLong_SHIFT) {
                    lla = -(PY_LONG_LONG) (((((unsigned PY_LONG_LONG)digits[1]) << PyLong_SHIFT) | (unsigned PY_LONG_LONG)digits[0]));
                    goto long_long;
                #endif
                }
                CYTHON_FALLTHROUGH;
            case 2:
                if (8 * sizeof(long) - 1 > 2 * PyLong_SHIFT) {
                    a = (long) (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]));
                    break;
                #ifdef HAVE_LONG_LONG
                } else if (8 * sizeof(PY_LONG_LONG) - 1 > 2 * PyLong_SHIFT) {
                    lla = (PY_LONG_LONG) (((((unsigned PY_LONG_LONG)digits[1]) << PyLong_SHIFT) | (unsigned PY_LONG_LONG)digits[0]));
                    goto long_long;
                #endif
                }
                CYTHON_FALLTHROUGH;
            case -3:
                if (8 * sizeof(long) - 1 > 3 * PyLong_SHIFT) {
                    a = -(long) (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]));
                    break;
                #ifdef HAVE_LONG_LONG
                } else if (8 * sizeof(PY_LONG_LONG) - 1 > 3 * PyLong_SHIFT) {
                    lla = -(PY_LONG_LONG) (((((((unsigned PY_LONG_LONG)digits[2]) << PyLong_SHIFT) | (unsigned PY_LONG_LONG)digits[1]) << PyLong_SHIFT) | (unsigned PY_LONG_LONG)digits[0]));
                    goto long_long;
                #endif
                }
                CYTHON_FALLTHROUGH;
            case 3:
                if (8 * sizeof(long) - 1 > 3 * PyLong_SHIFT) {
                    a = (long) (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]));
                    break;
                #ifdef HAVE_LONG_LONG
                } else if (8 * sizeof(PY_LONG_LONG) - 1 > 3 * PyLong_SHIFT) {
                    lla = (PY_LONG_LONG) (((((((unsigned PY_LONG_LONG)digits[2]) << PyLong_SHIFT) | (unsigned PY_LONG_LONG)digits[1]) << PyLong_SHIFT) | (unsigned PY_LONG_LONG)digits[0]));
                    goto long_long;
                #endif
                }
                CYTHON_FALLTHROUGH;
            case -4:
                if (8 * sizeof(long) - 1 > 4 * PyLong_SHIFT) {
                    a = -(long) (((((((((unsigned long)digits[3]) << PyLong_SHIFT) | (unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]));
                    break;
                #ifdef HAVE_LONG_LONG
                } else if (8 * sizeof(PY_LONG_LONG) - 1 > 4 * PyLong_SHIFT) {
                    lla = -(PY_LONG_LONG) (((((((((unsigned PY_LONG_LONG)digits[3]) << PyLong_SHIFT) | (unsigned PY_LONG_LONG)digits[2]) << PyLong_SHIFT) | (unsigned PY_LONG_LONG)digits[1]) << PyLong_SHIFT) | (unsigned PY_LONG_LONG)digits[0]));
                    goto long_long;
                #endif
                }
                CYTHON_FALLTHROUGH;
            case 4:
                if (8 * sizeof(long) - 1 > 4 * PyLong_SHIFT) {
                    a = (long) (((((((((unsigned long)digits[3]) << PyLong_SHIFT) | (unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]));
                    break;
                #ifdef HAVE_LONG_LONG
                } else if (8 * sizeof(PY_LONG_LONG) - 1 > 4 * PyLong_SHIFT) {
                    lla = (PY_LONG_LONG) (((((((((unsigned PY_LONG_LONG)digits[3]) << PyLong_SHIFT) | (unsigned PY_LONG_LONG)digits[2]) << PyLong_SHIFT) | (unsigned PY_LONG_LONG)digits[1]) << PyLong_SHIFT) | (unsigned PY_LONG_LONG)digits[0]));
                    goto long_long;
                #endif
                }
                CYTHON_FALLTHROUGH;
            default: return PyLong_Type.tp_as_number->nb_subtract(op1, op2);
        }
    }
            x = a - b;
        return PyLong_FromLong(x);
#ifdef HAVE_LONG_LONG
    long_long:
            llx = lla - llb;
        return PyLong_FromLongLong(llx);
#endif
    return __Pyx_Fallback___Pyx_PyLong_SubtractObjC(op1, op2, inplace);
    
    
}
#endif
static PyObject* __Pyx_Float___Pyx_PyLong_SubtractObjC(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_SubtractObjC(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_SubtractObjC(op1, op2, intval, inplace, zerodivision_check);
    }
    #endif
    if (PyFloat_CheckExact(op1)) {
        return __Pyx_Float___Pyx_PyLong_SubtractObjC(op1, intval, zerodivision_check);
    }
    return __Pyx_Fallback___Pyx_PyLong_SubtractObjC(op1, op2, inplace);
}
#endif

/* RaiseClosureNameError */
static void __Pyx_RaiseClosureNameError(const char *varname) {
    PyErr_Format(PyExc_NameError, "free variable '%s' referenced before assignment in enclosing scope", varname);
}

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

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

/* Import */
static PyObject *__Pyx_Import(PyObject *name, PyObject *from_list, int level) {
    PyObject *module = 0;
    PyObject *empty_dict = 0;
    PyObject *empty_list = 0;
    empty_dict = PyDict_New();
    if (unlikely(!empty_dict))
        goto bad;
    if (level == -1) {
        const char* package_sep = strchr(__Pyx_MODULE_NAME, '.');
        if (package_sep != (0)) {
            module = PyImport_ImportModuleLevelObject(
                name, __pyx_mstate_global->__pyx_d, 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, __pyx_mstate_global->__pyx_d, empty_dict, from_list, level);
    }
bad:
    Py_XDECREF(empty_dict);
    Py_XDECREF(empty_list);
    return module;
}

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

/* HasAttr */
#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

/* CallTypeTraverse */
#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

/* CallNextTpDealloc */
static void __Pyx_call_next_tp_dealloc(PyObject* obj, destructor current_tp_dealloc) {
    PyTypeObject* type = Py_TYPE(obj);
    destructor tp_dealloc = NULL;
    while (type && __Pyx_PyType_GetSlot(type, tp_dealloc, destructor) != current_tp_dealloc)
        type = __Pyx_PyType_GetSlot(type, tp_base, PyTypeObject*);
    while (type && (tp_dealloc = __Pyx_PyType_GetSlot(type, tp_dealloc, destructor)) == current_tp_dealloc)
        type = __Pyx_PyType_GetSlot(type, tp_base, PyTypeObject*);
    if (type)
        tp_dealloc(obj);
}

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

/* LimitedApiGetTypeDict */
#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 */
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 */
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);
#if PY_VERSION_HEX >= 0x030800b4
                    type->tp_vectorcall_offset = memb->offset;
#else
                    type->tp_print = (printfunc) memb->offset;
#endif
                    changed = 1;
                }
#endif  // CYTHON_METH_FASTCALL
                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;
                }
            }
            memb++;
        }
    }
#endif  // !CYTHON_COMPILING_IN_LIMITED_API
    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;
        }
    }
    if (changed)
        PyType_Modified(type);
#endif  // PY_VERSION_HEX > 0x030900B1
    return 0;
}

/* ValidateBasesTuple */
#if CYTHON_COMPILING_IN_CPYTHON || CYTHON_COMPILING_IN_LIMITED_API || CYTHON_USE_TYPE_SPECS
static int __Pyx_validate_bases_tuple(const char *type_name, Py_ssize_t dictoffset, PyObject *bases) {
    Py_ssize_t i, n;
#if CYTHON_ASSUME_SAFE_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
}

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

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

/* TypeImport */
#ifndef __PYX_HAVE_RT_ImportType_3_1_2
#define __PYX_HAVE_RT_ImportType_3_1_2
static PyTypeObject *__Pyx_ImportType_3_1_2(PyObject *module, const char *module_name, const char *class_name,
    size_t size, size_t alignment, enum __Pyx_ImportType_CheckSize_3_1_2 check_size)
{
    PyObject *result = 0;
    Py_ssize_t basicsize;
    Py_ssize_t itemsize;
#if CYTHON_COMPILING_IN_LIMITED_API
    PyObject *py_basicsize;
    PyObject *py_itemsize;
#endif
    result = PyObject_GetAttrString(module, class_name);
    if (!result)
        goto bad;
    if (!PyType_Check(result)) {
        PyErr_Format(PyExc_TypeError,
            "%.200s.%.200s is not a type object",
            module_name, class_name);
        goto bad;
    }
#if !CYTHON_COMPILING_IN_LIMITED_API
    basicsize = ((PyTypeObject *)result)->tp_basicsize;
    itemsize = ((PyTypeObject *)result)->tp_itemsize;
#else
    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_1_2 &&
            ((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_1_2 && (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

/* ImportDottedModule */
static PyObject *__Pyx__ImportDottedModule_Error(PyObject *name, PyObject *parts_tuple, Py_ssize_t count) {
    PyObject *partial_name = NULL, *slice = NULL, *sep = NULL;
    Py_ssize_t size;
    if (unlikely(PyErr_Occurred())) {
        PyErr_Clear();
    }
#if CYTHON_ASSUME_SAFE_SIZE
    size = PyTuple_GET_SIZE(parts_tuple);
#else
    size = PyTuple_Size(parts_tuple);
    if (size < 0) goto bad;
#endif
    if (likely(size == count)) {
        partial_name = name;
    } else {
        slice = PySequence_GetSlice(parts_tuple, 0, count);
        if (unlikely(!slice))
            goto bad;
        sep = PyUnicode_FromStringAndSize(".", 1);
        if (unlikely(!sep))
            goto bad;
        partial_name = PyUnicode_Join(sep, slice);
    }
    PyErr_Format(
        PyExc_ModuleNotFoundError,
        "No module named '%U'", partial_name);
bad:
    Py_XDECREF(sep);
    Py_XDECREF(slice);
    Py_XDECREF(partial_name);
    return NULL;
}
static PyObject *__Pyx__ImportDottedModule_Lookup(PyObject *name) {
    PyObject *imported_module;
#if (CYTHON_COMPILING_IN_PYPY && PYPY_VERSION_NUM  < 0x07030400) ||\
        CYTHON_COMPILING_IN_GRAAL
    PyObject *modules = PyImport_GetModuleDict();
    if (unlikely(!modules))
        return NULL;
    imported_module = __Pyx_PyDict_GetItemStr(modules, name);
    Py_XINCREF(imported_module);
#else
    imported_module = PyImport_GetModule(name);
#endif
    return imported_module;
}
static PyObject *__Pyx_ImportDottedModule_WalkParts(PyObject *module, PyObject *name, PyObject *parts_tuple) {
    Py_ssize_t i, nparts;
#if CYTHON_ASSUME_SAFE_SIZE
    nparts = PyTuple_GET_SIZE(parts_tuple);
#else
    nparts = PyTuple_Size(parts_tuple);
    if (nparts < 0) return NULL;
#endif
    for (i=1; i < nparts && module; i++) {
        PyObject *part, *submodule;
#if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
        part = PyTuple_GET_ITEM(parts_tuple, i);
#else
        part = __Pyx_PySequence_ITEM(parts_tuple, i);
        if (!part) return NULL;
#endif
        submodule = __Pyx_PyObject_GetAttrStrNoError(module, part);
#if !(CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS)
        Py_DECREF(part);
#endif
        Py_DECREF(module);
        module = submodule;
    }
    if (unlikely(!module)) {
        return __Pyx__ImportDottedModule_Error(name, parts_tuple, i);
    }
    return module;
}
static PyObject *__Pyx__ImportDottedModule(PyObject *name, PyObject *parts_tuple) {
    PyObject *imported_module;
    PyObject *module = __Pyx_Import(name, NULL, 0);
    if (!parts_tuple || unlikely(!module))
        return module;
    imported_module = __Pyx__ImportDottedModule_Lookup(name);
    if (likely(imported_module)) {
        Py_DECREF(module);
        return imported_module;
    }
    PyErr_Clear();
    return __Pyx_ImportDottedModule_WalkParts(module, name, parts_tuple);
}
static PyObject *__Pyx_ImportDottedModule(PyObject *name, PyObject *parts_tuple) {
#if CYTHON_COMPILING_IN_CPYTHON
    PyObject *module = __Pyx__ImportDottedModule_Lookup(name);
    if (likely(module)) {
        PyObject *spec = __Pyx_PyObject_GetAttrStrNoError(module, __pyx_mstate_global->__pyx_n_u_spec);
        if (likely(spec)) {
            PyObject *unsafe = __Pyx_PyObject_GetAttrStrNoError(spec, __pyx_mstate_global->__pyx_n_u_initializing);
            if (likely(!unsafe || !__Pyx_PyObject_IsTrue(unsafe))) {
                Py_DECREF(spec);
                spec = NULL;
            }
            Py_XDECREF(unsafe);
        }
        if (likely(!spec)) {
            PyErr_Clear();
            return module;
        }
        Py_DECREF(spec);
        Py_DECREF(module);
    } else if (PyErr_Occurred()) {
        PyErr_Clear();
    }
#endif
    return __Pyx__ImportDottedModule(name, parts_tuple);
}

/* ListPack */
static PyObject *__Pyx_PyList_Pack(Py_ssize_t n, ...) {
    va_list va;
    PyObject *l = PyList_New(n);
    va_start(va, n);
    if (unlikely(!l)) goto end;
    for (Py_ssize_t i=0; i<n; ++i) {
        PyObject *arg = va_arg(va, PyObject*);
        Py_INCREF(arg);
        if (__Pyx_PyList_SET_ITEM(l, i, arg) != (0)) {
            Py_CLEAR(l);
            goto end;
        }
    }
    end:
    va_end(va);
    return l;
}

/* FetchSharedCythonModule */
static PyObject *__Pyx_FetchSharedCythonABIModule(void) {
    return __Pyx_PyImport_AddModuleRef(__PYX_ABI_MODULE_NAME);
}

/* dict_setdefault */
static CYTHON_INLINE PyObject *__Pyx_PyDict_SetDefault(PyObject *d, PyObject *key, PyObject *default_value,
                                                       int is_safe_type) {
    PyObject* value;
    CYTHON_MAYBE_UNUSED_VAR(is_safe_type);
#if CYTHON_COMPILING_IN_LIMITED_API
    value = PyObject_CallMethod(d, "setdefault", "OO", key, default_value);
#elif PY_VERSION_HEX >= 0x030d0000
    PyDict_SetDefaultRef(d, key, default_value, &value);
#else
    value = PyDict_SetDefault(d, key, default_value);
    if (unlikely(!value)) return NULL;
    Py_INCREF(value);
#endif
    return value;
}

/* FetchCommonType */
#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;
    }
    CYTHON_UNUSED_VAR(module);
    cached_type = __Pyx_PyType_FromMetaclass(metaclass, 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, 1);
    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 */
PyObject* __pyx_CommonTypesMetaclass_get_module(CYTHON_UNUSED PyObject *self, CYTHON_UNUSED void* context) {
    return PyUnicode_FromString(__PYX_ABI_MODULE_NAME);
}
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},
    {0, 0}
};
static PyType_Spec __pyx_CommonTypesMetaclass_spec = {
    __PYX_TYPE_MODULE_PREFIX "_common_types_metatype",
    0,
    0,
#if PY_VERSION_HEX >= 0x030A0000
    Py_TPFLAGS_IMMUTABLETYPE |
    Py_TPFLAGS_DISALLOW_INSTANTIATION |
#endif
    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);
    if (unlikely(mstate->__pyx_CommonTypesMetaclassType == NULL)) {
        return -1;
    }
    return 0;
}

/* PyMethodNew */
#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 */
#if CYTHON_METH_FASTCALL && (CYTHON_VECTORCALL || CYTHON_BACKPORT_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, pos;
    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 = i = 0;
    keys_are_strings = Py_TPFLAGS_UNICODE_SUBCLASS;
    while (PyDict_Next(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
        Py_INCREF(key);
        Py_INCREF(value);
        #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:
    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 */
#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;
}
static PyObject *
__Pyx_CyFunction_get_dict_locked(__pyx_CyFunctionObject *op)
{
    if (unlikely(op->func_dict == NULL)) {
        op->func_dict = PyDict_New();
        if (unlikely(op->func_dict == NULL))
            return NULL;
    }
    Py_INCREF(op->func_dict);
    return op->func_dict;
}
static PyObject *
__Pyx_CyFunction_get_dict(__pyx_CyFunctionObject *op, void *context)
{
    CYTHON_UNUSED_VAR(context);
    PyObject *result;
    __Pyx_BEGIN_CRITICAL_SECTION(op);
    result = __Pyx_CyFunction_get_dict_locked(op);
    __Pyx_END_CRITICAL_SECTION();
    return result;
}
static int
__Pyx_CyFunction_set_dict(__pyx_CyFunctionObject *op, PyObject *value, void *context)
{
    CYTHON_UNUSED_VAR(context);
    if (unlikely(value == NULL)) {
        PyErr_SetString(PyExc_TypeError,
               "function's dictionary may not be deleted");
        return -1;
    }
    if (unlikely(!PyDict_Check(value))) {
        PyErr_SetString(PyExc_TypeError,
               "setting function's dictionary to a non-dict");
        return -1;
    }
    Py_INCREF(value);
    __Pyx_BEGIN_CRITICAL_SECTION(op);
    __Pyx_Py_XDECREF_SET(op->func_dict, value);
    __Pyx_END_CRITICAL_SECTION();
    return 0;
}
static PyObject *
__Pyx_CyFunction_get_globals(__pyx_CyFunctionObject *op, void *context)
{
    CYTHON_UNUSED_VAR(context);
    Py_INCREF(op->func_globals);
    return op->func_globals;
}
static PyObject *
__Pyx_CyFunction_get_closure(__pyx_CyFunctionObject *op, void *context)
{
    CYTHON_UNUSED_VAR(op);
    CYTHON_UNUSED_VAR(context);
    Py_INCREF(Py_None);
    return Py_None;
}
static PyObject *
__Pyx_CyFunction_get_code(__pyx_CyFunctionObject *op, void *context)
{
    PyObject* result = (op->func_code) ? op->func_code : Py_None;
    CYTHON_UNUSED_VAR(context);
    Py_INCREF(result);
    return result;
}
static int
__Pyx_CyFunction_init_defaults(__pyx_CyFunctionObject *op) {
    int result = 0;
    PyObject *res = op->defaults_getter((PyObject *) op);
    if (unlikely(!res))
        return -1;
    #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
    op->defaults_tuple = PyTuple_GET_ITEM(res, 0);
    Py_INCREF(op->defaults_tuple);
    op->defaults_kwdict = PyTuple_GET_ITEM(res, 1);
    Py_INCREF(op->defaults_kwdict);
    #else
    op->defaults_tuple = __Pyx_PySequence_ITEM(res, 0);
    if (unlikely(!op->defaults_tuple)) result = -1;
    else {
        op->defaults_kwdict = __Pyx_PySequence_ITEM(res, 1);
        if (unlikely(!op->defaults_kwdict)) result = -1;
    }
    #endif
    Py_DECREF(res);
    return result;
}
static int
__Pyx_CyFunction_set_defaults(__pyx_CyFunctionObject *op, PyObject* value, void *context) {
    CYTHON_UNUSED_VAR(context);
    if (!value) {
        value = Py_None;
    } else if (unlikely(value != Py_None && !PyTuple_Check(value))) {
        PyErr_SetString(PyExc_TypeError,
                        "__defaults__ must be set to a tuple object");
        return -1;
    }
    PyErr_WarnEx(PyExc_RuntimeWarning, "changes to cyfunction.__defaults__ will not "
                 "currently affect the values used in function calls", 1);
    Py_INCREF(value);
    __Pyx_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_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();
    return 0;
}
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(__pyx_CyFunctionObject *op, void *context) {
    PyObject *result;
    CYTHON_UNUSED_VAR(context);
    __Pyx_BEGIN_CRITICAL_SECTION(op);
    result = __Pyx_CyFunction_get_annotations_locked(op);
    __Pyx_END_CRITICAL_SECTION();
    return result;
}
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(marker);
            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},
    {"func_dict", (getter)__Pyx_CyFunction_get_dict, (setter)__Pyx_CyFunction_set_dict, 0, 0},
    {"__dict__", (getter)__Pyx_CyFunction_get_dict, (setter)__Pyx_CyFunction_set_dict, 0, 0},
    {"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},
    {"_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
    {"__dictoffset__", T_PYSSIZET, offsetof(__pyx_CyFunctionObject, func_dict), READONLY, 0},
#if CYTHON_METH_FASTCALL
#if CYTHON_BACKPORT_VECTORCALL || 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
    op->func_dict = NULL;
    op->func_name = NULL;
    Py_INCREF(qualname);
    op->func_qualname = qualname;
    op->func_doc = NULL;
#if PY_VERSION_HEX < 0x030900B1 || CYTHON_COMPILING_IN_LIMITED_API
    op->func_classobj = NULL;
#else
    ((PyCMethodObject*)op)->mm_class = NULL;
#endif
    op->func_globals = globals;
    Py_INCREF(op->func_globals);
    Py_XINCREF(code);
    op->func_code = code;
    op->defaults = NULL;
    op->defaults_tuple = NULL;
    op->defaults_kwdict = NULL;
    op->defaults_getter = NULL;
    op->func_annotations = NULL;
    op->func_is_coroutine = NULL;
#if CYTHON_METH_FASTCALL
    switch (ml->ml_flags & (METH_VARARGS | METH_FASTCALL | METH_NOARGS | METH_O | METH_KEYWORDS | METH_METHOD)) {
    case METH_NOARGS:
        __Pyx_CyFunction_func_vectorcall(op) = __Pyx_CyFunction_Vectorcall_NOARGS;
        break;
    case METH_O:
        __Pyx_CyFunction_func_vectorcall(op) = __Pyx_CyFunction_Vectorcall_O;
        break;
    case METH_METHOD | METH_FASTCALL | METH_KEYWORDS:
        __Pyx_CyFunction_func_vectorcall(op) = __Pyx_CyFunction_Vectorcall_FASTCALL_KEYWORDS_METHOD;
        break;
    case METH_FASTCALL | METH_KEYWORDS:
        __Pyx_CyFunction_func_vectorcall(op) = __Pyx_CyFunction_Vectorcall_FASTCALL_KEYWORDS;
        break;
    case METH_VARARGS | METH_KEYWORDS:
        __Pyx_CyFunction_func_vectorcall(op) = NULL;
        break;
    default:
        PyErr_SetString(PyExc_SystemError, "Bad call flags for CyFunction");
        Py_DECREF(op);
        return NULL;
    }
#endif
    return (PyObject *) op;
}
static int
__Pyx_CyFunction_clear(__pyx_CyFunctionObject *m)
{
    Py_CLEAR(m->func_closure);
#if CYTHON_COMPILING_IN_LIMITED_API
    Py_CLEAR(m->func);
#else
    Py_CLEAR(((PyCFunctionObject*)m)->m_module);
#endif
    Py_CLEAR(m->func_dict);
    Py_CLEAR(m->func_name);
    Py_CLEAR(m->func_qualname);
    Py_CLEAR(m->func_doc);
    Py_CLEAR(m->func_globals);
    Py_CLEAR(m->func_code);
#if !CYTHON_COMPILING_IN_LIMITED_API
#if PY_VERSION_HEX < 0x030900B1
    Py_CLEAR(__Pyx_CyFunction_GetClassObj(m));
#else
    {
        PyObject *cls = (PyObject*) ((PyCMethodObject *) (m))->mm_class;
        ((PyCMethodObject *) (m))->mm_class = NULL;
        Py_XDECREF(cls);
    }
#endif
#endif
    Py_CLEAR(m->defaults_tuple);
    Py_CLEAR(m->defaults_kwdict);
    Py_CLEAR(m->func_annotations);
    Py_CLEAR(m->func_is_coroutine);
    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
    Py_VISIT(m->func_dict);
    __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);
#if !CYTHON_COMPILING_IN_LIMITED_API
    Py_VISIT(__Pyx_CyFunction_GetClassObj(m));
#endif
    Py_VISIT(m->defaults_tuple);
    Py_VISIT(m->defaults_kwdict);
    Py_VISIT(m->func_is_coroutine);
    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 || CYTHON_BACKPORT_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 || CYTHON_BACKPORT_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;
#if CYTHON_BACKPORT_VECTORCALL
    Py_ssize_t nargs = (Py_ssize_t)nargsf;
#else
    Py_ssize_t nargs = PyVectorcall_NARGS(nargsf);
#endif
    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;
#if CYTHON_BACKPORT_VECTORCALL
    Py_ssize_t nargs = (Py_ssize_t)nargsf;
#else
    Py_ssize_t nargs = PyVectorcall_NARGS(nargsf);
#endif
    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;
#if CYTHON_BACKPORT_VECTORCALL
    Py_ssize_t nargs = (Py_ssize_t)nargsf;
#else
    Py_ssize_t nargs = PyVectorcall_NARGS(nargsf);
#endif
    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);
#if CYTHON_BACKPORT_VECTORCALL
    Py_ssize_t nargs = (Py_ssize_t)nargsf;
#else
    Py_ssize_t nargs = PyVectorcall_NARGS(nargsf);
#endif
    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_PyCMethod)(void(*)(void))meth)(self, cls, args, (size_t)nargs, 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 >= 0x030A0000
    Py_TPFLAGS_IMMUTABLETYPE |
#endif
    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;
}

/* CLineInTraceback */
#if CYTHON_CLINE_IN_TRACEBACK && CYTHON_CLINE_IN_TRACEBACK_RUNTIME
static int __Pyx_CLineForTraceback(PyThreadState *tstate, int c_line) {
    PyObject *use_cline;
    PyObject *ptype, *pvalue, *ptraceback;
#if CYTHON_COMPILING_IN_CPYTHON
    PyObject **cython_runtime_dict;
#endif
    CYTHON_MAYBE_UNUSED_VAR(tstate);
    if (unlikely(!__pyx_mstate_global->__pyx_cython_runtime)) {
        return c_line;
    }
    __Pyx_ErrFetchInState(tstate, &ptype, &pvalue, &ptraceback);
#if CYTHON_COMPILING_IN_CPYTHON
    cython_runtime_dict = _PyObject_GetDictPtr(__pyx_mstate_global->__pyx_cython_runtime);
    if (likely(cython_runtime_dict)) {
        __Pyx_BEGIN_CRITICAL_SECTION(*cython_runtime_dict);
        __PYX_PY_DICT_LOOKUP_IF_MODIFIED(
            use_cline, *cython_runtime_dict,
            __Pyx_PyDict_GetItemStr(*cython_runtime_dict, __pyx_mstate_global->__pyx_n_u_cline_in_traceback))
        Py_XINCREF(use_cline);
        __Pyx_END_CRITICAL_SECTION();
    } else
#endif
    {
      PyObject *use_cline_obj = __Pyx_PyObject_GetAttrStrNoError(__pyx_mstate_global->__pyx_cython_runtime, __pyx_mstate_global->__pyx_n_u_cline_in_traceback);
      if (use_cline_obj) {
        use_cline = PyObject_Not(use_cline_obj) ? Py_False : Py_True;
        Py_INCREF(use_cline);
        Py_DECREF(use_cline_obj);
      } else {
        PyErr_Clear();
        use_cline = NULL;
      }
    }
    if (!use_cline) {
        c_line = 0;
        (void) PyObject_SetAttr(__pyx_mstate_global->__pyx_cython_runtime, __pyx_mstate_global->__pyx_n_u_cline_in_traceback, Py_False);
    }
    else if (use_cline == Py_False || (use_cline != Py_True && PyObject_Not(use_cline) != 0)) {
        c_line = 0;
    }
    Py_XDECREF(use_cline);
    __Pyx_ErrRestoreInState(tstate, ptype, pvalue, ptraceback);
    return c_line;
}
#endif

/* CodeObjectCache */
static int __pyx_bisect_code_objects(__Pyx_CodeObjectCacheEntry* entries, int count, int code_line) {
    int start = 0, mid = 0, end = count - 1;
    if (end >= 0 && code_line > entries[end].code_line) {
        return count;
    }
    while (start < end) {
        mid = start + (end - start) / 2;
        if (code_line < entries[mid].code_line) {
            end = mid;
        } else if (code_line > entries[mid].code_line) {
             start = mid + 1;
        } else {
            return mid;
        }
    }
    if (code_line <= entries[mid].code_line) {
        return mid;
    } else {
        return mid + 1;
    }
}
static __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) {
        (void) __pyx_cfilenm;
        (void) __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;
        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

/* CIntFromPyVerify */
#define __PYX_VERIFY_RETURN_INT(target_type, func_type, func_value)\
    __PYX__VERIFY_RETURN_INT(target_type, func_type, func_value, 0)
#define __PYX_VERIFY_RETURN_INT_EXC(target_type, func_type, func_value)\
    __PYX__VERIFY_RETURN_INT(target_type, func_type, func_value, 1)
#define __PYX__VERIFY_RETURN_INT(target_type, func_type, func_value, exc)\
    {\
        func_type value = func_value;\
        if (sizeof(target_type) < sizeof(func_type)) {\
            if (unlikely(value != (func_type) (target_type) value)) {\
                func_type zero = 0;\
                if (exc && unlikely(value == (func_type)-1 && PyErr_Occurred()))\
                    return (target_type) -1;\
                if (is_unsigned && unlikely(value < zero))\
                    goto raise_neg_overflow;\
                else\
                    goto raise_overflow;\
            }\
        }\
        return (target_type) value;\
    }

/* CIntToPy */
static CYTHON_INLINE PyObject* __Pyx_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 defined(HAVE_LONG_LONG) && !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);
#ifdef HAVE_LONG_LONG
        } else if (sizeof(int) <= sizeof(PY_LONG_LONG)) {
            return PyLong_FromLongLong((PY_LONG_LONG) value);
#endif
        }
    }
    {
        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 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))
#ifdef HAVE_LONG_LONG
        } else if ((sizeof(int) <= sizeof(unsigned PY_LONG_LONG))) {
            __PYX_VERIFY_RETURN_INT_EXC(int, unsigned PY_LONG_LONG, PyLong_AsUnsignedLongLong(x))
#endif
        }
    } else {
#if CYTHON_USE_PYLONG_INTERNALS
        if (__Pyx_PyLong_IsCompact(x)) {
            __PYX_VERIFY_RETURN_INT(int, __Pyx_compact_pylong, __Pyx_PyLong_CompactValue(x))
        } else {
            const digit* digits = __Pyx_PyLong_Digits(x);
            assert(__Pyx_PyLong_DigitCount(x) > 1);
            switch (__Pyx_PyLong_SignedDigitCount(x)) {
                case -2:
                    if ((8 * sizeof(int) - 1 > 1 * PyLong_SHIFT)) {
                        if ((8 * sizeof(unsigned long) > 2 * PyLong_SHIFT)) {
                            __PYX_VERIFY_RETURN_INT(int, long, -(long) (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
                        } else if ((8 * sizeof(int) - 1 > 2 * PyLong_SHIFT)) {
                            return (int) (((int)-1)*(((((int)digits[1]) << PyLong_SHIFT) | (int)digits[0])));
                        }
                    }
                    break;
                case 2:
                    if ((8 * sizeof(int) > 1 * PyLong_SHIFT)) {
                        if ((8 * sizeof(unsigned long) > 2 * PyLong_SHIFT)) {
                            __PYX_VERIFY_RETURN_INT(int, unsigned long, (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
                        } else if ((8 * sizeof(int) - 1 > 2 * PyLong_SHIFT)) {
                            return (int) ((((((int)digits[1]) << PyLong_SHIFT) | (int)digits[0])));
                        }
                    }
                    break;
                case -3:
                    if ((8 * sizeof(int) - 1 > 2 * PyLong_SHIFT)) {
                        if ((8 * sizeof(unsigned long) > 3 * PyLong_SHIFT)) {
                            __PYX_VERIFY_RETURN_INT(int, long, -(long) (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
                        } else if ((8 * sizeof(int) - 1 > 3 * PyLong_SHIFT)) {
                            return (int) (((int)-1)*(((((((int)digits[2]) << PyLong_SHIFT) | (int)digits[1]) << PyLong_SHIFT) | (int)digits[0])));
                        }
                    }
                    break;
                case 3:
                    if ((8 * sizeof(int) > 2 * PyLong_SHIFT)) {
                        if ((8 * sizeof(unsigned long) > 3 * PyLong_SHIFT)) {
                            __PYX_VERIFY_RETURN_INT(int, unsigned long, (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
                        } else if ((8 * sizeof(int) - 1 > 3 * PyLong_SHIFT)) {
                            return (int) ((((((((int)digits[2]) << PyLong_SHIFT) | (int)digits[1]) << PyLong_SHIFT) | (int)digits[0])));
                        }
                    }
                    break;
                case -4:
                    if ((8 * sizeof(int) - 1 > 3 * PyLong_SHIFT)) {
                        if ((8 * sizeof(unsigned long) > 4 * PyLong_SHIFT)) {
                            __PYX_VERIFY_RETURN_INT(int, long, -(long) (((((((((unsigned long)digits[3]) << PyLong_SHIFT) | (unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
                        } else if ((8 * sizeof(int) - 1 > 4 * PyLong_SHIFT)) {
                            return (int) (((int)-1)*(((((((((int)digits[3]) << PyLong_SHIFT) | (int)digits[2]) << PyLong_SHIFT) | (int)digits[1]) << PyLong_SHIFT) | (int)digits[0])));
                        }
                    }
                    break;
                case 4:
                    if ((8 * sizeof(int) > 3 * PyLong_SHIFT)) {
                        if ((8 * sizeof(unsigned long) > 4 * PyLong_SHIFT)) {
                            __PYX_VERIFY_RETURN_INT(int, unsigned long, (((((((((unsigned long)digits[3]) << PyLong_SHIFT) | (unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
                        } else if ((8 * sizeof(int) - 1 > 4 * PyLong_SHIFT)) {
                            return (int) ((((((((((int)digits[3]) << PyLong_SHIFT) | (int)digits[2]) << PyLong_SHIFT) | (int)digits[1]) << PyLong_SHIFT) | (int)digits[0])));
                        }
                    }
                    break;
            }
        }
#endif
        if ((sizeof(int) <= sizeof(long))) {
            __PYX_VERIFY_RETURN_INT_EXC(int, long, PyLong_AsLong(x))
#ifdef HAVE_LONG_LONG
        } else if ((sizeof(int) <= sizeof(PY_LONG_LONG))) {
            __PYX_VERIFY_RETURN_INT_EXC(int, PY_LONG_LONG, PyLong_AsLongLong(x))
#endif
        }
    }
    {
        int val;
        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;
}

/* CIntToPy */
static CYTHON_INLINE PyObject* __Pyx_PyLong_From_int32_t(int32_t value) {
#ifdef __Pyx_HAS_GCC_DIAGNOSTIC
#pragma GCC diagnostic push
#pragma GCC diagnostic ignored "-Wconversion"
#endif
    const int32_t neg_one = (int32_t) -1, const_zero = (int32_t) 0;
#ifdef __Pyx_HAS_GCC_DIAGNOSTIC
#pragma GCC diagnostic pop
#endif
    const int is_unsigned = neg_one > const_zero;
    if (is_unsigned) {
        if (sizeof(int32_t) < sizeof(long)) {
            return PyLong_FromLong((long) value);
        } else if (sizeof(int32_t) <= sizeof(unsigned long)) {
            return PyLong_FromUnsignedLong((unsigned long) value);
#if defined(HAVE_LONG_LONG) && !CYTHON_COMPILING_IN_PYPY
        } else if (sizeof(int32_t) <= sizeof(unsigned PY_LONG_LONG)) {
            return PyLong_FromUnsignedLongLong((unsigned PY_LONG_LONG) value);
#endif
        }
    } else {
        if (sizeof(int32_t) <= sizeof(long)) {
            return PyLong_FromLong((long) value);
#ifdef HAVE_LONG_LONG
        } else if (sizeof(int32_t) <= sizeof(PY_LONG_LONG)) {
            return PyLong_FromLongLong((PY_LONG_LONG) value);
#endif
        }
    }
    {
        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(int32_t),
                                     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(int32_t));
        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 int32_t __Pyx_PyLong_As_int32_t(PyObject *x) {
#ifdef __Pyx_HAS_GCC_DIAGNOSTIC
#pragma GCC diagnostic push
#pragma GCC diagnostic ignored "-Wconversion"
#endif
    const int32_t neg_one = (int32_t) -1, const_zero = (int32_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))) {
        int32_t val;
        PyObject *tmp = __Pyx_PyNumber_Long(x);
        if (!tmp) return (int32_t) -1;
        val = __Pyx_PyLong_As_int32_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(int32_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(int32_t) > 1 * PyLong_SHIFT)) {
                        if ((8 * sizeof(unsigned long) > 2 * PyLong_SHIFT)) {
                            __PYX_VERIFY_RETURN_INT(int32_t, unsigned long, (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
                        } else if ((8 * sizeof(int32_t) >= 2 * PyLong_SHIFT)) {
                            return (int32_t) (((((int32_t)digits[1]) << PyLong_SHIFT) | (int32_t)digits[0]));
                        }
                    }
                    break;
                case 3:
                    if ((8 * sizeof(int32_t) > 2 * PyLong_SHIFT)) {
                        if ((8 * sizeof(unsigned long) > 3 * PyLong_SHIFT)) {
                            __PYX_VERIFY_RETURN_INT(int32_t, unsigned long, (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
                        } else if ((8 * sizeof(int32_t) >= 3 * PyLong_SHIFT)) {
                            return (int32_t) (((((((int32_t)digits[2]) << PyLong_SHIFT) | (int32_t)digits[1]) << PyLong_SHIFT) | (int32_t)digits[0]));
                        }
                    }
                    break;
                case 4:
                    if ((8 * sizeof(int32_t) > 3 * PyLong_SHIFT)) {
                        if ((8 * sizeof(unsigned long) > 4 * PyLong_SHIFT)) {
                            __PYX_VERIFY_RETURN_INT(int32_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(int32_t) >= 4 * PyLong_SHIFT)) {
                            return (int32_t) (((((((((int32_t)digits[3]) << PyLong_SHIFT) | (int32_t)digits[2]) << PyLong_SHIFT) | (int32_t)digits[1]) << PyLong_SHIFT) | (int32_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 (int32_t) -1;
            if (unlikely(result == 1))
                goto raise_neg_overflow;
        }
#endif
        if ((sizeof(int32_t) <= sizeof(unsigned long))) {
            __PYX_VERIFY_RETURN_INT_EXC(int32_t, unsigned long, PyLong_AsUnsignedLong(x))
#ifdef HAVE_LONG_LONG
        } else if ((sizeof(int32_t) <= sizeof(unsigned PY_LONG_LONG))) {
            __PYX_VERIFY_RETURN_INT_EXC(int32_t, unsigned PY_LONG_LONG, PyLong_AsUnsignedLongLong(x))
#endif
        }
    } else {
#if CYTHON_USE_PYLONG_INTERNALS
        if (__Pyx_PyLong_IsCompact(x)) {
            __PYX_VERIFY_RETURN_INT(int32_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(int32_t) - 1 > 1 * PyLong_SHIFT)) {
                        if ((8 * sizeof(unsigned long) > 2 * PyLong_SHIFT)) {
                            __PYX_VERIFY_RETURN_INT(int32_t, long, -(long) (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
                        } else if ((8 * sizeof(int32_t) - 1 > 2 * PyLong_SHIFT)) {
                            return (int32_t) (((int32_t)-1)*(((((int32_t)digits[1]) << PyLong_SHIFT) | (int32_t)digits[0])));
                        }
                    }
                    break;
                case 2:
                    if ((8 * sizeof(int32_t) > 1 * PyLong_SHIFT)) {
                        if ((8 * sizeof(unsigned long) > 2 * PyLong_SHIFT)) {
                            __PYX_VERIFY_RETURN_INT(int32_t, unsigned long, (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
                        } else if ((8 * sizeof(int32_t) - 1 > 2 * PyLong_SHIFT)) {
                            return (int32_t) ((((((int32_t)digits[1]) << PyLong_SHIFT) | (int32_t)digits[0])));
                        }
                    }
                    break;
                case -3:
                    if ((8 * sizeof(int32_t) - 1 > 2 * PyLong_SHIFT)) {
                        if ((8 * sizeof(unsigned long) > 3 * PyLong_SHIFT)) {
                            __PYX_VERIFY_RETURN_INT(int32_t, long, -(long) (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
                        } else if ((8 * sizeof(int32_t) - 1 > 3 * PyLong_SHIFT)) {
                            return (int32_t) (((int32_t)-1)*(((((((int32_t)digits[2]) << PyLong_SHIFT) | (int32_t)digits[1]) << PyLong_SHIFT) | (int32_t)digits[0])));
                        }
                    }
                    break;
                case 3:
                    if ((8 * sizeof(int32_t) > 2 * PyLong_SHIFT)) {
                        if ((8 * sizeof(unsigned long) > 3 * PyLong_SHIFT)) {
                            __PYX_VERIFY_RETURN_INT(int32_t, unsigned long, (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
                        } else if ((8 * sizeof(int32_t) - 1 > 3 * PyLong_SHIFT)) {
                            return (int32_t) ((((((((int32_t)digits[2]) << PyLong_SHIFT) | (int32_t)digits[1]) << PyLong_SHIFT) | (int32_t)digits[0])));
                        }
                    }
                    break;
                case -4:
                    if ((8 * sizeof(int32_t) - 1 > 3 * PyLong_SHIFT)) {
                        if ((8 * sizeof(unsigned long) > 4 * PyLong_SHIFT)) {
                            __PYX_VERIFY_RETURN_INT(int32_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(int32_t) - 1 > 4 * PyLong_SHIFT)) {
                            return (int32_t) (((int32_t)-1)*(((((((((int32_t)digits[3]) << PyLong_SHIFT) | (int32_t)digits[2]) << PyLong_SHIFT) | (int32_t)digits[1]) << PyLong_SHIFT) | (int32_t)digits[0])));
                        }
                    }
                    break;
                case 4:
                    if ((8 * sizeof(int32_t) > 3 * PyLong_SHIFT)) {
                        if ((8 * sizeof(unsigned long) > 4 * PyLong_SHIFT)) {
                            __PYX_VERIFY_RETURN_INT(int32_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(int32_t) - 1 > 4 * PyLong_SHIFT)) {
                            return (int32_t) ((((((((((int32_t)digits[3]) << PyLong_SHIFT) | (int32_t)digits[2]) << PyLong_SHIFT) | (int32_t)digits[1]) << PyLong_SHIFT) | (int32_t)digits[0])));
                        }
                    }
                    break;
            }
        }
#endif
        if ((sizeof(int32_t) <= sizeof(long))) {
            __PYX_VERIFY_RETURN_INT_EXC(int32_t, long, PyLong_AsLong(x))
#ifdef HAVE_LONG_LONG
        } else if ((sizeof(int32_t) <= sizeof(PY_LONG_LONG))) {
            __PYX_VERIFY_RETURN_INT_EXC(int32_t, PY_LONG_LONG, PyLong_AsLongLong(x))
#endif
        }
    }
    {
        int32_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 (int32_t) -1;
            assert(PyLong_CheckExact(v));
        }
        {
            int result = PyObject_RichCompareBool(v, Py_False, Py_LT);
            if (unlikely(result < 0)) {
                Py_DECREF(v);
                return (int32_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 (int32_t) -1;
        } else {
            stepval = v;
        }
        v = NULL;
        val = (int32_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(int32_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 |= ((int32_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(int32_t) * 8) - bits - (is_unsigned ? 0 : 1);
            if (unlikely(idigit >= (1L << remaining_bits)))
                goto raise_overflow;
            val |= ((int32_t) idigit) << bits;
        }
        if (!is_unsigned) {
            if (unlikely(val & (((int32_t) 1) << (sizeof(int32_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 (int32_t) -1;
        return val;
    }
raise_overflow:
    PyErr_SetString(PyExc_OverflowError,
        "value too large to convert to int32_t");
    return (int32_t) -1;
raise_neg_overflow:
    PyErr_SetString(PyExc_OverflowError,
        "can't convert negative value to int32_t");
    return (int32_t) -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))
#ifdef HAVE_LONG_LONG
        } else if ((sizeof(long) <= sizeof(unsigned PY_LONG_LONG))) {
            __PYX_VERIFY_RETURN_INT_EXC(long, unsigned PY_LONG_LONG, PyLong_AsUnsignedLongLong(x))
#endif
        }
    } else {
#if CYTHON_USE_PYLONG_INTERNALS
        if (__Pyx_PyLong_IsCompact(x)) {
            __PYX_VERIFY_RETURN_INT(long, __Pyx_compact_pylong, __Pyx_PyLong_CompactValue(x))
        } else {
            const digit* digits = __Pyx_PyLong_Digits(x);
            assert(__Pyx_PyLong_DigitCount(x) > 1);
            switch (__Pyx_PyLong_SignedDigitCount(x)) {
                case -2:
                    if ((8 * sizeof(long) - 1 > 1 * PyLong_SHIFT)) {
                        if ((8 * sizeof(unsigned long) > 2 * PyLong_SHIFT)) {
                            __PYX_VERIFY_RETURN_INT(long, long, -(long) (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
                        } else if ((8 * sizeof(long) - 1 > 2 * PyLong_SHIFT)) {
                            return (long) (((long)-1)*(((((long)digits[1]) << PyLong_SHIFT) | (long)digits[0])));
                        }
                    }
                    break;
                case 2:
                    if ((8 * sizeof(long) > 1 * PyLong_SHIFT)) {
                        if ((8 * sizeof(unsigned long) > 2 * PyLong_SHIFT)) {
                            __PYX_VERIFY_RETURN_INT(long, unsigned long, (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
                        } else if ((8 * sizeof(long) - 1 > 2 * PyLong_SHIFT)) {
                            return (long) ((((((long)digits[1]) << PyLong_SHIFT) | (long)digits[0])));
                        }
                    }
                    break;
                case -3:
                    if ((8 * sizeof(long) - 1 > 2 * PyLong_SHIFT)) {
                        if ((8 * sizeof(unsigned long) > 3 * PyLong_SHIFT)) {
                            __PYX_VERIFY_RETURN_INT(long, long, -(long) (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
                        } else if ((8 * sizeof(long) - 1 > 3 * PyLong_SHIFT)) {
                            return (long) (((long)-1)*(((((((long)digits[2]) << PyLong_SHIFT) | (long)digits[1]) << PyLong_SHIFT) | (long)digits[0])));
                        }
                    }
                    break;
                case 3:
                    if ((8 * sizeof(long) > 2 * PyLong_SHIFT)) {
                        if ((8 * sizeof(unsigned long) > 3 * PyLong_SHIFT)) {
                            __PYX_VERIFY_RETURN_INT(long, unsigned long, (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
                        } else if ((8 * sizeof(long) - 1 > 3 * PyLong_SHIFT)) {
                            return (long) ((((((((long)digits[2]) << PyLong_SHIFT) | (long)digits[1]) << PyLong_SHIFT) | (long)digits[0])));
                        }
                    }
                    break;
                case -4:
                    if ((8 * sizeof(long) - 1 > 3 * PyLong_SHIFT)) {
                        if ((8 * sizeof(unsigned long) > 4 * PyLong_SHIFT)) {
                            __PYX_VERIFY_RETURN_INT(long, long, -(long) (((((((((unsigned long)digits[3]) << PyLong_SHIFT) | (unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
                        } else if ((8 * sizeof(long) - 1 > 4 * PyLong_SHIFT)) {
                            return (long) (((long)-1)*(((((((((long)digits[3]) << PyLong_SHIFT) | (long)digits[2]) << PyLong_SHIFT) | (long)digits[1]) << PyLong_SHIFT) | (long)digits[0])));
                        }
                    }
                    break;
                case 4:
                    if ((8 * sizeof(long) > 3 * PyLong_SHIFT)) {
                        if ((8 * sizeof(unsigned long) > 4 * PyLong_SHIFT)) {
                            __PYX_VERIFY_RETURN_INT(long, unsigned long, (((((((((unsigned long)digits[3]) << PyLong_SHIFT) | (unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
                        } else if ((8 * sizeof(long) - 1 > 4 * PyLong_SHIFT)) {
                            return (long) ((((((((((long)digits[3]) << PyLong_SHIFT) | (long)digits[2]) << PyLong_SHIFT) | (long)digits[1]) << PyLong_SHIFT) | (long)digits[0])));
                        }
                    }
                    break;
            }
        }
#endif
        if ((sizeof(long) <= sizeof(long))) {
            __PYX_VERIFY_RETURN_INT_EXC(long, long, PyLong_AsLong(x))
#ifdef HAVE_LONG_LONG
        } else if ((sizeof(long) <= sizeof(PY_LONG_LONG))) {
            __PYX_VERIFY_RETURN_INT_EXC(long, PY_LONG_LONG, PyLong_AsLongLong(x))
#endif
        }
    }
    {
        long val;
        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_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 defined(HAVE_LONG_LONG) && !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);
#ifdef HAVE_LONG_LONG
        } else if (sizeof(long) <= sizeof(PY_LONG_LONG)) {
            return PyLong_FromLongLong((PY_LONG_LONG) value);
#endif
        }
    }
    {
        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_int8_t(int8_t value) {
#ifdef __Pyx_HAS_GCC_DIAGNOSTIC
#pragma GCC diagnostic push
#pragma GCC diagnostic ignored "-Wconversion"
#endif
    const int8_t neg_one = (int8_t) -1, const_zero = (int8_t) 0;
#ifdef __Pyx_HAS_GCC_DIAGNOSTIC
#pragma GCC diagnostic pop
#endif
    const int is_unsigned = neg_one > const_zero;
    if (is_unsigned) {
        if (sizeof(int8_t) < sizeof(long)) {
            return PyLong_FromLong((long) value);
        } else if (sizeof(int8_t) <= sizeof(unsigned long)) {
            return PyLong_FromUnsignedLong((unsigned long) value);
#if defined(HAVE_LONG_LONG) && !CYTHON_COMPILING_IN_PYPY
        } else if (sizeof(int8_t) <= sizeof(unsigned PY_LONG_LONG)) {
            return PyLong_FromUnsignedLongLong((unsigned PY_LONG_LONG) value);
#endif
        }
    } else {
        if (sizeof(int8_t) <= sizeof(long)) {
            return PyLong_FromLong((long) value);
#ifdef HAVE_LONG_LONG
        } else if (sizeof(int8_t) <= sizeof(PY_LONG_LONG)) {
            return PyLong_FromLongLong((PY_LONG_LONG) value);
#endif
        }
    }
    {
        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(int8_t),
                                     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(int8_t));
        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_int16_t(int16_t value) {
#ifdef __Pyx_HAS_GCC_DIAGNOSTIC
#pragma GCC diagnostic push
#pragma GCC diagnostic ignored "-Wconversion"
#endif
    const int16_t neg_one = (int16_t) -1, const_zero = (int16_t) 0;
#ifdef __Pyx_HAS_GCC_DIAGNOSTIC
#pragma GCC diagnostic pop
#endif
    const int is_unsigned = neg_one > const_zero;
    if (is_unsigned) {
        if (sizeof(int16_t) < sizeof(long)) {
            return PyLong_FromLong((long) value);
        } else if (sizeof(int16_t) <= sizeof(unsigned long)) {
            return PyLong_FromUnsignedLong((unsigned long) value);
#if defined(HAVE_LONG_LONG) && !CYTHON_COMPILING_IN_PYPY
        } else if (sizeof(int16_t) <= sizeof(unsigned PY_LONG_LONG)) {
            return PyLong_FromUnsignedLongLong((unsigned PY_LONG_LONG) value);
#endif
        }
    } else {
        if (sizeof(int16_t) <= sizeof(long)) {
            return PyLong_FromLong((long) value);
#ifdef HAVE_LONG_LONG
        } else if (sizeof(int16_t) <= sizeof(PY_LONG_LONG)) {
            return PyLong_FromLongLong((PY_LONG_LONG) value);
#endif
        }
    }
    {
        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(int16_t),
                                     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(int16_t));
        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 int8_t __Pyx_PyLong_As_int8_t(PyObject *x) {
#ifdef __Pyx_HAS_GCC_DIAGNOSTIC
#pragma GCC diagnostic push
#pragma GCC diagnostic ignored "-Wconversion"
#endif
    const int8_t neg_one = (int8_t) -1, const_zero = (int8_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))) {
        int8_t val;
        PyObject *tmp = __Pyx_PyNumber_Long(x);
        if (!tmp) return (int8_t) -1;
        val = __Pyx_PyLong_As_int8_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(int8_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(int8_t) > 1 * PyLong_SHIFT)) {
                        if ((8 * sizeof(unsigned long) > 2 * PyLong_SHIFT)) {
                            __PYX_VERIFY_RETURN_INT(int8_t, unsigned long, (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
                        } else if ((8 * sizeof(int8_t) >= 2 * PyLong_SHIFT)) {
                            return (int8_t) (((((int8_t)digits[1]) << PyLong_SHIFT) | (int8_t)digits[0]));
                        }
                    }
                    break;
                case 3:
                    if ((8 * sizeof(int8_t) > 2 * PyLong_SHIFT)) {
                        if ((8 * sizeof(unsigned long) > 3 * PyLong_SHIFT)) {
                            __PYX_VERIFY_RETURN_INT(int8_t, unsigned long, (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
                        } else if ((8 * sizeof(int8_t) >= 3 * PyLong_SHIFT)) {
                            return (int8_t) (((((((int8_t)digits[2]) << PyLong_SHIFT) | (int8_t)digits[1]) << PyLong_SHIFT) | (int8_t)digits[0]));
                        }
                    }
                    break;
                case 4:
                    if ((8 * sizeof(int8_t) > 3 * PyLong_SHIFT)) {
                        if ((8 * sizeof(unsigned long) > 4 * PyLong_SHIFT)) {
                            __PYX_VERIFY_RETURN_INT(int8_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(int8_t) >= 4 * PyLong_SHIFT)) {
                            return (int8_t) (((((((((int8_t)digits[3]) << PyLong_SHIFT) | (int8_t)digits[2]) << PyLong_SHIFT) | (int8_t)digits[1]) << PyLong_SHIFT) | (int8_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 (int8_t) -1;
            if (unlikely(result == 1))
                goto raise_neg_overflow;
        }
#endif
        if ((sizeof(int8_t) <= sizeof(unsigned long))) {
            __PYX_VERIFY_RETURN_INT_EXC(int8_t, unsigned long, PyLong_AsUnsignedLong(x))
#ifdef HAVE_LONG_LONG
        } else if ((sizeof(int8_t) <= sizeof(unsigned PY_LONG_LONG))) {
            __PYX_VERIFY_RETURN_INT_EXC(int8_t, unsigned PY_LONG_LONG, PyLong_AsUnsignedLongLong(x))
#endif
        }
    } else {
#if CYTHON_USE_PYLONG_INTERNALS
        if (__Pyx_PyLong_IsCompact(x)) {
            __PYX_VERIFY_RETURN_INT(int8_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(int8_t) - 1 > 1 * PyLong_SHIFT)) {
                        if ((8 * sizeof(unsigned long) > 2 * PyLong_SHIFT)) {
                            __PYX_VERIFY_RETURN_INT(int8_t, long, -(long) (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
                        } else if ((8 * sizeof(int8_t) - 1 > 2 * PyLong_SHIFT)) {
                            return (int8_t) (((int8_t)-1)*(((((int8_t)digits[1]) << PyLong_SHIFT) | (int8_t)digits[0])));
                        }
                    }
                    break;
                case 2:
                    if ((8 * sizeof(int8_t) > 1 * PyLong_SHIFT)) {
                        if ((8 * sizeof(unsigned long) > 2 * PyLong_SHIFT)) {
                            __PYX_VERIFY_RETURN_INT(int8_t, unsigned long, (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
                        } else if ((8 * sizeof(int8_t) - 1 > 2 * PyLong_SHIFT)) {
                            return (int8_t) ((((((int8_t)digits[1]) << PyLong_SHIFT) | (int8_t)digits[0])));
                        }
                    }
                    break;
                case -3:
                    if ((8 * sizeof(int8_t) - 1 > 2 * PyLong_SHIFT)) {
                        if ((8 * sizeof(unsigned long) > 3 * PyLong_SHIFT)) {
                            __PYX_VERIFY_RETURN_INT(int8_t, long, -(long) (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
                        } else if ((8 * sizeof(int8_t) - 1 > 3 * PyLong_SHIFT)) {
                            return (int8_t) (((int8_t)-1)*(((((((int8_t)digits[2]) << PyLong_SHIFT) | (int8_t)digits[1]) << PyLong_SHIFT) | (int8_t)digits[0])));
                        }
                    }
                    break;
                case 3:
                    if ((8 * sizeof(int8_t) > 2 * PyLong_SHIFT)) {
                        if ((8 * sizeof(unsigned long) > 3 * PyLong_SHIFT)) {
                            __PYX_VERIFY_RETURN_INT(int8_t, unsigned long, (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
                        } else if ((8 * sizeof(int8_t) - 1 > 3 * PyLong_SHIFT)) {
                            return (int8_t) ((((((((int8_t)digits[2]) << PyLong_SHIFT) | (int8_t)digits[1]) << PyLong_SHIFT) | (int8_t)digits[0])));
                        }
                    }
                    break;
                case -4:
                    if ((8 * sizeof(int8_t) - 1 > 3 * PyLong_SHIFT)) {
                        if ((8 * sizeof(unsigned long) > 4 * PyLong_SHIFT)) {
                            __PYX_VERIFY_RETURN_INT(int8_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(int8_t) - 1 > 4 * PyLong_SHIFT)) {
                            return (int8_t) (((int8_t)-1)*(((((((((int8_t)digits[3]) << PyLong_SHIFT) | (int8_t)digits[2]) << PyLong_SHIFT) | (int8_t)digits[1]) << PyLong_SHIFT) | (int8_t)digits[0])));
                        }
                    }
                    break;
                case 4:
                    if ((8 * sizeof(int8_t) > 3 * PyLong_SHIFT)) {
                        if ((8 * sizeof(unsigned long) > 4 * PyLong_SHIFT)) {
                            __PYX_VERIFY_RETURN_INT(int8_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(int8_t) - 1 > 4 * PyLong_SHIFT)) {
                            return (int8_t) ((((((((((int8_t)digits[3]) << PyLong_SHIFT) | (int8_t)digits[2]) << PyLong_SHIFT) | (int8_t)digits[1]) << PyLong_SHIFT) | (int8_t)digits[0])));
                        }
                    }
                    break;
            }
        }
#endif
        if ((sizeof(int8_t) <= sizeof(long))) {
            __PYX_VERIFY_RETURN_INT_EXC(int8_t, long, PyLong_AsLong(x))
#ifdef HAVE_LONG_LONG
        } else if ((sizeof(int8_t) <= sizeof(PY_LONG_LONG))) {
            __PYX_VERIFY_RETURN_INT_EXC(int8_t, PY_LONG_LONG, PyLong_AsLongLong(x))
#endif
        }
    }
    {
        int8_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 (int8_t) -1;
            assert(PyLong_CheckExact(v));
        }
        {
            int result = PyObject_RichCompareBool(v, Py_False, Py_LT);
            if (unlikely(result < 0)) {
                Py_DECREF(v);
                return (int8_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 (int8_t) -1;
        } else {
            stepval = v;
        }
        v = NULL;
        val = (int8_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(int8_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 |= ((int8_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(int8_t) * 8) - bits - (is_unsigned ? 0 : 1);
            if (unlikely(idigit >= (1L << remaining_bits)))
                goto raise_overflow;
            val |= ((int8_t) idigit) << bits;
        }
        if (!is_unsigned) {
            if (unlikely(val & (((int8_t) 1) << (sizeof(int8_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 (int8_t) -1;
        return val;
    }
raise_overflow:
    PyErr_SetString(PyExc_OverflowError,
        "value too large to convert to int8_t");
    return (int8_t) -1;
raise_neg_overflow:
    PyErr_SetString(PyExc_OverflowError,
        "can't convert negative value to int8_t");
    return (int8_t) -1;
}

/* CIntFromPy */
static CYTHON_INLINE int16_t __Pyx_PyLong_As_int16_t(PyObject *x) {
#ifdef __Pyx_HAS_GCC_DIAGNOSTIC
#pragma GCC diagnostic push
#pragma GCC diagnostic ignored "-Wconversion"
#endif
    const int16_t neg_one = (int16_t) -1, const_zero = (int16_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))) {
        int16_t val;
        PyObject *tmp = __Pyx_PyNumber_Long(x);
        if (!tmp) return (int16_t) -1;
        val = __Pyx_PyLong_As_int16_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(int16_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(int16_t) > 1 * PyLong_SHIFT)) {
                        if ((8 * sizeof(unsigned long) > 2 * PyLong_SHIFT)) {
                            __PYX_VERIFY_RETURN_INT(int16_t, unsigned long, (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
                        } else if ((8 * sizeof(int16_t) >= 2 * PyLong_SHIFT)) {
                            return (int16_t) (((((int16_t)digits[1]) << PyLong_SHIFT) | (int16_t)digits[0]));
                        }
                    }
                    break;
                case 3:
                    if ((8 * sizeof(int16_t) > 2 * PyLong_SHIFT)) {
                        if ((8 * sizeof(unsigned long) > 3 * PyLong_SHIFT)) {
                            __PYX_VERIFY_RETURN_INT(int16_t, unsigned long, (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
                        } else if ((8 * sizeof(int16_t) >= 3 * PyLong_SHIFT)) {
                            return (int16_t) (((((((int16_t)digits[2]) << PyLong_SHIFT) | (int16_t)digits[1]) << PyLong_SHIFT) | (int16_t)digits[0]));
                        }
                    }
                    break;
                case 4:
                    if ((8 * sizeof(int16_t) > 3 * PyLong_SHIFT)) {
                        if ((8 * sizeof(unsigned long) > 4 * PyLong_SHIFT)) {
                            __PYX_VERIFY_RETURN_INT(int16_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(int16_t) >= 4 * PyLong_SHIFT)) {
                            return (int16_t) (((((((((int16_t)digits[3]) << PyLong_SHIFT) | (int16_t)digits[2]) << PyLong_SHIFT) | (int16_t)digits[1]) << PyLong_SHIFT) | (int16_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 (int16_t) -1;
            if (unlikely(result == 1))
                goto raise_neg_overflow;
        }
#endif
        if ((sizeof(int16_t) <= sizeof(unsigned long))) {
            __PYX_VERIFY_RETURN_INT_EXC(int16_t, unsigned long, PyLong_AsUnsignedLong(x))
#ifdef HAVE_LONG_LONG
        } else if ((sizeof(int16_t) <= sizeof(unsigned PY_LONG_LONG))) {
            __PYX_VERIFY_RETURN_INT_EXC(int16_t, unsigned PY_LONG_LONG, PyLong_AsUnsignedLongLong(x))
#endif
        }
    } else {
#if CYTHON_USE_PYLONG_INTERNALS
        if (__Pyx_PyLong_IsCompact(x)) {
            __PYX_VERIFY_RETURN_INT(int16_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(int16_t) - 1 > 1 * PyLong_SHIFT)) {
                        if ((8 * sizeof(unsigned long) > 2 * PyLong_SHIFT)) {
                            __PYX_VERIFY_RETURN_INT(int16_t, long, -(long) (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
                        } else if ((8 * sizeof(int16_t) - 1 > 2 * PyLong_SHIFT)) {
                            return (int16_t) (((int16_t)-1)*(((((int16_t)digits[1]) << PyLong_SHIFT) | (int16_t)digits[0])));
                        }
                    }
                    break;
                case 2:
                    if ((8 * sizeof(int16_t) > 1 * PyLong_SHIFT)) {
                        if ((8 * sizeof(unsigned long) > 2 * PyLong_SHIFT)) {
                            __PYX_VERIFY_RETURN_INT(int16_t, unsigned long, (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
                        } else if ((8 * sizeof(int16_t) - 1 > 2 * PyLong_SHIFT)) {
                            return (int16_t) ((((((int16_t)digits[1]) << PyLong_SHIFT) | (int16_t)digits[0])));
                        }
                    }
                    break;
                case -3:
                    if ((8 * sizeof(int16_t) - 1 > 2 * PyLong_SHIFT)) {
                        if ((8 * sizeof(unsigned long) > 3 * PyLong_SHIFT)) {
                            __PYX_VERIFY_RETURN_INT(int16_t, long, -(long) (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
                        } else if ((8 * sizeof(int16_t) - 1 > 3 * PyLong_SHIFT)) {
                            return (int16_t) (((int16_t)-1)*(((((((int16_t)digits[2]) << PyLong_SHIFT) | (int16_t)digits[1]) << PyLong_SHIFT) | (int16_t)digits[0])));
                        }
                    }
                    break;
                case 3:
                    if ((8 * sizeof(int16_t) > 2 * PyLong_SHIFT)) {
                        if ((8 * sizeof(unsigned long) > 3 * PyLong_SHIFT)) {
                            __PYX_VERIFY_RETURN_INT(int16_t, unsigned long, (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
                        } else if ((8 * sizeof(int16_t) - 1 > 3 * PyLong_SHIFT)) {
                            return (int16_t) ((((((((int16_t)digits[2]) << PyLong_SHIFT) | (int16_t)digits[1]) << PyLong_SHIFT) | (int16_t)digits[0])));
                        }
                    }
                    break;
                case -4:
                    if ((8 * sizeof(int16_t) - 1 > 3 * PyLong_SHIFT)) {
                        if ((8 * sizeof(unsigned long) > 4 * PyLong_SHIFT)) {
                            __PYX_VERIFY_RETURN_INT(int16_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(int16_t) - 1 > 4 * PyLong_SHIFT)) {
                            return (int16_t) (((int16_t)-1)*(((((((((int16_t)digits[3]) << PyLong_SHIFT) | (int16_t)digits[2]) << PyLong_SHIFT) | (int16_t)digits[1]) << PyLong_SHIFT) | (int16_t)digits[0])));
                        }
                    }
                    break;
                case 4:
                    if ((8 * sizeof(int16_t) > 3 * PyLong_SHIFT)) {
                        if ((8 * sizeof(unsigned long) > 4 * PyLong_SHIFT)) {
                            __PYX_VERIFY_RETURN_INT(int16_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(int16_t) - 1 > 4 * PyLong_SHIFT)) {
                            return (int16_t) ((((((((((int16_t)digits[3]) << PyLong_SHIFT) | (int16_t)digits[2]) << PyLong_SHIFT) | (int16_t)digits[1]) << PyLong_SHIFT) | (int16_t)digits[0])));
                        }
                    }
                    break;
            }
        }
#endif
        if ((sizeof(int16_t) <= sizeof(long))) {
            __PYX_VERIFY_RETURN_INT_EXC(int16_t, long, PyLong_AsLong(x))
#ifdef HAVE_LONG_LONG
        } else if ((sizeof(int16_t) <= sizeof(PY_LONG_LONG))) {
            __PYX_VERIFY_RETURN_INT_EXC(int16_t, PY_LONG_LONG, PyLong_AsLongLong(x))
#endif
        }
    }
    {
        int16_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 (int16_t) -1;
            assert(PyLong_CheckExact(v));
        }
        {
            int result = PyObject_RichCompareBool(v, Py_False, Py_LT);
            if (unlikely(result < 0)) {
                Py_DECREF(v);
                return (int16_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 (int16_t) -1;
        } else {
            stepval = v;
        }
        v = NULL;
        val = (int16_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(int16_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 |= ((int16_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(int16_t) * 8) - bits - (is_unsigned ? 0 : 1);
            if (unlikely(idigit >= (1L << remaining_bits)))
                goto raise_overflow;
            val |= ((int16_t) idigit) << bits;
        }
        if (!is_unsigned) {
            if (unlikely(val & (((int16_t) 1) << (sizeof(int16_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 (int16_t) -1;
        return val;
    }
raise_overflow:
    PyErr_SetString(PyExc_OverflowError,
        "value too large to convert to int16_t");
    return (int16_t) -1;
raise_neg_overflow:
    PyErr_SetString(PyExc_OverflowError,
        "can't convert negative value to int16_t");
    return (int16_t) -1;
}

/* CIntToPy */
static CYTHON_INLINE PyObject* __Pyx_PyLong_From_uint32_t(uint32_t value) {
#ifdef __Pyx_HAS_GCC_DIAGNOSTIC
#pragma GCC diagnostic push
#pragma GCC diagnostic ignored "-Wconversion"
#endif
    const uint32_t neg_one = (uint32_t) -1, const_zero = (uint32_t) 0;
#ifdef __Pyx_HAS_GCC_DIAGNOSTIC
#pragma GCC diagnostic pop
#endif
    const int is_unsigned = neg_one > const_zero;
    if (is_unsigned) {
        if (sizeof(uint32_t) < sizeof(long)) {
            return PyLong_FromLong((long) value);
        } else if (sizeof(uint32_t) <= sizeof(unsigned long)) {
            return PyLong_FromUnsignedLong((unsigned long) value);
#if defined(HAVE_LONG_LONG) && !CYTHON_COMPILING_IN_PYPY
        } else if (sizeof(uint32_t) <= sizeof(unsigned PY_LONG_LONG)) {
            return PyLong_FromUnsignedLongLong((unsigned PY_LONG_LONG) value);
#endif
        }
    } else {
        if (sizeof(uint32_t) <= sizeof(long)) {
            return PyLong_FromLong((long) value);
#ifdef HAVE_LONG_LONG
        } else if (sizeof(uint32_t) <= sizeof(PY_LONG_LONG)) {
            return PyLong_FromLongLong((PY_LONG_LONG) value);
#endif
        }
    }
    {
        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(uint32_t),
                                     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(uint32_t));
        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 uint32_t __Pyx_PyLong_As_uint32_t(PyObject *x) {
#ifdef __Pyx_HAS_GCC_DIAGNOSTIC
#pragma GCC diagnostic push
#pragma GCC diagnostic ignored "-Wconversion"
#endif
    const uint32_t neg_one = (uint32_t) -1, const_zero = (uint32_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))) {
        uint32_t val;
        PyObject *tmp = __Pyx_PyNumber_Long(x);
        if (!tmp) return (uint32_t) -1;
        val = __Pyx_PyLong_As_uint32_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(uint32_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(uint32_t) > 1 * PyLong_SHIFT)) {
                        if ((8 * sizeof(unsigned long) > 2 * PyLong_SHIFT)) {
                            __PYX_VERIFY_RETURN_INT(uint32_t, unsigned long, (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
                        } else if ((8 * sizeof(uint32_t) >= 2 * PyLong_SHIFT)) {
                            return (uint32_t) (((((uint32_t)digits[1]) << PyLong_SHIFT) | (uint32_t)digits[0]));
                        }
                    }
                    break;
                case 3:
                    if ((8 * sizeof(uint32_t) > 2 * PyLong_SHIFT)) {
                        if ((8 * sizeof(unsigned long) > 3 * PyLong_SHIFT)) {
                            __PYX_VERIFY_RETURN_INT(uint32_t, unsigned long, (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
                        } else if ((8 * sizeof(uint32_t) >= 3 * PyLong_SHIFT)) {
                            return (uint32_t) (((((((uint32_t)digits[2]) << PyLong_SHIFT) | (uint32_t)digits[1]) << PyLong_SHIFT) | (uint32_t)digits[0]));
                        }
                    }
                    break;
                case 4:
                    if ((8 * sizeof(uint32_t) > 3 * PyLong_SHIFT)) {
                        if ((8 * sizeof(unsigned long) > 4 * PyLong_SHIFT)) {
                            __PYX_VERIFY_RETURN_INT(uint32_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(uint32_t) >= 4 * PyLong_SHIFT)) {
                            return (uint32_t) (((((((((uint32_t)digits[3]) << PyLong_SHIFT) | (uint32_t)digits[2]) << PyLong_SHIFT) | (uint32_t)digits[1]) << PyLong_SHIFT) | (uint32_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 (uint32_t) -1;
            if (unlikely(result == 1))
                goto raise_neg_overflow;
        }
#endif
        if ((sizeof(uint32_t) <= sizeof(unsigned long))) {
            __PYX_VERIFY_RETURN_INT_EXC(uint32_t, unsigned long, PyLong_AsUnsignedLong(x))
#ifdef HAVE_LONG_LONG
        } else if ((sizeof(uint32_t) <= sizeof(unsigned PY_LONG_LONG))) {
            __PYX_VERIFY_RETURN_INT_EXC(uint32_t, unsigned PY_LONG_LONG, PyLong_AsUnsignedLongLong(x))
#endif
        }
    } else {
#if CYTHON_USE_PYLONG_INTERNALS
        if (__Pyx_PyLong_IsCompact(x)) {
            __PYX_VERIFY_RETURN_INT(uint32_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(uint32_t) - 1 > 1 * PyLong_SHIFT)) {
                        if ((8 * sizeof(unsigned long) > 2 * PyLong_SHIFT)) {
                            __PYX_VERIFY_RETURN_INT(uint32_t, long, -(long) (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
                        } else if ((8 * sizeof(uint32_t) - 1 > 2 * PyLong_SHIFT)) {
                            return (uint32_t) (((uint32_t)-1)*(((((uint32_t)digits[1]) << PyLong_SHIFT) | (uint32_t)digits[0])));
                        }
                    }
                    break;
                case 2:
                    if ((8 * sizeof(uint32_t) > 1 * PyLong_SHIFT)) {
                        if ((8 * sizeof(unsigned long) > 2 * PyLong_SHIFT)) {
                            __PYX_VERIFY_RETURN_INT(uint32_t, unsigned long, (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
                        } else if ((8 * sizeof(uint32_t) - 1 > 2 * PyLong_SHIFT)) {
                            return (uint32_t) ((((((uint32_t)digits[1]) << PyLong_SHIFT) | (uint32_t)digits[0])));
                        }
                    }
                    break;
                case -3:
                    if ((8 * sizeof(uint32_t) - 1 > 2 * PyLong_SHIFT)) {
                        if ((8 * sizeof(unsigned long) > 3 * PyLong_SHIFT)) {
                            __PYX_VERIFY_RETURN_INT(uint32_t, long, -(long) (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
                        } else if ((8 * sizeof(uint32_t) - 1 > 3 * PyLong_SHIFT)) {
                            return (uint32_t) (((uint32_t)-1)*(((((((uint32_t)digits[2]) << PyLong_SHIFT) | (uint32_t)digits[1]) << PyLong_SHIFT) | (uint32_t)digits[0])));
                        }
                    }
                    break;
                case 3:
                    if ((8 * sizeof(uint32_t) > 2 * PyLong_SHIFT)) {
                        if ((8 * sizeof(unsigned long) > 3 * PyLong_SHIFT)) {
                            __PYX_VERIFY_RETURN_INT(uint32_t, unsigned long, (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
                        } else if ((8 * sizeof(uint32_t) - 1 > 3 * PyLong_SHIFT)) {
                            return (uint32_t) ((((((((uint32_t)digits[2]) << PyLong_SHIFT) | (uint32_t)digits[1]) << PyLong_SHIFT) | (uint32_t)digits[0])));
                        }
                    }
                    break;
                case -4:
                    if ((8 * sizeof(uint32_t) - 1 > 3 * PyLong_SHIFT)) {
                        if ((8 * sizeof(unsigned long) > 4 * PyLong_SHIFT)) {
                            __PYX_VERIFY_RETURN_INT(uint32_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(uint32_t) - 1 > 4 * PyLong_SHIFT)) {
                            return (uint32_t) (((uint32_t)-1)*(((((((((uint32_t)digits[3]) << PyLong_SHIFT) | (uint32_t)digits[2]) << PyLong_SHIFT) | (uint32_t)digits[1]) << PyLong_SHIFT) | (uint32_t)digits[0])));
                        }
                    }
                    break;
                case 4:
                    if ((8 * sizeof(uint32_t) > 3 * PyLong_SHIFT)) {
                        if ((8 * sizeof(unsigned long) > 4 * PyLong_SHIFT)) {
                            __PYX_VERIFY_RETURN_INT(uint32_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(uint32_t) - 1 > 4 * PyLong_SHIFT)) {
                            return (uint32_t) ((((((((((uint32_t)digits[3]) << PyLong_SHIFT) | (uint32_t)digits[2]) << PyLong_SHIFT) | (uint32_t)digits[1]) << PyLong_SHIFT) | (uint32_t)digits[0])));
                        }
                    }
                    break;
            }
        }
#endif
        if ((sizeof(uint32_t) <= sizeof(long))) {
            __PYX_VERIFY_RETURN_INT_EXC(uint32_t, long, PyLong_AsLong(x))
#ifdef HAVE_LONG_LONG
        } else if ((sizeof(uint32_t) <= sizeof(PY_LONG_LONG))) {
            __PYX_VERIFY_RETURN_INT_EXC(uint32_t, PY_LONG_LONG, PyLong_AsLongLong(x))
#endif
        }
    }
    {
        uint32_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 (uint32_t) -1;
            assert(PyLong_CheckExact(v));
        }
        {
            int result = PyObject_RichCompareBool(v, Py_False, Py_LT);
            if (unlikely(result < 0)) {
                Py_DECREF(v);
                return (uint32_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 (uint32_t) -1;
        } else {
            stepval = v;
        }
        v = NULL;
        val = (uint32_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(uint32_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 |= ((uint32_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(uint32_t) * 8) - bits - (is_unsigned ? 0 : 1);
            if (unlikely(idigit >= (1L << remaining_bits)))
                goto raise_overflow;
            val |= ((uint32_t) idigit) << bits;
        }
        if (!is_unsigned) {
            if (unlikely(val & (((uint32_t) 1) << (sizeof(uint32_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 (uint32_t) -1;
        return val;
    }
raise_overflow:
    PyErr_SetString(PyExc_OverflowError,
        "value too large to convert to uint32_t");
    return (uint32_t) -1;
raise_neg_overflow:
    PyErr_SetString(PyExc_OverflowError,
        "can't convert negative value to uint32_t");
    return (uint32_t) -1;
}

/* CIntToPy */
static CYTHON_INLINE PyObject* __Pyx_PyLong_From_uint8_t(uint8_t value) {
#ifdef __Pyx_HAS_GCC_DIAGNOSTIC
#pragma GCC diagnostic push
#pragma GCC diagnostic ignored "-Wconversion"
#endif
    const uint8_t neg_one = (uint8_t) -1, const_zero = (uint8_t) 0;
#ifdef __Pyx_HAS_GCC_DIAGNOSTIC
#pragma GCC diagnostic pop
#endif
    const int is_unsigned = neg_one > const_zero;
    if (is_unsigned) {
        if (sizeof(uint8_t) < sizeof(long)) {
            return PyLong_FromLong((long) value);
        } else if (sizeof(uint8_t) <= sizeof(unsigned long)) {
            return PyLong_FromUnsignedLong((unsigned long) value);
#if defined(HAVE_LONG_LONG) && !CYTHON_COMPILING_IN_PYPY
        } else if (sizeof(uint8_t) <= sizeof(unsigned PY_LONG_LONG)) {
            return PyLong_FromUnsignedLongLong((unsigned PY_LONG_LONG) value);
#endif
        }
    } else {
        if (sizeof(uint8_t) <= sizeof(long)) {
            return PyLong_FromLong((long) value);
#ifdef HAVE_LONG_LONG
        } else if (sizeof(uint8_t) <= sizeof(PY_LONG_LONG)) {
            return PyLong_FromLongLong((PY_LONG_LONG) value);
#endif
        }
    }
    {
        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(uint8_t),
                                     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(uint8_t));
        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 int64_t __Pyx_PyLong_As_int64_t(PyObject *x) {
#ifdef __Pyx_HAS_GCC_DIAGNOSTIC
#pragma GCC diagnostic push
#pragma GCC diagnostic ignored "-Wconversion"
#endif
    const int64_t neg_one = (int64_t) -1, const_zero = (int64_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))) {
        int64_t val;
        PyObject *tmp = __Pyx_PyNumber_Long(x);
        if (!tmp) return (int64_t) -1;
        val = __Pyx_PyLong_As_int64_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(int64_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(int64_t) > 1 * PyLong_SHIFT)) {
                        if ((8 * sizeof(unsigned long) > 2 * PyLong_SHIFT)) {
                            __PYX_VERIFY_RETURN_INT(int64_t, unsigned long, (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
                        } else if ((8 * sizeof(int64_t) >= 2 * PyLong_SHIFT)) {
                            return (int64_t) (((((int64_t)digits[1]) << PyLong_SHIFT) | (int64_t)digits[0]));
                        }
                    }
                    break;
                case 3:
                    if ((8 * sizeof(int64_t) > 2 * PyLong_SHIFT)) {
                        if ((8 * sizeof(unsigned long) > 3 * PyLong_SHIFT)) {
                            __PYX_VERIFY_RETURN_INT(int64_t, unsigned long, (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
                        } else if ((8 * sizeof(int64_t) >= 3 * PyLong_SHIFT)) {
                            return (int64_t) (((((((int64_t)digits[2]) << PyLong_SHIFT) | (int64_t)digits[1]) << PyLong_SHIFT) | (int64_t)digits[0]));
                        }
                    }
                    break;
                case 4:
                    if ((8 * sizeof(int64_t) > 3 * PyLong_SHIFT)) {
                        if ((8 * sizeof(unsigned long) > 4 * PyLong_SHIFT)) {
                            __PYX_VERIFY_RETURN_INT(int64_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(int64_t) >= 4 * PyLong_SHIFT)) {
                            return (int64_t) (((((((((int64_t)digits[3]) << PyLong_SHIFT) | (int64_t)digits[2]) << PyLong_SHIFT) | (int64_t)digits[1]) << PyLong_SHIFT) | (int64_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 (int64_t) -1;
            if (unlikely(result == 1))
                goto raise_neg_overflow;
        }
#endif
        if ((sizeof(int64_t) <= sizeof(unsigned long))) {
            __PYX_VERIFY_RETURN_INT_EXC(int64_t, unsigned long, PyLong_AsUnsignedLong(x))
#ifdef HAVE_LONG_LONG
        } else if ((sizeof(int64_t) <= sizeof(unsigned PY_LONG_LONG))) {
            __PYX_VERIFY_RETURN_INT_EXC(int64_t, unsigned PY_LONG_LONG, PyLong_AsUnsignedLongLong(x))
#endif
        }
    } else {
#if CYTHON_USE_PYLONG_INTERNALS
        if (__Pyx_PyLong_IsCompact(x)) {
            __PYX_VERIFY_RETURN_INT(int64_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(int64_t) - 1 > 1 * PyLong_SHIFT)) {
                        if ((8 * sizeof(unsigned long) > 2 * PyLong_SHIFT)) {
                            __PYX_VERIFY_RETURN_INT(int64_t, long, -(long) (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
                        } else if ((8 * sizeof(int64_t) - 1 > 2 * PyLong_SHIFT)) {
                            return (int64_t) (((int64_t)-1)*(((((int64_t)digits[1]) << PyLong_SHIFT) | (int64_t)digits[0])));
                        }
                    }
                    break;
                case 2:
                    if ((8 * sizeof(int64_t) > 1 * PyLong_SHIFT)) {
                        if ((8 * sizeof(unsigned long) > 2 * PyLong_SHIFT)) {
                            __PYX_VERIFY_RETURN_INT(int64_t, unsigned long, (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
                        } else if ((8 * sizeof(int64_t) - 1 > 2 * PyLong_SHIFT)) {
                            return (int64_t) ((((((int64_t)digits[1]) << PyLong_SHIFT) | (int64_t)digits[0])));
                        }
                    }
                    break;
                case -3:
                    if ((8 * sizeof(int64_t) - 1 > 2 * PyLong_SHIFT)) {
                        if ((8 * sizeof(unsigned long) > 3 * PyLong_SHIFT)) {
                            __PYX_VERIFY_RETURN_INT(int64_t, long, -(long) (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
                        } else if ((8 * sizeof(int64_t) - 1 > 3 * PyLong_SHIFT)) {
                            return (int64_t) (((int64_t)-1)*(((((((int64_t)digits[2]) << PyLong_SHIFT) | (int64_t)digits[1]) << PyLong_SHIFT) | (int64_t)digits[0])));
                        }
                    }
                    break;
                case 3:
                    if ((8 * sizeof(int64_t) > 2 * PyLong_SHIFT)) {
                        if ((8 * sizeof(unsigned long) > 3 * PyLong_SHIFT)) {
                            __PYX_VERIFY_RETURN_INT(int64_t, unsigned long, (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
                        } else if ((8 * sizeof(int64_t) - 1 > 3 * PyLong_SHIFT)) {
                            return (int64_t) ((((((((int64_t)digits[2]) << PyLong_SHIFT) | (int64_t)digits[1]) << PyLong_SHIFT) | (int64_t)digits[0])));
                        }
                    }
                    break;
                case -4:
                    if ((8 * sizeof(int64_t) - 1 > 3 * PyLong_SHIFT)) {
                        if ((8 * sizeof(unsigned long) > 4 * PyLong_SHIFT)) {
                            __PYX_VERIFY_RETURN_INT(int64_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(int64_t) - 1 > 4 * PyLong_SHIFT)) {
                            return (int64_t) (((int64_t)-1)*(((((((((int64_t)digits[3]) << PyLong_SHIFT) | (int64_t)digits[2]) << PyLong_SHIFT) | (int64_t)digits[1]) << PyLong_SHIFT) | (int64_t)digits[0])));
                        }
                    }
                    break;
                case 4:
                    if ((8 * sizeof(int64_t) > 3 * PyLong_SHIFT)) {
                        if ((8 * sizeof(unsigned long) > 4 * PyLong_SHIFT)) {
                            __PYX_VERIFY_RETURN_INT(int64_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(int64_t) - 1 > 4 * PyLong_SHIFT)) {
                            return (int64_t) ((((((((((int64_t)digits[3]) << PyLong_SHIFT) | (int64_t)digits[2]) << PyLong_SHIFT) | (int64_t)digits[1]) << PyLong_SHIFT) | (int64_t)digits[0])));
                        }
                    }
                    break;
            }
        }
#endif
        if ((sizeof(int64_t) <= sizeof(long))) {
            __PYX_VERIFY_RETURN_INT_EXC(int64_t, long, PyLong_AsLong(x))
#ifdef HAVE_LONG_LONG
        } else if ((sizeof(int64_t) <= sizeof(PY_LONG_LONG))) {
            __PYX_VERIFY_RETURN_INT_EXC(int64_t, PY_LONG_LONG, PyLong_AsLongLong(x))
#endif
        }
    }
    {
        int64_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 (int64_t) -1;
            assert(PyLong_CheckExact(v));
        }
        {
            int result = PyObject_RichCompareBool(v, Py_False, Py_LT);
            if (unlikely(result < 0)) {
                Py_DECREF(v);
                return (int64_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 (int64_t) -1;
        } else {
            stepval = v;
        }
        v = NULL;
        val = (int64_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(int64_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 |= ((int64_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(int64_t) * 8) - bits - (is_unsigned ? 0 : 1);
            if (unlikely(idigit >= (1L << remaining_bits)))
                goto raise_overflow;
            val |= ((int64_t) idigit) << bits;
        }
        if (!is_unsigned) {
            if (unlikely(val & (((int64_t) 1) << (sizeof(int64_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 (int64_t) -1;
        return val;
    }
raise_overflow:
    PyErr_SetString(PyExc_OverflowError,
        "value too large to convert to int64_t");
    return (int64_t) -1;
raise_neg_overflow:
    PyErr_SetString(PyExc_OverflowError,
        "can't convert negative value to int64_t");
    return (int64_t) -1;
}

/* CIntToPy */
static CYTHON_INLINE PyObject* __Pyx_PyLong_From_int64_t(int64_t value) {
#ifdef __Pyx_HAS_GCC_DIAGNOSTIC
#pragma GCC diagnostic push
#pragma GCC diagnostic ignored "-Wconversion"
#endif
    const int64_t neg_one = (int64_t) -1, const_zero = (int64_t) 0;
#ifdef __Pyx_HAS_GCC_DIAGNOSTIC
#pragma GCC diagnostic pop
#endif
    const int is_unsigned = neg_one > const_zero;
    if (is_unsigned) {
        if (sizeof(int64_t) < sizeof(long)) {
            return PyLong_FromLong((long) value);
        } else if (sizeof(int64_t) <= sizeof(unsigned long)) {
            return PyLong_FromUnsignedLong((unsigned long) value);
#if defined(HAVE_LONG_LONG) && !CYTHON_COMPILING_IN_PYPY
        } else if (sizeof(int64_t) <= sizeof(unsigned PY_LONG_LONG)) {
            return PyLong_FromUnsignedLongLong((unsigned PY_LONG_LONG) value);
#endif
        }
    } else {
        if (sizeof(int64_t) <= sizeof(long)) {
            return PyLong_FromLong((long) value);
#ifdef HAVE_LONG_LONG
        } else if (sizeof(int64_t) <= sizeof(PY_LONG_LONG)) {
            return PyLong_FromLongLong((PY_LONG_LONG) value);
#endif
        }
    }
    {
        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(int64_t),
                                     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(int64_t));
        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
    }
}

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

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

/* IterNextPlain */
#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
}

/* ReturnWithStopIteration */
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 */
#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};
                ret = __Pyx_PyObject_FastCall(meth, cargs+1, 3 | __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 (gen->gi_weakreflist != NULL)
        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;
}
static PyObject *
__Pyx__Coroutine_get_frame(__pyx_CoroutineObject *self)
{
#if !CYTHON_COMPILING_IN_LIMITED_API
    PyObject *frame;
    #if PY_VERSION_HEX >= 0x030d0000
    Py_BEGIN_CRITICAL_SECTION(self);
    #endif
    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);
    #if PY_VERSION_HEX >= 0x030d0000
    Py_END_CRITICAL_SECTION();
    #endif
    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
    gen->gi_weakreflist = NULL;
    Py_XINCREF(qualname);
    gen->gi_qualname = qualname;
    Py_XINCREF(name);
    gen->gi_name = name;
    Py_XINCREF(module_name);
    gen->gi_modulename = module_name;
    Py_XINCREF(code);
    gen->gi_code = code;
    gen->gi_frame = NULL;
    PyObject_GC_Track(gen);
    return gen;
}
static char __Pyx_Coroutine_test_and_set_is_running(__pyx_CoroutineObject *gen) {
    char result;
    #if PY_VERSION_HEX >= 0x030d0000 && !CYTHON_COMPILING_IN_LIMITED_API
    Py_BEGIN_CRITICAL_SECTION(gen);
    #endif
    result = gen->is_running;
    gen->is_running = 1;
    #if PY_VERSION_HEX >= 0x030d0000 && !CYTHON_COMPILING_IN_LIMITED_API
    Py_END_CRITICAL_SECTION();
    #endif
    return result;
}
static void __Pyx_Coroutine_unset_is_running(__pyx_CoroutineObject *gen) {
    #if PY_VERSION_HEX >= 0x030d0000 && !CYTHON_COMPILING_IN_LIMITED_API
    Py_BEGIN_CRITICAL_SECTION(gen);
    #endif
    assert(gen->is_running);
    gen->is_running = 0;
    #if PY_VERSION_HEX >= 0x030d0000 && !CYTHON_COMPILING_IN_LIMITED_API
    Py_END_CRITICAL_SECTION();
    #endif
}
static char __Pyx_Coroutine_get_is_running(__pyx_CoroutineObject *gen) {
    char result;
    #if PY_VERSION_HEX >= 0x030d0000 && !CYTHON_COMPILING_IN_LIMITED_API
    Py_BEGIN_CRITICAL_SECTION(gen);
    #endif
    result = gen->is_running;
    #if PY_VERSION_HEX >= 0x030d0000 && !CYTHON_COMPILING_IN_LIMITED_API
    Py_END_CRITICAL_SECTION();
    #endif
    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 */
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},
    {"__weaklistoffset__", T_PYSSIZET, offsetof(__pyx_CoroutineObject, gi_weakreflist), READONLY, 0},
    {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 >= 0x030A0000
    Py_TPFLAGS_IMMUTABLETYPE |
#endif
    Py_TPFLAGS_DEFAULT | Py_TPFLAGS_HAVE_GC | Py_TPFLAGS_HAVE_FINALIZE | __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;
}

/* GetRuntimeVersion */
static unsigned long __Pyx_get_runtime_version(void) {
#if __PYX_LIMITED_VERSION_HEX >= 0x030b0000
    return Py_Version & ~0xFFUL;
#else
    static unsigned long __Pyx_cached_runtime_version = 0;
    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;
    }
    return __Pyx_cached_runtime_version;
#endif
}

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

/* FunctionImport */
#ifndef __PYX_HAVE_RT_ImportFunction_3_1_2
#define __PYX_HAVE_RT_ImportFunction_3_1_2
static int __Pyx_ImportFunction_3_1_2(PyObject *module, const char *funcname, void (**f)(void), const char *sig) {
    PyObject *d = 0;
    PyObject *cobj = 0;
    union {
        void (*fp)(void);
        void *p;
    } tmp;
    d = PyObject_GetAttrString(module, "__pyx_capi__");
    if (!d)
        goto bad;
#if (defined(Py_LIMITED_API) && Py_LIMITED_API >= 0x030d0000) || (!defined(Py_LIMITED_API) && PY_VERSION_HEX >= 0x030d0000)
    PyDict_GetItemStringRef(d, funcname, &cobj);
#else
    cobj = PyDict_GetItemString(d, funcname);
    Py_XINCREF(cobj);
#endif
    if (!cobj) {
        PyErr_Format(PyExc_ImportError,
            "%.200s does not export expected C function %.200s",
                PyModule_GetName(module), funcname);
        goto bad;
    }
    if (!PyCapsule_IsValid(cobj, sig)) {
        PyErr_Format(PyExc_TypeError,
            "C function %.200s.%.200s has wrong signature (expected %.500s, got %.500s)",
             PyModule_GetName(module), funcname, sig, PyCapsule_GetName(cobj));
        goto bad;
    }
    tmp.p = PyCapsule_GetPointer(cobj, sig);
    *f = tmp.fp;
    if (!(*f))
        goto bad;
    Py_DECREF(d);
    Py_DECREF(cobj);
    return 0;
bad:
    Py_XDECREF(d);
    Py_XDECREF(cobj);
    return -1;
}
#endif

/* 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);
    return result;
  }
#elif PY_VERSION_HEX >= 0x030800B2 && !CYTHON_COMPILING_IN_PYPY
  #define __Pyx__PyCode_New(a, p, k, l, s, f, code, c, n, v, fv, cell, fn, name, fline, lnos)\
          PyCode_NewWithPosOnlyArgs(a, p, k, l, s, f, code, c, n, v, fv, cell, fn, name, fline, lnos)
#else
  #define __Pyx__PyCode_New(a, p, k, l, s, f, code, c, n, v, fv, cell, fn, name, fline, lnos)\
          PyCode_New(a, k, l, s, f, code, c, n, v, fv, cell, fn, name, fline, lnos)
#endif
static PyObject* __Pyx_PyCode_New(
        const __Pyx_PyCode_New_function_description descr,
        PyObject * const *varnames,
        PyObject *filename,
        PyObject *funcname,
        const char *line_table,
        PyObject *tuple_dedup_map
) {
    PyObject *code_obj = NULL, *varnames_tuple_dedup = NULL, *code_bytes = NULL, *line_table_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) {
        line_table_bytes = PyBytes_FromStringAndSize(line_table, descr.line_table_length);
        if (unlikely(!line_table_bytes)) goto done;
        Py_ssize_t code_len = (descr.line_table_length * 2 + 4) & ~3;
        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_bytes) ? line_table_bytes : __pyx_mstate_global->__pyx_empty_bytes
    );
done:
    Py_XDECREF(code_bytes);
    Py_XDECREF(line_table_bytes);
    #if CYTHON_AVOID_BORROWED_REFS
    Py_XDECREF(varnames_tuple_dedup);
    #endif
    Py_DECREF(varnames_tuple);
    return code_obj;
}

/* InitStrings */
static int __Pyx_InitStrings(__Pyx_StringTabEntry const *t, PyObject **target, const char* const* encoding_names) {
    while (t->s) {
        PyObject *str;
        if (t->is_unicode) {
            if (t->intern) {
                str = PyUnicode_InternFromString(t->s);
            } else if (t->encoding) {
                str = PyUnicode_Decode(t->s, t->n - 1, encoding_names[t->encoding], NULL);
            } else {
                str = PyUnicode_FromStringAndSize(t->s, t->n - 1);
            }
        } else {
            str = PyBytes_FromStringAndSize(t->s, t->n - 1);
        }
        if (!str)
            return -1;
        *target = str;
        if (PyObject_Hash(str) == -1)
            return -1;
        ++t;
        ++target;
    }
    return 0;
}

#include <string.h>
static CYTHON_INLINE Py_ssize_t __Pyx_ssize_strlen(const char *s) {
    size_t len = strlen(s);
    if (unlikely(len > (size_t) PY_SSIZE_T_MAX)) {
        PyErr_SetString(PyExc_OverflowError, "byte string is too long");
        return -1;
    }
    return (Py_ssize_t) len;
}
static CYTHON_INLINE PyObject* __Pyx_PyUnicode_FromString(const char* c_str) {
    Py_ssize_t len = __Pyx_ssize_strlen(c_str);
    if (unlikely(len < 0)) return NULL;
    return __Pyx_PyUnicode_FromStringAndSize(c_str, len);
}
static CYTHON_INLINE PyObject* __Pyx_PyByteArray_FromString(const char* c_str) {
    Py_ssize_t len = __Pyx_ssize_strlen(c_str);
    if (unlikely(len < 0)) return NULL;
    return PyByteArray_FromStringAndSize(c_str, len);
}
static CYTHON_INLINE const char* __Pyx_PyObject_AsString(PyObject* o) {
    Py_ssize_t ignore;
    return __Pyx_PyObject_AsStringAndSize(o, &ignore);
}
#if __PYX_DEFAULT_STRING_ENCODING_IS_ASCII || __PYX_DEFAULT_STRING_ENCODING_IS_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 b ? __Pyx_NewRef(Py_True) : __Pyx_NewRef(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 */
